From 61b9529ff848d6758b498389256111984bda1437 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 3 Oct 2012 18:11:12 +0000 Subject: users/17310: we can't treat < after [ as a normal character. Document problem and test for case that needs to work. --- ChangeLog | 9 ++++++++- Doc/Zsh/params.yo | 5 ++++- Src/lex.c | 4 ++-- Test/A04redirect.ztst | 3 +++ Test/D06subscript.ztst | 20 -------------------- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 681fd10e9..0d68f729f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-10-03 Peter Stephenson + + * users/17310: Doc/Zsh/params.yo, Src/lex.c, Test/A04redirect.ztst, + Test/D06subscript.ztst: back off users/17304 owing to problem + with [ command, document problem, and test the case that needs + to work. + 2012-10-02 Peter Stephenson * users/17304: Src/lex.c, Test/D06subscript.ztst: angle brackets @@ -207,5 +214,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5731 $ +* $Revision: 1.5732 $ ***************************************************** diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index bf9a68ba8..b7b7750ff 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -182,7 +182,10 @@ to the matching closing one is considered to be a list of flags, as in The flags tt(s), tt(n) and tt(b) take an argument; the delimiter is shown below as `tt(:)', but any character, or the matching pairs `tt(LPAR())...tt(RPAR())', `tt({)...tt(})', `tt([)...tt(])', or -`tt(<)...tt(>)', may be used. +`tt(<)...tt(>)', may be used, but note that `tt(<)...tt(>)' can only be +used if the subscript is inside a double quoted expression or a +parameter substitution enclosed in braces as otherwise the expression is +interpreted as a redirection. The flags currently understood are: diff --git a/Src/lex.c b/Src/lex.c index d02b3885a..1cf3611c9 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -1218,7 +1218,7 @@ gettokstr(int c, int sub) c = Comma; break; case LX2_OUTANG: - if (in_brace_param || sub || brct) + if (in_brace_param || sub) break; e = hgetc(); if (e != '(') { @@ -1255,7 +1255,7 @@ gettokstr(int c, int sub) break; } lexstop = 0; - if (in_brace_param || sub || brct) + if (in_brace_param || sub) break; goto brk; case LX2_EQUALS: diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index 3911b0629..d3c0a4a99 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -441,3 +441,6 @@ 0:failed assignment on non-posix-special, POSIX_BUILTINS >output ?zsh: read-only variable: foo + + ["; do - eval 'print ${string[(ws'$delims[1]'+'$delims[2]')2]}' - eval 'print $string[(ws'$delims[1]'+'$delims[2]')3]' - eval 'print "$string[(ws'$delims[1]'+'$delims[2]')4]"' - done -0:Check matched delimiters in subscripts ->like ->a ->dome ->like ->a ->dome ->like ->a ->dome ->like ->a ->dome -- cgit 1.4.1