Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: behavior of test true -a \( ! -a \)
On Thu, Mar 21, 2024 at 5:25 AM Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
>
> I think we factor out simple cases with two or three arguments and
> assume they aren't doing grouping or logical combinations, so that might
> be OK. Obviously once we're into more complciated expressions it's
> going to get fraught
Isn't the problem really here?
if (n_testargs > 2) {
/* three arguments: if the second argument is a binary operator, *
* perform that binary test on the first and the third argument */
if (!strcmp(*testargs, "=") ||
!strcmp(*testargs, "==") ||
!strcmp(*testargs, "!=") ||
(IS_DASH(**testargs) && get_cond_num(*testargs + 1) >= 0)) {
s1 = tokstr;
condlex();
s2 = tokstr;
condlex();
s3 = tokstr;
condlex();
return par_cond_triple(s1, s2, s3);
}
}
Shouldn't this be doing an expression parse for s3 rather than just
lexing a token? Admittedly I'm not sure how that factors in s1 given
that s2 is the actual binary operator here.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author