zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: Here-strings and $functions
Date: Tue, 24 Jul 2001 06:18:40 +0000	[thread overview]
Message-ID: <1010724061840.ZM15617@candle.brasslantern.com> (raw)
In-Reply-To: <1010724024529.ZM14507@candle.brasslantern.com>

On Jul 24,  2:45am, Bart Schaefer wrote:
}
} schaefer[505] foo() {
} function> <<<'This is a here-string'
} function> }
} schaefer[506] foo
} This is a here-string
} schaefer[507] functions[foo]=$functions[foo]
} schaefer[508] foo
} foo:1: command not found: is
} schaefer[509] functions foo
} foo () {
}         is a here-string'' <<< '''This'
} }
} 
} Uhh, yeah.

This bug is subtle, and I'm not sure how to fix it, and I can't spend
any more time on it tonight as I must get up very early tomorrow ...

The complication is that this:

foo() {
  <<-EOF
	This is a string
	EOF
}

gets converted internally into a REDIR_HERESTR, and so does the original
example with <<<.  But in the case of <<<, THE QUOTES ARE STILL PART OF
THE STRING, as \230 tokens.  For <<-, there are no quotes.  So when we
arrive in getredirs(), in the <<- case we need to insert quotes and then
call bslashquote(), but in the <<< case we only need to untokenize().

The only way to get this right is to know whether the original code was
really a here-string, or actually a full-fledged here-document; but
that information isn't passed down to getredirs() -- I'm not even sure
whether it's available in gettext2().

Otherwise we need to change the way <<< here-strings are parsed, so that
they're stored untokenized and with quotes stripped.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-07-24  6:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-22 22:47 Enhanced shell Peter Stephenson
2001-07-23 11:13 ` Oliver Kiddle
2001-07-23 11:38   ` Peter Stephenson
2001-07-23 18:03     ` Bart Schaefer
2001-07-24 13:42       ` Oliver Kiddle
2001-07-23 12:00   ` Nadav Har'El
2001-07-23 16:38     ` Enable/disable (was Re: Enhanced shell) Bart Schaefer
2001-07-23 22:00       ` Nadav Har'El
2001-07-24  1:12         ` Bart Schaefer
2001-07-24  2:45           ` Here-strings and $functions Bart Schaefer
2001-07-24  6:18             ` Bart Schaefer [this message]
2001-07-24  8:12               ` Sven Wischnowsky
2001-07-24 12:16                 ` Bart Schaefer
2001-07-24  9:23         ` Enable/disable (was Re: Enhanced shell) Peter Stephenson
2001-07-24 12:10           ` PATCH: Doc errors (Re: Enable/disable (was Re: Enhanced shell)) Bart Schaefer
2001-07-29  9:53 ` Enhanced shell Zefram
2001-07-29 22:07   ` Peter Stephenson
2001-07-30  1:34     ` Bart Schaefer
2001-07-30  2:19   ` Bart Schaefer

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=1010724061840.ZM15617@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).