zsh-workers
 help / color / mirror / code / Atom feed
* Minor annoyance with new `for' syntax
@ 2001-07-01  5:34 Bart Schaefer
  2001-07-05 17:26 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2001-07-01  5:34 UTC (permalink / raw)
  To: zsh-workers

zsh$ for key val in ${(kv)options}
zsh: correct 'val' to 'cal' [nyae]? 

I don't think correction should apply there ... but it gets worse; answer
`a' to `abort' and:

zsh$ for key val in ${(kv)options}
zsh: correct 'val' to 'cal' [nyae]? 
for> 

Anything that you type at the `for> ' prompt will be ignored when zsh
finally reacts to the abort request, but it lets you enter the entire
do ... done body before it finally does abort.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 2+ messages in thread

* 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

end of thread, other threads:[~2001-07-05 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-01  5:34 Minor annoyance with new `for' syntax Bart Schaefer
2001-07-05 17:26 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).