zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Subject: Re: '<<-' here-documents oddity with line continuation
Date: Fri, 9 Feb 2018 17:07:32 +0100	[thread overview]
Message-ID: <abe0eef0-e1f8-081b-9af7-e089b91ecebe@inlv.org> (raw)
In-Reply-To: <20180209152715.GA14126@chaz.gmail.com>

Op 09-02-18 om 16:27 schreef Stephane Chazelas:
> Note that there's also:
> 
> cat << EOF
> foo
> E\
> OF
> 
> which zsh does differently from other shells (and that nobody
> would ever do).

IOW, all shells support line continuation within the terminating
delimiter except zsh. Eesh.

Somebody somewhere has probably done this. I'll see if I can rethink my
patch to fix this as well.

> About order and token recognition to reply on Martijn's initial
> report, note  that in:
> 
> echo "$(echo 'foo\
> bar')"
> 
> Or
> 
> echo "$(cat << 'EOF'
> foo\
> bar
> EOF
> )"
> 
> The \<LF> is meant *not* to be treated as a line continuation.
> bash fixed a bug recently for that (the latter used to output
> "foobar", it's only fixed on the development branch).

(For the record, it looks like zsh handles both correctly with or
without the patch.)

> So there has to be some level of tokenisation and parsing done
> before line continuation is handled. It's not like in C where
> it's done as one of the first steps of the pre-processing stage.

Yes, I did realise as I was figuring out this patch that I slightly got
the wrong idea in the initial report, as the gethere() conversion
function appears to depend on tokenisation having already happened.

- Martijn


  reply	other threads:[~2018-02-09 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 17:39 Martijn Dekker
2018-02-09  7:01 ` Martijn Dekker
2018-02-09  7:58   ` Martijn Dekker
2018-02-09  9:24   ` Peter Stephenson
2018-02-09 15:27     ` Stephane Chazelas
2018-02-09 16:07       ` Martijn Dekker [this message]
2018-02-09 18:19         ` Martijn Dekker
2018-02-12 10:07           ` 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=abe0eef0-e1f8-081b-9af7-e089b91ecebe@inlv.org \
    --to=martijn@inlv.org \
    --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).