summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/parser.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/parser.c b/src/parser.c
index 9c9a7dc..3131045 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -704,10 +704,14 @@ top:
 	if (kwd & CHKNL) {
 		while (t == TNL) {
 			parseheredoc();
+			checkkwd = 0;
 			t = xxreadtoken();
 		}
 	}
 
+	kwd |= checkkwd;
+	checkkwd = 0;
+
 	if (t != TWORD || quoteflag) {
 		goto out;
 	}
@@ -725,7 +729,7 @@ top:
 		}
 	}
 
-	if (checkkwd & CHKALIAS) {
+	if (kwd & CHKALIAS) {
 		struct alias *ap;
 		if ((ap = lookupalias(wordtext, 1)) != NULL) {
 			if (*ap->val) {
@@ -735,7 +739,6 @@ top:
 		}
 	}
 out:
-	checkkwd = 0;
 #ifdef DEBUG
 	if (!alreadyseen)
 	    TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : ""));