/* -*-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
*
/*----- 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.
*
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);
}
}
/* --- 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 --- */