def seg_op

bolt@1.27.0.0 · src/rules/pedantic/strict.bend:40

import bolt@1.27.0.0/src/rules/pedantic/strict.bend as Strict
import Base
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

40# does the chain, up to its first top-level comma or `=>`, hold `&&` or `||`?
41def seg_op(nn: Tree.Node) -> Bool:
42  match nn:
43    case Tree.NCons{+h, rest}:
44      Lazy.stop(Bool, Calls.kind.leaf(~seg_op.ends, h), False{},
45        _u => seg_op.or(Bool.and(Calls.kind.leaf(~Calls.kind.oper, h), logic(Calls.leaf.text(h))), seg_op(rest)))
46    case other:
47      False{}

Uses (10)

Used by (1)