38#ifndef YY_SLAMPARSER_LOCATION_HH_INCLUDED
39#define YY_SLAMPARSER_LOCATION_HH_INCLUDED
45#if defined __cplusplus
46#if 201103L <= __cplusplus
47#define YY_NULLPTR nullptr
52#define YY_NULLPTR ((void*)0)
105 return lhs + rhs < min ? min : lhs + rhs;
122 return res += -width;
134template <
typename YYChar>
135std::basic_ostream<YYChar>&
operator<<(std::basic_ostream<YYChar>& ostr,
136 const position& pos) {
137 if (pos.filename) ostr << *pos.
filename <<
':';
138 return ostr << pos.line <<
'.' << pos.column;
210 return res += -width;
224template <
typename YYChar>
225std::basic_ostream<YYChar>&
operator<<(std::basic_ostream<YYChar>& ostr,
226 const location& loc) {
229 if (loc.end.filename &&
230 (!loc.begin.filename || *loc.begin.filename != *loc.end.filename))
231 ostr <<
'-' << loc.end.filename <<
':' << loc.end.line <<
'.' << end_col;
232 else if (loc.begin.line < loc.end.line)
233 ostr <<
'-' << loc.end.line <<
'.' << end_col;
234 else if (loc.begin.column < end_col)
235 ostr <<
'-' << end_col;
240#line 303 "location.hh"
Two points in a source file.
void step()
Reset initial location to final location.
void columns(counter_type count=1)
Extend the current location to the COUNT next columns.
position::filename_type filename_type
Type for file name.
location(const position &p=position())
Construct a 0-width location in p.
position::counter_type counter_type
Type for line and column numbers.
void lines(counter_type count=1)
Extend the current location to the COUNT next lines.
position end
End of the located region.
location(filename_type *f, counter_type l=1, counter_type c=1)
Construct a 0-width location in f, l, c.
position begin
Beginning of the located region.
void initialize(filename_type *f=YY_NULLPTR, counter_type l=1, counter_type c=1)
Initialization.
location(const position &b, const position &e)
Construct a location from b to e.
A point in a source file.
const std::string filename_type
Type for file name.
void columns(counter_type count=1)
(column related) Advance to the COUNT next columns.
void lines(counter_type count=1)
(line related) Advance to the COUNT next lines.
filename_type * filename
File name to which this position refers.
counter_type column
Current column number.
static counter_type add_(counter_type lhs, counter_type rhs, counter_type min)
Compute max (min, lhs+rhs).
int counter_type
Type for line and column numbers.
void initialize(filename_type *fn=YY_NULLPTR, counter_type l=1, counter_type c=1)
Initialization.
counter_type line
Current line number.
position(filename_type *f=YY_NULLPTR, counter_type l=1, counter_type c=1)
Construct a position.
position operator-(position res, position::counter_type width)
Subtract width columns.
position & operator+=(position &res, position::counter_type width)
Add width columns, in place.
std::basic_ostream< YYChar > & operator<<(std::basic_ostream< YYChar > &ostr, const position &pos)
Intercept output stream redirection.
position & operator-=(position &res, position::counter_type width)
Subtract width columns, in place.
position operator+(position res, position::counter_type width)
Add width columns.