add eval_input
This commit is contained in:
parent
c547d90d0b
commit
92be2066dc
|
@ -0,0 +1,17 @@
|
|||
use std::{io::{Read, stdin}, process::exit};
|
||||
|
||||
use brainrust::*;
|
||||
|
||||
fn main() {
|
||||
let mut str = String::new();
|
||||
stdin().read_to_string(&mut str).unwrap();
|
||||
|
||||
let eval_res = eval(&str.as_str());
|
||||
if eval_res.is_err() {
|
||||
let err = eval_res.unwrap_err();
|
||||
if err == "Stdin closed" {
|
||||
exit(0);
|
||||
}
|
||||
eprintln!("Program failed: {}", err);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ use brainrust::*;
|
|||
fn main() {
|
||||
let eval = eval(
|
||||
&(
|
||||
"+++++[>+++++++++<-],[[>--.++>+<<-]>+.->[<.>-]<<,]"
|
||||
"+[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+."
|
||||
)
|
||||
);
|
||||
if eval.is_err() {
|
||||
|
|
Loading…
Reference in New Issue