30 lines
612 B
Rust
30 lines
612 B
Rust
use clap::Parser;
|
|
use ngr::syntax::{ParserError, Program};
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[clap(author, version, about, long_about = None)]
|
|
struct CommandLineArguments {
|
|
/// Optional output file name
|
|
#[clap(short, long)]
|
|
output: Option<String>,
|
|
|
|
/// The file to parse
|
|
file: String
|
|
}
|
|
|
|
fn real_main() -> Result<(), ParserError> {
|
|
let args = CommandLineArguments::parse();
|
|
|
|
let program = Program::from_file(&args.file)?;
|
|
println!("args: {:?}", args);
|
|
println!("program: {:?}", program);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
if let Err(e) = real_main() {
|
|
println!("{}", e);
|
|
}
|
|
}
|