Table of Contents

Class SourceSpan

Namespace
Utils.Parser.Source
Assembly
Utils.Parser.Source.dll

Represents a technical range in a source text for lexer, parser, and runtime operations.

public sealed record SourceSpan : IEquatable<SourceSpan>
Inheritance
SourceSpan
Implements
Inherited Members
Extension Methods

Remarks

This type is used by runtime tokens, parse nodes, and related runtime analysis surfaces to preserve absolute text offsets. Unlike SourceCodeRange, it keeps the absolute source position and allows the file path to be omitted when the source text is anonymous or in-memory.

Constructors

SourceSpan(int, int, int, int, string?)

Represents a technical range in a source text for lexer, parser, and runtime operations.

public SourceSpan(int Position, int Length, int Line = 1, int Column = 1, string? FilePath = null)

Parameters

Position int

Zero-based absolute offset from the start of the source text.

Length int

Length of the range in the runtime text units used by the source representation.

Line int

1-based human-readable line where the range starts, when display coordinates are available.

Column int

1-based human-readable column where the range starts, when display coordinates are available.

FilePath string

Optional source file path used for display or diagnostics formatting.

Remarks

This type is used by runtime tokens, parse nodes, and related runtime analysis surfaces to preserve absolute text offsets. Unlike SourceCodeRange, it keeps the absolute source position and allows the file path to be omitted when the source text is anonymous or in-memory.

Properties

Column

1-based human-readable column where the range starts, when display coordinates are available.

public int Column { get; init; }

Property Value

int

FilePath

Optional source file path used for display or diagnostics formatting.

public string? FilePath { get; init; }

Property Value

string

Length

Length of the range in the runtime text units used by the source representation.

public int Length { get; init; }

Property Value

int

Line

1-based human-readable line where the range starts, when display coordinates are available.

public int Line { get; init; }

Property Value

int

Position

Zero-based absolute offset from the start of the source text.

public int Position { get; init; }

Property Value

int