X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/4896ede89ca060e3673e90fcd4a36f76517905c7..9ce27ab013185d1c17c78e0d57ff637319cb1e29:/data/glr.c?ds=sidebyside diff --git a/data/glr.c b/data/glr.c index 8f77aa61..1463a9a7 100644 --- a/data/glr.c +++ b/data/glr.c @@ -162,6 +162,21 @@ m4_define([b4_rhs_location], [(b4_rhs_data([$1], [$2]).yyloc)]) +## -------------- ## +## Declarations. ## +## -------------- ## + +# b4_shared_declarations +# ---------------------- +# Declaration that might either go into the header (if --defines) +# or open coded in the parser body. +m4_define([b4_shared_declarations], +[b4_percent_code_get([[requires]])[ +]b4_token_enums(b4_tokens)[ +]b4_declare_yylstype[ +]b4_percent_code_get([[provides]])[]dnl +]) + ## -------------- ## ## Output files. ## @@ -191,47 +206,11 @@ m4_if(b4_prefix, [yy], [], #define yylloc b4_prefix[]lloc])[ /* Copy the first part of user declarations. */ -]b4_user_pre_prologue - -b4_null_define - -dnl # b4_shared_declarations -dnl # ---------------------- -dnl # Declaration that might either go into the header (if --defines) -dnl # or open coded in the parser body. -m4_define([b4_shared_declarations], -[b4_percent_code_get([[requires]])[]dnl +]b4_user_pre_prologue[ -b4_token_enums(b4_tokens) - -[#ifndef YYSTYPE -]m4_ifdef([b4_stype], -[[typedef union ]b4_union_name[ -{ -]b4_user_stype[ -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1]], -[m4_if(b4_tag_seen_flag, 0, -[[typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1]])])[ -#endif -]b4_locations_if([[ -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED -typedef struct YYLTYPE -{ - int first_line; - int first_column; - int last_line; - int last_column; -} YYLTYPE; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 -#endif -]])[ -]b4_percent_code_get([[provides]])[]dnl -]) +]b4_null_define[ -b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], +]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]], [b4_shared_declarations])[ /* Enabling traces. */