X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/cd48d21d944380129d7a2ce68617ea31bf939aab..fa7b79c063589793d5786be7906d3b52b1732636:/data/yacc.c diff --git a/data/yacc.c b/data/yacc.c index 2b1cadba..74a014f1 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -189,13 +189,15 @@ b4_token_enums_defines(b4_tokens)[ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED ]m4_ifdef([b4_stype], -[[typedef union ]b4_union_name -b4_user_stype - YYSTYPE;], -[typedef int YYSTYPE;])[ +[[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]])])[ # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif ]b4_locations_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -286,9 +288,9 @@ typedef short int yytype_int16; #ifndef lint # define YYID(n) (n) #else -]b4_c_function_def([YYID], [static int], [[int i], [i]])[ +]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[ { - return i; + return yyi; } #endif @@ -673,12 +675,15 @@ do { \ `------------------------------------------------------------------*/ ]b4_c_function_def([yy_stack_print], [static void], - [[yytype_int16 *bottom], [bottom]], - [[yytype_int16 *top], [top]])[ + [[yytype_int16 *yybottom], [yybottom]], + [[yytype_int16 *yytop], [yytop]])[ { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1159,6 +1164,9 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1208,9 +1216,6 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) @@ -1219,9 +1224,8 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1413,9 +1417,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; ]b4_locations_if([[ yyerror_range[1] = yylloc; @@ -1456,7 +1457,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[); /* Do not reclaim the symbols of the rule which action triggered @@ -1496,13 +1497,15 @@ b4_token_enums_defines(b4_tokens) [#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED ]m4_ifdef([b4_stype], -[[typedef union ]b4_union_name -b4_user_stype - YYSTYPE;], -[typedef int YYSTYPE;])[ +[[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]])])[ # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif ]b4_pure_if([],