Skip to main content

oak_delphi/language/
mod.rs

1#![doc = include_str!("readme.md")]
2use crate::ast::DelphiRoot;
3use oak_core::{Language, LanguageCategory};
4
5/// Language definition for Delphi programming language
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8pub struct DelphiLanguage {
9    /// Whether to enable strict syntax checking
10    pub strict_syntax: bool,
11    /// Whether to support Unicode strings
12    pub unicode_strings: bool,
13}
14
15impl DelphiLanguage {
16    /// Creates a new `DelphiLanguage` configuration.
17    pub fn new() -> Self {
18        Self::default()
19    }
20}
21
22impl Default for DelphiLanguage {
23    fn default() -> Self {
24        Self { strict_syntax: false, unicode_strings: true }
25    }
26}
27
28impl Language for DelphiLanguage {
29    const NAME: &'static str = "delphi";
30    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
31
32    type TokenType = crate::lexer::token_type::DelphiTokenType;
33    type ElementType = crate::parser::element_type::DelphiElementType;
34    type TypedRoot = DelphiRoot;
35}