]/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])[
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. */
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
-do { \
- ((Current).begin = (Rhs)[1].begin); \
- ((Current).end = (Rhs)[N].end); \
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+do { \
+ if (N) \
+ { \
+ (Current).begin = (Rhs)[1].begin; \
+ (Current).end = (Rhs)[N].end; \
+ } \
+ else \
+ { \
+ (Current).begin = (Current).end = (Rhs)[0].end; \
+ } \
} while (0)
#endif
{
class ]b4_parser_class_name[;
- template < typename P >
+ template <typename P>
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;
};
}
{
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<StateType> StateStack;
+ typedef Stack<SemanticType> SemanticStack;
+ typedef Stack<LocationType> LocationStack;
]b4_parser_class_name[ (bool debug][]b4_param[]b4_parse_param_decl[) :
]b4_constructor[][debug_ (debug),
{
}
+ ]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[ ()
{
}
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 */
/* 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);
/* Debugging. */
int debug_;
- std::ostream &cdebug_;
+ std::ostream& cdebug_;
/* Look-ahead and look-ahead in internal form. */
int looka_;
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;
#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;
This behavior is undocumented and Bison
users should not rely upon it. */
if (len_)
- {
- yyval = semantic_stack_[len_ - 1];
- yyloc = location_stack_[len_ - 1];
- }
+ yyval = semantic_stack_[len_ - 1];
else
- {
- yyval = semantic_stack_[0];
- yyloc = location_stack_[0];
- }
+ yyval = semantic_stack_[0];
- if (len_)
- {
- Slice< LocationType, LocationStack > slice (location_stack_, len_);
- YYLLOC_DEFAULT (yyloc, slice, len_);
- }
+ {
+ Slice<LocationType, LocationStack> slice (location_stack_, len_);
+ YYLLOC_DEFAULT (yyloc, slice, len_);
+ }
YY_REDUCE_PRINT (n_);
switch (n_)
{
{
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]] << ' ';
namespace yy
{
- template < class T, class S = std::deque< T > >
+ template <class T, class S = std::deque<T> >
class Stack
{
public:
S seq_;
};
- template < class T, class S = Stack< T > >
+ template <class T, class S = Stack<T> >
class Slice
{
public:
}
/** \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;