Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Support the mksh's ${|func;} substitution
- X-seq: zsh-workers 51907
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Support the mksh's ${|func;} substitution
- Date: Thu, 6 Jul 2023 04:27:58 +0200
- Archived-at: <https://zsh.org/workers/51907>
- In-reply-to: <CAH+w=7bDio8qL6DmyuOaiEo6Ybt68F1Ms5+AG_3Z_n1pM+2pKQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKc7PVB9EHmNS9mL00iwZbNDeZOawBL_TWV=RYnZaNYacUTphQ@mail.gmail.com> <CAH+w=7Y1xZy1B21rD-zn+oAtBayK=StxitQ7BEWTjDbNopf=RA@mail.gmail.com> <e27c46cc-eeca-4f90-a5b1-d1f0f1fb0743@app.fastmail.com> <CAH+w=7aDHvJV6K=Znbur=vw8ASt-MpKWgBpUm9CHT_akkgg9sg@mail.gmail.com> <CAH+w=7bDio8qL6DmyuOaiEo6Ybt68F1Ms5+AG_3Z_n1pM+2pKQ@mail.gmail.com>
On 7/6/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Jul 4, 2023 at 10:32 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
>>
>> The first three of those are implementable within the structure of the
>> patch from workers/51898 although it's a little messy because of the
>> multiple "return" points in paramsubst().
>
> Fiddling with this has led me to find a few other issues with either
> of Sebastian's or my earlier patch in this thread, namely, both need
> to be more clever about finding the closing brace of the ${|...}
> substitution. This in turn leads me to ask if one of the old hands
> with the lexer can explain why, inside double quotes, "}" is always
> replaced by Outbrace but "{" is not replaced by Inbrace unless it is
> preceded by "$"?
>
> A small tweak to the lexer still passes all tests and makes
> skipparens(Inbrace, Outbrace, &str) work more consistently, but I
> don't want to have missed something.
I'm not one of said old hands, but presumably it's because { on its
own is not special inside double quotes? Possibly related,
% echo ${:-a{}b}
a{}b
% echo "${:-a{}b}"
a{b}
^ People occasionally get confused by this in #zsh, it comes up in
relation to %F{} or so usually.
It would probably be bad if this behavior changed.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author