From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-workers@zsh.org
Subject: Re: behavior of test true -a \( ! -a \)
Date: Thu, 21 Mar 2024 12:06:20 -0700 [thread overview]
Message-ID: <CAH+w=7YZW4p4Y6-zCMgpX=5p6Fy7PWmA6rDqGqxxVD8ADDCu-A@mail.gmail.com> (raw)
In-Reply-To: <409557737.5903555.1711023912772@mail.virginmedia.com>
On Thu, Mar 21, 2024 at 5:25 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> 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.
next prev parent reply other threads:[~2024-03-21 19:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 10:07 Vincent Lefevre
2024-03-21 10:28 ` Peter Stephenson
2024-03-21 11:04 ` Vincent Lefevre
2024-03-21 11:29 ` Peter Stephenson
2024-03-21 12:18 ` Vincent Lefevre
2024-03-21 12:25 ` Peter Stephenson
2024-03-21 19:06 ` Bart Schaefer [this message]
2024-03-22 5:02 ` Bart Schaefer
2024-03-25 16:38 ` Peter Stephenson
2024-03-25 17:36 ` Bart Schaefer
2024-04-03 13:59 ` Vincent Lefevre
2024-03-21 17:39 ` Bart Schaefer
2024-03-23 21:48 ` Bart Schaefer
2024-03-23 22:20 ` Vincent Lefevre
2024-03-23 22:41 ` Bart Schaefer
2024-03-23 23:33 ` Lawrence Velázquez
2024-03-24 0:14 ` Bart Schaefer
2024-03-24 2:52 ` Lawrence Velázquez
2024-03-25 10:23 ` Vincent Lefevre
2024-03-25 15:21 ` Bart Schaefer
2024-03-25 17:33 ` Vincent Lefevre
2024-03-25 17:43 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7YZW4p4Y6-zCMgpX=5p6Fy7PWmA6rDqGqxxVD8ADDCu-A@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).