]> Witch of Git - ivy/blob - src/lib.rs
[tools] Move ANSI color printing code into its own file
[ivy] / src / lib.rs
1 use ess::{self, parser::ParseError, Sexp};
2
3 pub mod ast;
4 pub mod trans;
5
6 pub fn parse(input: &str) -> Result<Sexp, ParseError> {
7 let (mut sexps, error) = ess::parse(input);
8 if let Some(err) = error {
9 return Err(err);
10 }
11
12 if sexps.len() > 1 {
13 return Err(ParseError::Sexp(
14 Box::new(ParseError::Unexpected('\0', sexps[1].get_loc().0)),
15 *sexps[1].get_loc(),
16 ));
17 }
18 Ok(sexps.remove(0))
19 }
20
21 pub static BUILTINS: &[&str] = &[
22 "debug", "true", "false", "<", ">", "<=", ">=", "==", "!=", "+", "-", "*", "/", "%",
23 ];