zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Bug in if... then if... parsing
Date: Sun, 6 Mar 2016 15:05:46 -0800	[thread overview]
Message-ID: <160306150547.ZM17307@torch.brasslantern.com> (raw)
In-Reply-To: <160306142731.ZM3208@torch.brasslantern.com>

On Mar 6,  2:27pm, Bart Schaefer wrote:
}
} As far as I can tell this only happens when "if" immediately follows "then".

The following seems to be the simplest fix.  I was afraid this was going
to be a lot harder to track down.

Does anyone recall why par_list() and par_list1() return a value when
literally nothing ever examines that value?  What does the 1 or 0 that
is returned even mean?

diff --git a/Src/parse.c b/Src/parse.c
index 628a9aa..349d1e4 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1413,7 +1413,7 @@ par_if(int *cmplx)
 	}
     }
     cmdpop();
-    if (xtok == ELSE) {
+    if (xtok == ELSE || tok == ELSE) {
 	pp = ecadd(0);
 	cmdpush(CS_ELSE);
 	while (tok == SEPER)


  reply	other threads:[~2016-03-06 23:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06 22:27 Bart Schaefer
2016-03-06 23:05 ` Bart Schaefer [this message]
2016-03-07 10:44   ` Peter Stephenson

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=160306150547.ZM17307@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).