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

Re: (z) flag little crazy when '((' closed with *single* ')'



> 2018/05/28 23:43, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> 
> ~ buf='(( i = 1, i <= size, ++ i )'; printf "|%s|\n" "${(z)buf}"
> |(|
> |(|
(snip)
> |)|
> 
> It splits almost char by char. I wonder if this couldn't be fixed? So
> that (z) would split this as:
> 
> |(( i = 1, i <= size, ++ i )|

If the lexer can't find the closing '))' on the command line, it tries
to interpret the opening '((' as '( (', i.e., nested subshells.

zsh% ((echo foo) )
foo
zsh% ((echo foo); echo bar)
foo
bar
zsh% ((echo foo)
subsh>

${(z)...} uses the same lexter, and even if it is OK to make it behave
differently from the command line, we may need to modify the lexer ...



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