Skip to content

Commit

Permalink
added support for hanging comma
Browse files Browse the repository at this point in the history
  • Loading branch information
cseufert committed Mar 29, 2021
1 parent 7bceb3f commit af9503a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/parser/expr.js
Expand Up @@ -645,6 +645,10 @@ module.exports = {
conds.push(this.read_expr());
while (this.token === ",") {
this.next();
if (this.token === this.tok.T_DOUBLE_ARROW) {
this.next();
return conds;
}
conds.push(this.read_expr());
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/snapshot/match.test.js
Expand Up @@ -34,7 +34,7 @@ describe("match", () => {
it("can have hanging comma", () => {
const ast = parser.parseEval(`
$test = match($test) {
true => 'ok',
true, => 'ok',
false => 'Nope!',
};
`);
Expand Down

0 comments on commit af9503a

Please sign in to comment.