mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
42297: (e) subscript flag needs extra work with scalars
This commit is contained in:
parent
449f13a467
commit
b066cc3ea9
3 changed files with 41 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2018-05-14 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* 42297: dana: Src/params.c, Test/D06subscript.ztst: (e)
|
||||||
|
subscript needs extra work with scalars.
|
||||||
|
|
||||||
|
* 42234: Stephane: Src/signals.c: don't kill a process that's
|
||||||
|
already exited when killing a job.
|
||||||
|
|
||||||
2018-05-13 Oliver Kiddle <okiddle@yahoo.co.uk>
|
2018-05-13 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||||
|
|
||||||
* 42488: Src/Modules/mathfunc.c, Src/builtin.c, Src/math.c,
|
* 42488: Src/Modules/mathfunc.c, Src/builtin.c, Src/math.c,
|
||||||
|
|
20
Src/params.c
20
Src/params.c
|
@ -1515,7 +1515,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!v->isarr && !word) {
|
if (!v->isarr && !word && !quote_arg) {
|
||||||
l = strlen(s);
|
l = strlen(s);
|
||||||
if (a2) {
|
if (a2) {
|
||||||
if (!l || *s != '*') {
|
if (!l || *s != '*') {
|
||||||
|
@ -1534,9 +1534,23 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!keymatch) {
|
if (!keymatch) {
|
||||||
if (quote_arg)
|
if (quote_arg) {
|
||||||
untokenize(s);
|
untokenize(s);
|
||||||
else
|
/* Scalar (e) needs implicit asterisk tokens */
|
||||||
|
if (!v->isarr && !word) {
|
||||||
|
l = strlen(s);
|
||||||
|
d = (char *) hcalloc(l + 2);
|
||||||
|
if (a2) {
|
||||||
|
*d = Star;
|
||||||
|
strcpy(d + 1, s);
|
||||||
|
} else {
|
||||||
|
strcpy(d, s);
|
||||||
|
d[l] = Star;
|
||||||
|
d[l + 1] = '\0';
|
||||||
|
}
|
||||||
|
s = d;
|
||||||
|
}
|
||||||
|
} else
|
||||||
tokenize(s);
|
tokenize(s);
|
||||||
remnulargs(s);
|
remnulargs(s);
|
||||||
pprog = patcompile(s, 0, NULL);
|
pprog = patcompile(s, 0, NULL);
|
||||||
|
|
|
@ -273,3 +273,19 @@
|
||||||
print ${string[1,twoarg(1,4)]}
|
print ${string[1,twoarg(1,4)]}
|
||||||
0:Commas inside parentheses do not confuse subscripts
|
0:Commas inside parentheses do not confuse subscripts
|
||||||
>abc
|
>abc
|
||||||
|
|
||||||
|
string='foobarbaz foob?rbaz foob?rbaz'
|
||||||
|
print $string[(i)b?r] $string[(I)b?r]
|
||||||
|
print $string[(r)b?r] $string[(R)b?r]
|
||||||
|
print $string[(r)b?r,(R)b?r]
|
||||||
|
print $string[(ei)b?r] $string[(eI)b?r]
|
||||||
|
print $string[(er)b?r] $string[(eR)b?r]
|
||||||
|
print $string[(er)b?r,(eR)b?r]
|
||||||
|
0:Pattern handling with scalars
|
||||||
|
F:Regression test for workers/42297
|
||||||
|
>4 24
|
||||||
|
>b b
|
||||||
|
>barbaz foob?rbaz foob?r
|
||||||
|
>14 24
|
||||||
|
>b b
|
||||||
|
>b?rbaz foob?r
|
||||||
|
|
Loading…
Reference in a new issue