Example #1
0
        private void ProcessBrackets()
        {
            if (tokenizer.EOF())
            {
                return;
            }
            var tok = tokenizer.Peek();

            if (!IsBracket())
            {
                return;
            }
            // We don't need to deal with the CLOSE_ALL bracket here
            // The CLOSE_ALL bracket is dealt with in ParseExpression
            if (tok.Value == CLOSE_ALL.ToString())
            {
                return;
            }
            if (bracket == -1)
            {
                bracket = BRACKETS.IndexOf(tokenizer.Peek().Value);
            }
            else
            {
                bracket--;
            }
            if (bracket == 0)
            {
                tokenizer.Next();
                bracket = -1;
            }
        }
Example #2
0
        private bool IsBracket()
        {
            if (tokenizer.EOF())
            {
                return(false);
            }
            var tok = tokenizer.Peek();

            return(tok.Type == TokenType.Punctuation && (BRACKETS.Contains(tok.Value) || CLOSE_ALL.ToString() == tok.Value));
        }