| 582 | } |
| 583 | |
| 584 | void GDScriptParser::end_statement(const String &p_context) { |
| 585 | bool found = false; |
| 586 | while (is_statement_end() && !is_at_end()) { |
| 587 | // Remove sequential newlines/semicolons. |
| 588 | if (is_statement_end_token()) { |
| 589 | // Only consume if this is an actual token. |
| 590 | advance(); |
| 591 | } else if (lambda_ended) { |
| 592 | lambda_ended = false; // Consume this "token". |
| 593 | found = true; |
| 594 | break; |
| 595 | } else { |
| 596 | if (!found) { |
| 597 | lambda_ended = true; // Mark the lambda as done since we found something else to end the statement. |
| 598 | found = true; |
| 599 | } |
| 600 | break; |
| 601 | } |
| 602 | |
| 603 | found = true; |
| 604 | } |
| 605 | if (!found && !is_at_end()) { |
| 606 | push_error(vformat(R"(Expected end of statement after %s, found "%s" instead.)", p_context, current.get_name())); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | void GDScriptParser::parse_program() { |
| 611 | head = alloc_node<ClassNode>(); |