Пример #1
0
    def visit(self, tree):
        CollectTokenDefs_Visitor(self.tokendefs).visit(tree)
        SVisitor.visit(self, tree)

        for tokendef in self.tokendefs.itervalues():
            self._simplify_token(tokendef)

        return self.tokendefs
Пример #2
0
 def _visit(self, tree):
     "_visit simplifies the tree as much as possible"
     # visit until nothing left to change (not the most efficient, but good enough since it's only the grammar)
     while SVisitor._visit(self, tree):
         pass