Scan.skip.go: def of yaml-for-bend@0.1.1.0 Import: import yaml-for-bend@0.1.1.0/scan.bend as Scan Lines 641-663 of yaml-for-bend@0.1.1.0/scan.bend: https://jend.leeeet.dev/read.txt?path=yaml-for-bend@0.1.1.0/scan.bend&start_line=641&end_line=663 import Base import yaml-for-bend@0.1.1.0/token.bend as T # 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 skip.go(s: String, +at: T.Mark, +left: Nat, +flow: Bool, +ind: Nat, +allowed: Bool, +comment: Bool, +gap: Bool, +tab: Bool, +nl: Bool, +lead: Bool, +sp: Nat, +bad: Bool) -> Skipped: match s: case SNil{}: Skipped{Cur{SNil{}, at, left}, allowed, tab, nl, sp, False{}} case SCon{+c, +t}: +brk = is_break(c) +space = Char.is_eq(c, ' ') +htab = Char.is_eq(c, '\t') +eat = Bool.or(Bool.or(brk, comment), Bool.or(Bool.or(space, htab), Bool.and(Char.is_eq(c, '#'), gap))) skip.or(eat, u => skip.go(t, past(at, c), Nat.sub(left, 1n), flow, ind, Bool.or(allowed, Bool.and(brk, Bool.not(flow))), Bool.and(Bool.not(brk), Bool.or(comment, Char.is_eq(c, '#'))), True{}, Bool.and(Bool.not(brk), Bool.or(tab, htab)), Bool.or(nl, brk), Bool.or(brk, Bool.and(lead, Bool.or(space, htab))), Bool.pick(Nat, brk, 0n, Bool.pick(Nat, Bool.and(Bool.and(lead, space), Bool.not(tab)), 1n+sp, sp)), Bool.and(Bool.not(brk), Bool.or(bad, Bool.and(Bool.and(htab, lead), Bool.and(Bool.not(flow), Nat.is_lt(1n+sp, ind)))))), Skipped{Cur{SCon{c, t}, at, left}, allowed, tab, nl, sp, bad}) Uses (17): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/scan.bend&name=Cur https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/scan.bend&name=Skipped https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/scan.bend&name=is_break https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/scan.bend&name=past https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/scan.bend&name=skip.or https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/token.bend&name=Mark