summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index dde4e56..2470931 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -1920,8 +1920,7 @@ ParseLexeme(
literal = Tcl_NewObj();
if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end,
TCL_PARSE_NO_WHITESPACE) == TCL_OK) {
- if (end < start + numBytes && !isalnum(UCHAR(*end))
- && UCHAR(*end) != '_') {
+ if (end < start + numBytes && !TclIsBareword(*end)) {
number:
TclInitStringRep(literal, start, end-start);
@@ -1945,7 +1944,7 @@ ParseLexeme(
if (literal->typePtr == &tclDoubleType) {
const char *p = start;
while (p < end) {
- if (!isalnum(UCHAR(*p++))) {
+ if (!TclIsBareword(*p++)) {
/*
* The number has non-bareword characters, so we
* must treat it as a number.
@@ -1969,7 +1968,13 @@ ParseLexeme(
}
}
- if (!isalnum(UCHAR(*start))) {
+ /*
+ * We reject leading underscores in bareword. No sensible reason why.
+ * Might be inspired by reserved identifier rules in C, which of course
+ * have no direct relevance here.
+ */
+
+ if (!TclIsBareword(*start) || *start == '_') {
if (Tcl_UtfCharComplete(start, numBytes)) {
scanned = Tcl_UtfToUniChar(start, &ch);
} else {
@@ -1983,7 +1988,7 @@ ParseLexeme(
return scanned;
}
end = start;
- while (numBytes && (isalnum(UCHAR(*end)) || (UCHAR(*end) == '_'))) {
+ while (numBytes && TclIsBareword(*end)) {
end += 1;
numBytes -= 1;
}