diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f9266d7..01592c85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ---------------- diff --git a/src/tokenizer.rs b/src/tokenizer.rs index c97b68b7..27333f42 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -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"