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

Method parse_with_statement

parser/src/parser/parser.rs:454–475  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

452 }
453
454 fn parse_with_statement(&mut self) -> Result<Statement, ParsingError> {
455 let node = self.start_node();
456 let is_async = self.eat(Kind::Async);
457 self.bump(Kind::With);
458 let items = self.parse_with_items()?;
459 self.expect(Kind::Colon)?;
460 let body = self.parse_suite()?;
461
462 if is_async {
463 Ok(Statement::AsyncWithStatement(Box::new(AsyncWith {
464 node: self.finish_node_chomped(node),
465 items,
466 body,
467 })))
468 } else {
469 Ok(Statement::WithStatement(Box::new(With {
470 node: self.finish_node_chomped(node),
471 items,
472 body,
473 })))
474 }
475 }
476
477 fn parse_with_items(&mut self) -> Result<Vec<WithItem>, ParsingError> {
478 let mut items = vec![];

Callers 1

Calls 7

start_nodeMethod · 0.80
eatMethod · 0.80
bumpMethod · 0.80
parse_with_itemsMethod · 0.80
expectMethod · 0.80
parse_suiteMethod · 0.80
finish_node_chompedMethod · 0.80

Tested by

no test coverage detected