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
67 changes: 42 additions & 25 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -12422,6 +12422,22 @@ expect1_heredoc_term(pm_parser_t *parser, const uint8_t *ident_start, size_t ide
}
}

/**
* A special expect1 that attaches the error to the opening token location
* rather than the current position. This is useful for errors about missing
* closing tokens, where we want to point to the line with the opening token
* (e.g., `def`, `class`, `if`, `{`) rather than the end of the file.
*/
static void
expect1_opening(pm_parser_t *parser, pm_token_type_t type, pm_diagnostic_id_t diag_id, const pm_token_t *opening) {
if (accept1(parser, type)) return;

pm_parser_err(parser, opening->start, opening->end, diag_id);

parser->previous.start = opening->end;
parser->previous.type = PM_TOKEN_MISSING;
}

static pm_node_t *
parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool accepts_command_call, bool accepts_label, pm_diagnostic_id_t diag_id, uint16_t depth);

Expand Down Expand Up @@ -14764,7 +14780,7 @@ parse_block(pm_parser_t *parser, uint16_t depth) {
statements = UP(parse_statements(parser, PM_CONTEXT_BLOCK_BRACES, (uint16_t) (depth + 1)));
}

expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BLOCK_TERM_BRACE);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BLOCK_TERM_BRACE, &opening);
} else {
if (!match1(parser, PM_TOKEN_KEYWORD_END)) {
if (!match3(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_ENSURE)) {
Expand All @@ -14779,7 +14795,7 @@ parse_block(pm_parser_t *parser, uint16_t depth) {
}
}

expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BLOCK_TERM_END);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BLOCK_TERM_END, &opening);
}

pm_constant_id_list_t locals;
Expand Down Expand Up @@ -15204,7 +15220,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl

accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON);
parser_warn_indentation_mismatch(parser, opening_newline_index, &else_keyword, false, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM_ELSE);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM_ELSE, &keyword);

pm_else_node_t *else_node = pm_else_node_create(parser, &else_keyword, else_statements, &parser->previous);

Expand All @@ -15221,7 +15237,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl
}
} else {
parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, if_after_else, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CONDITIONAL_TERM, &keyword);
}

// Set the appropriate end location for all of the nodes in the subtree.
Expand Down Expand Up @@ -16202,7 +16218,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures
if (!accept1(parser, PM_TOKEN_BRACKET_RIGHT)) {
inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_TOP | PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET, (uint16_t) (depth + 1));
accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET);
expect1_opening(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET, &opening);
}

closing = parser->previous;
Expand All @@ -16214,7 +16230,7 @@ parse_pattern_constant_path(pm_parser_t *parser, pm_constant_id_list_t *captures
if (!accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) {
inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_TOP | PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN, (uint16_t) (depth + 1));
accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN);
expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &opening);
}

closing = parser->previous;
Expand Down Expand Up @@ -16594,7 +16610,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm
pm_node_t *inner = parse_pattern(parser, captures, PM_PARSE_PATTERN_MULTI, PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET, (uint16_t) (depth + 1));

accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET);
expect1_opening(parser, PM_TOKEN_BRACKET_RIGHT, PM_ERR_PATTERN_TERM_BRACKET, &opening);
pm_token_t closing = parser->previous;

switch (PM_NODE_TYPE(inner)) {
Expand Down Expand Up @@ -16672,7 +16688,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm
node = parse_pattern_hash(parser, captures, first_node, (uint16_t) (depth + 1));

accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_PATTERN_TERM_BRACE);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_PATTERN_TERM_BRACE, &opening);
pm_token_t closing = parser->previous;

