summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-11-10 02:51:56 (GMT)
committerhobbs <hobbs>1999-11-10 02:51:56 (GMT)
commit92091cf22933ea53ced7f0ec22fdc6d1d33077aa (patch)
tree08a12b832ed3d87eab5e754f4607d7dd15e9d077 /generic/tclParse.c
parent284e6ca672d27e0c62c184d39089428622a453c1 (diff)
downloadtcl-92091cf22933ea53ced7f0ec22fdc6d1d33077aa.zip
tcl-92091cf22933ea53ced7f0ec22fdc6d1d33077aa.tar.gz
tcl-92091cf22933ea53ced7f0ec22fdc6d1d33077aa.tar.bz2
* generic/tclIOUtil.c: changed Tcl_Alloc to ckalloc
* generic/tclInt.h: * generic/tclObj.c: rolled back changes from 1999-10-29 Purify noted new leaks with that code * generic/tclParse.c: added code in Tcl_ParseBraces to test for possible unbalanced open brace in a comment
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r--generic/tclParse.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 56b0a05..ab50ac4 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.12 1999/08/12 23:14:42 stanton Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.13 1999/11/10 02:51:57 hobbs Exp $
*/
#include "tclInt.h"
@@ -1973,9 +1973,44 @@ Tcl_ParseBraces(interp, string, numBytes, parsePtr, append, termPtr)
src += length;
}
} else if (src == end) {
+ int openBrace;
+
if (interp != NULL) {
Tcl_SetResult(interp, "missing close-brace", TCL_STATIC);
}
+ /*
+ * Search the source string for a possible open
+ * brace within the context of a comment. Since we
+ * aren't performing a full Tcl parse, just look for
+ * an open brace preceeded by a '<whitspace>#' on
+ * the same line.
+ */
+ openBrace = 0;
+ while (src > string ) {
+ switch (*src) {
+ case '{':
+ openBrace = 1;
+ break;
+ case '\n':
+ openBrace = 0;
+ break;
+ case '#':
+ if ((openBrace == 1) && (isspace(UCHAR(src[-1])))) {
+ if (interp != NULL) {
+ Tcl_AppendResult(interp,
+ ": possible unbalanced brace in comment",
+ (char *) NULL);
+ }
+ openBrace = -1;
+ break;
+ }
+ break;
+ }
+ if (openBrace == -1) {
+ break;
+ }
+ src--;
+ }
parsePtr->errorType = TCL_PARSE_MISSING_BRACE;
parsePtr->term = string;
parsePtr->incomplete = 1;