X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/4524c55bcfc69d0ecb0e1b35dac035d44153c576..c6abeab182fed54a2068fd75978a97f9c09d9da7:/data/yacc.c diff --git a/data/yacc.c b/data/yacc.c index 6a547fce..163ecfef 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -2,10 +2,11 @@ # Yacc compatible skeleton for Bison # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007, 2008 Free Software Foundation, Inc. +# 2007, 2008, 2009 Free Software Foundation, Inc. m4_pushdef([b4_copyright_years], -[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008]) + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009]) # 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 @@ -20,13 +21,13 @@ m4_pushdef([b4_copyright_years], # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check the value of %define api.push_pull. -b4_percent_define_default([[api.push_pull]], [[pull]]) -b4_percent_define_check_values([[[[api.push_pull]], +# Check the value of %define api.push-pull. +b4_percent_define_default([[api.push-pull]], [[pull]]) +b4_percent_define_check_values([[[[api.push-pull]], [[pull]], [[push]], [[both]]]]) b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]]) b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]]) -m4_case(b4_percent_define_get([[api.push_pull]]), +m4_case(b4_percent_define_get([[api.push-pull]]), [pull], [m4_define([b4_push_flag], [[0]])], [push], [m4_define([b4_pull_flag], [[0]])]) @@ -156,8 +157,7 @@ m4_define([b4_rhs_location], m4_changecom() m4_divert_push(0)dnl @output(b4_parser_file_name@)@ -b4_copyright([Implementation for Bison's Yacc-like parsers in C])dnl' -[ +b4_copyright([Implementation for Bison's Yacc-like parsers in C])[ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ @@ -192,7 +192,7 @@ m4_if(b4_prefix, [yy], [], /* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG ]b4_debug_flag[ +# define YYDEBUG ]b4_parse_trace_if([1], [0])[ #endif /* Enabling verbose error messages. */ @@ -200,7 +200,7 @@ m4_if(b4_prefix, [yy], [], # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE ]b4_error_verbose_flag[ +# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[ #endif /* Enabling the token table. */ @@ -525,8 +525,14 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = #define YYPACT_NINF ]b4_pact_ninf[ +#define yypact_value_is_default(yystate) \ + ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[ + #define YYTABLE_NINF ]b4_table_ninf[ +#define yytable_value_is_error(yytable_value) \ + ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ + ]b4_parser_tables_define[ #define yyerrok (yyerrstatus = 0) @@ -848,7 +854,8 @@ yysyntax_error (char *yyresult, int yystate, int yytoken) char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. In other words, skip the first -YYN actions for this + state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -862,7 +869,8 @@ yysyntax_error (char *yyresult, int yystate, int yytoken) yyarg[yycount++] = yytname[yytoken]; for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { @@ -1271,7 +1279,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1321,7 +1329,7 @@ yyread_pushed_token:]])[ yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; @@ -1505,7 +1513,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -1599,7 +1607,7 @@ yypushreturn: ]b4_epilogue[]dnl b4_defines_if( [@output(b4_spec_defines_file@)@ -b4_copyright([Interface for Bison's Yacc-like parsers in C])dnl' +b4_copyright([Interface for Bison's Yacc-like parsers in C])dnl b4_percent_code_get([[requires]])[]dnl