diff options
author | Peter Stephenson <pws@zsh.org> | 2017-05-08 17:19:22 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2017-05-08 17:19:22 +0100 |
commit | 641a764b8203de5e5f5c9f1d6d5b0a48c26ca9e7 (patch) | |
tree | 335e6afa61b9feee5bbb392e3371f269805e8ec2 | |
parent | f25d01a97c61fdac5d6e0a6a8fb63b5b2b5f3393 (diff) | |
download | zsh-641a764b8203de5e5f5c9f1d6d5b0a48c26ca9e7.tar.gz zsh-641a764b8203de5e5f5c9f1d6d5b0a48c26ca9e7.tar.xz zsh-641a764b8203de5e5f5c9f1d6d5b0a48c26ca9e7.zip |
users/22688: Allow mixing redirs and arguments after anon functions.
These are parsed differently from the case of normal functions which can't take normal arguments at that point.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Src/parse.c | 19 | ||||
-rw-r--r-- | Test/A04redirect.ztst | 12 |
3 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 112a53d1a..8ac6df15e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2017-05-08 Peter Stephenson <p.stephenson@samsung.com> + * users/22688: Src/parse.c, Test/A04redirect.ztst: Allow mixing + of redirections and arguments after anonymous functions. + * 41060: Src/parse.c, Test/A04redirect.ztst: combination of HERE document and |& was broken by miscounting wordcode owing to missing flag. diff --git a/Src/parse.c b/Src/parse.c index 83e87afed..b0de9a863 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2030,10 +2030,21 @@ par_simple(int *cmplx, int nr) /* Unnamed function */ int parg = ecadd(0); ecadd(0); - while (tok == STRING) { - ecstr(tokstr); - argc++; - zshlex(); + while (tok == STRING || IS_REDIROP(tok)) { + if (tok == STRING) + { + ecstr(tokstr); + argc++; + zshlex(); + } else { + *cmplx = c = 1; + nrediradd = par_redir(&r, NULL); + p += nrediradd; + if (ppost) + ppost += nrediradd; + sr += nrediradd; + parg += nrediradd; + } } if (argc > 0) *cmplx = 1; diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index a5de552c1..2671080c2 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -475,6 +475,18 @@ >Nothing output yet >I just read any old rubbish + print you cannot be serious >input1 + () { + local var + read var + print $1 $var $2 + } <input1 Shirley >output1 dude + print Nothing output yet + cat output1 +0:anonymous function redirections mixed with argument +>Nothing output yet +>Shirley you cannot be serious dude + redirfn() { local var read var |