[antlr-interest] AST node creation
Bill Andersen
andersen at ontologyworks.com
Mon Feb 18 06:34:43 PST 2008
I've been trying the example on p 170 of the ANTLR reference, with a
small tweak. I have a tree-generating grammar ( output=AST is set }
name
: NAME
-> { new CommonTree(new CommonToken(NAME, "Fred")) }
| BLANK_NAME
;
meant to convert any NAMEs seen to "Fred". When I run the parser and
print the AST I don't see any Fred NAMEs, even though the test input
hits this production plenty.
Running the code thru the debugger shows the relevant code
root_0 = (Object)adaptor.nil();
// 102:3: ->
{
adaptor.addChild(root_0, new CommonTree(new CommonToken(NAME,
"Fred")) );
}
is being executed. Am I missing anything?
.bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080218/b8674975/attachment.html
More information about the antlr-interest
mailing list