Parse an operator reference. Examples: `+` `OPERATOR(schema.+)` `OPERATOR("foo"."bar"."baz".@>)`
(&mut self)
| 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. |
no test coverage detected