|
Yume
|
Represents a location in source code, as a range starting at a line and column and ending at some other line and column of some file. More...
#include <token.hpp>

Public Member Functions | |
| constexpr auto | operator<=> (const Loc &other) const noexcept=default |
| constexpr auto | operator+ (const Loc &other) const noexcept -> Loc |
| Create a new location representing the "union" of two locations. More... | |
| auto | to_string () const -> string |
| auto | valid () const -> bool |
| auto | single () const -> Loc |
| Return a new Loc which refers to the first character of the current Loc. More... | |
Public Attributes | |
| int | begin_line |
| int | begin_col |
| int | end_line |
| int | end_col |
| const char * | file |
Represents a location in source code, as a range starting at a line and column and ending at some other line and column of some file.
Lines are 1-indexed, meaning a line number of 0 as either the beginning or end represents an unknown location. The range is inclusive, meaning a location representing just a single character would have its begin line and column be equal to its end line and column. There is no way to store a location representing "zero characters".
Create a new location representing the "union" of two locations.
The new location will have the beginning line and column of whichever location has a beginning earlier in the file, and an ending line and column of whichever location has an ending later in the file.
Definition at line 39 of file token.hpp.
References begin_col, begin_line, end_col, end_line, file, and YUME_ASSERT.
|
constexprdefaultnoexcept |
|
inline |
Return a new Loc which refers to the first character of the current Loc.
Definition at line 73 of file token.hpp.
References begin_col, begin_line, and file.
Referenced by yume::diagnostic::Note::emit().
|
inline |
|
inline |
Definition at line 70 of file token.hpp.
References begin_line, and end_line.
Referenced by yume::diagnostic::Note::emit(), and to_string().
| int yume::Loc::begin_col |
Definition at line 28 of file token.hpp.
Referenced by yume::diagnostic::Note::emit(), operator+(), single(), and to_string().
| int yume::Loc::begin_line |
Definition at line 27 of file token.hpp.
Referenced by yume::diagnostic::Note::emit(), operator+(), single(), to_string(), and valid().
| int yume::Loc::end_col |
Definition at line 30 of file token.hpp.
Referenced by operator+(), and to_string().
| int yume::Loc::end_line |
Definition at line 29 of file token.hpp.
Referenced by operator+(), to_string(), and valid().
| const char* yume::Loc::file |
Definition at line 31 of file token.hpp.
Referenced by operator+(), single(), and to_string().