def bs.line

yaml-for-bend@0.1.1.0 · scan.bend:1040

import yaml-for-bend@0.1.1.0/scan.bend as Scan
import Base

1040# A content line starts at the indentation: what waits joins the text.
1041def bs.line(+cur: Cur, +acc: String, +ind: Nat, +max: Nat, +lead: Bool, +lblank: Bool, +brks: Nat, +folded: Bool) -> Bs:
1042  +s = cur.s(cur)
1043  +c = peek(s, 0n)
1044  +fold = Bool.and(Bool.and(folded, lead), Bool.and(Bool.not(lblank), Bool.not(is_blank(c))))
1045  +joined = String.repeat("\n", brks) ++ Bool.pick(String, fold, Bool.pick(String, Nat.is_eq(brks, 0n), " ", ""), Bool.pick(String, lead, "\n", "")) ++ acc
1046  Bool.pick(Bs, Bool.or(Bool.not(Nat.is_eq(1n+cur.col(cur), ind)), Bool.or(is_end(c), Bool.and(Nat.is_eq(cur.col(cur), 0n), is_marker(s)))),
1047    BsDone{acc, lead, brks, cur},
1048    Bs{cur, joined, ind, max, False{}, is_blank(c), 0n, Content{}})

Uses (19)

Used by (1)