Implement string functions with to_string/to_debug.

This commit is contained in:
Stephen Chung
2021-04-02 19:26:55 +08:00
parent 1866331e7b
commit a738f750f9
10 changed files with 97 additions and 44 deletions

View File

@@ -1828,7 +1828,7 @@ impl<'a> Iterator for TokenIterator<'a> {
None => return None,
// Reserved keyword/symbol
Some((Token::Reserved(s), pos)) => (match
(s.as_str(), self.engine.custom_keywords.contains_key(&s))
(s.as_str(), self.engine.custom_keywords.contains_key(s.as_str()))
{
("===", false) => Token::LexError(LERR::ImproperSymbol(s,
"'===' is not a valid operator. This is not JavaScript! Should it be '=='?".to_string(),
@@ -1869,7 +1869,7 @@ impl<'a> Iterator for TokenIterator<'a> {
(_, false) => Token::Reserved(s),
}, pos),
// Custom keyword
Some((Token::Identifier(s), pos)) if self.engine.custom_keywords.contains_key(&s) => {
Some((Token::Identifier(s), pos)) if self.engine.custom_keywords.contains_key(s.as_str()) => {
(Token::Custom(s), pos)
}
// Custom standard keyword/symbol - must be disabled