summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2005-10-04 23:49:45 (GMT)
committerhobbs <hobbs>2005-10-04 23:49:45 (GMT)
commitfeed575edf673f8860aa50a1eaaddc5aa887b893 (patch)
treecb59d78bfb3bf0bcdb545158876c04cb1aaf3448 /generic
parente42551f6773bb3d5f293f15ffec064a6338ea9a9 (diff)
downloadtcl-feed575edf673f8860aa50a1eaaddc5aa887b893.zip
tcl-feed575edf673f8860aa50a1eaaddc5aa887b893.tar.gz
tcl-feed575edf673f8860aa50a1eaaddc5aa887b893.tar.bz2
* generic/tclParse.c (Tcl_ParseCommand): add code that recognizes
{} in addition to {expand} for word expansion (make with -DALLOW_EMPTY_EXPAND).
Diffstat (limited to 'generic')
-rw-r--r--generic/tclParse.c38
1 files changed, 23 insertions, 15 deletions
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;