[antlr-interest] Source positions for imaginary tokens

Mike Lischke mike at lischke-online.de
Fri Sep 14 00:29:31 PDT 2012


> Just use $token->type = ID;
> 
> That's all I do - the type field will never change.


error(114): MySQL.g:2400:4: attribute is not a token, parameter, or return value: token

The rule is like this:

keyword:
	keyword_sp
	(
	| ASCII_SYMBOL
	| BACKUP_SYMBOL
...
	| UPGRADE_SYMBOL
	) { $token->type = IDENTIFIER; }
;

Been there, done that. This seems only to work for lexer rules.

Mike
-- 
www.soft-gems.net




More information about the antlr-interest mailing list