[antlr-interest] Semantic predicates in v4 lexer rules

Terence Parr parrt at cs.usfca.edu
Mon Jan 23 10:39:40 PST 2012


ooops. I removed actions from anywhere except the right-hand side but forgot to leave in predicates.

 adding to the list.
Ter
On Jan 23, 2012, at 10:31 AM, A Z wrote:

> Can we still use sementic predicates in lexer rules using v4? The following
> code works in 3.4 but 4.0ea complains with
> 
> error(15): TestLexer.g:484:29: '{keywords == true}?' came as a complete
> surprise to me while looking for lexer rule element
> 
> 
> K_IF                       : {keywords == true}? => 'if';
> K_INT                      : {keywords == true}? => 'int';
> 
> 
> The language I'm using allows changing the keyword set via preprocessor
> directives so all the keywords need to test a variable at runtime. Is there
> another way to do this in v4?
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list