1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
use regex::Regex;
#[cfg(feature = "color")]
pub type ColorDisplayFunc = fn(string: &str, to_file: bool) -> Box<dyn std::fmt::Display>;
pub const LOREM_SOURCE: &str = "Lorem ipsum dolor sit amet consectetur adipiscing elit. In rhoncus sapien iaculis sapien congue a dictum urna malesuada. In hac habitasse platea dictumst. Quisque dapibus justo a mollis condimentum sapien ligula aliquam massa in vehicula tellus magna vitae enim. Aliquam mattis ligula in enim congue auctor. Pellentesque at sollicitudin velit. Quisque blandit lobortis turpis at malesuada. Donec vitae luctus mauris. Aenean efficitur risus id tortor blandit laoreet. Vestibulum commodo aliquam sapien. Cras aliquam eget leo iaculis cursus. Morbi iaculis justo sed tellus ultrices aliquet. Nam bibendum ut erat quis. ";
lazy_static::lazy_static! {
pub static ref LOREM: Vec<&'static str> = LOREM_SOURCE.split(' ').collect();
pub static ref LOREM_WIDTH: usize = LOREM.len();
}
pub(crate) fn macro_start(custom: Option<char>) -> char {
if let Some(start) = custom {
start
} else {
MACRO_START_CHAR
}
}
pub(crate) fn comment_start(custom: Option<char>) -> char {
if let Some(start) = custom {
start
} else {
COMMENT_CHAR
}
}
const MACRO_START_CHAR: char = '$';
const COMMENT_CHAR: char = '%';
pub const ESCAPE_CHAR: char = '\\';
pub const LIT_CHAR: char = '*';
pub const MAIN_CALLER: &str = "@MAIN@";
lazy_static::lazy_static! {
pub static ref UNALLOWED_CHARS: Regex = Regex::new(r#"[a-zA-Z1-9\\_\*\^\|\(\)-=,:!]"#).expect("Failed to create regex expression");
}
#[cfg(feature = "debug")]
pub const DIFF_SOURCE_FILE: &str = "diff.src";
#[cfg(feature = "debug")]
pub const DIFF_OUT_FILE: &str = "diff.out";
#[cfg(windows)]
pub const LINE_ENDING: &str = "\r\n";
#[cfg(not(windows))]
pub const LINE_ENDING: &str = "\n";
#[cfg(windows)]
pub const PATH_SEPARATOR: &str = "\\\\";
#[cfg(not(windows))]
pub const PATH_SEPARATOR: &str = "/";
#[cfg(feature = "debug")]
pub const RDB_HELP: &str = include_str!("debug_help_message.txt");
pub const ESR: [&str; 0] = [];
pub const DEFINE_KEYWORD: &str = "define";