Commit 203c72c7
203c72c77fc2Merged
Ryan Seys <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
feat(parse): support MissingNode (parse-error placeholder; defensive handler)
Adds a parser case for PM_MISSING_NODE that exits with a clear internal-error message. Prism emits MissingNode as an error-recovery placeholder; the parser's main loop bails on parse errors before flatten() is called (spinel_parse.c:1201), so reaching this case indicates Prism produced a MissingNode without flagging an error in error_list -- a contract violation we surface clearly rather than route through the generic UnsupportedNode path.
No test fixture: this path is unreachable from valid or invalid Ruby in normal use (the error_list bail catches both). The handler is defense-in-depth in case Prism's contract changes.
Tests: 252 still pass. Bootstrap: gen2.c == gen3.c.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 203c72c77fc2
- Parent
- 6322a5e35310
spinel_parse.cmodifiedView file
node_counter--; return flatten(n->value); } case PM_MISSING_NODE: { /* Prism emits MissingNode as an error-recovery placeholder. main() bails out before flatten() runs when parser.error_list is non-empty, so reaching this case means Prism produced a MissingNode without flagging an error -- a contract violation we surface clearly rather than silently miscompile. */ fprintf(stderr, "spinel_parse: internal error: MissingNode reached flatten() at byte offset %td; parse error not in error_list\n", node->location.start - g_parser->start); exit(1); } case PM_SPLAT_NODE: { pm_splat_node_t *n = (pm_splat_node_t *)node; N("SplatNode");