def head.tail

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

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

987# Past blanks and a comment (after a blank), to a line break or the end.
988def head.tail(s: String, +at: T.Mark, +left: Nat, +comment: Bool, +gap: Bool) -> Cur:
989  match s:
990    case SNil{}:
991      Cur{SNil{}, at, left}
992    case SCon{+c, +t}:
993      +hash = Bool.and(Char.is_eq(c, '#'), gap)
994      when(Cur, Bool.or(is_break(c), Bool.not(Bool.or(comment, Bool.or(is_blank(c), hash)))), u => Cur{SCon{c, t}, at, left},
995        u => head.tail(t, past(at, c), Nat.sub(left, 1n), Bool.or(comment, hash), is_blank(c)))

Uses (15)

Used by (3)