]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
variables: use `parse.assert' instead of `debug'.
[bison.git] / data / lalr1.cc
index a23cc4f386d6586bb311ccf21f660686ac0a2daa..1791c76f2e99e2c8e9aeedb201ae3e79103ce7de 100644 (file)
@@ -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_declaration_(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_declaration_],
-[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_declarations
-# ----------------------------------
-# Declare symbol constructors for all the value types.
-# Use at class-level.
-m4_define([b4_symbol_constructor_declarations],
-[b4_variant_if([
-    // Symbol constructors declarations.
-b4_symbol_foreach([b4_symbol_constructor_declaration_])])])
-
-
-
-# b4_symbol_constructor_definition_(SYMBOL-NUMBER)
-# ------------------------------------------------
-# Define symbol constructor for this SYMBOL-NUMBER.
-m4_define([b4_symbol_constructor_definition_],
-[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_definitions
-# ----------------------------------
-# Define the overloaded versions of make_symbol for all the value types.
-m4_define([b4_symbol_constructor_definitions],
-[b4_variant_if([
-  // Implementation of make_symbol for each symbol type.
-b4_symbol_foreach([b4_symbol_constructor_definition_])])])
-
-
-# b4_yytranslate_definition
-# -------------------------
-# Define yytranslate_.  Sometimes we want it in the header file,
-# sometimes the cc file suffices.
-m4_define([b4_yytranslate_definition],
-[[  // 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<int>(t) <= yyeof_)
-      return yyeof_;
-    else if (static_cast<unsigned int> (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]])])
@@ -237,14 +154,14 @@ dnl FIXME: This is wrong, we want computed header guards.
 ]b4_namespace_open[
 ]b4_locations_if([  class position;
   class location;])[
-]b4_variant_if([b4_variant_definition])[
+]b4_variant_if([b4_variant_define])[
 ]b4_namespace_close[
 
 ]b4_locations_if([#include "location.hh"])[
 
 /* 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_declarations[
     /// Build a parser object.
     ]b4_parser_class_name[ (]b4_parse_param_decl[);
     virtual ~]b4_parser_class_name[ ();
@@ -435,9 +351,8 @@ do {                                                            \
 ]b4_parse_param_vars[
   };
 
-]b4_lex_symbol_if([b4_yytranslate_definition
-b4_public_types_define
-b4_symbol_constructor_definitions])[
+]b4_lex_symbol_if([b4_yytranslate_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_definitions])[
+]b4_lex_symbol_if([], [b4_public_types_define])[
 
   // stack_symbol_type.
   ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
@@ -1146,7 +1060,7 @@ b4_error_verbose_if([int yystate, int yytoken],
   }
 #endif // YYDEBUG
 
-]b4_lex_symbol_if([], [b4_yytranslate_definition])[
+]b4_lex_symbol_if([], [b4_yytranslate_define])[
 ]b4_namespace_close[
 ]b4_epilogue[]dnl
 m4_divert_pop(0)