Files
nuwiki/crates/nuwiki-core/src/syntax/vimwiki/mod.rs
T

41 lines
861 B
Rust
Raw Normal View History

2026-05-10 17:20:46 +00:00
//! Vimwiki syntax plugin.
pub mod lexer;
2026-05-10 17:58:41 +00:00
pub mod parser;
2026-05-10 17:20:46 +00:00
pub use lexer::{VimwikiLexer, VimwikiToken, VimwikiTokenKind};
2026-05-10 17:58:41 +00:00
pub use parser::VimwikiParser;
use crate::ast::DocumentNode;
use crate::syntax::{Lexer, Parser, SyntaxPlugin};
/// SyntaxPlugin facade: chains `VimwikiLexer` + `VimwikiParser` so the
/// registry can hand out a single trait object.
2026-05-10 17:58:41 +00:00
#[derive(Debug, Default, Clone)]
pub struct VimwikiSyntax;
impl VimwikiSyntax {
pub fn new() -> Self {
Self
}
}
impl SyntaxPlugin for VimwikiSyntax {
fn id(&self) -> &str {
"vimwiki"
}
fn display_name(&self) -> &str {
"Vimwiki"
}
fn file_extensions(&self) -> &[&str] {
&[".wiki"]
}
fn parse(&self, text: &str) -> DocumentNode {
let tokens = VimwikiLexer::new().lex(text);
VimwikiParser::new().parse(tokens)
}
}