[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 9613690: Raise an error when detecting old-style backquotes.
From: |
Stefan Monnier |
Subject: |
Re: master 9613690: Raise an error when detecting old-style backquotes. |
Date: |
Mon, 09 Oct 2017 21:19:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> I've reverted the commit, but this should really be fixed. Apparently
> Bovine generates incorrect code.
Bovine uses the Lisp reader to `read` things like "( ,@$2 )" and "( foo
,$1 (car ,@$2) )". AFAICT it was designed for the old-style unquotes, but
it's been tweaked to work correctly when those commas are treated as
new-style unquotes.
The patch below seems to work around this problem. Of course, as
mentioned in another email, just always interpreting those unquotes as
new-style works just as well (and with cleaner semantics).
Stefan
diff --git a/src/lread.c b/src/lread.c
index c073fc4ce6..75c7e3ee55 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2667,13 +2667,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
{
int c;
bool uninterned_symbol = false;
+ bool went_through_retry = false;
bool multibyte;
char stackbuf[MAX_ALLOCA];
current_thread->stack_top = stackbuf;
*pch = 0;
+ goto skipretry;
retry:
+ went_through_retry = true;
+ skipretry:
c = READCHAR_REPORT_MULTIBYTE (&multibyte);
if (c < 0)
@@ -3202,6 +3206,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
of a list. */
if (new_backquote_flag
|| !first_in_list
+ /* If there was some separation (space, comment, ....) between the
+ `(` and the `,`, we consider this is a new-style unquote. */
+ || went_through_retry
|| (next_char != ' ' && next_char != '@'))
{
Lisp_Object comma_type = Qnil;