1use regex::Regex;
2
3pub struct MatlabPatterns {
4 external_patterns: Vec<Regex>,
5 cache_patterns: Vec<Regex>,
6 extensions: Vec<String>,
7}
8
9impl MatlabPatterns {
10 pub fn new() -> Self {
11 let external_patterns = vec![
12 Regex::new(r"\.p$").unwrap(),
14 Regex::new(r"\.mex").unwrap(),
15 Regex::new(r"\.mexw32$").unwrap(),
16 Regex::new(r"\.mexw64$").unwrap(),
17 Regex::new(r"\.mexa64$").unwrap(),
18 Regex::new(r"\.mexmaci64$").unwrap(),
19
20 Regex::new(r"\.asv$").unwrap(),
22 Regex::new(r"\.autosave$").unwrap(),
23
24 Regex::new(r"matlab_crash_dump\.").unwrap(),
26 Regex::new(r"\.tmp$").unwrap(),
27
28 Regex::new(r"\.slxc$").unwrap(),
30 Regex::new(r"\.slx\.autosave$").unwrap(),
31 Regex::new(r"\.mdl\.autosave$").unwrap(),
32
33 Regex::new(r"\.prj$").unwrap(),
35
36 Regex::new(r"codegen/").unwrap(),
38 Regex::new(r"slprj/").unwrap(),
39
40 Regex::new(r"\.ctf$").unwrap(),
42 Regex::new(r"\.exe$").unwrap(),
43 Regex::new(r"\.app$").unwrap(),
44
45 Regex::new(r"\.mlappinstall$").unwrap(),
47
48 Regex::new(r"\.rpt$").unwrap(),
50
51 Regex::new(r"profile_results").unwrap(),
53
54 Regex::new(r"html/").unwrap(),
56
57 Regex::new(r"\.tmp/").unwrap(),
59 Regex::new(r"tmp/").unwrap(),
60 Regex::new(r"\.swp$").unwrap(),
61 Regex::new(r"\.swo$").unwrap(),
62 Regex::new(r"~$").unwrap(),
63
64 Regex::new(r"\.bak$").unwrap(),
66 Regex::new(r"\.orig$").unwrap(),
67
68 Regex::new(r"\.log$").unwrap(),
70 Regex::new(r"logs/").unwrap(),
71 ];
72
73 let cache_patterns = vec![
74 Regex::new(r"\.asv$").unwrap(),
76
77 Regex::new(r"codegen/").unwrap(),
79 Regex::new(r"slprj/").unwrap(),
80
81 Regex::new(r"\.p$").unwrap(),
83 Regex::new(r"\.mex").unwrap(),
84
85 Regex::new(r"html/").unwrap(),
87 ];
88
89 let extensions = vec![
90 "m".to_string(),
92
93 "mlx".to_string(),
95
96 "mlapp".to_string(),
98
99 "slx".to_string(),
101 "mdl".to_string(),
102
103 "p".to_string(),
105
106 "mat".to_string(),
108
109 "fig".to_string(),
111
112 "prj".to_string(),
114
115 "yml".to_string(),
117 "yaml".to_string(),
118 "json".to_string(),
119 "xml".to_string(),
120
121 "md".to_string(),
123 "rst".to_string(),
124 "txt".to_string(),
125
126 "csv".to_string(),
128 "tsv".to_string(),
129 "xlsx".to_string(),
130 "xls".to_string(),
131
132 "png".to_string(),
134 "jpg".to_string(),
135 "jpeg".to_string(),
136 "gif".to_string(),
137 "bmp".to_string(),
138 "tiff".to_string(),
139 "eps".to_string(),
140 "pdf".to_string(),
141
142 "c".to_string(),
144 "cpp".to_string(),
145 "h".to_string(),
146 "hpp".to_string(),
147
148 "f".to_string(),
150 "f90".to_string(),
151 "f95".to_string(),
152
153 "sh".to_string(),
155 "bash".to_string(),
156 "bat".to_string(),
157 "ps1".to_string(),
158 ];
159
160 Self {
161 external_patterns,
162 cache_patterns,
163 extensions,
164 }
165 }
166
167 pub fn get_external_patterns(&self) -> &[Regex] {
168 &self.external_patterns
169 }
170
171 pub fn get_cache_patterns(&self) -> &[Regex] {
172 &self.cache_patterns
173 }
174
175 pub fn get_extensions(&self) -> &[String] {
176 &self.extensions
177 }
178
179 pub fn get_script_names() -> Vec<&'static str> {
180 vec![
181 "startup.m", "finish.m", "pathdef.m",
183
184 "Contents.m", "info.xml",
186
187 "make.m", "build.m", "setup.m",
189
190 "runtests.m", "test.m",
192
193 "App.mlapp", "main.mlapp",
195
196 "model.slx", "library.slx",
198
199 "compile.m", "package.m",
201
202 ".github/workflows/matlab.yml",
204 ".travis.yml", "appveyor.yml",
205 "azure-pipelines.yml",
206
207 "Dockerfile", "docker-compose.yml",
209
210 ".editorconfig", ".gitignore",
212 ".gitattributes",
213
214 "run.sh", "build.sh", "deploy.sh",
216 "install.sh", "test.sh",
217 "run.bat", "build.bat",
218
219 "README.md", "CHANGELOG.md",
221 "LICENSE", "LICENCE",
222
223 "license.txt", "getting_started.mlx",
225 "examples.mlx", "demo.m",
226 ]
227 }
228
229 pub fn get_common_directories() -> Vec<&'static str> {
230 vec![
231 "src/", "lib/", "functions/",
233
234 "tests/", "test/", "unit_tests/",
236
237 "doc/", "docs/", "help/",
239 "examples/", "demos/",
240
241 "build/", "dist/", "codegen/",
243 "slprj/", "html/",
244
245 "data/", "datasets/", "results/",
247
248 "resources/", "assets/", "images/",
250
251 "tools/", "utils/", "utilities/",
253
254 "config/", "settings/",
256
257 "apps/", "gui/",
259
260 "models/", "simulink/",
262
263 "scripts/", "batch/",
265
266 "output/", "figures/", "plots/",
268 ]
269 }
270}