mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-23 11:32:25 +08:00
Move some stuff around to make it more flexible.
This commit is contained in:
@@ -7,6 +7,15 @@ class Normalizer(object):
|
||||
self._config = config
|
||||
self.issues = []
|
||||
|
||||
def visit(self, node):
|
||||
try:
|
||||
children = node.children
|
||||
except AttributeError:
|
||||
return self.visit_leaf(node)
|
||||
else:
|
||||
with self.visit_node(node):
|
||||
return ''.join(self.visit(child) for child in children)
|
||||
|
||||
@contextmanager
|
||||
def visit_node(self):
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user