MCPcopy Create free account
hub / github.com/Glyphack/enderpy / parse_target_list

Method parse_target_list

parser/src/parser/parser.rs:1701–1718  ·  view source on GitHub ↗

https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target_list

(&mut self)

Source from the content-addressed store, hash-verified

1699
1700 // https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target_list
1701 fn parse_target_list(&mut self) -> Result<Expression, ParsingError> {
1702 let node = self.start_node();
1703 let mut targets = vec![];
1704 loop {
1705 targets.push(self.parse_target()?);
1706 if !self.eat(Kind::Comma) || matches!(self.cur_kind(), Kind::NewLine | Kind::Eof) {
1707 break;
1708 }
1709 }
1710 if targets.len() == 1 {
1711 Ok(targets.remove(0))
1712 } else {
1713 Ok(Expression::Tuple(Box::new(Tuple {
1714 node: self.finish_node(node),
1715 elements: targets,
1716 })))
1717 }
1718 }
1719
1720 // https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target
1721 fn parse_target(&mut self) -> Result<Expression, ParsingError> {

Callers 3

parse_for_statementMethod · 0.80
parse_del_statementMethod · 0.80
parse_comp_forMethod · 0.80

Calls 6

TupleClass · 0.85
start_nodeMethod · 0.80
parse_targetMethod · 0.80
eatMethod · 0.80
finish_nodeMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected