Skip to main content

Module span

Module span 

Source
Expand description

Source positions/ranges anchored to UTF-16 code-unit offsets (1-based line/column). Port of varar-core/src/span.ts / Span.java.

Structs§

LineCol
A 1-based line/column position.
Span
A source range [start_offset, end_offset) in UTF-16 code units, with 1-based line/column at each end.

Functions§

line_col
Computes the 1-based (line, col) at offset (a UTF-16 code-unit index) into source. Walks per UTF-16 code unit from the start, exactly like Java’s charAt loop (so an astral character advances col by 2).