class SourceCode

Wraps a source code represented as a text string, and provides helpers for movement through the code characters and lines.

Public

Constructors

SourceCode

SourceCode(const String &source)

Methods

IsValid

bool IsValid() const

Returns true if this is a valid source code stream.

GetNextCharacter

char GetNextCharacter()

Returns the next character from the source, and advances the cursor.

SkipNextCharacter

void SkipNextCharacter()

Ignores the next character and advances the cursor.

GetPosition

const SourceCodePosition &GetPosition() const

Returns the current source position.

GetLine

const String &GetLine() const

Returns the current source line.

Protected

Constructors

SourceCode

SourceCode() = default

Methods

GetPreviouslyReadLine

String GetPreviouslyReadLine(u32 lineIndex) const

Returns the line (if it has already been read) by the zero-based line index.

Fields

mStream

StringStream mStream

mCurrentLine

String mCurrentLine

mReadLines

Vector<String> mReadLines

mPosition