Skip to content

Python parser recovery

Last verified end to end: 2026-10-03 (query_code schema version 1).

Python parser recovery preserves malformed source as a structured syntax_error node. This fixture stays separate from ordinary syntax tutorials so its recovery diagnostic does not make unrelated queries appear incomplete.

def unfinished(
(language python (syntax_error))
{"languages":["python"],"match":{"kind":"syntax_error"}}
{
"results": [
{
"enclosing_symbol": "python.recovered",
"end_line": 1,
"kind": "syntax_error",
"language": "python",
"path": "python/recovered.py",
"result_type": "structural_match",
"start_line": 1,
"text": "def unfinished("
}
],
"truncated": false
}