~/bend-docscommunity

lib/linter/shared/text/spec.bend open laws/TODOs

raw source on the hub · import bend-lint-rules@0.3.4.0/lib/linter/shared/text/spec.bend as Spec

Edits to texts, and places in them: the edits to make, spans that must not touch, and the lines and columns of offsets.

1 import
import Base

Laws

law Spans provedin layout/directive_order.bendsource · line 10 · raw

Data

Spans that never touch (Spans.touches).

law Spans.empty provedin layout/directive_order.bendsource · line 14 · raw

Spans

No spans.

law Place provedin layout/directive_order.bendsource · line 22 · raw

Data

An offset in a file.

law Place.of provedin layout/directive_order.bendsource · line 26 · raw

@path:String -> @offset:U32 -> Place

The offset offset in the file at path.

law Edit.path provedin layout/directive_order.bendsource · line 32 · raw

@edit:Edit -> String

The path of the file that edit changes.

law apply provedin layout/directive_order.bendsource · line 37 · raw

@edits:List<&2, Edit> -> @text:String -> String

text with edits made. Edits must not overlap.

law Spans.cmp provedin layout/directive_order.bendsource · line 43 · raw

@t:Spans -> @b:U32 -> @e:U32 -> Cmp

How the span from b to e compares with the root's of t, by start, then end; GT past a leaf.

law Spans.add provedin layout/directive_order.bendsource · line 50 · raw

@t:Spans -> @+b:U32 -> @+e:U32 -> @side:Cmp -> Spans

t with the span from b to e; side is how it compares with the root's.

law Spans.touches provedin layout/directive_order.bendsource · line 58 · raw

@+t:Spans -> @+b:U32 -> @+e:U32 -> Bool

Whether the span from b to e touches one of t: they share a character, or two insertions are at one place.

law positions provedin layout/directive_order.bendsource · line 65 · raw

@text:String -> @offsets:List<&2, U32> -> List<&2, Position>

Where each offset of offsets is in text, in order: one pass over the text, whatever the number of offsets.

law Place.at provedin layout/directive_order.bendsource · line 71 · raw

@places:Map<&2, Position> -> @path:String -> @offset:U32 -> Position

Where the offset offset of the file at path is, among places (what places gives); 1:1 if it is not there.

law places provedin layout/directive_order.bendsource · line 79 · raw

@texts:Map<&2, String> -> @requests:List<&2, Place> -> Map<&2, Position>

Where each requested offset is, by key (read with Place.at): one pass over each file asked about, whatever the number of requests. texts holds the files' texts, by path.

Types

type Edit source · line 6 · raw

Data

The text from beg to end in the file at path, replaced by text.

type Position source · line 18 · raw

Data

A place in a text: its line and its column, from 1. A column counts UTF-16 units, as editors do.