1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

27092: missing then-clause for if wasn't an error

This commit is contained in:
Peter Stephenson 2009-07-06 20:44:28 +00:00
parent 0cc033db7c
commit c6a3ccc8d7
3 changed files with 17 additions and 2 deletions

View file

@ -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 $
*****************************************************

View file

@ -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;

View file

@ -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