def onto
bolt@1.27.0.0 · src/rules/suspicious/concat.bend:74
import bolt@1.27.0.0/src/rules/suspicious/concat.bend as Concat
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/lazy/lazy.bend as Lazy
74
75
76def onto(aa: Tree.Node) -> Maybe<&2, Lex.Tok>:
77 match aa:
78 case Tree.NCons{Tree.Group{Lex.Tok{_, +o, _, _}, kids, _}, Tree.NNil{}}:
79 Lazy.stop(Maybe<&2, Lex.Tok>, Bool.not(String.eq(o, "(")), None{}, _u => onto(kids))
80 case Tree.NCons{hh, Tree.NCons{h2, rest}}:
81 onto.next(hh, h2)
82 case other:
83 None{}