(&mut self)
| 442 | } |
| 443 | |
| 444 | fn consume_identifier(&mut self) -> Token { |
| 445 | let start_index = self.index; |
| 446 | while self.is_current_char_func(|c| c == '_' || c.is_alphanumeric()) { |
| 447 | self.advance(); |
| 448 | } |
| 449 | |
| 450 | // Identifier is being case-insensitive by default, convert to lowercase to be easy to compare and lookup |
| 451 | let literal = &self.content[start_index..self.index]; |
| 452 | let mut string: String = literal.iter().collect(); |
| 453 | string = string.to_lowercase(); |
| 454 | |
| 455 | let kind = GITQL_RESERVED_KEYWORDS |
| 456 | .get(string.as_str()) |
| 457 | .cloned() |
| 458 | .unwrap_or(TokenKind::Symbol(string)); |
| 459 | Token::new(kind, self.current_source_location()) |
| 460 | } |
| 461 | |
| 462 | fn consume_backticks_identifier(&mut self) -> Result<Token, Box<Diagnostic>> { |
| 463 | let start_index = self.index; |
no test coverage detected