public static WildcardExpression Parse(string value, bool add_asterisks, ref string error)
        {
            List <string>      arg_13_0           = WildcardExpression.ParseTokens(value);
            WildcardExpression wildcardExpression = new WildcardExpression();
            int num = 0;

            if (!WildcardExpression.ParseExpression(arg_13_0, wildcardExpression, ref num, add_asterisks, ref error))
            {
                error = "error parsing string, defaulting to initial value";
                wildcardExpression.m_Wildcard = new Wildcard(value);
            }
            return(wildcardExpression);
        }
        private static bool ParseExpression(List <string> tokens, WildcardExpression expression, ref int index, bool add_asterisks, ref string error)
        {
            if (index == tokens.Count)
            {
                return(true);
            }
            int num = index;

            index = num + 1;
            string text = tokens[num];
            string a    = text.ToLower();

            if (index == tokens.Count || tokens[index] == ")")
            {
                if (index != tokens.Count)
                {
                    index++;
                }
                if (add_asterisks)
                {
                    text = WildcardExpression.AddAsterisks(text);
                }
                expression.m_Wildcard = new Wildcard(text);
                return(true);
            }
            WildcardExpression wildcardExpression = new WildcardExpression();

            if (text == "(")
            {
                if (!WildcardExpression.ParseExpression(tokens, wildcardExpression, ref index, add_asterisks, ref error))
                {
                    return(false);
                }
            }
            else
            {
                if (text == "&&" || text == "||" || a == "and" || a == "or")
                {
                    error = "Unexpected conditional token";
                    return(false);
                }
                if (add_asterisks)
                {
                    text = WildcardExpression.AddAsterisks(text);
                }
                wildcardExpression.m_Wildcard = new Wildcard(WildcardExpression.AddAsterisks(text));
            }
            expression.m_Exp1 = wildcardExpression;
            if (index == tokens.Count)
            {
                return(true);
            }
            num   = index;
            index = num + 1;
            text  = tokens[num];
            if (text == ")")
            {
                return(true);
            }
            string a2 = text.ToLower();

            if (!(a2 == "&&") && !(a2 == "and"))
            {
                if (!(a2 == "||") && !(a2 == "or"))
                {
                    error = "Unexpected token " + text;
                    return(false);
                }
                expression.m_Operator = WildcardExpression.Operator.Or;
            }
            else
            {
                expression.m_Operator = WildcardExpression.Operator.And;
            }
            WildcardExpression wildcardExpression2 = new WildcardExpression();

            if (!WildcardExpression.ParseExpression(tokens, wildcardExpression2, ref index, add_asterisks, ref error))
            {
                return(false);
            }
            expression.m_Exp2 = wildcardExpression2;
            return(true);
        }