https://docs.python.org/3/library/ast.html#ast.Expr
(&mut self)
| 1502 | |
| 1503 | // https://docs.python.org/3/library/ast.html#ast.Expr |
| 1504 | fn parse_expressions(&mut self) -> Result<Expression, ParsingError> { |
| 1505 | let node = self.start_node(); |
| 1506 | let expr = self.parse_expression()?; |
| 1507 | |
| 1508 | let mut exprs = vec![]; |
| 1509 | if self.at(Kind::Comma) { |
| 1510 | exprs.push(expr); |
| 1511 | while self.eat(Kind::Comma) { |
| 1512 | // expressions start with same tokens as star |
| 1513 | // expressions |
| 1514 | if self.at(Kind::Eof) || !self.cur_kind().is_star_expression() { |
| 1515 | break; |
| 1516 | } |
| 1517 | exprs.push(self.parse_expression()?); |
| 1518 | } |
| 1519 | } else { |
| 1520 | return Ok(expr); |
| 1521 | } |
| 1522 | |
| 1523 | Ok(Expression::Tuple(Box::new(Tuple { |
| 1524 | node: self.finish_node(node), |
| 1525 | elements: exprs, |
| 1526 | }))) |
| 1527 | } |
| 1528 | |
| 1529 | // https://docs.python.org/3/reference/expressions.html#conditional-expressions |
| 1530 | fn parse_conditional_expression(&mut self) -> Result<Expression, ParsingError> { |
no test coverage detected