You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now Span, ParseError, ParseErrorBundle, and ErrorFormatter all live inside the parser (errors.ts, error-formatter.ts) and are shaped by parser concerns — expected-token sets, parser state, single-point errors. That's fine while parsing is the only thing emitting diagnostics.
But the moment a typechecker, linter, or codegen wants to report "type string flows in here, expected int there," it either reinvents its own span/diagnostic types or reaches into the parser's internals. The dependency graph ends up pointing the wrong way: tools depend on the parser just to get a Span.
I'd like to split out a parser-agnostic diagnostic core:
ParseError then becomes a thin parser-specific adapter that produces Diagnostics, rather than being the diagnostic type itself. The parser depends on this core; future tools depend on the same core without touching the parser.
This is the umbrella that #11 (Span shape), #13 (related spans + fixes), and #14 (formatter pipeline) feed into — but none of them addresses the ownership/decoupling question, which is what actually unblocks non-parser consumers.
Open questions:
Where's the line between parser-specific data (expected tokens, merge semantics from or()) and the general Diagnostic? Does ParseError keep its parser-specific fields and just expose a toDiagnostic()?
Right now
Span,ParseError,ParseErrorBundle, andErrorFormatterall live inside the parser (errors.ts,error-formatter.ts) and are shaped by parser concerns — expected-token sets, parser state, single-point errors. That's fine while parsing is the only thing emitting diagnostics.But the moment a typechecker, linter, or codegen wants to report "type
stringflows in here, expectedintthere," it either reinvents its own span/diagnostic types or reaches into the parser's internals. The dependency graph ends up pointing the wrong way: tools depend on the parser just to get aSpan.I'd like to split out a parser-agnostic diagnostic core:
ParseErrorthen becomes a thin parser-specific adapter that producesDiagnostics, rather than being the diagnostic type itself. The parser depends on this core; future tools depend on the same core without touching the parser.This is the umbrella that #11 (Span shape), #13 (related spans + fixes), and #14 (formatter pipeline) feed into — but none of them addresses the ownership/decoupling question, which is what actually unblocks non-parser consumers.
Open questions:
or()) and the generalDiagnostic? DoesParseErrorkeep its parser-specific fields and just expose atoDiagnostic()?ErrorFormattermove with the core, or stay parser-side and consume a general renderer from Refactor ErrorFormatter into a unified render pipeline #14?Non-goals: