|
FE 0.13.1
Header-only C++ frontend library
|
Location within a Src: the half-open byte range [Loc::begin, Loc::end). More...
#include <fe/loc.h>
Public Types | |
| enum class | Style { Full , RowCol , Row , MSVC } |
| How much of a Loc a diagnostic spells out; see Diag::loc_style. More... | |
Public Member Functions | |
| constexpr | Loc ()=default |
| Creates an invalid Location. | |
| constexpr | Loc (const Src *src, Pos begin, Pos end) |
| constexpr | Loc (const Src *src, Pos pos) |
The empty Location at pos. | |
| constexpr | Loc (Pos begin, Pos end) |
| constexpr | Loc (Pos pos) |
| constexpr Loc | anew_begin () const |
| constexpr Loc | anew_end () const |
| constexpr uint32_t | size () const |
| constexpr Loc | operator+ (Pos pos) const |
| constexpr Loc | operator+ (Loc loc) const |
| The hull of both Locations. | |
| constexpr Loc | operator& (Loc loc) const |
| The overlap of both Locations - invalid if they are disjoint or sit in different files. | |
| constexpr | operator bool () const |
| Is a valid Location? | |
| constexpr bool | operator== (Loc other) const |
| void | dump () const |
Public Attributes | |
| const Src * | src = {} |
| Pos | begin = {} |
| Pos | end = {} |
| It's called end because - just like an STL iterator - it refers to the byte one past the last one within this Location. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, Loc loc) |
| Streams as path:row:col-row:col, resolved through Loc::src - or as raw offsets if it has none. | |
Location within a Src: the half-open byte range [Loc::begin, Loc::end).
It's only two machine words on a 64 bit arch, so pass around as value. An empty range is a Location between two characters - what you want to point at when something is missing rather than wrong; see Loc::anew_end.
|
strong |
How much of a Loc a diagnostic spells out; see Diag::loc_style.
| Enumerator | |
|---|---|
| Full | path:row:col-row:col - the whole range. |
| RowCol | path:row:col |
| Row | path:row |
| MSVC | path(row,col) |
|
constexprdefault |
Creates an invalid Location.
Referenced by anew_begin(), anew_end(), Loc(), Loc(), Loc(), fe::Error::note(), operator&(), operator+(), operator+(), operator<<, and operator==().
|
inlineconstexpr |
|
inlineconstexpr |
| void fe::Loc::dump | ( | ) | const |
|
inlineexplicitconstexpr |
The overlap of both Locations - invalid if they are disjoint or sit in different files.
Dual to operator+; since an invalid Loc is falsy, if (a & b) also reads as "do they overlap?". An empty Loc overlaps nothing, not even itself.
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 69 of file loc.h.
References begin, end, and fe::Pos::off.
|
friend |
| Pos fe::Loc::begin = {} |
Definition at line 94 of file loc.h.
Referenced by anew_begin(), Loc(), Loc(), operator bool(), operator&(), operator+(), operator+(), operator==(), size(), and fe::Parser< Tok, Tag, K, S >::tracker().
| Pos fe::Loc::end = {} |
It's called end because - just like an STL iterator - it refers to the byte one past the last one within this Location.
Definition at line 95 of file loc.h.
Referenced by anew_end(), Loc(), Loc(), fe::Lexer< K, S >::next(), operator&(), operator+(), operator==(), and size().
| const Src* fe::Loc::src = {} |
Definition at line 93 of file loc.h.
Referenced by anew_begin(), anew_end(), Loc(), Loc(), operator&(), operator+(), operator+(), and operator==().