Skip to main content

oak_ada/language/
mod.rs

1#[doc = include_str!("../readme.md")]
2use crate::{ast::AdaRoot, lexer::AdaTokenType, parser::AdaElementType};
3use oak_core::{Language, LanguageCategory};
4use serde::{Deserialize, Serialize};
5
6/// Ada 语言配置和元数据。
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
8pub struct AdaLanguage {
9    /// 是否启用 Ada 2022 特性
10    pub allow_ada_2022: bool,
11    /// 是否启用严格模式
12    pub strict_mode: bool,
13}
14
15impl AdaLanguage {
16    /// 创建新的 Ada 语言配置
17    pub fn new() -> Self {
18        Self { allow_ada_2022: true, strict_mode: false }
19    }
20}
21
22impl Default for AdaLanguage {
23    fn default() -> Self {
24        Self::new()
25    }
26}
27
28impl Language for AdaLanguage {
29    const NAME: &'static str = "ada";
30    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
31
32    type TokenType = AdaTokenType;
33    type ElementType = AdaElementType;
34    type TypedRoot = AdaRoot;
35}