private Expression ParseGroup(StyleSyntaxTokenizer tokenizer)
        {
            StyleSyntaxToken current = tokenizer.current;
            bool             flag    = current.type != StyleSyntaxTokenType.OpenBracket;

            if (flag)
            {
                throw new Exception(string.Format("Unexpected token '{0}' in group expression. Expected '[' token", current.type));
            }
            this.m_CombinatorStack.Push(ExpressionCombinator.Group);
            tokenizer.MoveNext();
            StyleSyntaxParser.EatSpace(tokenizer);
            Expression expression = this.ParseExpression(tokenizer);

            current = tokenizer.current;
            bool flag2 = current.type != StyleSyntaxTokenType.CloseBracket;

            if (flag2)
            {
                throw new Exception(string.Format("Unexpected token '{0}' in group expression. Expected ']' token", current.type));
            }
            tokenizer.MoveNext();
            Expression expression2 = new Expression(ExpressionType.Combinator);

            expression2.combinator     = ExpressionCombinator.Group;
            expression2.subExpressions = new Expression[]
            {
                expression
            };
            this.ParseMultiplier(tokenizer, ref expression2.multiplier);
            return(expression2);
        }
        private Expression ParseExpression(StyleSyntaxTokenizer tokenizer)
        {
            StyleSyntaxToken current = tokenizer.current;

            while (!StyleSyntaxParser.IsExpressionEnd(current))
            {
                bool       flag = current.type == StyleSyntaxTokenType.String || current.type == StyleSyntaxTokenType.LessThan;
                Expression item;
                if (flag)
                {
                    item = this.ParseTerm(tokenizer);
                }
                else
                {
                    bool flag2 = current.type == StyleSyntaxTokenType.OpenBracket;
                    if (!flag2)
                    {
                        throw new Exception(string.Format("Unexpected token '{0}' in expression", current.type));
                    }
                    item = this.ParseGroup(tokenizer);
                }
                this.m_ExpressionStack.Push(item);
                ExpressionCombinator expressionCombinator = this.ParseCombinatorType(tokenizer);
                bool flag3 = expressionCombinator > ExpressionCombinator.None;
                if (flag3)
                {
                    bool flag4 = this.m_CombinatorStack.Count > 0;
                    if (flag4)
                    {
                        ExpressionCombinator expressionCombinator2 = this.m_CombinatorStack.Peek();
                        int num  = (int)expressionCombinator2;
                        int num2 = (int)expressionCombinator;
                        while (num > num2 && expressionCombinator2 != ExpressionCombinator.Group)
                        {
                            this.ProcessCombinatorStack();
                            expressionCombinator2 = ((this.m_CombinatorStack.Count > 0) ? this.m_CombinatorStack.Peek() : ExpressionCombinator.None);
                            num = (int)expressionCombinator2;
                        }
                    }
                    this.m_CombinatorStack.Push(expressionCombinator);
                }
                current = tokenizer.current;
            }
            while (this.m_CombinatorStack.Count > 0)
            {
                ExpressionCombinator expressionCombinator3 = this.m_CombinatorStack.Peek();
                bool flag5 = expressionCombinator3 == ExpressionCombinator.Group;
                if (flag5)
                {
                    this.m_CombinatorStack.Pop();
                    break;
                }
                this.ProcessCombinatorStack();
            }
            return(this.m_ExpressionStack.Pop());
        }
        private void ParseMultiplier(StyleSyntaxTokenizer tokenizer, ref ExpressionMultiplier multiplier)
        {
            StyleSyntaxToken styleSyntaxToken = tokenizer.current;
            bool             flag             = StyleSyntaxParser.IsMultiplier(styleSyntaxToken);

            if (flag)
            {
                switch (styleSyntaxToken.type)
                {
                case StyleSyntaxTokenType.Asterisk:
                    multiplier.type = ExpressionMultiplierType.ZeroOrMore;
                    goto IL_A1;

                case StyleSyntaxTokenType.Plus:
                    multiplier.type = ExpressionMultiplierType.OneOrMore;
                    goto IL_A1;

                case StyleSyntaxTokenType.QuestionMark:
                    multiplier.type = ExpressionMultiplierType.ZeroOrOne;
                    goto IL_A1;

                case StyleSyntaxTokenType.HashMark:
                    multiplier.type = ExpressionMultiplierType.OneOrMoreComma;
                    goto IL_A1;

                case StyleSyntaxTokenType.ExclamationPoint:
                    multiplier.type = ExpressionMultiplierType.GroupAtLeastOne;
                    goto IL_A1;

                case StyleSyntaxTokenType.OpenBrace:
                    multiplier.type = ExpressionMultiplierType.Ranges;
                    goto IL_A1;
                }
                throw new Exception(string.Format("Unexpected token '{0}' in expression. Expected multiplier token", styleSyntaxToken.type));
IL_A1:
                styleSyntaxToken = tokenizer.MoveNext();
            }
            bool flag2 = multiplier.type == ExpressionMultiplierType.Ranges;

            if (flag2)
            {
                this.ParseRanges(tokenizer, out multiplier.min, out multiplier.max);
            }
        }
        private ExpressionCombinator ParseCombinatorType(StyleSyntaxTokenizer tokenizer)
        {
            ExpressionCombinator expressionCombinator = ExpressionCombinator.None;
            StyleSyntaxToken     styleSyntaxToken     = tokenizer.current;

            while (!StyleSyntaxParser.IsExpressionEnd(styleSyntaxToken) && expressionCombinator == ExpressionCombinator.None)
            {
                StyleSyntaxToken styleSyntaxToken2 = tokenizer.PeekNext();
                switch (styleSyntaxToken.type)
                {
                case StyleSyntaxTokenType.Space:
                {
                    bool flag = !StyleSyntaxParser.IsCombinator(styleSyntaxToken2) && styleSyntaxToken2.type != StyleSyntaxTokenType.CloseBracket;
                    if (flag)
                    {
                        expressionCombinator = ExpressionCombinator.Juxtaposition;
                    }
                    break;
                }

                case StyleSyntaxTokenType.SingleBar:
                    expressionCombinator = ExpressionCombinator.Or;
                    break;

                case StyleSyntaxTokenType.DoubleBar:
                    expressionCombinator = ExpressionCombinator.OrOr;
                    break;

                case StyleSyntaxTokenType.DoubleAmpersand:
                    expressionCombinator = ExpressionCombinator.AndAnd;
                    break;

                default:
                    throw new Exception(string.Format("Unexpected token '{0}' in expression. Expected combinator token", styleSyntaxToken.type));
                }
                styleSyntaxToken = tokenizer.MoveNext();
            }
            StyleSyntaxParser.EatSpace(tokenizer);
            return(expressionCombinator);
        }