From: Akim Demaille Date: Mon, 26 Nov 2001 09:50:29 +0000 (+0000) Subject: * src/reader.c (read_declarations): Don't abort on tok_illegal, X-Git-Tag: before-m4-back-end~264 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/e0c40012bd7c94c88a0bb9886e37de9622729d9a * src/reader.c (read_declarations): Don't abort on tok_illegal, issue an error message. * tests/regression.at (Invalid %directive): New. Reported by Hans Aberg. --- diff --git a/ChangeLog b/ChangeLog index 633ad3b3..9bca596c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-11-26 Akim Demaille + + * src/reader.c (read_declarations): Don't abort on tok_illegal, + issue an error message. + * tests/regression.at (Invalid %directive): New. + Reported by Hans Aberg. + 2001-11-26 Akim Demaille * configure.in: Invoke AC_FUNC_OBSTACK and AC_FUNC_ERROR_AT_LINE. diff --git a/src/reader.c b/src/reader.c index d3c08951..8f01a7c4 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1054,10 +1054,10 @@ read_declarations (void) case tok_stropt: case tok_intopt: case tok_obsolete: - case tok_illegal: abort (); break; + case tok_illegal: default: complain (_("unrecognized: %s"), token_buffer); skip_to_char ('%'); diff --git a/tests/regression.at b/tests/regression.at index a18bfc45..68f02adc 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -380,9 +380,9 @@ AT_DATA([input.y], ]]) AT_CHECK([bison input.y], [1], [], -[input.y:2: invalid input: `?' +[[input.y:2: invalid input: `?' input.y:3: fatal error: no rules in the input grammar -]) +]]) AT_CLEANUP @@ -400,8 +400,29 @@ default: 'a' } ]]) AT_CHECK([bison input.y], [1], [], -[input.y:2: invalid input: `}' -]) +[[input.y:2: invalid input: `}' +]]) + +AT_CLEANUP + + + +## -------------------- ## +## Invalid %directive. ## +## -------------------- ## + + +AT_SETUP([Invalid %directive]) + +AT_DATA([input.y], +[[%invalid +]]) + +AT_CHECK([bison input.y], [1], [], +[[input.y:1: unrecognized: %invalid +input.y:1: Skipping to next % +input.y:2: fatal error: no input grammar +]]) AT_CLEANUP