]> git.saurik.com Git - bison.git/commitdiff
* tests/regression.at (Invalid input: 2): New.
authorAkim Demaille <akim@epita.fr>
Thu, 1 Nov 2001 18:05:22 +0000 (18:05 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 1 Nov 2001 18:05:22 +0000 (18:05 +0000)
* src/lex.c (unlexed_token_buffer): New.
(lex, unlex): Adjust: when unlexing, be sure to save token_buffer
too.
Reported by Wwp.

ChangeLog
THANKS
src/lex.c
tests/regression.at

index 4168a345ea084254c5d3c2ff8901ba2cd3dafbcc..b6d0ec68146c2281c6370c0bcb827ebbcf4e8534 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
diff --git a/THANKS b/THANKS
index 08548b7940d2929bb39361142f5369e7f5fd12f8..2890b4627f2e6a7e00074f1ebc339d57c6a50b66 100644 (file)
--- 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
 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.
 
 Many people are not named here because we lost track of them.  We
 thank them!  Please, help us keeping this list up to date.
index 65082a8141f95358eb359bd6d4e675adaf8a8590..ec40c14160644e590c205e01a0fd940501d3c4d8 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -36,11 +36,10 @@ const char *token_buffer = NULL;
 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;
 
 void
 lex_init (void)
 
 void
 lex_init (void)
@@ -325,6 +324,7 @@ void
 unlex (token_t token)
 {
   unlexed = token;
 unlex (token_t token)
 {
   unlexed = token;
+  unlexed_token_buffer = token_buffer;
   unlexed_symval = symval;
 }
 
   unlexed_symval = symval;
 }
 
@@ -369,6 +369,7 @@ lex (void)
     {
       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;
     }
index 2be0ea00c34f2edd7bfdfabc5ad40349086fb276..8981874542b14b9f01e6083b22038d0a683d7f2e 100644 (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.  ##
 ## --------------------- ##