summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-03-16 14:13:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-03-16 14:13:32 (GMT)
commitdca2b08daf4b0c0cd16dfdf7d6b449c0448907d2 (patch)
treec471d2de916c3cac050922646092534391a2bbca /generic/tclParse.c
parentcb78c7f8a41f037806b2d4b1489bbd1e28f375a2 (diff)
downloadtcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.zip
tcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.tar.gz
tcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.tar.bz2
Rewrites to eliminate isspace() calls.
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r--generic/tclParse.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 158ff42..94d9c50 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -524,28 +524,23 @@ Tcl_ParseCommand(
*/
nextElem = tokenPtr[1].start;
- while (isspace(UCHAR(*nextElem))) {
- nextElem++;
- }
while (nextElem < listEnd) {
+ int quoted, brace;
+
tokenPtr->type = TCL_TOKEN_SIMPLE_WORD;
tokenPtr->numComponents = 1;
- tokenPtr->start = nextElem;
tokenPtr++;
tokenPtr->type = TCL_TOKEN_TEXT;
tokenPtr->numComponents = 0;
TclFindElement(NULL, nextElem, listEnd - nextElem,
&(tokenPtr->start), &nextElem,
- &(tokenPtr->size), NULL);
- if (tokenPtr->start + tokenPtr->size == listEnd) {
- tokenPtr[-1].size = listEnd - tokenPtr[-1].start;
- } else {
- tokenPtr[-1].size = tokenPtr->start
- + tokenPtr->size - tokenPtr[-1].start;
- tokenPtr[-1].size += (isspace(UCHAR(
- tokenPtr->start[tokenPtr->size])) == 0);
- }
+ &(tokenPtr->size), &brace);
+
+ quoted = brace || tokenPtr->start[-1] == '"';
+ tokenPtr[-1].start = tokenPtr->start - quoted;
+ tokenPtr[-1].size = tokenPtr->start + tokenPtr->size
+ - tokenPtr[-1].start + quoted;
tokenPtr++;
}