Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    /** An adaptor that tells ANTLR to build CymbalAST nodes */
    public static TreeAdaptor astAdaptor = new CommonTreeAdaptor() {
        public Object create(Token token) { return new GrammarAST(token); }
        public Object dupNode(Object t) {
            if ( t==null ) return null;
            return create(((GrammarAST)t).token);
        }
        public Object errorNode(TokenStream input, Token start, Token stop,
                                RecognitionException e)
        {
            return new GrammarASTErrorNode(input, start, stop, e);
        }
    };

If using a buffered stream, send into ctor:

Code Block

        BufferedTreeNodeStream nodes = new BufferedTreeNodeStream(astAdaptor,myRootNode);