Csv.rec.go: def of bend-kit-csv@0.3.0.0 Import: import bend-kit-csv@0.3.0.0/csv.bend as Csv Lines 61-129 of bend-kit-csv@0.3.0.0/csv.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-csv@0.3.0.0/csv.bend&start_line=61&end_line=129 import Base # r holds byte i. s is where the open field starts. Every step but the last reads one byte. def rec.go(f: Nat, st: St, r: Array & U32, +len: U32, +i: U32, +s: U32, +esc: Bool, +sp: List<&2, Span>) -> Array & Scan: match f: case 0n: (a, c) = r (a, SBad{i}) case 1n+p: match st: case SStart{}: (a, +c) = r match c: case 34: rec.go(p, SQ{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, sp) case 44: rec.go(p, SStart{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, Span{i, i, False{}} <> sp) case 10: (a, SRow{start.sp(sp, i), (i + 1 : U32)}) case 13: rec.go(p, SCR{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, start.sp(sp, i)) case 256: (a, SRow{start.sp(sp, i), i}) case _: rec.go(p, SUnq{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), i, False{}, sp) case SUnq{}: (a, +c) = r match c: case 44: rec.go(p, SStart{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, Span{s, i, False{}} <> sp) case 10: (a, SRow{Span{s, i, False{}} <> sp, (i + 1 : U32)}) case 13: rec.go(p, SCR{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, Span{s, i, False{}} <> sp) case 256: (a, SRow{Span{s, i, False{}} <> sp, i}) case 34: (a, SBad{i}) case _: rec.go(p, SUnq{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), s, False{}, sp) case SQ{}: (a, +c) = r match c: case 34: rec.go(p, SQQ{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), s, esc, sp) case 256: (a, SBad{i}) case _: rec.go(p, SQ{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), s, esc, sp) case SQQ{}: (a, +c) = r match c: case 34: rec.go(p, SQ{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), s, True{}, sp) case 44: rec.go(p, SStart{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, Span{s, (i - 1 : U32), esc} <> sp) case 10: (a, SRow{Span{s, (i - 1 : U32), esc} <> sp, (i + 1 : U32)}) case 13: rec.go(p, SCR{}, pk(a, len, (i + 1 : U32)), len, (i + 1 : U32), (i + 1 : U32), False{}, Span{s, (i - 1 : U32), esc} <> sp) case 256: (a, SRow{Span{s, (i - 1 : U32), esc} <> sp, i}) case _: (a, SBad{i}) case SCR{}: (a, +c) = r match c: case 10: (a, SRow{sp, (i + 1 : U32)}) case _: (a, SRow{sp, i}) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Con https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Nil https://jend.leeeet.dev/definition.txt?path=bend-kit-csv@0.3.0.0/csv.bend&name=Scan https://jend.leeeet.dev/definition.txt?path=bend-kit-csv@0.3.0.0/csv.bend&name=Span https://jend.leeeet.dev/definition.txt?path=bend-kit-csv@0.3.0.0/csv.bend&name=St https://jend.leeeet.dev/definition.txt?path=bend-kit-csv@0.3.0.0/csv.bend&name=pk https://jend.leeeet.dev/definition.txt?path=bend-kit-csv@0.3.0.0/csv.bend&name=start.sp