From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: comment block curiosity
Date: Mon, 4 Jan 2021 11:28:19 -0800 [thread overview]
Message-ID: <CAH+w=7bQrR--FkmvVkT0whr-WtWXD_ENQ02RtU=U_pWkNMA5bQ@mail.gmail.com> (raw)
In-Reply-To: <eda6fc7d-18b0-6845-a383-39f745bd9272@eastlink.ca>
On Mon, Jan 4, 2021 at 9:09 AM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> On 2021-01-03 10:10 p.m., Daniel Shahaf wrote:
> >
> > % zsh -f =(print -rC1 -- 'alias -g "|&"=": <<EOC"' 'echo foo' '|&' 'echo bar' 'EOC' 'echo baz')
>
> That is an invocation only an Adeptus dare use!
A somewhat more readable variation:
% zsh -f =(<<\EOSCRIPT
alias -g "|&"=": <<EOC"
echo foo
|&
echo bar
EOC
echo baz
EOSCRIPT
)
Also, "print -C1" is the same as "print -l" if that makes it more obvious.
> > ... The lexer doesn't emit a token for comments ...
> Is there some way of seeing lexer output?
You get that from
setopt xtrace
but redirections (including here-documents) are also omitted.
setopt verbose
gets the contents of the here-document, but neither of those setopts
shows expanded aliases, so with the "|&" alias in place you can't see
the "<<EOC" operator itself.
You can also get a lexical breakdown by using the (z) or (Z+c+)
parameter expansion flags, but those also do not expand aliases and
don't know about here-documents so you get the contents of the
here-document parsed into tokens as well. I suppose the latter could
be considered a bug.
prev parent reply other threads:[~2021-01-04 19:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-03 17:09 Ray Andrews
2021-01-03 17:26 ` Bart Schaefer
2021-01-03 17:36 ` Ray Andrews
2021-01-03 17:43 ` Bart Schaefer
2021-01-03 18:30 ` Ray Andrews
2021-01-03 18:50 ` Bart Schaefer
2021-01-03 21:17 ` Ray Andrews
2021-01-03 21:31 ` Ray Andrews
2021-01-04 6:10 ` Daniel Shahaf
2021-01-04 17:09 ` Ray Andrews
2021-01-04 19:28 ` Bart Schaefer [this message]
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='CAH+w=7bQrR--FkmvVkT0whr-WtWXD_ENQ02RtU=U_pWkNMA5bQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=rayandrews@eastlink.ca \
--cc=zsh-users@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).