[antlr-interest] Gated semantic predicates behaving like validating predicates
Jim Idle
jimi at temporal-wave.com
Sun Feb 3 08:14:32 PST 2008
Actually you are probably better matching the token letters that overlap
in one rule, then changing the type in an action afterwards. Otherwise
you are specifying the same sequence over and over again and duplicate
the predicate and its converse and so on.
Jim
> -----Original Message-----
> From: Steve Bennett [mailto:stevagewp at gmail.com]
> Sent: Sunday, February 03, 2008 6:39 AM
> To: antlr-interest
> Subject: Re: [antlr-interest] Gated semantic predicates behaving like
> validating predicates
>
> Dammit, I found the error. I didn't realise (or forgot) that gated
> predicates apply at the subrule level, not just the rule level.
>
> ESCAPED_PUNC : {this.in_noparse}? => ('#' | '*' | ':' | ';' | '|'
> | '[' | ']' | '=' | '/');
>
> is correct.
>
> ESCAPED_PUNC : {this.in_noparse}? => '#' | '*' | ':' | ';' | '|' |
> '[' | ']' | '=' | '/';
>
> is incorrect.
>
> Ouch. What a lot of time spent on what turned out to be missing
> parentheses.
>
> I have also learnt that this kind of construct is incorrect:
>
> FOO: {flag}? => 'X';
> UNFOO: 'X';
>
> You need to specify the reverse semantic predicate.
>
> Anyway, thanks for listening everyone, you've been very supportive :)
>
> Steve
More information about the antlr-interest
mailing list