summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclParse.c6
-rw-r--r--tests/parse.test13
3 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index de404f2..116524f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-24 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclParse.c: Corrected faulty check for trailing white
+ space in {expand} parsing. Thanks Andreas Leitgeb. [Bug 848262].
+ * tests/parse.test: New tests for the bug.
+
2003-11-24 Vince Darley <vincentdarley@users.sourceforge.net>
* generic/tclPathObj.c: fix to [Bug 845778] - Infinite recursion
diff --git a/generic/tclParse.c b/generic/tclParse.c
index e86a7d4..2923642 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -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: tclParse.c,v 1.30 2003/11/15 03:19:17 dgp Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.31 2003/11/24 19:06:08 dgp Exp $
*/
#include "tclInt.h"
@@ -360,7 +360,9 @@ parseWord:
&& (0 == strncmp(expPfx,expPtr->start,expPfxLen))
/* Is the prefix */
&& (numBytes > 0)
- && (0 == TclParseWhiteSpace(termPtr, 1, parsePtr, &type))
+ && (TclParseWhiteSpace(termPtr, numBytes, parsePtr, &type)
+ == 0)
+ && (type != TYPE_COMMAND_END)
/* Non-whitespace follows */
) {
expandWord = 1;
diff --git a/tests/parse.test b/tests/parse.test
index 3a83af1..2ae8152 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: parse.test,v 1.17 2003/11/14 20:44:46 dgp Exp $
+# RCS: @(#) $Id: parse.test,v 1.18 2003/11/24 19:06:08 dgp Exp $
if {[catch {package require tcltest 2.0.2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
@@ -215,6 +215,17 @@ test parse-5.23 {Tcl_ParseCommand: {expand} parsing} testparser {
test parse-5.24 {Tcl_ParseCommand: {expand} parsing} testparser {
testparser {{expand}x} 0
} {- {{expand}x} 1 expand {{expand}x} 1 text x 0 {}}
+test parse-5.25 {Tcl_ParseCommand: {expand} parsing} testparser {
+ testparser {{expand}
+} 0
+} {- {{expand}
+} 1 simple {{expand}} 1 text expand 0 {}}
+test parse-5.26 {Tcl_ParseCommand: {expand} parsing} testparser {
+ testparser {{expand};} 0
+} {- {{expand};} 1 simple {{expand}} 1 text expand 0 {}}
+test parse-5.27 {Tcl_ParseCommand: {expand} parsing} testparser {
+ testparser "{expand}\\\n foo bar" 0
+} {- \{expand\}\\\n\ foo\ bar 3 simple {{expand}} 1 text expand 0 simple foo 1 text foo 0 simple bar 1 text bar 0 {}}
test parse-6.1 {ParseTokens procedure, empty word} testparser {
testparser {""} 0