Skip to main content

oak_solidity/language/
mod.rs

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