Skip to main content

oak_dot/language/
mod.rs

1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3
4/// DOT language configuration (Graphviz).
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub struct DotLanguage {
8    /// Whether to enable strict mode.
9    pub strict_mode: bool,
10    /// Whether to allow directed graphs.
11    pub allow_digraph: bool,
12}
13
14impl DotLanguage {
15    /// Creates a new DOT language configuration.
16    pub fn new() -> Self {
17        Self::default()
18    }
19}
20
21impl Default for DotLanguage {
22    fn default() -> Self {
23        Self { strict_mode: false, allow_digraph: true }
24    }
25}
26
27impl Language for DotLanguage {
28    const NAME: &'static str = "dot";
29    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
30
31    type TokenType = crate::lexer::token_type::DotTokenType;
32    type ElementType = crate::parser::element_type::DotElementType;
33    type TypedRoot = ();
34}