[antlr-interest] Stangeness in example java grammar

mzukowski at bco.com mzukowski at bco.com
Tue Mar 12 09:19:44 PST 2002


You are exactly right.  Having the finallyHandler rule is the right way to
do it.

Monty

-----Original Message-----
From: Sander Mägi [mailto:sander at aqris.com]
Sent: Tuesday, March 12, 2002 9:16 AM
To: ANTLR
Subject: [antlr-interest] Stangeness in example java grammar


Hi
 
Example java grammar had (an unintentional?) strangness:
 
Can anybody please say if it was intentional and what were the reasons?
 
The 'try' rule
<RULE>
tryBlock
 : "try"^ compoundStatement
  (handler)*
  ( "finally"^ compoundStatement )?
 ;
</RULE>
 
When finally is present, then finally is set as a root node and try is it's
child.
 
Perhaps more logical would be?
<RULE>
tryBlock
 : "try"^ compoundStatement
  (handler)*
  ( finallyHandler )?
 ;
 
finallyHandler
 : "finally"^ compoundStatement
 ;
</RULE>
 
br,
Sander

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list