Examples of toStringTree()


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

  }

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

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

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

  }

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

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

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

  }

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

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

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

    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B[T__32] (C (D E[a])))");
    // C pattern has no text arg so despite [bar] in t, no need
    // to match text--check structure only.
    boolean valid = wiz.parse(t, "(A B[foo] C)");
    assertEquals("(A T__32 (C (D a)))", t.toStringTree());
  }

  @Test public void testParseWithTextFails() throws Exception {
    TreeWizard wiz = new TreeWizard(adaptor, tokens);
    CommonTree t = (CommonTree)wiz.create("(A B C)");
View Full Code Here

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

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

                    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

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

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

                    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

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

      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

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

      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
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.