diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-11-13 21:16:30 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-11-14 08:57:47 +1000 |
commit | cbed87baae49fac830307280d020ef823b60d23a (patch) | |
tree | 733131773fd4d5479eb5b41a6fa81d1eb58a4249 | |
parent | eaf87dbbda13ff99740d90dd53d54e83499fe722 (diff) | |
download | jimtcl-cbed87baae49fac830307280d020ef823b60d23a.zip jimtcl-cbed87baae49fac830307280d020ef823b60d23a.tar.gz jimtcl-cbed87baae49fac830307280d020ef823b60d23a.tar.bz2 |
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 <steveb@workware.net.au>
-rw-r--r-- | jim.c | 3 | ||||
-rw-r--r-- | tests/parse.test | 16 |
2 files changed, 19 insertions, 0 deletions
@@ -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 |