Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Here-strings and $functions
- X-seq: zsh-workers 15467
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: Here-strings and $functions
- Date: Tue, 24 Jul 2001 06:18:40 +0000
- In-reply-to: <1010724024529.ZM14507@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20010722224707.BD7621428E@xxxxxxxxxxxxxxxxxxxxxxxx> <3B5C06E6.FFFCCFCC@xxxxxxxxxxxxx> <20010723150019.A25511@xxxxxxxxxxxxxxxxxxxxxxxxx> <1010723163850.ZM14004@xxxxxxxxxxxxxxxxxxxxxxx> <20010724010052.A12156@xxxxxxxxxxxxxxxxxxxxxxxxx> <010723181213.ZM14442@xxxxxxxxxxxxxxxxxxxxxxx> <1010724024529.ZM14507@xxxxxxxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author