[antlr-interest] Using previously matched parser rule in decision making
Jim Idle
jimi at temporal-wave.com
Mon Mar 8 07:48:35 PST 2010
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Gokulakannan Somasundaram
> Sent: Sunday, March 07, 2010 10:56 PM
> To: Kieran Simpson
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Using previously matched parser rule in
> decision making
>
> What Jim is suggesting is something like this
>
> ruleA: ruleB[true];
>
> ruleD: ruleB[false];
>
> ruleB[boolean isRuleA]:
> {isRuleA}? .....
> | .....
> ;
>
> Usage of semantic predicates.
No - he asked to just know what rule it came from - I presume to test in action code. To use as a predicate it would have to be in a scope as otherwise the predicate may be hoisted out of scope of the local rule code.
Jim
More information about the antlr-interest
mailing list