diff --git a/rule-preprocessor/src/main.rs b/rule-preprocessor/src/main.rs index afd92a36..83fcd442 100644 --- a/rule-preprocessor/src/main.rs +++ b/rule-preprocessor/src/main.rs @@ -19,11 +19,13 @@ use semantic::SemanticAnalysis; use syntactic::SyntacticAnalysis; fn main() { - let out_dir = std::env::args() - .nth(1) - .expect("usage: rule-preprocessor "); + let mut args = std::env::args().skip(1); + let out_dir = args + .next() + .expect("usage: rule-preprocessor [rules-crate-dir]"); + let in_dir = args.next().unwrap_or_else(|| "../rules".to_string()); SemanticAnalysis::run(SyntacticAnalysis::run( - &std::fs::canonicalize("../rules").unwrap(), + &std::fs::canonicalize(&in_dir).unwrap(), )) .write_ir(&std::path::PathBuf::from(out_dir)); }