def closes

bolt@1.27.0.0 · src/rules/perf/strings.bend:23

import bolt@1.27.0.0/src/rules/perf/strings.bend as Strings
import Base

23# does the text end on a closing quote, its escapes read as a backslash and
24# the one char after it? esc: the char before was an unescaped backslash;
25# shut: it was an unescaped quote
26def closes(cs: List<&2, Char>, +esc: Bool, +shut: Bool) -> Bool:
27  match cs:
28    case Nil{}:
29      shut
30    case Con{ch, rest}:
31      +code = Char.to_u32(ch)
32      closes(rest, Bool.and(Bool.not(esc), U32.is_eq(code, 92)), Bool.and(Bool.not(esc), U32.is_eq(code, 34)))

Uses (7)

Used by (1)