Classes
BlockStackMixin
8
▼
Mixin for block stack management.
Host attributes and cross-mixin dependencies are declared via in…
BlockStackMixin
8
▼
Mixin for block stack management.
Host attributes and cross-mixin dependencies are declared via inline TYPE_CHECKING blocks.
Attributes
| Name | Type | Description |
|---|---|---|
_END_KEYWORDS |
frozenset[str]
|
— |
_CONTINUATION_KEYWORDS |
frozenset[str]
|
— |
_LOOP_BLOCKS |
frozenset[str]
|
— |
Methods
Internal Methods 5 ▼
_push_block
2
▼
Push a block onto the stack when opening it.
_push_block
2
▼
def _push_block(self, block_type: str, token: Token | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
block_type |
— |
Type of block (if, for, def, etc.) |
token |
— |
Token for error reporting (defaults to current token) Default:None
|
_pop_block
1
str
▼
Pop a block from the stack when closing it.
_pop_block
1
str
▼
def _pop_block(self, expected: str | None = None) -> str
Parameters
| Name | Type | Description |
|---|---|---|
expected |
— |
If provided, validates that the closing block matches. Use None to accept any block type (unified {% end %}). Default:None
|
Returns
str
The block type that was popped.
_format_open_blocks
0
str
▼
Format the current block stack for error messages.
_format_open_blocks
0
str
▼
def _format_open_blocks(self) -> str
Returns
str
_in_loop
0
bool
▼
Check if currently inside a loop block.
Used by break/continue to validate the…
_in_loop
0
bool
▼
def _in_loop(self) -> bool
Check if currently inside a loop block.
Used by break/continue to validate they are inside a loop. Part of RFC: kida-modern-syntax-features.
Returns
bool
_consume_end_tag
1
▼
Consume an end tag ({% end %} or {% endXXX %}) and pop from stack.
_consume_end_tag
1
▼
def _consume_end_tag(self, block_type: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
block_type |
— |
The expected block type being closed. This method handles both unified {% end %} and explicit {% endif %} etc. |