help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does ${x[@]} have to be written as is?


From: Marco Ippolito
Subject: Re: Why does ${x[@]} have to be written as is?
Date: Sat, 15 May 2021 03:45:00 -0300

What is your use case for this type of change request, please?

> On 9 May 2021, at 20:26, Peng Yu <PengYu.UT@gmail.com> wrote:
> 
> Hi
> 
> Things like `${x [@] }` are not legitimate. Why not allowing such a
> case and treat it the same as ${x[@]}?
> 
> I can understand that `VAR=val cmd` should not be written as `VAR =
> val cmd` as there is a different meaning of the 2nd form.
> 
> But for the case like "${x[@]}", it seems that spaces can be
> introduced in "${...}" without hurting anything.
> 
> Since I don't see ${x[@]} in the bison code, I assume it is parsed
> completely by the yylex(). Is it so?
> 
> https://git.savannah.gnu.org/cgit/bash.git/tree/parse.y#n381
> 
> yylex() seems to be too complicated. By allowing spaces in ${...},
> would it possible to convert some of the logic in yylex() into the
> bison grammar, so that the coupling of the lexer and the parser be
> reduced thus making the code in parse.y easier to understand and
> maintain?
> 
> -- 
> Regards,
> Peng
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]