1.1 KiB
1.1 KiB
Source Region Parser Experiment Notes
Current Parser Experiment
- The parser works directly with
CodePointIndexandCodePointSpan; richSpanconversion is intentionally left to rendering or reporting code. - Structured errors are currently enough to identify the failing region and the syntactic fact that failed, without committing to message text.
- Empty documents are valid because the document grammar is a sequence of expressions.
Source Region Observations
SourceText.getSpan(CodePointSpan)is the key boundary operation: parsers can stay low-level, while diagnostics can opt into line and column information later.- Zero-width EOF spans are important for parse errors such as an unclosed list. The existing
eofSpansupport fits this well. - Parser clients still need a few tiny local span helpers, such as current-code-point span and EOF cursor span.
renderSpanreturning structuredLineViewdata works well for UI rendering because the application can choose its own DOM and styling without reimplementing line slicing.