node->base.location.start = opening.start;
Expand Down Expand Up @@ -16798,7 +16814,7 @@ parse_pattern_primitive(pm_parser_t *parser, pm_constant_id_list_t *captures, pm
parser->pattern_matching_newlines = previous_pattern_matching_newlines;

accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN);
expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &lparen);
return UP(pm_pinned_expression_node_create(parser, expression, &operator, &lparen, &parser->previous));
}
default: {
Expand Down Expand Up @@ -16896,7 +16912,7 @@ parse_pattern_primitives(pm_parser_t *parser, pm_constant_id_list_t *captures, p

pm_node_t *body = parse_pattern(parser, captures, PM_PARSE_PATTERN_SINGLE, PM_ERR_PATTERN_EXPRESSION_AFTER_PAREN, (uint16_t) (depth + 1));
accept1(parser, PM_TOKEN_NEWLINE);
expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN);
expect1_opening(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_PATTERN_TERM_PAREN, &opening);
pm_node_t *right = UP(pm_parentheses_node_create(parser, &opening, body, &parser->previous, 0));

if (!alternation) {
Expand Down Expand Up @@ -17748,7 +17764,8 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
pm_accepts_block_stack_push(parser, true);
parser_lex(parser);

pm_hash_node_t *node = pm_hash_node_create(parser, &parser->previous);
pm_token_t opening = parser->previous;
pm_hash_node_t *node = pm_hash_node_create(parser, &opening);

if (!match2(parser, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_EOF)) {
if (current_hash_keys != NULL) {
Expand All @@ -17763,7 +17780,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

pm_accepts_block_stack_pop(parser);
expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_HASH_TERM);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_HASH_TERM, &opening);
pm_hash_node_closing_loc_set(node, &parser->previous);

return UP(node);
Expand Down Expand Up @@ -18380,7 +18397,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

parser_warn_indentation_mismatch(parser, opening_newline_index, &case_keyword, false, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CASE_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CASE_TERM, &case_keyword);

if (PM_NODE_TYPE_P(node, PM_CASE_NODE)) {
pm_case_node_end_keyword_loc_set((pm_case_node_t *) node, &parser->previous);
Expand Down Expand Up @@ -18413,7 +18430,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b

pm_begin_node_t *begin_node = pm_begin_node_create(parser, &begin_keyword, begin_statements);
parse_rescues(parser, opening_newline_index, &begin_keyword, begin_node, PM_RESCUES_BEGIN, (uint16_t) (depth + 1));
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BEGIN_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_BEGIN_TERM, &begin_keyword);

begin_node->base.location.end = parser->previous.end;
pm_begin_node_end_keyword_set(begin_node, &parser->previous);
Expand All @@ -18438,7 +18455,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
pm_token_t opening = parser->previous;
pm_statements_node_t *statements = parse_statements(parser, PM_CONTEXT_PREEXE, (uint16_t) (depth + 1));

expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BEGIN_UPCASE_TERM);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_BEGIN_UPCASE_TERM, &opening);
pm_context_t context = parser->current_context->context;
if ((context != PM_CONTEXT_MAIN) && (context != PM_CONTEXT_PREEXE)) {
pm_parser_err_token(parser, &keyword, PM_ERR_BEGIN_UPCASE_TOPLEVEL);
Expand Down Expand Up @@ -18568,7 +18585,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
parser_warn_indentation_mismatch(parser, opening_newline_index, &class_keyword, false, false);
}

expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM, &class_keyword);

pm_constant_id_list_t locals;
pm_locals_order(parser, &parser->current_scope->locals, &locals, false);
Expand Down Expand Up @@ -18626,7 +18643,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
parser_warn_indentation_mismatch(parser, opening_newline_index, &class_keyword, false, false);
}

expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_CLASS_TERM, &class_keyword);

if (context_def_p(parser)) {
pm_parser_err_token(parser, &class_keyword, PM_ERR_CLASS_IN_METHOD);
Expand Down Expand Up @@ -18936,7 +18953,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
pm_accepts_block_stack_pop(parser);
pm_do_loop_stack_pop(parser);

expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_DEF_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_DEF_TERM, &def_keyword);
end_keyword = parser->previous;
}

Expand Down Expand Up @@ -19030,7 +19047,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
pm_token_t opening = parser->previous;
pm_statements_node_t *statements = parse_statements(parser, PM_CONTEXT_POSTEXE, (uint16_t) (depth + 1));

expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_END_UPCASE_TERM);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_END_UPCASE_TERM, &opening);
return UP(pm_post_execution_node_create(parser, &keyword, &opening, statements, &parser->previous));
}
case PM_TOKEN_KEYWORD_FALSE:
Expand Down Expand Up @@ -19094,7 +19111,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

parser_warn_indentation_mismatch(parser, opening_newline_index, &for_keyword, false, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_FOR_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_FOR_TERM, &for_keyword);

return UP(pm_for_node_create(parser, index, collection, statements, &for_keyword, &in_keyword, &do_keyword, &parser->previous));
}
Expand Down Expand Up @@ -19245,7 +19262,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
pm_locals_order(parser, &parser->current_scope->locals, &locals, false);

pm_parser_scope_pop(parser);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_MODULE_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_MODULE_TERM, &module_keyword);

if (context_def_p(parser)) {
pm_parser_err_token(parser, &module_keyword, PM_ERR_MODULE_IN_METHOD);
Expand Down Expand Up @@ -19311,7 +19328,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, false, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_UNTIL_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_UNTIL_TERM, &keyword);

return UP(pm_until_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0));
}
Expand Down Expand Up @@ -19345,7 +19362,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

parser_warn_indentation_mismatch(parser, opening_newline_index, &keyword, false, false);
expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_WHILE_TERM);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_WHILE_TERM, &keyword);

return UP(pm_while_node_create(parser, &keyword, &do_keyword, &parser->previous, predicate, statements, 0));
}
Expand Down Expand Up @@ -20091,7 +20108,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
}

parser_warn_indentation_mismatch(parser, opening_newline_index, &operator, false, false);
expect1(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_LAMBDA_TERM_BRACE);
expect1_opening(parser, PM_TOKEN_BRACE_RIGHT, PM_ERR_LAMBDA_TERM_BRACE, &opening);
} else {
expect1(parser, PM_TOKEN_KEYWORD_DO, PM_ERR_LAMBDA_OPEN);
opening = parser->previous;
Expand All @@ -20109,7 +20126,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
parser_warn_indentation_mismatch(parser, opening_newline_index, &operator, false, false);
}

expect1(parser, PM_TOKEN_KEYWORD_END, PM_ERR_LAMBDA_TERM_END);
expect1_opening(parser, PM_TOKEN_KEYWORD_END, PM_ERR_LAMBDA_TERM_END, &operator);
}

