X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6b5a748937ae95af26d78e9e5e7a335351a2970d..e42906f7904ca7516e9867a3a19ee08d963b1205:/data/glr.c diff --git a/data/glr.c b/data/glr.c index 46eaccc7..9038c747 100644 --- a/data/glr.c +++ b/data/glr.c @@ -232,11 +232,11 @@ b4_percent_code_get([[top]])[ #endif /* Default (constant) value used for initialization for null - right-hand sides. Unlike the standard yacc.c template, - here we set the default value of $$ to a zeroed-out value. - Since the default value is undefined, this behavior is - technically correct. */ -static YYSTYPE yyval_default; + right-hand sides. Unlike the standard yacc.c template, here we set + the default value of $$ to a zeroed-out value. Since the default + value is undefined, this behavior is technically correct. */ +static YYSTYPE yyval_default;]b4_locations_if([[ +static YYLTYPE yyloc_default][]b4_yyloc_default;])[ /* Copy the second part of user declarations. */ ]b4_user_post_prologue @@ -250,19 +250,19 @@ b4_percent_code_get[]dnl # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #ifdef __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif #ifndef YYFREE @@ -288,8 +288,9 @@ b4_percent_code_get[]dnl #ifndef YYSETJMP # include # define YYJMP_BUF jmp_buf -# define YYSETJMP(env) setjmp (env) -# define YYLONGJMP(env, val) longjmp (env, val) +# define YYSETJMP(Env) setjmp (Env) +// Pacify clang. +# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0)) #endif /*-----------------. @@ -312,7 +313,7 @@ b4_percent_code_get[]dnl #endif])[ #ifndef YYASSERT -# define YYASSERT(condition) ((void) ((condition) || (abort (), 0))) +# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0))) #endif /* YYFINAL -- State number of the termination state. */ @@ -406,33 +407,15 @@ dnl We probably ought to introduce a type for confl. { ]b4_conflicting_rules[ }; - + /* Error token number */ #define YYTERROR 1 ]b4_locations_if([[ -#ifndef YYLLOC_DEFAULT ]b4_yylloc_default_define[ # define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -#endif -]],[ -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0) -#endif -])[ - -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +]])[ +]b4_yy_location_print_define[ /* YYLEX -- calling `yylex' with the right arguments. */ #define YYLEX ]b4_function_call([yylex], [int], b4_lex_param)[ @@ -913,8 +896,8 @@ yylhsNonterm (yyRuleNum yyrule) return yyr1[yyrule]; } -#define yypact_value_is_default(yystate) \ - ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[ +#define yypact_value_is_default(Yystate) \ + ]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[ /** True iff LR state YYSTATE has only a default reduction (regardless * of token). */ @@ -931,8 +914,8 @@ yydefaultAction (yyStateNum yystate) return yydefact[yystate]; } -#define yytable_value_is_error(yytable_value) \ - ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ +#define yytable_value_is_error(Yytable_value) \ + ]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[ /** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN. * Result R means @@ -2277,14 +2260,9 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; - yylval = yyval_default; -]b4_locations_if([ -#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL - yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; - yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; -#endif -]) -m4_ifdef([b4_initial_action], [ + yylval = yyval_default;]b4_locations_if([ + yylloc = yyloc_default;])[ +]m4_ifdef([b4_initial_action], [ b4_dollar_pushdef([yylval], [], [yylloc])dnl /* User initialization code. */ b4_user_initial_action