Exemplo n.º 1
0
        void ThrowParseException(TokenType type, string error_fmt, params object[] args)
        {
            if (!String.IsNullOrEmpty(error_fmt))
            {
                throw new ExpressionParseException(string.Format(error_fmt, args));
            }

            if (tokenizer.Token.Type == TokenType.EOF)
            {
                throw new ExpressionParseException(String.Format(
                                                       "Expected a \"{0}\" but the condition ended abruptly, while parsing condition \"{1}\"",
                                                       Token.TypeAsString(type), conditionStr));
            }

            throw new ExpressionParseException(String.Format(
                                                   "Expected \"{0}\" token,  but got {1}, while parsing \"{2}\"",
                                                   Token.TypeAsString(type), tokenizer.Token, conditionStr));
        }
Exemplo n.º 2
0
        // used to check current token type
        void IsAtToken(TokenType type, string error_msg)
        {
            if (tokenizer.Token.Type != type)
            {
                if (!String.IsNullOrEmpty(error_msg))
                {
                    throw new ExpressionParseException(error_msg);
                }

                if (tokenizer.Token.Type == TokenType.EOF)
                {
                    throw new ExpressionParseException(String.Format(
                                                           "Expected a \"{0}\" but the condition ended abruptly, while parsing condition \"{1}\"",
                                                           Token.TypeAsString(type), conditionStr));
                }

                throw new ExpressionParseException(String.Format(
                                                       "Expected \"{0}\" token,  but got {1}, while parsing \"{2}\"",
                                                       Token.TypeAsString(type), tokenizer.Token, conditionStr));
            }
        }