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