1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
9pub struct MsilLanguage {
10 pub extended_instructions: bool,
12 pub debug_info: bool,
14 pub strict_mode: bool,
16}
17
18impl MsilLanguage {
19 pub fn new() -> Self {
21 Self::default()
22 }
23
24 pub fn standard() -> Self {
26 Self { extended_instructions: false, debug_info: false, strict_mode: true }
27 }
28
29 pub fn extended() -> Self {
31 Self { extended_instructions: true, debug_info: true, strict_mode: false }
32 }
33}
34
35impl Default for MsilLanguage {
36 fn default() -> Self {
37 Self { extended_instructions: false, debug_info: false, strict_mode: false }
38 }
39}
40
41impl Language for MsilLanguage {
42 const NAME: &'static str = "msil";
43 const CATEGORY: LanguageCategory = LanguageCategory::Programming;
44
45 type TokenType = crate::lexer::token_type::MsilTokenType;
46 type ElementType = crate::parser::element_type::MsilElementType;
47 type TypedRoot = crate::ast::MsilRoot;
48}