https://peps.python.org/pep-0622/#appendix-a-full-grammar
(&mut self)
| 705 | |
| 706 | // https://peps.python.org/pep-0622/#appendix-a-full-grammar |
| 707 | fn parse_match_statement(&mut self) -> Result<Statement, ParsingError> { |
| 708 | let node = self.start_node(); |
| 709 | // This identifier is match word |
| 710 | // match is a soft keyword |
| 711 | self.bump(Kind::Identifier); |
| 712 | let subject = self.parse_subject()?; |
| 713 | self.expect(Kind::Colon)?; |
| 714 | self.expect(Kind::NewLine)?; |
| 715 | self.expect(Kind::Indent)?; |
| 716 | let cases = self.parse_cases()?; |
| 717 | self.expect_any(vec![Kind::Dedent, Kind::Eof])?; |
| 718 | |
| 719 | Ok(Statement::MatchStmt(Box::new(Match { |
| 720 | node: self.finish_node(node), |
| 721 | subject, |
| 722 | cases, |
| 723 | }))) |
| 724 | } |
| 725 | |
| 726 | // This is inaccuracy, but I don't know how |
| 727 | // the grammar should be |
no test coverage detected