From 561f9a30af99cfbd4dbb51bcc82506c987cb92a9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 1 Nov 2001 18:05:22 +0000 Subject: [PATCH] * tests/regression.at (Invalid input: 2): New. * src/lex.c (unlexed_token_buffer): New. (lex, unlex): Adjust: when unlexing, be sure to save token_buffer too. Reported by Wwp. --- ChangeLog | 8 ++++++++ THANKS | 1 + src/lex.c | 7 ++++--- tests/regression.at | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4168a345..b6d0ec68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-01 Akim Demaille + + * tests/regression.at (Invalid input: 2): New. + * src/lex.c (unlexed_token_buffer): New. + (lex, unlex): Adjust: when unlexing, be sure to save token_buffer + too. + Reported by Wwp. + 2001-11-01 Akim Demaille * tests/calc.at: Catch up with 1.30. diff --git a/THANKS b/THANKS index 08548b79..2890b462 100644 --- a/THANKS +++ b/THANKS @@ -23,6 +23,7 @@ Piotr Gackiewicz gacek@intertel.com.pl Richard Stallman rms@gnu.org Robert Anisko anisko_r@epita.fr Shura debil_urod@ngs.ru +Wwp subscript@free.fr Many people are not named here because we lost track of them. We thank them! Please, help us keeping this list up to date. diff --git a/src/lex.c b/src/lex.c index 65082a81..ec40c141 100644 --- a/src/lex.c +++ b/src/lex.c @@ -36,11 +36,10 @@ const char *token_buffer = NULL; bucket *symval; int numval; -/* these two describe a token to be reread */ +/* A token to be reread, see unlex and lex. */ static token_t unlexed = tok_undef; -/* by the next call to lex */ static bucket *unlexed_symval = NULL; - +static const char *unlexed_token_buffer = NULL; void lex_init (void) @@ -325,6 +324,7 @@ void unlex (token_t token) { unlexed = token; + unlexed_token_buffer = token_buffer; unlexed_symval = symval; } @@ -369,6 +369,7 @@ lex (void) { token_t res = unlexed; symval = unlexed_symval; + token_buffer = unlexed_token_buffer; unlexed = tok_undef; return res; } diff --git a/tests/regression.at b/tests/regression.at index 2be0ea00..89818745 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -109,6 +109,45 @@ input.y:3: fatal error: no rules in the input grammar AT_CLEANUP +## ----------------- ## +## Invalid input 1. ## +## ----------------- ## + + +AT_SETUP([Invalid input: 1]) + +AT_DATA([input.y], +[[%% +? +]]) + +AT_CHECK([bison input.y], [1], [], +[input.y:2: invalid input: `?' +input.y:3: fatal error: no rules in the input grammar +]) + +AT_CLEANUP + + +## ----------------- ## +## Invalid input 2. ## +## ----------------- ## + + +AT_SETUP([Invalid input: 2]) + +AT_DATA([input.y], +[[%% +default: 'a' } +]]) + +AT_CHECK([bison input.y], [1], [], +[input.y:2: invalid input: `}' +]) + +AT_CLEANUP + + ## --------------------- ## ## Invalid CPP headers. ## ## --------------------- ## -- 2.47.2