Skip to content

Commit

Permalink
godotengine#52499 Fix parsing 'preload': skip newlines after '(' and …
Browse files Browse the repository at this point in the history
…before ')'
  • Loading branch information
kdiduk committed Sep 9, 2021
1 parent 76693aa commit 2477753
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/gdscript/gdscript_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
tokenizer->advance();

while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) {
tokenizer->advance();
}

if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) {
completion_cursor = StringName();
completion_node = p_parent;
Expand Down Expand Up @@ -498,6 +502,10 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
}

while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) {
tokenizer->advance();
}

if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' after 'preload' path");
return nullptr;
Expand Down

0 comments on commit 2477753

Please sign in to comment.