From cbed87baae49fac830307280d020ef823b60d23a Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Fri, 13 Nov 2020 21:16:30 +1000 Subject: core: parser: fix for script with missing end quote Ensure that 'info complete' returns 0 for a script is missing the end quote such as "abc$def Fixes #181 Signed-off-by: Steve Bennett --- jim.c | 3 +++ tests/parse.test | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/jim.c b/jim.c index 6b6be70..0b89cee 100644 --- a/jim.c +++ b/jim.c @@ -1275,6 +1275,9 @@ static int JimParseScript(struct JimParserCtx *pc) pc->tend = pc->p - 1; pc->tline = pc->linenr; pc->tt = JIM_TT_EOL; + if (pc->inquote) { + pc->missing.ch = '"'; + } pc->eof = 1; return JIM_OK; } diff --git a/tests/parse.test b/tests/parse.test index 0194291..b7c2ad3 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -356,4 +356,20 @@ test parse-1.69 {comment with trailing backslash} { eval $x } {} +test parse-1.70 {info complete, missing quotes} { + set v 1 + set result {} + # missing leading quote is ok + foreach p { + {"abc} + {"abc$v} + {abc"} + {abc$v"} + {"abc$v"} + } { + lappend result [info complete $p] + } + set result +} {0 0 1 1 1} + testreport -- cgit v1.1