oak_org_mode/language/
mod.rs1#![doc = include_str!("readme.md")]
2use oak_core::{Language, LanguageCategory};
3use std::{
4 string::{String, ToString},
5 vec,
6 vec::Vec,
7};
8
9#[derive(Debug, Clone)]
11pub struct OrgModeLanguage {
12 pub todo_keywords: Vec<String>,
14 pub done_keywords: Vec<String>,
16 pub strict_mode: bool,
18}
19
20impl OrgModeLanguage {
21 pub fn new() -> Self {
23 Self { todo_keywords: vec!["TODO".to_string(), "NEXT".to_string(), "WAITING".to_string()], done_keywords: vec!["DONE".to_string(), "CANCELLED".to_string()], strict_mode: false }
24 }
25
26 pub fn with_todo_keywords(mut self, keywords: Vec<String>) -> Self {
28 self.todo_keywords = keywords;
29 self
30 }
31
32 pub fn with_done_keywords(mut self, keywords: Vec<String>) -> Self {
34 self.done_keywords = keywords;
35 self
36 }
37
38 pub fn with_strict_mode(mut self, strict: bool) -> Self {
40 self.strict_mode = strict;
41 self
42 }
43}
44
45impl Default for OrgModeLanguage {
46 fn default() -> Self {
47 Self { todo_keywords: vec!["TODO".to_string(), "NEXT".to_string(), "WAITING".to_string()], done_keywords: vec!["DONE".to_string(), "CANCELLED".to_string()], strict_mode: false }
48 }
49}
50
51impl Language for OrgModeLanguage {
52 const NAME: &'static str = "org-mode";
53 const CATEGORY: LanguageCategory = LanguageCategory::Markup;
54
55 type TokenType = crate::lexer::token_type::OrgModeTokenType;
56 type ElementType = crate::parser::element_type::OrgModeElementType;
57 type TypedRoot = ();
58}