# include <string.h>
#endif
#include <ctype.h>
-#include <assert.h>
extern void perror (const char *s);
/* Exercise pre-prologue dependency to %union. */
-typedef int value_t;
+typedef int value;
-static value_t global_result = 0;
+static value global_result = 0;
static int global_count = 0;
%}
/* Exercise %union. */
%union
{
- value_t ival;
+ value ival;
};
%{
- %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);
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
)
{
int
main (int argc, const char **argv)
{
- value_t result = 0;
+ value result = 0;
int count = 0;
int status;
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;
}
]])
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}])
# ----------------------- #
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}])