Initialize.
(self, token: str, tags: str, smart: bool, double: bool)
| 563 | """Delimiter.""" |
| 564 | |
| 565 | def __init__(self, token: str, tags: str, smart: bool, double: bool): |
| 566 | """Initialize.""" |
| 567 | |
| 568 | # An unclosed delimiter. |
| 569 | # |
| 570 | # 0. Start position of the (remaining) run in the text. |
| 571 | # 1. End position of the (remaining) run in the text. |
| 572 | # 2. Whether the run is ambiguous (could be a start or an end). |
| 573 | # 3. Original length of the run. |
| 574 | # 4. Current length of the run. |
| 575 | self.stack: deque[tuple[int, int, bool, int, int]] = deque() |
| 576 | temp = tags.split(',') |
| 577 | self.tag_count = len(temp) |
| 578 | self.tags: tuple[str, str] = (temp[0], temp[1]) if self.tag_count == 2 else (temp[0], temp[0]) |
| 579 | self.double = len(temp) != 2 and double |
| 580 | self.single = len(temp) != 2 and not double |
| 581 | self.smart = smart |
| 582 | self._build_patterns(token) |
| 583 | |
| 584 | def _build_patterns(self, token: str) -> str: |
| 585 | """Build regular expression patterns.""" |
nothing calls this directly
no test coverage detected