From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16937 invoked from network); 18 May 2001 09:57:15 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 May 2001 09:57:15 -0000 Received: (qmail 9781 invoked by alias); 18 May 2001 09:57:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14379 Received: (qmail 9751 invoked from network); 18 May 2001 09:57:02 -0000 From: "Bart Schaefer" Message-Id: <1010518095513.ZM22272@candle.brasslantern.com> Date: Fri, 18 May 2001 09:55:13 +0000 In-Reply-To: <200105170903.LAA18640@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: Quoting and ${(e)param} (was Re: destructive list-expand)" (May 17, 11:03am) References: <200105170903.LAA18640@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.dk Subject: Re: Quoting and ${(e)param} (was Re: destructive list-expand) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii (Hello, it's nearly 3am here and I'm waiting for my Windows machine to repair its disk ... if I leave it alone I can't answer the dialogs that it throws up periodically, and not answering causes it to lock up and have to be reset, which of course only makes matters worse ...) On May 17, 11:03am, Sven Wischnowsky wrote: } } Actually, the current state really isn't that far away from the right } thing. The (e) flag should make only the $-expansions from the value be } done on the result. Because of that parsing the string as in double } quotes is the right thing. Using parse_subst_string() or adding the } `parsestr()-as-if-not-in-quotes' Bart suggested would make glob pattern } be expanded, too. OK, that's obviously not ideal ... } So the easiest solution would be to just make paramsubst() always } tokenize the pattern strings, not only if it knows that the parameter } expansion is in quotes. I was fearing that this might result in some } quoting problems (having to double backslashes or some such), but it } seems to work, including handling of parameter expansions inside } patterns. Yes, it's pretty obvious that it should work: parse_subst_str() does an untokenize() before it lexes the string, so it won't matter if the string is or is not already tokenized. All that your patch is doing is removing an optimization. Consequently I think it would be OK to include it (possibly with the #if replaced by an explanatory comment). It'll slow down expansion of un- quoted parameters slightly in the name of correctness, a tradeoff I made several times in my subscript-parsing changes. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net