Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.278
retrieving revision 1.277
diff -u -r1.278 -r1.277
--- generic/tcl.h	17 Nov 2008 22:26:53 -0000	1.278
+++ generic/tcl.h	22 Oct 2008 20:23:59 -0000	1.277
@@ -13,7 +13,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tcl.h,v 1.278 2008/11/17 22:26:53 ferrieux Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.277 2008/10/22 20:23:59 nijtmans Exp $
  */
 
 #ifndef _TCL
@@ -2004,7 +2004,6 @@
 #define TCL_TOKEN_SUB_EXPR	64
 #define TCL_TOKEN_OPERATOR	128
 #define TCL_TOKEN_EXPAND_WORD	256
-#define TCL_TOKEN_UNCOLLAPSED_TEXT 512
 
 /*
  * Parsing error types. On any parsing error, one of these values will be
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.162
retrieving revision 1.160
diff -u -r1.162 -r1.160
--- generic/tclCompile.c	19 Nov 2008 00:00:20 -0000	1.162
+++ generic/tclCompile.c	26 Oct 2008 18:34:04 -0000	1.160
@@ -11,7 +11,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclCompile.c,v 1.162 2008/11/19 00:00:20 ferrieux Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.160 2008/10/26 18:34:04 dkf Exp $
  */
 
 #include "tclInt.h"
@@ -1077,7 +1077,6 @@
 {
     int numComponents = tokenPtr->numComponents;
     Tcl_Obj *tempPtr = NULL;
-    char *collapsed=NULL;
 
     if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
 	if (valuePtr != NULL) {
@@ -1101,17 +1100,6 @@
 	    }
 	    break;
 
-	case TCL_TOKEN_UNCOLLAPSED_TEXT:
-	    if (tempPtr != NULL) {
-		if (collapsed)
-		    collapsed=ckrealloc(collapsed,tokenPtr->size);
-		else
-		    collapsed=ckalloc(tokenPtr->size);
-		Tcl_AppendToObj(tempPtr, collapsed, TclCopyAndCollapse(tokenPtr->size,tokenPtr->start,collapsed));
-	    }
-	    break;
-
-
 	case TCL_TOKEN_BS:
 	    if (tempPtr != NULL) {
 		char utfBuf[TCL_UTF_MAX];
@@ -1122,14 +1110,12 @@
 
 	default:
 	    if (tempPtr != NULL) {
-		if (collapsed) ckfree(collapsed);
 		Tcl_DecrRefCount(tempPtr);
 	    }
 	    return 0;
 	}
 	tokenPtr++;
     }
-    if (collapsed) ckfree(collapsed);
     if (valuePtr != NULL) {
 	Tcl_AppendObjToObj(valuePtr, tempPtr);
 	Tcl_DecrRefCount(tempPtr);
@@ -1462,7 +1448,7 @@
 		     */
 
 		    objIndex = TclRegisterNewNSLiteral(envPtr,
-						       tokenPtr[1].start, tokenPtr[1].size);
+			    tokenPtr[1].start, tokenPtr[1].size);
 		    if (cmdPtr != NULL) {
 			TclSetCmdNameObj(interp,
 			      envPtr->literalArrayPtr[objIndex].objPtr,cmdPtr);
@@ -1486,7 +1472,7 @@
 		     * which already allows absolute counting.
 		     */
 		    objIndex = TclRegisterNewLiteral(envPtr,
-						     tokenPtr[1].start, tokenPtr[1].size);
+			    tokenPtr[1].start, tokenPtr[1].size);
 
 		    if (eclPtr->type == TCL_LOCATION_SOURCE) {
 			EnterCmdWordIndex(eclPtr,
@@ -1623,7 +1609,6 @@
     int numObjsToConcat, nameBytes, localVarName, localVar;
     int length, i;
     unsigned char *entryCodeNext = envPtr->codeNext;
-    char *collapsed=NULL;
 
     Tcl_DStringInit(&textBuffer);
     numObjsToConcat = 0;
@@ -1633,14 +1618,6 @@
 	    Tcl_DStringAppend(&textBuffer, tokenPtr->start, tokenPtr->size);
 	    break;
 
-	case TCL_TOKEN_UNCOLLAPSED_TEXT:
-	    if (collapsed)
-		collapsed=ckrealloc(collapsed,tokenPtr->size);
-	    else
-		collapsed=ckalloc(tokenPtr->size);
-	    Tcl_DStringAppend(&textBuffer, collapsed, TclCopyAndCollapse(tokenPtr->size,tokenPtr->start,collapsed));
-	    break;
-
 	case TCL_TOKEN_BS:
 	    length = Tcl_UtfBackslash(tokenPtr->start, NULL, buffer);
 	    Tcl_DStringAppend(&textBuffer, buffer, length);
@@ -1756,8 +1733,6 @@
 	}
     }
 
