summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-08-21 17:15:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-08-21 17:15:21 (GMT)
commit3154c0f487e39f1d7ad82415bcb33fcfc614593b (patch)
tree7fe4916f200091c197e444c95014c4abfd3b3313
parentf25390269e727c8be50ed17d360459e2249d3592 (diff)
downloadtcl-3154c0f487e39f1d7ad82415bcb33fcfc614593b.zip
tcl-3154c0f487e39f1d7ad82415bcb33fcfc614593b.tar.gz
tcl-3154c0f487e39f1d7ad82415bcb33fcfc614593b.tar.bz2
* generic/tclParseExpr.c: Revised mistaken call to
TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same additional info in error message.
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclParseExpr.c19
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 07fb907..ff86005 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
* generic/tclIOUtil.c: Revisions to complete the thread finalization
of the cwdPathPtr. [Bug 1536142]
+ * generic/tclParseExpr.c: Revised mistaken call to
+ TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same
+ additional info in error message.
+
2006-08-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* win/Makefile.in (gdb): Make this target work so that debugging an
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c
index 199a9cf..2f6589d 100644
--- a/generic/tclParseExpr.c
+++ b/generic/tclParseExpr.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParseExpr.c,v 1.37 2006/08/17 17:43:38 dgp Exp $
+ * RCS: @(#) $Id: tclParseExpr.c,v 1.38 2006/08/21 17:15:21 dgp Exp $
*/
#define OLD_EXPR_PARSER 0
@@ -2219,7 +2219,7 @@ Tcl_ParseExpr(
start, (scanned < limit) ? "" : "...",
(scanned < limit) ? scanned : limit - 3,
start, (scanned < limit) ? "" : "...");
- TclObjPrintf(NULL, post, " or \"%.*s%s(...)\" ?",
+ TclObjPrintf(NULL, post, " or \"%.*s%s(...)\" or ...",
(scanned < limit) ? scanned : limit - 3,
start, (scanned < limit) ? "" : "...");
continue;
@@ -2244,13 +2244,18 @@ Tcl_ParseExpr(
if ((NODE_TYPE & lastNodePtr->lexeme) == LEAF) {
msg = Tcl_NewObj();
TclObjPrintf(NULL, msg, "missing operator at %s", mark);
- scanned = 0;
- insertMark = 1;
operand = scratch.tokenPtr[lastNodePtr->token].start;
- if ((operand[0] == '0') && TclCheckBadOctal(NULL, operand)) {
- post = Tcl_NewStringObj(
- "looks like invalid octal number", -1);
+ if (operand[0] == '0') {
+ Tcl_Obj *copy = Tcl_NewStringObj(operand,
+ start + scanned - operand);
+ if (TclCheckBadOctal(NULL, Tcl_GetString(copy))) {
+ post = Tcl_NewStringObj(
+ "looks like invalid octal number", -1);
+ }
+ Tcl_DecrRefCount(copy);
}
+ scanned = 0;
+ insertMark = 1;
code = TCL_ERROR;
continue;
}