mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* data/lalr1.cc (position.hh): Make sure "columns" never pushes
before initial_columns. (location.hh): Use consistent variable names when defining the operator<<. Use "last" so that we subtract from Positions, not from unsigned.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2003-02-20 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* data/lalr1.cc (position.hh): Make sure "columns" never pushes
|
||||||
|
before initial_columns.
|
||||||
|
(location.hh): Use consistent variable names when defining the
|
||||||
|
operator<<.
|
||||||
|
Use "last" so that we subtract from Positions, not from unsigned.
|
||||||
|
|
||||||
2003-02-20 Akim Demaille <akim@epita.fr>
|
2003-02-20 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* data/lalr1.cc (position.hh): New subfile, including the extended
|
* data/lalr1.cc (position.hh): New subfile, including the extended
|
||||||
|
|||||||
@@ -923,7 +923,10 @@ namespace yy
|
|||||||
/** \brief (column related) Advance to the COLUMNS next columns. */
|
/** \brief (column related) Advance to the COLUMNS next columns. */
|
||||||
inline void columns (int columns = 1)
|
inline void columns (int columns = 1)
|
||||||
{
|
{
|
||||||
column += columns;
|
if (int (initial_column) < columns + int (column))
|
||||||
|
column += columns;
|
||||||
|
else
|
||||||
|
column = initial_column;
|
||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
@@ -1068,19 +1071,20 @@ namespace yy
|
|||||||
|
|
||||||
/** \brief Intercept output stream redirection.
|
/** \brief Intercept output stream redirection.
|
||||||
** \param ostr the destination output stream
|
** \param ostr the destination output stream
|
||||||
** \param pos a reference to the Position to redirect
|
** \param loc a reference to the Location to redirect
|
||||||
**
|
**
|
||||||
** Don't issue twice the line number when the location is on a single line.
|
** Avoid duplicate information.
|
||||||
*/
|
*/
|
||||||
inline std::ostream& operator<< (std::ostream& ostr, const Location& pos)
|
inline std::ostream& operator<< (std::ostream& ostr, const Location& loc)
|
||||||
{
|
{
|
||||||
ostr << pos.begin;
|
Position last = loc.end - 1;
|
||||||
if (pos.begin.filename != pos.end.filename)
|
ostr << loc.begin;
|
||||||
ostr << '-' << pos.end - 1;
|
if (loc.begin.filename != last.filename)
|
||||||
else if (pos.begin.line != pos.end.line)
|
ostr << '-' << last;
|
||||||
ostr << '-' << pos.end.line << '.' << pos.end.column - 1;
|
else if (loc.begin.line != last.line)
|
||||||
else if (pos.begin.column != pos.end.column - 1)
|
ostr << '-' << last.line << '.' << last.column;
|
||||||
ostr << '-' << pos.end.column - 1;
|
else if (loc.begin.column != last.column)
|
||||||
|
ostr << '-' << last.column;
|
||||||
return ostr;
|
return ostr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user