[antlr-interest] Unexpected char when generating lexer

Thiago Arrais thiago.arrais at gmail.com
Tue Dec 20 09:26:09 PST 2005


I am trying to create a lexer that needs to convert ASCII three-letter
code. I have a rule that looks like

1 ASCII
2	: "NUL" { $setText("\u0000"); }
3	| "SOH" { $setText("\u0001"); }
4	| "STX" { $setText("\u0002"); }
5	| "ETX" { $setText("\u0003"); }
6	;

When trying to generate the lexer, Antlr gives me the error
"unexpected char: 'u'" at lines 2-5.

Is this expected behavior? Does antlr actually care about what's
inside the semantic actions?

I need the lexer to map the codes to those unicode values. Can anyone
think of a workaround?

Regards,

Thiago Arrais


More information about the antlr-interest mailing list