Add cursor abstraction

This commit is contained in:
Yura Dupyn 2026-04-25 01:44:09 +02:00
parent f72575ae54
commit 85bc9b05e1
2 changed files with 83 additions and 0 deletions

View file

@ -19,6 +19,8 @@ It also allows for Spatial Tracking or various sub-regions within the source. It
- `SourceLocation` is basically a smart 2D coordinate equivalent to `(line, col)` (but also tracks `CodePointIndex`)
- `Span` an interval determined by `start` and `end` SourceLocations
# Source Cursor
- `SourceCursor` is a mutable cursor over `SourceRegion`. Primarily useful to build parsers on top of `SourceRegion`. It is line-aware.
# Rendering CLI Errors
Secondary functionality is `function renderSpan(region: SourceRegion, span: Span, contextLines = 1): LineView[]` which is able to render spans of source-code as follows