Skip to main content

oak_valkyrie/language/
mod.rs

1use crate::{ast::ValkyrieRoot, kind::ValkyrieSyntaxKind};
2use oak_core::{Language, LanguageCategory};
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
6/// The Valkyrie programming language definition.
7pub struct ValkyrieLanguage {
8    /// Allow using `<xml/>` syntax in source code
9    pub allow_xml: bool,
10    /// Allow using `<$ template $>` syntax in source code
11    pub allow_template: bool,
12}
13
14impl Default for ValkyrieLanguage {
15    fn default() -> Self {
16        Self { allow_xml: false, allow_template: false }
17    }
18}
19
20impl Language for ValkyrieLanguage {
21    const NAME: &'static str = "valkyrie";
22    const CATEGORY: LanguageCategory = LanguageCategory::Programming;
23
24    type TokenType = ValkyrieSyntaxKind;
25    type ElementType = ValkyrieSyntaxKind;
26    type TypedRoot = ValkyrieRoot;
27}