def marker.go

bolt@1.27.0.0 · src/lsp/report.bend:43

import bolt@1.27.0.0/src/lsp/report.bend as Report
import Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy

43# reading a marker past its padding: `count` digits of `whole` so far, and at
44# the first other character, the number they make when `>|` follows them
45def marker.go(ss: String, +whole: String, +count: Nat) -> Maybe<&2, U32>:
46  match ss:
47    case SNil{}:
48      None{}
49    case SCon{+hh, +tt}:
50      Lazy.stop(Maybe<&2, U32>, Bool.not(Char.is_digit(hh)),
51        Bool.pick(Maybe<&2, U32>, String.starts_with(SCon{hh, tt}, ">|"), U32.read(String.take(whole, count)), None{}),
52        _u => marker.go(tt, whole, 1n+count))

Uses (11)

Used by (1)