From: mdw Date: Sun, 21 Nov 1999 13:01:39 +0000 (+0000) Subject: Allow more characters to start words in test vector files. X-Git-Tag: 2.0.4~198 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/commitdiff_plain/120800815c7572b685ca8c9e34efd461a571aa68 Allow more characters to start words in test vector files. --- diff --git a/testrig.c b/testrig.c index 0531e73..df7a031 100644 --- 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 --- */