chiark / gitweb /
Allow more characters to start words in test vector files. 1.6.1
authormdw <mdw>
Sun, 21 Nov 1999 13:01:39 +0000 (13:01 +0000)
committermdw <mdw>
Sun, 21 Nov 1999 13:01:39 +0000 (13:01 +0000)
testrig.c

index 0531e738a0ac76eec976562aae001c88de413867..df7a0313496e3492af3b6c5071a102492b4dffef 100644 (file)
--- a/testrig.c
+++ b/testrig.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: testrig.c,v 1.6 1999/11/16 15:03:23 mdw Exp $
+ * $Id: testrig.c,v 1.7 1999/11/21 13:01:39 mdw Exp $
  *
  * Generic test driver
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: testrig.c,v $
+ * Revision 1.7  1999/11/21 13:01:39  mdw
+ * Allow more characters to start words in test vector files.
+ *
  * Revision 1.6  1999/11/16 15:03:23  mdw
  * Mark test types as constant.
  *
@@ -167,29 +170,42 @@ again:
       return (TOK_WORD);
     }
 
-    /* --- Anything else is either a word or self-delimiting --- */
+    /* --- Self-delimiting things --- */
+
+    case ';':
+    case '{':
+    case '}':
+      return (ch);
+
+    /* --- Anything else is a word --- */
 
     default:
-      if (isalnum((unsigned char)ch)) {
-       for (;;) {
-         DPUTC(&tok, ch);
+      for (;;) {
+       DPUTC(&tok, ch);
+       ch = getc(fp);
+       switch (ch) {
+         case EOF:
+         case ';':
+         case '{':
+         case '}':
+         case '\"':
+         case '\'':
+         case '`':
+           goto done;
+         default:
+           if (isspace((unsigned char)ch))
+             goto done;
+       }
+       if (ch == '\\') {
          ch = getc(fp);
-         if (ch == EOF ||
-             ch == ';' ||
-             ch == '\"' || ch == '\'' || ch == '`' ||
-             isspace((unsigned char)ch))
-           break;
-         if (ch == '\\') {
-           ch = getc(fp);
-           if (ch == EOF)
-             ch = '\\';
-         }
+         if (ch == EOF)
+           ch = '\\';
        }
-       ungetc(ch, fp);
-       DPUTZ(&tok);
-       return (TOK_WORD);
-      } else
-       return (ch);
+      }
+    done:
+      ungetc(ch, fp);
+      DPUTZ(&tok);
+      return (TOK_WORD);
   }
 }
 
@@ -351,7 +367,7 @@ void test_run(int argc, char *argv[],
     /* --- Past the open brace to the first chunk --- */
 
     if ((t = gettok(fp)) != '{')
-      die(1, "expected '{'; found `%s'", decode(t));
+      die(1, "expected `{'; found `%s'", decode(t));
 
     /* --- Start on the test data now --- */