X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6dde1c82cd2961df2fcb508b694d64b4d485f279..f85a5e6f4b9867cf91ec6c93bdbbb8a3b4ba8e11:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index 00090e7a..84051710 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -195,18 +195,18 @@ namespace yy { class ]b4_parser_class_name[; - template < typename P > + template struct Traits { }; - template < > - struct Traits< ]b4_parser_class_name[ > + template <> + struct Traits<]b4_parser_class_name[> { typedef ]b4_int_type_for([b4_translate])[ TokenNumberType; typedef ]b4_int_type_for([b4_rhs])[ RhsNumberType; - typedef int StateType; - typedef yystype SemanticType; + typedef int StateType; + typedef yystype SemanticType; typedef ]b4_location_type[ LocationType; }; } @@ -217,15 +217,15 @@ namespace yy { public: - typedef Traits< ]b4_parser_class_name[ >::TokenNumberType TokenNumberType; - typedef Traits< ]b4_parser_class_name[ >::RhsNumberType RhsNumberType; - typedef Traits< ]b4_parser_class_name[ >::StateType StateType; - typedef Traits< ]b4_parser_class_name[ >::SemanticType SemanticType; - typedef Traits< ]b4_parser_class_name[ >::LocationType LocationType; + typedef Traits<]b4_parser_class_name[>::TokenNumberType TokenNumberType; + typedef Traits<]b4_parser_class_name[>::RhsNumberType RhsNumberType; + typedef Traits<]b4_parser_class_name[>::StateType StateType; + typedef Traits<]b4_parser_class_name[>::SemanticType SemanticType; + typedef Traits<]b4_parser_class_name[>::LocationType LocationType; - typedef Stack< StateType > StateStack; - typedef Stack< SemanticType > SemanticStack; - typedef Stack< LocationType > LocationStack; + typedef Stack StateStack; + typedef Stack SemanticStack; + typedef Stack LocationStack; ]b4_parser_class_name[ (bool debug][]b4_param[]b4_parse_param_decl[) : ]b4_constructor[][debug_ (debug), @@ -233,6 +233,17 @@ namespace yy { } + ]b4_parser_class_name[ (bool debug, + LocationType][]b4_param[]b4_parse_param_decl[) : + ]b4_constructor[][debug_ (debug), + cdebug_ (std::cerr)]b4_parse_param_cons[ + { + cdebug_ << __FILE__ << ':' << __LINE__ + << ": this constructor is provided by backward compatibility" + << ", but will be removed in the near future." + << std::endl; + } + virtual ~]b4_parser_class_name[ () { } @@ -247,8 +258,8 @@ namespace yy virtual void report_syntax_error_ (); #if YYDEBUG virtual void symprint_ (int yytype, - const SemanticType *yyvaluep, - const LocationType *yylocationp); + const SemanticType* yyvaluep, + const LocationType* yylocationp); #endif /* ! YYDEBUG */ @@ -286,9 +297,9 @@ namespace yy /* Even more tables. */ inline TokenNumberType translate_ (int token); - inline void destruct_ (const char *yymsg, + inline void destruct_ (const char* yymsg, int yytype, - SemanticType *yyvaluep, LocationType *yylocationp); + SemanticType* yyvaluep, LocationType* yylocationp); /// Pop \a n symbols the three stacks. inline void pop (unsigned int n = 1); @@ -317,7 +328,7 @@ namespace yy /* Debugging. */ int debug_; - std::ostream &cdebug_; + std::ostream& cdebug_; /* Look-ahead and look-ahead in internal form. */ int looka_; @@ -398,7 +409,7 @@ do { \ void yy::]b4_parser_class_name[::symprint_ (int yytype, - const SemanticType *yyvaluep, const LocationType *yylocationp) + const SemanticType* yyvaluep, const LocationType* yylocationp) { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; @@ -418,8 +429,8 @@ yy::]b4_parser_class_name[::symprint_ (int yytype, #endif /* ! YYDEBUG */ void -yy::]b4_parser_class_name[::destruct_ (const char *yymsg, - int yytype, SemanticType *yyvaluep, LocationType *yylocationp) +yy::]b4_parser_class_name[::destruct_ (const char* yymsg, + int yytype, SemanticType* yyvaluep, LocationType* yylocationp) { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; @@ -584,7 +595,7 @@ yyreduce: if (len_) { - Slice< LocationType, LocationStack > slice (location_stack_, len_); + Slice slice (location_stack_, len_); YYLLOC_DEFAULT (yyloc, slice, len_); } YY_REDUCE_PRINT (n_); @@ -916,7 +927,8 @@ yy::]b4_parser_class_name[::reduce_print_ (int yyrule) { unsigned int yylno = rline_[yyrule]; /* Print the symbols being reduced, and their result. */ - cdebug_ << "Reducing stack by rule " << n_ - 1 << " (line " << yylno << "), "; + cdebug_ << "Reducing stack by rule " << n_ - 1 + << " (line " << yylno << "), "; for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_]; 0 <= rhs_[i]; ++i) cdebug_ << name_[rhs_[i]] << ' '; @@ -964,7 +976,7 @@ b4_copyright([Stack handling for Bison C++ parsers], [2002, 2003, 2004])[ namespace yy { - template < class T, class S = std::deque< T > > + template > class Stack { public: @@ -1025,7 +1037,7 @@ namespace yy S seq_; }; - template < class T, class S = Stack< T > > + template > class Slice { public: @@ -1245,7 +1257,7 @@ namespace yy } /** \brief Add and assign a Location */ - inline Location &operator+= (Location& res, unsigned int width) + inline Location& operator+= (Location& res, unsigned int width) { res.columns (width); return res;