9 namespace annotations {
15 const std::string &filename,
17 uint32_t first_column,
22 first_line(first_line),
23 first_column(first_column),
25 last_column(last_column)
27 if (last_line < first_line) {
30 if (last_line == first_line && last_column < first_column) {
60 os <<
object.filename;
68 os <<
":" <<
object.first_line;
74 if (
object.
last_line >
object.first_line) {
75 os <<
".." <<
object.last_line;
82 os <<
":" <<
object.first_column;
84 if (
object.
last_line ==
object.first_line) {
88 os <<
".." <<
object.last_column;
91 }
else if (
object.
last_line >
object.first_line) {
94 os <<
".." <<
object.last_line <<
":" <<
object.last_column;
uint32_t last_line
The last line of the range, or 0 if unknown.
uint32_t first_column
The first column of the range, or 0 if unknown.
uint32_t last_column
The last column of the range, or 0 if unknown.
Contains annotation objects used within the trees by libqasm.
Toplevel namespace with entry points for the new API.
uint32_t first_line
The first line of the range, or 0 if unknown.
Source location annotation object, containing source file line numbers etc.
void expand_to_include(uint32_t line, uint32_t column=1)
Expands the location range to contain the given location in the source file.
SourceLocation(const std::string &filename, uint32_t first_line=0, uint32_t first_column=0, uint32_t last_line=0, uint32_t last_column=0)
Constructs a source location object.
std::ostream & operator<<(std::ostream &os, const SourceLocation &object)
Stream << overload for source location objects.