? kaboodle
Index: generic/tclCompExpr.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompExpr.c,v
retrieving revision 1.59
diff -b -u -r1.59 tclCompExpr.c
--- generic/tclCompExpr.c	5 Jul 2007 22:21:35 -0000	1.59
+++ generic/tclCompExpr.c	8 Jul 2007 18:47:17 -0000
@@ -450,6 +450,7 @@
 		}
 		scanned = 0;
 		insertMark = 1;
+		parsePtr->errorType = TCL_PARSE_BAD_NUMBER;
 		code = TCL_ERROR;
 		continue;
 	    }
@@ -708,6 +709,7 @@
 		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 +854,9 @@
 		parsePtr->string, (numBytes < limit) ? "" : "..."));
     }
 
+    if (code != TCL_OK && parsePtr->errorType == TCL_PARSE_SUCCESS) {
+	parsePtr->errorType = TCL_PARSE_SYNTAX;
+    }
     return code;
 }
 
@@ -1225,6 +1230,8 @@
 				/* 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 +1242,8 @@
 	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);
