[antlr-interest] Not generating parts of AST (argh!)
Paul J. Lucas
pauljlucas at mac.com
Sun Oct 24 20:32:21 PDT 2004
On Sun, 24 Oct 2004, Monty Zukowski wrote:
> Try -traceParser when you run antlr.tool. What tree is mulExpr
> returninng?
Exactly what it should. After yet more time spent in the
debugger, I discovered that I had a rule like this as its
parent:
comparisonExpr!
{
boolean gotR2 = false;
}
: re1:rangeExpr
(co:comparisonOp re2:rangeExpr { gotR2 = true; })?
{
if ( gotR2 )
#comparisonExpr = #(co, re1, re2)
else
#comparisonExpr = #(re1); // <-- bug
}
;
The "bug" line should read:
#comparisonExpr = #re1; // no ()
Damn parentheses! Anyway, is there a simpler way to do the
above (without the boolean gotR2 flag)?
- Paul
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list