class SourceCodePosition

Represents a location (file, line, column) in source code that's being scanned or parsed.

Public

Constructors

SourceCodePosition

SourceCodePosition() noexcept = default

SourceCodePosition

SourceCodePosition(u32 row, u32 column, const String &filename)

SourceCodePosition

SourceCodePosition(const SourceCodePosition &other)

SourceCodePosition

SourceCodePosition(SourceCodePosition &&other)

Methods

ToString

String ToString(bool printFilename = true) const

Returns the source position as string in the format "Row:Column", e.g. "75:10".

GetRow

u32 GetRow() const

GetColumn

u32 GetColumn() const

MoveToNextRow

void MoveToNextRow()

Increases the current row count by 1 and sets the column to 0.

MoveToNextColumn

void MoveToNextColumn()

Increases the current column by 1.

IsValid

bool IsValid() const

Returns true if this is a valid source position.

False if row and column are 0.

Reset

void Reset()

Resets the source position to (0:0).

Operators

operator=

SourceCodePosition &operator=(const SourceCodePosition &other)

operator<

bool operator<(const SourceCodePosition &rhs) const

operator bool

operator bool() const

Private

Fields

mRow

u32 mRow

mColumn

u32 mColumn

mFilename

String mFilename