pm_constant_id_list_t locals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
x.each { x end
^~~ unexpected 'end', expecting end-of-input
^~~ unexpected 'end', ignoring it
^ expected a block beginning with `{` to end with `}`
^ expected a block beginning with `{` to end with `}`

2 changes: 1 addition & 1 deletion test/prism/errors/command_calls_2.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{a: b c}
^ expected a `}` to close the hash literal
^ expected a `}` to close the hash literal
^ unexpected local variable or method, expecting end-of-input
^ unexpected '}', expecting end-of-input
^ unexpected '}', ignoring it
Expand Down
2 changes: 1 addition & 1 deletion test/prism/errors/command_calls_24.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
->a=b c{}
^ expected a `do` keyword or a `{` to open the lambda block
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a lambda block beginning with `do` to end with `end`
^~ expected a lambda block beginning with `do` to end with `end`

2 changes: 1 addition & 1 deletion test/prism/errors/command_calls_25.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
^ unexpected ')', expecting end-of-input
^ unexpected ')', ignoring it
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a lambda block beginning with `do` to end with `end`
^~ expected a lambda block beginning with `do` to end with `end`

2 changes: 1 addition & 1 deletion test/prism/errors/heredoc_unterminated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ a=>{<<b
^~~ unexpected heredoc beginning; expected a key in the hash pattern
^ unterminated heredoc; can't find string "b" anywhere before EOF
^~~ expected a label as the key in the hash pattern
^ expected a `}` to close the pattern expression
^ expected a `}` to close the pattern expression
^ unexpected heredoc ending, expecting end-of-input
^ unexpected heredoc ending, ignoring it

2 changes: 1 addition & 1 deletion test/prism/errors/infix_after_label.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ 'a':.upcase => 1 }
^ unexpected '.'; expected a value in the hash literal
^ expected a `}` to close the hash literal
^ expected a `}` to close the hash literal
^ unexpected '}', expecting end-of-input
^ unexpected '}', ignoring it

2 changes: 1 addition & 1 deletion test/prism/errors/label_in_interpolated_string.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ case in el""Q
^~~~ expected a predicate for a case matching statement
^ expected a delimiter after the patterns of an `in` clause
^ unexpected constant, expecting end-of-input
^~~~ expected an `end` to close the `case` statement
!"""#{in el"":Q
^~ unexpected 'in', assuming it is closing the parent 'in' clause
^ expected a `}` to close the embedded expression
Expand All @@ -10,5 +11,4 @@ case in el""Q
^ cannot parse the string part
^~~~~~~~~~~ unexpected label
^~~~~~~~~~~ expected a string for concatenation
^ expected an `end` to close the `case` statement

2 changes: 1 addition & 1 deletion test/prism/errors/pattern_string_key.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
case:a
^~~~ expected an `end` to close the `case` statement
in b:"","#{}"
^~~~~ expected a label after the `,` in the hash pattern
^ expected a pattern expression after the key
^ expected a delimiter after the patterns of an `in` clause
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected an `end` to close the `case` statement

2 changes: 1 addition & 1 deletion test/prism/errors/shadow_args_in_lambda.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
->a;b{}
^ expected a `do` keyword or a `{` to open the lambda block
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a lambda block beginning with `do` to end with `end`
^~ expected a lambda block beginning with `do` to end with `end`

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_begin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
begin
^ unexpected end-of-input, assuming it is closing the parent top level context
^~~~~ expected an `end` to close the `begin` statement

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_begin_upcase.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BEGIN {
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a `}` to close the `BEGIN` statement

2 changes: 1 addition & 1 deletion test/prism/errors/unterminated_block.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
foo {
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a block beginning with `{` to end with `}`
^ expected a block beginning with `{` to end with `}`

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_block_do_end.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
foo do
^ unexpected end-of-input, assuming it is closing the parent top level context
^~ expected a block beginning with `do` to end with `end`

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_class.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Foo
^ unexpected end-of-input, assuming it is closing the parent top level context
^~~~~ expected an `end` to close the `class` statement

5 changes: 5 additions & 0 deletions test/prism/errors/unterminated_def.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def foo
^ expected a delimiter to close the parameters
^ unexpected end-of-input, assuming it is closing the parent top level context
^~~ expected an `end` to close the `def` statement

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_end_upcase.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
END {
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a `}` to close the `END` statement

5 changes: 5 additions & 0 deletions test/prism/errors/unterminated_for.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
for x in y
^ unexpected end-of-input; expected a 'do', newline, or ';' after the 'for' loop collection
^ unexpected end-of-input, assuming it is closing the parent top level context
^~~ expected an `end` to close the `for` loop

5 changes: 5 additions & 0 deletions test/prism/errors/unterminated_if.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if true
^ expected `then` or `;` or '\n'
^ unexpected end-of-input, assuming it is closing the parent top level context
^~ expected an `end` to close the conditional clause

5 changes: 5 additions & 0 deletions test/prism/errors/unterminated_if_else.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if true
^~ expected an `end` to close the `else` clause
else
^ unexpected end-of-input, assuming it is closing the parent top level context

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_lambda_brace.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-> {
^ unexpected end-of-input, assuming it is closing the parent top level context
^ expected a lambda block beginning with `{` to end with `}`

4 changes: 4 additions & 0 deletions test/prism/errors/unterminated_module.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Foo
^ unexpected end-of-input, assuming it is closing the parent top level context
^~~~~~ expected an `end` to close the `module` statement

Loading