Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Another ${(z)param} buglet



On Thu, 09 Dec 2010 07:42:33 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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 <pws@xxxxxxx>            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



Messages sorted by: Reverse Date, Date, Thread, Author