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

Method parse_qualified_identifier

src/sql-parser/src/parser.rs:7388–7422  ·  view source on GitHub ↗
(&mut self, id: Ident)

Source from the content-addressed store, hash-verified

7386 }
7387
7388 fn parse_qualified_identifier(&mut self, id: Ident) -> Result<Expr<Raw>, ParserError> {
7389 let mut id_parts = vec![id];
7390 match self.peek_token() {
7391 Some(Token::LParen) | Some(Token::Dot) => {
7392 let mut ends_with_wildcard = false;
7393 while self.consume_token(&Token::Dot) {
7394 match self.next_token() {
7395 Some(Token::Keyword(kw)) => id_parts.push(kw.into()),
7396 Some(Token::Ident(id)) => id_parts.push(self.new_identifier(id)?),
7397 Some(Token::Star) => {
7398 ends_with_wildcard = true;
7399 break;
7400 }
7401 unexpected => {
7402 return self.expected(
7403 self.peek_prev_pos(),
7404 "an identifier or a '*' after '.'",
7405 unexpected,
7406 );
7407 }
7408 }
7409 }
7410 if ends_with_wildcard {
7411 Ok(Expr::QualifiedWildcard(id_parts))
7412 } else if self.peek_token() == Some(Token::LParen) {
7413 let function =
7414 self.parse_function(RawItemName::Name(UnresolvedItemName(id_parts)))?;
7415 Ok(Expr::Function(function))
7416 } else {
7417 Ok(Expr::Identifier(id_parts))
7418 }
7419 }
7420 _ => Ok(Expr::Identifier(id_parts)),
7421 }
7422 }
7423
7424 /// Parse a parenthesized comma-separated list of unqualified, possibly quoted identifiers
7425 fn parse_parenthesized_column_list(

Callers 1

parse_prefixMethod · 0.80

Calls 11

UnresolvedItemNameClass · 0.85
FunctionClass · 0.85
peek_tokenMethod · 0.80
consume_tokenMethod · 0.80
next_tokenMethod · 0.80
new_identifierMethod · 0.80
expectedMethod · 0.80
peek_prev_posMethod · 0.80
parse_functionMethod · 0.80
NameClass · 0.50
pushMethod · 0.45

Tested by

no test coverage detected