Lex.step: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/syntax/lex.bend as Lex Lines 294-305 of bolt@1.27.0.0/src/syntax/lex.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&start_line=294&end_line=305 import Base import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy # one char: it continues the current token, or starts a new one. Only the # branch taken is built: the token is flushed (its text reversed, its kind # refined) once, where it ends, not on every char of it def step(+cc: Char, st: St) -> St: St{+mode, +kind, +line, +col, +sl, +sc, +buf, +toks} = st +cls = classify(cc) +nl = is_newline(cc) +line2 = Bool.pick(U32, nl, (line + 1 : U32), line) +col2 = Bool.pick(U32, nl, 0, (col + 1 : U32)) Lazy.either(St, continues(mode, cls), _u => St{after(mode, cls), kind, line2, col2, sl, sc, cc <> buf, toks}, _v => St{begin.mode(cls), begin.kind(cls), line2, col2, line, col, [cc], flush(kind, sl, sc, buf, toks)}) Uses (14): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List 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=bolt@1.27.0.0/src/lazy/lazy.bend&name=either https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=St https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=after https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=begin.kind https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=begin.mode https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=classify https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=continues https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=flush https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=is_newline