Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-04-16
17:50 • New ticket [7d20762952] extra characters after close quote or brace missing cont... artifact: 30d80ae9c5 user: anonymous

extra characters after close quote or brace missing context

Open7d207629522ecbf2d63a577d6dc18968b3dd6900Created 6 years agoUpdated 6 years ago
Descriptionplain2021-04-16 17:50:34
The pair of error messages for extra characters after a close quote or brace is missing context information.

The code is in tclParse.c at the if/else which begins:

    if (src[-1] == '"') {
        if (interp != NULL) {
        Tcl_SetObjResult(interp, Tcl_NewStringObj(
            "EXtra characters after close-quote", -1));
        }
        parsePtr->errorType = TCL_PARSE_QUOTE_EXTRA;
    } else {
     ....

I propose the following change:

   if (src[-1] == '"') {
        if (interp != NULL) {
            Tcl_Obj *emessage = Tcl_NewStringObj(
                "extra characters after close-quote at \"", -1);
            Tcl_AppendLimitedToObj(emessage, src, -1, 30, NULL);
            Tcl_SetObjResult(interp, emessage);
        }
        parsePtr->errorType = TCL_PARSE_QUOTE_EXTRA;
    } else {
        if (interp != NULL) {
            Tcl_Obj *emessage = Tcl_NewStringObj(
                "extra characters after close-brace at }", -1);
            Tcl_AppendLimitedToObj(emessage, src, -1, 30, NULL);
            Tcl_SetObjResult(interp, emessage);
        }
        parsePtr->errorType = TCL_PARSE_BRACE_EXTRA;
    }
Log in (anonymous is fine) to add a comment.