src/hdr.bend checks
raw source on the hub · import bend-toon-codec@0.1.0.0/src/hdr.bend as Hdr
6 imports
import Base import ./num.bend as N import ./head.bend as Hd import ./text.bend as T import ./split.bend as S import ./prim.bend as P
Types
type Hdr source · line 13 · raw
Data
length, delimiter as a code point, field names (empty: not tabular), and the text after the colon.
Hdr@n:U32 -> @d:U32 -> @fields:List<&2, String> -> @rest:String -> Hdr
Definitions
def empty source · line 16 · raw
Hdr
def bad source · line 19 · raw
@+m:String -> Result<&2, &2, String, Hdr>
def mark.name source · line 25 · raw
@+r:Result<&2, &2, String, String> -> Result<&2, &2, String, String>
A field name: quoted names are unescaped; a bare name that holds another delimiter than the active one is a delimiter mismatch. A quoted field name keeps its marker (see head.bend).
def name.ok source · line 32 · raw
@+bare:Bool -> @+bad_delim:Bool -> @+tok:String -> Result<&2, &2, String, String>
def other_delim source · line 41 · raw
@+c:U32 -> @+d:U32 -> Bool
def has_other source · line 44 · raw
@+s:String -> @+d:U32 -> Bool
def not_quoted source · line 51 · raw
@+s:String -> Bool
def name source · line 54 · raw
@+d:U32 -> @+tok:String -> Result<&2, &2, String, String>
def names.cons source · line 57 · raw
@+r:Result<&2, &2, String, String> -> @+rest:Result<&2, &2, String, List<&2, String>> -> Result<&2, &2, String, List<&2, String>>
def names source · line 66 · raw
@+d:U32 -> @+toks:List<&2, String> -> Result<&2, &2, String, List<&2, String>>
def fields.done source · line 73 · raw
@+n:U32 -> @+d:U32 -> @+rest:String -> @+r:Result<&2, &2, String, List<&2, String>> -> Result<&2, &2, String, Hdr>
def fields.after.pick source · line 80 · raw
@+colon:Bool -> @+n:U32 -> @+d:U32 -> @+inner:String -> @+s:String -> Result<&2, &2, String, Hdr>
def fields.after source · line 88 · raw
@+n:U32 -> @+d:U32 -> @+inner:String -> @+s:String -> Result<&2, &2, String, Hdr>
After }: the colon follows at once.
def fields.cut.if source · line 91 · raw
@+missing:Bool -> @+n:U32 -> @+d:U32 -> @+s:String -> @+i:U32 -> Result<&2, &2, String, Hdr>
def fields.cut source · line 98 · raw
@+n:U32 -> @+d:U32 -> @+s:String -> @+i:U32 -> Result<&2, &2, String, Hdr>
def after.pick source · line 101 · raw
@+colon:Bool -> @+brace:Bool -> @+n:U32 -> @+d:U32 -> @+s:String -> Result<&2, &2, String, Hdr>
def after source · line 111 · raw
@+n:U32 -> @+d:U32 -> @+s:String -> Result<&2, &2, String, Hdr>
After ]: the colon, or a field list.
def delim.pick source · line 114 · raw
@+tab:Bool -> @+pipe:Bool -> @+comma:Bool -> @+n:U32 -> @+s:String -> Result<&2, &2, String, Hdr>
def delim source · line 126 · raw
@+n:U32 -> @+s:String -> Result<&2, &2, String, Hdr>
The delimiter symbol, then ].
def len.pick source · line 129 · raw
@+ok:Bool -> @+n:Maybe<&2, U32> -> @+rest:String -> Result<&2, &2, String, Hdr>
def len.ok.pick source · line 136 · raw
@+empty:Bool -> @+zero:Bool -> @+lead0:Bool -> @+ds:String -> Bool
def len.ok source · line 148 · raw
@+ds:String -> Bool
A length is 0 or digits without a leading zero, at most nine of them.
def len source · line 151 · raw
@+r:0x12996a27cbeef5e5ba1e8cd909be0e05/src/num.Sp -> Result<&2, &2, String, Hdr>
def parse.pick source · line 156 · raw
@+open:Bool -> @+s:String -> Result<&2, &2, String, Hdr>
def parse source · line 164 · raw
@+s:String -> Result<&2, &2, String, Hdr>
Parse a header from its [.