diff options
-rw-r--r-- | jim.c | 11 | ||||
-rw-r--r-- | tests/misc.test | 7 |
2 files changed, 13 insertions, 5 deletions
@@ -1309,12 +1309,13 @@ static int JimParseVar(struct JimParserCtx *pc) } } else { - /* Include leading colons */ - while (*pc->p == ':') { - pc->p++; - pc->len--; - } while (!stop) { + /* Skip double colon, but not single colon! */ + if (pc->p[0] == ':' && pc->len > 1 && pc->p[1] == ':') { + pc->p += 2; + pc->len -= 2; + continue; + } if (!((*pc->p >= 'a' && *pc->p <= 'z') || (*pc->p >= 'A' && *pc->p <= 'Z') || (*pc->p >= '0' && *pc->p <= '9') || *pc->p == '_')) diff --git a/tests/misc.test b/tests/misc.test index 5fb84cb..f9a2de7 100644 --- a/tests/misc.test +++ b/tests/misc.test @@ -331,4 +331,11 @@ test split-1.1 "Split with leading null" { split "\0abc\0def\0" \0 } {{} abc def {}} +test parsevar-1.1 "Variables should include double colons" { + set ::a::b 2 + set x $::a::b + unset ::a::b + set x +} 2 + testreport |