better error checking
authorceriel <none@none>
Thu, 7 Dec 1989 16:28:05 +0000 (16:28 +0000)
committerceriel <none@none>
Thu, 7 Dec 1989 16:28:05 +0000 (16:28 +0000)
lang/m2/comp/LLlex.c
lang/m2/comp/make.tokcase

index e134056..8959049 100644 (file)
@@ -233,6 +233,20 @@ CheckForLineDirective()
        LineNumber = i;
 }
 
+STATIC
+CheckForLet()
+{
+       register int ch;
+
+       LoadChar(ch);
+       if (ch != EOI) {
+               if (class(ch) == STIDF) {
+                       lexerror("token separator required between identifier and number");
+               }
+               PushBack();
+       }
+}
+
 int
 LLlex()
 {
@@ -507,6 +521,7 @@ again:
                                            tk->TOK_INT < 0) {
 lexwarning(W_ORDINARY, "character constant out of range");
                                        }
+                                       CheckForLet();
                                        return tk->tk_symb = INTEGER;
                                }
                                if (ch == 'D' && base == 10) {
@@ -528,6 +543,7 @@ lexwarning(W_ORDINARY, "character constant out of range");
                                }
                                if (ovfl)
 lexwarning(W_ORDINARY, "overflow in constant");
+                               CheckForLet();
                                return tk->tk_symb = INTEGER;
                                }
 
@@ -602,6 +618,7 @@ lexwarning(W_ORDINARY, "overflow in constant");
                        lexerror("real constant too long");
                }
                else    tk->TOK_REL = Salloc(buf, (unsigned) (np - buf)) + 1;
+               CheckForLet();
                return tk->tk_symb = REAL;
 
                /*NOTREACHED*/
index 56d104a..2a74ca3 100755 (executable)
@@ -9,8 +9,8 @@ symbol2str(tok)
 {
 #define SIZBUF 8
        /* allow for a few invocations in f.i. an argument list */
-       static char buf[SIZBUF];
-       static int index;
+       static char buf[SIZBUF] = { '\'', 0, '\'', 0, '\'', 0, '\'', 0};
+       static int index = 1;
 
        switch (tok) {
 --EOT--
@@ -27,15 +27,9 @@ cat <<'--EOT--'
                if (tok < 040 || tok >= 0177) {
                        return "bad token";
                }
-               /* fall through */
-       case '\n':
-       case '\f':
-       case '\v':
-       case '\r':
-       case '\t':
-               index = (index+2) & (SIZBUF-1);
+               index = (index+4) & (SIZBUF-1);
                buf[index] = tok;
-               return &buf[index];
+               return &buf[index-1];
        }
 }
 --EOT--