Hi

SYNOPSIS

  % fossil test-th-eval "set x y; set z \""
  TH_ERROR: y

  % fossil test-th-eval "set x y; set z {"
  TH_ERROR: y

  % fossil test-th-eval "set x y; set z ["
  TH_ERROR: y

Take a look on src/th.c:thNextWord(), please. Could we make TH be more
verbose there? See $.02 patch.

  ./fossil test-th-eval "set x y; set z \""
  TH_ERROR: parse error

  ./fossil test-th-eval "set x y; set z {"
  TH_ERROR: parse error

  ./fossil test-th-eval "set x y; set z ["
  TH_ERROR: parse error

The second variant of such a report would be

  Th_ErrorMessage(interp, "parse error: \"", zInput, nInput);

  ./fossil test-th-eval "set x y; set z {"
  TH_ERROR: parse error: "{"

But I like the first short report, "parse error", as such a text let us
to get an easy way to implement TCL-like [info complete] command or just
TH procedure

  proc info_complete script {
    set err [catch [list uplevel 1 $script] errMsg]
    expr {! ($err && $errMsg eq "parse error")}
  }

And this is useful to make TH1 interactive shell. Hope, I miss nothing.

Thanks for Fossil and TH1!

Sergei

Index: src/th.c
==================================================================
--- src/th.c
+++ src/th.c
@@ -510,17 +510,17 @@
         case ']': if( nBrace==0 ) nSq--; break;
       }
       iEnd++;
     }
     if( nBrace>0 || nSq>0 ){
-      /* Parse error */
+      Th_SetResult(interp, "parse error", -1);
       return TH_ERROR;
     }
   }

   if( iEnd>nInput ){
-    /* Parse error */
+    Th_SetResult(interp, "parse error", -1);
     return TH_ERROR;
   }
   *pnWord = iEnd;
   return TH_OK;
 }

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to