Skip to main content

oak_regex/language/
mod.rs

1use crate::{ast::RegexRoot, lexer::RegexTokenType, parser::RegexElementType};
2use oak_core::{Language, LanguageCategory};
3
4/// Regex language configuration and metadata.
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub struct RegexLanguage;
8
9impl RegexLanguage {
10    /// Creates a new Regex language configuration.
11    pub fn new() -> Self {
12        Self
13    }
14}
15
16impl Default for RegexLanguage {
17    fn default() -> Self {
18        Self::new()
19    }
20}
21
22impl Language for RegexLanguage {
23    const NAME: &'static str = "regex";
24    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
25
26    type TokenType = RegexTokenType;
27    type ElementType = RegexElementType;
28    type TypedRoot = RegexRoot;
29}