oak_vampire/language/
mod.rs1use oak_core::{Language, LanguageCategory};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct CommentConfig {
5 pub line_comment: Option<String>,
6 pub block_comment: Option<(String, String)>,
7}
8
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct StringConfig {
11 pub quotes: Vec<char>,
12 pub escape_char: Option<char>,
13}
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub struct WhitespaceConfig {
17 pub characters: Vec<char>,
18 pub new_line_characters: Vec<char>,
19}
20
21pub struct VampireLanguage {
22 pub comment_config: CommentConfig,
23 pub string_config: StringConfig,
24 pub whitespace_config: WhitespaceConfig,
25}
26
27impl Default for VampireLanguage {
28 fn default() -> Self {
29 Self {
30 comment_config: CommentConfig { line_comment: Some("%".to_string()), block_comment: Some(("/*".to_string(), "*/".to_string())) },
31 string_config: StringConfig { quotes: vec!['"', '\''], escape_char: Some('\\') },
32 whitespace_config: WhitespaceConfig { characters: vec![' ', '\t'], new_line_characters: vec!['\n', '\r'] },
33 }
34 }
35}
36
37impl Language for VampireLanguage {
38 const NAME: &'static str = "vampire";
39 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
40
41 type TokenType = crate::kind::VampireSyntaxKind;
42 type ElementType = crate::kind::VampireSyntaxKind;
43 type TypedRoot = crate::ast::VampireRoot;
44}