1#![allow(dead_code)]
7
8pub mod ast;
9pub mod bigint;
10pub mod builtins;
11pub mod collate;
12pub mod cycle_gc;
13pub mod fn_meta;
14pub mod gc_policy;
15pub mod host;
16pub mod interp;
17pub mod lexer;
18pub mod numfmt;
19pub mod numloc;
20pub mod parser;
21pub mod regex;
22pub mod regex_syntax;
23pub mod uncaught;
24pub mod value;
25
26pub use interp::JsRuntime;
27pub use lexer::Lexer;
28pub use parser::Parser;
29pub use value::Value;
30
31pub fn parse_script(source: &str) -> ast::Program {
37 parser::note_parse(2, source.len());
38 Parser::new(Lexer::new(source)).parse_program()
39}
40
41pub fn parse_script_reporting(source: &str) -> (ast::Program, alloc::vec::Vec<parser::ParseError>) {
46 parser::note_parse(2, source.len());
47 Parser::new(Lexer::new(source)).parse_program_reporting()
48}
49
50pub fn eval(source: &str, runtime: &mut JsRuntime) -> Result<Value, alloc::string::String> {
52 runtime.eval(source)
53}