mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Do phrase level recovery for match
This commit is contained in:
parent
e5ccaa79e2
commit
4a0e40f6ea
16 changed files with 100 additions and 1 deletions
|
@ -2359,8 +2359,16 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() {
|
|||
}
|
||||
|
||||
if (!consume(GDScriptTokenizer::Token::COLON, vformat(R"(Expected ":"%s after "match" %s.)", has_guard ? "" : R"( or "when")", has_guard ? "pattern guard" : "patterns"))) {
|
||||
branch->block = alloc_recovery_suite();
|
||||
complete_extents(branch);
|
||||
return nullptr;
|
||||
// Consume the whole line and treat the next one as new match branch.
|
||||
while (current.type != GDScriptTokenizer::Token::NEWLINE && !is_at_end()) {
|
||||
advance();
|
||||
}
|
||||
if (!is_at_end()) {
|
||||
advance();
|
||||
}
|
||||
return branch;
|
||||
}
|
||||
|
||||
SuiteNode *suite = alloc_node<SuiteNode>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue