aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/lread.c b/src/lread.c
index c80ac430671..c0de95dd121 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2327,8 +2327,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
2327 c = READCHAR; 2327 c = READCHAR;
2328 } 2328 }
2329 2329
2330 if (c >= 0) 2330 UNREAD (c);
2331 UNREAD (c);
2332 *p = '\0'; 2331 *p = '\0';
2333 } 2332 }
2334 2333
@@ -2583,8 +2582,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2583 nskip *= 10; 2582 nskip *= 10;
2584 nskip += c - '0'; 2583 nskip += c - '0';
2585 } 2584 }
2586 if (c >= 0) 2585 UNREAD (c);
2587 UNREAD (c);
2588 2586
2589 if (load_force_doc_strings 2587 if (load_force_doc_strings
2590 && (EQ (readcharfun, Qget_file_char) 2588 && (EQ (readcharfun, Qget_file_char)
@@ -2660,7 +2658,17 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2660 { 2658 {
2661 uninterned_symbol = 1; 2659 uninterned_symbol = 1;
2662 c = READCHAR; 2660 c = READCHAR;
2663 goto default_label; 2661 if (!(c > 040
2662 && c != 0x8a0
2663 && (c >= 0200
2664 || strchr ("\"';()[]#`,", c) == NULL)))
2665 {
2666 /* No symbol character follows, this is the empty
2667 symbol. */
2668 UNREAD (c);
2669 return Fmake_symbol (build_string (""));
2670 }
2671 goto read_symbol;
2664 } 2672 }
2665 /* Reader forms that can reuse previously read objects. */ 2673 /* Reader forms that can reuse previously read objects. */
2666 if (c >= '0' && c <= '9') 2674 if (c >= '0' && c <= '9')
@@ -2841,7 +2849,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2841 next_char = READCHAR; 2849 next_char = READCHAR;
2842 ok = (next_char <= 040 2850 ok = (next_char <= 040
2843 || (next_char < 0200 2851 || (next_char < 0200
2844 && (strchr ("\"';()[]#?`,.", next_char)))); 2852 && strchr ("\"';()[]#?`,.", next_char) != NULL));
2845 UNREAD (next_char); 2853 UNREAD (next_char);
2846 if (ok) 2854 if (ok)
2847 return make_number (c); 2855 return make_number (c);
@@ -2966,11 +2974,6 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2966 /* Otherwise, READ_BUFFER contains only ASCII. */ 2974 /* Otherwise, READ_BUFFER contains only ASCII. */
2967 } 2975 }
2968 2976
2969 /* We want readchar_count to be the number of characters, not
2970 bytes. Hence we adjust for multibyte characters in the
2971 string. ... But it doesn't seem to be necessary, because
2972 READCHAR *does* read multibyte characters from buffers. */
2973 /* readchar_count -= (p - read_buffer) - nchars; */
2974 if (read_pure) 2977 if (read_pure)
2975 return make_pure_string (read_buffer, nchars, p - read_buffer, 2978 return make_pure_string (read_buffer, nchars, p - read_buffer,
2976 (force_multibyte 2979 (force_multibyte
@@ -2987,7 +2990,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2987 2990
2988 if (next_char <= 040 2991 if (next_char <= 040
2989 || (next_char < 0200 2992 || (next_char < 0200
2990 && (strchr ("\"';([#?`,", next_char)))) 2993 && strchr ("\"';([#?`,", next_char) != NULL))
2991 { 2994 {
2992 *pch = c; 2995 *pch = c;
2993 return Qnil; 2996 return Qnil;
@@ -3002,9 +3005,12 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3002 if (c <= 040) goto retry; 3005 if (c <= 040) goto retry;
3003 if (c == 0x8a0) /* NBSP */ 3006 if (c == 0x8a0) /* NBSP */
3004 goto retry; 3007 goto retry;
3008
3009 read_symbol:
3005 { 3010 {
3006 char *p = read_buffer; 3011 char *p = read_buffer;
3007 int quoted = 0; 3012 int quoted = 0;
3013 EMACS_INT start_position = readchar_count - 1;
3008 3014
3009 { 3015 {
3010 char *end = read_buffer + read_buffer_size; 3016 char *end = read_buffer + read_buffer_size;
@@ -3035,10 +3041,11 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3035 else 3041 else
3036 *p++ = c; 3042 *p++ = c;
3037 c = READCHAR; 3043 c = READCHAR;
3038 } while (c > 040 3044 }
3039 && c != 0x8a0 /* NBSP */ 3045 while (c > 040
3040 && (c >= 0200 3046 && c != 0x8a0 /* NBSP */
3041 || !(strchr ("\"';()[]#`,", c)))); 3047 && (c >= 0200
3048 || strchr ("\"';()[]#`,", c) == NULL));
3042 3049
3043 if (p == end) 3050 if (p == end)
3044 { 3051 {
@@ -3051,8 +3058,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3051 end = read_buffer + read_buffer_size; 3058 end = read_buffer + read_buffer_size;
3052 } 3059 }
3053 *p = 0; 3060 *p = 0;
3054 if (c >= 0) 3061 UNREAD (c);
3055 UNREAD (c);
3056 } 3062 }
3057 3063
3058 if (!quoted && !uninterned_symbol) 3064 if (!quoted && !uninterned_symbol)
@@ -3080,12 +3086,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3080 if (EQ (Vread_with_symbol_positions, Qt) 3086 if (EQ (Vread_with_symbol_positions, Qt)
3081 || EQ (Vread_with_symbol_positions, readcharfun)) 3087 || EQ (Vread_with_symbol_positions, readcharfun))
3082 Vread_symbol_positions_list = 3088 Vread_symbol_positions_list =
3083 /* Kind of a hack; this will probably fail if characters 3089 Fcons (Fcons (result, make_number (start_position)),
3084 in the symbol name were escaped. Not really a big
3085 deal, though. */
3086 Fcons (Fcons (result,
3087 make_number (readchar_count
3088 - XFASTINT (Flength (Fsymbol_name (result))))),
3089 Vread_symbol_positions_list); 3090 Vread_symbol_positions_list);
3090 return result; 3091 return result;
3091 } 3092 }