summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-11-26 17:00:55 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-11-26 17:00:55 (GMT)
commitf12dc54f7578abc9e2d5f625157263ec5a0bc40e (patch)
tree3e5190c1f6bf7c11a84c866357e5321453acf71b /generic/tclCompExpr.c
parent63678d528b5d4384d8a6fd8941b73888399227e5 (diff)
downloadtcl-f12dc54f7578abc9e2d5f625157263ec5a0bc40e.zip
tcl-f12dc54f7578abc9e2d5f625157263ec5a0bc40e.tar.gz
tcl-f12dc54f7578abc9e2d5f625157263ec5a0bc40e.tar.bz2
Same issue in expr parser also tested and fixed.
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c32
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) {