Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            // Create the tree nodes
            ASTFactory factory = new ASTFactory();
            CommonAST  r       = (CommonAST)factory.create(0, "ROOT");

            r.addChild((CommonAST)factory.create(0, "C1"));
            r.addChild((CommonAST)factory.create(0, "C2"));
            r.addChild((CommonAST)factory.create(0, "C3"));

            ASTFrame frame = new ASTFrame("AST JTree Example", r);

            Application.Run(frame);
        }
Exemplo n.º 4
0
		public static void Main(string[] args)
		{
			// Create the tree nodes
			ASTFactory factory = new ASTFactory();
			CommonAST r = (CommonAST) factory.create(0, "ROOT");
			r.addChild((CommonAST) factory.create(0, "C1"));
			r.addChild((CommonAST) factory.create(0, "C2"));
			r.addChild((CommonAST) factory.create(0, "C3"));
			
			ASTFrame frame = new ASTFrame("AST JTree Example", r);
			Application.Run(frame);
		}