def cookie.cut.go

bend-kit-http@0.38.2.0 · http.bend:1858

import bend-kit-http@0.38.2.0/http.bend as Http
import Base

1858# hit: the last char pushed onto acc was c.
1859def cookie.cut.go(s: String, +c: U32, acc: String, hit: Bool) -> String & String & Bool:
1860  match s:
1861    case SNil{}:
1862      match hit:
1863        case True{}:
1864          cookie.cut.found(take.cut(acc, SNil{}))
1865        case False{}:
1866          (String.reverse(acc), SNil{}, False{})
1867    case SCon{Chr{+x}, t}:
1868      match hit:
1869        case True{}:
1870          cookie.cut.found(take.cut(acc, SCon{Chr{x}, t}))
1871        case False{}:
1872          cookie.cut.go(t, c, SCon{Chr{x}, acc}, U32.is_eq(x, c))

Uses (10)

Used by (1)