Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/3] jp: Use `(nil)` for empty identifier strings
- X-seq: zsh-workers 42275
- From: Joey Pabalinas <joeypabalinas@xxxxxxxxx>
- To: schaefer@xxxxxxxxxxxxxxxx
- Subject: [PATCH 2/3] jp: Use `(nil)` for empty identifier strings
- Date: Sun, 14 Jan 2018 05:23:43 -1000
- Cc: dana@xxxxxxx, zsh-workers@xxxxxxx, Joey Pabalinas <joeypabalinas@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x4QzhMeWQfs3LeFWoEvSfJDUxAh2DHqcyLEJZzUcgYU=; b=Lw/5Htq5sjCPjo+P5bEZaf24EWUb/OhANQpWhj1RrV+H2XlR2kJ/Q0DFFfJzIOvTq8 SuTn4ZwJfpmNFPxrw2mD2a+2nha+NP+vQitrOfVUPVQ23cdaZFGFmu5T7NyFThdPdngr T8F+sCWpKQbWFfWn06Zx66f352FvBw/bz8y1wrfRgCEfkXx3lJHz6egma1SEBX7YzLp8 6yWVKqy48U/y1qb9niQ+Z0puDxYux6bwiT6G//SMGvSxrSEb1xktqwMo+pfLFDPxhqmt 2z6UvDn2zAJJQpzufoF0nESVLH8gNGOP/PdA914l3iQIjUQWt4MoOAj3QwTzOyJVL32V NNGQ==
- In-reply-to: <20180114152344.12018-1-joeypabalinas@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180114152344.12018-1-joeypabalinas@gmail.com>
Indicate the presence of an empty identifier string using `(nil)`; the
empty string case should still provide a somewhat useful error message using:
> zsh:1: not an identifier: (nil)
rather than:
> zsh:1: not an identifier:
which is fairly confusing and sort of useless.
Signed-off-by: Joey Pabalinas <joeypabalinas@xxxxxxxxx>
Requested-by: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
2 files changed, 6 insertions(+)
diff --git a/Src/params.c b/Src/params.c
index de7730ae735a44963c..44a942296f23ddf88f 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3004,6 +3004,8 @@ assignsparam(char *s, char *val, int flags)
int sstart, created = 0;
if (!isident(s)) {
+ if (!strcmp(s, ""))
+ s = "(nil)";
zerr("not an identifier: %s", s);
zsfree(val);
errflag |= ERRFLAG_ERROR;
diff --git a/Src/subst.c b/Src/subst.c
index d027e3d83cadc631a7..5fe69a6b94bfad8d9e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3150,6 +3150,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
}
if (*itype_end(s, IIDENT, 0)) {
untokenize(s);
+ if (!strcmp(s, ""))
+ s = "(nil)";
zerr("not an identifier: %s", s);
return NULL;
}
@@ -3210,6 +3212,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
++s;
if (*itype_end(s, IIDENT, 0)) {
untokenize(s);
+ if (!strcmp(s, ""))
+ s = "(nil)";
zerr("not an identifier: %s", s);
return NULL;
}
--
2.15.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author