public static void doTreeAction(string f, AST t, string[] tokenNames) { if (t == null) { return; } if (showTree) { BaseAST.setVerboseStringConversion(true, tokenNames); ASTFactory factory = new ASTFactory(); AST r = factory.create(0, "AST ROOT"); r.setFirstChild(t); ASTFrame frame = new ASTFrame("Java AST", r); frame.ShowDialog(); //frame.Visible = true; // System.out.println(t.toStringList()); } JavaTreeParser tparse = new JavaTreeParser(); JavaRecognizer.initializeASTFactory(tparse.getASTFactory()); try { tparse.compilationUnit(t); // System.out.println("successful walk of result AST for "+f); } catch (RecognitionException e) { Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); } }
public static void doTreeAction(string f, AST t, string[] tokenNames) { if (t == null) return ; if (showTree) { BaseAST.setVerboseStringConversion(true, tokenNames); ASTFactory factory = new ASTFactory(); AST r = factory.create(0, "AST ROOT"); r.setFirstChild(t); ASTFrame frame = new ASTFrame("Java AST", r); frame.ShowDialog(); //frame.Visible = true; // System.out.println(t.toStringList()); } JavaTreeParser tparse = new JavaTreeParser(); try { tparse.compilationUnit(t); // System.out.println("successful walk of result AST for "+f); } catch (RecognitionException e) { Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); } }