From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1617 invoked from network); 24 Jul 2001 06:19:47 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Jul 2001 06:19:47 -0000 Received: (qmail 4039 invoked by alias); 24 Jul 2001 06:19:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15467 Received: (qmail 4028 invoked from network); 24 Jul 2001 06:19:40 -0000 From: "Bart Schaefer" Message-Id: <1010724061840.ZM15617@candle.brasslantern.com> Date: Tue, 24 Jul 2001 06:18:40 +0000 In-Reply-To: <1010724024529.ZM14507@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Here-strings and $functions" (Jul 24, 2:45am) References: <20010722224707.BD7621428E@pwstephenson.fsnet.co.uk> <3B5C06E6.FFFCCFCC@u.genie.co.uk> <20010723150019.A25511@leeor.math.technion.ac.il> <1010723163850.ZM14004@candle.brasslantern.com> <20010724010052.A12156@leeor.math.technion.ac.il> <010723181213.ZM14442@candle.brasslantern.com> <1010724024529.ZM14507@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh hackers list Subject: Re: Here-strings and $functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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