| 805 | m.match() |
| 806 | |
| 807 | class depthchecker(bashlex.ast.nodevisitor): |
| 808 | def __init__(self): |
| 809 | self.depth = 0 |
| 810 | self.maxdepth = 0 |
| 811 | |
| 812 | def visitnode(self, node): |
| 813 | if "substitution" in node.kind: |
| 814 | self.depth += 1 |
| 815 | self.maxdepth = max(self.maxdepth, self.depth) |
| 816 | |
| 817 | def visitendnode(self, node): |
| 818 | if "substitution" in node.kind: |
| 819 | self.depth -= 1 |
| 820 | |
| 821 | v = depthchecker() |
| 822 | v.visit(m.ast) |
no outgoing calls