X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/5f5a90dff6b40a1a1e980680e078d7e2799d9bc2..1c72905811fa75e0715eb5ec1066dfcae520d070:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index b0d14dc0..39167f94 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -1,6 +1,6 @@ # C++ skeleton for Bison -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -114,92 +114,9 @@ m4_popdef([b4_at_dollar])dnl m4_popdef([b4_dollar_dollar])dnl ])]) -# b4_symbol_constructor_declare_(SYMBOL-NUMBER) -# --------------------------------------------- -# Declare the overloaded version of make_symbol for the (common) type of -# these SYMBOL-NUMBERS. Use at class-level. -m4_define([b4_symbol_constructor_declare_], -[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], -[ static inline - symbol_type - make_[]b4_symbol_([$1], [id]) (dnl -b4_args(b4_symbol_if([$1], [has_type], - [const b4_symbol([$1], [type])& v]), - b4_locations_if([const location_type& l]))); - -])])]) - - -# b4_symbol_constructor_declare -# ----------------------------- -# Declare symbol constructors for all the value types. -# Use at class-level. -m4_define([b4_symbol_constructor_declare], -[b4_variant_if([ - // Symbol constructors declarations. -b4_symbol_foreach([b4_symbol_constructor_declare_])])]) - - - -# b4_symbol_constructor_define_(SYMBOL-NUMBER) -# -------------------------------------------- -# Define symbol constructor for this SYMBOL-NUMBER. -m4_define([b4_symbol_constructor_define_], -[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], -[ b4_parser_class_name::symbol_type - b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl -b4_args(b4_symbol_if([$1], [has_type], - [const b4_symbol([$1], [type])& v]), - b4_locations_if([const location_type& l]))) - { - return symbol_type (b4_args([yytranslate_ (token::b4_symbol([$1], [id]))], - b4_symbol_if([$1], [has_type], [v]), - b4_locations_if([l]))); - } - -])])]) - - -# b4_symbol_constructor_define -# ---------------------------- -# Define the overloaded versions of make_symbol for all the value types. -m4_define([b4_symbol_constructor_define], -[b4_variant_if([ - // Implementation of make_symbol for each symbol type. -b4_symbol_foreach([b4_symbol_constructor_define_])])]) - - -# b4_yytranslate_define -# --------------------- -# Define yytranslate_. Sometimes we want it in the header file, -# sometimes the cc file suffices. -m4_define([b4_yytranslate_define], -[[ // Symbol number corresponding to token number t. - ]b4_parser_class_name[::token_number_type - ]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type], - [int])[ t) - { - static - const token_number_type - translate_table[] = - { -]b4_translate[ - }; - const unsigned int user_token_number_max_ = ]b4_user_token_number_max[; - const token_number_type undef_token_ = ]b4_undef_token_number[; - - if (static_cast(t) <= yyeof_) - return yyeof_; - else if (static_cast (t) <= user_token_number_max_) - return translate_table[t]; - else - return undef_token_; - } -]]) - m4_pushdef([b4_copyright_years], - [2002, 2003, 2004, 2005, 2006, 2007, 2008]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]) m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])]) @@ -229,7 +146,7 @@ dnl FIXME: This is wrong, we want computed header guards. ]b4_percent_code_get([[requires]])[ -]b4_assert_if([#include ])[ +]b4_parse_assert_if([#include ])[ #include #include #include "stack.hh" @@ -244,7 +161,7 @@ dnl FIXME: This is wrong, we want computed header guards. /* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG ]b4_debug_flag[ +# define YYDEBUG ]b4_parse_trace_if([1], [0])[ #endif /* Enabling verbose error messages. */ @@ -252,7 +169,7 @@ dnl FIXME: This is wrong, we want computed header guards. # 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. */ @@ -287,7 +204,6 @@ do { \ { public: ]b4_public_types_declare[ -]b4_symbol_constructor_declare[ /// Build a parser object. ]b4_parser_class_name[ (]b4_parse_param_decl[); virtual ~]b4_parser_class_name[ (); @@ -436,8 +352,7 @@ do { \ }; ]b4_lex_symbol_if([b4_yytranslate_define -b4_public_types_define -b4_symbol_constructor_define])[ +b4_public_types_define])[ ]b4_namespace_close[ ]b4_percent_define_flag_if([[global_tokens_and_yystype]], @@ -587,8 +502,7 @@ b4_percent_code_get[]dnl | Symbol types. | `---------------*/ -]b4_lex_symbol_if([], [b4_public_types_define -b4_symbol_constructor_define])[ +]b4_lex_symbol_if([], [b4_public_types_define])[ // stack_symbol_type. ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()