Classes
BlockScannerMixin
11
▼
Mixin providing block mode scanning logic.
Scans for block-level elements using window approach:
1…
BlockScannerMixin
11
▼
Mixin providing block mode scanning logic.
Scans for block-level elements using window approach:
- Find end of current line (window)
- Classify the line content (pure logic)
- Emit token and commit position (always advances)
Attributes
| Name | Type | Description |
|---|---|---|
_source |
str
|
— |
_pos |
int
|
— |
_consumed_newline |
bool
|
— |
_text_transformer |
Callable[[str], str] | None
|
— |
Methods
Internal Methods 7 ▼
_save_location
0
▼
Save current location for O(1) token location creation.
_save_location
0
▼
def _save_location(self) -> None
_find_line_end
0
int
▼
Find end of current line.
_find_line_end
0
int
▼
def _find_line_end(self) -> int
Returns
int
_calc_indent
1
tuple[int, int]
▼
Calculate indent level and content start position.
_calc_indent
1
tuple[int, int]
▼
def _calc_indent(self, line: str) -> tuple[int, int]
Parameters
| Name | Type | Description |
|---|---|---|
line |
— |
Returns
tuple[int, int]
_chars_for_indent
2
int
▼
Calculate how many characters to skip to consume target_indent spaces.
_chars_for_indent
2
int
▼
def _chars_for_indent(self, line: str, target_indent: int) -> int
Parameters
| Name | Type | Description |
|---|---|---|
line |
— |
|
target_indent |
— |
Returns
int
_commit_to
1
▼
Commit position to line_end.
_commit_to
1
▼
def _commit_to(self, line_end: int) -> None
Parameters
| Name | Type | Description |
|---|---|---|
line_end |
— |
_location_from
1
SourceLocation
▼
Get source location from saved position.
_location_from
1
SourceLocation
▼
def _location_from(self, start_pos: int) -> SourceLocation
Parameters
| Name | Type | Description |
|---|---|---|
start_pos |
— |
Returns
SourceLocation
_scan_block
0
Iterator[Token]
▼
Scan for block-level elements using window approach.
_scan_block
0
Iterator[Token]
▼
def _scan_block(self) -> Iterator[Token]
Returns
Iterator[Token]