From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 925 invoked from network); 26 Feb 2009 22:58:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Feb 2009 22:58:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 68660 invoked from network); 26 Feb 2009 22:58:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Feb 2009 22:58:23 -0000 Received: (qmail 9893 invoked by alias); 26 Feb 2009 22:58:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26617 Received: (qmail 9882 invoked from network); 26 Feb 2009 22:58:18 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 Feb 2009 22:58:18 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id 7CA57805905D for ; Thu, 26 Feb 2009 23:57:55 +0100 (CET) Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090226225754.OUWA7670.mtaout03-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Thu, 26 Feb 2009 22:57:54 +0000 Received: from pws-pc ([81.107.42.185]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090226225754.RYLC2093.aamtaout03-winn.ispmail.ntl.com@pws-pc>; Thu, 26 Feb 2009 22:57:54 +0000 Date: Thu, 26 Feb 2009 22:57:43 +0000 From: Peter Stephenson To: =?UTF-8?B?VG9tw6HFoQ==?= Smetana , zsh-workers@sunsite.dk Subject: Re: PATCH: Error parsing $(...) Message-ID: <20090226225743.1b707d46@pws-pc> In-Reply-To: <20090226094507.43cf3c16@gmail.com> References: <20090226094507.43cf3c16@gmail.com> X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Cloudmark-Analysis: v=1.0 c=1 a=jD5xQAhjpjoA:10 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=zOMttSINo4LenRhYawQA:9 a=PMvZaFQD5Rw8Hi5c1X0A:7 a=iKYizvDCmExOcqzpgXIOLr7r2SQA:4 a=LY0hPdMaydYA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.92.1/9051/Thu Feb 26 14:08:01 2009 on bifrost X-Virus-Status: Clean On Thu, 26 Feb 2009 09:45:07 +0100 Tom=C3=A1=C5=A1 Smetana wrote: > # Comment containing ' > VAR=3D$( > echo a > # Comment containing ' > ) > echo $VAR >=20 > This is syntactically correct but zsh would throw an error parsing it: > parse error near `VAR=3D$(' > > I have written a patch (attached) which seems to fix the problem. > Could you please review the patch and consider applying it? Thanks for reporting this. It's not quite that simple, since "#" is only a comment character at the start of a word. The following is better, I hope I haven't missed any cases... (We could do with some tests for this... and plenty of other things. Anyone can write tests, they're just ordinary shell code comparing against output and status.) Index: Src/lex.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/zsh/zsh/Src/lex.c,v retrieving revision 1.49 diff -u -r1.49 lex.c --- Src/lex.c 25 Feb 2009 10:24:01 -0000 1.49 +++ Src/lex.c 26 Feb 2009 22:49:04 -0000 @@ -1802,16 +1802,18 @@ static int skipcomm(void) { - int pct =3D 1, c; + int pct =3D 1, c, start =3D 1; =20 cmdpush(CS_CMDSUBST); SETPARBEGIN c =3D Inpar; do { + int iswhite; add(c); c =3D hgetc(); if (itok(c) || lexstop) break; + iswhite =3D isep(c); switch (c) { case '(': pct++; @@ -1854,7 +1856,15 @@ else add(c); break; + case '#': + if (start) { + add(c); + while ((c =3D hgetc()) !=3D '\n' && !lexstop) + add(c); + } + break; } + start =3D iswhite; } while (pct); if (!lexstop) --=20 Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/