Skip to main content

oak_ada/language/
mod.rs

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