From 3154c0f487e39f1d7ad82415bcb33fcfc614593b Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 21 Aug 2006 17:15:21 +0000 Subject: * generic/tclParseExpr.c: Revised mistaken call to TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same additional info in error message. --- ChangeLog | 4 ++++ generic/tclParseExpr.c | 19 ++++++++++++------- 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 * 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; } -- cgit v0.12