public void VisitLine(String line) { Core interp_visitor = new Core(); PrintVisitor print_visitor = new PrintVisitor(interp_visitor); ANTLRStringStream string_stream = new ANTLRStringStream(line); spinachLexer lexer = new spinachLexer(string_stream); CommonTokenStream tokens = new CommonTokenStream(lexer); spinachParser parser = new Test_Core(tokens, ""); try { spinachParser.program_return program = parser.program(); //h= (l+j)*h*l+l-h; if (strBuilder.ToString() == "") { List<Element> elements = program.ret; ///-- call core function. to pass list of element. for (int i = 0; i < elements.Count; i++) { Element curr = elements[i]; curr.Accept(print_visitor); curr.Accept(interp_visitor);//PlotReceiver } } else { Onerror(101, strBuilder.ToString()); } } catch (RecognitionException e) { Onerror(102, e.Message); } }
public void Visitline(string args) { CommonTokenStream str = new CommonTokenStream(); //We need the syntax for the core object Test_Core myprog = new Test_Core(str, ""); myprog.error += new Test_Core.errorreport(Onerror); myprog.VisitLine(args); }