Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: syntax error with anonymous functions when an argument begins with (
I think the fact the shell parses the token immediately after the "}" as
a command word is an accident; for a real command to follow, we'd need a
separator, just as with the end of a simple command line. Anyway,
resetting the flags seems to work.
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.88
diff -p -u -r1.88 parse.c
--- Src/parse.c 19 Jun 2011 20:12:00 -0000 1.88
+++ Src/parse.c 27 Jul 2011 18:30:44 -0000
@@ -1465,6 +1465,7 @@ par_funcdef(void)
ecssub = oecssub;
YYERRORV(oecused);
}
+ incmdpos = 0;
zshlex();
} else if (unset(SHORTLOOPS)) {
lineno += oldlineno;
@@ -1720,6 +1721,7 @@ par_simple(int *complex, int nr)
ecssub = oecssub;
YYERROR(oecused);
}
+ incmdpos = 0;
zshlex();
} else {
int ll, sl, c = 0;
Index: Test/C04funcdef.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C04funcdef.ztst,v
retrieving revision 1.8
diff -p -u -r1.8 C04funcdef.ztst
--- Test/C04funcdef.ztst 19 Jun 2011 20:12:00 -0000 1.8
+++ Test/C04funcdef.ztst 27 Jul 2011 18:30:44 -0000
@@ -1,3 +1,8 @@
+%prep
+
+ mkdir funcdef.tmp
+ cd funcdef.tmp
+
%test
fn1() { return 1; }
@@ -228,6 +233,18 @@
> print Following bit
>}
+ touch yes no
+ () { echo $1 } (y|z)*
+ (echo here)
+ () { echo $* } some (y|z)*
+ () { echo empty };(echo here)
+0:Anonymous function arguments and command arguments
+>yes
+>here
+>some yes
+>empty
+>here
+
%clean
rm -f file.in file.out
Messages sorted by:
Reverse Date,
Date,
Thread,
Author