From: Paul Eggert Date: Mon, 18 Jul 2005 18:39:01 +0000 (+0000) Subject: Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl. X-Git-Tag: BISON-2_1~82 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/ac8c5689f8897977863452e89ffadb05dffafd0f Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl. * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return void, not int. * tests/glr-regression.at (Badly Collapsed GLR States): Likewise. (Improper handling of embedded actions and dollar(-N) in GLR parsers): yylex should return 0 at EOF rather than aborting. --- diff --git a/ChangeLog b/ChangeLog index a93c813c..82929e9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2005-07-18 Paul Eggert + Fix yyerror / yylex test glitches noted by twlevo@xs4all.nl. + * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return + void, not int. + * tests/glr-regression.at (Badly Collapsed GLR States): + Likewise. + (Improper handling of embedded actions and dollar(-N) in GLR parsers): + yylex should return 0 at EOF rather than aborting. + Improve tests for stack overflow in GLR parser. Problem reported by twlevo@xs4all.nl. * data/glr.c (struct yyGLRStack): Remove yyerrflag member. diff --git a/tests/cxx-type.at b/tests/cxx-type.at index 0fcdfdb6..012b57e4 100644 --- a/tests/cxx-type.at +++ b/tests/cxx-type.at @@ -56,7 +56,7 @@ $1 # define ERROR_PARAMETERS char const *s #endif int yylex (LEX_PARAMETERS); - int yyerror (ERROR_PARAMETERS); + void yyerror (ERROR_PARAMETERS); %} %token TYPENAME ID @@ -191,7 +191,7 @@ yylex (LEX_PARAMETERS) } } -int +void yyerror (ERROR_PARAMETERS) { #if YYPURE && YYLSP_NEEDED diff --git a/tests/glr-regression.at b/tests/glr-regression.at index e6534624..4ac981c0 100644 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@ -34,7 +34,7 @@ AT_DATA_GRAMMAR([glr-regr1.y], #define YYSTYPE int static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1); int yylex (void); -int yyerror (char const *msg); +void yyerror (char const *msg); %} @@ -70,7 +70,7 @@ main (void) return yyparse (); } -int +void yyerror (char const *msg) { fprintf (stderr, "%s\n", msg); @@ -184,7 +184,7 @@ yylex (void) break; } if (fscanf (yyin, "%49s", buf) != 1) - abort (); + return 0; if (sizeof buf - 1 <= strlen (buf)) abort (); s = (char *) malloc (strlen (buf) + 1);