Skip to main content

oak_jasm/language/
mod.rs

1use oak_core::language::{Language, LanguageCategory};
2use serde::{Deserialize, Serialize};
3
4/// JASM 语言绑定与配置
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
6pub struct JasmLanguage {
7    /// 是否启用扩展指令(如 invokedynamic 等)
8    pub extended: bool,
9    /// 是否允许注释
10    pub comments: bool,
11}
12
13impl JasmLanguage {
14    pub fn new() -> Self {
15        Self::default()
16    }
17
18    pub fn standard() -> Self {
19        Self { extended: true, comments: true }
20    }
21
22    pub fn minimal() -> Self {
23        Self { extended: false, comments: false }
24    }
25}
26
27impl Language for JasmLanguage {
28    const NAME: &'static str = "jasm";
29    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
30
31    type TokenType = crate::syntax::JasmSyntaxKind;
32    type ElementType = crate::syntax::JasmSyntaxKind;
33    type TypedRoot = crate::ast::JasmRoot;
34}