def comment.find

cswap-bend-cli@0.1.0.0 · fmt/yscal.bend:17

import cswap-bend-cli@0.1.0.0/fmt/yscal.bend as Yscal
import Base
import cswap-bend-cli@0.1.0.0/fmt/ylex.bend as L

17# Where a comment starts: a `#` at the start or after a space.
18def comment.find(s: String, +n: Nat, +prev: Bool) -> Maybe<&2, Nat>:
19  match s:
20    case SNil{}:
21      None{}
22    case SCon{Chr{+c}, t}:
23      comment.pick(prev && U32.is_eq(c, 35), n, comment.find(t, Nat.add(n, 1n), L.is_space(c)))

Uses (10)

Used by (1)