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