* 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.
This commit is contained in:
Akim Demaille
2001-11-01 18:05:22 +00:00
parent f987e9d257
commit 561f9a30af
4 changed files with 52 additions and 3 deletions
+8
View File
@@ -1,3 +1,11 @@
2001-11-01 Akim Demaille <[email protected]>
* 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 <[email protected]> 2001-11-01 Akim Demaille <[email protected]>
* tests/calc.at: Catch up with 1.30. * tests/calc.at: Catch up with 1.30.
+1
View File
@@ -23,6 +23,7 @@ Piotr Gackiewicz [email protected]
Richard Stallman [email protected] Richard Stallman [email protected]
Robert Anisko [email protected] Robert Anisko [email protected]
Shura [email protected] Shura [email protected]
Wwp [email protected]
Many people are not named here because we lost track of them. We Many people are not named here because we lost track of them. We
thank them! Please, help us keeping this list up to date. thank them! Please, help us keeping this list up to date.
+4 -3
View File
@@ -36,11 +36,10 @@ const char *token_buffer = NULL;
bucket *symval; bucket *symval;
int numval; 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; static token_t unlexed = tok_undef;
/* by the next call to lex */
static bucket *unlexed_symval = NULL; static bucket *unlexed_symval = NULL;
static const char *unlexed_token_buffer = NULL;
void void
lex_init (void) lex_init (void)
@@ -325,6 +324,7 @@ void
unlex (token_t token) unlex (token_t token)
{ {
unlexed = token; unlexed = token;
unlexed_token_buffer = token_buffer;
unlexed_symval = symval; unlexed_symval = symval;
} }
@@ -369,6 +369,7 @@ lex (void)
{ {
token_t res = unlexed; token_t res = unlexed;
symval = unlexed_symval; symval = unlexed_symval;
token_buffer = unlexed_token_buffer;
unlexed = tok_undef; unlexed = tok_undef;
return res; return res;
} }
+39
View File
@@ -109,6 +109,45 @@ input.y:3: fatal error: no rules in the input grammar
AT_CLEANUP 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. ## ## Invalid CPP headers. ##
## --------------------- ## ## --------------------- ##