summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/parse.c4
-rw-r--r--Test/A01grammar.ztst7
3 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a8c06afc..fb30a1b91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-06  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 27092: Src/parse.c, Test/A01grammar.ztst: "if" didn't check
+	for missing clauses so a missing then-clause wasn't spotted
+	as an error.
+
 2009-07-05  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* Brendan Cully: 27088: Completion/Unix/Command/_hg,
@@ -11904,5 +11910,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4727 $
+* $Revision: 1.4728 $
 *****************************************************
diff --git a/Src/parse.c b/Src/parse.c
index f0a66ea12..89ef68688 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1199,6 +1199,10 @@ par_if(int *complex)
 	type = (xtok == IF ? WC_IF_IF : WC_IF_ELIF);
 	par_save_list(complex);
 	incmdpos = 1;
+	if (tok == ENDINPUT) {
+	    cmdpop();
+	    YYERRORV(oecused);
+	}
 	while (tok == SEPER)
 	    zshlex();
 	xtok = FI;
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 8f4ed2c19..e976c8356 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -378,10 +378,15 @@
 >true-2
 >false
 
-  if true; print true
+  if { true } print true
+  if { false } print false
 0:Short form of `if'
 >true
 
+  eval "if"
+1:Short form of `if' can't be too short
+?(eval):1: parse error near `if'
+
   for name ( word1 word2 word3 ) print $name
 0:Form of `for' with parentheses.
 >word1