X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6e649e659ebc2d8b54fa4636986370b76c2ff988..1d64f0bab600b607fd82ae8f2352a8a505853d57:/tests/calc.at diff --git a/tests/calc.at b/tests/calc.at index e79cdb2e..7cf12d39 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -46,22 +46,21 @@ AT_DATA_GRAMMAR([calc.y], # include #endif #include -#include extern void perror (const char *s); /* Exercise pre-prologue dependency to %union. */ -typedef int value_t; +typedef int value; -value_t global_result = 0; -int global_count = 0; +static value global_result = 0; +static int global_count = 0; %} /* Exercise %union. */ %union { - value_t ival; + value ival; }; %{ @@ -96,7 +95,7 @@ static int power (int base, int exponent); - %location & %pure & %glr - %location & %pure & %yacc & %parse-param. */ static void yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[ - ]AT_PARAM_IF([value_t *result, int *count, ])[ + ]AT_PARAM_IF([value *result, int *count, ])[ const char *s ); static int yylex (LEX_FORMALS); @@ -146,11 +145,11 @@ exp: ; %% /* The input. */ -FILE *yyin; +static FILE *yyin; static void yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[ - ]AT_PARAM_IF([value_t *result, int *count, ])[ + ]AT_PARAM_IF([value *result, int *count, ])[ const char *s ) { @@ -289,10 +288,9 @@ power (int base, int exponent) int main (int argc, const char **argv) { - value_t result = 0; + value result = 0; int count = 0; - int status = 0; - yyin = NULL; + int status; if (argc == 2) yyin = fopen (argv[1], "r"); @@ -309,8 +307,10 @@ main (int argc, const char **argv) yydebug = 1; #endif status = yyparse (]AT_PARAM_IF([&result, &count])[); - assert (global_result == result); - assert (global_count == count); + if (global_result != result) + abort (); + if (global_count != count) + abort (); return status; } ]]) @@ -562,7 +562,7 @@ AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix="calc AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {value_t *result}, {result} %parse-param {int *count}, {count}]) +AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {value *result} %parse-param {int *count}]) # ----------------------- # @@ -597,4 +597,4 @@ AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix="calc" AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {value_t *result}, {result} %parse-param {int *count}, {count}]) +AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {value *result} %parse-param {int *count}])