about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-10-17 20:29:47 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-10-17 20:29:47 -0700
commitdcd4f02845cba2a19895e03b53e9dcea1817d3ad (patch)
treece6312d3acfe1dda31bb428c88db7ec5edb2701b /Src/lex.c
parent3b0c8bdac8930712c2f7ee7fd0b737de2185144f (diff)
downloadzsh-dcd4f02845cba2a19895e03b53e9dcea1817d3ad.tar.gz
zsh-dcd4f02845cba2a19895e03b53e9dcea1817d3ad.tar.xz
zsh-dcd4f02845cba2a19895e03b53e9dcea1817d3ad.zip
41902: ${(z)...} continues parsing on unmatched quote when CSH_JUNKIE_QUOTES is set
Tests for 41902 and 41873
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Src/lex.c b/Src/lex.c
index e0190afc6..c2a59661c 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1291,7 +1291,9 @@ gettokstr(int c, int sub)
 		ALLOWHIST
 		if (c != '\'') {
 		    unmatched = '\'';
-		    peek = LEXERR;
+		    /* Not an error when called from bufferwords() */
+		    if (!(lexflags & LEXFLAGS_ACTIVE))
+			peek = LEXERR;
 		    cmdpop();
 		    goto brk;
 		}
@@ -1313,7 +1315,9 @@ gettokstr(int c, int sub)
 	    cmdpop();
 	    if (c) {
 		unmatched = '"';
-		peek = LEXERR;
+		/* Not an error when called from bufferwords() */
+		if (!(lexflags & LEXFLAGS_ACTIVE))
+		    peek = LEXERR;
 		goto brk;
 	    }
 	    c = Dnull;
@@ -1350,7 +1354,9 @@ gettokstr(int c, int sub)
 	    cmdpop();
 	    if (c != '`') {
 		unmatched = '`';
-		peek = LEXERR;
+		/* Not an error when called from bufferwords() */
+		if (!(lexflags & LEXFLAGS_ACTIVE))
+		    peek = LEXERR;
 		goto brk;
 	    }
 	    c = Tick;
@@ -1392,7 +1398,7 @@ gettokstr(int c, int sub)
 	return LEXERR;
     }
     hungetc(c);
-    if (unmatched)
+    if (unmatched && !(lexflags & LEXFLAGS_ACTIVE))
 	zerr("unmatched %c", unmatched);
     if (in_brace_param) {
 	while(bct-- >= in_brace_param)