src/yaml.bend checks
raw source on the hub · import bend-kube-runtime@0.1.1.0/src/yaml.bend as Yaml
2 imports
import Base import ./json.bend as J
Types
type Line source · line 19 · raw
Data
Line@indent:U32 -> @text:String -> Line
type YFrame source · line 25 · raw
Data
An open container: a mapping (members reversed, and the key whose value is still to come) or a sequence (items reversed, and, after a bare "- ", the anchor of the item whose block is still to come).
YMap@indent:U32 -> @members:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV> -> @pend:Maybe<&2, String> -> YFrame
YSeq@indent:U32 -> @items:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @pend:Maybe<&2, String> -> YFrame
YRoot@value:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> YFrame
type Flow source · line 32 · raw
Data
mode: 0 between tokens, 1 in "..", 2 in '..', 3 in a plain scalar; buf: the plain scalar so far (reversed); out: JSON text (reversed).
Flow@mode:U32 -> @buf:String -> @out:String -> @esc:Bool -> Flow
type Blk source · line 39 · raw
Data
A block scalar being read: its key line's indent and text before the indicator, literal (|) or folded (>), chomping (0 clip, 1 strip -, 2 keep +), the content's indent (0 until its first line), and its lines so far (reversed, the content indent removed).
Blk@ki:U32 -> @prefix:String -> @folded:Bool -> @chomp:U32 -> @bi:U32 -> @acc:List<&2, String> -> Blk
type BH source · line 42 · raw
Data
BH@prefix:String -> @folded:Bool -> @chomp:U32 -> BH
type LS source · line 46 · raw
Data
The line fold: lines out (reversed), and the block scalar, if inside one.
LS@out:List<&2, Line> -> @blk:Maybe<&2, Blk> -> LS
type AV source · line 50 · raw
Data
A value with its anchor (&name) split off.
AV@anchor:String -> @rest:String -> AV
type YR source · line 53 · raw
Data
YR@json:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @anchors:Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> YR
type KR source · line 327 · raw
Data
"key: rest" or "key:": the key (unquoted) and the rest, if this is a mapping entry.
KR@key:String -> @rest:String -> KR
Definitions
def Yaml.indent source · line 59 · raw
@s:String -> @+n:U32 -> U32
def Yaml.quote.go source · line 66 · raw
@+q:U32 -> @+k:U32 -> @none:Bool -> @same:Bool -> U32
def Yaml.quote source · line 76 · raw
@+q:U32 -> @+k:U32 -> U32
Entering or leaving a quote of kind k (1 single, 2 double).
def Yaml.nq source · line 80 · raw
@+c:Char -> @+q:U32 -> U32
The quote state after char c.
def Yaml.cut_at source · line 91 · raw
@s:String -> @+q:U32 -> @prev:Bool -> Bool
Whether a comment starts at the head of s: a '#' after a space, outside quotes.
def Yaml.uncomment source · line 99 · raw
@s:String -> @+q:U32 -> @cut:Bool -> String
Drops a comment, to the end of the line.
def Yaml.keep source · line 108 · raw
@+t:String -> Bool
def Yaml.lines.put.go source · line 111 · raw
@+i:U32 -> @text:String -> @rest:List<&2, Line> -> @keep:Bool -> List<&2, Line>
def Yaml.lines.put source · line 118 · raw
@+i:U32 -> @+text:String -> @rest:List<&2, Line> -> List<&2, Line>
def Yaml.head.go source · line 123 · raw
@r:String -> Maybe<&2, BH>
A block scalar's header ("key: |", "- >-", ...): the text before the indicator, its style and chomping.
def Yaml.head source · line 140 · raw
@t:String -> Maybe<&2, BH>
def Yaml.clean source · line 143 · raw
@+l:String -> String
def Yaml.blanks source · line 147 · raw
@xs:List<&2, String> -> @+n:U32 -> U32
Trailing blank lines (of a reversed list): how many, and the rest.
def Yaml.unblank source · line 154 · raw
@xs:List<&2, String> -> List<&2, String>
def Yaml.fold.sep source · line 161 · raw
@prev:Bool -> String
def Yaml.fold source · line 170 · raw
@xs:List<&2, String> -> @prev:Bool -> String
Folded lines: a line break between two text lines becomes a space; blank lines stay line breaks.
def Yaml.block.body source · line 179 · raw
@lines:List<&2, String> -> @folded:Bool -> String
def Yaml.block.tail.go source · line 186 · raw
@+chomp:U32 -> @+n:U32 -> @strip:Bool -> @keep:Bool -> String
def Yaml.block.tail source · line 195 · raw
@+chomp:U32 -> @+n:U32 -> @empty:Bool -> String
def Yaml.block.line source · line 203 · raw
@b:Blk -> Line
A finished block scalar, as the one line "prefix <JSON string>".
def Yaml.normal.go source · line 210 · raw
@out:List<&2, Line> -> @+i:U32 -> @+t:String -> @h:Maybe<&2, BH> -> LS
def Yaml.normal source · line 218 · raw
@out:List<&2, Line> -> @+raw:String -> LS
An ordinary line: kept if meaningful, or the start of a block scalar.
def Yaml.in_block.go source · line 221 · raw
@out:List<&2, Line> -> @b:Blk -> @+raw:String -> @blank:Bool -> @deeper:Bool -> @first:Bool -> LS
def Yaml.in_block source · line 235 · raw
@out:List<&2, Line> -> @b:Blk -> @+raw:String -> LS
A raw line inside a block scalar: content while deeper than the key (or blank), else the block ends and the line is read as ordinary.
def Yaml.step_line source · line 241 · raw
@st:LS -> @+raw:String -> LS
def Yaml.lines.fold source · line 248 · raw
@ls:List<&2, String> -> @st:LS -> LS
def Yaml.lines.fin source · line 255 · raw
@st:LS -> List<&2, Line>
def Yaml.lines source · line 264 · raw
@s:String -> List<&2, Line>
The meaningful lines: indentation and text, comments and blanks gone, block scalars (| and >) folded into one line each.
def Yaml.unsingle source · line 270 · raw
@s:String -> String
def Yaml.strip_ends source · line 279 · raw
@+s:String -> String
def Yaml.json_or source · line 282 · raw
@r:Result<&2, &2, String, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @s:String -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.digits source · line 289 · raw
@s:String -> Bool
def Yaml.plain.num source · line 297 · raw
@x:String -> @int:Bool -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
Plain integers are numbers, as YAML 1.2's core schema reads them.
def Yaml.plain source · line 305 · raw
@s:String -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
A plain scalar: null, ~, true, false, or a string.
def Flow.peek source · line 318 · raw
@s:String -> Char
def Flow.punct source · line 330 · raw
@+c:Char -> Bool
def Flow.out0.go source · line 347 · raw
@+c:Char -> @out:String -> @punct:Bool -> @space:Bool -> Flow
def Flow.out0 source · line 356 · raw
@+c:Char -> @out:String -> Flow
def Flow.dq source · line 365 · raw
@esc:Bool -> @+c:Char -> @out:String -> Flow
def Flow.sq.quote source · line 376 · raw
@out:String -> @doubled:Bool -> Flow
def Flow.sq source · line 383 · raw
@esc:Bool -> @+c:Char -> @+nxt:Char -> @out:String -> Flow
def Flow.closer source · line 396 · raw
@+c:Char -> Bool
def Flow.ends source · line 408 · raw
@+c:Char -> @+nxt:Char -> Bool
A plain scalar ends at a closer, or at ':' before a space or a closer.
def Flow.emit source · line 411 · raw
@buf:String -> @out:String -> String
def Flow.plain.go source · line 414 · raw
@+c:Char -> @buf:String -> @out:String -> @ends:Bool -> Flow
def Flow.plain source · line 421 · raw
@+c:Char -> @+nxt:Char -> @buf:String -> @out:String -> Flow
def Flow.step.go source · line 424 · raw
@+m:U32 -> @b:String -> @o:String -> @e:Bool -> @+c:Char -> @+nxt:Char -> @m0:Bool -> @m1:Bool -> @m2:Bool -> Flow
def Flow.step source · line 436 · raw
@st:Flow -> @+c:Char -> @+nxt:Char -> Flow
def Flow.go source · line 441 · raw
@s:String -> @st:Flow -> Flow
def Flow.fin.go source · line 448 · raw
@b:String -> @o:String -> @plain:Bool -> String
def Flow.fin source · line 455 · raw
@st:Flow -> String
def Yaml.flow source · line 461 · raw
@s:String -> String
A flow value's JSON text.
def Yaml.split_word.go source · line 474 · raw
@s:String -> @acc:String -> AV
def Yaml.split_word source · line 484 · raw
@s:String -> AV
The first word and the rest.
def Yaml.scalar.untagged source · line 487 · raw
@+s:String -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.tagged source · line 497 · raw
@av:AV -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
A tagged scalar: !!str keeps the text a string; other tags are dropped.
def Yaml.scalar source · line 505 · raw
@+s:String -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
A scalar or flow value; an alias (*name) or a tag (!!str x) first.
def Yaml.key.go source · line 522 · raw
@s:String -> @acc:String -> Maybe<&2, KR>
def Yaml.unquote_key source · line 533 · raw
@+k:String -> String
def Yaml.key.fin source · line 542 · raw
@m:Maybe<&2, KR> -> Maybe<&2, KR>
def Yaml.key source · line 549 · raw
@+s:String -> Maybe<&2, KR>
def Yaml.rev_kv source · line 563 · raw
@xs:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV> -> @acc:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.rev_items source · line 570 · raw
@xs:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @acc:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.pend_null source · line 577 · raw
@p:Maybe<&2, String> -> @ms:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV> -> List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV>
def Yaml.wrap.go source · line 584 · raw
@a:String -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @none:Bool -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.wrap source · line 591 · raw
@+a:String -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.value source · line 595 · raw
@f:YFrame -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
A finished container's value.
def Yaml.ctl source · line 607 · raw
@s:String -> @+n:U32 -> Bool
Whether s starts with the control char of code n.
def Yaml.member.split source · line 614 · raw
@parts:List<&2, String> -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV
def Yaml.member.go source · line 621 · raw
@k:String -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @marked:Bool -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV
def Yaml.member source · line 629 · raw
@+k:String -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.KV
A pending key's member, its anchor (if marked) wrapped around v.
def Yaml.give source · line 634 · raw
@v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @st:List<&2, YFrame> -> List<&2, YFrame>
Hands v to the container on top: a mapping's pending key, a sequence's next item, or the document itself.
def Yaml.top_indent source · line 649 · raw
@st:List<&2, YFrame> -> U32
def Yaml.ends source · line 660 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> @dash:Bool -> Bool
Whether the top container ends before a line at indent i: it is deeper, or it is a sequence at i and the line is no item of it.
def Yaml.pop source · line 669 · raw
@st:List<&2, YFrame> -> List<&2, YFrame>
def Yaml.close source · line 676 · raw
@fuel:Nat -> @+st:List<&2, YFrame> -> @+i:U32 -> @+dash:Bool -> @ends:Bool -> List<&2, YFrame>
def Yaml.map_at source · line 683 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> Bool
def Yaml.mark.go source · line 690 · raw
@a:String -> @k:String -> @none:Bool -> String
def Yaml.mark source · line 697 · raw
@+a:String -> @k:String -> String
def Yaml.entry.put.go source · line 700 · raw
@st:List<&2, YFrame> -> @k:String -> @+a:String -> @+r:String -> @empty:Bool -> List<&2, YFrame>
def Yaml.entry.put.av source · line 710 · raw
@st:List<&2, YFrame> -> @k:String -> @av:AV -> List<&2, YFrame>
def Yaml.split_anchor source · line 715 · raw
@+s:String -> AV
def Yaml.entry.put source · line 722 · raw
@st:List<&2, YFrame> -> @k:String -> @+r:String -> @empty:Bool -> List<&2, YFrame>
def Yaml.entry.go source · line 731 · raw
@st:List<&2, YFrame> -> @+i:U32 -> @kr:KR -> @here:Bool -> List<&2, YFrame>
def Yaml.entry source · line 739 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> @kr:KR -> List<&2, YFrame>
A mapping entry at indent i: into the open mapping at i, or a new one.
def Yaml.seq_at source · line 742 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> Bool
def Yaml.item.seq.go source · line 750 · raw
@st:List<&2, YFrame> -> @+i:U32 -> @here:Bool -> List<&2, YFrame>
A new item: an item still waiting for its block got none, so it is null.
def Yaml.item.seq source · line 759 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> List<&2, YFrame>
def Yaml.item.value.go source · line 762 · raw
@st:List<&2, YFrame> -> @+a:String -> @+r:String -> @empty:Bool -> List<&2, YFrame>
def Yaml.item.value source · line 771 · raw
@st:List<&2, YFrame> -> @av:AV -> List<&2, YFrame>
"- &a value", "- *a", "- " (a block follows), or "- &a" (an anchored block follows).
def Yaml.item.go source · line 778 · raw
@st:List<&2, YFrame> -> @+i:U32 -> @rest:String -> @kr:Maybe<&2, KR> -> List<&2, YFrame>
The item is a mapping when it reads "key: ..." (its keys then sit at i + 2), else a scalar.
def Yaml.item source · line 786 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> @+rest:String -> List<&2, YFrame>
A "- item" line at indent i: into the open sequence at i, or a new one.
def Yaml.is_dash source · line 789 · raw
@t:String -> Bool
def Yaml.after_dash source · line 798 · raw
@t:String -> String
def Yaml.step.entry source · line 801 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> @+t:String -> @kr:Maybe<&2, KR> -> List<&2, YFrame>
def Yaml.step.go source · line 808 · raw
@+st:List<&2, YFrame> -> @+i:U32 -> @+t:String -> @dash:Bool -> List<&2, YFrame>
def Yaml.step source · line 816 · raw
@+st:List<&2, YFrame> -> @l:Line -> List<&2, YFrame>
One line.
def Yaml.feed source · line 822 · raw
@ls:List<&2, Line> -> @+st:List<&2, YFrame> -> List<&2, YFrame>
def Yaml.result source · line 829 · raw
@st:List<&2, YFrame> -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.is_open source · line 838 · raw
@st:List<&2, YFrame> -> Bool
def Yaml.close_all.go source · line 847 · raw
@fuel:Nat -> @+st:List<&2, YFrame> -> @open:Bool -> List<&2, YFrame>
def Yaml.close_all source · line 855 · raw
@fuel:Nat -> @+st:List<&2, YFrame> -> List<&2, YFrame>
Closes every open container, into the document.
def YR.json source · line 858 · raw
@r:YR -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def YR.anchors source · line 867 · raw
@r:YR -> Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json>
def Yaml.marker.go source · line 872 · raw
@n:String -> @hit:Bool -> Maybe<&2, String>
def Yaml.marker source · line 879 · raw
@s:String -> @+kind:Char -> Maybe<&2, String>
def Yaml.anchor_name source · line 886 · raw
@k:String -> Maybe<&2, String>
def Yaml.res.mem source · line 889 · raw
@k:String -> @h:YR -> @t:YR -> YR
def Yaml.res.cons source · line 894 · raw
@h:YR -> @t:YR -> YR
def Yaml.merge.take source · line 899 · raw
@+ms:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.merge.missing.put source · line 902 · raw
@k:String -> @v:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @rest:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @h:Bool -> @has:Bool -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.has source · line 909 · raw
@ms:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @+k:String -> Bool
def Yaml.merge.missing source · line 913 · raw
@src:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @+ms:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
Members whose keys the chain ms lacks, from the merged object's chain.
def Yaml.append_mem source · line 920 · raw
@ms:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @extra:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.merge.go source · line 927 · raw
@src:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @+rest:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.merge source · line 935 · raw
@+ms:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
Applies a "<<" member: its object's members join where keys are absent.
def Yaml.res.obj source · line 938 · raw
@r:YR -> YR
def Yaml.res.arr source · line 943 · raw
@r:YR -> YR
def Yaml.is_alias source · line 948 · raw
@s:String -> Maybe<&2, String>
def Yaml.lookup.fin source · line 951 · raw
@r:Pair(Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json>, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json) -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.alias source · line 956 · raw
@+name:String -> @+anchors:Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.res.str source · line 959 · raw
@s:String -> @+a:Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @alias:Maybe<&2, String> -> YR
def Yaml.res.anchor source · line 966 · raw
@+n:String -> @r:YR -> YR
def Yaml.res.single source · line 972 · raw
@+k:String -> @n:Maybe<&2, String> -> @+rv:YR -> @tail:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @a:Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> YR
A one-member object: an anchor marker, or a plain object.
def Yaml.res source · line 980 · raw
@j:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> @+a:Map<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> YR
The document with anchors recorded, aliases replaced and merges applied.
def Yaml.resolve source · line 999 · raw
@j:0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
def Yaml.parse source · line 1003 · raw
@s:String -> 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json
The (first) document as JSON, anchors and aliases resolved.
def Yaml.is_sep source · line 1009 · raw
@+l:String -> Bool
def Yaml.docs.cur source · line 1012 · raw
@+l:String -> @cur:List<&2, String> -> @sep:Bool -> List<&2, String>
def Yaml.docs.done source · line 1019 · raw
@+cur:List<&2, String> -> @done:List<&2, String> -> @sep:Bool -> List<&2, String>
def Yaml.docs.go source · line 1027 · raw
@ls:List<&2, String> -> @+cur:List<&2, String> -> @done:List<&2, String> -> List<&2, String>
Splits a stream at "---" and "..." lines; documents come reversed.
def Yaml.docs.keep source · line 1034 · raw
@d:String -> @acc:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @empty:Bool -> List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json>
def Yaml.docs.parse source · line 1041 · raw
@ds:List<&2, String> -> @acc:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json>
def Yaml.parse_all source · line 1050 · raw
@s:String -> List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json>
Every document of a stream (kubectl's multi-document files), in order; empty documents are skipped.