diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-10 15:19:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 15:19:17 +0100 |
commit | 92ae349668d04fbf16951aa62dda753587c2cb67 (patch) | |
tree | 816b00c489cf67c3328b78ca3d2d5bf1cbfc38a3 /modules/gdscript/gdscript_parser.cpp | |
parent | e317e34c15cc0b2021198d6b53e515b29170c9f6 (diff) | |
parent | c7a8e047ccc8908f680dc55b9d1e6f2787ac49f6 (diff) |
Merge pull request #54358 from Shawak/feature-allow-root-node-paths-without-quote
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index b96139ac51..924e7d2df1 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2774,6 +2774,23 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_get_node(ExpressionNode *p get_node->chain.push_back(identifier); } while (match(GDScriptTokenizer::Token::SLASH)); return get_node; + } else if (match(GDScriptTokenizer::Token::SLASH)) { + GetNodeNode *get_node = alloc_node<GetNodeNode>(); + IdentifierNode *identifier_root = alloc_node<IdentifierNode>(); + get_node->chain.push_back(identifier_root); + int chain_position = 0; + do { + make_completion_context(COMPLETION_GET_NODE, get_node, chain_position++); + if (!current.is_node_name()) { + push_error(R"(Expect node path after "/".)"); + return nullptr; + } + advance(); + IdentifierNode *identifier = alloc_node<IdentifierNode>(); + identifier->name = previous.get_identifier(); + get_node->chain.push_back(identifier); + } while (match(GDScriptTokenizer::Token::SLASH)); + return get_node; } else { push_error(R"(Expect node path as string or identifier after "$".)"); return nullptr; |