From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH (redux): POSIX `for' syntax
Date: Thu, 21 Jun 2001 10:34:39 +0000 [thread overview]
Message-ID: <1010621103439.ZM9814@candle.brasslantern.com> (raw)
In-Reply-To: <Tc0a88d0154470c687b@mailsweeper01.cambridgesiliconradio.com>
On Jun 21, 10:52am, Peter Stephenson wrote:
} Subject: Re: PATCH: 4.1: multi-parameter for loop
}
} > I guess, Bart suggestion (use foreach) is better. And more Perlish :-)
}
} I'm not so convinced, since `for' and `foreach' currently do the same
} thing, and I don't really like dividing the syntax to make people use the
} non-standard variant just for one use. foreach is automatically handled at
} the moment, as well as for, by the way.
Hrm. The patch I just sent makes
for x
(a b c)
behave as `for x (a b c)' used to, but
foreach x
(a b c)
is taken as a short-loop to run the command "a b c" in a subshell once for
each positional parameter. I think they should both behave that way; so
the change to parse.c has to be fractionally more complicated.
This goes on top of the last one.
--- zsh-forge/current/Src/parse.c Thu Jun 21 03:06:36 2001
+++ zsh-4.0/Src/parse.c Thu Jun 21 03:31:04 2001
@@ -903,13 +903,15 @@
yylex();
type = WC_FOR_COND;
} else {
+ int posix_in;
infor = 0;
if (tok != STRING || !isident(tokstr))
YYERRORV(oecused);
ecstr(tokstr);
incmdpos = 1;
yylex();
- while (isnewlin && !csh)
+ posix_in = isnewlin;
+ while (isnewlin)
yylex();
if (tok == STRING && !strcmp(tokstr, "in")) {
int np, n;
@@ -922,7 +924,7 @@
YYERRORV(oecused);
ecbuf[np] = n;
type = (sel ? WC_SELECT_LIST : WC_FOR_LIST);
- } else if (tok == INPAR) {
+ } else if (!posix_in && tok == INPAR) {
int np, n;
incmdpos = 0;
--
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
next prev parent reply other threads:[~2001-06-21 10:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-20 14:45 PATCH: 4.1: multi-parameter for loop Peter Stephenson
2001-06-20 16:11 ` Peter Stephenson
2001-06-20 18:01 ` Andrej Borsenkow
2001-06-20 18:20 ` Bart Schaefer
2001-06-20 18:39 ` Peter Stephenson
2001-06-20 18:55 ` Bart Schaefer
2001-06-20 19:12 ` Peter Stephenson
2001-06-20 22:56 ` Danek Duvall
2001-06-21 7:19 ` Andrej Borsenkow
2001-06-21 9:52 ` Peter Stephenson
2001-06-21 10:34 ` Bart Schaefer [this message]
2001-06-21 15:31 ` PATCH (redux): non-POSIX `for' syntax Peter Stephenson
2001-06-25 16:05 ` Peter Stephenson
2001-06-21 9:55 ` PATCH: POSIX " Bart Schaefer
2001-06-22 6:29 ` PATCH: test case for " Andrej Borsenkow
2001-06-22 23:49 ` PATCH: 4.1: multi-parameter for loop Zefram
2001-06-23 0:04 ` Bart Schaefer
2001-06-21 8:33 ` Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1010621103439.ZM9814@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).