Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Support the mksh's ${|func;} substitution



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