(self)
| 97 | |
| 98 | class ParserInline: |
| 99 | def __init__(self) -> None: |
| 100 | self.ruler = Ruler[RuleFuncInlineType]() |
| 101 | for name, rule in _rules: |
| 102 | self.ruler.push(name, rule) |
| 103 | # Second ruler used for post-processing (e.g. in emphasis-like rules) |
| 104 | self.ruler2 = Ruler[RuleFuncInline2Type]() |
| 105 | for name, rule2 in _rules2: |
| 106 | self.ruler2.push(name, rule2) |
| 107 | # Characters that stop the text rule, allowing other inline rules to fire. |
| 108 | # _extra_terminator_chars is only allocated when add_terminator_char() is called |
| 109 | # with a char outside the defaults, keeping __init__ allocation-free. |
| 110 | self._extra_terminator_chars: set[str] = set() |
| 111 | # Pre-compiled regex shared with all default instances (no copy in the common path). |
| 112 | self.terminator_re: re.Pattern[str] = _default_terminator_re() |
| 113 | |
| 114 | def add_terminator_char(self, ch: str) -> None: |
| 115 | """Register a character that stops the ``text`` rule, allowing inline rules to fire. |
nothing calls this directly
no test coverage detected