X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/a9739e7c4c782e06bd482d45646a9d984524ff33..2073e1b6023bef516150070c8fd8239a1d8f873e:/tests/actions.at diff --git a/tests/actions.at b/tests/actions.at index 5dc64ae4..6267b74e 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -1,5 +1,5 @@ # Executing Actions. -*- Autotest -*- -# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,13 +30,13 @@ AT_SETUP([Mid-rule actions]) # action. AT_DATA_GRAMMAR([[input.y]], -[[%{ +[[%error-verbose +%debug +%{ # include # include static void yyerror (const char *msg); static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 %} %% exp: { putchar ('0'); } @@ -91,13 +91,14 @@ AT_CLEANUP AT_SETUP([Exotic Dollars]) AT_DATA_GRAMMAR([[input.y]], -[[%{ +[[%error-verbose +%debug +%{ # include # include static void yyerror (const char *msg); static int yylex (void); -# define YYDEBUG 1 -# define YYERROR_VERBOSE 1 +# define USE(Var) %} %union @@ -112,6 +113,7 @@ AT_DATA_GRAMMAR([[input.y]], exp: a_1 a_2 { $$ = 3; } { $$ = $3 + 1; } a_5 sum_of_the_five_previous_values { + USE (($1, $2, $3, $4, $5)); printf ("%d\n", $6); } ; @@ -145,7 +147,7 @@ main (void) } ]]) -AT_CHECK([bison -d -v -o input.c input.y]) +AT_CHECK([bison -d -v -o input.c input.y], 0) AT_COMPILE([input]) AT_PARSER_CHECK([./input], 0, [[15 @@ -170,7 +172,7 @@ m4_if([$1$2$3], $[1]$[2]$[3], [], # helping macros. So don't put any directly in the Bison file. AT_BISON_OPTION_PUSHDEFS([$5]) AT_DATA_GRAMMAR([[input.y]], -[[%{ +[[%start-header { #include #include #include @@ -180,20 +182,20 @@ AT_DATA_GRAMMAR([[input.y]], ]AT_LALR1_CC_IF( [#define RANGE(Location) (Location).begin.line, (Location).end.line], [#define RANGE(Location) (Location).first_line, (Location).last_line]) -[%} +[} $5] m4_ifval([$6], [%union { int ival; }]) -[ -%{ -]AT_LALR1_CC_IF([typedef yy::location YYLTYPE; +AT_LALR1_CC_IF([%define "global_tokens_and_yystype"]) +m4_ifval([$6], [[%end-header {]], [[%start-header {]]) +AT_LALR1_CC_IF([typedef yy::location YYLTYPE; m4_ifval([$6], , [#define YYSTYPE int])]) [static int yylex (]AT_LEX_FORMALS[); ]AT_LALR1_CC_IF([], [static void yyerror (const char *msg);]) -[%} +[} ]m4_ifval([$6], [%type '(' 'x' 'y' ')' ';' thing line input])[