+12
-16
lines changedFilter options
+12
-16
lines changed Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
+
export type EcmaVersion = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1
+
import { EcmaVersion } from "./ecma-versions"
1
2
import { Reader } from "./reader"
2
3
import { RegExpSyntaxError } from "./regexp-syntax-error"
3
4
import {
@@ -123,12 +124,13 @@ export namespace RegExpValidator {
123
124
strict?: boolean
124
125
125
126
/**
126
-
* ECMAScript version. Default is `2018`.
127
+
* ECMAScript version. Default is `2020`.
127
128
* - `2015` added `u` and `y` flags.
128
129
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
129
130
* and Unicode Property Escape.
131
+
* - `2019` and `2020` added more valid Unicode Property Escapes.
130
132
*/
131
-
ecmaVersion?: 5 | 2015 | 2016 | 2017 | 2018
133
+
ecmaVersion?: EcmaVersion
132
134
133
135
/**
134
136
* A function that is called when the validator entered a RegExp literal.
@@ -543,7 +545,7 @@ export class RegExpValidator {
543
545
}
544
546
545
547
private get ecmaVersion() {
546
-
return this._options.ecmaVersion || 2018
548
+
return this._options.ecmaVersion || 2020
547
549
}
548
550
549
551
private onLiteralEnter(start: number): void {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4