sun::support::Position

sun::support::Position

struct · Source (opens in a new tab)

struct sun::support::Position

Source location tracking for error messages and debugging.

Public Functions

Position

Position()=default

public · function · Source (opens in a new tab)

sun::support::Position::Position()=default

Creates 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.

hasEnd

public · function · Source (opens in a new tab)

bool sun::support::Position::hasEnd() const

Check if this position has end info.

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() const

Format as "file:line:column" or "line:column" if no file.

Public Fields

column

public · variable · Source (opens in a new tab)

int sun::support::Position::column = 1

No documentation comment.

endColumn

public · variable · Source (opens in a new tab)

std::optional<int> sun::support::Position::endColumn = std::nullopt

No documentation comment.

endLine

public · variable · Source (opens in a new tab)

std::optional<int> sun::support::Position::endLine = std::nullopt

No documentation comment.

endOffset

public · variable · Source (opens in a new tab)

std::optional<int> sun::support::Position::endOffset = std::nullopt

No documentation comment.

filePath

public · variable · Source (opens in a new tab)

std::optional<std::string> sun::support::Position::filePath = std::nullopt

No documentation comment.

line

public · variable · Source (opens in a new tab)

int sun::support::Position::line = 1

No documentation comment.

offset

public · variable · Source (opens in a new tab)

int sun::support::Position::offset = 0

No documentation comment.