scan.bend checks
raw source on the hub · import yaml-for-bend@0.1.1.0/scan.bend as Scan
The scanner: YAML text to tokens.
It follows the design of libyaml's scanner. One step fetches the next token. Block collections open and close by indentation, so the scanner keeps a stack of indentations and adds BSeqStart, BMapStart and BEnd tokens as they change. A "simple key" (a key without "?") is only known to be a key when its ":" arrives, so the scanner remembers where each possible key started and, at the ":", inserts a KeyTok (and BMapStart) before the key's first token.
It reads YAML 1.2 as the YAML test suite has it: tabs separate tokens but never indent, a flow collection's lines and a quoted scalar's indent past the block around them, a comment follows a blank, anchors take any character but blanks and flow indicators, ":" is a value indicator right after a JSON-like node in flow, and reserved directives are skipped.
An error ends the tokens with a Broken token, so the parser still sees the tokens before it.
2 imports
import Base import ./token.bend as T
Types
type Cur source · line 25 · raw
Data
The text left to read, where it starts, and how many characters are left.
Cur@s:String -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @left:Nat -> Cur
type SKey source · line 32 · raw
Data
A place a simple key may start: whether one still may, whether it must (a block key at the indentation), the number its first token has, and where. Each level also keeps where the oldest key still possible at or below it started (+low+), so finding stale keys needn't look at every level.
SKey@possible:Bool -> @required:Bool -> @number:Nat -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @tab:Bool -> @low:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark> -> SKey
type Sc source · line 40 · raw
Data
The scanner: the cursor, the block indentation plus one (0 outside any block collection) and the ones it returns to, how deep in flow collections it is, whether a simple key may start here, one possible key per flow level (the block level last), the tokens so far (newest first) and their count, and how deep flow collections may nest.
Sc@cur:Cur -> @ind:Nat -> @inds:List<&2, Nat> -> @flow:Nat -> @allowed:Bool -> @tab:Bool -> @keys:List<&2, SKey> -> @out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> @n:Nat -> @max:Nat -> Sc
type Step source · line 45 · raw
Data
A step goes on, or stops: at the stream's end or at an error, as the last token says.
Go@st:Sc -> Step
Stop@st:Sc -> Step
type Lay source · line 49 · raw
Data
Lay@ind:Nat -> @inds:List<&2, Nat> -> @out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> @n:Nat -> Lay
type Skipped source · line 55 · raw
Data
Skipped@cur:Cur -> @allowed:Bool -> @tab:Bool -> @nl:Bool -> @sp:Nat -> @bad:Bool -> Skipped
type Pl source · line 64 · raw
Data
Reading a plain scalar: the cursor, the text so far (reversed), where the last word ended, the blanks after it (reversed), whether a line break came since, how many more breaks did, and whether a word is being read.
Pl@cur:Cur -> @acc:String -> @end:0x856d414a32087762da315b6efc605eaa/token.Mark -> @ws:String -> @lead:Bool -> @brks:Nat -> @word:Bool -> @bad:Bool -> Pl
PlDone@cur:Cur -> @acc:String -> @end:0x856d414a32087762da315b6efc605eaa/token.Mark -> @lead:Bool -> Pl
PlBad@error:0x856d414a32087762da315b6efc605eaa/token.Error -> Pl
type Qs source · line 76 · raw
Data
Reading a quoted scalar: the cursor, the text so far (reversed), the blanks waiting (reversed), whether a line break came since the last text and how many more did, whether that break was escaped, and whether text (not blanks) is being read.
Qs@cur:Cur -> @acc:String -> @ws:String -> @lead:Bool -> @brks:Nat -> @esc:Bool -> @text:Bool -> @bad:Bool -> Qs
QsDone@cur:Cur -> @acc:String -> Qs
QsBad@error:0x856d414a32087762da315b6efc605eaa/token.Error -> Qs
type Chomp source · line 84 · raw
Data
ClipChomp
StripChomp
KeepChomp
type Head source · line 91 · raw
Data
A block scalar's header: how to chomp, the indentation indicator (0 when there's none), and the cursor after it; or an error.
Head@chomp:Chomp -> @inc:Nat -> @cur:Cur -> Head
HeadBad@why:String -> Head
type BPhase source · line 95 · raw
Data
BreaksBPhase
LineStartBPhase
ContentBPhase
type Bs source · line 104 · raw
Data
Reading a block scalar: the cursor, the text so far (reversed), the content's indentation plus one (0 until known), the deepest blank line, whether a line break waits, whether the last line started with a blank, how many more breaks wait, and the phase: blank lines, a line's start, or content.
Bs@cur:Cur -> @acc:String -> @ind:Nat -> @max:Nat -> @lead:Bool -> @lblank:Bool -> @brks:Nat -> @phase:BPhase -> Bs
BsDone@acc:String -> @lead:Bool -> @brks:Nat -> @cur:Cur -> Bs
BsBad@error:0x856d414a32087762da315b6efc605eaa/token.Error -> Bs
type Taken source · line 113 · raw
Data
What a scan took: the text it read and how many characters that was.
Taken@text:String -> @n:Nat -> Taken
Definitions
def then source · line 117 · raw
@v:Step -> @f:(@_:Sc -> Step) -> Step
The step after +v+, when it goes on.
def when source · line 125 · raw
@-A:Type -> @hit:Bool -> @yes:(@_:Unit -> A) -> @no:(@_:Unit -> A) -> A
+yes+ when +hit+, else +no+; only the one chosen runs.
def code source · line 135 · raw
@c:Char -> U32
def peek source · line 141 · raw
@s:String -> @n:Nat -> Char
The character +n+ places on, or NUL past the end.
def is_blank source · line 152 · raw
@c:Char -> Bool
def is_break source · line 161 · raw
@c:Char -> Bool
def is_end source · line 164 · raw
@c:Char -> Bool
def is_blankz source · line 167 · raw
@+c:Char -> Bool
def is_breakz source · line 170 · raw
@+c:Char -> Bool
def is_flow.ind source · line 173 · raw
@c:Char -> Bool
def between source · line 188 · raw
@+x:U32 -> @lo:U32 -> @hi:U32 -> Bool
def is_digit source · line 191 · raw
@c:Char -> Bool
def is_hex source · line 194 · raw
@+c:Char -> Bool
def is_word source · line 198 · raw
@+c:Char -> Bool
A letter, digit or "-": what a tag handle's name is made of.
def is_in source · line 201 · raw
@c:Char -> @s:String -> Bool
def is_uri source · line 205 · raw
@+c:Char -> Bool
A URI character other than "%" (which starts an escape).
def is_tag source · line 209 · raw
@+c:Char -> Bool
A tag character: a URI character but "!" and the flow indicators.
def is_printable source · line 213 · raw
@c:Char -> Bool
What YAML allows in a document: tab, line feed, and printable characters.
def hex.digit source · line 220 · raw
@c:Char -> U32
def hex.value source · line 224 · raw
@s:String -> @acc:U32 -> U32
def all.hex source · line 231 · raw
@s:String -> Bool
def marker source · line 239 · raw
@+s:String -> @+c:Char -> Bool
"---" or "..." (+c+ thrice) and then a blank, a break or the end.
def is_marker source · line 242 · raw
@+s:String -> Bool
def lf source · line 247 · raw
@s:String -> String
Line breaks as "\n": "\r\n" and a lone "\r" both become one, as YAML reads them.
def strip.bom source · line 262 · raw
@s:String -> String
def past source · line 274 · raw
@at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @c:Char -> 0x856d414a32087762da315b6efc605eaa/token.Mark
def adv source · line 283 · raw
@c:Cur -> Cur
def adv.n source · line 292 · raw
@n:Nat -> @c:Cur -> Cur
def cur.s source · line 299 · raw
@c:Cur -> String
def cur.at source · line 304 · raw
@c:Cur -> 0x856d414a32087762da315b6efc605eaa/token.Mark
def cur.left source · line 309 · raw
@c:Cur -> Nat
def cur.col source · line 314 · raw
@c:Cur -> Nat
def sc.cur source · line 320 · raw
@st:Sc -> Cur
def sc.s source · line 325 · raw
@st:Sc -> String
def sc.at source · line 328 · raw
@st:Sc -> 0x856d414a32087762da315b6efc605eaa/token.Mark
def sc.col source · line 331 · raw
@st:Sc -> Nat
def sc.ind source · line 334 · raw
@st:Sc -> Nat
def sc.flow source · line 339 · raw
@st:Sc -> Nat
def sc.in_flow source · line 344 · raw
@st:Sc -> Bool
def sc.max source · line 347 · raw
@st:Sc -> Nat
def sc.tab source · line 352 · raw
@st:Sc -> Bool
def sc.allowed source · line 357 · raw
@st:Sc -> Bool
def sc.keys source · line 362 · raw
@st:Sc -> List<&2, SKey>
def sc.out source · line 367 · raw
@st:Sc -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
def sc.with.cur source · line 372 · raw
@st:Sc -> @c:Cur -> Sc
def sc.allow source · line 377 · raw
@st:Sc -> @b:Bool -> Sc
def sc.with.keys source · line 382 · raw
@st:Sc -> @ks:List<&2, SKey> -> Sc
def skip source · line 387 · raw
@+st:Sc -> @k:Nat -> Sc
def emit.span source · line 391 · raw
@st:Sc -> @tok:0x856d414a32087762da315b6efc605eaa/token.Tok -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> @end:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
A token from +start+ to +end+.
def emit source · line 397 · raw
@+st:Sc -> @tok:0x856d414a32087762da315b6efc605eaa/token.Tok -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
A token from +start+ to here.
def single source · line 401 · raw
@+st:Sc -> @tok:0x856d414a32087762da315b6efc605eaa/token.Tok -> Sc
A one-character token here.
def fail source · line 404 · raw
@+st:Sc -> @why:String -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def fail.limit source · line 408 · raw
@+st:Sc -> @why:String -> Step
A limit reached: the error names it.
def fail.with source · line 411 · raw
@+st:Sc -> @e:0x856d414a32087762da315b6efc605eaa/token.Error -> Step
def cannot source · line 417 · raw
@+st:Sc -> Step
"found character that cannot start any token"
def json.tok source · line 423 · raw
@t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Bool
The token before this one: whether it was a JSON-like node (a quoted scalar or a flow collection), after which ":" is a value indicator even without a space.
def json.before source · line 440 · raw
@out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> Bool
def key.top source · line 453 · raw
@keys:List<&2, SKey> -> SKey
The possible key on top, which a ":" would make a key.
def key.or source · line 460 · raw
@r:Result<&2, &2, 0x856d414a32087762da315b6efc605eaa/token.Error, List<&2, SKey>> -> @+st:Sc -> Step
def low.of source · line 467 · raw
@keys:List<&2, SKey> -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark>
def key.removed source · line 476 · raw
@keys:List<&2, SKey> -> Result<&2, &2, 0x856d414a32087762da315b6efc605eaa/token.Error, List<&2, SKey>>
def remove.key source · line 488 · raw
@+st:Sc -> Step
The key on top can no longer be; an error if it had to be.
def low.with source · line 492 · raw
@below:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark> -> @possible:Bool -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark>
A level's low: the one below it, or its own key when that is possible.
def key.put source · line 503 · raw
@st:Sc -> @required:Bool -> Sc
def key.saved source · line 509 · raw
@r:Step -> @+required:Bool -> Step
def save.key source · line 518 · raw
@+st:Sc -> Step
A simple key may start here. It must be one (no "?" can come later) when it starts a block line at the indentation.
def is_stale source · line 523 · raw
@+kat:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Bool
A simple key stays on one line and within 1024 characters.
def low.stale source · line 526 · raw
@low:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark> -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Bool
def stale.cons source · line 533 · raw
@+possible:Bool -> @required:Bool -> @number:Nat -> @+kat:0x856d414a32087762da315b6efc605eaa/token.Mark -> @tab:Bool -> @r:Result<&2, &2, 0x856d414a32087762da315b6efc605eaa/token.Error, List<&2, SKey>> -> Result<&2, &2, 0x856d414a32087762da315b6efc605eaa/token.Error, List<&2, SKey>>
def stale.go source · line 543 · raw
@keys:List<&2, SKey> -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Result<&2, &2, 0x856d414a32087762da315b6efc605eaa/token.Error, List<&2, SKey>>
Keys left behind are no longer possible. Keys go stale oldest first, so a level whose oldest possible key is still fresh has nothing stale at or below it, and the search stops there.
def stale source · line 556 · raw
@+st:Sc -> Step
def key.cleared source · line 559 · raw
@keys:List<&2, SKey> -> List<&2, SKey>
def flow.push source · line 568 · raw
@st:Sc -> Sc
def flow.pop source · line 573 · raw
@st:Sc -> Sc
def insert.at source · line 585 · raw
@d:Nat -> @out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> @t:0x856d414a32087762da315b6efc605eaa/token.Token -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
def insert source · line 597 · raw
@out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> @n:Nat -> @number:Maybe<&2, Nat> -> @t:0x856d414a32087762da315b6efc605eaa/token.Token -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
A token at the end, or (+number+) before the token with that number.
def roll.do source · line 604 · raw
@st:Sc -> @col:Nat -> @number:Maybe<&2, Nat> -> @tok:0x856d414a32087762da315b6efc605eaa/token.Tok -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
def roll source · line 610 · raw
@+st:Sc -> @+col:Nat -> @number:Maybe<&2, Nat> -> @tok:0x856d414a32087762da315b6efc605eaa/token.Tok -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
A block collection starts at +col+ when that's deeper than the indentation.
def unroll.go source · line 613 · raw
@inds:List<&2, Nat> -> @+ind:Nat -> @+lim:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> @+n:Nat -> Lay
def unrolled source · line 620 · raw
@l:Lay -> @cur:Cur -> @flow:Nat -> @allowed:Bool -> @tab:Bool -> @keys:List<&2, SKey> -> @max:Nat -> Sc
def unroll.do source · line 625 · raw
@st:Sc -> @+lim:Nat -> Sc
def unroll source · line 631 · raw
@+st:Sc -> @+lim:Nat -> Sc
Block collections deeper than +lim+ (a column plus one) end.
def skip.or source · line 634 · raw
@eat:Bool -> @more:(@_:Unit -> Skipped) -> @stop:Skipped -> Skipped
def skip.go source · line 647 · raw
@s:String -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+left:Nat -> @+flow:Bool -> @+ind:Nat -> @+allowed:Bool -> @+comment:Bool -> @+gap:Bool -> @+tab:Bool -> @+nl:Bool -> @+lead:Bool -> @+sp:Nat -> @+bad:Bool -> Skipped
Blanks, comments and line breaks before a token. A "#" starts a comment after a blank or at a line's start (+gap+). A line break in block context lets a simple key start. Along the way: whether a tab came on the token's line (+tab+), whether a line break came (+nl+), the spaces that start the token's line (+sp+, while +lead+), and whether a tab stood where block indentation belongs (+bad+).
def skipped source · line 665 · raw
@k:Skipped -> @st:Sc -> Sc
def last.plain source · line 674 · raw
@out:List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token> -> Bool
Whether the last token was a plain or block scalar, which end past the blanks after them, so a "#" here follows a blank.
def skip.check source · line 697 · raw
@k:Skipped -> @+st:Sc -> Step
What the skipped whitespace allows: no tab where block indentation belongs, and in flow, lines indented past the block around them.
def skip.ws.at source · line 707 · raw
@c:Cur -> @+st:Sc -> Step
def skip.ws source · line 714 · raw
@+st:Sc -> Step
def folded.breaks source · line 718 · raw
@+brks:Nat -> String
Folded line breaks: one break is a space, more are newlines (less one).
def flush source · line 722 · raw
@acc:String -> @ws:String -> @lead:Bool -> @+brks:Nat -> String
The blanks or breaks before a word join the text.
def pl.word source · line 730 · raw
@cur:Cur -> @+acc:String -> @+end:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+ws:String -> @+lead:Bool -> @+brks:Nat -> @+flow:Bool -> Pl
In a word: a blank ends it; ": " or a flow indicator in flow ends the scalar.
def pl.blank source · line 744 · raw
@cur:Cur -> @+acc:String -> @+end:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+ws:String -> @+lead:Bool -> @+brks:Nat -> @+bad:Bool -> @+ind:Nat -> @+flow:Bool -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Pl
Between words: blanks and breaks wait to join the text; then the next word starts, unless the scalar ended (less indented, a document marker, a comment, or the end). A tab may not stand where indentation belongs on a line that goes on.
def pl.step source · line 760 · raw
@p:Pl -> @+ind:Nat -> @+flow:Bool -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Pl
def pl.run source · line 771 · raw
@fuel:Nat -> @+ind:Nat -> @+flow:Bool -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> @p:Pl -> Pl
def plain.done source · line 782 · raw
@p:Pl -> @+st:Sc -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def plain.scan source · line 791 · raw
@+st:Sc -> Step
def plain source · line 796 · raw
@+st:Sc -> Step
def q.text source · line 799 · raw
@cur:Cur -> @acc:String -> Qs
def simple.escape source · line 802 · raw
@e:Char -> Maybe<&2, Char>
def q.simple source · line 843 · raw
@m:Maybe<&2, Char> -> @cur:Cur -> @acc:String -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
def is_scalar.value source · line 851 · raw
@+x:U32 -> Bool
A code point that is a character: not a surrogate, and at most 10FFFF.
def q.hex source · line 855 · raw
@+n:Nat -> @+cur:Cur -> @acc:String -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
\x, \u or \U and +n+ hex digits.
def q.escape source · line 864 · raw
@e:Char -> @cur:Cur -> @acc:String -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
def q.char source · line 877 · raw
@double:Bool -> @c:Char -> @+c1:Char -> @+cur:Cur -> @+acc:String -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
def q.in.text source · line 894 · raw
@+double:Bool -> @+cur:Cur -> @+acc:String -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
def q.joined source · line 904 · raw
@+acc:String -> @ws:String -> @lead:Bool -> @+brks:Nat -> @esc:Bool -> String
The blanks and breaks between text: kept, or folded, once text resumes.
def q.in.blanks source · line 913 · raw
@+cur:Cur -> @+acc:String -> @+ws:String -> @+lead:Bool -> @+brks:Nat -> @+esc:Bool -> @+bad:Bool -> @+ind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
Between text: blanks and breaks wait to join it. A line after a break must be indented past the block around it (+ind+), with spaces.
def q.step source · line 922 · raw
@q:Qs -> @+double:Bool -> @+ind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Qs
def q.run source · line 933 · raw
@fuel:Nat -> @+double:Bool -> @+ind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> @q:Qs -> Qs
def quoted.done source · line 944 · raw
@q:Qs -> @+st:Sc -> @+double:Bool -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def quoted.scan source · line 953 · raw
@+st:Sc -> @+double:Bool -> Step
def quoted source · line 958 · raw
@+st:Sc -> @+double:Bool -> Step
def digit.value source · line 961 · raw
@c:Char -> Nat
def chomp.of source · line 964 · raw
@c:Char -> Maybe<&2, Chomp>
def chomp.or source · line 973 · raw
@m:Maybe<&2, Chomp> -> @d:Chomp -> Chomp
def is_some.chomp source · line 980 · raw
@m:Maybe<&2, Chomp> -> Bool
def head.tail source · line 988 · raw
@s:String -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> @+left:Nat -> @+comment:Bool -> @+gap:Bool -> Cur
Past blanks and a comment (after a blank), to a line break or the end.
def head.check source · line 997 · raw
@chomp:Chomp -> @+inc:Nat -> @+cur:Cur -> Head
def head.end source · line 1000 · raw
@chomp:Chomp -> @+inc:Nat -> @cur:Cur -> Head
def header source · line 1006 · raw
@+cur:Cur -> Head
The indicators after "|" or ">", in either order.
def bs.breaks source · line 1025 · raw
@+cur:Cur -> @+acc:String -> @+ind:Nat -> @+max:Nat -> @+lead:Bool -> @+lblank:Bool -> @+brks:Nat -> @+pind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Bs
Blank lines and the indentation before content. The first content line sets the indentation when the header didn't; no blank line before it may be deeper. A tab may start content but not indentation. A last line of spaces with no break after it still counts as a line.
def bs.line source · line 1041 · raw
@+cur:Cur -> @+acc:String -> @+ind:Nat -> @+max:Nat -> @+lead:Bool -> @+lblank:Bool -> @+brks:Nat -> @+folded:Bool -> Bs
A content line starts at the indentation: what waits joins the text.
def bs.content source · line 1050 · raw
@+cur:Cur -> @+acc:String -> @+ind:Nat -> @+max:Nat -> @+lblank:Bool -> Bs
def bs.step source · line 1056 · raw
@b:Bs -> @+folded:Bool -> @+pind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Bs
def bs.run source · line 1069 · raw
@fuel:Nat -> @+folded:Bool -> @+pind:Nat -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> @b:Bs -> Bs
def chomped source · line 1081 · raw
@chomp:Chomp -> @+acc:String -> @+lead:Bool -> @+brks:Nat -> String
The final line break and the blank lines after the text.
def block.done source · line 1090 · raw
@b:Bs -> @chomp:Chomp -> @+st:Sc -> @+folded:Bool -> @start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def block.body source · line 1099 · raw
@h:Head -> @+st:Sc -> @+folded:Bool -> @+start:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def block.scan source · line 1109 · raw
@+st:Sc -> @+folded:Bool -> Step
def block.scalar source · line 1113 · raw
@+st:Sc -> @+folded:Bool -> Step
def taken.cons source · line 1116 · raw
@c:Char -> @+k:Nat -> @t:Taken -> Taken
def took.or source · line 1121 · raw
@stop:Bool -> @more:(@_:Unit -> Taken) -> Taken
def anchor.name source · line 1129 · raw
@s:String -> Taken
An anchor's name: anything up to a blank, a break or a flow indicator.
def anchor.took source · line 1136 · raw
@t:Taken -> @+st:Sc -> @+is_anchor:Bool -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def anchor.scan source · line 1144 · raw
@+st:Sc -> @+is_anchor:Bool -> Step
def anchor source · line 1148 · raw
@+st:Sc -> @+is_anchor:Bool -> Step
def taken.skip source · line 1153 · raw
@t:Taken -> Taken
Tag characters, with %XX escapes decoded; +uri+ allows all URI characters (in a verbatim tag or a %TAG prefix).
def tag.chars source · line 1158 · raw
@s:String -> @+uri:Bool -> @+pending:Nat -> Taken
def tag.ends source · line 1175 · raw
@+c:Char -> @+flow:Bool -> Bool
What may follow a tag: a blank, a break, the end, or in flow a flow indicator.
def tag.emit source · line 1178 · raw
@+st:Sc -> @handle:String -> @suffix:String -> @+n:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def tag.verbatim source · line 1187 · raw
@t:Taken -> @+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
"!<uri>".
def tag.suffix source · line 1194 · raw
@t:Taken -> @+named:Bool -> @+word:String -> @+k:Nat -> @+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def tag.short source · line 1204 · raw
@w:Taken -> @+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
"!suffix", "!!suffix", "!name!suffix", or "!" alone.
def word.chars source · line 1211 · raw
@s:String -> Taken
def tag.scan source · line 1218 · raw
@+st:Sc -> Step
def tag source · line 1225 · raw
@+st:Sc -> Step
def count.or source · line 1231 · raw
@go:Bool -> @more:(@_:Unit -> Nat) -> Nat
def blanks source · line 1238 · raw
@s:String -> Nat
def digits source · line 1245 · raw
@s:String -> Taken
def nat.of source · line 1252 · raw
@s:String -> @acc:Nat -> Nat
def directive.put source · line 1259 · raw
@+st:Sc -> @tok:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Tok> -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
def directive.tail source · line 1266 · raw
@+cur:Cur -> @+st:Sc -> @tok:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Tok> -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def directive.end source · line 1272 · raw
@+st:Sc -> @tok:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Tok> -> @at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
After a directive: blanks, a comment, then a line break or the end.
def version.done source · line 1275 · raw
@m:Taken -> @+st:Sc -> @major:String -> @+used:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def version.minor source · line 1281 · raw
@m:Taken -> @+st:Sc -> @+b:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def version.scan source · line 1292 · raw
@+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
"%YAML 1.2".
def tagdir.prefix source · line 1298 · raw
@p:Taken -> @+st:Sc -> @handle:String -> @+used:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def tagdir.handle source · line 1304 · raw
@w:Taken -> @+st:Sc -> @+b:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def tagdir.scan source · line 1318 · raw
@+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
"%TAG !e! prefix".
def line.rest source · line 1325 · raw
@s:String -> Nat
Past the rest of a line.
def directive.named source · line 1333 · raw
@+name:String -> @+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
%YAML, %TAG, or a reserved directive, which is skipped.
def directive.name source · line 1338 · raw
@w:Taken -> @+st:Sc -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Step
def directive.scan source · line 1344 · raw
@+st:Sc -> Step
def directive source · line 1348 · raw
@+st:Sc -> Step
def flow.start source · line 1355 · raw
@+st:Sc -> @t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Step
"[" or "{", unless flow collections already nest as deep as allowed.
def flow.end source · line 1359 · raw
@+st:Sc -> @t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Step
def flow.entry source · line 1362 · raw
@+st:Sc -> Step
def block.entry.rest source · line 1365 · raw
@+st:Sc -> Step
def block.entry source · line 1369 · raw
@+st:Sc -> Step
"- ": a block sequence's entry, which may open the sequence.
def key.tok source · line 1375 · raw
@+st:Sc -> Sc
def key.rest source · line 1378 · raw
@+st:Sc -> Step
def key source · line 1382 · raw
@+st:Sc -> Step
"? ": an explicit key.
def value.rest source · line 1388 · raw
@+st:Sc -> Sc
def value.alone source · line 1391 · raw
@+st:Sc -> Step
def insert.key source · line 1396 · raw
@st:Sc -> @number:Nat -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Sc
def value.with source · line 1403 · raw
@k:SKey -> @+st:Sc -> Step
": ": a value. When a simple key waits, it becomes a key: a KeyTok goes before it, and a block mapping may start at its column.
def value source · line 1412 · raw
@+st:Sc -> Step
def marker.tok source · line 1415 · raw
@+st:Sc -> @t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Sc
def end.mark source · line 1419 · raw
@m:0x856d414a32087762da315b6efc605eaa/token.Mark -> 0x856d414a32087762da315b6efc605eaa/token.Mark
The stream ends on a line of its own.
def end.tok source · line 1424 · raw
@+st:Sc -> Sc
def doc.end.check source · line 1428 · raw
@+st:Sc -> @t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Step
def doc.indicator source · line 1436 · raw
@+st:Sc -> @+t:0x856d414a32087762da315b6efc605eaa/token.Tok -> Step
def stream.end source · line 1439 · raw
@+st:Sc -> Step
def is_plain.start source · line 1442 · raw
@+c:Char -> Bool
def fetch.char source · line 1446 · raw
@c:Char -> @+c1:Char -> @+flow:Bool -> @+st:Sc -> Step
The token a character starts.
def fetch.next source · line 1481 · raw
@+st:Sc -> Step
def fetch.after source · line 1491 · raw
@+st:Sc -> Step
def fetch source · line 1495 · raw
@+st:Sc -> Step
One token (and the block tokens before it).
def scan.run source · line 1498 · raw
@fuel:Nat -> @s:Step -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
def unprintable source · line 1511 · raw
@s:String -> @+at:0x856d414a32087762da315b6efc605eaa/token.Mark -> Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark>
Where the first character YAML doesn't allow is (a control character, a surrogate), if there is one.
def stream.start source · line 1518 · raw
0x856d414a32087762da315b6efc605eaa/token.Token
def scan.start source · line 1521 · raw
@m:Maybe<&2, 0x856d414a32087762da315b6efc605eaa/token.Mark> -> @+s:String -> @max:Nat -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
def scan source · line 1530 · raw
@text:String -> @max:Nat -> List<&2, 0x856d414a32087762da315b6efc605eaa/token.Token>
The tokens of +text+, from StreamStart to StreamEnd, or to a Broken token at the first error. Flow collections may nest +max+ deep.