From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16079 invoked from network); 27 Feb 2009 10:20:07 -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; 27 Feb 2009 10:20:07 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 56572 invoked from network); 27 Feb 2009 10:20:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Feb 2009 10:20:01 -0000 Received: (qmail 15414 invoked by alias); 27 Feb 2009 10:19:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26622 Received: (qmail 15399 invoked from network); 27 Feb 2009 10:19:55 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 27 Feb 2009 10:19:55 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id ECF3B8058F83 for ; Fri, 27 Feb 2009 11:19:52 +0100 (CET) Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090227101952.NFBW4080.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Fri, 27 Feb 2009 10:19:52 +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 <20090227101951.WBZN2093.aamtaout03-winn.ispmail.ntl.com@pws-pc>; Fri, 27 Feb 2009 10:19:51 +0000 Date: Fri, 27 Feb 2009 10:19:41 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk Cc: =?UTF-8?B?VG9tw6HFoQ==?= Smetana Subject: Re: PATCH: Error parsing $(...) Message-ID: <20090227101941.5552f177@pws-pc> In-Reply-To: <20090226225743.1b707d46@pws-pc> References: <20090226094507.43cf3c16@gmail.com> <20090226225743.1b707d46@pws-pc> 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=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=jD5xQAhjpjoA:10 a=NLZqzBF-AAAA:8 a=0z78VhnH9HU81DqTn7EA:9 a=cA7MbjzHLGH-YdDke_QA:7 a=9gC08L0blc7OJGZF7z-NdbLiXuwA:4 a=ScSMxcE-fkIA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.92.1/9054/Fri Feb 27 10:02:52 2009 on bifrost X-Virus-Status: Clean oncurrene of 43 On Thu, 26 Feb 2009 22:57:43 +0000 Peter Stephenson wrote: > 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... I should have tested for whitespace including a possible newline, not separators, before the "#" for this level of parsing, and I should have marked that a previous comment line ended in whitespace. Index: Src/lex.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/lex.c,v retrieving revision 1.50 diff -u -r1.50 lex.c --- Src/lex.c 26 Feb 2009 23:01:49 -0000 1.50 +++ Src/lex.c 27 Feb 2009 10:17:51 -0000 @@ -1813,7 +1813,7 @@ c = hgetc(); if (itok(c) || lexstop) break; - iswhite = isep(c); + iswhite = inblank(c); switch (c) { case '(': pct++; @@ -1861,6 +1861,7 @@ add(c); while ((c = hgetc()) != '\n' && !lexstop) add(c); + iswhite = 1; } break; } Index: Test/A01grammar.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A01grammar.ztst,v retrieving revision 1.17 diff -u -r1.17 A01grammar.ztst --- Test/A01grammar.ztst 11 May 2008 19:03:58 -0000 1.17 +++ Test/A01grammar.ztst 27 Feb 2009 10:17:51 -0000 @@ -503,3 +503,15 @@ $ZTST_testdir/../Src/zsh -f NonExistentScript 127q:Non-existent script causes exit status 127 ?$ZTST_testdir/../Src/zsh: can't open input file: NonExistentScript + + (setopt nonomatch + # use this to get stuff at start of line + contents=$'# comment \'\necho value #with " stuff\n# comment\n#comment + echo not#comment\n' + eval 'VAR=$('"$contents"')' + print -l $VAR) +0:comments within $(...) +>value +>not#comment + + -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/