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

${(z)} split of unmatched, doubled ((



Consider:

% print -rl - ${(z):-'(( e'}
 e
%

Shouldn't it output the parentheses as well?  I realise it can't know yet
whether it's an arithmetic evaluation or two subshells, but pretending the
parentheses don't exist will never be the right parse...

Other unfinished constructs don't seem to exhibit this behaviour:

% print -rl - ${(z):-'( e'}
(
e
% print -rl - ${(z):-'( ( e'}
(
(
e
% print -rl - ${(z):-'echo "hello w'}   
echo
"hello w

I ran into this in zsh-syntax-highlighting when BUFFER='(( 42 ', with
the closing-double-paren not having been typed yet.  For that use-case,
I don't care whether I get a single '((' token or two '(' tokens; either
would be fine.

Cheers,

Daniel



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