diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-14 06:08:50 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-14 06:08:50 (GMT) |
commit | cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4 (patch) | |
tree | 58b484a653058cac3bd24fba45dcc1578ac093c5 /generic/tclParse.c | |
parent | a09671a0a00f2d3e4abf4747a072da94b0320459 (diff) | |
parent | f70e1f98b3e5235a48e0fbea21515ed7e277e6cd (diff) | |
download | tcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.zip tcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.tar.gz tcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 49ee348..d56a41d 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -119,7 +119,7 @@ const char tclCharTypeTable[] = { * Prototypes for local functions defined in this file: */ -static inline int CommandComplete(const char *script, int numBytes); +static int CommandComplete(const char *script, int numBytes); static int ParseComment(const char *src, int numBytes, Tcl_Parse *parsePtr); static int ParseTokens(const char *src, int numBytes, int mask, @@ -220,6 +220,10 @@ Tcl_ParseCommand( * point to char after terminating one. */ int scanned; + if (numBytes < 0 && start) { + numBytes = strlen(start); + } + TclParseInit(interp, start, numBytes, parsePtr); if ((start == NULL) && (numBytes != 0)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -227,10 +231,6 @@ Tcl_ParseCommand( } return TCL_ERROR; } - if (numBytes < 0) { - numBytes = strlen(start); - } - TclParseInit(interp, start, numBytes, parsePtr); parsePtr->commentStart = NULL; parsePtr->commentSize = 0; parsePtr->commandStart = NULL; @@ -1347,16 +1347,15 @@ Tcl_ParseVarName( int varIndex; unsigned array; - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } /* * Generate one token for the variable, an additional token for the name, @@ -1629,16 +1628,15 @@ Tcl_ParseBraces( const char *src; int startIndex, level, length; - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } src = start; startIndex = parsePtr->numTokens; @@ -1827,16 +1825,15 @@ Tcl_ParseQuotedString( * the quoted string's terminating close-quote * if the parse succeeds. */ { - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } if (TCL_OK != ParseTokens(start+1, numBytes-1, TYPE_QUOTE, TCL_SUBST_ALL, parsePtr)) { @@ -2107,7 +2104,7 @@ TclSubstTokens( * command, which is refered to by 'script'. * The 'clNextOuter' refers to the current * entry in the table of continuation lines in - * this "master script", and the character + * this "main script", and the character * offsets are relative to the 'outerScript' * as well. * @@ -2399,7 +2396,7 @@ TclSubstTokens( *---------------------------------------------------------------------- */ -static inline int +static int CommandComplete( const char *script, /* Script to check. */ int numBytes) /* Number of bytes in script. */ |