61 parse_location(
int line,
int column) noexcept : _file(), _line(line - 1), _column(column - 1) {}
63 [[nodiscard]]
bool has_file() const noexcept {
64 return static_cast<bool>(_file);
67 [[nodiscard]] URL
const &file() const noexcept {
71 [[nodiscard]]
int line() const noexcept {
75 [[nodiscard]]
int column() const noexcept {
80 return {_line + 1, _column + 1};
87 void set_file(URL file) {
88 _file = std::make_shared<URL>(
std::move(file));
91 void set_line(
int line)
noexcept {
95 void set_column(
int column)
noexcept {
100 _line = line_and_column.first - 1;
101 _column = line_and_column.second - 1;
104 tt_force_inline
void increment_column() noexcept {
108 tt_force_inline
void tab_column() noexcept {
114 tt_force_inline
void increment_line() noexcept {
123 _column = ((_column / 8) + 1) * 8;
147 while (ttlet c = *s++) {
154 if (location._line == 0) {
155 _column += location._column;
157 _line += location._line;
158 _column = location._column;
164 return fmt::format(
"{0}:{1}:{2}", l.file(), l.line(), l.column());