def media.charset.quoted

bend-kit-camber@0.15.0.1 · input.bend:141

import bend-kit-camber@0.15.0.1/input.bend as Input
import Base

141# Compare the decoded quoted-string charset without allocating a second value.
142def media.charset.quoted(text: String, expected: String, escaped: Bool) -> Bool:
143  match text:
144    case SNil{}: False{}
145    case SCon{Chr{+c}, rest}:
146      match c:
147        case 92:
148          match expected:
149            case SNil{}: False{}
150            case SCon{Chr{want}, next}:
151              match escaped:
152                case True{}: False{}
153                case False{}: media.charset.quoted(rest, SCon{Chr{want}, next}, True{})
154        case _:
155          match expected:
156            case SNil{}: U32.is_eq(c, 34) && Bool.not(escaped) && String.eq(rest, "")
157            case SCon{Chr{want}, next}: U32.is_eq(c, want) && media.charset.quoted(rest, next, False{})

Uses (10)

Used by (1)