From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16360 invoked by alias); 9 Dec 2010 18:16:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28508 Received: (qmail 25777 invoked from network); 9 Dec 2010 18:16:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 9 Dec 2010 18:16:32 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Another ${(z)param} buglet Message-ID: <20101209181632.27d47e95@pwslap01u.europe.root.pri> In-Reply-To: <101209074233.ZM8003@torch.brasslantern.com> References: <101207203441.ZM4340@torch.brasslantern.com> <20101208175103.40d6cc29@pwslap01u.europe.root.pri> <101209074233.ZM8003@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Dec 2010 18:16:33.0273 (UTC) FILETIME=[358D3E90:01CB97CD] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.71.0.134 On Thu, 09 Dec 2010 07:42:33 -0800 Bart Schaefer wrote: > Thanks for putting in this effort, but on reflection I think it's > important to be able to specify whether comments are handled or not. > There isn't yet a (Z) flag; perhaps we could make that the equivalent > of turning on interactivecomments, and leave (z) as it was? Wondered about that, but there are so many possible tweaks to word splitting I'm trying to think of a more flexible way than simply two letters (that doesn't involve anything as gross as a shell option). The best I can think of is extending the syntax to append options, a bit like (q) can have the q multiple or a - added, but maybe less gross e.g. explicit option flags like z+c+ to turn on comment handling (and possibly z+C+ to strip comments). '+' appears not to be taken so would work without complications and there's a mnemonic that there's more to come (compared with "(q-)"). > I'm undecided on stripping comments vs. leaving them as "tokens" for > manual removal, but I lean to leaving them, as it's possible to remove > them once they've been parsed but it's practically impossible to put > them back once they're gone. That was my thinking, too. > Maybe this gives someone [*] enough to go on to be able to fix that > here-document problem I encountered. That's not easily fixable down here. You need some parsing to tell you where the here documents are and how they fit together. You could do it within bufferwords() by assuming a << token is a here document and being clever with multiple lines, but it's a real mess; they even need to stack because of multios. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom