public class SourceRange extends Object
Represents a half-open or inclusive line/column source range in a file.
Line and column numbers are zero-based (0 is the first line and first column).
import klyn.code.ast range = SourceRange(2, 0, 10, 4) assert range.containsLine(5) assert range.lineSpan == 9
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | endColumnendColumn as Long |
Zero-based ending column index. |
| public readonly property | endLineendLine as Long |
Zero-based inclusive ending line index. |
| public readonly property | lineSpanlineSpan as Long |
Total number of lines spanned by this range (endLine - startLine + 1). |
| public readonly property | startColumnstartColumn as Long |
Zero-based starting column index. |
| public readonly property | startLinestartLine as Long |
Zero-based starting line index. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SourceRangeSourceRange(
startLine as Long = 0,
startColumn as Long = 0,
endLine as Long = 0,
endColumn as Long = 0
) |
Constructs a SourceRange from zero-based start/end line and column coordinates. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | containsLine | Checks whether a zero-based line index falls within [startLine, endLine]. |
| public | withEndwithEnd(newEndLine as Long, newEndColumn as Long = 0) as SourceRange |
Returns a new SourceRange with an updated endLine and endColumn. |