From 3f44e2893c34245c78b495ba0235b2a3cfba49eb Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Thu, 14 Jan 2021 19:07:03 +0800 Subject: [PATCH] Wrap up 0.19.10. --- Cargo.toml | 2 +- README.md | 8 +++----- RELEASES.md | 3 ++- src/ast.rs | 15 ++------------- src/syntax.rs | 8 ++++++++ 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8d3234c3..cb68a5e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung", "jhwgh1968"] description = "Embedded scripting for Rust" homepage = "https://rhaiscript.github.io/book" -repository = "https://github.com/rhaiscript/rhai" +repository = "https://github.com/rhaiscript" readme = "README.md" license = "MIT OR Apache-2.0" include = [ diff --git a/README.md b/README.md index caf5be6c..82aa7dec 100644 --- a/README.md +++ b/README.md @@ -70,15 +70,13 @@ Documentation See [The Rhai Book](https://rhaiscript.github.io/book) for details on the Rhai scripting engine and language. -To build _The Book_, first install [`mdbook`](https://github.com/rust-lang/mdBook) -and [`mdbook-tera`](https://github.com/avitex/mdbook-tera) (for templating). -Running `mdbook build` builds it. - Playground ---------- -An [Online Playground](https://rhaiscript.github.io/playground) is available with syntax-highlighting editor. +An [Online Playground](https://rhaiscript.github.io/playground) is available with +syntax-highlighting editor, powered by WebAssembly. + Scripts can be evaluated directly from the editor. diff --git a/RELEASES.md b/RELEASES.md index cc2c13d8..1240a3cf 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -7,8 +7,9 @@ Version 0.19.10 Bug fixes --------- +* `no_std` feature now compiles correctly (bug introduced in `0.19.9`). * Bug in `FileModuleResolver::clear_cache_for_path` path mapping fixed. -* Some optimizer fringe cases is fixed - related to constants propagation when the evil `eval` is present. +* Some optimizer fringe cases are fixed - related to constants propagation when the evil `eval` is present. Breaking changes ---------------- diff --git a/src/ast.rs b/src/ast.rs index 20b19987..12bf72ec 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1058,13 +1058,13 @@ impl Stmt { } } -/// _(INTERNALS)_ A custom syntax definition. +/// _(INTERNALS)_ A custom syntax expression. /// Exported under the `internals` feature only. /// /// # WARNING /// /// This type is volatile and may change. -#[derive(Clone, Hash)] +#[derive(Debug, Clone, Hash)] pub struct CustomExpr { /// List of keywords. pub keywords: StaticVec, @@ -1074,17 +1074,6 @@ pub struct CustomExpr { pub scope_delta: isize, } -impl fmt::Debug for CustomExpr { - #[inline(always)] - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("CustomExpr { keywords:")?; - fmt::Debug::fmt(&self.keywords, f)?; - f.write_str(", tokens:")?; - fmt::Debug::fmt(&self.tokens, f)?; - f.write_str("}") - } -} - /// _(INTERNALS)_ A binary expression. /// Exported under the `internals` feature only. /// diff --git a/src/syntax.rs b/src/syntax.rs index 65b6513c..78ce64f7 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -101,6 +101,14 @@ impl Engine { /// * `keywords` holds a slice of strings that define the custom syntax. /// * `new_vars` is the number of new variables declared by this custom syntax, or the number of variables removed (if negative). /// * `func` is the implementation function. + /// + /// # Notes + /// + /// If `new_vars` is positive, then a number of new variables are expected to be pushed into the + /// current [`Scope`][crate::Scope]. + /// + /// If `new_vars` is negative, then it is expected that only the top `new_vars` variables in the + /// current [`Scope`][crate::Scope] will be _popped_. Do not randomly remove variables. pub fn register_custom_syntax + Into>( &mut self, keywords: impl AsRef<[S]>,