-    if (collapsed) ckfree(collapsed);
-
     /*
      * Push any accumulated characters appearing at the end.
      */
Index: generic/tclParse.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclParse.c,v
retrieving revision 1.75
diff -u -r1.75 tclParse.c
--- generic/tclParse.c	19 Nov 2008 00:00:20 -0000	1.75
+++ generic/tclParse.c	26 Nov 2008 00:10:40 -0000
@@ -435,7 +435,7 @@
 	    }
 
 	    if (isLiteral) {
-		int elemCount = 0, code = TCL_OK;
+		int elemCount = 0, code = TCL_OK, nakedbs = 0;
 		const char *nextElem, *listEnd, *elemStart;
 
 		/*
@@ -457,20 +457,36 @@
 		 */
 
 		while (nextElem < listEnd) {
+		    int size,brace;
+
 		    code = TclFindElement(NULL, nextElem, listEnd - nextElem,
-			    &elemStart, &nextElem, NULL, NULL);
+			    &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
+		     * 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.
 		     */
 
@@ -532,29 +548,6 @@
 			    tokenPtr[-1].size += (isspace(UCHAR(
 				tokenPtr->start[tokenPtr->size])) == 0);
 			}
-			if (tokenPtr[-1].start[0]!='{')
-			    {
-				const char *s;
-				int n;
-
-				for(n=tokenPtr->size,s=tokenPtr->start;n>0;n--,s++)
-				    {
-					if ((*s)=='\\') {
-					    tokenPtr->type = TCL_TOKEN_UNCOLLAPSED_TEXT;
-					    /*
-					     * In this case we also demote the
-					     * enclosing token from
-					     * SIMPLE_WORD to WORD in order to
-					     * preserve the simplicity of all
-					     * shortcuts made on SIMPLE_WORDs
-					     * in clients.
-					     */
-					    tokenPtr[-1].type = TCL_TOKEN_WORD;
-					    break;
-					}
-				    }
-			    }
-
 			tokenPtr++;
 		    }
 		}
@@ -2156,7 +2149,6 @@
 {
     Tcl_Obj *result;
     int code = TCL_OK;
-    char *collapsed = NULL;
 
     /*
      * Each pass through this loop will substitute one token, and its
@@ -2181,15 +2173,6 @@
 	    appendByteLength = tokenPtr->size;
 	    break;
 
-	case TCL_TOKEN_UNCOLLAPSED_TEXT:
-	    if (collapsed)
-		collapsed=ckrealloc(collapsed,tokenPtr->size);
-	    else
-		collapsed=ckalloc(tokenPtr->size);
-	    appendByteLength=TclCopyAndCollapse(tokenPtr->size,tokenPtr->start,collapsed);
-	    append=collapsed;
-	    break;
-
 	case TCL_TOKEN_BS:
 	    appendByteLength = Tcl_UtfBackslash(tokenPtr->start, NULL,
 		    utfCharBytes);
@@ -2302,8 +2285,6 @@
 	    }
 	}
     }
-    if (collapsed) ckfree(collapsed);
-
     if (code != TCL_ERROR) {		/* Keep error message in result! */
 	if (result != NULL) {
 	    Tcl_SetObjResult(interp, result);
Index: generic/tclTest.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTest.c,v
retrieving revision 1.132
diff -u -r1.132 tclTest.c
--- generic/tclTest.c	25 Nov 2008 06:48:01 -0000	1.132
+++ generic/tclTest.c	26 Nov 2008 00:10:47 -0000
@@ -3451,9 +3451,6 @@
 	case TCL_TOKEN_TEXT:
 	    typeString = "text";
 	    break;
-	case TCL_TOKEN_UNCOLLAPSED_TEXT:
-	    typeString = "text-to-collapse";
-	    break;
 	case TCL_TOKEN_BS:
 	    typeString = "backslash";
 	    break;
Index: tests/parse.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/parse.test,v
retrieving revision 1.35
diff -u -r1.35 parse.test
--- tests/parse.test	17 Nov 2008 22:37:36 -0000	1.35
+++ tests/parse.test	26 Nov 2008 00:10:49 -0000
@@ -234,7 +234,7 @@
 } {- {{*}{a b}} 2 simple a 1 text a 0 simple b 1 text b 0 {}}
 test parse-5.29 {Tcl_ParseCommand: {*} parsing, expanded literals, naked backslashes} testparser {
     testparser {{*}{a \n b}} 0
-} {- {{*}{a \n b}} 3 simple a 1 text a 0 word {\n} 1 text-to-collapse {\n} 0 simple b 1 text b 0 {}}
+} {- {{*}{a \n b}} 1 expand {{*}{a \n b}} 1 text {a \n b} 0 {}}
 
 test parse-6.1 {ParseTokens procedure, empty word} testparser {
     testparser {""} 0
