diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclParse.c | 38 |
2 files changed, 29 insertions, 15 deletions
@@ -1,3 +1,9 @@ +2005-10-04 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tclParse.c (Tcl_ParseCommand): add code that recognizes + {} in addition to {expand} for word expansion (make with + -DALLOW_EMPTY_EXPAND). + 2005-10-04 Zoran Vasiljevic <vasiljevic@users.sourceforge.net> * generic/tclIO.c (Tcl_ClearChannelHandlers): now deletes any diff --git a/generic/tclParse.c b/generic/tclParse.c index 53b2021..eac35be 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.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: tclParse.c,v 1.43 2005/07/21 14:38:50 dkf Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.44 2005/10/04 23:49:45 hobbs Exp $ */ #include "tclInt.h" @@ -374,20 +374,28 @@ Tcl_ParseCommand(interp, start, numBytes, nested, parsePtr) */ expPtr = &parsePtr->tokenPtr[expIdx]; - if ((expPfxLen == (size_t) expPtr->size) - /* Same length as prefix */ - && (0 == expandWord) - /* Haven't seen prefix already */ - && (1 == parsePtr->numTokens - expIdx) - /* Only one token */ - && (0 == strncmp(expPfx,expPtr->start,expPfxLen)) - /* Is the prefix */ - && (numBytes > 0) - && (TclParseWhiteSpace(termPtr, numBytes, parsePtr, &type) - == 0) - && (type != TYPE_COMMAND_END) - /* Non-whitespace follows */ - ) { + if ( + (0 == expandWord) + /* Haven't seen prefix already */ + && (1 == parsePtr->numTokens - expIdx) + /* Only one token */ + && (((expPfxLen == (size_t) expPtr->size) + /* Same length as prefix */ + && (0 == strncmp(expPfx,expPtr->start,expPfxLen))) +#ifdef ALLOW_EMPTY_EXPAND + /* + * Allow {} in addition to {expand} + */ + || (0 == (size_t) expPtr->size) +#endif + ) + /* Is the prefix */ + && (numBytes > 0) + && (TclParseWhiteSpace(termPtr, numBytes, parsePtr, + &type) == 0) + && (type != TYPE_COMMAND_END) + /* Non-whitespace follows */ + ) { expandWord = 1; parsePtr->numTokens--; goto parseWord; |