X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/aa0cb40d61cda5bfa9d325a45735439cbbd06327..d59beda068aef97834ea84ce4f5cc99b487e4b68:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index 8e79333e..6174e824 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -29,7 +29,7 @@ m4_define([b4_integral_parser_table_declare], ]) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) -# --------------------------------------------- +# ------------------------------------------------------------- # Define "parser::yy_" which contents is CONTENT. m4_define([b4_integral_parser_table_define], [ const b4_int_type_for([$2]) @@ -147,6 +147,7 @@ dnl FIXME: This is wrong, we want computed header guards. ]b4_percent_code_get([[requires]])[ ]b4_parse_assert_if([#include ])[ +#include #include #include #include "stack.hh" @@ -320,7 +321,7 @@ do { \ /// The state. state_type state; - /// Return the type corresponding to this state. + /// The type (corresponding to \a state). inline int type_get_ () const; }; @@ -397,7 +398,7 @@ m4_if(b4_prefix, [yy], [], b4_percent_code_get[]dnl [#ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* FIXME: INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -814,12 +815,21 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ // Perform the reduction. YY_REDUCE_PRINT (yyn); - switch (yyn) + try + { + switch (yyn) { ]b4_user_actions[ default: break; } + } + catch (const syntax_error& yyexc) + { + error (]b4_args(b4_locations_if([yyexc.location]), + [[yyexc.what()]])[); + YYERROR; + } YY_SYMBOL_PRINT ("-> $$ =", yylhs); ]b4_variant_if([[ // Destroy the rhs symbols. @@ -866,7 +876,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ /* Return failure if at end of input. */ if (yyla.type == yyeof_) YYABORT; - else + else if (!yyempty) { yy_destroy_ ("Error: discarding", yyla); yyempty = true;