diff options
Diffstat (limited to 'autochomp/src/main.rs')
-rw-r--r-- | autochomp/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/autochomp/src/main.rs b/autochomp/src/main.rs index 400cc2d..9b3b521 100644 --- a/autochomp/src/main.rs +++ b/autochomp/src/main.rs @@ -1,6 +1,11 @@ -use std::{error::Error, io::{self, Read, Write}, process::exit}; +use std::{ + error::Error, + fs, + io::{self, Read, Write}, + process::exit, +}; -use chewed::Parse; +use chewed::{IterWrapper, Parser}; mod nibble { include!(concat!(env!("OUT_DIR"), "/nibble.rs")); @@ -11,7 +16,11 @@ fn main() { let res = io::stdin() .read_to_string(&mut input) .map_err(|e| Box::new(e) as Box<dyn Error>) - .and_then(|_| nibble::Ast::parse(input.chars().peekable()).map_err(|e| Box::new(e) as Box<dyn Error>)) + .and_then(|_| { + IterWrapper::new(input.chars()) + .parse::<nibble::Ast>() + .map_err(|e| Box::new(e) as Box<dyn Error>) + }) .and_then(|ast| { write!(io::stdout(), "{:?}", ast).map_err(|e| Box::new(e) as Box<dyn Error>) }); |