1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
use compiler::CompileError; use thiserror::Error; use vm::RuntimeError; pub mod chunk; pub mod compiler; pub mod debug; pub mod value; pub mod vm; #[cfg(not(feature = "debug"))] pub const DEBUG: bool = false; #[cfg(feature = "debug")] pub const DEBUG: bool = true; #[cfg(not(feature = "super_debug"))] pub const SUPER_DEBUG: bool = false; #[cfg(feature = "super_debug")] pub const SUPER_DEBUG: bool = true; pub type InterpretResult<T> = Result<T, InterpretError>; #[derive(Error, Debug)] pub enum InterpretError { #[error("An unknown error has occurred.")] Unknown, #[error("An error occurred during compilation:\n{0}")] CompileError(#[from] CompileError), #[error("An error occurred during execution:\n{0}")] RuntimeError(#[from] RuntimeError), }