#![doc = include_str!("readme.md")]
use crate::ast::DRoot;
use oak_core::{Language, LanguageCategory};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DLanguage {
pub d2_features: bool,
pub inline_asm: bool,
pub contracts: bool,
}
impl DLanguage {
pub fn new() -> Self {
Self::default()
}
pub fn standard() -> Self {
Self { d2_features: true, inline_asm: true, contracts: true }
}
pub fn minimal() -> Self {
Self { d2_features: false, inline_asm: false, contracts: false }
}
}
impl Default for DLanguage {
fn default() -> Self {
Self { d2_features: true, inline_asm: false, contracts: true }
}
}
impl Language for DLanguage {
const NAME: &'static str = "d";
const CATEGORY: LanguageCategory = LanguageCategory::Programming;
type TokenType = crate::lexer::token_type::DTokenType;
type ElementType = crate::parser::element_type::DElementType;
type TypedRoot = DRoot;
}