Skip to main content

oak_delphi/language/
mod.rs

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