//! JavaScript engine — lexer, parser, bytecode, register VM, GC, JIT (AArch64). use std::fmt; /// An error produced by the JavaScript engine. #[derive(Debug)] pub enum JsError { /// The engine does not yet support this feature or syntax. NotImplemented, /// A parse/syntax error in the source. SyntaxError(String), /// A runtime error during execution. RuntimeError(String), } impl fmt::Display for JsError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { JsError::NotImplemented => write!(f, "not implemented"), JsError::SyntaxError(msg) => write!(f, "SyntaxError: {}", msg), JsError::RuntimeError(msg) => write!(f, "RuntimeError: {}", msg), } } } /// Evaluate a JavaScript source string and return the completion value. /// /// This is a stub that always returns `NotImplemented`. The real /// implementation will lex, parse, compile to bytecode, and execute. pub fn evaluate(_source: &str) -> Result<(), JsError> { Err(JsError::NotImplemented) }