blob: fe87ef0b921b56b657288e76b2febf5b77a52c70 (
plain)
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
|
extern crate modelica_parser;
use std::env;
use std::io::Read;
use std::fs::File;
use std::process::exit;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() <= 1 {
println!("I'm a modelica parser! Pass me one or more files to parse...");
exit(-1);
}
for input in &args[1..] {
let mut raw = String::new();
if let Err(err) = File::open(input).and_then(|mut f| f.read_to_string(&mut raw)) {
println!("=== {}: I/O Error {}",
input, err);
continue;
}
let striped = modelica_parser::strip_comments(&raw);
let result = modelica_parser::parser::parse_file(&striped);
match result {
Ok(_) => println!("=== {}: OK", input),
Err(err) => println!("=== {}: ERROR\n{}", input, modelica_parser::pp_parseerror(&striped, err)),
}
}
}
|