public static QuestionForm ParseInputString(string input) { ICharStream stream = CharStreams.fromstring(input); ITokenSource lexer = new QLLexer(stream); ITokenStream tokens = new CommonTokenStream(lexer); QLParser parser = new QLParser(tokens); QLParser.FContext context = parser.f(); QLListener listener = new QLListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.Walk(listener, context); return(listener.Form); }
public void ControlBlockChildrenAssignment() { string input = @"form ExampleBlock { if (3==-11){} else { if (3==12) {} else {}; }; } "; Build(input); Listener = new QLListener(); Parser.AddParseListener(Listener); var formBlock = Parser.formBlock(); Assert.IsTrue(Listener.ASTExists); }