def Parse.expect_literal.go
bend-scanner@0.1.0.0 · parse.bend:60
import bend-scanner@0.1.0.0/parse.bend as Parse
import Base
60def Parse.expect_literal.go(
61 s: String, p: String, eq: Bool, h: Char, off: Nat
62) -> Result<&2, &2, Parse.Error, Parse.Cur>:
63 match s p eq:
64 case _ _ False{}:
65 Fail{Unexpected{off, h}}
66 case _ SNil{} True{}:
67 Done{Cur{s, 1n+off}}
68 case SNil{} SCon{_, _} True{}:
69 Fail{Eof{1n+off}}
70 case SCon{+h2, t} SCon{ph, pt} True{}:
71 Parse.expect_literal.go(t, pt, Char.is_eq(h2, ph), h2, 1n+off)