sun::support::Position
struct · Source (opens in a new tab)
struct sun::support::PositionSource location tracking for error messages and debugging.
Public Functions
Position
Position()=default
public · function · Source (opens in a new tab)
sun::support::Position::Position()=defaultCreates a source coordinate with its optional file path and byte offset.
Position(int l, int c, int o=0, std::optional< std::string > path=std::nullopt)
public · function · Source (opens in a new tab)
sun::support::Position::Position(int l, int c, int o=0, std::optional< std::string > path=std::nullopt)Creates a source coordinate with its optional file path and byte offset.
fileOnly
public · function · static · Source (opens in a new tab)
static Position sun::support::Position::fileOnly(const std::string &path)Records a known source file when source coordinates are unavailable.
Related: Position
hasEnd
public · function · Source (opens in a new tab)
bool sun::support::Position::hasEnd() constCheck if this position has end info.
hasSourceLocation
public · function · Source (opens in a new tab)
bool sun::support::Position::hasSourceLocation() constDistinguishes source information from a default synthesized position.
setEnd
setEnd(int el, int ec)
public · function · Source (opens in a new tab)
void sun::support::Position::setEnd(int el, int ec)Set end position (for token/expression span).
setEnd(int el, int ec, int eo)
public · function · Source (opens in a new tab)
void sun::support::Position::setEnd(int el, int ec, int eo)Sets the ending source coordinate of this span.
toString
public · function · Source (opens in a new tab)
std::string sun::support::Position::toString() constFormat as "file:line:column" or "line:column" if no file.
A nonpositive line denotes a known file without source coordinates and prints only it.
Public Fields
column
public · variable · Source (opens in a new tab)
int sun::support::Position::column = 1No documentation comment.
endColumn
public · variable · Source (opens in a new tab)
std::optional<int> sun::support::Position::endColumn = std::nulloptNo documentation comment.
endLine
public · variable · Source (opens in a new tab)
std::optional<int> sun::support::Position::endLine = std::nulloptNo documentation comment.
endOffset
public · variable · Source (opens in a new tab)
std::optional<int> sun::support::Position::endOffset = std::nulloptNo documentation comment.
filePath
public · variable · Source (opens in a new tab)
std::optional<std::string> sun::support::Position::filePath = std::nulloptNo documentation comment.
line
public · variable · Source (opens in a new tab)
int sun::support::Position::line = 1No documentation comment.
offset
public · variable · Source (opens in a new tab)
int sun::support::Position::offset = 0No documentation comment.