Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Here docs
- X-seq: zsh-workers 1873
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Here docs
- Date: Thu, 01 Aug 1996 15:49:39 +0200
- In-reply-to: "borsenkow.msk@xxxxxx"'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@xxxxxx 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@xxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author