prompt_toolkit REPL integration
koskari.lexer.prompt_toolkit
prompt_toolkit integration for Koskari REPL.
Provides KoskariLexer, KoskariCompleter, and koskari_style for syntax highlighting and Tab completion. Requires prompt_toolkit.
- class koskari.lexer.prompt_toolkit.KoskariCompleter(get_namespace=None, special_names=None)
Bases:
CompleterCompleter for Koskari special forms, layout heads, and namespace symbols.
- get_completions(document, complete_event)
Yield completions for the atom before the cursor.
- Parameters:
document – prompt_toolkit Document
complete_event – CompletionEvent
- Yield:
Completion instances
- class koskari.lexer.prompt_toolkit.KoskariLexer(special_names=None, get_reader=None)
Bases:
Lexerprompt_toolkit Lexer for Koskari source.
Provides syntax highlighting via tokenize. Handles partial input by returning highlighting for tokens produced before any error.
- lex_document(document)
Return a callable that maps line numbers to style tuples.
- Parameters:
document – prompt_toolkit Document
- Returns:
callable(lineno) -> list of (style_class, text) tuples
- koskari.lexer.prompt_toolkit.load_koskari_key_bindings()
Return KeyBindings for the Koskari REPL.
Tab moves the current line’s leading indent to the next 4-space tab stop when the text before the cursor on the current line is whitespace-only; otherwise the default Tab (completion) runs.
Shift+Tab moves the current line’s leading indent to the previous tab stop (from any cursor position on that line).