Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -13949,6 +13949,15 @@ parse_statements(pm_parser_t *parser, pm_context_t context, uint16_t depth) {
if (PM_NODE_TYPE_P(node, PM_MISSING_NODE)) {
parser_lex(parser);

// If we are at the end of the file, then we need to stop parsing
// the statements entirely at this point. Mark the parser as
// recovering, as we know that EOF closes the top-level context, and
// then break out of the loop.
if (match1(parser, PM_TOKEN_EOF)) {
parser->recovering = true;
break;
}

while (accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON));
if (context_terminator(context, &parser->current)) break;
} else if (!accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_EOF)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
x.each { x end
^~~ unexpected 'end', expecting end-of-input
^~~ unexpected 'end', ignoring it
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a block beginning with `{` to end with `}`

Loading