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

Method parse_operator

src/sql-parser/src/parser.rs:1534–1550  ·  view source on GitHub ↗

Parse an operator reference. Examples: `+` `OPERATOR(schema.+)` `OPERATOR("foo"."bar"."baz".@>)`

(&mut self)

Source from the content-addressed store, hash-verified

1532 /// * `OPERATOR(schema.+)`
1533 /// * `OPERATOR("foo"."bar"."baz".@>)`
1534 fn parse_operator(&mut self) -> Result<Op, ParserError> {
1535 let mut namespace = vec![];
1536 let op = loop {
1537 match self.next_token() {
1538 Some(Token::Keyword(kw)) => namespace.push(kw.into()),
1539 Some(Token::Ident(id)) => namespace.push(self.new_identifier(id)?),
1540 Some(Token::Op(op)) => break op,
1541 Some(Token::Star) => break "*".to_string(),
1542 tok => self.expected(self.peek_prev_pos(), "operator", tok)?,
1543 }
1544 self.expect_token(&Token::Dot)?;
1545 };
1546 Ok(Op {
1547 namespace: Some(namespace),
1548 op,
1549 })
1550 }
1551
1552 /// Parses an `ANY`, `ALL`, or `SOME` operation, starting after the `ANY`,
1553 /// `ALL`, or `SOME` keyword.

Callers 1

parse_infixMethod · 0.80

Calls 7

next_tokenMethod · 0.80
new_identifierMethod · 0.80
expectedMethod · 0.80
peek_prev_posMethod · 0.80
expect_tokenMethod · 0.80
pushMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected