Remove parsing logic
This commit is contained in:
parent
d8ec2e6c3a
commit
f6c249393b
7 changed files with 1 additions and 286 deletions
29
src/main.rs
29
src/main.rs
|
|
@ -1,14 +1,8 @@
|
|||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
use crate::parse::Parser;
|
||||
use crate::source::SourceFiles;
|
||||
|
||||
mod commands;
|
||||
mod parse;
|
||||
mod source;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
pub struct Opt {
|
||||
|
|
@ -18,26 +12,5 @@ pub struct Opt {
|
|||
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
|
||||
let mut files = SourceFiles::new();
|
||||
|
||||
let (file, content) = match files.load(&opt.file) {
|
||||
Ok(result) => result,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to load file: {}", e);
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
let mut parser = Parser::new(file, content);
|
||||
|
||||
let commands = match parser.parse(parse::parse_commands) {
|
||||
Ok(result) => result,
|
||||
Err(es) => {
|
||||
files.emit_all(&es);
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
println!("{:#?}", commands);
|
||||
println!("{:#?}", opt);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue