Parse a simple one-word identifier (possibly quoted, possibly a keyword)
(&mut self)
| 7356 | |
| 7357 | /// Parse a simple one-word identifier (possibly quoted, possibly a keyword) |
| 7358 | fn parse_identifier(&mut self) -> Result<Ident, ParserError> { |
| 7359 | match self.consume_identifier()? { |
| 7360 | Some(id) => { |
| 7361 | if id.as_str().is_empty() { |
| 7362 | return parser_err!( |
| 7363 | self, |
| 7364 | self.peek_prev_pos(), |
| 7365 | "zero-length delimited identifier", |
| 7366 | ); |
| 7367 | } |
| 7368 | Ok(id) |
| 7369 | } |
| 7370 | None => self.expected(self.peek_pos(), "identifier", self.peek_token()), |
| 7371 | } |
| 7372 | } |
| 7373 | |
| 7374 | fn consume_identifier(&mut self) -> Result<Option<Ident>, ParserError> { |
| 7375 | match self.peek_token() { |
no test coverage detected