Parses a postfix expression in a loop until there are no postfix expressions left to parse. For a given left-hand side, a postfix expression can begin with either `(` for a call expression, `[` for a subscript expression, or `.` for an attribute expression. This method does nothing if the current token is not a candidate for a postfix expression.
(
&mut self,
mut lhs: Expr,
start: TextSize,
context: ExpressionContext,
)
| 680 | /// |
| 681 | /// This method does nothing if the current token is not a candidate for a postfix expression. |
| 682 | fn parse_postfix_expression( |
| 683 | &mut self, |
| 684 | mut lhs: Expr, |
| 685 | start: TextSize, |
| 686 | context: ExpressionContext, |
| 687 | ) -> Expr { |
| 688 | loop { |
| 689 | lhs = match self.current_token_kind() { |
| 690 | TokenKind::Lpar => Expr::Call(self.parse_call_expression(lhs, start)), |
| 691 | TokenKind::Lsqb => Expr::Subscript(self.parse_subscript_expression(lhs, start)), |
| 692 | TokenKind::Dot => { |
| 693 | Expr::Attribute(self.parse_attribute_expression(lhs, start, context)) |
| 694 | } |
| 695 | _ => break lhs, |
| 696 | }; |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | /// Parse a call expression. |
| 701 | /// |
no test coverage detected