[antlr-interest] 8 bit ASCII and cpp source code
Gavin Lambert
antlr at mirality.co.nz
Sat Jan 27 12:14:23 PST 2007
At 10:25 27/01/2007, Jim O'Connor wrote:
> The charscanner and inputbuffer classes have a return type of
> int for LA(). LA(1) returns 0Xffd8 for my "problem" character.
>
>Solution: change the LA() to return unsigned? Ric hinted at such
>in a 2004 archive note.
I haven't actually looked at the code for LA, but probably a
simpler solution is to cast through unsigned char along the way.
ie. somewhere it'll have a bit that says "return c;" where c is a
char (or maybe "return (int)c;" -- change that to "return
(int)(unsigned char)c;" (or the equivalent static_casts, if you're
that way inclined) and it should fix up your problem character
without changing the function signature, which might be important
if something is depending on it to return negative answers
sometimes.
More information about the antlr-interest
mailing list