internal static QLListener ParseString(string input) { ICharStream stream = CharStreams.fromstring(input); ITokenSource lexer = new QLLexer(stream); ITokenStream tokens = new CommonTokenStream(lexer); QL parser = new QL(tokens); QL.FormContext context = parser.form(); QLListener listener = new QLListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.Walk(listener, context); return(listener); }
public Presenter() { var listener = QLListener.ParseString(System.IO.File.ReadAllText("test.txt")); if (listener.FormHasErrors) { ReportFormErrors(listener.Errors); } else { _form = listener.Form; UpdateControls(); } }