Add support for d flag of regex literals in parser (#13396)
This commit is contained in:
parent
813f2a3cce
commit
0b29b5c2c0
@ -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 _
|
||||
|
||||
1
packages/babel-parser/test/fixtures/es2022/regexp-match-indices/d-flag/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2022/regexp-match-indices/d-flag/input.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
/./d;
|
||||
26
packages/babel-parser/test/fixtures/es2022/regexp-match-indices/d-flag/output.json
vendored
Normal file
26
packages/babel-parser/test/fixtures/es2022/regexp-match-indices/d-flag/output.json
vendored
Normal 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": []
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user