From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Here docs
Date: Thu, 01 Aug 1996 15:49:39 +0200 [thread overview]
Message-ID: <199608011349.PAA09906@hydra.ifh.de> (raw)
In-Reply-To: "borsenkow.msk@sni.de"'s message of "Thu, 01 Aug 1996 13:10:42 MET." <Pine.SV4.3.95.960801125025.4508D-100000@itsrm1>
I expect Zoltan's already fixed this, but anyway...
borsenkow.msk@sni.de wrote:
> On Thu, 1 Aug 1996, Peter Stephenson wrote:
>
> > Anyone know the proper backslash rules for here documents?
>
> Here is relevant part form XPG4 Shell:
>
> 1. Section 2.7.4 (Here-document)
>
> ...
> In this case, the backslash in the input will behave as the
> backslash inside double-quotes (see Section 2.2.3) However, the
> double-quote character (") will not be treated specially within a
> here-document, except when the double-quote appears within $(), ``, or
> ${}.
That's clear enough for here documents... the question is what should
happen at other times when zsh is parsing something in the same way.
This is usually when tokenising a string that hadn't already been
through the lexer, but is going to have some substitution arrangement
performed on it (this does not include many obvious cases like
$(...)). If the answer is that \" should be left in this case too,
the fix is easy.
I believe this fix is right in all those cases for the following
reason: the code in dquote_parse() is specifically set up not to treat
unbackslashed " specially in these circumstances (test at line 1095 of
lex.c), so should not treat backslashed " specially either.
This should make Configure happier, any chance that it might work now?
There's a very minor difference left:
% cat <<EOS
> ${not_set:-\}}
> EOS
ksh gives \} and zsh gives } as output. I like zsh's better.
*** Src/lex.c.bsqt Wed Jul 24 16:34:31 1996
--- Src/lex.c Thu Aug 1 15:29:18 1996
***************
*** 1001,1007 ****
c = hgetc();
if (c != '\n')
add(c == '$' || c == '\\' || (c == '}' && !intick && bct) ||
! c == '\"' || c == '`' ? Bnull : '\\');
else if (sub || unset(CSHJUNKIEQUOTES) || endchar != '"')
continue;
break;
--- 1001,1007 ----
c = hgetc();
if (c != '\n')
add(c == '$' || c == '\\' || (c == '}' && !intick && bct) ||
! (endchar && c == '\"') || c == '`' ? Bnull : '\\');
else if (sub || unset(CSHJUNKIEQUOTES) || endchar != '"')
continue;
break;
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
next prev parent reply other threads:[~1996-08-01 14:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-31 21:11 Announcement draft Zoltan Hidvegi
1996-07-31 22:15 ` Zefram
1996-08-01 6:36 ` Bas V. de Bakker
1996-08-01 8:31 ` Peter Stephenson
1996-08-01 9:04 ` Running zsh as sh (Was: Announcement draft) Bas V. de Bakker
1996-08-01 9:10 ` Announcement draft Andrej Borsenkow
1996-08-01 13:49 ` Peter Stephenson [this message]
1996-08-01 14:07 ` Here docs Zoltan Hidvegi
1996-08-01 16:27 ` More Configure problems Peter Stephenson
1996-08-01 17:40 ` Peter Stephenson
1996-08-01 17:55 ` Zoltan Hidvegi
1996-08-01 21:03 ` Zoltan Hidvegi
1996-08-01 23:30 ` Zoltan Hidvegi
1996-08-02 8:32 ` Peter Stephenson
1996-08-02 10:03 ` Andrej Borsenkow
1996-08-02 13:29 ` Zoltan Hidvegi
1996-08-02 1:03 ` Zefram
1996-08-01 14:42 ` Announcement draft Zoltan Hidvegi
1996-08-08 15:13 ` sh compatibility again :-> Andrej Borsenkow
1996-08-12 2:18 ` Zoltan Hidvegi
1996-08-12 4:36 ` Bart Schaefer
1996-08-12 5:00 ` Zefram
1996-08-12 6:01 ` Bart Schaefer
1996-08-12 6:34 ` Bart Schaefer
1996-08-12 6:20 ` Andrej Borsenkow
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=199608011349.PAA09906@hydra.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/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).