Support $symbol$ in custom syntax.

This commit is contained in:
Stephen Chung
2021-07-10 15:50:31 +08:00
parent e0cae4546c
commit b21deaf052
9 changed files with 105 additions and 59 deletions

View File

@@ -307,13 +307,13 @@ impl Engine {
None | Some(Token::Reserved(_)) | Some(Token::Custom(_)) => (),
// Active standard keywords cannot be made custom
// Disabled keywords are OK
Some(token) if token.is_keyword() => {
Some(token) if token.is_standard_keyword() => {
if !self.disabled_symbols.contains(token.syntax().as_ref()) {
return Err(format!("'{}' is a reserved keyword", keyword.as_ref()));
}
}
// Active standard symbols cannot be made custom
Some(token) if token.is_symbol() => {
Some(token) if token.is_standard_symbol() => {
if !self.disabled_symbols.contains(token.syntax().as_ref()) {
return Err(format!("'{}' is a reserved operator", keyword.as_ref()));
}