2022-08-24 15:03:17 +02:00
|
|
|
mod builtins;
|
2022-08-25 17:00:05 +02:00
|
|
|
mod chunk;
|
|
|
|
mod compiler;
|
|
|
|
mod errors;
|
|
|
|
mod eval;
|
2022-09-04 17:43:28 +02:00
|
|
|
pub mod observer;
|
2022-08-25 17:00:05 +02:00
|
|
|
mod opcode;
|
2022-10-13 14:23:45 +02:00
|
|
|
mod pretty_ast;
|
2022-10-04 16:05:34 +02:00
|
|
|
mod source;
|
2022-10-06 13:33:09 +02:00
|
|
|
mod spans;
|
2022-10-12 11:26:40 +02:00
|
|
|
mod systems;
|
2022-08-29 17:07:58 +02:00
|
|
|
mod upvalues;
|
2022-08-25 17:00:05 +02:00
|
|
|
mod value;
|
|
|
|
mod vm;
|
2022-08-12 16:07:32 +02:00
|
|
|
mod warnings;
|
2022-08-25 17:00:05 +02:00
|
|
|
|
2022-10-10 20:43:51 +02:00
|
|
|
mod nix_search_path;
|
2022-09-17 19:50:58 +02:00
|
|
|
#[cfg(test)]
|
|
|
|
mod properties;
|
2022-08-25 17:00:05 +02:00
|
|
|
#[cfg(test)]
|
2022-09-18 18:38:53 +02:00
|
|
|
mod test_utils;
|
|
|
|
#[cfg(test)]
|
2022-08-25 17:00:05 +02:00
|
|
|
mod tests;
|
|
|
|
|
2022-11-05 12:57:33 +01:00
|
|
|
use std::rc::Rc;
|
|
|
|
|
2022-09-04 17:43:28 +02:00
|
|
|
// Re-export the public interface used by other crates.
|
|
|
|
pub use crate::builtins::global_builtins;
|
2022-10-26 14:16:04 +02:00
|
|
|
pub use crate::compiler::{compile, prepare_globals};
|
2022-11-06 00:50:31 +01:00
|
|
|
pub use crate::errors::{ErrorKind, EvalResult};
|
2022-09-18 21:59:59 +02:00
|
|
|
pub use crate::eval::{interpret, Options};
|
2022-10-13 14:23:45 +02:00
|
|
|
pub use crate::pretty_ast::pretty_print_expr;
|
2022-10-04 16:05:34 +02:00
|
|
|
pub use crate::source::SourceCode;
|
2022-11-06 00:50:31 +01:00
|
|
|
pub use crate::value::{Builtin, Value};
|
|
|
|
pub use crate::vm::{run_lambda, VM};
|
2022-11-05 12:57:33 +01:00
|
|
|
|
|
|
|
// TODO: use Rc::unwrap_or_clone once it is stabilised.
|
|
|
|
// https://doc.rust-lang.org/std/rc/struct.Rc.html#method.unwrap_or_clone
|
|
|
|
pub fn unwrap_or_clone_rc<T: Clone>(rc: Rc<T>) -> T {
|
|
|
|
Rc::try_unwrap(rc).unwrap_or_else(|rc| (*rc).clone())
|
|
|
|
}
|