c = READCHAR;
}
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
*p = '\0';
}
nskip *= 10;
nskip += c - '0';
}
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
if (load_force_doc_strings
&& (EQ (readcharfun, Qget_file_char)
if (saved_doc_string_size == 0)
{
+ saved_doc_string = (char *) xmalloc (nskip + extra);
saved_doc_string_size = nskip + extra;
- saved_doc_string = (char *) xmalloc (saved_doc_string_size);
}
if (nskip > saved_doc_string_size)
{
- saved_doc_string_size = nskip + extra;
saved_doc_string = (char *) xrealloc (saved_doc_string,
- saved_doc_string_size);
+ nskip + extra);
+ saved_doc_string_size = nskip + extra;
}
saved_doc_string_position = file_tell (instream);
{
uninterned_symbol = 1;
c = READCHAR;
- goto default_label;
+ if (!(c > 040
+ && c != 0x8a0
+ && (c >= 0200
+ || strchr ("\"';()[]#`,", c) == NULL)))
+ {
+ /* No symbol character follows, this is the empty
+ symbol. */
+ UNREAD (c);
+ return Fmake_symbol (build_string (""));
+ }
+ goto read_symbol;
}
/* Reader forms that can reuse previously read objects. */
if (c >= '0' && c <= '9')
next_char = READCHAR;
ok = (next_char <= 040
|| (next_char < 0200
- && (strchr ("\"';()[]#?`,.", next_char))));
+ && strchr ("\"';()[]#?`,.", next_char) != NULL));
UNREAD (next_char);
if (ok)
return make_number (c);
if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
/* Otherwise, READ_BUFFER contains only ASCII. */
}
- /* We want readchar_count to be the number of characters, not
- bytes. Hence we adjust for multibyte characters in the
- string. ... But it doesn't seem to be necessary, because
- READCHAR *does* read multibyte characters from buffers. */
- /* readchar_count -= (p - read_buffer) - nchars; */
if (read_pure)
return make_pure_string (read_buffer, nchars, p - read_buffer,
(force_multibyte
if (next_char <= 040
|| (next_char < 0200
- && (strchr ("\"';([#?`,", next_char))))
+ && strchr ("\"';([#?`,", next_char) != NULL))
{
*pch = c;
return Qnil;
if (c <= 040) goto retry;
if (c == 0x8a0) /* NBSP */
goto retry;
+
+ read_symbol:
{
char *p = read_buffer;
int quoted = 0;
+ EMACS_INT start_position = readchar_count - 1;
{
char *end = read_buffer + read_buffer_size;
if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
else
*p++ = c;
c = READCHAR;
- } while (c > 040
- && c != 0x8a0 /* NBSP */
- && (c >= 0200
- || !(strchr ("\"';()[]#`,", c))));
+ }
+ while (c > 040
+ && c != 0x8a0 /* NBSP */
+ && (c >= 0200
+ || strchr ("\"';()[]#`,", c) == NULL));
if (p == end)
{
if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
*p = 0;
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
}
if (!quoted && !uninterned_symbol)
if (EQ (Vread_with_symbol_positions, Qt)
|| EQ (Vread_with_symbol_positions, readcharfun))
Vread_symbol_positions_list =
- /* Kind of a hack; this will probably fail if characters
- in the symbol name were escaped. Not really a big
- deal, though. */
- Fcons (Fcons (result,
- make_number (readchar_count
- - XFASTINT (Flength (Fsymbol_name (result))))),
+ Fcons (Fcons (result, make_number (start_position)),
Vread_symbol_positions_list);
return result;
}
init_obarray (void)
{
Lisp_Object oblength;
+ ptrdiff_t size = 100 + MAX_MULTIBYTE_LENGTH;
XSETFASTINT (oblength, OBARRAY_SIZE);
DEFSYM (Qvariable_documentation, "variable-documentation");
- read_buffer_size = 100 + MAX_MULTIBYTE_LENGTH;
- read_buffer = (char *) xmalloc (read_buffer_size);
+ read_buffer = (char *) xmalloc (size);
+ read_buffer_size = size;
}
\f
void
Qlexical_binding = intern ("lexical-binding");
staticpro (&Qlexical_binding);
DEFVAR_LISP ("lexical-binding", Vlexical_binding,
- doc: /* If non-nil, use lexical binding when evaluating code.
-This applies to code evaluated by `eval-buffer' and `eval-region' and
-other commands that call these functions, like `eval-defun' and
-the like.
+ doc: /* Whether to use lexical binding when evaluating code.
+Non-nil means that the code in the current buffer should be evaluated
+with lexical binding.
This variable is automatically set from the file variables of an
interpreted Lisp file read using `load'. */);
Fmake_variable_buffer_local (Qlexical_binding);