(&mut self)
| 607 | } |
| 608 | |
| 609 | fn expr_multi_string(&mut self) -> Expr { |
| 610 | assert!(self.tok.kind == TokenKind::MultiString); |
| 611 | |
| 612 | // TODO asdf Inlining Multistrings in a function call is a bit of a PITA right now. |
| 613 | // The solution is to exctract them out to a variable, which might not always be desirable. |
| 614 | // The problem is that a ';' is automatically inserted after each line |
| 615 | let start = self.start(); |
| 616 | |
| 617 | // Accumulate all lines |
| 618 | let mut lines = vec![]; |
| 619 | |
| 620 | loop { |
| 621 | lines.push(self.tok.text.clone()); |
| 622 | |
| 623 | // consume MultiString |
| 624 | self.next(); |
| 625 | |
| 626 | // a semicolon is always inserted afterwards. |
| 627 | // consume it only if the next token is still a MultiString. |
| 628 | // |
| 629 | if self.tok.kind != TokenKind::MultiString { |
| 630 | break; |
| 631 | } |
| 632 | |
| 633 | /* |
| 634 | if self.nth(self.current + 1).kind == TokenKind::MultiString { |
| 635 | // consume ';' |
| 636 | self.next(); |
| 637 | continue; |
| 638 | } else { |
| 639 | // otherwise break off the loop, MultiString is finished |
| 640 | break; |
| 641 | } |
| 642 | */ |
| 643 | } |
| 644 | |
| 645 | let lit = Literal::String(StrType::Multi(lines)); |
| 646 | |
| 647 | Expr::Literal { |
| 648 | lit, |
| 649 | ty: Type::dummy(), |
| 650 | span: self.make_span(start), |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | fn expr_try(&mut self, lhs: Expr) -> Expr { |
| 655 | assert!(self.tok.kind == TokenKind::Question); |
no test coverage detected