![]() |
Spicy
|
#include <location.h>
Public Member Functions | |
Location (hilti::rt::filesystem::path file="", int from_line=-1, int to_line=-1, int from_character=-1, int to_character=-1) | |
Location (const Location &)=default | |
Location (Location &&)=default | |
Location & | operator= (const Location &)=default |
Location & | operator= (Location &&)=default |
auto | file () const |
auto | from () const |
auto | to () const |
std::string | render (bool no_path=false) const |
operator bool () const | |
operator std::string () const | |
bool | operator< (const Location &other) const |
bool | operator== (const Location &other) const |
Friends | |
struct | std::hash< Location > |
Source code locations associated with AST nodes.
|
inline |
Constructor. If all arguments are left at their default, the instance will match location::None
.
file | file name/path associated with the location; empty if unknown. |
from_line | first line number of the described range; -1 if not availabl. |
to_line | last line number of the described range; -1 if not availabl. |
from_character | first character number of the described range; -1 if not availabl. |
to_character | first character number of the described range; -1 if not availabl. |
|
explicit |
Returns true if the location is set. A location is unset if it equals location::None
(which a default constructed location will)..
|
inline |
Forwards to render()
.
std::string Location::render | ( | bool | no_path = false | ) | const |
Returns a string representation of the location.
no_path | if true, do not include the file |