diff options
author | dgp <dgp@users.sourceforge.net> | 2008-12-01 22:39:58 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-12-01 22:39:58 (GMT) |
commit | 7d7e6c17a1d6a68a6ca89923164fa69be4244f6e (patch) | |
tree | 88b11698fc24efd19c62dcaa00ccb112b7347694 /generic/tclParse.c | |
parent | 336831b7a640936c4ab784e96c3c0116fe3b04aa (diff) | |
download | tcl-7d7e6c17a1d6a68a6ca89923164fa69be4244f6e.zip tcl-7d7e6c17a1d6a68a6ca89923164fa69be4244f6e.tar.gz tcl-7d7e6c17a1d6a68a6ca89923164fa69be4244f6e.tar.bz2 |
* generic/tclParse.c: Backport fix for [Bug 2251175].
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 3197ac8..769be99 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.62.2.1 2008/05/21 20:38:09 dgp Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.62.2.2 2008/12/01 22:39:59 dgp Exp $ */ #include "tclInt.h" @@ -435,7 +435,7 @@ Tcl_ParseCommand( } if (isLiteral) { - int elemCount = 0, code = TCL_OK; + int elemCount = 0, code = TCL_OK, nakedbs = 0; const char *nextElem, *listEnd, *elemStart; /* @@ -457,21 +457,37 @@ Tcl_ParseCommand( */ while (nextElem < listEnd) { + int size, brace; + code = TclFindElement(NULL, nextElem, listEnd - nextElem, - &elemStart, &nextElem, NULL, NULL); - if (code != TCL_OK) break; + &elemStart, &nextElem, &size, &brace); + if (code != TCL_OK) { + break; + } + if (!brace) { + const char *s; + + for(s=elemStart;size>0;s++,size--) { + if ((*s)=='\\') { + nakedbs=1; + break; + } + } + } if (elemStart < listEnd) { elemCount++; } } - if (code != TCL_OK) { + if ((code != TCL_OK) || nakedbs) { /* - * Some list element could not be parsed. This means the - * literal string was not in fact a valid list. Defer the - * handling of this to compile/eval time, where code is - * already in place to report the "attempt to expand a - * non-list" error. + * Some list element could not be parsed, or contained + * naked backslashes. This means the literal string was + * not in fact a valid nor canonical list. Defer the + * handling of this to compile/eval time, where code is + * already in place to report the "attempt to expand a + * non-list" error or expand lists that require + * substitution. */ tokenPtr->type = TCL_TOKEN_EXPAND_WORD; |