]> git.saurik.com Git - bison.git/blobdiff - tests/glr-regression.at
Undo previous change, then add comment as to why the
[bison.git] / tests / glr-regression.at
index a2d3ce762d18c84bf9390a5db0296e95bf827d20..0fb970577032e3b75fa506c01ef5819810c15d41 100644 (file)
@@ -406,7 +406,7 @@ merge (YYSTYPE s1, YYSTYPE s2)
 static void
 yyerror (char const *msg)
 {
-  printf ("%s\n", msg);
+  fprintf (stderr, "%s\n", msg);
 }
 ]])
 
@@ -422,11 +422,11 @@ AT_CHECK([[./glr-regr4]], 0,
 AT_CLEANUP
 
 
-## ---------------------------------------------------------------------- ##
-## User destructor for unresolved GLR semantic value                      ##
-## Thanks to Joel E. Denny for this test; see                             ##
-## <http://lists.gnu.org/archive/html/help-bison/2005-07/msg00013.html>.  ##
-## ---------------------------------------------------------------------- ##
+## ------------------------------------------------------------------------- ##
+## User destructor for unresolved GLR semantic value                         ##
+## Thanks to Joel E. Denny for this test; see                                ##
+## <http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00016.html>.  ##
+## ------------------------------------------------------------------------- ##
 
 AT_SETUP([User destructor for unresolved GLR semantic value])
 
@@ -470,7 +470,7 @@ yylex (void)
 static void
 yyerror (char const *msg)
 {
-  printf ("%s\n", msg);
+  fprintf (stderr, "%s\n", msg);
 }
 
 int
@@ -485,7 +485,71 @@ AT_CHECK([[bison -o glr-regr5.c glr-regr5.y]], 0, [],
 ])
 AT_COMPILE([glr-regr5])
 
-AT_CHECK([[./glr-regr5]], 0,
+AT_CHECK([[./glr-regr5]], 0, [],
+[syntax is ambiguous
+])
+
+AT_CLEANUP
+
+
+## ------------------------------------------------------------------------- ##
+## User destructor after an error during a split parse                       ##
+## Thanks to Joel E. Denny for this test; see                                ##
+## <http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00029.html>.  ##
+## ------------------------------------------------------------------------- ##
+
+AT_SETUP([User destructor after an error during a split parse])
+
+AT_DATA_GRAMMAR([glr-regr6.y],
+[[%{
+  #include <stdio.h>
+  #include <stdlib.h>
+  static void yyerror (char const *);
+  static int yylex (void);
+%}
+
+%glr-parser
+%union { int value; }
+%type <value> 'a'
+
+%destructor {
+  printf ("Destructor called.\n");
+} 'a'
+
+%%
+
+start: 'a' | 'a' ;
+
+%%
+
+static int
+yylex (void)
+{
+  static char const *input = "a";
+  return *input++;
+}
+
+static void
+yyerror (char const *msg)
+{
+  fprintf (stderr, "%s\n", msg);
+}
+
+int
+main (void)
+{
+  return yyparse () != 1;
+}
+]])
+
+AT_CHECK([[bison -o glr-regr6.c glr-regr6.y]], 0, [],
+[glr-regr6.y: conflicts: 1 reduce/reduce
+])
+AT_COMPILE([glr-regr6])
+
+AT_CHECK([[./glr-regr6]], 0,
+[Destructor called.
+],
 [syntax is ambiguous
 ])