SourceText

Represents D source code.

The source text may come from a file or from a memory buffer.

Constructors

this
this(cstring filePath, bool loadFile = false)

True when the text has no invalid UTF8 sequences. Constructs a SourceText object.

this
this(cstring filePath, cstring data)

Constructs a SourceText object.

Members

Functions

load
bool load(Diagnostics diag = null)

Loads the source text from a file.

text
cstring text()

Returns a slice to the source text, excluding the sentinel string.

Static functions

addSentinelString
void addSentinelString(ref cstring text)

Appends the sentinel string to the text (if not already there.)

Static variables

sentinelString
auto sentinelString;

The data member must be terminated with this string. Four zeros are used to make certain optimizations possible in the Lexer.

Variables

data
cstring data;

The UTF-8, zero-terminated source text.

filePath
cstring filePath;

The file path to the source text. Mainly used for error messages.

Meta