[antlr-interest] Unexpected char when generating lexer

Gregg Reynolds dev at arabink.com
Tue Dec 20 10:08:33 PST 2005


Thiago Arrais wrote:
> 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.
> 
Try using single quotes:  '\u0000'.  That works for me.


More information about the antlr-interest mailing list