extern crate modelica_parser; use std::env; use std::io::Read; use std::fs::File; use std::process::exit; fn main() { let args: Vec = 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::parse_model(&striped); match result { Ok(_) => println!("=== {}: OK", input), Err(err) => println!("=== {}: ERROR\n{}", input, modelica_parser::pp_parseerror(&striped, err)), } } }