Add support for d flag of regex literals in parser (#13396)

This commit is contained in:
Yosuke Ota 2021-05-31 21:34:53 +09:00 committed by GitHub
parent 813f2a3cce
commit 0b29b5c2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -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 _

View File

@ -0,0 +1 @@
/./d;

View File

@ -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": []
}
}