def Walk.go

bend-lint-rules@0.2.0.0 · lib/text/main.bend:289

import bend-lint-rules@0.2.0.0/lib/text/main.bend as BendLintRules
import Base

289# The offsets placed, one character of `text` at a time; offsets past its end are placed at its end.
290def Walk.go(text: String, +at: U32, +line: U32, column: U32, w: Walk) -> List<&2, Located>:
291  match text w:
292    case _ Walk{Nil{}, out}:
293      out
294    case SNil{} Walk{pending, out}:
295      Walk.done(Walk.emit(pending, True{}, 4294967295, line, column, out))
296    case SCon{+c, t} Walk{+pending, out}:
297      +ends = Char.is_eq(c, '\n')
298      +l = Bool.pick(U32, ends, (line + 1: U32), line)
299      +col = Bool.pick(
300        U32,
301        ends,
302        1,
303        (column + Bool.pick(U32, U32.is_ge(Char.to_u32(c), 65536), 2, 1): U32)
304      )
305      Walk.go(
306        t,
307        (at + 1: U32),
308        l,
309        col,
310        Walk.emit(pending, Walk.is_due(pending, (at + 1: U32)), (at + 1: U32), l, col, out)
311      )

Uses (15)

Used by (1)