From 2477753f633304d3ea55f966b2bf2f2277aecb5e Mon Sep 17 00:00:00 2001 From: Kirill Diduk Date: Thu, 9 Sep 2021 22:40:13 +0200 Subject: [PATCH] #52499 Fix parsing 'preload': skip newlines after '(' and before ')' --- modules/gdscript/gdscript_parser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 8dd31a5704f5..72760014acbb 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -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; @@ -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;