X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/71c7e24f2e0190ea22e0ada09e7dafc3f37579cd..e4828e238445e3bf1bde0e2b7c38a73de7a7719e:/tests/regression.at diff --git a/tests/regression.at b/tests/regression.at index fa93833c..c2795f66 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -41,7 +41,7 @@ program: 'x'; AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([-o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o]) AT_COMPILE([input.o], [-DYYDEBUG -c input.c]) AT_CLEANUP @@ -71,7 +71,7 @@ program: { $$ = ""; }; AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([-o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o]) AT_CLEANUP @@ -111,7 +111,7 @@ exp: MY_TOKEN; AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([-y -o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o]) AT_CLEANUP @@ -156,7 +156,7 @@ exp: MY_TOKEN; AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([-o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o]) AT_CLEANUP @@ -462,20 +462,8 @@ AT_DATA_GRAMMAR([input.y], %% exp: "a" "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"; %% -void -yyerror (char const *s) -{ - fprintf (stderr, "%s\n", s); -} - -int -yylex (void) -{ - static int called; - if (called++) - abort (); - return SPECIAL; -} +]AT_YYERROR_DEFINE[ +]AT_YYLEX_DEFINE([{ SPECIAL }])[ int main (void) @@ -531,7 +519,7 @@ exp: AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([-o input.c input.y]) -AT_COMPILE([input.o], [-c input.c]) +AT_COMPILE([input.o]) AT_CLEANUP @@ -850,13 +838,11 @@ AT_CLEANUP # so that possible bound checking compilers could check all the skeletons. m4_define([_AT_DATA_DANCER_Y], [AT_DATA_GRAMMAR([dancer.y], -[%{ -static int yylex (AT_LALR1_CC_IF([int *], [void])); -AT_LALR1_CC_IF([], -[#include -#include -]AT_YYERROR_DECLARE[]) -%} +[[%code provides +{ + ]AT_YYERROR_DECLARE[ + ]AT_YYLEX_DECLARE[ +} $1 %token ARROW INVALID NUMBER STRING DATA %defines @@ -901,15 +887,10 @@ member: STRING | INVALID ; %% -AT_LALR1_CC_IF( -[/* A C++ error reporting function. */ -void -yy::parser::error (const location&, const std::string& m) -{ - std::cerr << m << std::endl; -} - -int +]AT_YYERROR_DEFINE[ +]AT_YYLEX_DEFINE([":"])[ +]AT_LALR1_CC_IF( +[int yyparse () { yy::parser parser; @@ -918,33 +899,14 @@ yyparse () #endif return parser.parse (); } -], -[static void -yyerror (const char *s) -{ - fprintf (stderr, "%s\n", s); -}]) - -static int -yylex (AT_LALR1_CC_IF([int *lval], [void])) -[{ - static int const tokens[] = - { - ':', -1 - }; - static size_t toknum; - ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[ - if (! (toknum < sizeof tokens / sizeof *tokens)) - abort (); - return tokens[toknum++]; -}] +])[ int main (void) { return yyparse (); } -]) +]]) ])# _AT_DATA_DANCER_Y @@ -1010,6 +972,7 @@ yyparse () } ])[ +#include static int yylex (]AT_LALR1_CC_IF([int *lval], [void])[) { @@ -1019,8 +982,7 @@ yylex (]AT_LALR1_CC_IF([int *lval], [void])[) }; static size_t toknum; ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[ - if (! (toknum < sizeof tokens / sizeof *tokens)) - abort (); + assert (toknum < sizeof tokens / sizeof *tokens); return tokens[toknum++]; } @@ -1086,13 +1048,8 @@ start: %printer { fprintf (yyoutput, "PRINTER"); } 'a'; %% - ]AT_YYERROR_DEFINE[ -static int -yylex (void) -{ - return 'a'; -} +]AT_YYLEX_DEFINE(["a"])[ int main (void) @@ -1225,13 +1182,7 @@ sr_conflict: %% ]AT_YYERROR_DEFINE[ -int -yylex (void) -{ - static int const input[] = { 1, 2, 3, 0 }; - static int const *inputp = input; - return *inputp++; -} +]AT_YYLEX_DEFINE([{ 1, 2, 3, 0 }])[ int main (void) @@ -1327,7 +1278,7 @@ syntax_error: /* Induce two syntax error messages (which requires full error recovery by shifting 3 tokens) in order to detect any loss of the reallocated buffer. */ -]AT_YYLEX_DEFINE([abc])[ +]AT_YYLEX_DEFINE(["abc"])[ int main (void) { @@ -1434,7 +1385,7 @@ syntax_error2: ]AT_YYERROR_DEFINE[ /* Induce two syntax error messages (which requires full error recovery by shifting 3 tokens). */ -]AT_YYLEX_DEFINE([abc])[ +]AT_YYLEX_DEFINE(["abc"])[ int main (void) { @@ -1584,7 +1535,7 @@ A: /*empty*/ | 'a' ; %% ]AT_YYERROR_DEFINE[ -]AT_YYLEX_DEFINE([$1])[ +]AT_YYLEX_DEFINE(["$1"])[ int main (void) {