1use crate::ast::DRoot;
2use oak_core::{Language, LanguageCategory};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, 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 standard() -> Self {
19 Self { d2_features: true, inline_asm: true, contracts: true }
20 }
21
22 pub fn minimal() -> Self {
24 Self { d2_features: false, inline_asm: false, contracts: false }
25 }
26}
27
28impl Default for DLanguage {
29 fn default() -> Self {
30 Self { d2_features: true, inline_asm: false, contracts: true }
31 }
32}
33
34impl Language for DLanguage {
35 const NAME: &'static str = "d";
36 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
37
38 type TokenType = crate::kind::DSyntaxKind;
39 type ElementType = crate::kind::DSyntaxKind;
40 type TypedRoot = DRoot;
41}