Parse application: f x y z
(&mut self)
| 496 | |
| 497 | /// Parse application: f x y z |
| 498 | fn parse_app_expr(&mut self) -> crate::Result<Expr> { |
| 499 | let mut func = self.parse_atomic_expr()?; |
| 500 | let mut args = Vec::new(); |
| 501 | |
| 502 | while !self.is_eof() && self.is_atomic_start() { |
| 503 | args.push(self.parse_atomic_expr()?); |
| 504 | } |
| 505 | |
| 506 | if args.is_empty() { |
| 507 | Ok(func) |
| 508 | } else { |
| 509 | let span = func.span().to(args.last().unwrap().span()); |
| 510 | Ok(Expr::App { |
| 511 | span, |
| 512 | func: Box::new(func), |
| 513 | args, |
| 514 | }) |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | /// Parse atomic (primary) expression |
| 519 | fn parse_atomic_expr(&mut self) -> crate::Result<Expr> { |
no test coverage detected