[antlr-interest] java.g: setting CommonAST.text vs. adding a child
Martin d Anjou
point14 at magma.ca
Tue Apr 19 19:23:44 PDT 2005
Hello,
I see that in the java.g grammar classDefinition production, the class
name (an IDENT) is built as a child of the classDefinition tree.
Why isn't the text of the classDefinition AST node set to the class name
IDENT instead? What is the advantage of adding a child with the class
name instead of setting the text property to the value of IDENT?
Here is the snippet I am talking about with IDENT as the second child:
classDefinition![AST modifiers]
: "class" IDENT
// it _might_ have a superclass...
sc:superClassClause
// it might implement some interfaces...
ic:implementsClause
// now parse the body of the class
cb:classBlock
{#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],modifiers,IDENT,sc,ic,cb);}
;
Thanks!
Martin
More information about the antlr-interest
mailing list