Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.CommonTree.toStringTree()


                    Method[] methods = _return.getDeclaredMethods();
                    for(Method method : methods) {
                      if ( method.getName().equals("getTree") ) {
                        Method returnName = _return.getMethod("getTree");
                          CommonTree tree = (CommonTree) returnName.invoke(ruleReturn);
                          astString = tree.toStringTree();
                      }
                      else if ( method.getName().equals("getTemplate") ) {
                        Method returnName = _return.getMethod("getTemplate");
                        StringTemplate st = (StringTemplate) returnName.invoke(ruleReturn);
                        stString = st.toString();
View Full Code Here


                    Method[] methods = _treeReturn.getDeclaredMethods();
                  for(Method method : methods) {
                      if ( method.getName().equals("getTree") ) {
                        Method treeReturnName = _treeReturn.getMethod("getTree");
                          CommonTree returnTree = (CommonTree) treeReturnName.invoke(treeRuleReturn);
                            astString = returnTree.toStringTree();
                      }
                      else if ( method.getName().equals("getTemplate") ) {
                        Method treeReturnName = _return.getMethod("getTemplate");
                        StringTemplate st = (StringTemplate) treeReturnName.invoke(treeRuleReturn);
                        stString = st.toString();
View Full Code Here

      final boolean debugEnabled = log.isDebugEnabled();
      for ( AstProcessor processor : processingChain ) {
        tree = processor.process( tokens, tree );

        if ( debugEnabled ) {
          log.debug( "Processed tree: " + tree.toStringTree() );
        }
      }

      return processingChain.getResult();
    }
View Full Code Here

      final boolean debugEnabled = log.isDebugEnabled();
      for ( AstProcessor processor : processingChain ) {
        tree = processor.process( tokens, tree );

        if ( debugEnabled ) {
          log.debug( "Processed tree: " + tree.toStringTree() );
        }
      }

      return processingChain.getResult();
    }
View Full Code Here

      if (parser.getNumberOfSyntaxErrors() > 0){
        ToolPlugin.showError(parser.getNumberOfSyntaxErrors() + " Syntax error in cursor " + getFile().getName() + "\n"
            + this.parseErrors.toString(), null);
      } else {
        CommonTree tree = (CommonTree) result.getTree();
        System.out.println(tree.toStringTree());
        CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
        nodes.setTokenStream(tokens);
        // TODO write a tree walker
        //      FortePRXTree walker = new FortePRXTree(this, nodes);
        //      walker.project();
View Full Code Here

                    Method[] methods = _return.getDeclaredMethods();
                    for(Method method : methods) {
                      if ( method.getName().equals("getTree") ) {
                        Method returnName = _return.getMethod("getTree");
                          CommonTree tree = (CommonTree) returnName.invoke(ruleReturn);
                          astString = tree.toStringTree();
                      }
                      else if ( method.getName().equals("getTemplate") ) {
                        Method returnName = _return.getMethod("getTemplate");
                        StringTemplate st = (StringTemplate) returnName.invoke(ruleReturn);
                        stString = st.toString();
View Full Code Here

                    Method[] methods = _treeReturn.getDeclaredMethods();
                  for(Method method : methods) {
                      if ( method.getName().equals("getTree") ) {
                        Method treeReturnName = _treeReturn.getMethod("getTree");
                          CommonTree returnTree = (CommonTree) treeReturnName.invoke(treeRuleReturn);
                            astString = returnTree.toStringTree();
                      }
                      else if ( method.getName().equals("getTemplate") ) {
                        Method treeReturnName = _return.getMethod("getTemplate");
                        StringTemplate st = (StringTemplate) treeReturnName.invoke(treeRuleReturn);
                        stString = st.toString();
View Full Code Here

  protected static final TreeAdaptor adaptor = new CommonTreeAdaptor();

  @Test public void testSingleNode() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("ID");
    String found = t.toStringTree();
    String expecting = "ID";
    assertEquals(expecting, found);
  }

  @Test public void testSingleNodeWithArg() throws Exception {
View Full Code Here

  }

  @Test public void testSingleNodeWithArg() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("ID[foo]");
    String found = t.toStringTree();
    String expecting = "foo";
    assertEquals(expecting, found);
  }

  @Test public void testSingleNodeTree() throws Exception {
View Full Code Here

  }

  @Test public void testSingleNodeTree() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A)");
    String found = t.toStringTree();
    String expecting = "A";
    assertEquals(expecting, found);
  }

  @Test public void testSingleLevelTree() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.