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

Method parse_suite

parser/src/parser/parser.rs:1121–1138  ·  view source on GitHub ↗

https://docs.python.org/3/reference/compound_stmts.html#grammar-token-python-grammar-suite

(&mut self)

Source from the content-addressed store, hash-verified

1119
1120 // https://docs.python.org/3/reference/compound_stmts.html#grammar-token-python-grammar-suite
1121 fn parse_suite(&mut self) -> Result<Vec<Statement>, ParsingError> {
1122 if self.eat(Kind::NewLine) {
1123 self.consume_whitespace_and_newline();
1124 self.expect(Kind::Indent)?;
1125 let mut stmts = vec![];
1126 while !self.eat(Kind::Dedent) && !self.at(Kind::Eof) {
1127 if self.eat(Kind::Comment) || self.consume_whitespace_and_newline() {
1128 continue;
1129 }
1130 let stmt = self.parse_statement()?;
1131 stmts.extend(stmt);
1132 }
1133 Ok(stmts)
1134 } else {
1135 let stmt = self.parse_statement_list()?;
1136 Ok(stmt)
1137 }
1138 }
1139
1140 // https://docs.python.org/3/reference/compound_stmts.html#grammar-token-python-grammar-statement
1141 fn parse_statement(&mut self) -> Result<Vec<Statement>, ParsingError> {

Callers 9

parse_if_statementMethod · 0.80
parse_while_statementMethod · 0.80
parse_for_statementMethod · 0.80
parse_with_statementMethod · 0.80
parse_try_statementMethod · 0.80
parse_except_clausesMethod · 0.80
parse_casesMethod · 0.80

Calls 6

eatMethod · 0.80
expectMethod · 0.80
atMethod · 0.80
parse_statementMethod · 0.80
parse_statement_listMethod · 0.80

Tested by

no test coverage detected