zsh-workers
 help / color / mirror / code / Atom feed
* Problem with function definition and [[/((
@ 2006-06-24 21:17 Stephane Chazelas
  2006-06-26  9:57 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2006-06-24 21:17 UTC (permalink / raw)
  To: Zsh hackers list

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
(1)~$ '
function function function quote>

Same goes for:

odd() (( $1 % 2 ))

-- 
Stéphane


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

* Re: Problem with function definition and [[/((
  2006-06-24 21:17 Problem with function definition and [[/(( Stephane Chazelas
@ 2006-06-26  9:57 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2006-06-26  9:57 UTC (permalink / raw)
  To: Zsh hackers list

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@csr.com>                  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


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

end of thread, other threads:[~2006-06-26  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-24 21:17 Problem with function definition and [[/(( Stephane Chazelas
2006-06-26  9:57 ` 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).