mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
PNC for Patterns, stabilize formatting
This commit is contained in:
parent
bac165fd99
commit
3b0db07fa1
78 changed files with 789 additions and 332 deletions
|
@ -10,6 +10,8 @@
|
|||
//!
|
||||
//! Note that `--release` is important, as this tool is very slow in debug mode.
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
use test_syntax::{
|
||||
minimize::{print_minimizations, Options},
|
||||
test_helpers::InputKind,
|
||||
|
@ -18,7 +20,7 @@ use test_syntax::{
|
|||
fn main() {
|
||||
let args = std::env::args().collect::<Vec<String>>();
|
||||
if args.len() < 3 || args.len() > 5 {
|
||||
eprintln!("Usage: {} [--minimize-full-error] [--minimize-initial-parse-error] [expr|full|moduledefs|header] <input>", args[0]);
|
||||
eprintln!("Usage: {} [--minimize-full-error] [--minimize-initial-parse-error] [expr|full|moduledefs|header|pattern] <input>", args[0]);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
|
@ -46,13 +48,21 @@ fn main() {
|
|||
"full" => InputKind::Full,
|
||||
"moduledefs" => InputKind::ModuleDefs,
|
||||
"header" => InputKind::Header,
|
||||
"pattern" => InputKind::Pattern,
|
||||
_ => {
|
||||
eprintln!("Invalid input kind: {}", args[index]);
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
let input = &args[index + 1];
|
||||
let mut buf = String::new();
|
||||
let text = if input == "-" {
|
||||
std::io::stdin().read_to_string(&mut buf).unwrap();
|
||||
buf.to_string()
|
||||
} else {
|
||||
std::fs::read_to_string(input).unwrap()
|
||||
};
|
||||
|
||||
let text = std::fs::read_to_string(&args[index + 1]).unwrap();
|
||||
let found_error = print_minimizations(&text, options);
|
||||
std::process::exit(if found_error { 0 } else { 1 });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue