54 _file(
file), _line(line - 1), _column(column - 1)
62 parse_location(
int line,
int column) noexcept : _file(), _line(line - 1), _column(column - 1) {}
64 [[nodiscard]]
bool has_file() const noexcept
66 return static_cast<bool>(_file);
69 [[nodiscard]] URL file() const noexcept
78 [[nodiscard]]
int line() const noexcept
83 [[nodiscard]]
int column() const noexcept
90 return {_line + 1, _column + 1};
98 void set_file(URL file)
100 _file = std::make_shared<URL>(
std::move(file));
103 void set_line(
int line)
noexcept
108 void set_column(
int column)
noexcept
110 _column = column - 1;
115 _line = line_and_column.first - 1;
116 _column = line_and_column.second - 1;
119 void increment_column() noexcept
124 void tab_column() noexcept
131 void increment_line() noexcept
140 case '\t': _column = ((_column / 8) + 1) * 8;
break;
141 case '\f': [[fallthrough]];
142 case '\n': ++_line; [[fallthrough]];
143 case '\r': _column = 0;
break;
159 while (ttlet c = *s++) {
167 if (location._line == 0) {
168 _column += location._column;
170 _line += location._line;
171 _column = location._column;
178 return std::format(
"{}:{}:{}", l.file(), l.line(), l.column());