comparison src/lread.c @ 5017:9c277d938ccd

(read1): If token has a \, don't treat it as a number.
author Richard M. Stallman <rms@gnu.org>
date Mon, 15 Nov 1993 06:29:24 +0000
parents 05f6a91c2801
children 951396781a0e
comparison
equal deleted inserted replaced
5016:11f0a3153f63 5017:9c277d938ccd
1187 } 1187 }
1188 default: 1188 default:
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;
1195 1196
1196 while (c > 040 && 1197 while (c > 040 &&
1210 p += new - read_buffer; 1211 p += new - read_buffer;
1211 read_buffer += new - read_buffer; 1212 read_buffer += new - read_buffer;
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 }
1219 1223
1220 if (p == end) 1224 if (p == end)
1227 *p = 0; 1231 *p = 0;
1228 if (c >= 0) 1232 if (c >= 0)
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 }
1264 } 1269 }
1265 } 1270 }