Accept more than one specification file

This commit is contained in:
Patrick Lühne 2020-05-29 18:53:42 +02:00
parent 27fff47c91
commit f169931eac
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 25 additions and 21 deletions

View File

@ -1,12 +1,15 @@
pub fn run<P>(program_path: P, specification_path: P,
pub fn run<P1, P2>(program_path: P1, specification_paths: &[P2],
proof_direction: crate::problem::ProofDirection, no_simplify: bool,
color_choice: crate::output::ColorChoice)
where
P: AsRef<std::path::Path>,
P1: AsRef<std::path::Path>,
P2: AsRef<std::path::Path>,
{
let mut problem = crate::Problem::new(color_choice);
log::info!("reading specification “{}”", specification_path.as_ref().display());
for specification_path in specification_paths
{
log::info!("reading specification file “{}”", specification_path.as_ref().display());
let specification_content = match std::fs::read_to_string(specification_path.as_ref())
{
@ -21,11 +24,12 @@ where
// TODO: rename to read_specification
if let Err(error) = crate::input::parse_specification(&specification_content, &mut problem)
{
log::error!("could not read specification: {}", error);
log::error!("could not read specification file: {}", error);
std::process::exit(1)
}
log::info!("read specification “{}”", specification_path.as_ref().display());
}
problem.process_output_predicates();

View File

@ -13,8 +13,8 @@ enum Command
program_path: std::path::PathBuf,
#[structopt(name = "specification", parse(from_os_str), required(true))]
/// Specification file path
specification_path: std::path::PathBuf,
/// One or more specification file paths
specification_paths: Vec<std::path::PathBuf>,
/// Proof direction (forward, backward, both)
#[structopt(long, default_value = "forward")]
@ -41,12 +41,12 @@ fn main()
Command::VerifyProgram
{
program_path,
specification_path,
specification_paths,
proof_direction,
no_simplify,
color_choice,
}
=> anthem::commands::verify_program::run(&program_path, &specification_path,
=> anthem::commands::verify_program::run(&program_path, specification_paths.as_slice(),
proof_direction, no_simplify, color_choice),
}
}