mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Shell: Allow newlines before do
in POSIX for loops
This commit is contained in:
parent
fca5a34ad3
commit
0d8b90aec6
1 changed files with 4 additions and 1 deletions
|
@ -1365,12 +1365,15 @@ ErrorOr<RefPtr<AST::Node>> Parser::parse_for_clause()
|
|||
iterated_expression = parse_word_list();
|
||||
|
||||
if (saw_in) {
|
||||
if (peek().type == Token::Type::Semicolon)
|
||||
if (peek().type == Token::Type::Semicolon || peek().type == Token::Type::Newline)
|
||||
skip();
|
||||
else
|
||||
error(peek(), "Expected a semicolon, not {}", peek().type_name());
|
||||
}
|
||||
|
||||
while (peek().type == Token::Type::Newline)
|
||||
skip();
|
||||
|
||||
auto body = TRY(parse_do_group());
|
||||
return AST::make_ref_counted<AST::ForLoop>(
|
||||
start_position.with_end(peek().position.value_or(empty_position())),
|
||||
|
|
Loading…
Reference in a new issue