diff --git a/CHANGELOG.md b/CHANGELOG.md index 2957d043..7c0d1ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ Version 1.4.0 This version adds support for integer _ranges_ via the `..` and `..=` operators. Many standard API's are extended with range parameters where appropriate. +Script-breaking changes +----------------------- + +* `is` is (pun intended) now a reserved keyword to prepare for possible future type checking expressions (e.g. `x is "string"`). + New features ------------ @@ -100,8 +105,8 @@ Bug fixes Version 1.2.0 ============= -Bug fixes with breaking script changes -------------------------------------- +Bug fixes (potentially script-breaking) +-------------------------------------- * As originally intended, function calls with a bang (`!`) now operates directly on the caller's scope, allowing variables inside the scope to be mutated. * As originally intended, `Engine::XXX_with_scope` API's now properly propagate constants within the provided scope also to _functions_ in the script. diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 66fedac4..2a6d301f 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -786,11 +786,16 @@ impl Token { #[cfg(feature = "no_module")] "import" | "export" | "as" => Reserved(syntax.into()), - "===" | "!==" | "->" | "<-" | ":=" | "~" | "::<" | "(*" | "*)" | "#" | "#!" - | "public" | "protected" | "super" | "new" | "use" | "module" | "package" | "var" - | "static" | "shared" | "with" | "goto" | "exit" | "match" | "case" | "default" - | "void" | "null" | "nil" | "spawn" | "thread" | "go" | "sync" | "async" | "await" - | "yield" => Reserved(syntax.into()), + // List of reserved operators + "===" | "!==" | "->" | "<-" | ":=" | "~" | "::<" | "(*" | "*)" | "#" | "#!" => { + Reserved(syntax.into()) + } + + // List of reserved keywords + "public" | "protected" | "super" | "new" | "use" | "module" | "package" | "var" + | "static" | "shared" | "with" | "is" | "goto" | "exit" | "match" | "case" + | "default" | "void" | "null" | "nil" | "spawn" | "thread" | "go" | "sync" + | "async" | "await" | "yield" => Reserved(syntax.into()), KEYWORD_PRINT | KEYWORD_DEBUG | KEYWORD_TYPE_OF | KEYWORD_EVAL | KEYWORD_FN_PTR | KEYWORD_FN_PTR_CALL | KEYWORD_FN_PTR_CURRY | KEYWORD_THIS | KEYWORD_IS_DEF_VAR => {