1use crate::ast::DRoot;
2use oak_core::{Language, LanguageCategory};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub struct DLanguage {
8 pub d2_features: bool,
10 pub inline_asm: bool,
12 pub contracts: bool,
14}
15
16impl DLanguage {
17 pub fn new() -> Self {
19 Self::default()
20 }
21
22 pub fn standard() -> Self {
24 Self { d2_features: true, inline_asm: true, contracts: true }
25 }
26
27 pub fn minimal() -> Self {
29 Self { d2_features: false, inline_asm: false, contracts: false }
30 }
31}
32
33impl Default for DLanguage {
34 fn default() -> Self {
35 Self { d2_features: true, inline_asm: false, contracts: true }
36 }
37}
38
39impl Language for DLanguage {
40 const NAME: &'static str = "d";
41 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
42
43 type TokenType = crate::kind::DSyntaxKind;
44 type ElementType = crate::kind::DSyntaxKind;
45 type TypedRoot = DRoot;
46}