~/bend-docscommunity

core.bend checks

raw source on the hub · import 0x65fa10d55c6f03218f714e3b19c26baf/core.bend as Core

1 import
import Base

Types

type Ans source · line 11 · raw

Data

type CK source · line 16 · raw

Data

character class: all nullary, so a class is a shared constant, never allocated

type FM source · line 26 · raw

Data

mode: S = at field start, B = in bare field, E = in escaped field, Q = just after a quote in an escaped field; SC/BC/QC = the same with one CR held back (it is content only if the next char continues the record).

Definitions

def cls_go source · line 36 · raw

@+lf:Bool -> @+cr:Bool -> @+sep:Bool -> @+quote:Bool -> CK

def cls_u source · line 55 · raw

@+sep:U32 -> @+u:U32 -> CK

def cls source · line 58 · raw

@+sep:U32 -> @+c:Char -> CK

def close_empty source · line 61 · raw

@+flds:List<&2, String> -> @+rows:List<&2, List<&2, String>> -> List<&2, List<&2, String>>

def row source · line 68 · raw

@+txt:String -> @+flds:List<&2, String> -> @+rows:List<&2, List<&2, String>> -> List<&2, List<&2, String>>

def one source · line 71 · raw

@+c:Char -> String

def fin source · line 74 · raw

@+m:FM -> @+txt:String -> @+flds:List<&2, String> -> @+rows:List<&2, List<&2, String>> -> Ans

def cls_of source · line 94 · raw

@+sep:U32 -> @+s:String -> CK

class of the first character of a string (CText for the empty string: unused)

def go source · line 104 · raw

@+s:String -> @+m:FM -> @+k:CK -> @+sep:U32 -> @+txt:String -> @+flds:List<&2, String> -> @+rows:List<&2, List<&2, String>> -> Ans

the one walk: input first (it shrinks), then mode, then the class of the head character (computed once, by the caller), then everything else. ONE match on (input, mode, class) per character; a rejecting pair returns at once.

def parse_sep source · line 173 · raw

@+sep:U32 -> @+s:String -> Ans

def parse source · line 176 · raw

@+s:String -> Ans