Classes
QuoteClassifierMixin
3
▼
Mixin providing block quote classification.
QuoteClassifierMixin
3
▼
Mixin providing block quote classification.
Methods
Internal Methods 3 ▼
Create token with raw coordinates. Implemented by Lexer.
def _make_token(self, token_type: TokenType, value: str, start_pos: int, *, start_col: int | None = None, end_pos: int | None = None, line_indent: int = -1) -> Token
Parameters
| Name | Type | Description |
|---|---|---|
token_type |
— |
|
value |
— |
|
start_pos |
— |
|
start_col |
— |
Default:None
|
end_pos |
— |
Default:None
|
line_indent |
— |
Default:-1
|
Returns
Token
_expand_tabs
2
str
▼
Expand tabs. Implemented by Lexer.
_expand_tabs
2
str
▼
def _expand_tabs(self, text: str, start_col: int = 1) -> str
Parameters
| Name | Type | Description |
|---|---|---|
text |
— |
|
start_col |
— |
Default:1
|
Returns
str
Classify block quote marker(s) and emit tokens.
A single line may carry many n…
def _classify_block_quote(self: LexerClassifierHost, content: str, line_start: int, indent: int = 0) -> Iterator[Token]
Classify block quote marker(s) and emit tokens.
A single line may carry many nested> markers (> > > x). Each marker
is emitted as aBLOCK_QUOTE_MARKERtoken; the innermost content is then
classified once.
This is written as a LOOP rather than tail recursion. The original recursive
form crashed with aRecursionErrorin the lexer on adversarial single-line
input (hundreds of leading>) BEFORE the parser's max_nesting_depth
guard could fire. Iterating peels one>per pass and emits identical
tokens (same marker offsets,start_col, line_indent, and the same
nested heading/list/fence/link-ref/thematic-break handling).
Parameters
| Name | Type | Description |
|---|---|---|
content |
— |
Content starting with > |
line_start |
— |
Absolute offset of the start of the line |
indent |
— |
Column position of the > marker (0-indexed) Default:0
|
Returns
Iterator[Token]