(&mut self, ctx: &CalcContext<'_>)
| 638 | } |
| 639 | |
| 640 | fn visit_calc(&mut self, ctx: &CalcContext<'_>) -> Self::Return { |
| 641 | match &ctx.op { |
| 642 | None => match &ctx.unary() { |
| 643 | None => self.report_error::<ParseError, _>( |
| 644 | ctx.start().deref(), |
| 645 | None, |
| 646 | "No `UnaryContextAll`!", |
| 647 | ), |
| 648 | Some(unary) => self.visit(unary.as_ref()), |
| 649 | }, |
| 650 | Some(op) => { |
| 651 | if let (Some(lhs), Some(rhs)) = (ctx.calc(0), ctx.calc(1)) { |
| 652 | let lhs = self.visit(lhs.as_ref()); |
| 653 | let op_id = self.helper.next_id(op); |
| 654 | let rhs = self.visit(rhs.as_ref()); |
| 655 | match operators::find_operator(op.get_text()) { |
| 656 | None => self.report_error::<ParseError, _>( |
| 657 | op, |
| 658 | None, |
| 659 | format!("Unknown `{}` operator!", op.get_text()), |
| 660 | ), |
| 661 | Some(op) => { |
| 662 | self.global_call_or_macro(op_id, op.to_string(), vec![lhs, rhs]) |
| 663 | } |
| 664 | } |
| 665 | } else { |
| 666 | self.report_error::<ParseError, _>( |
| 667 | ctx.start().deref(), |
| 668 | None, |
| 669 | "Incomplete `CalcContext`!", |
| 670 | ) |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | fn visit_MemberExpr(&mut self, ctx: &MemberExprContext<'_>) -> Self::Return { |
| 677 | match &ctx.member() { |
nothing calls this directly
no test coverage detected