Digest.laws_of: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/rules/digest.bend as Digest Lines 290-303 of bolt@1.27.0.0/src/rules/digest.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/rules/digest.bend&start_line=290&end_line=303 import Base import bolt@1.27.0.0/src/syntax/tree.bend as Tree import bolt@1.27.0.0/src/syntax/bind.bend as Bind import bolt@1.27.0.0/src/syntax/outline.bend as Outline import bolt@1.27.0.0/src/rules/laws/closed.bend as Closed # every law of a tree, with whether it binds and its doc lines. items is a # cursor: each law's search starts where the last one stopped, so the items # are read once over all the laws, not once per law def laws_of(root: Tree.Node, +items: List<&2, Outline.Item>) -> List<&2, Law>: match root: case Tree.NCons{Tree.Stmt{Tree.SLaw{}, +kids, body}, rest}: +at = Tree.line(kids) +left = from_line(items, at, from_line.stop(items, at)) dd = doc_at(left, at) Law{Closed.name.of(Bind.declared(kids)), at, Closed.binds(body), String.lines(dd)} <> laws_of(rest, left) case Tree.NCons{h, rest}: laws_of(rest, items) case other: Nil{} Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.lines https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/digest.bend&name=Law https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/digest.bend&name=doc_at https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/digest.bend&name=from_line https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/digest.bend&name=from_line.stop https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/laws/closed.bend&name=binds https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/laws/closed.bend&name=name.of https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/bind.bend&name=declared https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/outline.bend&name=Item https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=Node https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=StmtKind https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=line