[antlr-interest] Changing Token Names

"Paul Bouché (NSN)" paul.bouche at nsn.com
Wed Apr 1 02:27:08 PDT 2009


Hi,

I would like to change the token names for error display.

I used have this:
value : simpleValue | '{' property '}';
where a token type for the curly braces was created by ANTLR (T_XXX), 
but if it was missing then in the error message a '{' was generated 
because for that token in the Java target tokenNames contained a '{'.
Now I needed to create tokens for the brackets, but I would still like 
the tokenName display as '{'. I solve this now by a static initializer 
which alters the tokenNames array - this is kind of a hack - is there 
another way? In ANTLR v2 there was the paraphrase option?

Thanks,
Paul

-- 
Paul Bouché
Voice: +49 30 590080-1284
 
Nokia Siemens Networks GmbH & Co. KG, An den Treptowers 1, 12435 Berlin, Germany
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304

Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416



More information about the antlr-interest mailing list