[antlr-interest] Excluding words as tokens

Micha micha-1 at fantasymail.de
Fri May 22 04:01:17 PDT 2009


On Friday 22 May 2009 11:07:55 schlpbch at gmx.ch wrote:
> Dear all
>
> I'm trying to write a grammar to check the correctness of package names in
> respect to our meta modell. Thereby I ran into to following problems:
>

use syntactic predicates or/and action in lexer rules to change the type of 
the tokens:

COMPONENTNAME:
	LOWERCASE+ DIGIT* { if ($text.equal("model")) $type = MODEL; .... }

with syntactic predicates and actions you can resolve many conflicts.

 Michael



More information about the antlr-interest mailing list