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

Method parse_nonlocal_statement

parser/src/parser/parser.rs:1375–1391  ·  view source on GitHub ↗

https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement

(&mut self)

Source from the content-addressed store, hash-verified

1373
1374 // https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement
1375 fn parse_nonlocal_statement(&mut self) -> Result<Statement, ParsingError> {
1376 let node = self.start_node();
1377 self.bump(Kind::Nonlocal);
1378 let mut names = vec![];
1379 while self.at(Kind::Identifier) {
1380 let name = self.cur_token().to_string(self.source);
1381 names.push(name);
1382 self.bump(Kind::Identifier);
1383 if !self.eat(Kind::Comma) {
1384 break;
1385 }
1386 }
1387 Ok(Statement::Nonlocal(Box::new(Nonlocal {
1388 node: self.finish_node(node),
1389 names,
1390 })))
1391 }
1392
1393 // https://docs.python.org/3/reference/simple_stmts.html#the-import-statement
1394 fn parse_import_statement(&mut self) -> Result<Statement, ParsingError> {

Callers 1

Calls 8

NonlocalClass · 0.85
start_nodeMethod · 0.80
bumpMethod · 0.80
atMethod · 0.80
to_stringMethod · 0.80
cur_tokenMethod · 0.80
eatMethod · 0.80
finish_nodeMethod · 0.80

Tested by

no test coverage detected