rustla/parser/
automata.rs1use crate::parser::regex_patterns;
8use regex::Regex;
9
10lazy_static::lazy_static! {
11
12 pub static ref ATTRIBUTION_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::ATTRIBUTION_PATTERN) {
14 automaton
15 } else {
16 panic!("Could not initialize ATTRIBUTION automaton. Computer says no...")
17 };
18
19 pub static ref BLANK_LINE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::BLANK_LINE_PATTERN) {
21 automaton
22 } else {
23 panic!("Could not initialize BLANK_LINE automaton. Computer says no...")
24 };
25
26 pub static ref BULLET_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::BULLET_PATTERN) {
28 automaton
29 } else {
30 panic!("Could not initialize BULLET automaton. Computer says no...")
31 };
32
33 pub static ref ENUMERATOR_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::ENUMERATOR_PATTERN) {
35 automaton
36 } else {
37 panic!("Could not initialize ENUMERATOR automaton. Computer says no...")
38 };
39
40 pub static ref FIELD_MARKER_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::FIELD_MARKER_PATTERN) {
42 automaton
43 } else {
44 panic!("Could not initialize FIELD_MARKER automaton. Computer says no...")
45 };
46
47 pub static ref INDENTED_LITERAL_BLOCK_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::INDENTED_LITERAL_BLOCK_PATTERN) {
49 automaton
50 } else {
51 panic!("Could not initialize INDENTED_LITERAL_BLOCK automaton. Computer says no...")
52 };
53
54 pub static ref QUOTED_LITERAL_BLOCK_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::QUOTED_LITERAL_BLOCK_PATTERN) {
56 automaton
57 } else {
58 panic!("Could not initialize QUOTED_LITERAL_BLOCK automaton. Computer says no...")
59 };
60
61 pub static ref GRID_TABLE_TOP_AND_BOT_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::GRID_TABLE_TOP_AND_BOT_PATTERN) {
63 automaton
64 } else {
65 panic!("Could not initialize GRID_TABLE_TOP_AND_BOT_AUTOMATON automaton. Computer says no...")
66 };
67
68 pub static ref SIMPLE_TABLE_TOP_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SIMPLE_TABLE_TOP_PATTERN) {
70 automaton
71 } else {
72 panic!("Could not initialize SIMPLE_TABLE_TOP_AUTOMATON automaton. Computer says no...")
73 };
74
75 pub static ref SIMPLE_TABLE_BOTTOM_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SIMPLE_TABLE_BOTTOM_PATTERN) {
77 automaton
78 } else {
79 panic!("Could not initialize SIMPLE_TABLE_BOTTOM_AUTOMATON automaton. Computer says no...")
80 };
81
82 pub static ref FOOTNOTE_AUTOMATON: regex::Regex = match regex::Regex::new(regex_patterns::FOOTNOTE_PATTERN) {
84 Ok(automaton) => automaton,
85 Err(e) => panic!("Could not initialize FOOTNOTE_AUTOMATON: {}. Computer says no...", e)
86 };
87
88 pub static ref MANUAL_FOOTNOTE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::MANUAL_FOOTNOTE_PATTERN) {
90 automaton
91 } else {
92 panic!("Could not initialize MANUAL_FOOTNOTE automaton. Computer says no...")
93 };
94
95 pub static ref AUTO_NUM_FOOTNOTE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::AUTO_NUM_FOOTNOTE_PATTERN) {
97 automaton
98 } else {
99 panic!("Could not initialize AUTO_NUM_FOOTNOTE automaton. Computer says no...")
100 };
101
102 pub static ref SIMPLE_NAME_FOOTNOTE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SIMPLE_NAME_FOOTNOTE_PATTERN) {
104 automaton
105 } else {
106 panic!("Could not initialize SIMPLE_NAME_FOOTNOTE automaton. Computer says no...")
107 };
108
109 pub static ref AUTO_SYM_FOOTNOTE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::AUTO_SYM_FOOTNOTE_PATTERN) {
111 automaton
112 } else {
113 panic!("Could not initialize AUTO_SYM_FOOTNOTE automaton. Computer says no...")
114 };
115
116 pub static ref CITATION_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::CITATION_PATTERN) {
118 automaton
119 } else {
120 panic!("Could not initialize CITATION automaton. Computer says no...")
121 };
122
123 pub static ref HYPERLINK_TARGET_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::HYPERLINK_TARGET_PATTERN) {
125 automaton
126 } else {
127 panic!("Could not initialize HYPERLINK_TARGET automaton. Computer says no...")
128 };
129
130 pub static ref SUBSTITUTION_DEF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SUBSTITUTION_DEF_PATTERN) {
132 automaton
133 } else {
134 panic!("Could not initialize SUBSTITUTION_DEF automaton. Computer says no...")
135 };
136
137 pub static ref DIRECTIVE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::DIRECTIVE_PATTERN) {
139 automaton
140 } else {
141 panic!("Could not initialize DIRECTIVE automaton. Computer says no...")
142 };
143
144 pub static ref COMMENT_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::COMMENT_PATTERN) {
146 automaton
147 } else {
148 panic!("Could not initialize COMMENT automaton. Computer says no...")
149 };
150
151 pub static ref LINE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::LINE_PATTERN) {
153 automaton
154 } else {
155 panic!("Could not initialize LINE automaton. Computer says no...")
156 };
157
158 pub static ref TEXT_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::TEXT_PATTERN) {
160 automaton
161 } else {
162 panic!("Could not initialize TEXT automaton. Computer says no...")
163 };
164
165 pub static ref STRONG_EMPH_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::STRONG_EMPH_PATTERN) {
167 automaton
168 } else {
169 panic!("Could not initialize STRONG_EMPH automaton. Computer says no...")
170 };
171
172 pub static ref EMPH_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::EMPH_PATTERN) {
174 automaton
175 } else {
176 panic!("Could not initialize EMPH automaton. Computer says no...")
177 };
178
179 pub static ref LITERAL_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::LITERAL_PATTERN) {
181 automaton
182 } else {
183 panic!("Could not initialize LITERAL automaton. Computer says no...")
184 };
185
186 pub static ref INLINE_TARGET_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::INLINE_TARGET_PATTERN) {
188 automaton
189 } else {
190 panic!("Could not initialize INLINE_TARGET automaton. Computer says no...")
191 };
192
193 pub static ref INTERPRETED_TEXT_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::INTERPRETED_TEXT_PATTERN) {
195 automaton
196 } else {
197 panic!("Could not initialize INTERPRETED_TEXT automaton. Computer says no...")
198 };
199
200 pub static ref PHRASE_REF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::PHRASE_REF_PATTERN) {
202 automaton
203 } else {
204 panic!("Could not initialize PHRASE_REF automaton. Computer says no...")
205 };
206
207 pub static ref SIMPLE_REF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SIMPLE_REF_PATTERN) {
209 automaton
210 } else {
211 panic!("Could not initialize SIMPLE_REF automaton. Computer says no...")
212 };
213
214 pub static ref FOOTNOTE_REF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::FOOTNOTE_REF_PATTERN) {
216 automaton
217 } else {
218 panic!("Could not initialize FOOTNOTE_REF automaton. Computer says no...")
219 };
220
221 pub static ref CITATION_REF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::CITATION_REF_PATTERN) {
223 automaton
224 } else {
225 panic!("Could not initialize CITATION_REF automaton. Computer says no...")
226 };
227
228 pub static ref SUBSTITUTION_REF_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::SUBSTITUTION_REF_PATTERN) {
230 automaton
231 } else {
232 panic!("Could not initialize SUBSTITUTION_REF automaton. Computer says no...")
233 };
234
235 pub static ref URI_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::URI_PATTERN) {
237 automaton
238 } else {
239 panic!("Could not initialize URI automaton. Computer says no...")
240 };
241
242 pub static ref APLUS_COL_BREAK_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::APLUS_COL_BREAK_PATTERN) {
246 automaton
247 } else {
248 panic!("Could not initialize APLUS_COL_BREAK automaton. Computer says no...")
249 };
250
251 pub static ref APLUS_QUESTIONNAIRE_DIRECTIVE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::APLUS_QUESTIONNAIRE_DIRECTIVE_PATTERN) {
253 automaton
254 } else {
255 panic!("Could not initialize APLUS_QUESTIONNAIRE_DIRECTIVE automaton. Computer says no...")
256 };
257
258 pub static ref APLUS_PICK_ONE_CHOICE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::APLUS_PICK_ONE_CHOICE_PATTERN) {
260 automaton
261 } else {
262 panic!("Could not initialize APLUS_PICK_ONE_CHOICE automaton. Computer says no...")
263 };
264
265 pub static ref APLUS_PICK_ANY_CHOICE_AUTOMATON: regex::Regex = if let Ok(automaton) = Regex::new(regex_patterns::APLUS_PICK_ANY_CHOICE_PATTERN) {
267 automaton
268 } else {
269 panic!("Could not initialize APLUS_PICK_ANY_CHOICE automaton. Computer says no...")
270 };
271
272}