Expand description
Source locations (see docs/done/2026-10-11_elly-ctx-chunks.md, Source locations).
A document is one input to muon::parse: a file, a REPL input or an
eval source. A chunk records its documents and gives each a range of its
own positions, a ChunkLoc; its code has spans in those positions, in
side tables parallel to its nodes, patterns, lambdas and members. A realm
gives each chunk a base in its own offset space when the chunk is added, so
a Loc names a position in any of the realm’s chunks, and
Ctx::locate resolves it to a Location in a document.
The realm keeps no source text. A line is found from the line starts a
chunk records; a column is computed from the text on demand
(Location::column).
Structs§
- Chunk
Loc - A position relative to a chunk: an offset into the concatenation of its
documents. A chunk is built with no realm’s offsets; adding the base its
realm gives it (see
Ctx::chunk_bases) is the one way to aLoc. - Chunk
Span lenbytes from aChunkLoc.- CtxSpan
lenbytes from aLoc.- Doc
- A document of a chunk: its source, and where its text and lines lie among the chunk’s.
- Loc
- A position in a realm’s offset space, which concatenates the documents of its chunks in the order the chunks were added.
- Location
- A
Locresolved: the document it falls in, and its line there.
Enums§
- DocSource
- Where a document came from. The realm keeps no source text, so this is what finds the text again.
Functions§
- report
- Reports
messageatspanof the documentname, whose text istext: aname:line:column: messageline, then the span’s first line with the span underlined to that line’s end. Columns count code points, a tab as one, asLocation::columndoes. A span past the text’s end is put at its end.