def colon

bend-kit-llm@0.13.0.1 · sse.bend:60

import bend-kit-llm@0.13.0.1/sse.bend as Sse
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

60# The first colon at or after i, or the line's end. f counts the bytes from i to the line's end; r holds byte i.
61def colon(f: Nat, r: Array<U32> & U32, +i: U32) -> Array<U32> & U32:
62  match f:
63    case 0n:
64      (a, c) = r
65      (a, i)
66    case 1n+p:
67      (a, +c) = r
68      match c:
69        case 58:
70          (a, i)
71        case _:
72          colon(p, Bytes.peek(a, (i + 1 : U32)), (i + 1 : U32))

Uses (10)

Used by (1)