diff options
author | dgp <dgp@users.sourceforge.net> | 2014-11-26 17:00:55 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-11-26 17:00:55 (GMT) |
commit | 03f0d60f88e00392c71063d8617a35c685d2c474 (patch) | |
tree | 3e5190c1f6bf7c11a84c866357e5321453acf71b /generic/tclCompExpr.c | |
parent | 92402afe21c8b0391c1727986781792eff7dbe86 (diff) | |
download | tcl-03f0d60f88e00392c71063d8617a35c685d2c474.zip tcl-03f0d60f88e00392c71063d8617a35c685d2c474.tar.gz tcl-03f0d60f88e00392c71063d8617a35c685d2c474.tar.bz2 |
Same issue in expr parser also tested and fixed.
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r-- | generic/tclCompExpr.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 9142e2b..dde4e56 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1969,31 +1969,23 @@ ParseLexeme( } } - if (Tcl_UtfCharComplete(start, numBytes)) { - scanned = Tcl_UtfToUniChar(start, &ch); - } else { - char utfBytes[TCL_UTF_MAX]; - memcpy(utfBytes, start, (size_t) numBytes); - utfBytes[numBytes] = '\0'; - scanned = Tcl_UtfToUniChar(utfBytes, &ch); - } - if (!isalnum(UCHAR(ch))) { - *lexemePtr = INVALID; - Tcl_DecrRefCount(literal); - return scanned; - } - end = start; - while (isalnum(UCHAR(ch)) || (UCHAR(ch) == '_')) { - end += scanned; - numBytes -= scanned; - if (Tcl_UtfCharComplete(end, numBytes)) { - scanned = Tcl_UtfToUniChar(end, &ch); + if (!isalnum(UCHAR(*start))) { + if (Tcl_UtfCharComplete(start, numBytes)) { + scanned = Tcl_UtfToUniChar(start, &ch); } else { char utfBytes[TCL_UTF_MAX]; - memcpy(utfBytes, end, (size_t) numBytes); + memcpy(utfBytes, start, (size_t) numBytes); utfBytes[numBytes] = '\0'; scanned = Tcl_UtfToUniChar(utfBytes, &ch); } + *lexemePtr = INVALID; + Tcl_DecrRefCount(literal); + return scanned; + } + end = start; + while (numBytes && (isalnum(UCHAR(*end)) || (UCHAR(*end) == '_'))) { + end += 1; + numBytes -= 1; } *lexemePtr = BAREWORD; if (literalPtr) { |