diff options
author | dgp <dgp@noemail.net> | 2008-12-01 22:39:58 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2008-12-01 22:39:58 (GMT) |
commit | 84e732511ddd88a96c0689615bf01fd839eb0875 (patch) | |
tree | 88b11698fc24efd19c62dcaa00ccb112b7347694 /generic/tclParse.c | |
parent | c59a25874dca5159cc5155b405f9f234ab63e0e1 (diff) | |
download | tcl-84e732511ddd88a96c0689615bf01fd839eb0875.zip tcl-84e732511ddd88a96c0689615bf01fd839eb0875.tar.gz tcl-84e732511ddd88a96c0689615bf01fd839eb0875.tar.bz2 |
* generic/tclParse.c: Backport fix for [Bug 2251175].
FossilOrigin-Name: 0fe1dac07375ec1e86f07d9d02ee00f4f00841b1
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; |