]>
Witch of Git - ivy/blob - src/main.rs
1 use ess
::{self, Sexp
, parser
::ParseError
};
2 use std
::io
::{self, Read
};
4 fn parse(input
: &str) -> Result
<Sexp
, ParseError
> {
5 let (sexp
, rest
) = ess
::parse_one(input
)?
;
6 if !rest
.trim().is
_empty
() {
7 return Err(ParseError
::Unexpected('
\0'
, sexp
.get_loc().1));
12 fn main() -> io
::Result
<()> {
13 let stdin
= std
::io
::stdin();
14 let mut text
= String
::new();
15 stdin
.lock().read_to_string(&mut text
)?
;
16 let item
= match parse(&text
) {
19 println
!("{:?}", err
);
20 std
::process
::exit(1);
23 println
!("{:?}", item
);