summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-09-07 14:30:47 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-09-07 14:30:47 (GMT)
commit27306c24b9e0af8fc80742dc287acbe68b072119 (patch)
tree82898d2e9a83146ce6a781691dc07aac6499a221 /generic/tclCompExpr.c
parentce6c10424834a81beb5c714d76a1bd6670d320b5 (diff)
downloadtcl-27306c24b9e0af8fc80742dc287acbe68b072119.zip
tcl-27306c24b9e0af8fc80742dc287acbe68b072119.tar.gz
tcl-27306c24b9e0af8fc80742dc287acbe68b072119.tar.bz2
Tidiness, comments, and tests.dgp_3401704
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 3fdcc22..36e1c9d 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -1919,7 +1919,8 @@ ParseLexeme(
literal = Tcl_NewObj();
if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end,
TCL_PARSE_NO_WHITESPACE) == TCL_OK) {
- if (!isalnum(UCHAR(*end)) && UCHAR(*end) != '_') {
+ if (end < start + numBytes && !isalnum(UCHAR(*end))
+ && UCHAR(*end) != '_') {
number:
TclInitStringRep(literal, start, end-start);
@@ -1932,16 +1933,38 @@ ParseLexeme(
return (end-start);
} else {
unsigned char lexeme;
- const char *p = start;
- while (p < end) {
- if (!isalnum(UCHAR(*p++))) {
- goto number;
+
+ /*
+ * We have a number followed directly by bareword characters
+ * (alpha, digit, underscore). Is this a number followed by
+ * bareword syntax error? Or should we join into one bareword?
+ * Example: Inf + luence + () becomes a valid function call.
+ * [Bug 3401704]
+ */
+ if (literal->typePtr == &tclDoubleType) {
+ const char *p = start;
+ while (p < end) {
+ if (!isalnum(UCHAR(*p++))) {
+ /*
+ * The number has non-bareword characters, so we
+ * must treat it as a number.
+ */
+ goto number;
+ }
}
}
ParseLexeme(end, numBytes-(end-start), &lexeme, NULL);
if ((NODE_TYPE & lexeme) == BINARY) {
+ /*
+ * The bareword characters following the number take the
+ * form of an operator (eq, ne, in, ni, ...) so we treat
+ * as number + operator.
+ */
goto number;
}
+ /*
+ * Otherwise, fall through and parse the whole as a bareword.
+ */
}
}