]> git.saurik.com Git - bison.git/commitdiff
* tests/regression.at (Invalid input: 2): New.
authorAkim Demaille <akim@epita.fr>
Thu, 1 Nov 2001 18:03:46 +0000 (18:03 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 1 Nov 2001 18:03:46 +0000 (18:03 +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 144f31a7511ce9f657695753d3a1b29cb6a27ace..728e3987289ee124ea6319d60490891e00f3c2f4 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>
 
        * configure.in: Bump to 1.30a.
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
+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.
index d8aa6f89cf2f8808f8945f334842753c72bffaf5..6d1ec27e1a3810891188904b8f0e9ba7ddd2cdde 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -35,11 +35,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)
@@ -324,6 +323,7 @@ void
 unlex (token_t token)
 {
   unlexed = token;
+  unlexed_token_buffer = token_buffer;
   unlexed_symval = symval;
 }
 
@@ -368,6 +368,7 @@ lex (void)
     {
       token_t res = unlexed;
       symval = unlexed_symval;
+      token_buffer = unlexed_token_buffer;
       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
 
 
+## ----------------- ##
+## 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.  ##
 ## --------------------- ##