Overview
| Artifact ID: | 7a6a54e3ec897b272787443d177b476eb805d7a4 |
|---|---|
| Ticket: | 219829ffffffffffffffffffffffffffffffffff
"subst" processes "return" incorrectly |
| User & Date: | hobbs on 2000-11-02 04:45:26 |
Changes
- closedate changed to: "2000-11-01T21:45:26"
- closer changed to: "hobbs"
- icomment:
Fixed with the following patch. There was varying behavior from 7.6 to 8.2 that (in 8.0+) was all broken in one way or another. The following allows for the best effort, keeping close compatability with 7.6. cvs diff -bc generic/tclParse.c Index: generic/tclParse.c =================================================================== RCS file: /home/cvs/external/tcl/generic/tclParse.c,v retrieving revision 1.13 diff -b -c -r1.13 tclParse.c *** tclParse.c 1999/11/10 02:51:57 1.13 --- tclParse.c 2000/11/01 21:43:50 *************** *** 1456,1470 **** Tcl_DecrRefCount(objv[i]); } if (gotParse) { ! p = parse.commandStart + parse.commandSize; Tcl_FreeParse(&parse); ! if ((nested != 0) && (p > script) && (p[-1] == ']')) { /* * We get here in the special case where the TCL_BRACKET_TERM ! * flag was set in the interpreter and we reached a close ! * bracket in the script. Return immediately. */ iPtr->termOffset = (p - 1) - script; } else { iPtr->termOffset = p - script; --- 1456,1506 ---- Tcl_DecrRefCount(objv[i]); } if (gotParse) { ! next = parse.commandStart + parse.commandSize; ! bytesLeft -= next - p; ! p = next; Tcl_FreeParse(&parse); ! ! if ((nested != 0) && (p > script)) { ! char *nextCmd = NULL; /* pointer to start of next command */ ! /* * We get here in the special case where the TCL_BRACKET_TERM ! * flag was set in the interpreter. ! * ! * At this point, we want to find the end of the script ! * (either end of script or the closing ']'). ! */ ! ! while ((p[-1] != ']') && bytesLeft) { ! if (Tcl_ParseCommand(NULL, p, bytesLeft, nested, &parse) ! != TCL_OK) { ! /* ! * We were looking for the ']' to close the script. ! * But if we find a syntax error, it is ok to quit ! * early since in that case we no longer need to know ! * where the ']' is (if there was one). We reset the ! * pointer to the start of the command that after the ! * one causing the return. -- hobbs */ + p = (nextCmd == NULL) ? parse.commandStart : nextCmd; + break; + } + + if (nextCmd == NULL) { + nextCmd = parse.commandStart; + } + + /* + * Advance to the next command in the script. + */ + + next = parse.commandStart + parse.commandSize; + bytesLeft -= next - p; + p = next; + Tcl_FreeParse(&parse); + } iPtr->termOffset = (p - 1) - script; } else { iPtr->termOffset = p - script; - login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"