[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bison bug fix for non-ascii unibyte char tokens on signed-char hosts
From: |
Paul Eggert |
Subject: |
Bison bug fix for non-ascii unibyte char tokens on signed-char hosts |
Date: |
01 Jul 2002 01:49:46 -0700 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 |
Just for fun I tried Bison on this grammar on a Solaris 8 sparc host:
%%
start: '¿';
%%
(That character token is an upside-down question mark in Latin-1 encoding.)
Bison reported the following bogus message:
tokens $ and '\277' both assigned number -65
I installed the following patch, which fixes a bug for non-ASCII
unibyte char tokens on hosts that have signed char. Perhaps this
issue should be documented in bison.texinfo, since it means that on
signed-char hosts '¿' == 191 in Bison even though '¿' == -65 in C.
However, I'm a bit leery about saying too much about this issue given
our aversion to supporting non-ASCII character literal tokens.
2002-07-01 Paul Eggert <address@hidden>
* src/scan-gram.l (<SC_ESCAPED_CHARACTER>): Convert to unsigned
char, so that negative chars don't collide with $.
Index: scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.18
retrieving revision 1.19
diff -p -u -r1.18 -r1.19
--- scan-gram.l 30 Jun 2002 17:34:52 -0000 1.18
+++ scan-gram.l 1 Jul 2002 08:36:37 -0000 1.19
@@ -294,7 +294,8 @@ blanks [ \t\f]+
YY_OBS_FINISH;
yylval->symbol = symbol_get (last_string, *yylloc);
symbol_class_set (yylval->symbol, token_sym, *yylloc);
- symbol_user_token_number_set (yylval->symbol, last_string[1], *yylloc);
+ symbol_user_token_number_set (yylval->symbol,
+ (unsigned char) last_string[1], *yylloc);
YY_OBS_FREE;
yy_pop_state ();
return ID;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bison bug fix for non-ascii unibyte char tokens on signed-char hosts,
Paul Eggert <=