Skip to content

Commit

Permalink
Add support for d flag of regex literals in parser (#13396)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed May 31, 2021
1 parent 813f2a3 commit 0b29b5c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-parser/src/tokenizer/index.js
Expand Up @@ -21,7 +21,7 @@ import {
import State from "./state";
import type { LookaheadState } from "./state";

const VALID_REGEX_FLAGS = new Set(["g", "m", "s", "i", "y", "u"]);
const VALID_REGEX_FLAGS = new Set(["g", "m", "s", "i", "y", "u", "d"]);

// The following character codes are forbidden from being
// an immediate sibling of NumericLiteralSeparator _
Expand Down
@@ -0,0 +1 @@
/./d;
@@ -0,0 +1,26 @@
{
"type": "File",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
"program": {
"type": "Program",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
"expression": {
"type": "RegExpLiteral",
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
"extra": {
"raw": "/./d"
},
"pattern": ".",
"flags": "d"
}
}
],
"directives": []
}
}

0 comments on commit 0b29b5c

Please sign in to comment.