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

Re: [PATCH?] Nofork and removing newlines



On Wed, Mar 6, 2024, at 11:53 PM, Bart Schaefer wrote:
> On Wed, Mar 6, 2024 at 2:42 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> On Wed, Mar 6, 2024 at 2:22 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> >
>> > Is there some strong reason we could not allow ${(T) foo} btw?
>>
>> "{ " (curly bracket followed by space) is recognized like a syntax
>> token.
>
> Code-wise, a sequence starting with ${ (with or without the space) and
> ending with } is lexed into a single STRING token.  (If it's inside
> double quotes, the entire double-quoted thing is a STRING token, but
> you can have nested quotes inside the dollar-brace inside the double
> quotes, etc., so this has to work recursively, and so on.)  So the
> lexer has to decide when it sees dollar-brace how to find the closing
> brace.  Skipping over parameter flags before deciding to switch to
> parsing something that looks like a function body might be possible,
> but doesn't really fit into the structure of the lexer.  Deciding
> based on the very next character (space or pipe for a command, or any
> other for a parameter) makes it tractable.

Hm, would it be feasible to create an explicit LF-preserving form
using a different character (e.g., ${&cmd})?  If so, would it be
undesirable for some other reason?

(Sorry if you already said something ruling this out; I only had
time to quickly skim today's messages.)

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author