public static IQueryValue ParseValue(IEnvironment env, ICharStream input) { IQLangLexer lexer = new IQLangLexer(input); lexer.RemoveErrorListeners(); lexer.AddErrorListener(LexerErrorListener.Instance); CommonTokenStream tokenStream = new CommonTokenStream(lexer); IQLangParser parser = new IQLangParser(tokenStream); parser.RemoveErrorListeners(); parser.AddErrorListener(ParserErrorListener.Instance); return parser.value().expr.Evaluate(env); }
public static IQueryStatement[] Parse(ICharStream input) { IQLangLexer lexer = new IQLangLexer(input); lexer.RemoveErrorListeners(); lexer.AddErrorListener(LexerErrorListener.Instance); CommonTokenStream tokenStream = new CommonTokenStream(lexer); IQLangParser parser = new IQLangParser(tokenStream); parser.RemoveErrorListeners(); parser.AddErrorListener(ParserErrorListener.Instance); return parser.compileUnit().list.ToArray(); }