Class OriginalSourceDocument

Namespace
Pixie.Code
Assembly
Pixie.dll

Represents a user-authored source document and owns its display coordinate mapping.

public abstract class OriginalSourceDocument : SourceDocument
Inheritance
OriginalSourceDocument
Derived
Inherited Members

Remarks

Original documents are the final diagnostic coordinate space. Mapped or preprocessed documents ultimately resolve their locations to OriginalSourceSpan values backed by instances of this type.

Constructors

OriginalSourceDocument(string)

Creates an original source document from an identifier and contents string.

public OriginalSourceDocument(string identifier)

Parameters

identifier string

The document's identifier.

Properties

Identifier

Gets the document's identifier. This is typically a path.

public override string Identifier { get; }

Property Value

string

The document's identifier.

LineCount

public int LineCount { get; }

Property Value

int

Methods

GetLineByOffset(int)

Gets the display line that contains a document offset.

public SourceLine GetLineByOffset(int offset)

Parameters

offset int

The document offset.

Returns

SourceLine

The source line that contains the offset.

GetPosition(int)

Gets the diagnostic display position that corresponds to a particular offset in this document.

public override LineAndColumnPosition GetPosition(int offset)

Parameters

offset int

The offset to a character in the document.

Returns

LineAndColumnPosition

A diagnostic display position.

ResolveSpan(int, int)

Resolves a span in this document to its original source coverage.

public override ResolvedSourceSpan ResolveSpan(int start, int length)

Parameters

start int

The zero-based start offset within this document.

length int

The span length within this document.

Returns

ResolvedSourceSpan

The resolved original source coverage.

TryGetLine(int, out SourceLine)

Tries to get a display line by its zero-based line index.

public bool TryGetLine(int lineIndex, out SourceLine line)

Parameters

lineIndex int

The zero-based line index.

line SourceLine

The source line, if it exists.

Returns

bool

true if the line exists; otherwise, false.

TryGetOffset(int, int, out int)

Tries to convert one-based line and column coordinates to an offset.

public bool TryGetOffset(int line, int column, out int offset)

Parameters

line int

The one-based line.

column int

The one-based column.

offset int

The resulting offset, if the coordinates are valid.

Returns

bool

true if an offset could be computed; otherwise, false.