Skip to content

Commit

Permalink
Merge pull request #2261 from haldun/haldun/fix-parsing-targets
Browse files Browse the repository at this point in the history
Fix multiple assigns with newlines
  • Loading branch information
kddnewton authored Jan 26, 2024
2 parents 248a692 + 91b5550 commit 6f6efa7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 38 deletions.
1 change: 1 addition & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -11143,6 +11143,7 @@ parse_targets(pm_parser_t *parser, pm_node_t *first_target, pm_binding_power_t b
static pm_node_t *
parse_targets_validate(pm_parser_t *parser, pm_node_t *first_target, pm_binding_power_t binding_power) {
pm_node_t *result = parse_targets(parser, first_target, binding_power);
accept1(parser, PM_TOKEN_NEWLINE);

// Ensure that we have either an = or a ) after the targets.
if (!match2(parser, PM_TOKEN_EQUAL, PM_TOKEN_PARENTHESIS_RIGHT)) {
Expand Down
5 changes: 5 additions & 0 deletions test/prism/fixtures/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ end
foo => Object[{x:}]

1.then { 1 in ^_1 }

(
a,
b
) = c
100 changes: 62 additions & 38 deletions test/prism/snapshots/patterns.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f6efa7

Please sign in to comment.