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
4 changes: 2 additions & 2 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -15486,7 +15486,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl
pm_token_t keyword = parser->previous;
pm_token_t then_keyword = { 0 };

pm_node_t *predicate = parse_predicate(parser, PM_BINDING_POWER_MODIFIER, context, &then_keyword, (uint16_t) (depth + 1));
pm_node_t *predicate = parse_predicate(parser, PM_BINDING_POWER_COMPOSITION, context, &then_keyword, (uint16_t) (depth + 1));
pm_statements_node_t *statements = NULL;

if (!match3(parser, PM_TOKEN_KEYWORD_ELSIF, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) {
Expand Down Expand Up @@ -15524,7 +15524,7 @@ parse_conditional(pm_parser_t *parser, pm_context_t context, size_t opening_newl
pm_token_t elsif_keyword = parser->current;
parser_lex(parser);

pm_node_t *predicate = parse_predicate(parser, PM_BINDING_POWER_MODIFIER, PM_CONTEXT_ELSIF, &then_keyword, (uint16_t) (depth + 1));
pm_node_t *predicate = parse_predicate(parser, PM_BINDING_POWER_COMPOSITION, PM_CONTEXT_ELSIF, &then_keyword, (uint16_t) (depth + 1));
pm_accepts_block_stack_push(parser, true);

pm_statements_node_t *statements = parse_statements(parser, PM_CONTEXT_ELSIF, (uint16_t) (depth + 1));
Expand Down
12 changes: 12 additions & 0 deletions test/prism/errors/modifier_conditional_in_predicate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if a if b then end
^~ expected `then` or `;` or '\n'
^~ unexpected 'if', ignoring it
^~~~ unexpected 'then', expecting end-of-input
^~~~ unexpected 'then', ignoring it

unless a unless b then end
^~~~~~ expected `then` or `;` or '\n'
^~~~~~ unexpected 'unless', ignoring it
^~~~ unexpected 'then', expecting end-of-input
^~~~ unexpected 'then', ignoring it

Loading