Class SourceRegion

Namespace
Pixie.Code
Assembly
Pixie.dll

Specifies a sparse region of text in a document.

public sealed class SourceRegion
Inheritance
SourceRegion
Inherited Members

Constructors

SourceRegion(SourceSpan)

Creates a source region from a span.

public SourceRegion(SourceSpan span)

Parameters

span SourceSpan

A span of text in a document.

Properties

BoundingSpan

Gets a source span that covers the full extent of this region.

public SourceSpan BoundingSpan { get; }

Property Value

SourceSpan

A source span that covers the full extent of this region.

Document

Gets the document that is the context for this region.

public SourceDocument Document { get; }

Property Value

SourceDocument

The source document.

End

Gets the offset to the end of this region: the index of the first character that does not belong to this region.

public int End { get; }

Property Value

int

The offset to the end of this region.

EndOffset

Gets the offset to the end of this region: the index of the first character that does not belong to this region.

public int EndOffset { get; }

Property Value

int

The offset to the end of this region.

Length

Gets the length of this region: the difference between the end and start of this region.

public int Length { get; }

Property Value

int

The length of the region.

Start

Gets the offset to the start of this region.

public int Start { get; }

Property Value

int

The offset to the start of this region.

StartOffset

Gets the offset to the start of this region.

public int StartOffset { get; }

Property Value

int

The offset to the start of this region.

Methods

Contains(int)

Checks if this region contains the character at the given offset.

public bool Contains(int offset)

Parameters

offset int

The offset of a character.

Returns

bool

true if this region contains the character at the offset; otherwise, false.

ExcludeCharacters(Predicate<char>)

Creates a new region that includes the intersection of the current region's characters and the characters for which a predicate returns false.

public SourceRegion ExcludeCharacters(Predicate<char> exclude)

Parameters

exclude Predicate<char>

A predicate that decides whether a character is discarded or kept.

Returns

SourceRegion

A new source region.

FilterCharacters(Predicate<char>)

Creates a new region that includes the intersection of the current region's characters and the characters for which a predicate returns true.

public SourceRegion FilterCharacters(Predicate<char> include)

Parameters

include Predicate<char>

A predicate that decides whether a character is kept or discarded.

Returns

SourceRegion

A new source region.

Union(SourceRegion)

Computes the union of this region and another region

public SourceRegion Union(SourceRegion region)

Parameters

region SourceRegion

A region of text in the same document.

Returns

SourceRegion

A new source region.

Union(SourceSpan)

Computes the union of this region and a span.

public SourceRegion Union(SourceSpan span)

Parameters

span SourceSpan

A span of text in the same document.

Returns

SourceRegion

A new source region.