40 #ifndef BISON_LOCATION_HH
41 # define BISON_LOCATION_HH
79 inline void columns (
unsigned int count = 1)
85 inline void lines (
unsigned int count = 1)
100 inline const location
operator+ (
const location& begin,
const location& end)
102 location res = begin;
108 inline const location
operator+ (
const location& begin,
unsigned int width)
110 location res = begin;
116 inline location&
operator+= (location& res,
unsigned int width)
128 inline std::ostream&
operator<< (std::ostream& ostr,
const location& loc)
130 position last = loc.end - 1;
133 && (!loc.begin.filename
134 || *loc.begin.filename != *last.filename))
136 else if (loc.begin.line != last.line)
137 ostr <<
'-' << last.line <<
'.' << last.column;
138 else if (loc.begin.column != last.column)
139 ostr <<
'-' << last.column;
145 #endif // not BISON_LOCATION_HH
position begin
Beginning of the located region.
std::ostream & operator<<(std::ostream &ostr, const location &loc)
Intercept output stream redirection.
void columns(unsigned int count=1)
Extend the current location to the COUNT next columns.
void lines(unsigned int count=1)
Extend the current location to the COUNT next lines.
location & operator+=(location &res, unsigned int width)
Add and assign a location.
void step()
Reset initial location to final location.
location()
Construct a location.
void initialize(std::string *fn)
Initialization.
const location operator+(const location &begin, const location &end)
Join two location objects to create a location.
position end
End of the located region.
void lines(int count=1)
(line related) Advance to the COUNT next lines.
void initialize(std::string *fn)
Initialization.