src/syntax/word.bend checks
raw source on the hub · import 0x013e0f9a479bbebad5ed196725eede95/src/syntax/word.bend as MWord
src/syntax/word: the name under a (line, col), both 0-based. A name is letters,
digits, _ and . (dots are just characters in a Bend name, and a module
alias rides in front: Frame.decode). A position right after a name counts
as on it, as editors put the cursor there.
2 imports
import Base import ../lazy/lazy.bend as Lazy
Types
type W source · line 10 · raw
Data
i: the column of the next char; start: where the current run began; run: the current name, reversed; hit: the name found
W@i:U32 -> @start:U32 -> @run:List<&2, Char> -> @hit:Maybe<&2, String> -> W
Definitions
def is_name source · line 14 · raw
@+cc:Char -> Bool
a char a name may hold: letters, digits, _ and .
def text source · line 18 · raw
@run:List<&2, Char> -> String
the run's chars (reversed) as a string
def close.yes source · line 22 · raw
@ok:Bool -> @run:List<&2, Char> -> @hit:Maybe<&2, String> -> Maybe<&2, String>
the run holds the column: keep it; otherwise the hit so far
def close.run source · line 30 · raw
@run:List<&2, Char> -> @+start:U32 -> @+ii:U32 -> @+col:U32 -> @hit:Maybe<&2, String> -> Maybe<&2, String>
an empty run leaves the hit; otherwise the run if start <= col <= i
def close source · line 38 · raw
@+ii:U32 -> @+start:U32 -> @run:List<&2, Char> -> @hit:Maybe<&2, String> -> @+col:U32 -> Maybe<&2, String>
a run that ends at column i holds col when start <= col <= i, unless one already did
def step.on source · line 46 · raw
@name:Bool -> @cc:Char -> @+ii:U32 -> @+start:U32 -> @run:List<&2, Char> -> @hit:Maybe<&2, String> -> @+col:U32 -> W
a name char joins the run; any other char ends it
def step source · line 55 · raw
@+cc:Char -> @st:W -> @+col:U32 -> W
one char: it extends the run of name chars, or ends it (a run holding the column is the answer)
def finish source · line 60 · raw
@st:W -> @col:U32 -> String
the run that held the column, else ""
def at.skip.n source · line 65 · raw
@nl:Bool -> @nn:U32 -> U32
lines still to skip after this char; a newline counts as one
def at.skip.done source · line 73 · raw
@nl:Bool -> @nn:U32 -> Bool
the next char starts the wanted line when this one was its preceding newline
def at.skip source · line 81 · raw
@ss:String -> @+nn:U32 -> @done:Bool -> String
the source with n lines skipped. done means this string is the line
def at.advance source · line 91 · raw
@nl:Bool -> @hh:Char -> @st:W -> @+col:U32 -> W
a newline ends the line; any other char is part of it
def at.read source · line 99 · raw
@ss:String -> @stop:Bool -> @st:W -> @+col:U32 -> String
the name at col, from here up to the next newline
def at source · line 109 · raw
@source:String -> @+line:U32 -> @col:U32 -> String
the name under a (line, col) of a source, "" when none
def cut.go source · line 113 · raw
@cs:List<&2, Char> -> @acc:List<&2, Char> -> Pair(String, String)
Alias.rest cut at its first dot: ("Alias", "rest"); no dot: (name, "")
def cut source · line 123 · raw
@name:String -> Pair(String, String)
Alias.rest cut at its first dot: ("Alias", "rest"); no dot: (name, "")
def fst source · line 127 · raw
@pp:Pair(String, String) -> String
a pair's first
def snd source · line 132 · raw
@pp:Pair(String, String) -> String
a pair's second
def head source · line 137 · raw
@name:String -> String
the part before the first dot
def rest source · line 141 · raw
@name:String -> String
the part after the first dot, "" when there is none
def run_of source · line 145 · raw
@cs:List<&2, Char> -> List<&2, Char>
the leading run of name chars
def before source · line 153 · raw
@source:String -> @line:U32 -> @col:U32 -> String
the name that ends at (line, col): what is being typed, for completion