923 |
/** \brief (column related) Advance to the COLUMNS next columns. */ |
/** \brief (column related) Advance to the COLUMNS next columns. */ |
924 |
inline void columns (int columns = 1) |
inline void columns (int columns = 1) |
925 |
{ |
{ |
926 |
column += columns; |
if (int (initial_column) < columns + int (column)) |
927 |
|
column += columns; |
928 |
|
else |
929 |
|
column = initial_column; |
930 |
} |
} |
931 |
/** \} */ |
/** \} */ |
932 |
|
|
1071 |
|
|
1072 |
/** \brief Intercept output stream redirection. |
/** \brief Intercept output stream redirection. |
1073 |
** \param ostr the destination output stream |
** \param ostr the destination output stream |
1074 |
** \param pos a reference to the Position to redirect |
** \param loc a reference to the Location to redirect |
1075 |
** |
** |
1076 |
** Don't issue twice the line number when the location is on a single line. |
** Avoid duplicate information. |
1077 |
*/ |
*/ |
1078 |
inline std::ostream& operator<< (std::ostream& ostr, const Location& pos) |
inline std::ostream& operator<< (std::ostream& ostr, const Location& loc) |
1079 |
{ |
{ |
1080 |
ostr << pos.begin; |
Position last = loc.end - 1; |
1081 |
if (pos.begin.filename != pos.end.filename) |
ostr << loc.begin; |
1082 |
ostr << '-' << pos.end - 1; |
if (loc.begin.filename != last.filename) |
1083 |
else if (pos.begin.line != pos.end.line) |
ostr << '-' << last; |
1084 |
ostr << '-' << pos.end.line << '.' << pos.end.column - 1; |
else if (loc.begin.line != last.line) |
1085 |
else if (pos.begin.column != pos.end.column - 1) |
ostr << '-' << last.line << '.' << last.column; |
1086 |
ostr << '-' << pos.end.column - 1; |
else if (loc.begin.column != last.column) |
1087 |
|
ostr << '-' << last.column; |
1088 |
return ostr; |
return ostr; |
1089 |
} |
} |
1090 |
|
|