summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
diff options
context:
space:
mode:
authorwelch <welch>1999-07-02 06:41:23 (GMT)
committerwelch <welch>1999-07-02 06:41:23 (GMT)
commitb7e8369091ba30a1598b6b2c9bf440a007baced3 (patch)
treecbe0bd27d4413c6dbc5c788f534133a809340def /generic/tclParse.c
parent77a4b3e4bb780523b51caec96494323aebc956af (diff)
downloadtcl-b7e8369091ba30a1598b6b2c9bf440a007baced3.zip
tcl-b7e8369091ba30a1598b6b2c9bf440a007baced3.tar.gz
tcl-b7e8369091ba30a1598b6b2c9bf440a007baced3.tar.bz2
Improved support for empty array names
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r--generic/tclParse.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 4f35468..e465ad7 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -14,7 +14,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.7 1999/05/04 01:32:12 stanton Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.8 1999/07/02 06:41:23 welch Exp $
*/
#include "tclInt.h"
@@ -1592,6 +1592,7 @@ Tcl_ParseVarName(interp, string, numBytes, parsePtr, append)
unsigned char c;
int varIndex, offset;
Tcl_UniChar ch;
+ unsigned array;
if (numBytes >= 0) {
end = string + numBytes;
@@ -1698,12 +1699,17 @@ Tcl_ParseVarName(interp, string, numBytes, parsePtr, append)
}
break;
}
+
+ /*
+ * Support for empty array names here.
+ */
+ array = ((src != end) && (*src == '('));
tokenPtr->size = src - tokenPtr->start;
- if (tokenPtr->size == 0) {
+ if (tokenPtr->size == 0 && !array) {
goto justADollarSign;
}
parsePtr->numTokens++;
- if ((src != end) && (*src == '(')) {
+ if (array) {
/*
* This is a reference to an array element. Call
* ParseTokens recursively to parse the element name,