~/bend-docscommunity

lib/linter/shared/text/impl.bend checks

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

3 imports
import Base
import bend-lint-api@0.3.4.0/shared.bend as Shared
import ./spec.bend as Spec

Types

type Spans source · line 7 · raw

Data

By place: a balanced (AVL) tree, by start, then end; height counts its levels. As spans never touch, their ends rise with their starts.

type Place source · line 11 · raw

Data

type Placed source · line 222 · raw

Data

An offset to place, by its place among the offsets asked; and a place found, by the same.

type Located source · line 225 · raw

Data

type Walk source · line 229 · raw

Data

The offsets left to place, in offset order, and the places found, last first.

Definitions

def Edit.is_le source · line 33 · raw

@a:0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Edit -> @b:0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Edit -> Bool

def apply.go source · line 40 · raw

@edits:List<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Edit> -> @+rest:String -> @+at:U32 -> @out:List<&2, String> -> String

rest, the text from at on, with edits (in order) made, after the pieces of out (last first). The pieces join once, at the end, so the text is copied once, whatever the number of edits.

def Spans.height source · line 57 · raw

@t:Spans -> U32

Spans =====

def Spans.node source · line 65 · raw

@+l:Spans -> @b:U32 -> @e:U32 -> @+r:Spans -> Spans

The node over l and r, whose heights differ by one at most.

def Spans.lean_left.if source · line 70 · raw

@outer:Bool -> @ll:Spans -> @lb:U32 -> @le:U32 -> @lr:Spans -> @b:U32 -> @e:U32 -> @r:Spans -> Spans

def Spans.lean_left source · line 88 · raw

@l:Spans -> @b:U32 -> @e:U32 -> @r:Spans -> Spans

The node over l and r, where l is two levels higher: turned right, after its left turns left if its inner side is the higher.

def Spans.lean_right.if source · line 95 · raw

@outer:Bool -> @l:Spans -> @b:U32 -> @e:U32 -> @rl:Spans -> @rb:U32 -> @re:U32 -> @rr:Spans -> Spans

def Spans.lean_right source · line 112 · raw

@l:Spans -> @b:U32 -> @e:U32 -> @r:Spans -> Spans

The node over l and r, where r is two levels higher: the mirror of lean_left.

def Spans.balance.if source · line 119 · raw

@left:Bool -> @right:Bool -> @l:Spans -> @b:U32 -> @e:U32 -> @r:Spans -> Spans

def Spans.balance source · line 129 · raw

@+l:Spans -> @b:U32 -> @e:U32 -> @+r:Spans -> Spans

The node over l and r, balanced: their heights may differ by two.

def Spans.cmp.of source · line 134 · raw

@starts:Cmp -> @e:U32 -> @y:U32 -> Cmp

def Spans.has source · line 160 · raw

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

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

def Spans.starts_before source · line 171 · raw

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

def Spans.last source · line 180 · raw

@t:Spans -> @+e:U32 -> @found:Maybe<&2, U32> -> @before:Bool -> Maybe<&2, U32>

The end of the last span of t (by start, then end) that starts before e, or found. before says whether the root's does. Its end is the furthest of theirs, as ends rise with starts.

def Spans.ends_after source · line 189 · raw

@last:Maybe<&2, U32> -> @b:U32 -> Bool

def Spans.touches.insertion source · line 196 · raw

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

def Spans.touches.of source · line 203 · raw

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

def Placed.is_le source · line 232 · raw

@a:Placed -> @b:Placed -> Bool

def Located.is_le source · line 237 · raw

@a:Located -> @b:Located -> Bool

def Placed.of source · line 242 · raw

@offsets:List<&2, U32> -> @+index:U32 -> @out:List<&2, Placed> -> List<&2, Placed>

def Walk.is_due source · line 249 · raw

@pending:List<&2, Placed> -> @at:U32 -> Bool

def Walk.emit source · line 257 · raw

@pending:List<&2, Placed> -> @due:Bool -> @+at:U32 -> @+line:U32 -> @+column:U32 -> @out:List<&2, Located> -> Walk

The offsets due at at, placed at line and column.

def Walk.done source · line 278 · raw

@w:Walk -> List<&2, Located>

def Walk.width source · line 285 · raw

@units:U32 -> @cr:Bool -> @rest:String -> U32

The columns a character takes, units of UTF-16, before the text rest: none if it is a CR (cr) before an LF, as the two end the line, and an editor places nothing between them.

def Walk.go source · line 293 · raw

@text:String -> @+at:U32 -> @+line:U32 -> @column:U32 -> @w:Walk -> List<&2, Located>

The offsets placed, one character of text at a time; offsets past its end are placed at its end.

def Walk.positions source · line 323 · raw

@located:List<&2, Located> -> @out:List<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position> -> List<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position>

def Walk.locate source · line 334 · raw

@+sorted:List<&2, Placed> -> @text:String -> List<&2, Located>

The offsets of sorted (in offset order) placed in text, in no order.

def Place.key source · line 347 · raw

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

def places.group source · line 358 · raw

@requests:List<&2, Place> -> @groups:Map<&2, List<&2, Placed>> -> Map<&2, List<&2, Placed>>

The requests by file, each offset numbered by itself, onto groups.

def places.keep source · line 369 · raw

@located:List<&2, Located> -> @+path:String -> @out:Map<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position> -> Map<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position>

The places found in the file at path, by key, onto out.

def places.walk source · line 381 · raw

@paths:List<&2, String> -> @+groups:Map<&2, List<&2, Placed>> -> @+texts:Map<&2, String> -> @out:Map<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position> -> Map<&2, 0x04e69ea1ff1359de841d076dffd167c9/lib/linter/shared/text/spec.Position>

The requests of each file of paths placed in its text, onto out; a file texts lacks places them at its start.