class Prism::Pattern

def scan(root)

that will yield each node that matches the pattern.
matches the pattern. If no block is given, an enumerator will be returned
pattern. If a block is given, it will be called with each node that
Scan the given node and all of its children for nodes that match the
def scan(root)
  return to_enum(:scan, root) unless block_given?
  @compiled ||= compile
  queue = [root]
  while (node = queue.shift)
    yield node if @compiled.call(node) # steep:ignore
    queue.concat(node.compact_child_nodes)
  end
end