[antlr-interest] Selectively disabling lexer rules

Terence Parr parrt at cs.usfca.edu
Tue Jan 3 11:44:17 PST 2006


On Jan 2, 2006, at 6:50 PM, Martin Traverso wrote:

> Hmm...I wonder if you try the other way:
>
> CHAR_LIT : {Character.isIdentifierChar(input.LA (3))}? '?' ~' ' ;
>
> QUESTION : '?' ;
>
>
> I guess you meant !Character.isIdentifierChar(...), right?
>
> But anyway, that won't prevent CHAR_LIT from matching in the  
> expression "a ?b : c", will it?

Oh, right.  Crap.  So, the enclosing syntax dictates the answer?  Ok,  
Bryan is right then...you should use something in the parser.

Ter


More information about the antlr-interest mailing list