Skip to main content

oak_apl/language/
mod.rs

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