src/law.bend checks
raw source on the hub · import bend-semver-checks@0.1.0.0/src/law.bend as Law
2 imports
import Base import ./text.bend as T
Types
type Law source · line 17 · raw
Data
Law@name:String -> @line:U32 -> @binders:List<&2, String> -> @statement:String -> Law
type Ln source · line 22 · raw
Data
One physical line: 1-based number, whether it starts with a space or tab, and its cleaned text.
Ln@no:U32 -> @ind:Bool -> @text:String -> Ln
type Block source · line 27 · raw
Data
A law block before its body is split: header name, header line, body lines (cleaned, newest first while scanning).
Block@name:String -> @line:U32 -> @body:List<&2, String> -> Block
type Cur source · line 30 · raw
Data
NoCurCur
InLaw@block:Block -> Cur
type PErr source · line 34 · raw
Data
NoErrPErr
PErr@line:U32 -> @msg:String -> PErr
type SS source · line 39 · raw
Data
Scanner state: the open block, closed blocks (newest first), first error.
SS@cur:Cur -> @acc:List<&2, Block> -> @err:PErr -> SS
type Hdr source · line 42 · raw
Data
Hdr@name:String -> @rest:String -> Hdr
NoHdrHdr
type Parsed source · line 47 · raw
Data
The outcome of parsing: the laws in file order, or the first error.
Good@laws:List<&2, Law> -> Parsed
Bad@line:U32 -> @msg:String -> Parsed
type ES source · line 179 · raw
Data
Logical entries: a line continues the previous one while a bracket is open
or the previous one ends in ->. State: bracket depth, current entry,
finished entries (newest first).
ES@d:U32 -> @cur:String -> @acc:List<&2, String> -> ES
type PS source · line 208 · raw
Data
Binders and statement parts, each newest first.
PS@bs:List<&2, String> -> @ss:List<&2, String> -> PS
Definitions
def lns source · line 53 · raw
@+rs:List<&2, String> -> @+n:U32 -> List<&2, Ln>
def colon source · line 63 · raw
@+s:String -> @+name:String -> Hdr
law name: rest after the law prefix, split at the first colon.
def valid.if source · line 74 · raw
@+ok:Bool -> @+name:String -> @+rest:String -> Hdr
def valid source · line 81 · raw
@+h:Hdr -> Hdr
def header source · line 88 · raw
@+text:String -> Hdr
def first_body.if source · line 92 · raw
@+b:Bool -> @+rest:String -> List<&2, String>
The body of a block opened by a header: the text after the colon, if any.
def first_body source · line 99 · raw
@+rest:String -> List<&2, String>
def flush source · line 102 · raw
@+cur:Cur -> @+acc:List<&2, Block> -> List<&2, Block>
def set_err source · line 109 · raw
@+err:PErr -> @+no:U32 -> @+msg:String -> PErr
def open.hdr source · line 116 · raw
@+no:U32 -> @+text:String -> @+acc:List<&2, Block> -> @+err:PErr -> @+h:Hdr -> SS
def push_body source · line 124 · raw
@+text:String -> @+cur:Cur -> Cur
Keep the first error.
def close_line source · line 134 · raw
@+is_law:Bool -> @+no:U32 -> @+text:String -> @+ss:SS -> SS
A non-blank column-0 line closes the open block; law opens a new one.
def indented_line source · line 145 · raw
@+text:String -> @+ss:SS -> SS
def step source · line 151 · raw
@+blank:Bool -> @+ind:Bool -> @+is_law:Bool -> @+no:U32 -> @+text:String -> @+ss:SS -> SS
Dispatch order matches binder order: blank, ind, is_law, then the state.
def scan source · line 162 · raw
@+ls:List<&2, Ln> -> @+ss:SS -> SS
def blocks source · line 171 · raw
@+ls:List<&2, Ln> -> SS
def push_entry.if source · line 182 · raw
@+b:Bool -> @+cur:String -> @+acc:List<&2, String> -> List<&2, String>
def entry_step source · line 189 · raw
@+cont:Bool -> @+l:String -> @+d:U32 -> @+cur:String -> @+acc:List<&2, String> -> ES
def entries source · line 196 · raw
@+ls:List<&2, String> -> @+es:ES -> List<&2, String>
def part.put source · line 211 · raw
@+isb:Bool -> @+e:String -> @+bs:List<&2, String> -> @+ss:List<&2, String> -> PS
def is_binder source · line 218 · raw
@+e:String -> Bool
def part source · line 221 · raw
@+es:List<&2, String> -> @+ps:PS -> PS
def with_statement.if source · line 230 · raw
@+empty:Bool -> @+name:String -> @+line:U32 -> @+bs:List<&2, String> -> @+st:String -> Parsed
def with_statement source · line 237 · raw
@+name:String -> @+line:U32 -> @+bs:List<&2, String> -> @+st:String -> Parsed
def from_parts source · line 240 · raw
@+name:String -> @+line:U32 -> @+ps:PS -> Parsed
def build source · line 245 · raw
@+b:Block -> Parsed
def join source · line 250 · raw
@+p:Parsed -> @+q:Parsed -> Parsed
def build_all source · line 261 · raw
@+bs:List<&2, Block> -> Parsed
def find.pick source · line 270 · raw
@+eq:Bool -> @+l:Law -> @+rest:Maybe<&2, Law> -> Maybe<&2, Law>
def find source · line 277 · raw
@+name:String -> @+ls:List<&2, Law> -> Maybe<&2, Law>
def dup.pick source · line 286 · raw
@+m:Maybe<&2, Law> -> @+line:U32 -> @+name:String -> @+next:Parsed -> Parsed
def dups source · line 295 · raw
@+ls:List<&2, Law> -> Parsed
def ensure.go source · line 304 · raw
@+d:Parsed -> @+ls:List<&2, Law> -> Parsed
def ensure source · line 311 · raw
@+p:Parsed -> Parsed
def finish.err source · line 318 · raw
@+err:PErr -> @+p:Parsed -> Parsed
def finish source · line 325 · raw
@+ss:SS -> Parsed
def parse source · line 331 · raw
@+text:String -> Parsed
All laws of a LAWS.bend text, in file order, or the first parse error.
def law_json source · line 336 · raw
@+l:Law -> String
def laws_json.go source · line 341 · raw
@+ls:List<&2, Law> -> String
def laws_json source · line 348 · raw
@+ls:List<&2, Law> -> String