MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_identifier

Method parse_identifier

src/sql-parser/src/parser.rs:7358–7372  ·  view source on GitHub ↗

Parse a simple one-word identifier (possibly quoted, possibly a keyword)

(&mut self)

Source from the content-addressed store, hash-verified

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() {

Calls 6

consume_identifierMethod · 0.80
expectedMethod · 0.80
peek_posMethod · 0.80
peek_tokenMethod · 0.80
is_emptyMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected