Add shared and sync to reserved keywords.
This commit is contained in:
parent
057f6435a4
commit
f05cd1fdf3
@ -59,8 +59,10 @@ Reserved Keywords
|
|||||||
| `package` | Package |
|
| `package` | Package |
|
||||||
| `spawn` | Threading |
|
| `spawn` | Threading |
|
||||||
| `go` | Threading |
|
| `go` | Threading |
|
||||||
|
| `shared` | Threading |
|
||||||
| `await` | Async |
|
| `await` | Async |
|
||||||
| `async` | Async |
|
| `async` | Async |
|
||||||
|
| `sync` | Async |
|
||||||
| `yield` | Async |
|
| `yield` | Async |
|
||||||
| `default` | Special value |
|
| `default` | Special value |
|
||||||
| `void` | Special value |
|
| `void` | Special value |
|
||||||
|
@ -5,21 +5,21 @@ Keywords
|
|||||||
|
|
||||||
The following are reserved keywords in Rhai:
|
The following are reserved keywords in Rhai:
|
||||||
|
|
||||||
| Active keywords | Reserved keywords | Usage | Inactive under feature |
|
| Active keywords | Reserved keywords | Usage | Inactive under feature |
|
||||||
| ------------------------------------------------- | ---------------------------------------- | --------------------- | :--------------------: |
|
| ------------------------------------------------- | ---------------------------------------------------------- | --------------------- | :--------------------: |
|
||||||
| `true`, `false` | | Boolean constants | |
|
| `true`, `false` | | Boolean constants | |
|
||||||
| `let`, `const` | `var`, `static` | Variable declarations | |
|
| `let`, `const` | `var`, `static` | Variable declarations | |
|
||||||
| `if`, `else` | `then`, `goto`, `exit` | Control flow | |
|
| `if`, `else` | `then`, `goto`, `exit` | Control flow | |
|
||||||
| | `switch`, `match`, `case` | Matching | |
|
| | `switch`, `match`, `case` | Matching | |
|
||||||
| `while`, `loop`, `for`, `in`, `continue`, `break` | `do`, `each` | Looping | |
|
| `while`, `loop`, `for`, `in`, `continue`, `break` | `do`, `each` | Looping | |
|
||||||
| `fn`, `private` | `public`, `new` | Functions | [`no_function`] |
|
| `fn`, `private` | `public`, `new` | Functions | [`no_function`] |
|
||||||
| `return` | | Return values | |
|
| `return` | | Return values | |
|
||||||
| `throw` | `try`, `catch` | Throw exceptions | |
|
| `throw` | `try`, `catch` | Throw exceptions | |
|
||||||
| `import`, `export`, `as` | `use`, `with`, `module`, `package` | Modules/packages | [`no_module`] |
|
| `import`, `export`, `as` | `use`, `with`, `module`, `package` | Modules/packages | [`no_module`] |
|
||||||
| `Fn`, `call`, `curry` | | Function pointers | |
|
| `Fn`, `call`, `curry` | | Function pointers | |
|
||||||
| | `spawn`, `go`, `async`, `await`, `yield` | Threading/async | |
|
| | `spawn`, `go`, `shared`, `sync`, `async`, `await`, `yield` | Threading/async | |
|
||||||
| `type_of`, `print`, `debug`, `eval` | | Special functions | |
|
| `type_of`, `print`, `debug`, `eval` | | Special functions | |
|
||||||
| | `default`, `void`, `null`, `nil` | Special values | |
|
| | `default`, `void`, `null`, `nil` | Special values | |
|
||||||
|
|
||||||
Keywords cannot become the name of a [function] or [variable], even when they are disabled.
|
Keywords cannot become the name of a [function] or [variable], even when they are disabled.
|
||||||
|
|
||||||
|
@ -495,8 +495,8 @@ impl Token {
|
|||||||
"===" | "!==" | "->" | "<-" | "=>" | ":=" | "::<" | "(*" | "*)" | "#" | "public"
|
"===" | "!==" | "->" | "<-" | "=>" | ":=" | "::<" | "(*" | "*)" | "#" | "public"
|
||||||
| "new" | "use" | "module" | "package" | "var" | "static" | "with" | "do" | "each"
|
| "new" | "use" | "module" | "package" | "var" | "static" | "with" | "do" | "each"
|
||||||
| "then" | "goto" | "exit" | "switch" | "match" | "case" | "try" | "catch"
|
| "then" | "goto" | "exit" | "switch" | "match" | "case" | "try" | "catch"
|
||||||
| "default" | "void" | "null" | "nil" | "spawn" | "go" | "async" | "await"
|
| "default" | "void" | "null" | "nil" | "spawn" | "go" | "shared" | "sync"
|
||||||
| "yield" => Reserved(syntax.into()),
|
| "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 => Reserved(syntax.into()),
|
| KEYWORD_FN_PTR_CALL | KEYWORD_FN_PTR_CURRY | KEYWORD_THIS => Reserved(syntax.into()),
|
||||||
|
Loading…
Reference in New Issue
Block a user