Reserve is keyword.

This commit is contained in:
Stephen Chung 2021-12-24 14:59:14 +08:00
parent 5c31ec7f78
commit 43363e0660
2 changed files with 17 additions and 7 deletions

View File

@ -7,6 +7,11 @@ Version 1.4.0
This version adds support for integer _ranges_ via the `..` and `..=` operators. This version adds support for integer _ranges_ via the `..` and `..=` operators.
Many standard API's are extended with range parameters where appropriate. 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 New features
------------ ------------
@ -100,8 +105,8 @@ Bug fixes
Version 1.2.0 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, 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. * As originally intended, `Engine::XXX_with_scope` API's now properly propagate constants within the provided scope also to _functions_ in the script.

View File

@ -786,11 +786,16 @@ impl Token {
#[cfg(feature = "no_module")] #[cfg(feature = "no_module")]
"import" | "export" | "as" => Reserved(syntax.into()), "import" | "export" | "as" => Reserved(syntax.into()),
"===" | "!==" | "->" | "<-" | ":=" | "~" | "::<" | "(*" | "*)" | "#" | "#!" // List of reserved operators
| "public" | "protected" | "super" | "new" | "use" | "module" | "package" | "var" "===" | "!==" | "->" | "<-" | ":=" | "~" | "::<" | "(*" | "*)" | "#" | "#!" => {
| "static" | "shared" | "with" | "goto" | "exit" | "match" | "case" | "default" Reserved(syntax.into())
| "void" | "null" | "nil" | "spawn" | "thread" | "go" | "sync" | "async" | "await" }
| "yield" => 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_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 => { | KEYWORD_FN_PTR_CALL | KEYWORD_FN_PTR_CURRY | KEYWORD_THIS | KEYWORD_IS_DEF_VAR => {