Skip to main content

oak_d2/language/
mod.rs

1use oak_core::{Language, LanguageCategory};
2
3/// Implementation of the D2 language for the Oak framework.
4#[derive(Debug, Clone, Copy, Default)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct D2Language {}
7
8impl D2Language {
9    /// Creates a new `D2Language` instance.
10    pub fn new() -> Self {
11        Self::default()
12    }
13}
14
15impl Language for D2Language {
16    const NAME: &'static str = "d2";
17    const CATEGORY: LanguageCategory = LanguageCategory::Modeling;
18
19    type TokenType = crate::lexer::token_type::D2TokenType;
20    type ElementType = crate::parser::element_type::D2ElementType;
21    type TypedRoot = crate::ast::D2Root;
22}