Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is there something in parser that always starts new token?
- X-seq: zsh-users 21833
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Is there something in parser that always starts new token?
- Date: Fri, 02 Sep 2016 17:43:54 +0100
- In-reply-to: <CAKc7PVApnS8mM1kQNF341Uq-NG9AferCgYjO+im5=wkZDLGp5g@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CAKc7PVApnS8mM1kQNF341Uq-NG9AferCgYjO+im5=wkZDLGp5g@mail.gmail.com>
On Fri, 02 Sep 2016 18:27:11 +0200
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hello
> a='`something something else'; print -rl -- "${(@z)a}"
> output: `something something else
>
> I would like to manually divide the string after "something". Is there
> something in (z) flag that could be used to force new token?
The trouble here, as I see it, is that once you've realised the
expression you've got doesn't work as it is (in this case you've got
what looks like an incomplete backquoted substitution), what you decide
to do with it isn't down to the parser, which has given you its
best shot. This is compounded by the fact that zsh doesn't understand
incomplete expressions --- there's nothing like parse-partial-sexp ---
so you can't take them apart, and there's nothing that does
token-by-token splitting rather than word-by-word splitting. What's
more, ${(Q)a} doesn't even understand complete backquote expressions
since it only deals with quotes with no side effect.
You could just split the expression using non-syntactic word splitting,
and take the words after the first as your new input.
If instead what you want to do is remove the backquote, then I think
you're going to have to do that by hand.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author