src/syntax/word.bend checks
raw source on the hub · import bolt@1.43.0.0/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.
3 imports
import Base import ../lazy/lazy.bend as Lazy import ../rchars.bend as Rchars
Types
type W source · line 11 · 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 15 · raw
@+cc:Char -> Bool
a char a name may hold: letters, digits, _ and .
def text source · line 19 · raw
@run:List<&2, Char> -> String
the run's chars (reversed) as a string
def close.yes source · line 23 · 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 31 · 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 39 · 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 47 · 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 56 · 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 61 · raw
@st:W -> @col:U32 -> String
the run that held the column, else ""
def at.skip.n source · line 66 · raw
@nl:Bool -> @nn:U32 -> U32
lines still to skip after this char; a newline counts as one
def at.skip.done source · line 74 · 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 82 · 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 92 · 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 100 · 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 110 · raw
@source:String -> @+line:U32 -> @col:U32 -> String
the name under a (line, col) of a source, "" when none
def cut.go source · line 114 · 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 124 · raw
@name:String -> Pair(String, String)
Alias.rest cut at its first dot: ("Alias", "rest"); no dot: (name, "")
def fst source · line 128 · raw
@pp:Pair(String, String) -> String
a pair's first
def snd source · line 133 · raw
@pp:Pair(String, String) -> String
a pair's second
def head source · line 138 · raw
@name:String -> String
the part before the first dot
def rest source · line 142 · raw
@name:String -> String
the part after the first dot, "" when there is none
def run_of source · line 146 · raw
@cs:List<&2, Char> -> List<&2, Char>
the leading run of name chars
def before source · line 154 · raw
@source:String -> @line:U32 -> @col:U32 -> String
the name that ends at (line, col): what is being typed, for completion