Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: POSIX `for' syntax



On Jun 21, 11:19am, Andrej Borsenkow wrote:
}
} for_clause       : For name linebreak                            do_group
}                  | For name linebreak in wordlist sequential_sep do_group
} name             : NAME                     /* Apply rule 5 */
}                  ;
} in               : In                       /* Apply rule 6 */
} 
} It means, that the following is valid:
} 
} fot i
} in a b c
} do
} ...
} 
} it is currently does not work in zsh:
} 
} bor@itsrm2% for i
} for> in a b c
} bor@itsrm2%
} ^^^^^^^^^^^^^^^ Oops!

The following patch (which almost certainly conflicts with Peter's)
makes zsh accept any number of newlines preceding the "in" token.  This
also applies to `select', which I presumed it ought to.

--- zsh-forge/current/Src/parse.c	Mon Jun 18 01:05:17 2001
+++ zsh-4.0/Src/parse.c	Thu Jun 21 02:45:23 2001
@@ -909,6 +909,8 @@
 	ecstr(tokstr);
 	incmdpos = 1;
 	yylex();
+	while (isnewlin && !csh)
+	  yylex();
 	if (tok == STRING && !strcmp(tokstr, "in")) {
 	    int np, n;
 

-- 
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   



Messages sorted by: Reverse Date, Date, Thread, Author