Expand description
Parse worker: a subprocess that reads source and writes the parsed
[CodeGraph], one request per line. It exists to contain tree-sitter — the
grammars are C and can abort() on malformed input, which is uncatchable in
Rust; running parsing here means such a crash kills only this worker, not the
daemon (see gonzalo_parse::ParserPool).
§Protocol (newline-delimited JSON, one exchange per line)
- Request: a JSON
ParseRequest({ language, source }). JSON escapes newlines, so a whole file is exactly one line. - Response: a JSON [
CodeGraph] on one line.
§Fault injection (tests only)
Two env-gated sentinels give deterministic stand-ins for grammar pathologies, used to test pool respawn/timeout. Unset in production, so neither is a live code path:
GONZALO_PARSE_CRASH_TOKEN— a request whosesourceequals itabort()s the worker (a grammar crash).GONZALO_PARSE_HANG_TOKEN— a request whosesourceequals it blocks forever (a grammar hang).
Functions§
- main 🔒