MCPcopy Index your code
hub / github.com/python/cpython / RuleCollectorVisitor

Class RuleCollectorVisitor

Tools/peg_generator/pegen/parser_generator.py:32–42  ·  view source on GitHub ↗

Visitor that invokes a provided callmaker visitor with just the NamedItem nodes

Source from the content-addressed store, hash-verified

30
31
32class RuleCollectorVisitor(GrammarVisitor):
33 """Visitor that invokes a provided callmaker visitor with just the NamedItem nodes"""
34
35 def __init__(self, callmakervisitor: GrammarVisitor) -> None:
36 self.callmaker = callmakervisitor
37
38 def visit_Rule(self, rule: Rule) -> None:
39 self.visit(rule.flatten())
40
41 def visit_NamedItem(self, item: NamedItem) -> None:
42 self.callmaker.visit(item)
43
44
45class KeywordCollectorVisitor(GrammarVisitor):

Callers 1

collect_rulesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…