summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Src/init.c2
-rw-r--r--Src/parse.c7
-rw-r--r--Test/01grammar.ztst9
3 files changed, 11 insertions, 7 deletions
diff --git a/Src/init.c b/Src/init.c
index 131b50606..5f0c98ca0 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -944,7 +944,7 @@ source(char *s)
execode(prog, 1, 0);
popheap();
} else
- loop(0, 0); /* loop through the file to be sourced */
+ loop(0, 0); /* loop through the file to be sourced */
sourcelevel--;
/* restore the current shell state */
diff --git a/Src/parse.c b/Src/parse.c
index 453e45ad0..5e90984ac 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -459,6 +459,7 @@ par_event(void)
}
}
if (!r) {
+ tok = LEXERR;
if (errflag) {
yyerror(0);
ecused--;
@@ -491,10 +492,8 @@ parse_list(void)
yylex();
init_parse();
par_list(&c);
-#if 0
- if (tok == LEXERR)
-#endif
- if (tok != ENDINPUT) {
+ if (tok != ENDINPUT) {
+ tok = LEXERR;
yyerror(0);
return NULL;
}
diff --git a/Test/01grammar.ztst b/Test/01grammar.ztst
index 361512e98..0ef1a1756 100644
--- a/Test/01grammar.ztst
+++ b/Test/01grammar.ztst
@@ -50,9 +50,8 @@
#
# Tests for `Precommand Modifiers'
#
- - sh -c 'echo $0'
+ - $ZTST_testdir/../Src/zsh -fc "[[ \$0 = \"-$ZTST_testdir/../Src/zsh\" ]]"
0:`-' precommand modifier
->-sh
echo f*
noglob echo f*
@@ -107,6 +106,12 @@
0:`if ...' (iii)
>false
+ if true;
+ :
+ fi
+1d:`if ...' (iv)
+?ZTST_execchunk:-1: parse error near `fi'
+
for name in word to term; do
print $name
done