[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pkg adf7b760f2 12/76: More symbol reading
From: |
Gerd Moellmann |
Subject: |
pkg adf7b760f2 12/76: More symbol reading |
Date: |
Fri, 21 Oct 2022 00:16:09 -0400 (EDT) |
branch: pkg
commit adf7b760f2830f2adb77a28a6e912b7b47efae72
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
More symbol reading
---
src/lread.c | 59 +++++++++++++++++++++++++++++++++++------------------------
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index edd50efd16..b812474a2c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4133,18 +4133,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
char *end = read_buffer + read_buffer_size;
EMACS_INT start_position = readchar_offset - 1;
- /* PKG-FIXME check. And this code is much too long. */
-
- /* If of the form ||, everything except '|' is considered quoted.
- the bars doesn't belong to the symbol name. */
- bool in_vertical_bar = false;
- if (!read_emacs_syntax && c == '|')
- {
- in_vertical_bar = true;
- c = READCHAR;
- if (c < 0)
- end_of_file_error ();
- }
+ /* PKG-FIXME: This is too complicated. */
/* Remember where package prefixes end in COLON, which
will be set to the first colon we find. NCOLONS is the
@@ -4154,11 +4143,14 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
/* True means last character read was a backslash. */
bool last_was_backslash = false;
+ bool in_vertical_bar = false;
bool any_quoted = false;
for (;;)
{
- if (c == ':' && !last_was_backslash && !in_vertical_bar)
+ if (c == ':'
+ // This is actually \: or |...:
+ && !last_was_backslash && !in_vertical_bar)
{
/* Remember where the first : is. */
if (colon == NULL)
@@ -4167,7 +4159,8 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
if (!read_emacs_syntax)
{
- /* #:xyz should not contain a colon. */
+ /* #:xyz should not contain a colon unless in Emacs
+ original syntax. */
if (uninterned_symbol)
invalid_syntax ("colon in uninterned symbol",
readcharfun);
@@ -4178,18 +4171,36 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
}
}
- /* Handle backslash. The first backslash is not part of
- the symbol name. \\ gives a single \ in the
- symbol. */
- if (c == '\\' && !last_was_backslash)
+ /* Handle unquote backslash and bar . */
+ if (!last_was_backslash)
{
- c = READCHAR;
- if (c < 0)
- end_of_file_error ();
- last_was_backslash = true;
- any_quoted = true;
- continue;
+ /* Unquoted backslash: The first backslash is not part
+ of the symbol name. \\ gives a single \ in the
+ symbol. */
+ if (c == '\\')
+ {
+ c = READCHAR;
+ if (c < 0)
+ end_of_file_error ();
+ last_was_backslash = true;
+ any_quoted = true;
+ continue;
+ }
+
+ /* Unquoted vertical bar. Begin or end multi-escape,
+ unless in Emacs syntax. In either case, proceed
+ with next char, the bar is not part of the
+ name. */
+ if (c == '|' && !read_emacs_syntax)
+ {
+ c = READCHAR;
+ if (c < 0)
+ end_of_file_error ();
+ in_vertical_bar = !in_vertical_bar;
+ continue;
+ }
}
+
last_was_backslash = false;
/* Store the character read, and advance the write pointer
- pkg 963de7cafe 35/76: More scribbling, (continued)
- pkg 963de7cafe 35/76: More scribbling, Gerd Moellmann, 2022/10/21
- pkg 90c070fec6 59/76: Restore obarray.el to return vectors, Gerd Moellmann, 2022/10/21
- pkg 74da61ff09 74/76: Remove a call to pkg_break, Gerd Moellmann, 2022/10/21
- pkg cc6095482b 73/76: Add pkg_set_status and Lisp defun for it, Gerd Moellmann, 2022/10/21
- pkg 7acb6c5ca1 68/76: Intrdduce pkg_find_symbol, Gerd Moellmann, 2022/10/21
- pkg 55cef2c78c 69/76: Some cleanup in pkg.c and lisp.h, Gerd Moellmann, 2022/10/21
- pkg df1e4c1e51 34/76: Allow intern with ":xyz" again, Gerd Moellmann, 2022/10/21
- pkg 513f5a0b90 21/76: Remove obarrays, Gerd Moellmann, 2022/10/21
- pkg 051a17f540 63/76: Fix some warnings, Gerd Moellmann, 2022/10/21
- pkg 0f4b419fa3 65/76: Remove unused function prototype from lisp.h, Gerd Moellmann, 2022/10/21
- pkg adf7b760f2 12/76: More symbol reading,
Gerd Moellmann <=
- pkg e2b79c2c5a 14/76: Revert the escaping of symbol names in lisp files, Gerd Moellmann, 2022/10/21
- pkg 4d4690f8cf 75/76: Handle keywords in image specs, Gerd Moellmann, 2022/10/21
- pkg f45b266d0e 03/76: Don't use symbols that look package-qualified, Gerd Moellmann, 2022/10/21
- pkg 06cfa629a5 05/76: Print symbols differently, Gerd Moellmann, 2022/10/21
- pkg 54a08db92b 01/76: Basic functionality for packages, Gerd Moellmann, 2022/10/21
- pkg 3e29407122 10/76: And more fixes, Gerd Moellmann, 2022/10/21
- pkg 8615f5b048 15/76: Can now pdumg withput warnings from cl-defstruct, Gerd Moellmann, 2022/10/21
- pkg 0e5323c908 16/76: Remove Lisp_Symbol::interned, Gerd Moellmann, 2022/10/21
- pkg aa00af4e17 26/76: Consider shorthands out of scope, Gerd Moellmann, 2022/10/21
- pkg 4c1bbd4fd7 31/76: intern-soft with ':' trick, Gerd Moellmann, 2022/10/21