X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/dcd5344dcde3ddc4761867134e6f8cc7b945ce1c..049016237e8ad3666609295234ed550e66cc185c:/data/glr.cc diff --git a/data/glr.cc b/data/glr.cc index 826bc80e..0e53d619 100644 --- a/data/glr.cc +++ b/data/glr.cc @@ -54,7 +54,7 @@ b4_defines_if([], [b4_fatal([b4_skeleton[: using %%defines is mandatory]])]) m4_include(b4_pkgdatadir/[c++.m4]) -b4_percent_define_ifdef([[location_type]], [], +b4_percent_define_ifdef([[api.location.type]], [], [m4_include(b4_pkgdatadir/[location.cc])]) m4_define([b4_parser_class_name], @@ -87,12 +87,17 @@ m4_define([b4_yy_symbol_print_generate], ]b4_parse_param_use[]dnl [ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[); } -]]) +]])[ +# Hijack the initial action to initialize the locations. +]b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], +[m4_define([b4_initial_action], +[yylloc.initialize ();]m4_ifdef([b4_initial_action], [ +m4_defn([b4_initial_action])]))])])[ # Hijack the post prologue to insert early definition of YYLLOC_DEFAULT # and declaration of yyerror. -m4_append([b4_post_prologue], +]m4_append([b4_post_prologue], [b4_syncline([@oline@], [@ofile@])[ ]b4_yylloc_default_define[ #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) @@ -238,7 +243,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++], # include # include -]b4_percent_define_ifdef([[location_type]], [], +]b4_percent_define_ifdef([[api.location.type]], [], [[# include "location.hh"]])[ ]b4_YYDEBUG_define[ @@ -262,7 +267,7 @@ b4_user_stype typedef ]b4_api_PREFIX[STYPE semantic_type; # endif /// Symbol locations. - typedef ]b4_percent_define_get([[location_type]], + typedef ]b4_percent_define_get([[api.location.type]], [[location]])[ location_type; /// Tokens. struct token