improved error messages
authorceriel <none@none>
Fri, 17 Nov 1989 11:44:48 +0000 (11:44 +0000)
committerceriel <none@none>
Fri, 17 Nov 1989 11:44:48 +0000 (11:44 +0000)
lang/pc/comp/LLmessage.c
lang/pc/comp/make.tokcase

index efab3e2..101a649 100644 (file)
@@ -28,7 +28,7 @@ LLmessage(tk)
                */
                register struct token *dotp = &dot;
 
-               error("%s missing", symbol2str(tk));
+               error("%s missing before %s", symbol2str(tk), symbol2str(dotp->tk_symb));
 
                aside = *dotp;
                asidetype = toktype;
index ef32292..56d104a 100755 (executable)
@@ -1,34 +1,41 @@
 cat <<'--EOT--'
+/* Generated by make.tokcase */
+/* $Header$ */
 #include "Lpars.h"
 
 char *
 symbol2str(tok)
        int tok;
 {
-       static char buf[2] = { '\0', '\0' };
+#define SIZBUF 8
+       /* allow for a few invocations in f.i. an argument list */
+       static char buf[SIZBUF];
+       static int index;
 
-       if (040 <= tok && tok < 0177) {
-               buf[0] = tok;
-               buf[1] = '\0';
-               return buf;
-       }
        switch (tok) {
 --EOT--
+
 sed '
 /{[A-Z]/!d
 s/.*{\(.*\),.*\(".*"\).*$/     case \1 :\
                return \2;/
 '
+
 cat <<'--EOT--'
+       default:
+               if (tok <= 0) return "end of file";
+               if (tok < 040 || tok >= 0177) {
+                       return "bad token";
+               }
+               /* fall through */
        case '\n':
        case '\f':
        case '\v':
        case '\r':
        case '\t':
-               buf[0] = tok;
-               return buf;
-       default:
-               return "bad token";
+               index = (index+2) & (SIZBUF-1);
+               buf[index] = tok;
+               return &buf[index];
        }
 }
 --EOT--