From dcd4f02845cba2a19895e03b53e9dcea1817d3ad Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Tue, 17 Oct 2017 20:29:47 -0700 Subject: 41902: ${(z)...} continues parsing on unmatched quote when CSH_JUNKIE_QUOTES is set Tests for 41902 and 41873 --- Src/lex.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Src/lex.c') 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) -- cgit 1.4.1