| 737 | } |
| 738 | |
| 739 | fn visit_Select(&mut self, ctx: &SelectContext<'_>) -> Self::Return { |
| 740 | if let (Some(member), Some(id), Some(op)) = (&ctx.member(), &ctx.id, &ctx.op) { |
| 741 | let operand = self.visit(member.as_ref()); |
| 742 | let field = id.get_text(); |
| 743 | if let Some(_opt) = &ctx.opt { |
| 744 | return if self.enable_optional_syntax { |
| 745 | let field_literal = self.helper.next_expr( |
| 746 | op.as_ref(), |
| 747 | Expr::Literal(LiteralValue::String(field.clone().into())), |
| 748 | ); |
| 749 | let op_id = self.helper.next_id(op.as_ref()); |
| 750 | self.global_call_or_macro( |
| 751 | op_id, |
| 752 | operators::OPT_SELECT.to_string(), |
| 753 | vec![operand, field_literal], |
| 754 | ) |
| 755 | } else { |
| 756 | self.report_error::<ParseError, _>(op.as_ref(), None, "unsupported syntax '.?'") |
| 757 | }; |
| 758 | } |
| 759 | self.helper.next_expr( |
| 760 | op.as_ref(), |
| 761 | Expr::Select(SelectExpr { |
| 762 | operand: Box::new(operand), |
| 763 | field, |
| 764 | test: false, |
| 765 | }), |
| 766 | ) |
| 767 | } else { |
| 768 | self.report_error::<ParseError, _>(&ctx.start(), None, "Incomplete `SelectContext`!") |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | fn visit_PrimaryExpr(&mut self, ctx: &PrimaryExprContext<'_>) -> Self::Return { |
| 773 | match &ctx.primary() { |