phase 4: vimwiki parser + SyntaxPlugin glue
Hand-rolled recursive-descent parser over the token stream. Resilient per SPEC §6.7: never aborts the document — anything the dispatcher can't claim becomes BlockNode::Error and the cursor advances, and unterminated wikilinks / transclusions / delimiters fall back to literal text. Block coverage: every variant from §6.4 — Heading (with inline content between markers), Paragraph (with soft-break across single newlines), HorizontalRule, Blockquote (both `>` and 4-space styles), Preformatted, MathBlock, List (with checkbox + indent-driven sublists), DefinitionList, Table (header separator promotes the preceding row, plus colspan / rowspan cells), Comment (single + multiline), and page-level placeholders threaded into PageMetadata. Inline pairing: left-to-right scan with "find next matching delim", recursing on the slice between. `_*x*_` becomes Italic(Bold(...)), mirroring SPEC §6.7 precedence. URLs inside `[[ ]]` route to ExternalLinkNode; everything else to WikiLinkNode with full LinkTarget classification (Wiki / Interwiki numbered + named / Diary / File / Local / AnchorOnly / directory / root-relative / filesystem-absolute). VimwikiSyntax registers as id="vimwiki", extensions=[".wiki"] and chains lexer + parser inside SyntaxPlugin::parse. SPEC §4 updated to record the hand-rolled choice with rationale — span-bearing tokens fit awkwardly into winnow/nom combinator style; resilience and recovery are explicit in code instead. Tests (41 new parser cases) cover every AST construct, inline precedence including nested bold/italic, every LinkKind, transclusion alt + attrs, resilience on unterminated links, and end-to-end SyntaxRegistry dispatch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a
|
||||
Rust-based language server (LSP).
|
||||
|
||||
> **Status:** Phase 3 (vimwiki lexer) complete. Parser, renderer, and editor
|
||||
> glue still pending — not yet functional end-to-end.
|
||||
> **Status:** Phase 4 (vimwiki parser) complete. End-to-end source → AST works
|
||||
> via `VimwikiSyntax`. Renderer and editor glue still pending.
|
||||
|
||||
See [`SPEC.md`](./SPEC.md) for the full project specification.
|
||||
|
||||
@@ -16,8 +16,8 @@ See [`SPEC.md`](./SPEC.md) for the full project specification.
|
||||
| 1 | Core AST | ✅ done |
|
||||
| 2 | Syntax Plugin Interface | ✅ done |
|
||||
| 3 | Vimwiki Lexer | ✅ done |
|
||||
| 4 | Vimwiki Parser | ⏳ next |
|
||||
| 5 | Renderer | ⏳ |
|
||||
| 4 | Vimwiki Parser | ✅ done |
|
||||
| 5 | Renderer | ⏳ next |
|
||||
| 6 | LSP Foundation | ⏳ |
|
||||
| 7 | Semantic Tokens | ⏳ |
|
||||
| 8 | Navigation | ⏳ |
|
||||
|
||||
Reference in New Issue
Block a user