zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: lexer issue
Date: Sat, 31 Mar 2018 18:17:21 +0100	[thread overview]
Message-ID: <4294A9D0-3BF2-4EE5-8C7E-743DCFE2D2DD@ntlworld.com> (raw)
In-Reply-To: <9531.1522231067@thecus>



On 28 March 2018 10:57:47 BST, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
>Peter wrote:
>> Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
>> > Does anyone know what may be causing this:
>> > 
>> >     echo $(( ((##h << 8) + ##e) << 8)+<SPACE>
>> >   ??? echo $(( ((##h << 8) +
>> > 
>> > This is with space bound to magic-space.
>>
>> This will be to do with the fact that you've closed one of the
>> parentheses of the arithmetic expression, but not the other, so the
>next
>> expansion has decided it's a command substitution.  In that, the ##e
>is
>> a comment, so gets stripped.  In fact, I'm not seeing the effect you
>> are, which may be down to options, or to the fact that the way we
>handle
>> interactive comments changed recently, or a combination.

Sorry, limited network access at the moment so partial
poorly formatted reply.

This is indeed because it looks like a command subst that
went wrong. I think the math aspect is actually irrelevant.

>It can be reproduced starting from zsh -f with nothing more than
>  bindkey ' ' magic-space
>So interactive_comments is not set.

That appears to be important but I'm not sure why.

However, I think I do understand the basics of this.

When we  do the recursive parse of the command subst we
abort and flush the history on failure. But inside a string it
doesn't bother finishing off the history line. That's important in
this case because we're using that line directly as the string
we get from the nested lex.

Full patch when my laptop finds its way to Wi-Fi but for a taster:

In herrflush() , !strin should be (!strin || lex_add_raw) for which 
the static before lex_add_raw in lex. c has to go; inside the loop, in
addition to hwaddc() the return from ingetc() has also to be
passed to addtoline(). The !lexstop tests need tweaking as a consequence.

If that was too garbled I will be doing this properly next week. 

Haven't seen any side effects but they are endemic in the lexer /
ZLE interface so some playing around wil be necessary. 

pws



  reply	other threads:[~2018-03-31 17:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180327111617epcas3p264cdae264e676ace2503d20bd919ea5e@epcas3p2.samsung.com>
2018-03-27 11:05 ` Oliver Kiddle
2018-03-27 11:56   ` Peter Stephenson
2018-03-28  9:57     ` Oliver Kiddle
2018-03-31 17:17       ` Peter Stephenson [this message]
2018-04-04 17:10         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4294A9D0-3BF2-4EE5-8C7E-743DCFE2D2DD@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).