@@ -12,6 +12,7 @@ import {
12
12
Pattern ,
13
13
Quantifier ,
14
14
} from "./ast"
15
+ import { EcmaVersion } from "./ecma-versions"
15
16
import { HyphenMinus } from "./unicode"
16
17
import { RegExpValidator } from "./validator"
17
18
@@ -29,7 +30,7 @@ const DummyCapturingGroup: CapturingGroup = {} as any
29
30
30
31
class RegExpParserState {
31
32
public readonly strict : boolean
32
- public readonly ecmaVersion : 5 | 2015 | 2016 | 2017 | 2018
33
+ public readonly ecmaVersion : EcmaVersion
33
34
private _node : AppendableNode = DummyPattern
34
35
private _flags : Flags = DummyFlags
35
36
private _backreferences : Backreference [ ] = [ ]
@@ -39,7 +40,7 @@ class RegExpParserState {
39
40
40
41
public constructor ( options ?: RegExpParser . Options ) {
41
42
this . strict = Boolean ( options && options . strict )
42
- this . ecmaVersion = ( options && options . ecmaVersion ) || 2018
43
+ this . ecmaVersion = ( options && options . ecmaVersion ) || 2020
43
44
}
44
45
45
46
public get pattern ( ) : Pattern {
@@ -501,12 +502,13 @@ export namespace RegExpParser {
501
502
strict ?: boolean
502
503
503
504
/**
504
- * ECMAScript version. Default is `2018 `.
505
+ * ECMAScript version. Default is `2020 `.
505
506
* - `2015` added `u` and `y` flags.
506
507
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
507
508
* and Unicode Property Escape.
509
+ * - `2019` and `2020` added more valid Unicode Property Escapes.
508
510
*/
509
- ecmaVersion ?: 5 | 2015 | 2016 | 2017 | 2018
511
+ ecmaVersion ?: EcmaVersion
510
512
}
511
513
}
512
514
0 commit comments