Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Improve error message for missing close brace

Deleted218980ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:08:54
OriginalBugID: 3434 RFE
Version: 8.2.1
SubmitDate: '1999-11-05'
LastModified: '1999-12-03'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: HP-UX
OSVersion: 10.20
FixedDate: '1999-12-03'
FixedInVersion: 8.3b1
ClosedDate: '2000-10-25'


Name:

Bob Techentin


Comments:

Perhaps a little different wording in the message?


DesiredBehavior:

Per http://www.deja.com/getdoc.xp?AN=544049227

Here is a patch to tclParse.c which will issue a little

more detailed message if it detects a missing close 

brace in a block which might contains a comment

character preceeding an open-brace.


Patch:

*** ../generic/tclParse.c       Wed Nov  3 15:06:36 1999

--- ../generic/tclParse.c.orig  Wed Nov  3 14:07:47 1999

***************

*** 1895,1901 ****

      Tcl_Token *tokenPtr;

      register char *src, *end;

      int startIndex, level, length;

-     int openBrace;


      if ((numBytes >= 0) || (string == NULL)) {

        end = string + numBytes;

--- 1895,1900 ----

***************

*** 1976,2010 ****

        } else if (src == end) {

            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(*(--src)))) {

-                     Tcl_SetResult(interp, "missing close-brace:\nYou probably screwed up by putting an open brace in a comment.\nBraces must be balanced, EVEN IN COMMENTS!\nDo NOT, under any circumstances, post a question about it on comp.lang.tcl", TCL_STATIC);

-                     openBrace = -1;

-                     break;

-                   }

-                 }

-                 if (openBrace == -1) {

-                   break;

-                 } 

-                 src--;

-               }

            }

            parsePtr->errorType = TCL_PARSE_MISSING_BRACE;

            parsePtr->term = string;

--- 1975,1980 ----


PatchFiles:

generic/tclParse.c




improved error messages in 8.3b1. 
-- 12/03/1999 hobbs
welch Closed ticket [218980ffff]. [History diff]2000-10-26 08:33:07
dgp Open ticket [218980ffff]. [History diff]2001-04-19 04:20:26
dgp Deleted ticket [218980ffff]. [History diff]2001-04-19 04:21:00
Log in (anonymous is fine) to add a comment.