(i: int)
| 405 | assert len(literal) > 0, "Empty literal not supported" |
| 406 | |
| 407 | def recurse(i: int): |
| 408 | c = literal[i] |
| 409 | if maybe_escaped_underscores and c == "_": |
| 410 | yield f"[^{c}\\\\]" |
| 411 | yield " | " |
| 412 | yield f'"\\\\"? "{c}"' |
| 413 | else: |
| 414 | yield f"[^{c}]" |
| 415 | if i < len(literal) - 1: |
| 416 | yield " | " |
| 417 | yield self._format_literal(c) |
| 418 | yield " (" |
| 419 | yield from recurse(i + 1) |
| 420 | yield ")?" |
| 421 | |
| 422 | return "".join(("(", *recurse(0), ")")) |
| 423 |
nothing calls this directly
no test coverage detected