def annotate.go
bolt@1.27.0.0 · src/syntax/bind.bend:858
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
858
859
860
861
862def annotate.go(binds: List<&2, Bind>, +lines: List<&2, String>, +at: U32, +cur: List<&2, String>) -> List<&2, Bind>:
863 match binds:
864 case Nil{}:
865 Nil{}
866 case Con{Bind{name, +line, col, +kind, note}, rest}:
867 +ahead = U32.is_ge(line, at)
868 +here = Lazy.either(List<&2, String>, ahead, _u => annotate.ahead(line, at, cur), _v => cur)
869 +text = Lazy.either(String, ahead, _u => annotate.head(here), _v => annotate.back(lines, line))
870 Bind{name, line, col, kind, note_for(kind, note, _w => stripped(text))}
871 <> annotate.go(rest, lines, Bool.pick(U32, ahead, line, at), here)