* 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 <akim@epita.fr>
+
+ * 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 <akim@epita.fr>
* tests/calc.at: Catch up with 1.30.
2001-11-01 Akim Demaille <akim@epita.fr>
* tests/calc.at: Catch up with 1.30.
Richard Stallman rms@gnu.org
Robert Anisko anisko_r@epita.fr
Shura debil_urod@ngs.ru
Richard Stallman rms@gnu.org
Robert Anisko anisko_r@epita.fr
Shura debil_urod@ngs.ru
Many people are not named here because we lost track of them. We
thank them! Please, help us keeping this list up to date.
Many people are not named here because we lost track of them. We
thank them! Please, help us keeping this list up to date.
bucket *symval;
int numval;
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;
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;
unlex (token_t token)
{
unlexed = token;
unlex (token_t token)
{
unlexed = token;
+ unlexed_token_buffer = token_buffer;
unlexed_symval = symval;
}
unlexed_symval = symval;
}
{
token_t res = unlexed;
symval = unlexed_symval;
{
token_t res = unlexed;
symval = unlexed_symval;
+ token_buffer = unlexed_token_buffer;
unlexed = tok_undef;
return res;
}
unlexed = tok_undef;
return res;
}
+## ----------------- ##
+## 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. ##
## --------------------- ##