def tok.pct1
import emerging-ezhttp@0.21.0.0/src/qs.bend as Qsimport Base
import emerging-ezhttp@0.21.0.0/src/http.bend as Http
72# a character after `%` and a hex digit: a second hex digit makes the byte
73# they name, anything else leaves `%` and the digit as written
74def tok.pct1(plus: Bool, +d: Char, +c: Char, k: Esc -> List<&2, Tok>,
75 hex: Bool) -> List<&2, Tok>:
76 match hex:
77 case True{}:
78 B{U32.add(U32.mul(Http.hex.val(d), 16), Http.hex.val(c))} <> k(Plain{})
79 case False{}:
80 B{37} <> (B{Char.to_u32(d)} <> tok.plain(plus, c, k))