oak_d/language/
mod.rs

1use crate::kind::DSyntaxKind;
2use oak_core::Language;
3
4/// Language definition for D programming language
5#[derive(Debug, Clone)]
6pub struct DLanguage {
7    /// Whether to enable D2 features
8    pub d2_features: bool,
9    /// Whether to allow inline assembly
10    pub inline_asm: bool,
11    /// Whether to enable contract programming
12    pub contracts: bool,
13}
14
15impl DLanguage {
16    /// Create a standard D language instance
17    pub fn standard() -> Self {
18        Self { d2_features: true, inline_asm: true, contracts: true }
19    }
20
21    /// Create a minimal D language instance
22    pub fn minimal() -> Self {
23        Self { d2_features: false, inline_asm: false, contracts: false }
24    }
25}
26
27impl Default for DLanguage {
28    fn default() -> Self {
29        Self { d2_features: true, inline_asm: false, contracts: true }
30    }
31}
32
33impl Language for DLanguage {
34    type SyntaxKind = DSyntaxKind;
35    type TypedRoot = ();
36}