[antlr-interest] action syntax

brian bsl04 at uark.edu
Tue Nov 22 23:36:42 PST 2005


If I do
type:("char"|"int") name:IDENTIFIER
{ do something with 'type' and 'name' }
in the parser, ANTLR tells me there's no variable 'type'.

If I make TYPE:"char"|"int"; in the lexer and say type:TYPE instead in
the parser and try to parse some sensible data, I always get "unexpected
token: char" or "unexpected token: int" as if it doesn't see I said to
expect TYPE and that I wanted to refer to it in the action as 'type'.

Thanks for any help.


More information about the antlr-interest mailing list