38 #ifndef YY_YY_ROSTLAB_BLAST_PARSER_LOCATION_H_INCLUDED 39 # define YY_YY_ROSTLAB_BLAST_PARSER_LOCATION_H_INCLUDED 46 # if defined __cplusplus 47 # if 201103L <= __cplusplus 48 # define YY_NULLPTR nullptr 53 # define YY_NULLPTR ((void*)0) 57 #line 22 "blast-parser-parser.ypp" // location.cc:339 58 namespace rostlab {
namespace blast {
59 #line 60 "rostlab/blast-parser-location.h" // location.cc:339 86 void lines (
int count = 1)
112 static unsigned add_ (
unsigned lhs,
int rhs,
int min)
114 return static_cast<unsigned> (std::max (min,
115 static_cast<int> (lhs) + rhs));
138 return res += -width;
152 return (pos1.line == pos2.line
153 && pos1.column == pos2.column
154 && (pos1.filename == pos2.filename
155 || (pos1.filename && pos2.filename
156 && *pos1.filename == *pos2.filename)));
163 return !(pos1 == pos2);
170 template <
typename YYChar>
171 std::basic_ostream<YYChar>&
172 operator<< (std::basic_ostream<YYChar>& ostr,
const position& pos)
176 return ostr << pos.line <<
'.' << pos.column;
210 begin.initialize (f, l, c);
273 return res += -width;
293 return !(loc1 == loc2);
302 template <
typename YYChar>
303 std::basic_ostream<YYChar>&
304 operator<< (std::basic_ostream<YYChar>& ostr,
const location& loc)
306 unsigned end_col = 0 < loc.
end.
column ? loc.end.column - 1 : 0;
309 && (!loc.begin.filename
310 || *loc.begin.filename != *loc.end.filename))
311 ostr <<
'-' << loc.end.filename <<
':' << loc.end.line <<
'.' << end_col;
312 else if (loc.begin.line < loc.end.line)
313 ostr <<
'-' << loc.end.line <<
'.' << end_col;
314 else if (loc.begin.column < end_col)
315 ostr <<
'-' << end_col;
319 #line 22 "blast-parser-parser.ypp" // location.cc:339 321 #line 322 "rostlab/blast-parser-location.h" // location.cc:339 322 #endif // !YY_YY_ROSTLAB_BLAST_PARSER_LOCATION_H_INCLUDED bool operator!=(const position &pos1, const position &pos2)
Compare two position objects.
std::string * filename
File name to which this position refers.
location(std::string *f, unsigned l=1u, unsigned c=1u)
Construct a 0-width location in f, l, c.
location(const position &p=position())
Construct a 0-width location in p.
position & operator-=(position &res, int width)
Subtract width columns, in place.
void lines(int count=1)
(line related) Advance to the COUNT next lines.
bool operator==(const position &pos1, const position &pos2)
Compare two position objects.
void initialize(std::string *f=YY_NULLPTR, unsigned l=1u, unsigned c=1u)
Initialization.
A point in a source file.
position begin
Beginning of the located region.
Two points in a source file.
position end
End of the located region.
void initialize(std::string *fn=YY_NULLPTR, unsigned l=1u, unsigned c=1u)
Initialization.
position(std::string *f=YY_NULLPTR, unsigned l=1u, unsigned c=1u)
Construct a position.
position operator+(position res, int width)
Add width columns.
void lines(int count=1)
Extend the current location to the COUNT next lines.
location(const position &b, const position &e)
Construct a location from b to e.
void columns(int count=1)
Extend the current location to the COUNT next columns.
unsigned column
Current column number.
position operator-(position res, int width)
Subtract width columns.
void step()
Reset initial location to final location.
position & operator+=(position &res, int width)
Add width columns, in place.
void columns(int count=1)
(column related) Advance to the COUNT next columns.
unsigned line
Current line number.