At 04:08 4/11/2008, Hendrik Maryns wrote:
>This looks promising to solve my problem as well (see other
>threads).
>Could you explain further what the line
> : (A) => A { $type = A; }
>does? I crawled the site for an explanation of "=>" but
>couldn't find more than "semantic predicate" and "always
>execute predicate".
It's called a "syntactic predicate". Basically the fragment in
parentheses before the => is evaluated as lookahead, and only if
the entire thing is present does it enter the block to the right
of the =>. It's a way of forcing explicit lookahead.
Normally, you want to avoid putting loops (*/+) into the lookahead
(since they're usually just a waste of time -- but not always), so
it's more common to inline the rule rather than put it verbatim on
both sides as above. But in this case it's a simple sequence rule
so it should be ok.
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---