Class SourceSpan
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
PositionintZero-based absolute offset from the start of the source text.
LengthintLength of the range in the runtime text units used by the source representation.
Lineint1-based human-readable line where the range starts, when display coordinates are available.
Columnint1-based human-readable column where the range starts, when display coordinates are available.
FilePathstringOptional 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
FilePath
Optional source file path used for display or diagnostics formatting.
public string? FilePath { get; init; }
Property Value
Length
Length of the range in the runtime text units used by the source representation.
public int Length { get; init; }
Property Value
Line
1-based human-readable line where the range starts, when display coordinates are available.
public int Line { get; init; }
Property Value
Position
Zero-based absolute offset from the start of the source text.
public int Position { get; init; }