Skip to main content

oak_dot/language/
mod.rs

1use oak_core::{Language, LanguageCategory};
2use serde::{Deserialize, Serialize};
3
4/// DOT 语言配置(Graphviz)
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6pub struct DotLanguage {
7    /// 是否启用严格模式
8    pub strict_mode: bool,
9    /// 是否允许有向图
10    pub allow_digraph: bool,
11}
12
13impl DotLanguage {
14    pub fn new() -> Self {
15        Self::default()
16    }
17}
18
19impl Default for DotLanguage {
20    fn default() -> Self {
21        Self { strict_mode: false, allow_digraph: true }
22    }
23}
24
25impl Language for DotLanguage {
26    const NAME: &'static str = "dot";
27    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
28
29    type TokenType = crate::kind::DotSyntaxKind;
30    type ElementType = crate::kind::DotSyntaxKind;
31    type TypedRoot = ();
32}