Module

parser.errors

Parser error handling for Kida.

Provides ParseError class with rich source context and suggestions.

Classes

ParseError 4
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
Internal Methods 3
__init__ 5
def __init__(self, message: str, token: Token, source: str | None = None, filename: str | None = None, suggestion: str | None = None)
Parameters
Name Type Description
message
token
source Default:None
filename Default:None
suggestion 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