diff options
| author | Richard M. Stallman | 1993-11-15 06:29:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-15 06:29:24 +0000 |
| commit | 481c63363cb0d3951ef0137be1ad871994bc4eeb (patch) | |
| tree | 1907b40b64565aecc925f0d6b6081b9b74244189 /src/lread.c | |
| parent | 07ccf0bc946915c7284a70918b3bf4192756bd62 (diff) | |
| download | emacs-481c63363cb0d3951ef0137be1ad871994bc4eeb.tar.gz emacs-481c63363cb0d3951ef0137be1ad871994bc4eeb.zip | |
(read1): If token has a \, don't treat it as a number.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/lread.c b/src/lread.c index 6d215e8473e..5dbc921f829 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1189,6 +1189,7 @@ read1 (readcharfun) | |||
| 1189 | if (c <= 040) goto retry; | 1189 | if (c <= 040) goto retry; |
| 1190 | { | 1190 | { |
| 1191 | register char *p = read_buffer; | 1191 | register char *p = read_buffer; |
| 1192 | int quoted = 0; | ||
| 1192 | 1193 | ||
| 1193 | { | 1194 | { |
| 1194 | register char *end = read_buffer + read_buffer_size; | 1195 | register char *end = read_buffer + read_buffer_size; |
| @@ -1212,7 +1213,10 @@ read1 (readcharfun) | |||
| 1212 | end = read_buffer + read_buffer_size; | 1213 | end = read_buffer + read_buffer_size; |
| 1213 | } | 1214 | } |
| 1214 | if (c == '\\') | 1215 | if (c == '\\') |
| 1215 | c = READCHAR; | 1216 | { |
| 1217 | c = READCHAR; | ||
| 1218 | quoted = 1; | ||
| 1219 | } | ||
| 1216 | *p++ = c; | 1220 | *p++ = c; |
| 1217 | c = READCHAR; | 1221 | c = READCHAR; |
| 1218 | } | 1222 | } |
| @@ -1229,35 +1233,36 @@ read1 (readcharfun) | |||
| 1229 | UNREAD (c); | 1233 | UNREAD (c); |
| 1230 | } | 1234 | } |
| 1231 | 1235 | ||
| 1232 | /* Is it an integer? */ | 1236 | if (!quoted) |
| 1233 | { | 1237 | { |
| 1234 | register char *p1; | 1238 | register char *p1; |
| 1235 | register Lisp_Object val; | 1239 | register Lisp_Object val; |
| 1236 | p1 = read_buffer; | 1240 | p1 = read_buffer; |
| 1237 | if (*p1 == '+' || *p1 == '-') p1++; | 1241 | if (*p1 == '+' || *p1 == '-') p1++; |
| 1238 | if (p1 != p) | 1242 | /* Is it an integer? */ |
| 1239 | { | 1243 | if (p1 != p) |
| 1240 | while (p1 != p && (c = *p1) >= '0' && c <= '9') p1++; | 1244 | { |
| 1245 | while (p1 != p && (c = *p1) >= '0' && c <= '9') p1++; | ||
| 1241 | #ifdef LISP_FLOAT_TYPE | 1246 | #ifdef LISP_FLOAT_TYPE |
| 1242 | /* Integers can have trailing decimal points. */ | 1247 | /* Integers can have trailing decimal points. */ |
| 1243 | if (p1 > read_buffer && p1 < p && *p1 == '.') p1++; | 1248 | if (p1 > read_buffer && p1 < p && *p1 == '.') p1++; |
| 1244 | #endif | 1249 | #endif |
| 1245 | if (p1 == p) | 1250 | if (p1 == p) |
| 1246 | /* It is an integer. */ | 1251 | /* It is an integer. */ |
| 1247 | { | 1252 | { |
| 1248 | #ifdef LISP_FLOAT_TYPE | 1253 | #ifdef LISP_FLOAT_TYPE |
| 1249 | if (p1[-1] == '.') | 1254 | if (p1[-1] == '.') |
| 1250 | p1[-1] = '\0'; | 1255 | p1[-1] = '\0'; |
| 1251 | #endif | 1256 | #endif |
| 1252 | XSET (val, Lisp_Int, atoi (read_buffer)); | 1257 | XSET (val, Lisp_Int, atoi (read_buffer)); |
| 1253 | return val; | 1258 | return val; |
| 1254 | } | 1259 | } |
| 1255 | } | 1260 | } |
| 1256 | #ifdef LISP_FLOAT_TYPE | 1261 | #ifdef LISP_FLOAT_TYPE |
| 1257 | if (isfloat_string (read_buffer)) | 1262 | if (isfloat_string (read_buffer)) |
| 1258 | return make_float (atof (read_buffer)); | 1263 | return make_float (atof (read_buffer)); |
| 1259 | #endif | 1264 | #endif |
| 1260 | } | 1265 | } |
| 1261 | 1266 | ||
| 1262 | return intern (read_buffer); | 1267 | return intern (read_buffer); |
| 1263 | } | 1268 | } |