public Oc5Runner(string oc5Source) { Oc5Source = oc5Source; var inputStream = new AntlrInputStream(oc5Source); var lexer = new Oc5Lexer(inputStream); var tokenStream = new CommonTokenStream(lexer); var parser = new Oc5Parser(tokenStream); var ocfileContext = parser.ocfile(); var visitor = new CompileVisitor(ocfileContext); Oc5Model = visitor.Oc5Model; Oc5ModelState = visitor.Oc5ModelState; }
private void Arrange(string input) { var inputStream = new AntlrInputStream(input); lexer = new Oc5Lexer(inputStream); var commonTokenStream = new CommonTokenStream(lexer); parser = new Oc5Parser(commonTokenStream); StringWriter writer = new StringWriter(); errorListener = new Oc5ErrorListener(writer); lexer.RemoveErrorListeners(); //lexer.addErrorListener(errorListener); parser.RemoveErrorListeners(); parser.AddErrorListener(errorListener); }