summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-07-09 14:51:44 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-07-09 14:51:44 (GMT)
commite57b07943eb8c2ee68eb8c1c9a23d9837116d0da (patch)
treea7ab6d4af84bc774fd886e0b055e52e5fd4b0ea0
parent7649a3a78d3c1826a7ab683a06c6e7ab9fc6b442 (diff)
downloadtcl-e57b07943eb8c2ee68eb8c1c9a23d9837116d0da.zip
tcl-e57b07943eb8c2ee68eb8c1c9a23d9837116d0da.tar.gz
tcl-e57b07943eb8c2ee68eb8c1c9a23d9837116d0da.tar.bz2
* generic/tclCompExpr.c: Added missing creation and return
of the Tcl_Parse fields that indicate error conditions. [Bug 1749987]
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclCompExpr.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 38ae503..01b575a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-09 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCompExpr.c: Added missing creation and return
+ of the Tcl_Parse fields that indicate error conditions. [Bug 1749987]
+
2007-07-05 Don Porter <dgp@users.sourceforge.net>
* library/init.tcl (unknown): Corrected inconsistent error message
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index b178a2a..3474562 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.59 2007/07/05 22:21:35 dgp Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.60 2007/07/09 14:51:44 dgp Exp $
*/
#include "tclInt.h"
@@ -450,6 +450,7 @@ ParseExpr(
}
scanned = 0;
insertMark = 1;
+ parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
code = TCL_ERROR;
continue;
}
@@ -631,6 +632,7 @@ ParseExpr(
if (prec[nodePtr[-1].lexeme] > precedence) {
if (nodePtr[-1].lexeme == OPEN_PAREN) {
TclNewLiteralStringObj(msg, "unbalanced open paren");
+ parsePtr->errorType = TCL_PARSE_MISSING_PAREN;
} else if (nodePtr[-1].lexeme == COMMA) {
msg = Tcl_ObjPrintf(
"missing function argument at %s", mark);
@@ -708,6 +710,7 @@ ParseExpr(
if ((otherPtr->lexeme == OPEN_PAREN)
&& (lexeme != CLOSE_PAREN)) {
TclNewLiteralStringObj(msg, "unbalanced open paren");
+ parsePtr->errorType = TCL_PARSE_MISSING_PAREN;
code = TCL_ERROR;
break;
}
@@ -852,6 +855,9 @@ ParseExpr(
parsePtr->string, (numBytes < limit) ? "" : "..."));
}
+ if (code != TCL_OK && parsePtr->errorType == TCL_PARSE_SUCCESS) {
+ parsePtr->errorType = TCL_PARSE_SYNTAX;
+ }
return code;
}
@@ -1225,6 +1231,8 @@ Tcl_ParseExpr(
/* Holds the Tcl_Tokens of substitutions */
int code = ParseExpr(interp, start, numBytes, &opTree, litList,
funcList, exprParsePtr);
+ int errorType = exprParsePtr->errorType;
+ const char* term = exprParsePtr->term;
if (numBytes < 0) {
numBytes = (start ? strlen(start) : 0);
@@ -1235,7 +1243,8 @@ Tcl_ParseExpr(
ConvertTreeToTokens(interp, start, numBytes, opTree, litList,
exprParsePtr->tokenPtr, parsePtr);
} else {
- /* TODO: copy over any error info to *parsePtr */
+ parsePtr->term = term;
+ parsePtr->errorType = errorType;
}
Tcl_FreeParse(exprParsePtr);