summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2020-08-24 13:31:00 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2020-08-24 13:31:00 (GMT)
commitfe94c1d6c4fa1c0d810d2eb6b845e7d0faf8812c (patch)
tree8142f58dec8cbaef0dbba7953de362400c6c4cb4 /generic/tclCompExpr.c
parent1192757fb71a5f28fa60aa3e5c23ac851adabc3e (diff)
downloadtcl-fe94c1d6c4fa1c0d810d2eb6b845e7d0faf8812c.zip
tcl-fe94c1d6c4fa1c0d810d2eb6b845e7d0faf8812c.tar.gz
tcl-fe94c1d6c4fa1c0d810d2eb6b845e7d0faf8812c.tar.bz2
Tricky case in function calls.
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 5c5a491..30ca876 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -676,9 +676,10 @@ ParseExpr(
OpNode *newPtr = NULL;
do {
- if (size <= UINT_MAX/sizeof(OpNode)) {
- newPtr = (OpNode *)attemptckrealloc(nodes, size * sizeof(OpNode));
- }
+ if (size <= UINT_MAX/sizeof(OpNode)) {
+ newPtr = (OpNode *) attemptckrealloc(nodes,
+ size * sizeof(OpNode));
+ }
} while ((newPtr == NULL)
&& ((size -= (size - nodesUsed) / 2) > nodesUsed));
if (newPtr == NULL) {
@@ -748,6 +749,32 @@ ParseExpr(
} else if (Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
lexeme = BOOLEAN;
} else {
+ /*
+ * Tricky case: see test expr-62.10
+ */
+
+ int scanned2 = scanned;
+ do {
+ scanned2 += TclParseAllWhiteSpace(
+ start + scanned2, numBytes - scanned2);
+ scanned2 += ParseLexeme(
+ start + scanned2, numBytes - scanned2, &lexeme,
+ NULL);
+ } while (lexeme == COMMENT);
+ if (lexeme == OPEN_PAREN) {
+ /*
+ * Actually a function call, but with obscuring
+ * comments. Skip to the start of the parentheses.
+ * Note that we assume that open parentheses are one
+ * byte long.
+ */
+
+ lexeme = FUNCTION;
+ Tcl_ListObjAppendElement(NULL, funcList, literal);
+ scanned = scanned2 - 1;
+ break;
+ }
+
Tcl_DecrRefCount(literal);
msg = Tcl_ObjPrintf("invalid bareword \"%.*s%s\"",
(scanned < limit) ? scanned : limit - 3, start,