diff --git a/src/ast.rs b/src/ast.rs index 44847ac7..6626d595 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -12,17 +12,10 @@ use crate::INT; #[cfg(not(feature = "no_float"))] use crate::FLOAT; -#[cfg(not(feature = "no_index"))] -use crate::engine::Array; - -#[cfg(not(feature = "no_object"))] -use crate::engine::Map; - #[cfg(not(feature = "no_module"))] use crate::engine::Imports; use crate::stdlib::{ - any::TypeId, borrow::Cow, boxed::Box, collections::HashMap, @@ -141,14 +134,12 @@ impl AST { pub fn new(statements: Vec, lib: Module) -> Self { Self(statements, lib) } - /// Get the statements. #[cfg(not(feature = "internals"))] #[inline(always)] pub(crate) fn statements(&self) -> &[Stmt] { &self.0 } - /// _[INTERNALS]_ Get the statements. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] @@ -157,21 +148,18 @@ impl AST { pub fn statements(&self) -> &[Stmt] { &self.0 } - /// Get a mutable reference to the statements. #[cfg(not(feature = "no_optimize"))] #[inline(always)] pub(crate) fn statements_mut(&mut self) -> &mut Vec { &mut self.0 } - /// Get the internal `Module` containing all script-defined functions. #[cfg(not(feature = "internals"))] #[inline(always)] pub(crate) fn lib(&self) -> &Module { &self.1 } - /// _[INTERNALS]_ Get the internal `Module` containing all script-defined functions. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] @@ -180,7 +168,6 @@ impl AST { pub fn lib(&self) -> &Module { &self.1 } - /// Clone the `AST`'s functions into a new `AST`. /// No statements are cloned. /// @@ -190,7 +177,6 @@ impl AST { pub fn clone_functions_only(&self) -> Self { self.clone_functions_only_filtered(|_, _, _| true) } - /// Clone the `AST`'s functions into a new `AST` based on a filter predicate. /// No statements are cloned. /// @@ -205,14 +191,12 @@ impl AST { functions.merge_filtered(&self.1, &mut filter); Self(Default::default(), functions) } - /// Clone the `AST`'s script statements into a new `AST`. /// No functions are cloned. #[inline(always)] pub fn clone_statements_only(&self) -> Self { Self(self.0.clone(), Default::default()) } - /// Merge two `AST` into one. Both `AST`'s are untouched and a new, merged, version /// is returned. /// @@ -266,7 +250,6 @@ impl AST { pub fn merge(&self, other: &Self) -> Self { self.merge_filtered(other, |_, _, _| true) } - /// Combine one `AST` with another. The second `AST` is consumed. /// /// Statements in the second `AST` are simply appended to the end of the first _without any processing_. @@ -319,7 +302,6 @@ impl AST { pub fn combine(&mut self, other: Self) -> &mut Self { self.combine_filtered(other, |_, _, _| true) } - /// Merge two `AST` into one. Both `AST`'s are untouched and a new, merged, version /// is returned. /// @@ -395,7 +377,6 @@ impl AST { Self::new(ast, functions) } - /// Combine one `AST` with another. The second `AST` is consumed. /// /// Statements in the second `AST` are simply appended to the end of the first _without any processing_. @@ -457,7 +438,6 @@ impl AST { functions.merge_filtered(&other.1, &mut filter); self } - /// Filter out the functions, retaining only some based on a filter predicate. /// /// # Example @@ -486,7 +466,6 @@ impl AST { pub fn retain_functions(&mut self, filter: impl FnMut(FnAccess, &str, usize) -> bool) { self.1.retain_functions(filter); } - /// Iterate through all functions #[cfg(not(feature = "no_function"))] #[inline(always)] @@ -495,14 +474,12 @@ impl AST { ) -> impl Iterator)> + 'a { self.1.iter_script_fn() } - /// Clear all function definitions in the `AST`. #[cfg(not(feature = "no_function"))] #[inline(always)] pub fn clear_functions(&mut self) { self.1 = Default::default(); } - /// Clear all statements in the `AST`, leaving only function definitions. #[inline(always)] pub fn clear_statements(&mut self) { @@ -656,7 +633,6 @@ impl Stmt { _ => false, } } - /// Get the `Position` of this statement. pub fn position(&self) -> Position { match self { @@ -685,7 +661,6 @@ impl Stmt { Self::Share(x) => x.pos, } } - /// Override the `Position` of this statement. pub fn set_position(&mut self, new_pos: Position) -> &mut Self { match self { @@ -718,7 +693,6 @@ impl Stmt { self } - /// Is this statement self-terminated (i.e. no need for a semicolon terminator)? pub fn is_self_terminated(&self) -> bool { match self { @@ -747,7 +721,6 @@ impl Stmt { Self::Share(_) => false, } } - /// Is this statement _pure_? pub fn is_pure(&self) -> bool { match self { @@ -861,6 +834,8 @@ pub struct FnCallExpr { #[derive(Debug, Clone)] pub enum Expr { /// Dynamic constant. + /// Used to hold either an Array or Map literal for quick cloning. + /// All other primitive data types should use the appropriate variants for better speed. DynamicConstant(Box, Position), /// Integer constant. IntegerConstant(INT, Position), @@ -924,35 +899,6 @@ impl Default for Expr { } impl Expr { - /// Get the type of an expression. - /// - /// Returns `None` if the expression's result type is not constant. - pub fn get_type_id(&self) -> Option { - Some(match self { - Self::Expr(x) => return x.get_type_id(), - - Self::DynamicConstant(x, _) => x.type_id(), - Self::IntegerConstant(_, _) => TypeId::of::(), - #[cfg(not(feature = "no_float"))] - Self::FloatConstant(_, _) => TypeId::of::(), - Self::CharConstant(_, _) => TypeId::of::(), - Self::StringConstant(_, _) => TypeId::of::(), - Self::FnPointer(_, _) => TypeId::of::(), - Self::True(_) | Self::False(_) | Self::In(_, _) | Self::And(_, _) | Self::Or(_, _) => { - TypeId::of::() - } - Self::Unit(_) => TypeId::of::<()>(), - - #[cfg(not(feature = "no_index"))] - Self::Array(_, _) => TypeId::of::(), - - #[cfg(not(feature = "no_object"))] - Self::Map(_, _) => TypeId::of::(), - - _ => return None, - }) - } - /// Get the `Dynamic` value of a constant expression. /// /// Returns `None` if the expression is not constant. @@ -991,7 +937,6 @@ impl Expr { _ => return None, }) } - /// Is the expression a simple variable access? pub(crate) fn get_variable_access(&self, non_qualified: bool) -> Option<&str> { match self { @@ -999,7 +944,6 @@ impl Expr { _ => None, } } - /// Get the `Position` of the expression. pub fn position(&self) -> Position { match self { @@ -1030,7 +974,6 @@ impl Expr { Self::Custom(_, pos) => *pos, } } - /// Override the `Position` of the expression. pub fn set_position(&mut self, new_pos: Position) -> &mut Self { match self { @@ -1061,7 +1004,6 @@ impl Expr { self } - /// Is the expression pure? /// /// A pure expression has no side effects. @@ -1084,7 +1026,6 @@ impl Expr { _ => self.is_constant(), } } - /// Is the expression the unit `()` literal? #[inline(always)] pub fn is_unit(&self) -> bool { @@ -1093,7 +1034,6 @@ impl Expr { _ => false, } } - /// Is the expression a constant? pub fn is_constant(&self) -> bool { match self { @@ -1127,7 +1067,6 @@ impl Expr { _ => false, } } - /// Is a particular token allowed as a postfix operator to this expression? pub fn is_valid_postfix(&self, token: &Token) -> bool { match self { diff --git a/src/dynamic.rs b/src/dynamic.rs index 3ad3ea11..3ad4f10f 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -263,7 +263,6 @@ impl Dynamic { _ => false, } } - /// Does this `Dynamic` hold a shared data type /// instead of one of the supported system primitive types? #[inline(always)] @@ -274,7 +273,6 @@ impl Dynamic { _ => false, } } - /// Is the value held by this `Dynamic` a particular type? /// /// If the `Dynamic` is a Shared variant checking is performed on @@ -289,7 +287,6 @@ impl Dynamic { self.type_id() == target_type_id } - /// Get the TypeId of the value held by this `Dynamic`. /// /// # Panics or Deadlocks When Value is Shared @@ -323,7 +320,6 @@ impl Dynamic { Union::Shared(cell) => (*cell.read().unwrap()).type_id(), } } - /// Get the name of the type of the value held by this `Dynamic`. /// /// # Panics or Deadlocks When Value is Shared diff --git a/src/engine_api.rs b/src/engine_api.rs index ecfa96a0..3fc8891e 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -84,7 +84,6 @@ impl Engine { self.global_module.set_raw_fn(name, arg_types, func); self } - /// Register a custom type for use with the `Engine`. /// The type must implement `Clone`. /// @@ -126,7 +125,6 @@ impl Engine { pub fn register_type(&mut self) -> &mut Self { self.register_type_with_name::(type_name::()) } - /// Register a custom type for use with the `Engine`, with a pretty-print name /// for the `type_of` function. The type must implement `Clone`. /// @@ -177,7 +175,6 @@ impl Engine { self.type_names.insert(type_name::().into(), name.into()); self } - /// Register an iterator adapter for an iterable type with the `Engine`. /// This is an advanced feature. #[inline(always)] @@ -189,7 +186,6 @@ impl Engine { self.global_module.set_iterable::(); self } - /// Register a getter function for a member of a registered type with the `Engine`. /// /// The function signature must start with `&mut self` and not `&self`. @@ -238,7 +234,6 @@ impl Engine { { self.register_fn(&make_getter(name), callback) } - /// Register a getter function for a member of a registered type with the `Engine`. /// Returns `Result>`. /// @@ -286,7 +281,6 @@ impl Engine { ) -> &mut Self { self.register_result_fn(&make_getter(name), callback) } - /// Register a setter function for a member of a registered type with the `Engine`. /// /// # Example @@ -336,7 +330,6 @@ impl Engine { { self.register_fn(&make_setter(name), callback) } - /// Register a setter function for a member of a registered type with the `Engine`. /// Returns `Result<(), Box>`. /// @@ -392,7 +385,6 @@ impl Engine { callback(obj, value).map(Into::into) }) } - /// Short-hand for registering both getter and setter functions /// of a registered type with the `Engine`. /// @@ -445,7 +437,6 @@ impl Engine { { self.register_get(name, get_fn).register_set(name, set_fn) } - /// Register an index getter for a custom type with the `Engine`. /// /// The function signature must start with `&mut self` and not `&self`. @@ -514,7 +505,6 @@ impl Engine { self.register_fn(FN_IDX_GET, callback) } - /// Register an index getter for a custom type with the `Engine`. /// Returns `Result>`. /// @@ -585,7 +575,6 @@ impl Engine { self.register_result_fn(FN_IDX_GET, callback) } - /// Register an index setter for a custom type with the `Engine`. /// /// # Panics @@ -654,7 +643,6 @@ impl Engine { self.register_fn(FN_IDX_SET, callback) } - /// Register an index setter for a custom type with the `Engine`. /// Returns `Result<(), Box>`. /// @@ -729,7 +717,6 @@ impl Engine { callback(obj, index, value).map(Into::into) }) } - /// Short-hand for register both index getter and setter functions for a custom type with the `Engine`. /// /// # Panics @@ -785,7 +772,6 @@ impl Engine { self.register_indexer_get(getter) .register_indexer_set(setter) } - /// Compile a string into an `AST`, which can be used later for evaluation. /// /// # Example @@ -809,7 +795,6 @@ impl Engine { pub fn compile(&self, script: &str) -> Result { self.compile_with_scope(&Default::default(), script) } - /// Compile a string into an `AST` using own scope, which can be used later for evaluation. /// /// The scope is useful for passing constants into the script for optimization @@ -852,7 +837,6 @@ impl Engine { pub fn compile_with_scope(&self, scope: &Scope, script: &str) -> Result { self.compile_scripts_with_scope(scope, &[script]) } - /// When passed a list of strings, first join the strings into one large script, /// and then compile them into an `AST` using own scope, which can be used later for evaluation. /// @@ -907,7 +891,6 @@ impl Engine { ) -> Result { self.compile_with_scope_and_optimization_level(scope, scripts, self.optimization_level) } - /// Join a list of strings and compile into an `AST` using own scope at a specific optimization level. #[inline(always)] pub(crate) fn compile_with_scope_and_optimization_level( @@ -920,7 +903,6 @@ impl Engine { let stream = self.lex(scripts, None); self.parse(hash, &mut stream.peekable(), scope, optimization_level) } - /// Read the contents of a file into a string. #[cfg(not(feature = "no_std"))] #[cfg(not(target_arch = "wasm32"))] @@ -944,7 +926,6 @@ impl Engine { Ok(contents) } - /// Compile a script file into an `AST`, which can be used later for evaluation. /// /// # Example @@ -971,7 +952,6 @@ impl Engine { pub fn compile_file(&self, path: PathBuf) -> Result> { self.compile_file_with_scope(&Default::default(), path) } - /// Compile a script file into an `AST` using own scope, which can be used later for evaluation. /// /// The scope is useful for passing constants into the script for optimization @@ -1013,7 +993,6 @@ impl Engine { ) -> Result> { Self::read_file(path).and_then(|contents| Ok(self.compile_with_scope(scope, &contents)?)) } - /// Parse a JSON string into a map. /// /// The JSON string must be an object hash. It cannot be a simple JavaScript primitive. @@ -1098,7 +1077,6 @@ impl Engine { self.eval_ast_with_scope(&mut scope, &ast) } - /// Compile a string containing an expression into an `AST`, /// which can be used later for evaluation. /// @@ -1123,7 +1101,6 @@ impl Engine { pub fn compile_expression(&self, script: &str) -> Result { self.compile_expression_with_scope(&Default::default(), script) } - /// Compile a string containing an expression into an `AST` using own scope, /// which can be used later for evaluation. /// @@ -1176,7 +1153,6 @@ impl Engine { let mut peekable = stream.peekable(); self.parse_global_expr(hash, &mut peekable, scope, self.optimization_level) } - /// Evaluate a script file. /// /// # Example @@ -1198,7 +1174,6 @@ impl Engine { pub fn eval_file(&self, path: PathBuf) -> Result> { Self::read_file(path).and_then(|contents| self.eval::(&contents)) } - /// Evaluate a script file with own scope. /// /// # Example @@ -1228,7 +1203,6 @@ impl Engine { ) -> Result> { Self::read_file(path).and_then(|contents| self.eval_with_scope::(scope, &contents)) } - /// Evaluate a string. /// /// # Example @@ -1247,7 +1221,6 @@ impl Engine { pub fn eval(&self, script: &str) -> Result> { self.eval_with_scope(&mut Default::default(), script) } - /// Evaluate a string with own scope. /// /// # Example @@ -1283,7 +1256,6 @@ impl Engine { )?; self.eval_ast_with_scope(scope, &ast) } - /// Evaluate a string containing an expression. /// /// # Example @@ -1305,7 +1277,6 @@ impl Engine { ) -> Result> { self.eval_expression_with_scope(&mut Default::default(), script) } - /// Evaluate a string containing an expression with own scope. /// /// # Example @@ -1340,7 +1311,6 @@ impl Engine { self.eval_ast_with_scope(scope, &ast) } - /// Evaluate an `AST`. /// /// # Example @@ -1363,7 +1333,6 @@ impl Engine { pub fn eval_ast(&self, ast: &AST) -> Result> { self.eval_ast_with_scope(&mut Default::default(), ast) } - /// Evaluate an `AST` with own scope. /// /// # Example @@ -1413,7 +1382,6 @@ impl Engine { .into() }); } - /// Evaluate an `AST` with own scope. #[inline(always)] pub(crate) fn eval_ast_with_scope_raw<'a>( @@ -1424,7 +1392,6 @@ impl Engine { ) -> Result<(Dynamic, u64), Box> { self.eval_statements_raw(scope, mods, ast.statements(), &[ast.lib()]) } - /// Evaluate a file, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[cfg(not(feature = "no_std"))] @@ -1433,7 +1400,6 @@ impl Engine { pub fn consume_file(&self, path: PathBuf) -> Result<(), Box> { Self::read_file(path).and_then(|contents| self.consume(&contents)) } - /// Evaluate a file with own scope, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[cfg(not(feature = "no_std"))] @@ -1446,14 +1412,12 @@ impl Engine { ) -> Result<(), Box> { Self::read_file(path).and_then(|contents| self.consume_with_scope(scope, &contents)) } - /// Evaluate a string, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[inline(always)] pub fn consume(&self, script: &str) -> Result<(), Box> { self.consume_with_scope(&mut Default::default(), script) } - /// Evaluate a string with own scope, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[inline] @@ -1468,14 +1432,12 @@ impl Engine { let ast = self.parse(hash, &mut stream.peekable(), scope, self.optimization_level)?; self.consume_ast_with_scope(scope, &ast) } - /// Evaluate an AST, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[inline(always)] pub fn consume_ast(&self, ast: &AST) -> Result<(), Box> { self.consume_ast_with_scope(&mut Default::default(), ast) } - /// Evaluate an `AST` with own scope, but throw away the result and only return error (if any). /// Useful for when you don't need the result, but still need to keep track of possible errors. #[inline(always)] @@ -1488,7 +1450,6 @@ impl Engine { self.eval_statements_raw(scope, &mut mods, ast.statements(), &[ast.lib()]) .map(|_| ()) } - /// Call a script function defined in an `AST` with multiple arguments. /// Arguments are passed as a tuple. /// @@ -1551,7 +1512,6 @@ impl Engine { .into() }); } - /// Call a script function defined in an `AST` with multiple `Dynamic` arguments /// and optionally a value for binding to the 'this' pointer. /// @@ -1615,7 +1575,6 @@ impl Engine { self.call_fn_dynamic_raw(scope, &[lib.as_ref()], name, &mut this_ptr, args.as_mut()) } - /// Call a script function defined in an `AST` with multiple `Dynamic` arguments. /// /// ## WARNING @@ -1649,7 +1608,6 @@ impl Engine { self.call_script_fn(scope, &mut mods, &mut state, lib, this_ptr, fn_def, args, 0) } - /// Optimize the `AST` with constants defined in an external Scope. /// An optimized copy of the `AST` is returned while the original `AST` is consumed. /// @@ -1683,7 +1641,6 @@ impl Engine { let stmt = mem::take(ast.statements_mut()); optimize_into_ast(self, scope, stmt, lib, optimization_level) } - /// Provide a callback that will be invoked before each variable access. /// /// ## Return Value of Callback @@ -1726,7 +1683,6 @@ impl Engine { self.resolve_var = Some(Box::new(callback)); self } - /// Register a callback for script evaluation progress. /// /// # Example @@ -1769,7 +1725,6 @@ impl Engine { self.progress = Some(Box::new(callback)); self } - /// Override default action of `print` (print to stdout using `println!`) /// /// # Example @@ -1799,7 +1754,6 @@ impl Engine { self.print = Box::new(callback); self } - /// Override default action of `debug` (print to stdout using `println!`) /// /// # Example diff --git a/src/engine_settings.rs b/src/engine_settings.rs index b6d7cfd9..aebcfdb3 100644 --- a/src/engine_settings.rs +++ b/src/engine_settings.rs @@ -27,7 +27,6 @@ impl Engine { self.packages.push(package.into()); self } - /// Control whether and how the `Engine` will optimize an AST after compilation. /// /// Not available under the `no_optimize` feature. @@ -37,7 +36,6 @@ impl Engine { self.optimization_level = optimization_level; self } - /// The current optimization level. /// It controls whether and how the `Engine` will optimize an AST after compilation. /// @@ -47,7 +45,6 @@ impl Engine { pub fn optimization_level(&self) -> OptimizationLevel { self.optimization_level } - /// Set the maximum levels of function calls allowed for a script in order to avoid /// infinite recursion and stack overflows. #[cfg(not(feature = "unchecked"))] @@ -56,14 +53,12 @@ impl Engine { self.limits.max_call_stack_depth = levels; self } - /// The maximum levels of function calls allowed for a script. #[cfg(not(feature = "unchecked"))] #[inline(always)] pub fn max_call_levels(&self) -> usize { self.limits.max_call_stack_depth } - /// Set the maximum number of operations allowed for a script to run to avoid /// consuming too much resources (0 for unlimited). #[cfg(not(feature = "unchecked"))] @@ -76,14 +71,12 @@ impl Engine { }; self } - /// The maximum number of operations allowed for a script to run (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[inline(always)] pub fn max_operations(&self) -> u64 { self.limits.max_operations } - /// Set the maximum number of imported modules allowed for a script. #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_module"))] @@ -92,7 +85,6 @@ impl Engine { self.limits.max_modules = modules; self } - /// The maximum number of imported modules allowed for a script. #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_module"))] @@ -100,7 +92,6 @@ impl Engine { pub fn max_modules(&self) -> usize { self.limits.max_modules } - /// Set the depth limits for expressions (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[inline(always)] @@ -124,14 +115,12 @@ impl Engine { } self } - /// The depth limit for expressions (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[inline(always)] pub fn max_expr_depth(&self) -> usize { self.limits.max_expr_depth } - /// The depth limit for expressions in functions (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_function"))] @@ -139,7 +128,6 @@ impl Engine { pub fn max_function_expr_depth(&self) -> usize { self.limits.max_function_expr_depth } - /// Set the maximum length of strings (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[inline(always)] @@ -147,14 +135,12 @@ impl Engine { self.limits.max_string_size = if max_size == usize::MAX { 0 } else { max_size }; self } - /// The maximum length of strings (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[inline(always)] pub fn max_string_size(&self) -> usize { self.limits.max_string_size } - /// Set the maximum length of arrays (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_index"))] @@ -163,7 +149,6 @@ impl Engine { self.limits.max_array_size = if max_size == usize::MAX { 0 } else { max_size }; self } - /// The maximum length of arrays (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_index"))] @@ -171,7 +156,6 @@ impl Engine { pub fn max_array_size(&self) -> usize { self.limits.max_array_size } - /// Set the maximum length of object maps (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_object"))] @@ -180,7 +164,6 @@ impl Engine { self.limits.max_map_size = if max_size == usize::MAX { 0 } else { max_size }; self } - /// The maximum length of object maps (0 for unlimited). #[cfg(not(feature = "unchecked"))] #[cfg(not(feature = "no_object"))] @@ -188,7 +171,6 @@ impl Engine { pub fn max_map_size(&self) -> usize { self.limits.max_map_size } - /// Set the module resolution service used by the `Engine`. /// /// Not available under the `no_module` feature. @@ -201,7 +183,6 @@ impl Engine { self.module_resolver = resolver.map(|f| Box::new(f) as Box); self } - /// Disable a particular keyword or operator in the language. /// /// # Examples @@ -243,7 +224,6 @@ impl Engine { self.disabled_symbols.insert(symbol.into()); self } - /// Register a custom operator into the language. /// /// The operator must be a valid identifier (i.e. it cannot be a symbol). diff --git a/src/result.rs b/src/result.rs index 8153a2c5..8cf405a2 100644 --- a/src/result.rs +++ b/src/result.rs @@ -303,7 +303,6 @@ impl EvalAltResult { Self::LoopBreak(_, _) | Self::Return(_, _) => unreachable!(), } } - /// Is this error a system exception? pub fn is_system_exception(&self) -> bool { match self { @@ -322,7 +321,6 @@ impl EvalAltResult { _ => false, } } - /// Get the `Position` of this error. pub fn position(&self) -> Position { match self { @@ -356,7 +354,6 @@ impl EvalAltResult { | Self::Return(_, pos) => *pos, } } - /// Override the `Position` of this error. pub fn set_position(&mut self, new_position: Position) { match self { @@ -390,7 +387,6 @@ impl EvalAltResult { | Self::Return(_, pos) => *pos = new_position, } } - /// Consume the current `EvalAltResult` and return a new one with the specified `Position` /// if the current position is `Position::None`. #[inline(always)] diff --git a/src/syntax.rs b/src/syntax.rs index 7a60d787..a7214eec 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -193,7 +193,6 @@ impl Engine { Ok(self) } - /// Register a custom syntax with the `Engine`. /// /// ## WARNING - Low Level API