marianoguerra/shrubbery/basic does not have a README file

    Pos

    pub(all) struct Pos {
    line : Int
    pos : Int
    idx : Int
    col0 : Int
    col :
    Column

    } derive(Eq)

    A position in a source file.

    Four numbers, in three different units, and keeping them apart is the first thing this port has to get right:

    • line and pos are what Racket's port-next-location reports, in CODE POINTS. They are what raw-srcloc carries, and what the oracle compares, so they cannot be approximated by anything cheaper.
    • idx is a UTF-16 code-unit index. It exists to slice a MoonBit String and to hand a span to error-report, and it is never reported.
    • col is the INDENTATION column, which is a partial order rather than a number — see @column.Column. It is not pos minus the line start: tabs and grapheme clusters both make it something else.

    Pos::to_display

    fn Pos::to_display(self : Pos) -> String

    line:col, 1-based on both, for a message.

    Span

    pub(all) struct Span {
    start : Pos
    end : Pos
    } derive(Eq)

    A half-open range of a source file.

    Span::at

    fn Span::at(p : Pos) -> Span

    An empty span at p, for an error that has no extent — an unexpected end of input, or a missing closer.

    Span::merge

    fn Span::merge(self : Span, other : Span) -> Span

    The smallest span covering both.

    Span::units

    fn Span::units(self : Span) -> Int

    Length in UTF-16 code units — the unit error-report spans are in.

    start

    let start : Pos

    Source Files