Subject: Re: Bug in if... then if... parsing
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Sun, 6 Mar 2016 15:05:46 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

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)