comparison src/lread.c @ 102300:d7ea9e8841d3

(read_escape): Signal an error for invalid \UXXXXXXXX.
author Kenichi Handa <handa@m17n.org>
date Fri, 27 Feb 2009 00:48:03 +0000
parents 12ffc72c0bbc
children 245a1f77b840
comparison
equal deleted inserted replaced
102299:668bf00f127d 102300:d7ea9e8841d3
2203 case 'u': 2203 case 'u':
2204 2204
2205 /* A Unicode escape. We only permit them in strings and characters, 2205 /* A Unicode escape. We only permit them in strings and characters,
2206 not arbitrarily in the source code, as in some other languages. */ 2206 not arbitrarily in the source code, as in some other languages. */
2207 { 2207 {
2208 int i = 0; 2208 unsigned int i = 0;
2209 int count = 0; 2209 int count = 0;
2210 2210
2211 while (++count <= unicode_hex_count) 2211 while (++count <= unicode_hex_count)
2212 { 2212 {
2213 c = READCHAR; 2213 c = READCHAR;
2220 { 2220 {
2221 error ("Non-hex digit used for Unicode escape"); 2221 error ("Non-hex digit used for Unicode escape");
2222 break; 2222 break;
2223 } 2223 }
2224 } 2224 }
2225 2225 if (i > 0x10FFFF)
2226 error ("Non-Unicode character: 0x%x", i);
2226 return i; 2227 return i;
2227 } 2228 }
2228 2229
2229 default: 2230 default:
2230 return c; 2231 return c;