feat: rowan-based lossless YAML CST parser (Phase 1 of unified parsing)#114
Merged
feat: rowan-based lossless YAML CST parser (Phase 1 of unified parsing)#114
Conversation
Lossless, span-preserving YAML parser for rivet's YAML subset: - SyntaxKind enum (28 variants: tokens + composite nodes + Error) - Hand-written lexer: handles plain/quoted scalars, block scalars, flow sequences, comments, document markers - Recursive-descent parser with indent tracking via byte offsets - Error recovery: wraps unparseable spans in Error nodes - Round-trip guarantee: parse(source).text() == source 18 tests: simple/nested mappings, sequences, flow sequences, block scalars, comments, quoted strings, URLs with colons, colons in values, document markers, error recovery. Utility functions: line_starts(), offset_to_line_col() for converting rowan TextRange to LSP line/column positions. Phase 1 of the unified parsing architecture plan. No integration with the rest of rivet yet — standalone module.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 9070f02 | Previous: 2c9fb62 | Ratio |
|---|---|---|---|
store_insert/10000 |
14934409 ns/iter (± 964832) |
10743106 ns/iter (± 494627) |
1.39 |
validate/10000 |
12547326 ns/iter (± 1382543) |
9515609 ns/iter (± 605808) |
1.32 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of the unified parsing architecture: a rowan-based lossless YAML CST parser.
What it does
parse(source).text() == sourcefor every fileTextRangeon every nodeline_starts()+offset_to_line_col()for LSP position conversionWhat it doesn't do (yet)
Design
bazel.rsrowan pattern: SyntaxKind enum, YamlLanguage trait, hand-written lexer, recursive-descent parser with GreenNodeBuilderTests: 18
Round-trip, nested structures, flow sequences, block scalars, comments, quoted strings, URLs with colons, colons in values, error recovery.
Refs #22.
🤖 Generated with Claude Code