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

Re: Problem with function definition and [[/((



Stephane Chazelas wrote:
> Hi guys,
> 
> something I just noticed (zsh 4.3.2 and 4.3.2-dev1 from debian
> unstable) and looks like a bug to me:
> 
> ~$ a() [[ a = a ]]
> zsh: parse error near `\n'
> (1)~$ a() [[ a = a ]]
> zsh: parse error near `\n'
> (1)~$ a() [[ a = a ]]
> zsh: parse error near `\n'
> (1)~$ print -P %_
> function function function

Yes, that's a bug.  Thanks.

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.54
diff -u -r1.54 parse.c
--- Src/parse.c	30 May 2006 22:35:03 -0000	1.54
+++ Src/parse.c	26 Jun 2006 09:53:40 -0000
@@ -1672,6 +1672,7 @@
 		    lineno += oldlineno;
 		    ecnpats = onp;
 		    ecssub = oecssub;
+		    cmdpop();
 		    YYERROR(oecused);
 		}
 		yylex();
@@ -1683,8 +1684,10 @@
 		pl = ecadd(WCB_PIPE(WC_PIPE_END, 0));
 
 		par_cmd(&c);
-		if (!c)
+		if (!c) {
+		    cmdpop();
 		    YYERROR(oecused);
+		}
 
 		set_sublist_code(sl, WC_SUBLIST_END, 0, ecused - 1 - sl, c);
 		set_list_code(ll, (Z_SYNC | Z_END), c);

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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