Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [^ax-y] doesn't work but [^x-ya] does

On Thu, Mar 2, 2017, at 02:47 AM, Peter Stephenson wrote:
> Isn't the same problem showing up here?  Watch closely, I may be missing
> the point...
>   % print ${value//[${foo}b-z]/x}
>   xc
> Oops, should be a combination of the above effects, giving xx, which is
> what you get if you expand the ${foo} by hand...

Yes exactly. With the addition that following works:

# print ${value//[b-z${foo}]/x}
> Unfortunately tracking down where this came in isn't much help as we
> need to be able to get the correct overall effect of either Dash or
> literal '-' in all cases, rather than just moving the problem around.

Looked at code few times when debugging, had an unexamined impression
that sister variable of "seen_brct" is needed:

-                   if (!in_brace_param)
-                       in_brace_param = bct;
+                   if (!in_brace_param) {
+                       if ((in_brace_param = bct))
+                           seen_brct = 0;
+                   }

if resetting seen_brct helps in one case but harms other one. Raw
thought, tokenization is a single-"thread" process, this might be just

Sebastian Gniazdowski

Messages sorted by: Reverse Date, Date, Thread, Author