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

Method parse_global_statement

parser/src/parser/parser.rs:1356–1372  ·  view source on GitHub ↗

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

(&mut self)

Source from the content-addressed store, hash-verified

1354
1355 // https://docs.python.org/3/reference/simple_stmts.html#the-global-statement
1356 fn parse_global_statement(&mut self) -> Result<Statement, ParsingError> {
1357 let node = self.start_node();
1358 self.bump(Kind::Global);
1359 let mut names = vec![];
1360 while self.at(Kind::Identifier) {
1361 let name = self.cur_token().to_string(self.source);
1362 names.push(name);
1363 self.bump(Kind::Identifier);
1364 if !self.eat(Kind::Comma) {
1365 break;
1366 }
1367 }
1368 Ok(Statement::Global(Box::new(Global {
1369 node: self.finish_node(node),
1370 names,
1371 })))
1372 }
1373
1374 // https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement
1375 fn parse_nonlocal_statement(&mut self) -> Result<Statement, ParsingError> {

Callers 1

Calls 8

GlobalClass · 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