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 line){ ANTLRStringStream string_stream = new ANTLRStringStream(line); spinachLexer lexer = new spinachLexer(string_stream); CommonTokenStream tokens = new CommonTokenStream(lexer); spinachParser parser = new spinachParser(tokens); try { spinachParser.program_return program = parser.program(); List<Element> elements = program.ret; for(int i = 0; i < elements.Count; i++){ Element curr = elements[i]; curr.Accept(print_visitor); //curr.Accept(interp_visitor); } } catch (RecognitionException e) { Console.WriteLine(e.Message); } }