https://docs.python.org/3/reference/expressions.html#expression-lists termination_kind is used to know when to stop parsing the list for example to parse a tuple the termination_kind is Kind::RightParen caller is responsible to consume the first & last occurrence of the termination_kind
(
&mut self,
termination_kind: Kind,
)
| 1962 | // caller is responsible to consume the first & last occurrence of the |
| 1963 | // termination_kind |
| 1964 | fn parse_starred_list( |
| 1965 | &mut self, |
| 1966 | termination_kind: Kind, |
| 1967 | ) -> Result<Vec<Expression>, ParsingError> { |
| 1968 | let mut expressions = vec![]; |
| 1969 | while !self.at(Kind::Eof) && !self.at(termination_kind) { |
| 1970 | if self.eat(Kind::Comment) || self.consume_whitespace_and_newline() { |
| 1971 | continue; |
| 1972 | } |
| 1973 | let expr = self.parse_starred_item()?; |
| 1974 | if !self.at(Kind::Eof) && !self.at(termination_kind) { |
| 1975 | self.expect(Kind::Comma)?; |
| 1976 | } |
| 1977 | expressions.push(expr); |
| 1978 | } |
| 1979 | Ok(expressions) |
| 1980 | } |
| 1981 | |
| 1982 | // https://docs.python.org/3/reference/expressions.html#expression-lists |
| 1983 | fn parse_starred_item(&mut self) -> Result<Expression, ParsingError> { |
no test coverage detected