summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-03-05 14:03:42 -0800
committerBart Schaefer <schaefer@zsh.org>2023-03-05 14:03:42 -0800
commita9ba1662165823a0303a03fdeddb2ce4ca3814e5 (patch)
tree4e6d63f11ccb7650bd31ff93f47354adaf446cc4 /Src/utils.c
parent806d096b0e7a64bf9712be1cb8159a1ef5b4bf81 (diff)
downloadzsh-a9ba1662165823a0303a03fdeddb2ce4ca3814e5.tar.gz
zsh-a9ba1662165823a0303a03fdeddb2ce4ca3814e5.zip
51483: Enable assignment and expansion of parameters with ksh-like namespace prefixes.
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 55f2d1ab0..1393ecb13 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3123,7 +3123,7 @@ spckword(char **s, int hist, int cmd, int ask)
if (**s == String && !*t) {
guess = *s + 1;
- if (itype_end(guess, IIDENT, 1) == guess)
+ if (itype_end(guess, INAMESPC, 1) == guess)
return;
ic = String;
d = 100;
@@ -4310,13 +4310,27 @@ wcsitype(wchar_t c, int itype)
* If "once" is set, just test the first character, i.e. (outptr !=
* inptr) tests whether the first character is valid in an identifier.
*
- * Currently this is only called with itype IIDENT, IUSER or ISEP.
+ * Currently called only with itype INAMESPC, IIDENT, IUSER or ISEP.
*/
/**/
mod_export char *
itype_end(const char *ptr, int itype, int once)
{
+ if (itype == INAMESPC) {
+ itype = IIDENT;
+ if (once == 0 && !isset(POSIXIDENTIFIERS)) {
+ /* Special case for names containing ".", ksh93 namespaces */
+ char *t = itype_end(ptr + (*ptr == '.'), itype, 0);
+ if (t > ptr+1) {
+ if (*t == '.')
+ return itype_end(t+1, itype, 0);
+ else
+ return t;
+ }
+ }
+ }
+
#ifdef MULTIBYTE_SUPPORT
if (isset(MULTIBYTE) &&
(itype != IIDENT || !isset(POSIXIDENTIFIERS))) {