[antlr-interest] labels on chars

Kay Roepke kroepke at classdump.org
Fri Nov 3 15:00:32 PST 2006


On 3. Nov 2006, at 23:53 , Terence Parr wrote:

> Hi, in the lexer for v3 when you reference a char, should it be of  
> type int or char?
>
> R : a='c' {char foo = $a;} ;
>
> Should $a be an int or char?  Char is more convenient and probably  
> correct.  Any issues?  EOF perhaps?

char is unsigned in java, isn't it? what happens if you get EOF (=  
-1)? Does it wrap around to 0xFFFF?
Having EOF==-1 bothered me in ObjC since I couldn't use enums to hold  
tokentypes because of the -1 :(
Other than that char should be ok, it covers the whole UTF-16 range,  
right?

-k

-- 
Kay Röpke <kroepke at classdump.org>
classdump Software
Key fingerprint = A849 0F2C C322 4022 379E  8661 7E1B FE0D 4CD2 A6D0





More information about the antlr-interest mailing list