diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2001-06-25 16:07:51 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2001-06-25 16:07:51 +0000 |
commit | 1897a361bf68faf47c5d5d0fa662127cbf5c2c95 (patch) | |
tree | 4462548ebeb9b13aba825601baa8386a0e4abf94 /Src/parse.c | |
parent | bbd2a98f4171a474cec10f58ff80df197fae6491 (diff) | |
download | zsh-1897a361bf68faf47c5d5d0fa662127cbf5c2c95.tar.gz zsh-1897a361bf68faf47c5d5d0fa662127cbf5c2c95.tar.xz zsh-1897a361bf68faf47c5d5d0fa662127cbf5c2c95.zip |
15030: multi-parameter `for' loops
Diffstat (limited to 'Src/parse.c')
-rw-r--r-- | Src/parse.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/Src/parse.c b/Src/parse.c index b611e8e0c..fd7138605 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -878,7 +878,7 @@ static void par_for(int *complex) { int oecused = ecused, csh = (tok == FOREACH), p, sel = (tok == SELECT); - int type; + int type, ona = noaliases; p = ecadd(0); @@ -903,19 +903,32 @@ par_for(int *complex) yylex(); type = WC_FOR_COND; } else { - int posix_in; + int np, n, posix_in; infor = 0; if (tok != STRING || !isident(tokstr)) YYERRORV(oecused); - ecstr(tokstr); + np = ecadd(0); + n = 0; incmdpos = 1; - yylex(); + noaliases = 1; + for (;;) { + n++; + ecstr(tokstr); + yylex(); + if (tok != STRING || !strcmp(tokstr, "in") || sel) + break; + if (!isident(tokstr)) + { + noaliases = ona; + YYERRORV(oecused); + } + } + noaliases = ona; + ecbuf[np] = n; posix_in = isnewlin; while (isnewlin) - yylex(); - if (tok == STRING && !strcmp(tokstr, "in")) { - int np, n; - + yylex(); + if (tok == STRING && !strcmp(tokstr, "in")) { incmdpos = 0; yylex(); np = ecadd(0); @@ -925,8 +938,6 @@ par_for(int *complex) ecbuf[np] = n; type = (sel ? WC_SELECT_LIST : WC_FOR_LIST); } else if (!posix_in && tok == INPAR) { - int np, n; - incmdpos = 0; yylex(); np = ecadd(0); |