[antlr-interest] CommonTreeAdaptor subclass

Rampon Jerome ramponjerome at yahoo.fr
Tue Mar 27 04:58:02 PDT 2012


For info, based on recent experiments with 3.4 (I did not find feedbacks
on this, reason of my post)

If anyone interested in subclassing CommonTreeAdaptor as described in
The Definitive ANTLR reference (7.2 - pp 170)
to get his own CommonTree nodes created in AST via its own adaptor.

it seems to me that create method has to be subclassed in new 

CommonTree extent as described

but also dupNode and 

constructor with self-node parameter
to get a clean final AST (as called in CommonTreeAdaptor)

  public MyNewCommonTree(MyNewCommonTree node) {
  public Tree dupNode() {
    return new MyNewCommonTree(this);

For documentation update possibly ...



More information about the antlr-interest mailing list