Add missing reserved tokens.

This commit is contained in:
Stephen Chung 2022-08-20 21:55:00 +08:00
parent 8c20801574
commit 689ed48235
2 changed files with 8 additions and 3 deletions

View File

@ -14,6 +14,7 @@ Bug fixes
* Capturing an unknown variable in a closure no longer panics.
* Fixes panic in interpolated strings with constant expressions.
* Using `call_fn_raw` on a function without evaluating the AST no longer panics on namespace-qualified function calls due to `import` statements not run.
* Some reserved tokens (such as "?", "++") cannot be used in custom syntax; this is now fixed.
Breaking changes
----------------

View File

@ -873,6 +873,11 @@ impl Token {
"**" => PowerOf,
"**=" => PowerOfAssign,
#[cfg(feature = "no_object")]
"?." => Reserved(syntax.into()),
#[cfg(feature = "no_index")]
"?[" => Reserved(syntax.into()),
#[cfg(not(feature = "no_function"))]
"fn" => Fn,
#[cfg(not(feature = "no_function"))]
@ -892,9 +897,8 @@ impl Token {
"import" | "export" | "as" => Reserved(syntax.into()),
// List of reserved operators
"===" | "!==" | "->" | "<-" | ":=" | "~" | "::<" | "(*" | "*)" | "#" | "#!" => {
Reserved(syntax.into())
}
"===" | "!==" | "->" | "<-" | "?" | ":=" | ":;" | "~" | "!." | "::<" | "(*" | "*)"
| "#" | "#!" | "@" | "$" | "++" | "--" | "..." | "<|" | "|>" => Reserved(syntax.into()),
// List of reserved keywords
"public" | "protected" | "super" | "new" | "use" | "module" | "package" | "var"