* Re: Minor annoyance with new `for' syntax
2001-07-01 5:34 Minor annoyance with new `for' syntax Bart Schaefer
@ 2001-07-05 17:26 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2001-07-05 17:26 UTC (permalink / raw)
To: Zsh hackers list
"Bart Schaefer" wrote:
> zsh$ for key val in ${(kv)options}
> zsh: correct 'val' to 'cal' [nyae]?
> for>
I hope this fixes that.
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.26
diff -u -r1.26 parse.c
--- Src/parse.c 2001/06/25 16:07:53 1.26
+++ Src/parse.c 2001/07/05 17:26:12
@@ -878,7 +878,7 @@
par_for(int *complex)
{
int oecused = ecused, csh = (tok == FOREACH), p, sel = (tok == SELECT);
- int type, ona = noaliases;
+ int type;
p = ecadd(0);
@@ -903,27 +903,29 @@
yylex();
type = WC_FOR_COND;
} else {
- int np, n, posix_in;
+ int np, n, posix_in, ona = noaliases, onc = nocorrect;
infor = 0;
if (tok != STRING || !isident(tokstr))
YYERRORV(oecused);
np = ecadd(0);
n = 0;
incmdpos = 1;
- noaliases = 1;
+ noaliases = nocorrect = 1;
for (;;) {
n++;
ecstr(tokstr);
yylex();
if (tok != STRING || !strcmp(tokstr, "in") || sel)
break;
- if (!isident(tokstr))
+ if (!isident(tokstr) || errflag)
{
noaliases = ona;
+ nocorrect = onc;
YYERRORV(oecused);
}
}
noaliases = ona;
+ nocorrect = onc;
ecbuf[np] = n;
posix_in = isnewlin;
while (isnewlin)
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
^ permalink raw reply [flat|nested] 2+ messages in thread