[antlr-interest] Skip subtree with gated semantic predicate in tree parser - need help
fridi
fridi70 at gmx.de
Tue Mar 2 00:30:00 PST 2010
Hi all,
I tried to skip a rule in an if-then-else construct using gated symantic
predicates.
This works well until the subrule itself is a tree (i.e. a nested
if-then-else), and this tree should be skipped if the expression returns false.
So it seems, that the '.' does not match the whole subtree? I get this error:
Eval.g: node from after line 1:21 no viable alternative at input 'DOWN
Thanks for any hint, fridi
ifElse
scope {
boolean expResult;
} :
^(
IFTHEN b = expression { $ifElse::expResult = b; }
(
{$ifElse::expResult == true}?=> actionSequence
| . // if expResult == false, no action required but eat the token
)
)
;
(full grammar see attachments)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Eval.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20100302/186b9e68/attachment.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Simple.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20100302/186b9e68/attachment-0001.pl
More information about the antlr-interest
mailing list