def mark
bolt@1.27.0.0 · src/rules/pedantic/rewalk.bend:190
import bolt@1.27.0.0/src/rules/pedantic/rewalk.bend as Rewalk
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/rules/calls.bend as Calls
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
190
191def mark(nn: Tree.Node) -> List<&2, Pos>:
192 match nn:
193 case Tree.NCons{Tree.Leaf{Lex.Tok{k, +t, l, c}}, Tree.NCons{Tree.Group{Lex.Tok{_, +o, _, _}, +kids, _}, rest}}:
194 +here = Lazy.stop(List<&2, Pos>, Bool.not(String.eq(o, "(")), [], _u => mark_slot(slot_of(t), Calls.args(kids)))
195 List.concat(&2, Pos, [here, mark(kids), mark(rest)])
196 case Tree.NCons{Tree.Group{open, +kids, close}, rest}:
197 List.concat(&2, Pos, [mark(kids), mark(rest)])
198 case Tree.NCons{Tree.Stmt{Tree.SCase{}, +kids, body}, rest}:
199 List.concat(&2, Pos, [mark(kids), mark(rest)])
200 case Tree.NCons{Tree.Stmt{kind, +kids, body}, rest}:
201 List.concat(&2, Pos, [mark(kids), mark(body), mark(rest)])
202 case Tree.NCons{h, rest}:
203 mark(rest)
204 case other:
205 Nil{}