From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: vared 'functions[xx]'
Date: Thu, 13 Dec 2007 21:41:12 +0000 [thread overview]
Message-ID: <20071213214112.8cb1a094.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <chaz20071213172705.GB24933@artesyncp.com>
On Thu, 13 Dec 2007 17:27:07 +0000
Stephane Chazelas <stephane_chazelas@yahoo.fr> wrote:
> ~$ vared functions\[a\]\
> echo foobar
[and then only after hitting return to accept the edit...]
> zsh: not an identifier: functions[a]
>
> Still, vared showed me the content of $functions[a]. I would
> have expected it to return with an error before (well instead
> of) allowing me to edit the content.
The story here is that vared is using the flag to the parameter that
indicates braces are present. They aren't, actually, it's just a trick
to get extra parameter effects to work. So the parameter code doesn't
care if there's extra stuff after the bits it's handled; the caller
needs to check. When setting the value, the parameter code needs to be
able to parse the entire expression and gives an error if it can't.
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.100
diff -u -r1.100 zle_main.c
--- Src/Zle/zle_main.c 19 Oct 2007 01:33:09 -0000 1.100
+++ Src/Zle/zle_main.c 13 Dec 2007 21:38:55 -0000
@@ -1441,6 +1441,10 @@
zwarnnam(name, "no such variable: %s", args[0]);
return 1;
} else if (v) {
+ if (*s) {
+ zwarnnam(name, "not an identifier: `%s'", args[0]);
+ return 1;
+ }
if (v->isarr) {
/* Array: check for separators and quote them. */
char **arr = getarrvalue(v), **aptr, **tmparr, **tptr;
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
prev parent reply other threads:[~2007-12-13 21:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 17:27 Stephane Chazelas
2007-12-13 21:23 ` Peter Stephenson
2007-12-13 21:41 ` Peter Stephenson [this message]
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=20071213214112.8cb1a094.p.w.stephenson@ntlworld.com \
--to=p.w.stephenson@ntlworld.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).