Semantic.encode: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/lsp/semantic.bend as Semantic Lines 400-410 of bolt@1.27.0.0/src/lsp/semantic.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/lsp/semantic.bend&start_line=400&end_line=410 import Base # LSP's encoding: five numbers a token, positions relative to the previous # token (a line delta, and a column delta on the same line, absolute on a new # one) def encode(sems: List<&2, Sem>, +pl: U32, +pc: U32) -> List<&2, U32>: match sems: case Nil{}: Nil{} case Con{Sem{+line, +col, len, typ}, rest}: +same = U32.is_eq(line, pl) +dcol = Bool.pick(U32, same, (col - pc : U32), col) (line - pl : U32) <> (dcol <> (len <> (typ <> (0 <> encode(rest, line, col))))) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick 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.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/lsp/semantic.bend&name=Sem