Module

parser.errors

Parser error handling for Kida.

Provides ParseError class with rich source context and suggestions.

Classes

ParseError 5 ▼
Parser error with rich source context. Inherits from TemplateSyntaxError to ensure consistent exce…

Parser error with rich source context.

Inherits from TemplateSyntaxError to ensure consistent exception handling. Displays errors with source code snippets and visual pointers, matching the format used by the lexer for consistency.

Methods

col_offset 0 int ▼
Column offset where the error occurred (0-based).
property
def col_offset(self) -> int
Returns
int
col_offset 1 ▼
Allow parent __init__ to set col_offset without clobbering token value.
def col_offset(self, value: int | None) -> None
Parameters
Name Type Description
value —
Internal Methods 3 ▼
__init__ 6 ▼
def __init__(self, message: str, token: Token, source: str | None = None, filename: str | None = None, suggestion: str | None = None, code: ErrorCode | None = None)
Parameters
Name Type Description
message —
token —
source — Default:None
filename — Default:None
suggestion — Default:None
code — Default:None
_format_message 0 str ▼
Override parent's formatting with rich source context.
def _format_message(self) -> str
Returns
str
_format 0 str ▼
Format error with source context like Rust/modern compilers.
def _format(self) -> str
Returns
str