Skip to main content

oak_d2/language/
mod.rs

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