(text, depth=0)
| 64 | |
| 65 | |
| 66 | def match_paren(text, depth=0): |
| 67 | pos = 0 |
| 68 | while (m := _PAREN_RE.match(text, pos)): |
| 69 | pos = m.end() |
| 70 | _open, _close = m.groups() |
| 71 | if _open: |
| 72 | depth += 1 |
| 73 | else: # _close |
| 74 | depth -= 1 |
| 75 | if depth == 0: |
| 76 | return pos |
| 77 | else: |
| 78 | raise ValueError(f'could not find matching parens for {text!r}') |
| 79 | |
| 80 | |
| 81 | VAR_DECL = set_capture_groups(_VAR_DECL, ( |
no test coverage detected
searching dependent graphs…