[antlr-interest] Antlr3b6 [bug?] Can't find template matchSetTrack.st
David Holroyd
dave at badgers-in-foil.co.uk
Sun Apr 15 07:19:03 PDT 2007
On Sun, Apr 15, 2007 at 08:17:21PM +0800, femto gary wrote:
> for the following grammar, antlr reports error:
> Can't find template matchSetTrack.st
> doing a google search reveals somebody has also this problem:
> http://www.antlr.org/pipermail/antlr-interest/2007-January/019038.html,
> is this an antlr3b6 bug?
I can't say for sure which parser rule is causing the error, but this
looks a bit suspicious,
> if_expression
> : 'if' b=boolean_expression ('then'|':'|LINE_BREAK)
> body0=body ('elsif' b1=boolean_expression
> ('then'|':'|LINE_BREAK) body1+=body)*
> ('else' body2=body)?
> 'end' -> ^(IF $b $body0 $b1* $body1* $body2? )
> ;
simply because if I recall correctly, the construction
(... b1=boolean_expression ...)*
will overwrite b1 each time that ()* subrule matches, so that only the
last boolean_expression matched will appear in the result tree. Might
be better for you to create a new rule to build the "elsif" subtree.
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list