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

Re: Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var})



On Thu, Feb 22, 2024 at 2:31 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Another possibility therefore is to to have %l do raw output but NOT
> unmetafy(), so the caller would need to either unmetafy() and pass a
> length, or nicedup() the string when that was the desired output
> (which handles the unmetafy() internally, and nul-terminates).

The changes for that are minimal.  With them, Stephane's math-garbles
handle the ellipsis more cleanly:

% printf '%d\n' '1+|ÃÃÃÃÃÃ'
zsh: bad math expression: operand expected at `|\M-C\M-c\...'
0
% ((1+|ÃÃÃÃÃÃ))
zsh: bad math expression: operand expected at `|Ã?Ã?Ã?...'

And the ${..?..} error messages come out as expected:

% err=$'one\ntwo'
% print ${a?$err}
zsh: a: one
two

I'm not sure what if anything to change about yyerror() in parse.c,
it's already untokenize()ing what it passes and maybe that shouldn't
be "nice" anyway?

No patch until I have more feedback, this time.




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