Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.TreeVisitor


     *
     *  Parameter must be a token.
     *  todo: do we want?
     */
    public void expandParameterizedLoops(GrammarAST root) {
        TreeVisitor v = new TreeVisitor(new GrammarASTAdaptor());
        v.visit(root, new TreeVisitorAction() {
            @Override
            public Object pre(Object t) {
                if ( ((GrammarAST)t).getType() == 3 ) {
                    return expandParameterizedLoop((GrammarAST)t);
                }
View Full Code Here


    /** Utility visitor that sets grammar ptr in each node */
  public static void setGrammarPtr(final Grammar g, GrammarAST tree) {
    if ( tree==null ) return;
    // ensure each node has pointer to surrounding grammar
    TreeVisitor v = new TreeVisitor(new GrammarASTAdaptor());
    v.visit(tree, new TreeVisitorAction() {
      @Override
      public Object pre(Object t) { ((GrammarAST)t).g = g; return t; }
      @Override
      public Object post(Object t) { return t; }
    });
View Full Code Here

          @Override
          public Object post(Object t) {
            return t;
          }
        };
        new TreeVisitor(ParseDriver.adaptor).visit(havingExpr, action);

        if (aliasReferences.size() > 0) {
          String havingClause = SemanticAnalyzer.this.ctx
              .getTokenRewriteStream().toString(
                  havingExpr.getTokenStartIndex(),
View Full Code Here

    return numberOfOnChannelTokens - 1;
  }

  private static int countAllTreeTokens(CommonTokenStream tokens, CommonTree tree) {
    CountNodesAction action = new CountNodesAction(tokens);
    TreeVisitor visitor = new TreeVisitor();
    visitor.visit(tree, action);
    return action.getCount();
  }
View Full Code Here

TOP

Related Classes of org.antlr.runtime.tree.TreeVisitor

Copyright © 2018 www.massapicom. 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.