summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-07-18 15:42:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-07-18 15:42:54 (GMT)
commit64759df0b78b38806d06382708eaebe16ce7c07e (patch)
tree10b1fe79c403e17da470df6f8eb602fc0b7c1a7d
parent6d2beac7e80048bcc4d4d46c68ec4f55d90986b3 (diff)
parent517197f8571ca5ff1c51b2cadc771505922d9137 (diff)
downloadtcl-64759df0b78b38806d06382708eaebe16ce7c07e.zip
tcl-64759df0b78b38806d06382708eaebe16ce7c07e.tar.gz
tcl-64759df0b78b38806d06382708eaebe16ce7c07e.tar.bz2
merge trunk
-rw-r--r--generic/tclAssembly.c15
-rw-r--r--generic/tclBasic.c5
-rw-r--r--generic/tclCompile.c6
-rw-r--r--tests/assemble.test3
4 files changed, 14 insertions, 15 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 1a061f0..0722eb9 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -1013,8 +1013,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 */
@@ -1028,10 +1026,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.
@@ -1040,7 +1034,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;
@@ -1060,6 +1054,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 bd4f157..82affb0 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -5082,7 +5082,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;
}
/*
@@ -5338,6 +5340,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 763e8f1..a52ad3e 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -2109,7 +2109,6 @@ TclCompileScript(
Tcl_LogCommandInfo(interp, script, parse.commandStart,
parse.term + 1 - parse.commandStart);
TclCompileSyntaxError(interp, envPtr);
- Tcl_FreeParse(&parse);
return;
}
@@ -2242,10 +2241,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;
}
diff --git a/tests/assemble.test b/tests/assemble.test
index 7d4e5d1..b0487e6 100644
--- a/tests/assemble.test
+++ b/tests/assemble.test
@@ -175,8 +175,7 @@ test assemble-4.1 {syntax error} {
-match glob
-result {1 {extra characters after close-brace} {extra characters after close-brace
while executing
-"{}extra
- "
+"{}e"
("assemble" body, line 2)*}}
}
test assemble-4.2 {null command} {