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