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

Re: Bug in if... then if... parsing



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)



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