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 21834
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: Is there something in parser that always starts new token?
- Date: Fri, 2 Sep 2016 21:37:14 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Jz4GVmtsEW0iBgr3AZrXSV9TOoAxDtMyKu9W7w8R4h4=; b=v5E0nptCGWottsBi8piARtTyKKli4aqxFvzEsuhs7N0WqNURLifU/Z7NCvPQUpPZUc 6tPk7/lEeWJqXzAXXpQBjSfEgbpUJ7FwOyCm7m8klIg+CoOjMLYtv+pAuu2tlW86jHH2 hKiTwf3IK4cbQNUaWGf/Y0V7juEntsfK0dxb/2+oT7BsXXh/g7SKdjxUFjvp0WsIdALy u6nSRktLhdykR3NLAkSIKEGzXiRy4xSqTJDW+6tZSmgNhYEJsFHEBOIB/TBWsCC3wrsA if1Q+nwTm9YFhbwb5lSmvSQ3vMLLeTikecMV9DtlZTtftgzgtpABOLGRfyfKqd+to3oS WQhw==
- In-reply-to: <20160902174354.471c308e@pwslap01u.europe.root.pri>
- 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
- References: <CAKc7PVApnS8mM1kQNF341Uq-NG9AferCgYjO+im5=wkZDLGp5g@mail.gmail.com> <20160902174354.471c308e@pwslap01u.europe.root.pri>
On 2 September 2016 at 18:43, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> 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.
I'm using (z) in a special way: I have that vertical and horizontal
selection list, seen here:
https://asciinema.org/a/8k8v5ni5lnnpoc3z5jzl6jgav
All horizontal blocks navigated with the red highlight are obtained
via (z). So what I need is a way to unconditionally force (z) to start
new token, when I detect that a part of line is unbounded via:
exp='`x' # the part of line
exp="$exp test" # an append to test
tokens=( "${(@z)exp}" )
[ "${#tokens}" = "1" ] && echo unbounded
When I get the "unbounded" condition, I can do exp="$exp (some special
char)" so that (z) will just stop at the special value. This way,
despite adding some random special value to the text, I'll at least
have rest of the text correctly splitted.
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author