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
const &file() const noexcept
74 [[nodiscard]]
int line() const noexcept
79 [[nodiscard]]
int column() const noexcept
86 return {_line + 1, _column + 1};
94 void set_file(URL file)
96 _file = std::make_shared<URL>(
std::move(file));
99 void set_line(
int line)
noexcept
104 void set_column(
int column)
noexcept
106 _column = column - 1;
111 _line = line_and_column.first - 1;
112 _column = line_and_column.second - 1;
115 void increment_column() noexcept
120 void tab_column() noexcept
127 void increment_line() noexcept
136 case '\t': _column = ((_column / 8) + 1) * 8;
break;
137 case '\f': [[fallthrough]];
138 case '\n': ++_line; [[fallthrough]];
139 case '\r': _column = 0;
break;
155 while (ttlet c = *s++) {
163 if (location._line == 0) {
164 _column += location._column;
166 _line += location._line;
167 _column = location._column;
174 return std::format(
"{0}:{1}:{2}", l.file(), l.line(), l.column());