summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-07-18 15:05:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-07-18 15:05:18 (GMT)
commit517197f8571ca5ff1c51b2cadc771505922d9137 (patch)
tree97de78e38c2f1e7cd5411638a63eaca8ef6f2ab0 /generic
parenta398b126a43e46efa6d6044b0bcf57a4b9385c4e (diff)
downloadtcl-517197f8571ca5ff1c51b2cadc771505922d9137.zip
tcl-517197f8571ca5ff1c51b2cadc771505922d9137.tar.gz
tcl-517197f8571ca5ff1c51b2cadc771505922d9137.tar.bz2
[Bug 1c17fbba5d] Fix -errorinfo from syntax errors so that the error is
not obscured. Instead highlight it by making it the last character quoted.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c15
-rw-r--r--generic/tclBasic.c5
-rw-r--r--generic/tclCompile.c5
3 files changed, 13 insertions, 12 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 62641e6..416ee10 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -985,8 +985,6 @@ TclAssembleCode(
const char* instPtr = codePtr;
/* Where to start looking for a line of code */
- int instLen; /* Length in bytes of the current line of
- * code */
const char* nextPtr; /* Pointer to the end of the line of code */
int bytesLeft = codeLen; /* Number of bytes of source code remaining to
* be parsed */
@@ -1000,10 +998,6 @@ TclAssembleCode(
*/
status = Tcl_ParseCommand(interp, instPtr, bytesLeft, 0, parsePtr);
- instLen = parsePtr->commandSize;
- if (parsePtr->term == parsePtr->commandStart + instLen - 1) {
- --instLen;
- }
/*
* Report errors in the parse.
@@ -1012,7 +1006,7 @@ TclAssembleCode(
if (status != TCL_OK) {
if (flags & TCL_EVAL_DIRECT) {
Tcl_LogCommandInfo(interp, codePtr, parsePtr->commandStart,
- instLen);
+ parsePtr->term + 1 - parsePtr->commandStart);
}
FreeAssemblyEnv(assemEnvPtr);
return TCL_ERROR;
@@ -1032,6 +1026,13 @@ TclAssembleCode(
*/
if (parsePtr->numWords > 0) {
+ int instLen = parsePtr->commandSize;
+ /* Length in bytes of the current command */
+
+ if (parsePtr->term == parsePtr->commandStart + instLen - 1) {
+ --instLen;
+ }
+
/*
* If tracing, show each line assembled as it happens.
*/
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index b2a505a..1d35034 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -5084,7 +5084,9 @@ TclEvalEx(
do {
if (Tcl_ParseCommand(interp, p, bytesLeft, 0, parsePtr) != TCL_OK) {
code = TCL_ERROR;
- goto error;
+ Tcl_LogCommandInfo(interp, script, parsePtr->commandStart,
+ parsePtr->term + 1 - parsePtr->commandStart);
+ goto posterror;
}
/*
@@ -5340,6 +5342,7 @@ TclEvalEx(
Tcl_LogCommandInfo(interp, script, parsePtr->commandStart,
commandLength);
}
+ posterror:
iPtr->flags &= ~ERR_ALREADY_LOGGED;
/*
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 633966e..6a2a318 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1790,10 +1790,7 @@ TclCompileScript(
*/
Tcl_LogCommandInfo(interp, script, parsePtr->commandStart,
- /* Drop the command terminator (";","]") if appropriate */
- (parsePtr->term ==
- parsePtr->commandStart + parsePtr->commandSize - 1)?
- parsePtr->commandSize - 1 : parsePtr->commandSize);
+ parsePtr->term + 1 - parsePtr->commandStart);
TclCompileSyntaxError(interp, envPtr);
break;
}