Skip to main content

oak_j/language/
mod.rs

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