Skip to content

Commit

Permalink
Adds support for spread operator inside arrays from PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cfroystad committed Apr 13, 2021
1 parent c307ec4 commit 95f130a
Show file tree
Hide file tree
Showing 5 changed files with 48,140 additions and 47,586 deletions.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,8 @@ module.exports = grammar({

array_element_initializer: $ => prec.right(choice(
seq(optional('&'), $._expression),
seq($._expression, '=>', optional('&'), $._expression)
seq($._expression, '=>', optional('&'), $._expression),
$.variadic_unpacking
)),

binary_expression: $ => choice(
Expand Down
4 changes: 4 additions & 0 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -5611,6 +5611,10 @@
"name": "_expression"
}
]
},
{
"type": "SYMBOL",
"name": "variadic_unpacking"
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@
{
"type": "_expression",
"named": true
},
{
"type": "variadic_unpacking",
"named": true
}
]
}
Expand Down
Loading

0 comments on commit 95f130a

Please sign in to comment.