driftjs-compiler 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-cjs.js +11 -11
- package/dist/index-es.js +514 -523
- package/package.json +2 -2
package/dist/index-es.js
CHANGED
|
@@ -209,29 +209,27 @@ function d(e) {
|
|
|
209
209
|
return n === 1;
|
|
210
210
|
}
|
|
211
211
|
function f(e, t) {
|
|
212
|
-
if (!
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (Object.prototype.hasOwnProperty.call(e, t)) return globalThis[t];
|
|
227
|
-
e = Object.getPrototypeOf(e);
|
|
212
|
+
if (!(t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__")) {
|
|
213
|
+
if (e && typeof e == "object") {
|
|
214
|
+
let n = e;
|
|
215
|
+
for (; n && n !== Object.prototype;) {
|
|
216
|
+
if (Object.prototype.hasOwnProperty.call(n, t)) return n[t];
|
|
217
|
+
n = Object.getPrototypeOf(n);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (typeof globalThis < "u" && globalThis) {
|
|
221
|
+
let e = globalThis;
|
|
222
|
+
for (; e && e !== Object.prototype;) {
|
|
223
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) return globalThis[t];
|
|
224
|
+
e = Object.getPrototypeOf(e);
|
|
225
|
+
}
|
|
228
226
|
}
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
|
-
typeof globalThis < "u" && !globalThis._get && (globalThis._get =
|
|
229
|
+
typeof globalThis < "u" && !globalThis._get && (globalThis._get = f);
|
|
232
230
|
//#endregion
|
|
233
231
|
//#region src/lexer.ts
|
|
234
|
-
var
|
|
232
|
+
var p = {
|
|
235
233
|
[t.Data]: [
|
|
236
234
|
{
|
|
237
235
|
to: t.Comment,
|
|
@@ -366,17 +364,17 @@ var m = {
|
|
|
366
364
|
emits: "EOF"
|
|
367
365
|
}]
|
|
368
366
|
};
|
|
369
|
-
function
|
|
367
|
+
function m(e) {
|
|
370
368
|
return e === "script" || e === "style";
|
|
371
369
|
}
|
|
372
|
-
var
|
|
370
|
+
var h = /* @__PURE__ */ new Set([
|
|
373
371
|
"if",
|
|
374
372
|
"else",
|
|
375
373
|
"for",
|
|
376
374
|
"switch",
|
|
377
375
|
"case",
|
|
378
376
|
"default"
|
|
379
|
-
]),
|
|
377
|
+
]), g = /* @__PURE__ */ new Set([
|
|
380
378
|
"return",
|
|
381
379
|
"yield",
|
|
382
380
|
"await",
|
|
@@ -389,7 +387,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
389
387
|
"do",
|
|
390
388
|
"throw",
|
|
391
389
|
"new"
|
|
392
|
-
]),
|
|
390
|
+
]), _ = class {
|
|
393
391
|
source;
|
|
394
392
|
offset = 0;
|
|
395
393
|
line = 1;
|
|
@@ -448,7 +446,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
448
446
|
this.advance();
|
|
449
447
|
let n = "";
|
|
450
448
|
for (; !this.isAtEnd() && /[a-zA-Z]/.test(this.peek());) n += this.advance();
|
|
451
|
-
if (!
|
|
449
|
+
if (!h.has(n)) throw new i(`Unknown directive '@${n}'`, t.line, t.column, t.offset);
|
|
452
450
|
if (n === "if") return this.readDirectiveHeader(t, e.DirectiveIf);
|
|
453
451
|
if (n === "else") {
|
|
454
452
|
if (this.skipWhitespace(), this.startsWith("if") && !/[a-zA-Z0-9_]/.test(this.peek(2))) return this.consumePattern("if"), this.readDirectiveHeader(t, e.DirectiveElseIf);
|
|
@@ -545,7 +543,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
545
543
|
if (/[a-zA-Z0-9_$]/.test(i)) {
|
|
546
544
|
let e = i;
|
|
547
545
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
548
|
-
h =
|
|
546
|
+
h = g.has(e) ? n.Keyword : n.IdentifierOrLiteral, r += e;
|
|
549
547
|
continue;
|
|
550
548
|
}
|
|
551
549
|
r += i;
|
|
@@ -556,7 +554,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
556
554
|
if (this.isAtEnd()) throw this.createUnexpectedEOFError(n ? "after closing tag opener" : "after opening tag opener");
|
|
557
555
|
let r = this.getLocation(), a = this.peek();
|
|
558
556
|
if (!this.isIdentifierStart(a)) throw new i(`Expected tag name but found '${a || "EOF"}'`, r.line, r.column, r.offset);
|
|
559
|
-
let o = this.readIdentifierValue(), s = !n &&
|
|
557
|
+
let o = this.readIdentifierValue(), s = !n && m(o);
|
|
560
558
|
return this.transitionTo({
|
|
561
559
|
kind: t.BeforeAttributeName,
|
|
562
560
|
tagName: o,
|
|
@@ -581,7 +579,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
581
579
|
return this.transitionTo({ kind: t.Data }), this.createToken(e.TagSelfClose, "/>", r);
|
|
582
580
|
}
|
|
583
581
|
}
|
|
584
|
-
if (this.peek() === ">") return this.advance(), s.has(n.tagName.toLowerCase()) || this.elementDepth++, n.entersRawText &&
|
|
582
|
+
if (this.peek() === ">") return this.advance(), s.has(n.tagName.toLowerCase()) || this.elementDepth++, n.entersRawText && m(n.tagName) ? this.transitionTo({
|
|
585
583
|
kind: t.RawText,
|
|
586
584
|
tagName: n.tagName
|
|
587
585
|
}) : this.transitionTo({ kind: t.Data }), this.createToken(e.TagClose, ">", r);
|
|
@@ -621,7 +619,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
621
619
|
kind: t.BeforeAttributeName,
|
|
622
620
|
tagName: r,
|
|
623
621
|
isClosingTag: !1,
|
|
624
|
-
entersRawText:
|
|
622
|
+
entersRawText: m(r)
|
|
625
623
|
}), this.readBeforeAttributeNameToken();
|
|
626
624
|
}
|
|
627
625
|
readBeforeAttributeValueToken() {
|
|
@@ -655,7 +653,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
655
653
|
return e === n.Start || e === n.Punctuator || e === n.Keyword;
|
|
656
654
|
}
|
|
657
655
|
readInterpolationToken(r, a, o) {
|
|
658
|
-
let s = 1, c = null, l = !1, u = !1, d = !1, f = !1, p = !1,
|
|
656
|
+
let s = 1, c = null, l = !1, u = !1, d = !1, f = !1, p = !1, h = n.Start, _ = [], v = "";
|
|
659
657
|
for (; !this.isAtEnd();) {
|
|
660
658
|
let i = this.advance();
|
|
661
659
|
if (u) {
|
|
@@ -667,17 +665,17 @@ var g = /* @__PURE__ */ new Set([
|
|
|
667
665
|
continue;
|
|
668
666
|
}
|
|
669
667
|
if (f) {
|
|
670
|
-
v += i, l ? l = !1 : i === "\\" ? l = !0 : i === "[" ? p = !0 : i === "]" && p ? p = !1 : i === "/" && !p && (f = !1,
|
|
668
|
+
v += i, l ? l = !1 : i === "\\" ? l = !0 : i === "[" ? p = !0 : i === "]" && p ? p = !1 : i === "/" && !p && (f = !1, h = n.IdentifierOrLiteral);
|
|
671
669
|
continue;
|
|
672
670
|
}
|
|
673
671
|
if (c !== null) {
|
|
674
672
|
if (v += i, l) l = !1;
|
|
675
673
|
else if (i === "\\") l = !0;
|
|
676
|
-
else if (i === c) c = null,
|
|
674
|
+
else if (i === c) c = null, h = n.IdentifierOrLiteral;
|
|
677
675
|
else if (c === "`" && i === "{" && v.endsWith("${")) {
|
|
678
676
|
let e = 0;
|
|
679
677
|
for (let t = v.length - 3; t >= 0 && v[t] === "\\"; t--) e++;
|
|
680
|
-
e % 2 == 0 && (
|
|
678
|
+
e % 2 == 0 && (_.push(s), c = null, s++, h = n.Start);
|
|
681
679
|
}
|
|
682
680
|
continue;
|
|
683
681
|
}
|
|
@@ -689,10 +687,10 @@ var g = /* @__PURE__ */ new Set([
|
|
|
689
687
|
} else if (e === "*") {
|
|
690
688
|
d = !0, v += i;
|
|
691
689
|
continue;
|
|
692
|
-
} else if (this.isRegexStart(
|
|
690
|
+
} else if (this.isRegexStart(h)) {
|
|
693
691
|
f = !0, p = !1, v += i;
|
|
694
692
|
continue;
|
|
695
|
-
} else
|
|
693
|
+
} else h = n.Punctuator;
|
|
696
694
|
}
|
|
697
695
|
if (i === "\"" || i === "'" || i === "`") {
|
|
698
696
|
inQuote: c = i;
|
|
@@ -700,31 +698,31 @@ var g = /* @__PURE__ */ new Set([
|
|
|
700
698
|
continue;
|
|
701
699
|
}
|
|
702
700
|
if (i === "(") {
|
|
703
|
-
|
|
701
|
+
h = n.Start, v += i;
|
|
704
702
|
continue;
|
|
705
703
|
}
|
|
706
704
|
if (i === ")") {
|
|
707
|
-
|
|
705
|
+
h = n.IdentifierOrLiteral, v += i;
|
|
708
706
|
continue;
|
|
709
707
|
}
|
|
710
708
|
if (i === "[") {
|
|
711
|
-
|
|
709
|
+
h = n.Start, v += i;
|
|
712
710
|
continue;
|
|
713
711
|
}
|
|
714
712
|
if (i === "]") {
|
|
715
|
-
|
|
713
|
+
h = n.IdentifierOrLiteral, v += i;
|
|
716
714
|
continue;
|
|
717
715
|
}
|
|
718
716
|
if (i === "{") {
|
|
719
|
-
s++,
|
|
717
|
+
s++, h = n.Start, v += i;
|
|
720
718
|
continue;
|
|
721
719
|
}
|
|
722
720
|
if (i === "}") {
|
|
723
|
-
if (s--,
|
|
721
|
+
if (s--, _.length > 0 && s === _[_.length - 1] && (_.pop(), c = "`"), h = n.IdentifierOrLiteral, s === 0) return a === "attribute" && o !== null ? this.transitionTo({
|
|
724
722
|
kind: t.BeforeAttributeName,
|
|
725
723
|
tagName: o,
|
|
726
724
|
isClosingTag: !1,
|
|
727
|
-
entersRawText:
|
|
725
|
+
entersRawText: m(o)
|
|
728
726
|
}) : this.transitionTo({ kind: t.Data }), this.createToken(e.Interpolation, v, r);
|
|
729
727
|
v += i;
|
|
730
728
|
continue;
|
|
@@ -732,20 +730,20 @@ var g = /* @__PURE__ */ new Set([
|
|
|
732
730
|
if (i === "+" || i === "-") {
|
|
733
731
|
if (this.peek() === i) {
|
|
734
732
|
let e = this.advance();
|
|
735
|
-
v += i + e,
|
|
733
|
+
v += i + e, h = h === n.IdentifierOrLiteral ? n.PostfixOp : n.Start;
|
|
736
734
|
continue;
|
|
737
735
|
}
|
|
738
|
-
|
|
736
|
+
h = n.Punctuator, v += i;
|
|
739
737
|
continue;
|
|
740
738
|
}
|
|
741
739
|
if ("=(,:;!&|?*%<>~^".includes(i)) {
|
|
742
|
-
|
|
740
|
+
h = n.Punctuator, v += i;
|
|
743
741
|
continue;
|
|
744
742
|
}
|
|
745
743
|
if (/[a-zA-Z0-9_$]/.test(i)) {
|
|
746
744
|
let e = i;
|
|
747
745
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
748
|
-
|
|
746
|
+
h = g.has(e) ? n.Keyword : n.IdentifierOrLiteral, v += e;
|
|
749
747
|
continue;
|
|
750
748
|
}
|
|
751
749
|
v += i;
|
|
@@ -787,7 +785,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
787
785
|
kind: t.BeforeAttributeName,
|
|
788
786
|
tagName: a,
|
|
789
787
|
isClosingTag: !1,
|
|
790
|
-
entersRawText:
|
|
788
|
+
entersRawText: m(a)
|
|
791
789
|
}), this.createToken(e.StringLiteral, o, n);
|
|
792
790
|
o += this.advance();
|
|
793
791
|
}
|
|
@@ -823,7 +821,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
823
821
|
return new i(`Unexpected end of input ${e}`, t.line, t.column, t.offset);
|
|
824
822
|
}
|
|
825
823
|
transitionTo(e) {
|
|
826
|
-
if (!
|
|
824
|
+
if (!p[this.state.kind].some((t) => t.to === e.kind)) throw Error(`Invalid lexer transition from '${this.state.kind}' to '${e.kind}'.`);
|
|
827
825
|
this.state = e;
|
|
828
826
|
}
|
|
829
827
|
getLocation() {
|
|
@@ -873,7 +871,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
873
871
|
let n = this.peek(t);
|
|
874
872
|
return n === "" || n === ">" || n === " " || n === " " || n === "\r" || n === "\n";
|
|
875
873
|
}
|
|
876
|
-
},
|
|
874
|
+
}, v = class {
|
|
877
875
|
tokens;
|
|
878
876
|
current = 0;
|
|
879
877
|
constructor(e) {
|
|
@@ -884,7 +882,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
884
882
|
let e = this.tokens[this.current];
|
|
885
883
|
return this.current++, e;
|
|
886
884
|
}
|
|
887
|
-
},
|
|
885
|
+
}, ee = {
|
|
888
886
|
amp: "&",
|
|
889
887
|
lt: "<",
|
|
890
888
|
gt: ">",
|
|
@@ -1027,7 +1025,7 @@ var g = /* @__PURE__ */ new Set([
|
|
|
1027
1025
|
psi: "ψ",
|
|
1028
1026
|
omega: "ω"
|
|
1029
1027
|
};
|
|
1030
|
-
function
|
|
1028
|
+
function te(e) {
|
|
1031
1029
|
return !e || !e.includes("&") ? e : e.replace(/&(?:#(\d+)|#x([0-9a-fA-F]+)|([a-zA-Z0-9]+));/g, (e, t, n, r) => {
|
|
1032
1030
|
if (t) {
|
|
1033
1031
|
let e = parseInt(t, 10);
|
|
@@ -1045,14 +1043,14 @@ function ne(e) {
|
|
|
1045
1043
|
return "�";
|
|
1046
1044
|
}
|
|
1047
1045
|
}
|
|
1048
|
-
return r &&
|
|
1046
|
+
return r && ee[r] || e;
|
|
1049
1047
|
});
|
|
1050
1048
|
}
|
|
1051
|
-
var
|
|
1049
|
+
var ne = class {
|
|
1052
1050
|
tokenSource;
|
|
1053
1051
|
lookahead = [];
|
|
1054
1052
|
constructor(e) {
|
|
1055
|
-
this.tokenSource = Array.isArray(e) ? new
|
|
1053
|
+
this.tokenSource = Array.isArray(e) ? new v(e) : e;
|
|
1056
1054
|
}
|
|
1057
1055
|
parse() {
|
|
1058
1056
|
return this.lookahead.length = 0, this.parseProgram();
|
|
@@ -1088,7 +1086,7 @@ var re = class {
|
|
|
1088
1086
|
if (t.type === e.DirectiveSwitch) return this.parseSwitchDirective();
|
|
1089
1087
|
if (t.type === e.Text) return this.advance(), {
|
|
1090
1088
|
type: r.Text,
|
|
1091
|
-
content:
|
|
1089
|
+
content: te(t.value),
|
|
1092
1090
|
loc: t.loc
|
|
1093
1091
|
};
|
|
1094
1092
|
throw t.type === e.TagOpenSlash ? new a(`Unexpected closing tag '</${this.peek(1).value}>' without opening tag`, t.loc.start.line, t.loc.start.column, t.loc.start.offset) : new a(`Unexpected token '${t.value}' of type '${t.type}'`, t.loc.start.line, t.loc.start.column, t.loc.start.offset);
|
|
@@ -1155,7 +1153,7 @@ var re = class {
|
|
|
1155
1153
|
if (t.type === e.StringLiteral) return this.advance(), {
|
|
1156
1154
|
type: r.Attribute,
|
|
1157
1155
|
name: i,
|
|
1158
|
-
value:
|
|
1156
|
+
value: te(t.value),
|
|
1159
1157
|
loc: {
|
|
1160
1158
|
start: n,
|
|
1161
1159
|
end: t.loc.end
|
|
@@ -1373,7 +1371,7 @@ var re = class {
|
|
|
1373
1371
|
if (this.lookahead.push(t), t.type === e.EOF) break;
|
|
1374
1372
|
}
|
|
1375
1373
|
}
|
|
1376
|
-
},
|
|
1374
|
+
}, re = [
|
|
1377
1375
|
509,
|
|
1378
1376
|
0,
|
|
1379
1377
|
227,
|
|
@@ -1704,7 +1702,7 @@ var re = class {
|
|
|
1704
1702
|
9,
|
|
1705
1703
|
787719,
|
|
1706
1704
|
239
|
|
1707
|
-
],
|
|
1705
|
+
], ie = [
|
|
1708
1706
|
0,
|
|
1709
1707
|
11,
|
|
1710
1708
|
2,
|
|
@@ -2323,18 +2321,18 @@ var re = class {
|
|
|
2323
2321
|
4938,
|
|
2324
2322
|
6,
|
|
2325
2323
|
8489
|
|
2326
|
-
],
|
|
2324
|
+
], ae = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・", oe = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", se = {
|
|
2327
2325
|
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
2328
2326
|
5: "class enum extends super const export import",
|
|
2329
2327
|
6: "enum",
|
|
2330
2328
|
strict: "implements interface let package private protected public static yield",
|
|
2331
2329
|
strictBind: "eval arguments"
|
|
2332
|
-
},
|
|
2333
|
-
5:
|
|
2334
|
-
"5module":
|
|
2335
|
-
6:
|
|
2336
|
-
},
|
|
2337
|
-
function
|
|
2330
|
+
}, ce = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this", le = {
|
|
2331
|
+
5: ce,
|
|
2332
|
+
"5module": ce + " export import",
|
|
2333
|
+
6: ce + " const class extends export import super"
|
|
2334
|
+
}, ue = /^in(stanceof)?$/, de = RegExp("[" + oe + "]"), fe = RegExp("[" + oe + ae + "]");
|
|
2335
|
+
function pe(e, t) {
|
|
2338
2336
|
for (var n = 65536, r = 0; r < t.length; r += 2) {
|
|
2339
2337
|
if (n += t[r], n > e) return !1;
|
|
2340
2338
|
if (n += t[r + 1], n >= e) return !0;
|
|
@@ -2342,10 +2340,10 @@ function me(e, t) {
|
|
|
2342
2340
|
return !1;
|
|
2343
2341
|
}
|
|
2344
2342
|
function y(e, t) {
|
|
2345
|
-
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 &&
|
|
2343
|
+
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 && de.test(String.fromCharCode(e)) : t !== !1 && pe(e, ie);
|
|
2346
2344
|
}
|
|
2347
2345
|
function b(e, t) {
|
|
2348
|
-
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 &&
|
|
2346
|
+
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 && fe.test(String.fromCharCode(e)) : t === !1 ? !1 : pe(e, ie) || pe(e, re);
|
|
2349
2347
|
}
|
|
2350
2348
|
var x = function(e, t) {
|
|
2351
2349
|
t === void 0 && (t = {}), this.label = e, this.keyword = t.keyword, this.beforeExpr = !!t.beforeExpr, this.startsExpr = !!t.startsExpr, this.isLoop = !!t.isLoop, this.isAssign = !!t.isAssign, this.prefix = !!t.prefix, this.postfix = !!t.postfix, this.binop = t.binop || null, this.updateContext = null;
|
|
@@ -2356,9 +2354,9 @@ function S(e, t) {
|
|
|
2356
2354
|
binop: t
|
|
2357
2355
|
});
|
|
2358
2356
|
}
|
|
2359
|
-
var C = { beforeExpr: !0 }, w = { startsExpr: !0 },
|
|
2357
|
+
var C = { beforeExpr: !0 }, w = { startsExpr: !0 }, me = {};
|
|
2360
2358
|
function T(e, t) {
|
|
2361
|
-
return t === void 0 && (t = {}), t.keyword = e,
|
|
2359
|
+
return t === void 0 && (t = {}), t.keyword = e, me[e] = new x(e, t);
|
|
2362
2360
|
}
|
|
2363
2361
|
var E = {
|
|
2364
2362
|
num: new x("num", w),
|
|
@@ -2493,46 +2491,46 @@ var E = {
|
|
|
2493
2491
|
prefix: !0,
|
|
2494
2492
|
startsExpr: !0
|
|
2495
2493
|
})
|
|
2496
|
-
}, D = /\r\n?|\n|\u2028|\u2029/,
|
|
2497
|
-
function
|
|
2494
|
+
}, D = /\r\n?|\n|\u2028|\u2029/, he = new RegExp(D.source, "g");
|
|
2495
|
+
function ge(e) {
|
|
2498
2496
|
return e === 10 || e === 13 || e === 8232 || e === 8233;
|
|
2499
2497
|
}
|
|
2500
|
-
function
|
|
2498
|
+
function _e(e, t, n) {
|
|
2501
2499
|
n === void 0 && (n = e.length);
|
|
2502
2500
|
for (var r = t; r < n; r++) {
|
|
2503
2501
|
var i = e.charCodeAt(r);
|
|
2504
|
-
if (
|
|
2502
|
+
if (ge(i)) return r < n - 1 && i === 13 && e.charCodeAt(r + 1) === 10 ? r + 2 : r + 1;
|
|
2505
2503
|
}
|
|
2506
2504
|
return -1;
|
|
2507
2505
|
}
|
|
2508
|
-
var
|
|
2509
|
-
return
|
|
2510
|
-
}),
|
|
2511
|
-
return
|
|
2512
|
-
}),
|
|
2506
|
+
var ve = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, O = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, ye = Object.prototype, be = ye.hasOwnProperty, xe = ye.toString, Se = Object.hasOwn || (function(e, t) {
|
|
2507
|
+
return be.call(e, t);
|
|
2508
|
+
}), Ce = Array.isArray || (function(e) {
|
|
2509
|
+
return xe.call(e) === "[object Array]";
|
|
2510
|
+
}), we = Object.create(null);
|
|
2513
2511
|
function k(e) {
|
|
2514
|
-
return
|
|
2512
|
+
return we[e] || (we[e] = RegExp("^(?:" + e.replace(/ /g, "|") + ")$"));
|
|
2515
2513
|
}
|
|
2516
2514
|
function A(e) {
|
|
2517
2515
|
return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
|
|
2518
2516
|
}
|
|
2519
|
-
var
|
|
2517
|
+
var Te = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, Ee = function(e, t) {
|
|
2520
2518
|
this.line = e, this.column = t;
|
|
2521
2519
|
};
|
|
2522
|
-
|
|
2523
|
-
return new
|
|
2520
|
+
Ee.prototype.offset = function(e) {
|
|
2521
|
+
return new Ee(this.line, this.column + e);
|
|
2524
2522
|
};
|
|
2525
|
-
var
|
|
2523
|
+
var De = function(e, t, n) {
|
|
2526
2524
|
this.start = t, this.end = n, e.sourceFile !== null && (this.source = e.sourceFile);
|
|
2527
2525
|
};
|
|
2528
|
-
function
|
|
2526
|
+
function Oe(e, t) {
|
|
2529
2527
|
for (var n = 1, r = 0;;) {
|
|
2530
|
-
var i =
|
|
2531
|
-
if (i < 0) return new
|
|
2528
|
+
var i = _e(e, r, t);
|
|
2529
|
+
if (i < 0) return new Ee(n, t - r);
|
|
2532
2530
|
++n, r = i;
|
|
2533
2531
|
}
|
|
2534
2532
|
}
|
|
2535
|
-
var
|
|
2533
|
+
var ke = {
|
|
2536
2534
|
ecmaVersion: null,
|
|
2537
2535
|
sourceType: "script",
|
|
2538
2536
|
strict: !1,
|
|
@@ -2553,20 +2551,20 @@ var Ae = {
|
|
|
2553
2551
|
sourceFile: null,
|
|
2554
2552
|
directSourceFile: null,
|
|
2555
2553
|
preserveParens: !1
|
|
2556
|
-
},
|
|
2557
|
-
function
|
|
2554
|
+
}, Ae = !1;
|
|
2555
|
+
function je(e) {
|
|
2558
2556
|
var t = {};
|
|
2559
|
-
for (var n in
|
|
2560
|
-
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!
|
|
2557
|
+
for (var n in ke) t[n] = e && Se(e, n) ? e[n] : ke[n];
|
|
2558
|
+
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!Ae && typeof console == "object" && console.warn && (Ae = !0, console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")), t.ecmaVersion = 11) : t.ecmaVersion >= 2015 && (t.ecmaVersion -= 2009), t.allowReserved ??= t.ecmaVersion < 5, (!e || e.allowHashBang == null) && (t.allowHashBang = t.ecmaVersion >= 14), Ce(t.onToken)) {
|
|
2561
2559
|
var r = t.onToken;
|
|
2562
2560
|
t.onToken = function(e) {
|
|
2563
2561
|
return r.push(e);
|
|
2564
2562
|
};
|
|
2565
2563
|
}
|
|
2566
|
-
if (
|
|
2564
|
+
if (Ce(t.onComment) && (t.onComment = Me(t, t.onComment)), t.sourceType === "commonjs" && t.allowAwaitOutsideFunction) throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
2567
2565
|
return t;
|
|
2568
2566
|
}
|
|
2569
|
-
function
|
|
2567
|
+
function Me(e, t) {
|
|
2570
2568
|
return function(n, r, i, a, o, s) {
|
|
2571
2569
|
var c = {
|
|
2572
2570
|
type: n ? "Block" : "Line",
|
|
@@ -2574,20 +2572,20 @@ function Ne(e, t) {
|
|
|
2574
2572
|
start: i,
|
|
2575
2573
|
end: a
|
|
2576
2574
|
};
|
|
2577
|
-
e.locations && (c.loc = new
|
|
2575
|
+
e.locations && (c.loc = new De(this, o, s)), e.ranges && (c.range = [i, a]), t.push(c);
|
|
2578
2576
|
};
|
|
2579
2577
|
}
|
|
2580
|
-
var
|
|
2578
|
+
var Ne = 1, j = 2, Pe = 4, Fe = 8, Ie = 16, Le = 32, Re = 64, ze = 128, M = 256, Be = 512, Ve = 1024, He = Ne | j | M;
|
|
2581
2579
|
function Ue(e, t) {
|
|
2582
|
-
return
|
|
2580
|
+
return j | (e ? Pe : 0) | (t ? Fe : 0);
|
|
2583
2581
|
}
|
|
2584
|
-
var We = 0, Ge = 1,
|
|
2585
|
-
this.options = e =
|
|
2582
|
+
var We = 0, Ge = 1, N = 2, Ke = 3, qe = 4, Je = 5, P = function(e, t, n) {
|
|
2583
|
+
this.options = e = je(e), this.sourceFile = e.sourceFile, this.keywords = k(le[e.ecmaVersion >= 6 ? 6 : e.sourceType === "module" ? "5module" : 5]);
|
|
2586
2584
|
var r = "";
|
|
2587
|
-
e.allowReserved !== !0 && (r =
|
|
2588
|
-
var i = (r ? r + " " : "") +
|
|
2589
|
-
this.reservedWordsStrict = k(i), this.reservedWordsStrictBind = k(i + " " +
|
|
2590
|
-
},
|
|
2585
|
+
e.allowReserved !== !0 && (r = se[e.ecmaVersion >= 6 ? 6 : e.ecmaVersion === 5 ? 5 : 3], e.sourceType === "module" && (r += " await")), this.reservedWords = k(r);
|
|
2586
|
+
var i = (r ? r + " " : "") + se.strict;
|
|
2587
|
+
this.reservedWordsStrict = k(i), this.reservedWordsStrictBind = k(i + " " + se.strictBind), this.input = String(t), this.containsEsc = !1, n ? (this.pos = n, this.lineStart = this.input.lastIndexOf("\n", n - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(D).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = E.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = e.sourceType === "module", this.strict = this.inModule || e.strict === !0 || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && e.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ? j : Ne), this.regexpState = null, this.privateNameStack = [];
|
|
2588
|
+
}, F = {
|
|
2591
2589
|
inFunction: { configurable: !0 },
|
|
2592
2590
|
inGenerator: { configurable: !0 },
|
|
2593
2591
|
inAsync: { configurable: !0 },
|
|
@@ -2600,57 +2598,57 @@ var We = 0, Ge = 1, P = 2, Ke = 3, qe = 4, Je = 5, F = function(e, t, n) {
|
|
|
2600
2598
|
allowUsing: { configurable: !0 },
|
|
2601
2599
|
inClassStaticBlock: { configurable: !0 }
|
|
2602
2600
|
};
|
|
2603
|
-
|
|
2601
|
+
P.prototype.parse = function() {
|
|
2604
2602
|
var e = this, t = this.options.program || this.startNode();
|
|
2605
2603
|
return this.nextToken(), this.catchStackOverflow(function() {
|
|
2606
2604
|
return e.parseTopLevel(t);
|
|
2607
2605
|
});
|
|
2608
|
-
},
|
|
2609
|
-
return (this.currentVarScope().flags &
|
|
2610
|
-
},
|
|
2606
|
+
}, F.inFunction.get = function() {
|
|
2607
|
+
return (this.currentVarScope().flags & j) > 0;
|
|
2608
|
+
}, F.inGenerator.get = function() {
|
|
2611
2609
|
return (this.currentVarScope().flags & Fe) > 0;
|
|
2612
|
-
},
|
|
2610
|
+
}, F.inAsync.get = function() {
|
|
2613
2611
|
return (this.currentVarScope().flags & Pe) > 0;
|
|
2614
|
-
},
|
|
2612
|
+
}, F.canAwait.get = function() {
|
|
2615
2613
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
2616
2614
|
var t = this.scopeStack[e].flags;
|
|
2617
|
-
if (t & (
|
|
2618
|
-
if (t &
|
|
2615
|
+
if (t & (M | Be)) return !1;
|
|
2616
|
+
if (t & j) return (t & Pe) > 0;
|
|
2619
2617
|
}
|
|
2620
2618
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
2621
|
-
},
|
|
2622
|
-
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags &
|
|
2623
|
-
},
|
|
2619
|
+
}, F.allowReturn.get = function() {
|
|
2620
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & Ne);
|
|
2621
|
+
}, F.allowSuper.get = function() {
|
|
2624
2622
|
return (this.currentThisScope().flags & Re) > 0 || this.options.allowSuperOutsideMethod;
|
|
2625
|
-
},
|
|
2623
|
+
}, F.allowDirectSuper.get = function() {
|
|
2626
2624
|
return (this.currentThisScope().flags & ze) > 0;
|
|
2627
|
-
},
|
|
2625
|
+
}, F.treatFunctionsAsVar.get = function() {
|
|
2628
2626
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
2629
|
-
},
|
|
2627
|
+
}, F.allowNewDotTarget.get = function() {
|
|
2630
2628
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
2631
2629
|
var t = this.scopeStack[e].flags;
|
|
2632
|
-
if (t & (
|
|
2630
|
+
if (t & (M | Be) || t & j && !(t & Ie)) return !0;
|
|
2633
2631
|
}
|
|
2634
2632
|
return !1;
|
|
2635
|
-
},
|
|
2633
|
+
}, F.allowUsing.get = function() {
|
|
2636
2634
|
var e = this.currentScope().flags;
|
|
2637
|
-
return !(e & Ve || !this.inModule && e &
|
|
2638
|
-
},
|
|
2639
|
-
return (this.currentVarScope().flags &
|
|
2640
|
-
},
|
|
2635
|
+
return !(e & Ve || !this.inModule && e & Ne);
|
|
2636
|
+
}, F.inClassStaticBlock.get = function() {
|
|
2637
|
+
return (this.currentVarScope().flags & M) > 0;
|
|
2638
|
+
}, P.extend = function() {
|
|
2641
2639
|
for (var e = [], t = arguments.length; t--;) e[t] = arguments[t];
|
|
2642
2640
|
for (var n = this, r = 0; r < e.length; r++) n = e[r](n);
|
|
2643
2641
|
return n;
|
|
2644
|
-
},
|
|
2642
|
+
}, P.parse = function(e, t) {
|
|
2645
2643
|
return new this(t, e).parse();
|
|
2646
|
-
},
|
|
2644
|
+
}, P.parseExpressionAt = function(e, t, n) {
|
|
2647
2645
|
var r = new this(n, e, t);
|
|
2648
2646
|
return r.nextToken(), r.parseExpression();
|
|
2649
|
-
},
|
|
2647
|
+
}, P.tokenizer = function(e, t) {
|
|
2650
2648
|
return new this(t, e);
|
|
2651
|
-
}, Object.defineProperties(
|
|
2652
|
-
var
|
|
2653
|
-
|
|
2649
|
+
}, Object.defineProperties(P.prototype, F);
|
|
2650
|
+
var I = P.prototype, Ye = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
2651
|
+
I.strictDirective = function(e) {
|
|
2654
2652
|
if (this.options.ecmaVersion < 5) return !1;
|
|
2655
2653
|
for (;;) {
|
|
2656
2654
|
O.lastIndex = e, e += O.exec(this.input)[0].length;
|
|
@@ -2663,55 +2661,55 @@ L.strictDirective = function(e) {
|
|
|
2663
2661
|
}
|
|
2664
2662
|
e += t[0].length, O.lastIndex = e, e += O.exec(this.input)[0].length, this.input[e] === ";" && e++;
|
|
2665
2663
|
}
|
|
2666
|
-
},
|
|
2664
|
+
}, I.eat = function(e) {
|
|
2667
2665
|
return this.type === e ? (this.next(), !0) : !1;
|
|
2668
|
-
},
|
|
2666
|
+
}, I.isContextual = function(e) {
|
|
2669
2667
|
return this.type === E.name && this.value === e && !this.containsEsc;
|
|
2670
|
-
},
|
|
2668
|
+
}, I.eatContextual = function(e) {
|
|
2671
2669
|
return this.isContextual(e) ? (this.next(), !0) : !1;
|
|
2672
|
-
},
|
|
2670
|
+
}, I.catchStackOverflow = function(e) {
|
|
2673
2671
|
try {
|
|
2674
2672
|
return e();
|
|
2675
2673
|
} catch (e) {
|
|
2676
2674
|
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) this.raise(this.start, "Not enough stack space to parse input");
|
|
2677
2675
|
else throw e;
|
|
2678
2676
|
}
|
|
2679
|
-
},
|
|
2677
|
+
}, I.expectContextual = function(e) {
|
|
2680
2678
|
this.eatContextual(e) || this.unexpected();
|
|
2681
|
-
},
|
|
2679
|
+
}, I.canInsertSemicolon = function() {
|
|
2682
2680
|
return this.type === E.eof || this.type === E.braceR || D.test(this.input.slice(this.lastTokEnd, this.start));
|
|
2683
|
-
},
|
|
2681
|
+
}, I.insertSemicolon = function() {
|
|
2684
2682
|
if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
2685
|
-
},
|
|
2683
|
+
}, I.semicolon = function() {
|
|
2686
2684
|
!this.eat(E.semi) && !this.insertSemicolon() && this.unexpected();
|
|
2687
|
-
},
|
|
2685
|
+
}, I.afterTrailingComma = function(e, t) {
|
|
2688
2686
|
if (this.type === e) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), t || this.next(), !0;
|
|
2689
|
-
},
|
|
2687
|
+
}, I.expect = function(e) {
|
|
2690
2688
|
this.eat(e) || this.unexpected();
|
|
2691
|
-
},
|
|
2689
|
+
}, I.unexpected = function(e) {
|
|
2692
2690
|
this.raise(e ?? this.start, "Unexpected token");
|
|
2693
2691
|
};
|
|
2694
2692
|
var Xe = function() {
|
|
2695
2693
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
2696
2694
|
};
|
|
2697
|
-
|
|
2695
|
+
I.checkPatternErrors = function(e, t) {
|
|
2698
2696
|
if (e) {
|
|
2699
2697
|
e.trailingComma > -1 && this.raiseRecoverable(e.trailingComma, "Comma is not permitted after the rest element");
|
|
2700
2698
|
var n = t ? e.parenthesizedAssign : e.parenthesizedBind;
|
|
2701
2699
|
n > -1 && this.raiseRecoverable(n, t ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
2702
2700
|
}
|
|
2703
|
-
},
|
|
2701
|
+
}, I.checkExpressionErrors = function(e, t) {
|
|
2704
2702
|
if (!e) return !1;
|
|
2705
2703
|
var n = e.shorthandAssign, r = e.doubleProto;
|
|
2706
2704
|
if (!t) return n >= 0 || r >= 0;
|
|
2707
2705
|
n >= 0 && this.raise(n, "Shorthand property assignments are valid only in destructuring patterns"), r >= 0 && this.raiseRecoverable(r, "Redefinition of __proto__ property");
|
|
2708
|
-
},
|
|
2706
|
+
}, I.checkYieldAwaitInDefaultParams = function() {
|
|
2709
2707
|
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
2710
|
-
},
|
|
2708
|
+
}, I.isSimpleAssignTarget = function(e) {
|
|
2711
2709
|
return e.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(e.expression) : e.type === "Identifier" || e.type === "MemberExpression";
|
|
2712
2710
|
};
|
|
2713
|
-
var
|
|
2714
|
-
|
|
2711
|
+
var L = P.prototype;
|
|
2712
|
+
L.parseTopLevel = function(e) {
|
|
2715
2713
|
var t = Object.create(null);
|
|
2716
2714
|
for (e.body ||= []; this.type !== E.eof;) {
|
|
2717
2715
|
var n = this.parseStatement(null, !0, t);
|
|
@@ -2724,7 +2722,7 @@ R.parseTopLevel = function(e) {
|
|
|
2724
2722
|
return this.adaptDirectivePrologue(e.body), this.next(), e.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(e, "Program");
|
|
2725
2723
|
};
|
|
2726
2724
|
var Ze = { kind: "loop" }, Qe = { kind: "switch" };
|
|
2727
|
-
|
|
2725
|
+
L.isLet = function(e) {
|
|
2728
2726
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
2729
2727
|
O.lastIndex = this.pos;
|
|
2730
2728
|
var t = O.exec(this.input), n = this.pos + t[0].length, r = this.fullCharCodeAt(n);
|
|
@@ -2738,15 +2736,15 @@ R.isLet = function(e) {
|
|
|
2738
2736
|
while (b(r = this.fullCharCodeAt(n)));
|
|
2739
2737
|
if (r === 92) return !0;
|
|
2740
2738
|
var a = this.input.slice(i, n);
|
|
2741
|
-
if (!
|
|
2739
|
+
if (!ue.test(a)) return !0;
|
|
2742
2740
|
}
|
|
2743
2741
|
return !1;
|
|
2744
|
-
},
|
|
2742
|
+
}, L.isAsyncFunction = function() {
|
|
2745
2743
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
2746
2744
|
O.lastIndex = this.pos;
|
|
2747
2745
|
var e = O.exec(this.input), t = this.pos + e[0].length, n;
|
|
2748
2746
|
return !D.test(this.input.slice(this.pos, t)) && this.input.slice(t, t + 8) === "function" && (t + 8 === this.input.length || !(b(n = this.fullCharCodeAt(t + 8)) || n === 92));
|
|
2749
|
-
},
|
|
2747
|
+
}, L.isUsingKeyword = function(e, t) {
|
|
2750
2748
|
if (this.options.ecmaVersion < 17 || !this.isContextual(e ? "await" : "using")) return !1;
|
|
2751
2749
|
O.lastIndex = this.pos;
|
|
2752
2750
|
var n = O.exec(this.input), r = this.pos + n[0].length;
|
|
@@ -2766,18 +2764,18 @@ R.isLet = function(e) {
|
|
|
2766
2764
|
while (b(s = this.fullCharCodeAt(r)));
|
|
2767
2765
|
if (s === 92) return !0;
|
|
2768
2766
|
var l = this.input.slice(c, r);
|
|
2769
|
-
if (
|
|
2767
|
+
if (ue.test(l)) return !1;
|
|
2770
2768
|
if (t && !e && l === "of") {
|
|
2771
2769
|
O.lastIndex = r;
|
|
2772
2770
|
var u = O.exec(this.input);
|
|
2773
2771
|
if (r += u[0].length, this.input.charCodeAt(r) !== 61 || (s = this.input.charCodeAt(r + 1)) === 61 || s === 62) return !1;
|
|
2774
2772
|
}
|
|
2775
2773
|
return !0;
|
|
2776
|
-
},
|
|
2774
|
+
}, L.isAwaitUsing = function(e) {
|
|
2777
2775
|
return this.isUsingKeyword(!0, e);
|
|
2778
|
-
},
|
|
2776
|
+
}, L.isUsing = function(e) {
|
|
2779
2777
|
return this.isUsingKeyword(!1, e);
|
|
2780
|
-
},
|
|
2778
|
+
}, L.parseStatement = function(e, t, n) {
|
|
2781
2779
|
var r = this.type, i = this.startNode(), a;
|
|
2782
2780
|
switch (this.isLet(e) && (r = E._var, a = "let"), r) {
|
|
2783
2781
|
case E._break:
|
|
@@ -2813,7 +2811,7 @@ R.isLet = function(e) {
|
|
|
2813
2811
|
var u = this.value, d = this.parseExpression();
|
|
2814
2812
|
return r === E.name && d.type === "Identifier" && this.eat(E.colon) ? this.parseLabeledStatement(i, u, d, e) : this.parseExpressionStatement(i, d);
|
|
2815
2813
|
}
|
|
2816
|
-
},
|
|
2814
|
+
}, L.parseBreakContinueStatement = function(e, t) {
|
|
2817
2815
|
var n = t === "break";
|
|
2818
2816
|
this.next(), this.eat(E.semi) || this.insertSemicolon() ? e.label = null : this.type === E.name ? (e.label = this.parseIdent(), this.semicolon()) : this.unexpected();
|
|
2819
2817
|
for (var r = 0; r < this.labels.length; ++r) {
|
|
@@ -2821,11 +2819,11 @@ R.isLet = function(e) {
|
|
|
2821
2819
|
if ((e.label == null || i.name === e.label.name) && (i.kind != null && (n || i.kind === "loop") || e.label && n)) break;
|
|
2822
2820
|
}
|
|
2823
2821
|
return r === this.labels.length && this.raise(e.start, "Unsyntactic " + t), this.finishNode(e, n ? "BreakStatement" : "ContinueStatement");
|
|
2824
|
-
},
|
|
2822
|
+
}, L.parseDebuggerStatement = function(e) {
|
|
2825
2823
|
return this.next(), this.semicolon(), this.finishNode(e, "DebuggerStatement");
|
|
2826
|
-
},
|
|
2824
|
+
}, L.parseDoStatement = function(e) {
|
|
2827
2825
|
return this.next(), this.labels.push(Ze), e.body = this.parseStatement("do"), this.labels.pop(), this.expect(E._while), e.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(E.semi) : this.semicolon(), this.finishNode(e, "DoWhileStatement");
|
|
2828
|
-
},
|
|
2826
|
+
}, L.parseForStatement = function(e) {
|
|
2829
2827
|
this.next();
|
|
2830
2828
|
var t = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
2831
2829
|
if (this.labels.push(Ze), this.enterScope(0), this.expect(E.parenL), this.type === E.semi) return t > -1 && this.unexpected(t), this.parseFor(e, null);
|
|
@@ -2841,43 +2839,43 @@ R.isLet = function(e) {
|
|
|
2841
2839
|
}
|
|
2842
2840
|
var l = this.containsEsc, u = new Xe(), d = this.start, f = t > -1 ? this.parseExprSubscripts(u, "await") : this.parseExpression(!0, u);
|
|
2843
2841
|
return this.type === E._in || (o = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (t > -1 ? (this.type === E._in && this.unexpected(t), e.await = !0) : o && this.options.ecmaVersion >= 8 && (f.start === d && !l && f.type === "Identifier" && f.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (e.await = !1)), a && o && this.raise(f.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(f, !1, u), this.checkLValPattern(f), this.parseForIn(e, f)) : (this.checkExpressionErrors(u, !0), t > -1 && this.unexpected(t), this.parseFor(e, f));
|
|
2844
|
-
},
|
|
2842
|
+
}, L.parseForAfterInit = function(e, t, n) {
|
|
2845
2843
|
return (this.type === E._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && t.declarations.length === 1 ? (this.type === E._in ? ((t.kind === "using" || t.kind === "await using") && !t.declarations[0].init && this.raise(this.start, "Using declaration is not allowed in for-in loops"), this.options.ecmaVersion >= 9 && n > -1 && this.unexpected(n)) : this.options.ecmaVersion >= 9 && (e.await = n > -1), this.parseForIn(e, t)) : (n > -1 && this.unexpected(n), this.parseFor(e, t));
|
|
2846
|
-
},
|
|
2844
|
+
}, L.parseFunctionStatement = function(e, t, n) {
|
|
2847
2845
|
return this.next(), this.parseFunction(e, et | (n ? 0 : tt), !1, t);
|
|
2848
|
-
},
|
|
2846
|
+
}, L.parseIfStatement = function(e) {
|
|
2849
2847
|
return this.next(), e.test = this.parseParenExpression(), e.consequent = this.parseStatement("if"), e.alternate = this.eat(E._else) ? this.parseStatement("if") : null, this.finishNode(e, "IfStatement");
|
|
2850
|
-
},
|
|
2848
|
+
}, L.parseReturnStatement = function(e) {
|
|
2851
2849
|
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(E.semi) || this.insertSemicolon() ? e.argument = null : (e.argument = this.parseExpression(), this.semicolon()), this.finishNode(e, "ReturnStatement");
|
|
2852
|
-
},
|
|
2850
|
+
}, L.parseSwitchStatement = function(e) {
|
|
2853
2851
|
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(E.braceL), this.labels.push(Qe), this.enterScope(Ve);
|
|
2854
2852
|
for (var t, n = !1; this.type !== E.braceR;) if (this.type === E._case || this.type === E._default) {
|
|
2855
2853
|
var r = this.type === E._case;
|
|
2856
2854
|
t && this.finishNode(t, "SwitchCase"), e.cases.push(t = this.startNode()), t.consequent = [], this.next(), r ? t.test = this.parseExpression() : (n && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), n = !0, t.test = null), this.expect(E.colon);
|
|
2857
2855
|
} else t || this.unexpected(), t.consequent.push(this.parseStatement(null));
|
|
2858
2856
|
return this.exitScope(), t && this.finishNode(t, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(e, "SwitchStatement");
|
|
2859
|
-
},
|
|
2857
|
+
}, L.parseThrowStatement = function(e) {
|
|
2860
2858
|
return this.next(), D.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), e.argument = this.parseExpression(), this.semicolon(), this.finishNode(e, "ThrowStatement");
|
|
2861
2859
|
};
|
|
2862
2860
|
var $e = [];
|
|
2863
|
-
|
|
2861
|
+
L.parseCatchClauseParam = function() {
|
|
2864
2862
|
var e = this.parseBindingAtom(), t = e.type === "Identifier";
|
|
2865
|
-
return this.enterScope(t ? Le : 0), this.checkLValPattern(e, t ? qe :
|
|
2866
|
-
},
|
|
2863
|
+
return this.enterScope(t ? Le : 0), this.checkLValPattern(e, t ? qe : N), this.expect(E.parenR), e;
|
|
2864
|
+
}, L.parseTryStatement = function(e) {
|
|
2867
2865
|
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.type === E._catch) {
|
|
2868
2866
|
var t = this.startNode();
|
|
2869
2867
|
this.next(), this.eat(E.parenL) ? t.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), t.param = null, this.enterScope(0)), t.body = this.parseBlock(!1), this.exitScope(), e.handler = this.finishNode(t, "CatchClause");
|
|
2870
2868
|
}
|
|
2871
2869
|
return e.finalizer = this.eat(E._finally) ? this.parseBlock() : null, !e.handler && !e.finalizer && this.raise(e.start, "Missing catch or finally clause"), this.finishNode(e, "TryStatement");
|
|
2872
|
-
},
|
|
2870
|
+
}, L.parseVarStatement = function(e, t, n) {
|
|
2873
2871
|
return this.next(), this.parseVar(e, !1, t, n), this.semicolon(), this.finishNode(e, "VariableDeclaration");
|
|
2874
|
-
},
|
|
2872
|
+
}, L.parseWhileStatement = function(e) {
|
|
2875
2873
|
return this.next(), e.test = this.parseParenExpression(), this.labels.push(Ze), e.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(e, "WhileStatement");
|
|
2876
|
-
},
|
|
2874
|
+
}, L.parseWithStatement = function(e) {
|
|
2877
2875
|
return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), e.object = this.parseParenExpression(), e.body = this.parseStatement("with"), this.finishNode(e, "WithStatement");
|
|
2878
|
-
},
|
|
2876
|
+
}, L.parseEmptyStatement = function(e) {
|
|
2879
2877
|
return this.next(), this.finishNode(e, "EmptyStatement");
|
|
2880
|
-
},
|
|
2878
|
+
}, L.parseLabeledStatement = function(e, t, n, r) {
|
|
2881
2879
|
for (var i = 0, a = this.labels; i < a.length; i += 1) a[i].name === t && this.raise(n.start, "Label '" + t + "' is already declared");
|
|
2882
2880
|
for (var o = this.type.isLoop ? "loop" : this.type === E._switch ? "switch" : null, s = this.labels.length - 1; s >= 0; s--) {
|
|
2883
2881
|
var c = this.labels[s];
|
|
@@ -2889,36 +2887,36 @@ R.parseCatchClauseParam = function() {
|
|
|
2889
2887
|
kind: o,
|
|
2890
2888
|
statementStart: this.start
|
|
2891
2889
|
}), e.body = this.parseStatement(r ? r.indexOf("label") === -1 ? r + "label" : r : "label"), this.labels.pop(), e.label = n, this.finishNode(e, "LabeledStatement");
|
|
2892
|
-
},
|
|
2890
|
+
}, L.parseExpressionStatement = function(e, t) {
|
|
2893
2891
|
return e.expression = t, this.semicolon(), this.finishNode(e, "ExpressionStatement");
|
|
2894
|
-
},
|
|
2892
|
+
}, L.parseBlock = function(e, t, n) {
|
|
2895
2893
|
for (e === void 0 && (e = !0), t === void 0 && (t = this.startNode()), t.body = [], this.expect(E.braceL), e && this.enterScope(0); this.type !== E.braceR;) {
|
|
2896
2894
|
var r = this.parseStatement(null);
|
|
2897
2895
|
t.body.push(r);
|
|
2898
2896
|
}
|
|
2899
2897
|
return n && (this.strict = !1), this.next(), e && this.exitScope(), this.finishNode(t, "BlockStatement");
|
|
2900
|
-
},
|
|
2898
|
+
}, L.parseFor = function(e, t) {
|
|
2901
2899
|
return e.init = t, this.expect(E.semi), e.test = this.type === E.semi ? null : this.parseExpression(), this.expect(E.semi), e.update = this.type === E.parenR ? null : this.parseExpression(), this.expect(E.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, "ForStatement");
|
|
2902
|
-
},
|
|
2900
|
+
}, L.parseForIn = function(e, t) {
|
|
2903
2901
|
var n = this.type === E._in;
|
|
2904
2902
|
return this.next(), t.type === "VariableDeclaration" && t.declarations[0].init != null && (!n || this.options.ecmaVersion < 8 || this.strict || t.kind !== "var" || t.declarations[0].id.type !== "Identifier") && this.raise(t.start, (n ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"), e.left = t, e.right = n ? this.parseExpression() : this.parseMaybeAssign(), this.expect(E.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, n ? "ForInStatement" : "ForOfStatement");
|
|
2905
|
-
},
|
|
2903
|
+
}, L.parseVar = function(e, t, n, r) {
|
|
2906
2904
|
for (e.declarations = [], e.kind = n;;) {
|
|
2907
2905
|
var i = this.startNode();
|
|
2908
2906
|
if (this.parseVarId(i, n), this.eat(E.eq) ? i.init = this.parseMaybeAssign(t) : !r && n === "const" && !(this.type === E._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !r && (n === "using" || n === "await using") && this.options.ecmaVersion >= 17 && this.type !== E._in && !this.isContextual("of") ? this.raise(this.lastTokEnd, "Missing initializer in " + n + " declaration") : !r && i.id.type !== "Identifier" && !(t && (this.type === E._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : i.init = null, e.declarations.push(this.finishNode(i, "VariableDeclarator")), !this.eat(E.comma)) break;
|
|
2909
2907
|
}
|
|
2910
2908
|
return e;
|
|
2911
|
-
},
|
|
2912
|
-
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Ge :
|
|
2909
|
+
}, L.parseVarId = function(e, t) {
|
|
2910
|
+
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Ge : N, !1);
|
|
2913
2911
|
};
|
|
2914
2912
|
var et = 1, tt = 2, nt = 4;
|
|
2915
|
-
|
|
2916
|
-
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === E.star && t & tt && this.unexpected(), e.generator = this.eat(E.star)), this.options.ecmaVersion >= 8 && (e.async = !!r), t & et && (e.id = t & nt && this.type !== E.name ? null : this.parseIdent(), e.id && !(t & tt) && this.checkLValSimple(e.id, this.strict || e.generator || e.async ? this.treatFunctionsAsVar ? Ge :
|
|
2913
|
+
L.parseFunction = function(e, t, n, r, i) {
|
|
2914
|
+
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === E.star && t & tt && this.unexpected(), e.generator = this.eat(E.star)), this.options.ecmaVersion >= 8 && (e.async = !!r), t & et && (e.id = t & nt && this.type !== E.name ? null : this.parseIdent(), e.id && !(t & tt) && this.checkLValSimple(e.id, this.strict || e.generator || e.async ? this.treatFunctionsAsVar ? Ge : N : Ke));
|
|
2917
2915
|
var a = this.yieldPos, o = this.awaitPos, s = this.awaitIdentPos;
|
|
2918
2916
|
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Ue(e.async, e.generator)), t & et || (e.id = this.type === E.name ? this.parseIdent() : null), this.parseFunctionParams(e), this.parseFunctionBody(e, n, !1, i), this.yieldPos = a, this.awaitPos = o, this.awaitIdentPos = s, this.finishNode(e, t & et ? "FunctionDeclaration" : "FunctionExpression");
|
|
2919
|
-
},
|
|
2917
|
+
}, L.parseFunctionParams = function(e) {
|
|
2920
2918
|
this.expect(E.parenL), e.params = this.parseBindingList(E.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
2921
|
-
},
|
|
2919
|
+
}, L.parseClass = function(e, t) {
|
|
2922
2920
|
this.next();
|
|
2923
2921
|
var n = this.strict;
|
|
2924
2922
|
this.strict = !0, this.parseClassId(e, t), this.parseClassSuper(e);
|
|
@@ -2928,7 +2926,7 @@ R.parseFunction = function(e, t, n, r, i) {
|
|
|
2928
2926
|
o && (i.body.push(o), o.type === "MethodDefinition" && o.kind === "constructor" ? (a && this.raiseRecoverable(o.start, "Duplicate constructor in the same class"), a = !0) : o.key && o.key.type === "PrivateIdentifier" && rt(r, o) && this.raiseRecoverable(o.key.start, "Identifier '#" + o.key.name + "' has already been declared"));
|
|
2929
2927
|
}
|
|
2930
2928
|
return this.strict = n, this.next(), e.body = this.finishNode(i, "ClassBody"), this.exitClassBody(), this.finishNode(e, t ? "ClassDeclaration" : "ClassExpression");
|
|
2931
|
-
},
|
|
2929
|
+
}, L.parseClassElement = function(e) {
|
|
2932
2930
|
if (this.eat(E.semi)) return null;
|
|
2933
2931
|
var t = this.options.ecmaVersion, n = this.startNode(), r = "", i = !1, a = !1, o = "method", s = !1;
|
|
2934
2932
|
if (this.eatContextual("static")) {
|
|
@@ -2944,40 +2942,40 @@ R.parseFunction = function(e, t, n, r, i) {
|
|
|
2944
2942
|
l && o !== "method" && this.raise(n.key.start, "Constructor can't have get/set modifier"), n.kind = l ? "constructor" : o, this.parseClassMethod(n, i, a, u);
|
|
2945
2943
|
} else this.parseClassField(n);
|
|
2946
2944
|
return n;
|
|
2947
|
-
},
|
|
2945
|
+
}, L.isClassElementNameStart = function() {
|
|
2948
2946
|
return this.type === E.name || this.type === E.privateId || this.type === E.num || this.type === E.string || this.type === E.bracketL || this.type.keyword;
|
|
2949
|
-
},
|
|
2947
|
+
}, L.parseClassElementName = function(e) {
|
|
2950
2948
|
this.type === E.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), e.computed = !1, e.key = this.parsePrivateIdent()) : this.parsePropertyName(e);
|
|
2951
|
-
},
|
|
2949
|
+
}, L.parseClassMethod = function(e, t, n, r) {
|
|
2952
2950
|
var i = e.key;
|
|
2953
2951
|
e.kind === "constructor" ? (t && this.raise(i.start, "Constructor can't be a generator"), n && this.raise(i.start, "Constructor can't be an async method")) : e.static && it(e, "prototype") && this.raise(i.start, "Classes may not have a static property named prototype");
|
|
2954
2952
|
var a = e.value = this.parseMethod(t, n, r);
|
|
2955
2953
|
return e.kind === "get" && a.params.length !== 0 && this.raiseRecoverable(a.start, "getter should have no params"), e.kind === "set" && a.params.length !== 1 && this.raiseRecoverable(a.start, "setter should have exactly one param"), e.kind === "set" && a.params[0].type === "RestElement" && this.raiseRecoverable(a.params[0].start, "Setter cannot use rest params"), this.finishNode(e, "MethodDefinition");
|
|
2956
|
-
},
|
|
2954
|
+
}, L.parseClassField = function(e) {
|
|
2957
2955
|
return it(e, "constructor") ? this.raise(e.key.start, "Classes can't have a field named 'constructor'") : e.static && it(e, "prototype") && this.raise(e.key.start, "Classes can't have a static field named 'prototype'"), this.eat(E.eq) ? (this.enterScope(Be | Re), e.value = this.parseMaybeAssign(), this.exitScope()) : e.value = null, this.semicolon(), this.finishNode(e, "PropertyDefinition");
|
|
2958
|
-
},
|
|
2956
|
+
}, L.parseClassStaticBlock = function(e) {
|
|
2959
2957
|
e.body = [];
|
|
2960
2958
|
var t = this.labels;
|
|
2961
|
-
for (this.labels = [], this.enterScope(
|
|
2959
|
+
for (this.labels = [], this.enterScope(M | Re); this.type !== E.braceR;) {
|
|
2962
2960
|
var n = this.parseStatement(null);
|
|
2963
2961
|
e.body.push(n);
|
|
2964
2962
|
}
|
|
2965
2963
|
return this.next(), this.exitScope(), this.labels = t, this.finishNode(e, "StaticBlock");
|
|
2966
|
-
},
|
|
2967
|
-
this.type === E.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id,
|
|
2968
|
-
},
|
|
2964
|
+
}, L.parseClassId = function(e, t) {
|
|
2965
|
+
this.type === E.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id, N, !1)) : (t === !0 && this.unexpected(), e.id = null);
|
|
2966
|
+
}, L.parseClassSuper = function(e) {
|
|
2969
2967
|
e.superClass = this.eat(E._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
2970
|
-
},
|
|
2968
|
+
}, L.enterClassBody = function() {
|
|
2971
2969
|
var e = {
|
|
2972
2970
|
declared: Object.create(null),
|
|
2973
2971
|
used: []
|
|
2974
2972
|
};
|
|
2975
2973
|
return this.privateNameStack.push(e), e.declared;
|
|
2976
|
-
},
|
|
2974
|
+
}, L.exitClassBody = function() {
|
|
2977
2975
|
var e = this.privateNameStack.pop(), t = e.declared, n = e.used;
|
|
2978
2976
|
if (this.options.checkPrivateFields) for (var r = this.privateNameStack.length, i = r === 0 ? null : this.privateNameStack[r - 1], a = 0; a < n.length; ++a) {
|
|
2979
2977
|
var o = n[a];
|
|
2980
|
-
|
|
2978
|
+
Se(t, o.name) || (i ? i.used.push(o) : this.raiseRecoverable(o.start, "Private field '#" + o.name + "' must be declared in an enclosing class"));
|
|
2981
2979
|
}
|
|
2982
2980
|
};
|
|
2983
2981
|
function rt(e, t) {
|
|
@@ -2988,9 +2986,9 @@ function it(e, t) {
|
|
|
2988
2986
|
var n = e.computed, r = e.key;
|
|
2989
2987
|
return !n && (r.type === "Identifier" && r.name === t || r.type === "Literal" && r.value === t);
|
|
2990
2988
|
}
|
|
2991
|
-
|
|
2989
|
+
L.parseExportAllDeclaration = function(e, t) {
|
|
2992
2990
|
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (e.exported = this.parseModuleExportName(), this.checkExport(t, e.exported, this.lastTokStart)) : e.exported = null), this.expectContextual("from"), this.type !== E.string && this.unexpected(), e.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ExportAllDeclaration");
|
|
2993
|
-
},
|
|
2991
|
+
}, L.parseExport = function(e, t) {
|
|
2994
2992
|
if (this.next(), this.eat(E.star)) return this.parseExportAllDeclaration(e, t);
|
|
2995
2993
|
if (this.eat(E._default)) return this.checkExport(t, "default", this.lastTokStart), e.declaration = this.parseExportDefaultDeclaration(), this.finishNode(e, "ExportDefaultDeclaration");
|
|
2996
2994
|
if (this.shouldParseExportStatement()) e.declaration = this.parseExportDeclaration(e), e.declaration.type === "VariableDeclaration" ? this.checkVariableExport(t, e.declaration.declarations) : this.checkExport(t, e.declaration.id, e.declaration.id.start), e.specifiers = [], e.source = null, this.options.ecmaVersion >= 16 && (e.attributes = []);
|
|
@@ -3006,9 +3004,9 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3006
3004
|
this.semicolon();
|
|
3007
3005
|
}
|
|
3008
3006
|
return this.finishNode(e, "ExportNamedDeclaration");
|
|
3009
|
-
},
|
|
3007
|
+
}, L.parseExportDeclaration = function(e) {
|
|
3010
3008
|
return this.parseStatement(null);
|
|
3011
|
-
},
|
|
3009
|
+
}, L.parseExportDefaultDeclaration = function() {
|
|
3012
3010
|
var e;
|
|
3013
3011
|
if (this.type === E._function || (e = this.isAsyncFunction())) {
|
|
3014
3012
|
var t = this.startNode();
|
|
@@ -3020,9 +3018,9 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3020
3018
|
var r = this.parseMaybeAssign();
|
|
3021
3019
|
return this.semicolon(), r;
|
|
3022
3020
|
}
|
|
3023
|
-
},
|
|
3024
|
-
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value),
|
|
3025
|
-
},
|
|
3021
|
+
}, L.checkExport = function(e, t, n) {
|
|
3022
|
+
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value), Se(e, t) && this.raiseRecoverable(n, "Duplicate export '" + t + "'"), e[t] = !0);
|
|
3023
|
+
}, L.checkPatternExport = function(e, t) {
|
|
3026
3024
|
var n = t.type;
|
|
3027
3025
|
if (n === "Identifier") this.checkExport(e, t, t.start);
|
|
3028
3026
|
else if (n === "ObjectPattern") for (var r = 0, i = t.properties; r < i.length; r += 1) {
|
|
@@ -3034,17 +3032,17 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3034
3032
|
c && this.checkPatternExport(e, c);
|
|
3035
3033
|
}
|
|
3036
3034
|
else n === "Property" ? this.checkPatternExport(e, t.value) : n === "AssignmentPattern" ? this.checkPatternExport(e, t.left) : n === "RestElement" && this.checkPatternExport(e, t.argument);
|
|
3037
|
-
},
|
|
3035
|
+
}, L.checkVariableExport = function(e, t) {
|
|
3038
3036
|
if (e) for (var n = 0, r = t; n < r.length; n += 1) {
|
|
3039
3037
|
var i = r[n];
|
|
3040
3038
|
this.checkPatternExport(e, i.id);
|
|
3041
3039
|
}
|
|
3042
|
-
},
|
|
3040
|
+
}, L.shouldParseExportStatement = function() {
|
|
3043
3041
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
3044
|
-
},
|
|
3042
|
+
}, L.parseExportSpecifier = function(e) {
|
|
3045
3043
|
var t = this.startNode();
|
|
3046
3044
|
return t.local = this.parseModuleExportName(), t.exported = this.eatContextual("as") ? this.parseModuleExportName() : t.local, this.checkExport(e, t.exported, t.exported.start), this.finishNode(t, "ExportSpecifier");
|
|
3047
|
-
},
|
|
3045
|
+
}, L.parseExportSpecifiers = function(e) {
|
|
3048
3046
|
var t = [], n = !0;
|
|
3049
3047
|
for (this.expect(E.braceL); !this.eat(E.braceR);) {
|
|
3050
3048
|
if (n) n = !1;
|
|
@@ -3052,18 +3050,18 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3052
3050
|
t.push(this.parseExportSpecifier(e));
|
|
3053
3051
|
}
|
|
3054
3052
|
return t;
|
|
3055
|
-
},
|
|
3053
|
+
}, L.parseImport = function(e) {
|
|
3056
3054
|
return this.next(), this.type === E.string ? (e.specifiers = $e, e.source = this.parseExprAtom()) : (e.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), e.source = this.type === E.string ? this.parseExprAtom() : this.unexpected()), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ImportDeclaration");
|
|
3057
|
-
},
|
|
3055
|
+
}, L.parseImportSpecifier = function() {
|
|
3058
3056
|
var e = this.startNode();
|
|
3059
|
-
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local,
|
|
3060
|
-
},
|
|
3057
|
+
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local, N), this.finishNode(e, "ImportSpecifier");
|
|
3058
|
+
}, L.parseImportDefaultSpecifier = function() {
|
|
3061
3059
|
var e = this.startNode();
|
|
3062
|
-
return e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
3063
|
-
},
|
|
3060
|
+
return e.local = this.parseIdent(), this.checkLValSimple(e.local, N), this.finishNode(e, "ImportDefaultSpecifier");
|
|
3061
|
+
}, L.parseImportNamespaceSpecifier = function() {
|
|
3064
3062
|
var e = this.startNode();
|
|
3065
|
-
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
3066
|
-
},
|
|
3063
|
+
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local, N), this.finishNode(e, "ImportNamespaceSpecifier");
|
|
3064
|
+
}, L.parseImportSpecifiers = function() {
|
|
3067
3065
|
var e = [], t = !0;
|
|
3068
3066
|
if (this.type === E.name && (e.push(this.parseImportDefaultSpecifier()), !this.eat(E.comma))) return e;
|
|
3069
3067
|
if (this.type === E.star) return e.push(this.parseImportNamespaceSpecifier()), e;
|
|
@@ -3073,7 +3071,7 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3073
3071
|
e.push(this.parseImportSpecifier());
|
|
3074
3072
|
}
|
|
3075
3073
|
return e;
|
|
3076
|
-
},
|
|
3074
|
+
}, L.parseWithClause = function() {
|
|
3077
3075
|
var e = [];
|
|
3078
3076
|
if (!this.eat(E._with)) return e;
|
|
3079
3077
|
this.expect(E.braceL);
|
|
@@ -3081,25 +3079,25 @@ R.parseExportAllDeclaration = function(e, t) {
|
|
|
3081
3079
|
if (n) n = !1;
|
|
3082
3080
|
else if (this.expect(E.comma), this.afterTrailingComma(E.braceR)) break;
|
|
3083
3081
|
var r = this.parseImportAttribute(), i = r.key.type === "Identifier" ? r.key.name : r.key.value;
|
|
3084
|
-
|
|
3082
|
+
Se(t, i) && this.raiseRecoverable(r.key.start, "Duplicate attribute key '" + i + "'"), t[i] = !0, e.push(r);
|
|
3085
3083
|
}
|
|
3086
3084
|
return e;
|
|
3087
|
-
},
|
|
3085
|
+
}, L.parseImportAttribute = function() {
|
|
3088
3086
|
var e = this.startNode();
|
|
3089
3087
|
return e.key = this.type === E.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"), this.expect(E.colon), this.type !== E.string && this.unexpected(), e.value = this.parseExprAtom(), this.finishNode(e, "ImportAttribute");
|
|
3090
|
-
},
|
|
3088
|
+
}, L.parseModuleExportName = function() {
|
|
3091
3089
|
if (this.options.ecmaVersion >= 13 && this.type === E.string) {
|
|
3092
3090
|
var e = this.parseLiteral(this.value);
|
|
3093
|
-
return
|
|
3091
|
+
return Te.test(e.value) && this.raise(e.start, "An export name cannot include a lone surrogate."), e;
|
|
3094
3092
|
}
|
|
3095
3093
|
return this.parseIdent(!0);
|
|
3096
|
-
},
|
|
3094
|
+
}, L.adaptDirectivePrologue = function(e) {
|
|
3097
3095
|
for (var t = 0; t < e.length && this.isDirectiveCandidate(e[t]); ++t) e[t].directive = e[t].expression.raw.slice(1, -1);
|
|
3098
|
-
},
|
|
3096
|
+
}, L.isDirectiveCandidate = function(e) {
|
|
3099
3097
|
return this.options.ecmaVersion >= 5 && e.type === "ExpressionStatement" && e.expression.type === "Literal" && typeof e.expression.value == "string" && (this.input[e.start] === "\"" || this.input[e.start] === "'");
|
|
3100
3098
|
};
|
|
3101
|
-
var
|
|
3102
|
-
|
|
3099
|
+
var R = P.prototype;
|
|
3100
|
+
R.toAssignable = function(e, t, n) {
|
|
3103
3101
|
if (this.options.ecmaVersion >= 6 && e) switch (e.type) {
|
|
3104
3102
|
case "Identifier":
|
|
3105
3103
|
this.inAsync && e.name === "await" && this.raise(e.start, "Cannot use 'await' as identifier inside an async function");
|
|
@@ -3138,7 +3136,7 @@ z.toAssignable = function(e, t, n) {
|
|
|
3138
3136
|
}
|
|
3139
3137
|
else n && this.checkPatternErrors(n, !0);
|
|
3140
3138
|
return e;
|
|
3141
|
-
},
|
|
3139
|
+
}, R.toAssignableList = function(e, t) {
|
|
3142
3140
|
for (var n = e.length, r = 0; r < n; r++) {
|
|
3143
3141
|
var i = e[r];
|
|
3144
3142
|
i && this.toAssignable(i, t);
|
|
@@ -3148,13 +3146,13 @@ z.toAssignable = function(e, t, n) {
|
|
|
3148
3146
|
this.options.ecmaVersion === 6 && t && a && a.type === "RestElement" && a.argument.type !== "Identifier" && this.unexpected(a.argument.start);
|
|
3149
3147
|
}
|
|
3150
3148
|
return e;
|
|
3151
|
-
},
|
|
3149
|
+
}, R.parseSpread = function(e) {
|
|
3152
3150
|
var t = this.startNode();
|
|
3153
3151
|
return this.next(), t.argument = this.parseMaybeAssign(!1, e), this.finishNode(t, "SpreadElement");
|
|
3154
|
-
},
|
|
3152
|
+
}, R.parseRestBinding = function() {
|
|
3155
3153
|
var e = this.startNode();
|
|
3156
3154
|
return this.next(), this.options.ecmaVersion === 6 && this.type !== E.name && this.unexpected(), e.argument = this.parseBindingAtom(), this.finishNode(e, "RestElement");
|
|
3157
|
-
},
|
|
3155
|
+
}, R.parseBindingAtom = function() {
|
|
3158
3156
|
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
3159
3157
|
case E.bracketL:
|
|
3160
3158
|
var e = this.startNode();
|
|
@@ -3162,7 +3160,7 @@ z.toAssignable = function(e, t, n) {
|
|
|
3162
3160
|
case E.braceL: return this.parseObj(!0);
|
|
3163
3161
|
}
|
|
3164
3162
|
return this.parseIdent();
|
|
3165
|
-
},
|
|
3163
|
+
}, R.parseBindingList = function(e, t, n, r) {
|
|
3166
3164
|
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(E.comma), t && this.type === E.comma) i.push(null);
|
|
3167
3165
|
else if (n && this.afterTrailingComma(e)) break;
|
|
3168
3166
|
else if (this.type === E.ellipsis) {
|
|
@@ -3171,21 +3169,21 @@ z.toAssignable = function(e, t, n) {
|
|
|
3171
3169
|
break;
|
|
3172
3170
|
} else i.push(this.parseAssignableListItem(r));
|
|
3173
3171
|
return i;
|
|
3174
|
-
},
|
|
3172
|
+
}, R.parseAssignableListItem = function(e) {
|
|
3175
3173
|
var t = this.parseMaybeDefault(this.start, this.startLoc);
|
|
3176
3174
|
return this.parseBindingListItem(t), t;
|
|
3177
|
-
},
|
|
3175
|
+
}, R.parseBindingListItem = function(e) {
|
|
3178
3176
|
return e;
|
|
3179
|
-
},
|
|
3177
|
+
}, R.parseMaybeDefault = function(e, t, n) {
|
|
3180
3178
|
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(E.eq)) return n;
|
|
3181
3179
|
var r = this.startNodeAt(e, t);
|
|
3182
3180
|
return r.left = n, r.right = this.parseMaybeAssign(), this.finishNode(r, "AssignmentPattern");
|
|
3183
|
-
},
|
|
3181
|
+
}, R.checkLValSimple = function(e, t, n) {
|
|
3184
3182
|
t === void 0 && (t = We);
|
|
3185
3183
|
var r = t !== We;
|
|
3186
3184
|
switch (e.type) {
|
|
3187
3185
|
case "Identifier":
|
|
3188
|
-
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t ===
|
|
3186
|
+
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t === N && e.name === "let" && this.raiseRecoverable(e.start, "let is disallowed as a lexically bound name"), n && (Se(n, e.name) && this.raiseRecoverable(e.start, "Argument name clash"), n[e.name] = !0), t !== Je && this.declareName(e.name, t, e.start));
|
|
3189
3187
|
break;
|
|
3190
3188
|
case "ChainExpression":
|
|
3191
3189
|
this.raiseRecoverable(e.start, "Optional chaining cannot appear in left-hand side");
|
|
@@ -3196,7 +3194,7 @@ z.toAssignable = function(e, t, n) {
|
|
|
3196
3194
|
case "ParenthesizedExpression": return r && this.raiseRecoverable(e.start, "Binding parenthesized expression"), this.checkLValSimple(e.expression, t, n);
|
|
3197
3195
|
default: this.raise(e.start, (r ? "Binding" : "Assigning to") + " rvalue");
|
|
3198
3196
|
}
|
|
3199
|
-
},
|
|
3197
|
+
}, R.checkLValPattern = function(e, t, n) {
|
|
3200
3198
|
switch (t === void 0 && (t = We), e.type) {
|
|
3201
3199
|
case "ObjectPattern":
|
|
3202
3200
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
@@ -3212,7 +3210,7 @@ z.toAssignable = function(e, t, n) {
|
|
|
3212
3210
|
break;
|
|
3213
3211
|
default: this.checkLValSimple(e, t, n);
|
|
3214
3212
|
}
|
|
3215
|
-
},
|
|
3213
|
+
}, R.checkLValInnerPattern = function(e, t, n) {
|
|
3216
3214
|
switch (t === void 0 && (t = We), e.type) {
|
|
3217
3215
|
case "Property":
|
|
3218
3216
|
this.checkLValInnerPattern(e.value, t, n);
|
|
@@ -3226,29 +3224,29 @@ z.toAssignable = function(e, t, n) {
|
|
|
3226
3224
|
default: this.checkLValPattern(e, t, n);
|
|
3227
3225
|
}
|
|
3228
3226
|
};
|
|
3229
|
-
var
|
|
3227
|
+
var z = function(e, t, n, r, i) {
|
|
3230
3228
|
this.token = e, this.isExpr = !!t, this.preserveSpace = !!n, this.override = r, this.generator = !!i;
|
|
3231
|
-
},
|
|
3232
|
-
b_stat: new
|
|
3233
|
-
b_expr: new
|
|
3234
|
-
b_tmpl: new
|
|
3235
|
-
p_stat: new
|
|
3236
|
-
p_expr: new
|
|
3237
|
-
q_tmpl: new
|
|
3229
|
+
}, B = {
|
|
3230
|
+
b_stat: new z("{", !1),
|
|
3231
|
+
b_expr: new z("{", !0),
|
|
3232
|
+
b_tmpl: new z("${", !1),
|
|
3233
|
+
p_stat: new z("(", !1),
|
|
3234
|
+
p_expr: new z("(", !0),
|
|
3235
|
+
q_tmpl: new z("`", !0, !0, function(e) {
|
|
3238
3236
|
return e.tryReadTemplateToken();
|
|
3239
3237
|
}),
|
|
3240
|
-
f_stat: new
|
|
3241
|
-
f_expr: new
|
|
3242
|
-
f_expr_gen: new
|
|
3243
|
-
f_gen: new
|
|
3244
|
-
}, at =
|
|
3238
|
+
f_stat: new z("function", !1),
|
|
3239
|
+
f_expr: new z("function", !0),
|
|
3240
|
+
f_expr_gen: new z("function", !0, !1, null, !0),
|
|
3241
|
+
f_gen: new z("function", !1, !1, null, !0)
|
|
3242
|
+
}, at = P.prototype;
|
|
3245
3243
|
at.initialContext = function() {
|
|
3246
|
-
return [
|
|
3244
|
+
return [B.b_stat];
|
|
3247
3245
|
}, at.curContext = function() {
|
|
3248
3246
|
return this.context[this.context.length - 1];
|
|
3249
3247
|
}, at.braceIsBlock = function(e) {
|
|
3250
3248
|
var t = this.curContext();
|
|
3251
|
-
return t ===
|
|
3249
|
+
return t === B.f_expr || t === B.f_stat ? !0 : e === E.colon && (t === B.b_stat || t === B.b_expr) ? !t.isExpr : e === E._return || e === E.name && this.exprAllowed ? D.test(this.input.slice(this.lastTokEnd, this.start)) : e === E._else || e === E.semi || e === E.eof || e === E.parenR || e === E.arrow ? !0 : e === E.braceL ? t === B.b_stat : e === E._var || e === E._const || e === E.name ? !1 : !this.exprAllowed;
|
|
3252
3250
|
}, at.inGeneratorContext = function() {
|
|
3253
3251
|
for (var e = this.context.length - 1; e >= 1; e--) {
|
|
3254
3252
|
var t = this.context[e];
|
|
@@ -3266,32 +3264,32 @@ at.initialContext = function() {
|
|
|
3266
3264
|
return;
|
|
3267
3265
|
}
|
|
3268
3266
|
var e = this.context.pop();
|
|
3269
|
-
e ===
|
|
3267
|
+
e === B.b_stat && this.curContext().token === "function" && (e = this.context.pop()), this.exprAllowed = !e.isExpr;
|
|
3270
3268
|
}, E.braceL.updateContext = function(e) {
|
|
3271
|
-
this.context.push(this.braceIsBlock(e) ?
|
|
3269
|
+
this.context.push(this.braceIsBlock(e) ? B.b_stat : B.b_expr), this.exprAllowed = !0;
|
|
3272
3270
|
}, E.dollarBraceL.updateContext = function() {
|
|
3273
|
-
this.context.push(
|
|
3271
|
+
this.context.push(B.b_tmpl), this.exprAllowed = !0;
|
|
3274
3272
|
}, E.parenL.updateContext = function(e) {
|
|
3275
3273
|
var t = e === E._if || e === E._for || e === E._with || e === E._while;
|
|
3276
|
-
this.context.push(t ?
|
|
3274
|
+
this.context.push(t ? B.p_stat : B.p_expr), this.exprAllowed = !0;
|
|
3277
3275
|
}, E.incDec.updateContext = function() {}, E._function.updateContext = E._class.updateContext = function(e) {
|
|
3278
|
-
e.beforeExpr && e !== E._else && !(e === E.semi && this.curContext() !==
|
|
3276
|
+
e.beforeExpr && e !== E._else && !(e === E.semi && this.curContext() !== B.p_stat) && !(e === E._return && D.test(this.input.slice(this.lastTokEnd, this.start))) && !((e === E.colon || e === E.braceL) && this.curContext() === B.b_stat) ? this.context.push(B.f_expr) : this.context.push(B.f_stat), this.exprAllowed = !1;
|
|
3279
3277
|
}, E.colon.updateContext = function() {
|
|
3280
3278
|
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
3281
3279
|
}, E.backQuote.updateContext = function() {
|
|
3282
|
-
this.curContext() ===
|
|
3280
|
+
this.curContext() === B.q_tmpl ? this.context.pop() : this.context.push(B.q_tmpl), this.exprAllowed = !1;
|
|
3283
3281
|
}, E.star.updateContext = function(e) {
|
|
3284
3282
|
if (e === E._function) {
|
|
3285
3283
|
var t = this.context.length - 1;
|
|
3286
|
-
this.context[t] ===
|
|
3284
|
+
this.context[t] === B.f_expr ? this.context[t] = B.f_expr_gen : this.context[t] = B.f_gen;
|
|
3287
3285
|
}
|
|
3288
3286
|
this.exprAllowed = !0;
|
|
3289
3287
|
}, E.name.updateContext = function(e) {
|
|
3290
3288
|
var t = !1;
|
|
3291
3289
|
this.options.ecmaVersion >= 6 && e !== E.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (t = !0), this.exprAllowed = t;
|
|
3292
3290
|
};
|
|
3293
|
-
var
|
|
3294
|
-
|
|
3291
|
+
var V = P.prototype;
|
|
3292
|
+
V.checkPropClash = function(e, t, n) {
|
|
3295
3293
|
if (!(this.options.ecmaVersion >= 9 && e.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (e.computed || e.method || e.shorthand))) {
|
|
3296
3294
|
var r = e.key, i;
|
|
3297
3295
|
switch (r.type) {
|
|
@@ -3316,7 +3314,7 @@ H.checkPropClash = function(e, t, n) {
|
|
|
3316
3314
|
set: !1
|
|
3317
3315
|
}, o[a] = !0;
|
|
3318
3316
|
}
|
|
3319
|
-
},
|
|
3317
|
+
}, V.parseExpression = function(e, t) {
|
|
3320
3318
|
var n = this;
|
|
3321
3319
|
return this.catchStackOverflow(function() {
|
|
3322
3320
|
var r = n.start, i = n.startLoc, a = n.parseMaybeAssign(e, t);
|
|
@@ -3327,7 +3325,7 @@ H.checkPropClash = function(e, t, n) {
|
|
|
3327
3325
|
}
|
|
3328
3326
|
return a;
|
|
3329
3327
|
});
|
|
3330
|
-
},
|
|
3328
|
+
}, V.parseMaybeAssign = function(e, t, n) {
|
|
3331
3329
|
if (this.isContextual("yield")) {
|
|
3332
3330
|
if (this.inGenerator) return this.parseYield(e);
|
|
3333
3331
|
this.exprAllowed = !1;
|
|
@@ -3342,7 +3340,7 @@ H.checkPropClash = function(e, t, n) {
|
|
|
3342
3340
|
return u.operator = this.value, this.type === E.eq && (l = this.toAssignable(l, !1, t)), r || (t.parenthesizedAssign = t.trailingComma = t.doubleProto = -1), t.shorthandAssign >= l.start && (t.shorthandAssign = -1), this.type === E.eq ? this.checkLValPattern(l) : this.checkLValSimple(l), u.left = l, this.next(), u.right = this.parseMaybeAssign(e), o > -1 && (t.doubleProto = o), this.finishNode(u, "AssignmentExpression");
|
|
3343
3341
|
} else r && this.checkExpressionErrors(t, !0);
|
|
3344
3342
|
return i > -1 && (t.parenthesizedAssign = i), a > -1 && (t.trailingComma = a), l;
|
|
3345
|
-
},
|
|
3343
|
+
}, V.parseMaybeConditional = function(e, t) {
|
|
3346
3344
|
var n = this.start, r = this.startLoc, i = this.parseExprOps(e, t);
|
|
3347
3345
|
if (this.checkExpressionErrors(t)) return i;
|
|
3348
3346
|
if (!(i.type === "ArrowFunctionExpression" && i.start === n) && this.eat(E.question)) {
|
|
@@ -3350,10 +3348,10 @@ H.checkPropClash = function(e, t, n) {
|
|
|
3350
3348
|
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(E.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
|
|
3351
3349
|
}
|
|
3352
3350
|
return i;
|
|
3353
|
-
},
|
|
3351
|
+
}, V.parseExprOps = function(e, t) {
|
|
3354
3352
|
var n = this.start, r = this.startLoc, i = this.parseMaybeUnary(t, !1, !1, e);
|
|
3355
3353
|
return this.checkExpressionErrors(t) || i.start === n && i.type === "ArrowFunctionExpression" ? i : this.parseExprOp(i, n, r, -1, e);
|
|
3356
|
-
},
|
|
3354
|
+
}, V.parseExprOp = function(e, t, n, r, i) {
|
|
3357
3355
|
var a = this.type.binop;
|
|
3358
3356
|
if (a != null && (!i || this.type !== E._in) && a > r) {
|
|
3359
3357
|
var o = this.type === E.logicalOR || this.type === E.logicalAND, s = this.type === E.coalesce;
|
|
@@ -3364,11 +3362,11 @@ H.checkPropClash = function(e, t, n) {
|
|
|
3364
3362
|
return (o && this.type === E.coalesce || s && (this.type === E.logicalOR || this.type === E.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(f, t, n, r, i);
|
|
3365
3363
|
}
|
|
3366
3364
|
return e;
|
|
3367
|
-
},
|
|
3365
|
+
}, V.buildBinary = function(e, t, n, r, i, a) {
|
|
3368
3366
|
r.type === "PrivateIdentifier" && this.raise(r.start, "Private identifier can only be left side of binary expression");
|
|
3369
3367
|
var o = this.startNodeAt(e, t);
|
|
3370
3368
|
return o.left = n, o.operator = i, o.right = r, this.finishNode(o, a ? "LogicalExpression" : "BinaryExpression");
|
|
3371
|
-
},
|
|
3369
|
+
}, V.parseMaybeUnary = function(e, t, n, r) {
|
|
3372
3370
|
var i = this.start, a = this.startLoc, o;
|
|
3373
3371
|
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(r), t = !0;
|
|
3374
3372
|
else if (this.type.prefix) {
|
|
@@ -3392,12 +3390,12 @@ function ot(e) {
|
|
|
3392
3390
|
function st(e) {
|
|
3393
3391
|
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" && st(e.expression) || e.type === "ParenthesizedExpression" && st(e.expression);
|
|
3394
3392
|
}
|
|
3395
|
-
|
|
3393
|
+
V.parseExprSubscripts = function(e, t) {
|
|
3396
3394
|
var n = this.start, r = this.startLoc, i = this.parseExprAtom(e, t);
|
|
3397
3395
|
if (i.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return i;
|
|
3398
3396
|
var a = this.parseSubscripts(i, n, r, !1, t);
|
|
3399
3397
|
return e && a.type === "MemberExpression" && (e.parenthesizedAssign >= a.start && (e.parenthesizedAssign = -1), e.parenthesizedBind >= a.start && (e.parenthesizedBind = -1), e.trailingComma >= a.start && (e.trailingComma = -1)), a;
|
|
3400
|
-
},
|
|
3398
|
+
}, V.parseSubscripts = function(e, t, n, r, i) {
|
|
3401
3399
|
for (var a = this.options.ecmaVersion >= 8 && e.type === "Identifier" && e.name === "async" && this.lastTokEnd === e.end && !this.canInsertSemicolon() && e.end - e.start === 5 && this.potentialArrowAt === e.start, o = !1;;) {
|
|
3402
3400
|
var s = this.parseSubscript(e, t, n, r, a, o, i);
|
|
3403
3401
|
if (s.optional && (o = !0), s === e || s.type === "ArrowFunctionExpression") {
|
|
@@ -3409,11 +3407,11 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3409
3407
|
}
|
|
3410
3408
|
e = s;
|
|
3411
3409
|
}
|
|
3412
|
-
},
|
|
3410
|
+
}, V.shouldParseAsyncArrow = function() {
|
|
3413
3411
|
return !this.canInsertSemicolon() && this.eat(E.arrow);
|
|
3414
|
-
},
|
|
3412
|
+
}, V.parseSubscriptAsyncArrow = function(e, t, n, r) {
|
|
3415
3413
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !0, r);
|
|
3416
|
-
},
|
|
3414
|
+
}, V.parseSubscript = function(e, t, n, r, i, a, o) {
|
|
3417
3415
|
var s = this.options.ecmaVersion >= 11, c = s && this.eat(E.questionDot);
|
|
3418
3416
|
r && c && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
3419
3417
|
var l = this.eat(E.bracketL);
|
|
@@ -3434,7 +3432,7 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3434
3432
|
_.tag = e, _.quasi = this.parseTemplate({ isTagged: !0 }), e = this.finishNode(_, "TaggedTemplateExpression");
|
|
3435
3433
|
}
|
|
3436
3434
|
return e;
|
|
3437
|
-
},
|
|
3435
|
+
}, V.parseExprAtom = function(e, t, n) {
|
|
3438
3436
|
this.type === E.slash && this.readRegexp();
|
|
3439
3437
|
var r, i = this.potentialArrowAt === this.start;
|
|
3440
3438
|
switch (this.type) {
|
|
@@ -3442,7 +3440,7 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3442
3440
|
case E._this: return r = this.startNode(), this.next(), this.finishNode(r, "ThisExpression");
|
|
3443
3441
|
case E.name:
|
|
3444
3442
|
var a = this.start, o = this.startLoc, s = this.containsEsc, c = this.parseIdent(!1);
|
|
3445
|
-
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(E._function)) return this.overrideContext(
|
|
3443
|
+
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(E._function)) return this.overrideContext(B.f_expr), this.parseFunction(this.startNodeAt(a, o), 0, !1, !0, t);
|
|
3446
3444
|
if (i && !this.canInsertSemicolon()) {
|
|
3447
3445
|
if (this.eat(E.arrow)) return this.parseArrowExpression(this.startNodeAt(a, o), [c], !1, t);
|
|
3448
3446
|
if (this.options.ecmaVersion >= 8 && c.name === "async" && this.type === E.name && !s && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return c = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(E.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(a, o), [c], !0, t);
|
|
@@ -3463,7 +3461,7 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3463
3461
|
var u = this.start, d = this.parseParenAndDistinguishExpression(i, t);
|
|
3464
3462
|
return e && (e.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(d) && (e.parenthesizedAssign = u), e.parenthesizedBind < 0 && (e.parenthesizedBind = u)), d;
|
|
3465
3463
|
case E.bracketL: return r = this.startNode(), this.next(), r.elements = this.parseExprList(E.bracketR, !0, !0, e), this.finishNode(r, "ArrayExpression");
|
|
3466
|
-
case E.braceL: return this.overrideContext(
|
|
3464
|
+
case E.braceL: return this.overrideContext(B.b_expr), this.parseObj(!1, e);
|
|
3467
3465
|
case E._function: return r = this.startNode(), this.next(), this.parseFunction(r, 0);
|
|
3468
3466
|
case E._class: return this.parseClass(this.startNode(), !1);
|
|
3469
3467
|
case E._new: return this.parseNew();
|
|
@@ -3471,36 +3469,36 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3471
3469
|
case E._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(n) : this.unexpected();
|
|
3472
3470
|
default: return this.parseExprAtomDefault();
|
|
3473
3471
|
}
|
|
3474
|
-
},
|
|
3472
|
+
}, V.parseExprAtomDefault = function() {
|
|
3475
3473
|
this.unexpected();
|
|
3476
|
-
},
|
|
3474
|
+
}, V.parseExprImport = function(e) {
|
|
3477
3475
|
var t = this.startNode();
|
|
3478
3476
|
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === E.parenL && !e) return this.parseDynamicImport(t);
|
|
3479
3477
|
if (this.type === E.dot) {
|
|
3480
3478
|
var n = this.startNodeAt(t.start, t.loc && t.loc.start);
|
|
3481
3479
|
return n.name = "import", t.meta = this.finishNode(n, "Identifier"), this.parseImportMeta(t);
|
|
3482
3480
|
} else this.unexpected();
|
|
3483
|
-
},
|
|
3481
|
+
}, V.parseDynamicImport = function(e) {
|
|
3484
3482
|
if (this.next(), e.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(E.parenR) ? e.options = null : (this.expect(E.comma), this.afterTrailingComma(E.parenR) ? e.options = null : (e.options = this.parseMaybeAssign(), this.eat(E.parenR) || (this.expect(E.comma), this.afterTrailingComma(E.parenR) || this.unexpected())));
|
|
3485
3483
|
else if (!this.eat(E.parenR)) {
|
|
3486
3484
|
var t = this.start;
|
|
3487
3485
|
this.eat(E.comma) && this.eat(E.parenR) ? this.raiseRecoverable(t, "Trailing comma is not allowed in import()") : this.unexpected(t);
|
|
3488
3486
|
}
|
|
3489
3487
|
return this.finishNode(e, "ImportExpression");
|
|
3490
|
-
},
|
|
3488
|
+
}, V.parseImportMeta = function(e) {
|
|
3491
3489
|
this.next();
|
|
3492
3490
|
var t = this.containsEsc;
|
|
3493
3491
|
return e.property = this.parseIdent(!0), e.property.name !== "meta" && this.raiseRecoverable(e.property.start, "The only valid meta property for import is 'import.meta'"), t && this.raiseRecoverable(e.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(e.start, "Cannot use 'import.meta' outside a module"), this.finishNode(e, "MetaProperty");
|
|
3494
|
-
},
|
|
3492
|
+
}, V.parseLiteral = function(e) {
|
|
3495
3493
|
var t = this.startNode();
|
|
3496
3494
|
return t.value = e, t.raw = this.input.slice(this.start, this.end), t.raw.charCodeAt(t.raw.length - 1) === 110 && (t.bigint = t.value == null ? t.raw.slice(0, -1).replace(/_/g, "") : t.value.toString()), this.next(), this.finishNode(t, "Literal");
|
|
3497
|
-
},
|
|
3495
|
+
}, V.parseParenExpression = function() {
|
|
3498
3496
|
this.expect(E.parenL);
|
|
3499
3497
|
var e = this.parseExpression();
|
|
3500
3498
|
return this.expect(E.parenR), e;
|
|
3501
|
-
},
|
|
3499
|
+
}, V.shouldParseArrow = function(e) {
|
|
3502
3500
|
return !this.canInsertSemicolon();
|
|
3503
|
-
},
|
|
3501
|
+
}, V.parseParenAndDistinguishExpression = function(e, t) {
|
|
3504
3502
|
var n = this.start, r = this.startLoc, i, a = this.options.ecmaVersion >= 8;
|
|
3505
3503
|
if (this.options.ecmaVersion >= 6) {
|
|
3506
3504
|
this.next();
|
|
@@ -3520,13 +3518,13 @@ H.parseExprSubscripts = function(e, t) {
|
|
|
3520
3518
|
var _ = this.startNodeAt(n, r);
|
|
3521
3519
|
return _.expression = i, this.finishNode(_, "ParenthesizedExpression");
|
|
3522
3520
|
} else return i;
|
|
3523
|
-
},
|
|
3521
|
+
}, V.parseParenItem = function(e) {
|
|
3524
3522
|
return e;
|
|
3525
|
-
},
|
|
3523
|
+
}, V.parseParenArrowList = function(e, t, n, r) {
|
|
3526
3524
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !1, r);
|
|
3527
3525
|
};
|
|
3528
3526
|
var ct = [];
|
|
3529
|
-
|
|
3527
|
+
V.parseNew = function() {
|
|
3530
3528
|
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
3531
3529
|
var e = this.startNode();
|
|
3532
3530
|
if (this.next(), this.options.ecmaVersion >= 6 && this.type === E.dot) {
|
|
@@ -3537,7 +3535,7 @@ H.parseNew = function() {
|
|
|
3537
3535
|
}
|
|
3538
3536
|
var r = this.start, i = this.startLoc;
|
|
3539
3537
|
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), this.eat(E.parenL) ? e.arguments = this.parseExprList(E.parenR, this.options.ecmaVersion >= 8, !1) : e.arguments = ct, this.finishNode(e, "NewExpression");
|
|
3540
|
-
},
|
|
3538
|
+
}, V.parseTemplateElement = function(e) {
|
|
3541
3539
|
var t = e.isTagged, n = this.startNode();
|
|
3542
3540
|
return this.type === E.invalidTemplate ? (t || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), n.value = {
|
|
3543
3541
|
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
@@ -3546,7 +3544,7 @@ H.parseNew = function() {
|
|
|
3546
3544
|
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
|
3547
3545
|
cooked: this.value
|
|
3548
3546
|
}, this.next(), n.tail = this.type === E.backQuote, this.finishNode(n, "TemplateElement");
|
|
3549
|
-
},
|
|
3547
|
+
}, V.parseTemplate = function(e) {
|
|
3550
3548
|
e === void 0 && (e = {});
|
|
3551
3549
|
var t = e.isTagged;
|
|
3552
3550
|
t === void 0 && (t = !1);
|
|
@@ -3555,9 +3553,9 @@ H.parseNew = function() {
|
|
|
3555
3553
|
var r = this.parseTemplateElement({ isTagged: t });
|
|
3556
3554
|
for (n.quasis = [r]; !r.tail;) this.type === E.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(E.dollarBraceL), n.expressions.push(this.parseExpression()), this.expect(E.braceR), n.quasis.push(r = this.parseTemplateElement({ isTagged: t }));
|
|
3557
3555
|
return this.next(), this.finishNode(n, "TemplateLiteral");
|
|
3558
|
-
},
|
|
3556
|
+
}, V.isAsyncProp = function(e) {
|
|
3559
3557
|
return !e.computed && e.key.type === "Identifier" && e.key.name === "async" && (this.type === E.name || this.type === E.num || this.type === E.string || this.type === E.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === E.star) && !D.test(this.input.slice(this.lastTokEnd, this.start));
|
|
3560
|
-
},
|
|
3558
|
+
}, V.parseObj = function(e, t) {
|
|
3561
3559
|
var n = this.startNode(), r = !0, i = {};
|
|
3562
3560
|
for (n.properties = [], this.next(); !this.eat(E.braceR);) {
|
|
3563
3561
|
if (r) r = !1;
|
|
@@ -3566,13 +3564,13 @@ H.parseNew = function() {
|
|
|
3566
3564
|
e || this.checkPropClash(a, i, t), n.properties.push(a);
|
|
3567
3565
|
}
|
|
3568
3566
|
return this.finishNode(n, e ? "ObjectPattern" : "ObjectExpression");
|
|
3569
|
-
},
|
|
3567
|
+
}, V.parseProperty = function(e, t) {
|
|
3570
3568
|
var n = this.startNode(), r, i, a, o;
|
|
3571
3569
|
if (this.options.ecmaVersion >= 9 && this.eat(E.ellipsis)) return e ? (n.argument = this.parseIdent(!1), this.type === E.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(n, "RestElement")) : (n.argument = this.parseMaybeAssign(!1, t), this.type === E.comma && t && t.trailingComma < 0 && (t.trailingComma = this.start), this.finishNode(n, "SpreadElement"));
|
|
3572
3570
|
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(E.star)));
|
|
3573
3571
|
var s = this.containsEsc;
|
|
3574
3572
|
return this.parsePropertyName(n), !e && !s && this.options.ecmaVersion >= 8 && !r && this.isAsyncProp(n) ? (i = !0, r = this.options.ecmaVersion >= 9 && this.eat(E.star), this.parsePropertyName(n)) : i = !1, this.parsePropertyValue(n, e, r, i, a, o, t, s), this.finishNode(n, "Property");
|
|
3575
|
-
},
|
|
3573
|
+
}, V.parseGetterSetter = function(e) {
|
|
3576
3574
|
var t = e.key.name;
|
|
3577
3575
|
this.parsePropertyName(e), e.value = this.parseMethod(!1), e.kind = t;
|
|
3578
3576
|
var n = e.kind === "get" ? 0 : 1;
|
|
@@ -3580,23 +3578,23 @@ H.parseNew = function() {
|
|
|
3580
3578
|
var r = e.value.start;
|
|
3581
3579
|
e.kind === "get" ? this.raiseRecoverable(r, "getter should have no params") : this.raiseRecoverable(r, "setter should have exactly one param");
|
|
3582
3580
|
} else e.kind === "set" && e.value.params[0].type === "RestElement" && this.raiseRecoverable(e.value.params[0].start, "Setter cannot use rest params");
|
|
3583
|
-
},
|
|
3581
|
+
}, V.parsePropertyValue = function(e, t, n, r, i, a, o, s) {
|
|
3584
3582
|
(n || r) && this.type === E.colon && this.unexpected(), this.eat(E.colon) ? (e.value = t ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, o), e.kind = "init") : this.options.ecmaVersion >= 6 && this.type === E.parenL ? (t && this.unexpected(), e.method = !0, e.value = this.parseMethod(n, r), e.kind = "init") : !t && !s && this.options.ecmaVersion >= 5 && !e.computed && e.key.type === "Identifier" && (e.key.name === "get" || e.key.name === "set") && this.type !== E.comma && this.type !== E.braceR && this.type !== E.eq ? ((n || r) && this.unexpected(), this.parseGetterSetter(e)) : this.options.ecmaVersion >= 6 && !e.computed && e.key.type === "Identifier" ? ((n || r) && this.unexpected(), this.checkUnreserved(e.key), e.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = i), t ? e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key)) : this.type === E.eq && o ? (o.shorthandAssign < 0 && (o.shorthandAssign = this.start), e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key))) : e.value = this.copyNode(e.key), e.kind = "init", e.shorthand = !0) : this.unexpected();
|
|
3585
|
-
},
|
|
3583
|
+
}, V.parsePropertyName = function(e) {
|
|
3586
3584
|
if (this.options.ecmaVersion >= 6) {
|
|
3587
3585
|
if (this.eat(E.bracketL)) return e.computed = !0, e.key = this.parseMaybeAssign(), this.expect(E.bracketR), e.key;
|
|
3588
3586
|
e.computed = !1;
|
|
3589
3587
|
}
|
|
3590
3588
|
return e.key = this.type === E.num || this.type === E.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
3591
|
-
},
|
|
3589
|
+
}, V.initFunction = function(e) {
|
|
3592
3590
|
e.id = null, this.options.ecmaVersion >= 6 && (e.generator = e.expression = !1), this.options.ecmaVersion >= 8 && (e.async = !1);
|
|
3593
|
-
},
|
|
3591
|
+
}, V.parseMethod = function(e, t, n) {
|
|
3594
3592
|
var r = this.startNode(), i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
3595
3593
|
return this.initFunction(r), this.options.ecmaVersion >= 6 && (r.generator = e), this.options.ecmaVersion >= 8 && (r.async = !!t), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Ue(t, r.generator) | Re | (n ? ze : 0)), this.expect(E.parenL), r.params = this.parseBindingList(E.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(r, !1, !0, !1), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(r, "FunctionExpression");
|
|
3596
|
-
},
|
|
3594
|
+
}, V.parseArrowExpression = function(e, t, n, r) {
|
|
3597
3595
|
var i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
3598
3596
|
return this.enterScope(Ue(n, !1) | Ie), this.initFunction(e), this.options.ecmaVersion >= 8 && (e.async = !!n), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, e.params = this.toAssignableList(t, !0), this.parseFunctionBody(e, !0, !1, r), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(e, "ArrowFunctionExpression");
|
|
3599
|
-
},
|
|
3597
|
+
}, V.parseFunctionBody = function(e, t, n, r) {
|
|
3600
3598
|
var i = t && this.type !== E.braceL, a = this.strict, o = !1;
|
|
3601
3599
|
if (i) e.body = this.parseMaybeAssign(r), e.expression = !0, this.checkParams(e, !1);
|
|
3602
3600
|
else {
|
|
@@ -3606,15 +3604,15 @@ H.parseNew = function() {
|
|
|
3606
3604
|
this.labels = [], o && (this.strict = !0), this.checkParams(e, !a && !o && !t && !n && this.isSimpleParamList(e.params)), this.strict && e.id && this.checkLValSimple(e.id, Je), e.body = this.parseBlock(!1, void 0, o && !a), e.expression = !1, this.adaptDirectivePrologue(e.body.body), this.labels = c;
|
|
3607
3605
|
}
|
|
3608
3606
|
this.exitScope();
|
|
3609
|
-
},
|
|
3607
|
+
}, V.isSimpleParamList = function(e) {
|
|
3610
3608
|
for (var t = 0, n = e; t < n.length; t += 1) if (n[t].type !== "Identifier") return !1;
|
|
3611
3609
|
return !0;
|
|
3612
|
-
},
|
|
3610
|
+
}, V.checkParams = function(e, t) {
|
|
3613
3611
|
for (var n = Object.create(null), r = 0, i = e.params; r < i.length; r += 1) {
|
|
3614
3612
|
var a = i[r];
|
|
3615
3613
|
this.checkLValInnerPattern(a, Ge, t ? null : n);
|
|
3616
3614
|
}
|
|
3617
|
-
},
|
|
3615
|
+
}, V.parseExprList = function(e, t, n, r) {
|
|
3618
3616
|
for (var i = [], a = !0; !this.eat(e);) {
|
|
3619
3617
|
if (a) a = !1;
|
|
3620
3618
|
else if (this.expect(E.comma), t && this.afterTrailingComma(e)) break;
|
|
@@ -3622,50 +3620,50 @@ H.parseNew = function() {
|
|
|
3622
3620
|
n && this.type === E.comma ? o = null : this.type === E.ellipsis ? (o = this.parseSpread(r), r && this.type === E.comma && r.trailingComma < 0 && (r.trailingComma = this.start)) : o = this.parseMaybeAssign(!1, r), i.push(o);
|
|
3623
3621
|
}
|
|
3624
3622
|
return i;
|
|
3625
|
-
},
|
|
3623
|
+
}, V.checkUnreserved = function(e) {
|
|
3626
3624
|
var t = e.start, n = e.end, r = e.name;
|
|
3627
3625
|
this.inGenerator && r === "yield" && this.raiseRecoverable(t, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & He) && r === "arguments" && this.raiseRecoverable(t, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (r === "arguments" || r === "await") && this.raise(t, "Cannot use " + r + " in class static initialization block"), this.keywords.test(r) && this.raise(t, "Unexpected keyword '" + r + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(t, n).indexOf("\\") !== -1) && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(r) && (!this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(t, "The keyword '" + r + "' is reserved"));
|
|
3628
|
-
},
|
|
3626
|
+
}, V.parseIdent = function(e) {
|
|
3629
3627
|
var t = this.parseIdentNode();
|
|
3630
3628
|
return this.next(!!e), this.finishNode(t, "Identifier"), e || (this.checkUnreserved(t), t.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = t.start)), t;
|
|
3631
|
-
},
|
|
3629
|
+
}, V.parseIdentNode = function() {
|
|
3632
3630
|
var e = this.startNode();
|
|
3633
3631
|
return this.type === E.name ? e.name = this.value : this.type.keyword ? (e.name = this.type.keyword, (e.name === "class" || e.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = E.name) : this.unexpected(), e;
|
|
3634
|
-
},
|
|
3632
|
+
}, V.parsePrivateIdent = function() {
|
|
3635
3633
|
var e = this.startNode();
|
|
3636
3634
|
return this.type === E.privateId ? e.name = this.value : this.unexpected(), this.next(), this.finishNode(e, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(e.start, "Private field '#" + e.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(e)), e;
|
|
3637
|
-
},
|
|
3635
|
+
}, V.parseYield = function(e) {
|
|
3638
3636
|
this.yieldPos ||= this.start;
|
|
3639
3637
|
var t = this.startNode();
|
|
3640
3638
|
return this.next(), this.type === E.semi || this.canInsertSemicolon() || this.type !== E.star && !this.type.startsExpr ? (t.delegate = !1, t.argument = null) : (t.delegate = this.eat(E.star), t.argument = this.parseMaybeAssign(e)), this.finishNode(t, "YieldExpression");
|
|
3641
|
-
},
|
|
3639
|
+
}, V.parseAwait = function(e) {
|
|
3642
3640
|
this.awaitPos ||= this.start;
|
|
3643
3641
|
var t = this.startNode();
|
|
3644
3642
|
return this.next(), t.argument = this.parseMaybeUnary(null, !0, !1, e), this.finishNode(t, "AwaitExpression");
|
|
3645
3643
|
};
|
|
3646
|
-
var lt =
|
|
3644
|
+
var lt = P.prototype;
|
|
3647
3645
|
lt.raise = function(e, t) {
|
|
3648
|
-
var n =
|
|
3646
|
+
var n = Oe(this.input, e);
|
|
3649
3647
|
t += " (" + n.line + ":" + n.column + ")", this.sourceFile && (t += " in " + this.sourceFile);
|
|
3650
3648
|
var r = SyntaxError(t);
|
|
3651
3649
|
throw r.pos = e, r.loc = n, r.raisedAt = this.pos, r;
|
|
3652
3650
|
}, lt.raiseRecoverable = lt.raise, lt.curPosition = function() {
|
|
3653
|
-
if (this.options.locations) return new
|
|
3651
|
+
if (this.options.locations) return new Ee(this.curLine, this.pos - this.lineStart);
|
|
3654
3652
|
};
|
|
3655
|
-
var
|
|
3653
|
+
var H = P.prototype, ut = function(e) {
|
|
3656
3654
|
this.flags = e, this.var = [], this.lexical = [], this.functions = [];
|
|
3657
3655
|
};
|
|
3658
|
-
|
|
3656
|
+
H.enterScope = function(e) {
|
|
3659
3657
|
this.scopeStack.push(new ut(e));
|
|
3660
|
-
},
|
|
3658
|
+
}, H.exitScope = function() {
|
|
3661
3659
|
this.scopeStack.pop();
|
|
3662
|
-
},
|
|
3663
|
-
return e.flags &
|
|
3664
|
-
},
|
|
3660
|
+
}, H.treatFunctionsAsVarInScope = function(e) {
|
|
3661
|
+
return e.flags & j || !this.inModule && e.flags & Ne;
|
|
3662
|
+
}, H.declareName = function(e, t, n) {
|
|
3665
3663
|
var r = !1;
|
|
3666
|
-
if (t ===
|
|
3664
|
+
if (t === N) {
|
|
3667
3665
|
var i = this.currentScope();
|
|
3668
|
-
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags &
|
|
3666
|
+
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags & Ne && delete this.undefinedExports[e];
|
|
3669
3667
|
} else if (t === qe) this.currentScope().lexical.push(e);
|
|
3670
3668
|
else if (t === Ke) {
|
|
3671
3669
|
var a = this.currentScope();
|
|
@@ -3676,27 +3674,27 @@ U.enterScope = function(e) {
|
|
|
3676
3674
|
r = !0;
|
|
3677
3675
|
break;
|
|
3678
3676
|
}
|
|
3679
|
-
if (s.var.push(e), this.inModule && s.flags &
|
|
3677
|
+
if (s.var.push(e), this.inModule && s.flags & Ne && delete this.undefinedExports[e], s.flags & He) break;
|
|
3680
3678
|
}
|
|
3681
3679
|
r && this.raiseRecoverable(n, "Identifier '" + e + "' has already been declared");
|
|
3682
|
-
},
|
|
3680
|
+
}, H.checkLocalExport = function(e) {
|
|
3683
3681
|
this.scopeStack[0].lexical.indexOf(e.name) === -1 && this.scopeStack[0].var.indexOf(e.name) === -1 && (this.undefinedExports[e.name] = e);
|
|
3684
|
-
},
|
|
3682
|
+
}, H.currentScope = function() {
|
|
3685
3683
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
3686
|
-
},
|
|
3684
|
+
}, H.currentVarScope = function() {
|
|
3687
3685
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
3688
3686
|
var t = this.scopeStack[e];
|
|
3689
|
-
if (t.flags & (He | Be |
|
|
3687
|
+
if (t.flags & (He | Be | M)) return t;
|
|
3690
3688
|
}
|
|
3691
|
-
},
|
|
3689
|
+
}, H.currentThisScope = function() {
|
|
3692
3690
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
3693
3691
|
var t = this.scopeStack[e];
|
|
3694
|
-
if (t.flags & (He | Be |
|
|
3692
|
+
if (t.flags & (He | Be | M) && !(t.flags & Ie)) return t;
|
|
3695
3693
|
}
|
|
3696
3694
|
};
|
|
3697
3695
|
var dt = function(e, t, n) {
|
|
3698
|
-
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new
|
|
3699
|
-
}, ft =
|
|
3696
|
+
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new De(e, n)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [t, 0]);
|
|
3697
|
+
}, ft = P.prototype;
|
|
3700
3698
|
ft.startNode = function() {
|
|
3701
3699
|
return new dt(this, this.start, this.startLoc);
|
|
3702
3700
|
}, ft.startNodeAt = function(e, t) {
|
|
@@ -3758,7 +3756,7 @@ for (var jt = 0, Mt = [
|
|
|
3758
3756
|
var Nt = Mt[jt];
|
|
3759
3757
|
At(Nt);
|
|
3760
3758
|
}
|
|
3761
|
-
var
|
|
3759
|
+
var U = P.prototype, Pt = function(e, t) {
|
|
3762
3760
|
this.parent = e, this.base = t || this;
|
|
3763
3761
|
};
|
|
3764
3762
|
Pt.prototype.separatedFrom = function(e) {
|
|
@@ -3767,15 +3765,15 @@ Pt.prototype.separatedFrom = function(e) {
|
|
|
3767
3765
|
}, Pt.prototype.sibling = function() {
|
|
3768
3766
|
return new Pt(this.parent, this.base);
|
|
3769
3767
|
};
|
|
3770
|
-
var
|
|
3768
|
+
var W = function(e) {
|
|
3771
3769
|
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = kt[e.options.ecmaVersion >= 14 ? 14 : e.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
3772
3770
|
};
|
|
3773
|
-
|
|
3771
|
+
W.prototype.reset = function(e, t, n) {
|
|
3774
3772
|
var r = n.indexOf("v") !== -1, i = n.indexOf("u") !== -1;
|
|
3775
3773
|
this.start = e | 0, this.source = t + "", this.flags = n, r && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = i && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = i && this.parser.options.ecmaVersion >= 9);
|
|
3776
|
-
},
|
|
3774
|
+
}, W.prototype.raise = function(e) {
|
|
3777
3775
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e);
|
|
3778
|
-
},
|
|
3776
|
+
}, W.prototype.at = function(e, t) {
|
|
3779
3777
|
t === void 0 && (t = !1);
|
|
3780
3778
|
var n = this.source, r = n.length;
|
|
3781
3779
|
if (e >= r) return -1;
|
|
@@ -3783,21 +3781,21 @@ G.prototype.reset = function(e, t, n) {
|
|
|
3783
3781
|
if (!(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r) return i;
|
|
3784
3782
|
var a = n.charCodeAt(e + 1);
|
|
3785
3783
|
return a >= 56320 && a <= 57343 ? (i << 10) + a - 56613888 : i;
|
|
3786
|
-
},
|
|
3784
|
+
}, W.prototype.nextIndex = function(e, t) {
|
|
3787
3785
|
t === void 0 && (t = !1);
|
|
3788
3786
|
var n = this.source, r = n.length;
|
|
3789
3787
|
if (e >= r) return r;
|
|
3790
3788
|
var i = n.charCodeAt(e), a;
|
|
3791
3789
|
return !(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r || (a = n.charCodeAt(e + 1)) < 56320 || a > 57343 ? e + 1 : e + 2;
|
|
3792
|
-
},
|
|
3790
|
+
}, W.prototype.current = function(e) {
|
|
3793
3791
|
return e === void 0 && (e = !1), this.at(this.pos, e);
|
|
3794
|
-
},
|
|
3792
|
+
}, W.prototype.lookahead = function(e) {
|
|
3795
3793
|
return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e);
|
|
3796
|
-
},
|
|
3794
|
+
}, W.prototype.advance = function(e) {
|
|
3797
3795
|
e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e);
|
|
3798
|
-
},
|
|
3796
|
+
}, W.prototype.eat = function(e, t) {
|
|
3799
3797
|
return t === void 0 && (t = !1), this.current(t) === e ? (this.advance(t), !0) : !1;
|
|
3800
|
-
},
|
|
3798
|
+
}, W.prototype.eatChars = function(e, t) {
|
|
3801
3799
|
t === void 0 && (t = !1);
|
|
3802
3800
|
for (var n = this.pos, r = 0, i = e; r < i.length; r += 1) {
|
|
3803
3801
|
var a = i[r], o = this.at(n, t);
|
|
@@ -3805,7 +3803,7 @@ G.prototype.reset = function(e, t, n) {
|
|
|
3805
3803
|
n = this.nextIndex(n, t);
|
|
3806
3804
|
}
|
|
3807
3805
|
return this.pos = n, !0;
|
|
3808
|
-
},
|
|
3806
|
+
}, U.validateRegExpFlags = function(e) {
|
|
3809
3807
|
for (var t = e.validFlags, n = e.flags, r = !1, i = !1, a = 0; a < n.length; a++) {
|
|
3810
3808
|
var o = n.charAt(a);
|
|
3811
3809
|
t.indexOf(o) === -1 && this.raise(e.start, "Invalid regular expression flag"), n.indexOf(o, a + 1) > -1 && this.raise(e.start, "Duplicate regular expression flag"), o === "u" && (r = !0), o === "v" && (i = !0);
|
|
@@ -3816,23 +3814,23 @@ function Ft(e) {
|
|
|
3816
3814
|
for (var t in e) return !0;
|
|
3817
3815
|
return !1;
|
|
3818
3816
|
}
|
|
3819
|
-
|
|
3817
|
+
U.validateRegExpPattern = function(e) {
|
|
3820
3818
|
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 && Ft(e.groupNames) && (e.switchN = !0, this.regexp_pattern(e));
|
|
3821
|
-
},
|
|
3819
|
+
}, U.regexp_pattern = function(e) {
|
|
3822
3820
|
e.pos = 0, e.lastIntValue = 0, e.lastStringValue = "", e.lastAssertionIsQuantifiable = !1, e.numCapturingParens = 0, e.maxBackReference = 0, e.groupNames = Object.create(null), e.backReferenceNames.length = 0, e.branchID = null, this.regexp_disjunction(e), e.pos !== e.source.length && (e.eat(41) && e.raise("Unmatched ')'"), (e.eat(93) || e.eat(125)) && e.raise("Lone quantifier brackets")), e.maxBackReference > e.numCapturingParens && e.raise("Invalid escape");
|
|
3823
3821
|
for (var t = 0, n = e.backReferenceNames; t < n.length; t += 1) {
|
|
3824
3822
|
var r = n[t];
|
|
3825
3823
|
e.groupNames[r] || e.raise("Invalid named capture referenced");
|
|
3826
3824
|
}
|
|
3827
|
-
},
|
|
3825
|
+
}, U.regexp_disjunction = function(e) {
|
|
3828
3826
|
var t = this.options.ecmaVersion >= 16;
|
|
3829
3827
|
for (t && (e.branchID = new Pt(e.branchID, null)), this.regexp_alternative(e); e.eat(124);) t && (e.branchID = e.branchID.sibling()), this.regexp_alternative(e);
|
|
3830
3828
|
t && (e.branchID = e.branchID.parent), this.regexp_eatQuantifier(e, !0) && e.raise("Nothing to repeat"), e.eat(123) && e.raise("Lone quantifier brackets");
|
|
3831
|
-
},
|
|
3829
|
+
}, U.regexp_alternative = function(e) {
|
|
3832
3830
|
for (; e.pos < e.source.length && this.regexp_eatTerm(e););
|
|
3833
|
-
},
|
|
3831
|
+
}, U.regexp_eatTerm = function(e) {
|
|
3834
3832
|
return this.regexp_eatAssertion(e) ? (e.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(e) && e.switchU && e.raise("Invalid quantifier"), !0) : (e.switchU ? this.regexp_eatAtom(e) : this.regexp_eatExtendedAtom(e)) ? (this.regexp_eatQuantifier(e), !0) : !1;
|
|
3835
|
-
},
|
|
3833
|
+
}, U.regexp_eatAssertion = function(e) {
|
|
3836
3834
|
var t = e.pos;
|
|
3837
3835
|
if (e.lastAssertionIsQuantifiable = !1, e.eat(94) || e.eat(36)) return !0;
|
|
3838
3836
|
if (e.eat(92)) {
|
|
@@ -3844,11 +3842,11 @@ W.validateRegExpPattern = function(e) {
|
|
|
3844
3842
|
if (this.options.ecmaVersion >= 9 && (n = e.eat(60)), e.eat(61) || e.eat(33)) return this.regexp_disjunction(e), e.eat(41) || e.raise("Unterminated group"), e.lastAssertionIsQuantifiable = !n, !0;
|
|
3845
3843
|
}
|
|
3846
3844
|
return e.pos = t, !1;
|
|
3847
|
-
},
|
|
3845
|
+
}, U.regexp_eatQuantifier = function(e, t) {
|
|
3848
3846
|
return t === void 0 && (t = !1), this.regexp_eatQuantifierPrefix(e, t) ? (e.eat(63), !0) : !1;
|
|
3849
|
-
},
|
|
3847
|
+
}, U.regexp_eatQuantifierPrefix = function(e, t) {
|
|
3850
3848
|
return e.eat(42) || e.eat(43) || e.eat(63) || this.regexp_eatBracedQuantifier(e, t);
|
|
3851
|
-
},
|
|
3849
|
+
}, U.regexp_eatBracedQuantifier = function(e, t) {
|
|
3852
3850
|
var n = e.pos;
|
|
3853
3851
|
if (e.eat(123)) {
|
|
3854
3852
|
var r = 0, i = -1;
|
|
@@ -3856,16 +3854,16 @@ W.validateRegExpPattern = function(e) {
|
|
|
3856
3854
|
e.switchU && !t && e.raise("Incomplete quantifier"), e.pos = n;
|
|
3857
3855
|
}
|
|
3858
3856
|
return !1;
|
|
3859
|
-
},
|
|
3857
|
+
}, U.regexp_eatAtom = function(e) {
|
|
3860
3858
|
return this.regexp_eatPatternCharacters(e) || e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e);
|
|
3861
|
-
},
|
|
3859
|
+
}, U.regexp_eatReverseSolidusAtomEscape = function(e) {
|
|
3862
3860
|
var t = e.pos;
|
|
3863
3861
|
if (e.eat(92)) {
|
|
3864
3862
|
if (this.regexp_eatAtomEscape(e)) return !0;
|
|
3865
3863
|
e.pos = t;
|
|
3866
3864
|
}
|
|
3867
3865
|
return !1;
|
|
3868
|
-
},
|
|
3866
|
+
}, U.regexp_eatUncapturingGroup = function(e) {
|
|
3869
3867
|
var t = e.pos;
|
|
3870
3868
|
if (e.eat(40)) {
|
|
3871
3869
|
if (e.eat(63)) {
|
|
@@ -3894,37 +3892,37 @@ W.validateRegExpPattern = function(e) {
|
|
|
3894
3892
|
e.pos = t;
|
|
3895
3893
|
}
|
|
3896
3894
|
return !1;
|
|
3897
|
-
},
|
|
3895
|
+
}, U.regexp_eatCapturingGroup = function(e) {
|
|
3898
3896
|
if (e.eat(40)) {
|
|
3899
3897
|
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(e) : e.current() === 63 && e.raise("Invalid group"), this.regexp_disjunction(e), e.eat(41)) return e.numCapturingParens += 1, !0;
|
|
3900
3898
|
e.raise("Unterminated group");
|
|
3901
3899
|
}
|
|
3902
3900
|
return !1;
|
|
3903
|
-
},
|
|
3901
|
+
}, U.regexp_eatModifiers = function(e) {
|
|
3904
3902
|
for (var t = "", n = 0; (n = e.current()) !== -1 && It(n);) t += A(n), e.advance();
|
|
3905
3903
|
return t;
|
|
3906
3904
|
};
|
|
3907
3905
|
function It(e) {
|
|
3908
3906
|
return e === 105 || e === 109 || e === 115;
|
|
3909
3907
|
}
|
|
3910
|
-
|
|
3908
|
+
U.regexp_eatExtendedAtom = function(e) {
|
|
3911
3909
|
return e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e) || this.regexp_eatInvalidBracedQuantifier(e) || this.regexp_eatExtendedPatternCharacter(e);
|
|
3912
|
-
},
|
|
3910
|
+
}, U.regexp_eatInvalidBracedQuantifier = function(e) {
|
|
3913
3911
|
return this.regexp_eatBracedQuantifier(e, !0) && e.raise("Nothing to repeat"), !1;
|
|
3914
|
-
},
|
|
3912
|
+
}, U.regexp_eatSyntaxCharacter = function(e) {
|
|
3915
3913
|
var t = e.current();
|
|
3916
3914
|
return Lt(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3917
3915
|
};
|
|
3918
3916
|
function Lt(e) {
|
|
3919
3917
|
return e === 36 || e >= 40 && e <= 43 || e === 46 || e === 63 || e >= 91 && e <= 94 || e >= 123 && e <= 125;
|
|
3920
3918
|
}
|
|
3921
|
-
|
|
3919
|
+
U.regexp_eatPatternCharacters = function(e) {
|
|
3922
3920
|
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !Lt(n);) e.advance();
|
|
3923
3921
|
return e.pos !== t;
|
|
3924
|
-
},
|
|
3922
|
+
}, U.regexp_eatExtendedPatternCharacter = function(e) {
|
|
3925
3923
|
var t = e.current();
|
|
3926
3924
|
return t !== -1 && t !== 36 && !(t >= 40 && t <= 43) && t !== 46 && t !== 63 && t !== 91 && t !== 94 && t !== 124 ? (e.advance(), !0) : !1;
|
|
3927
|
-
},
|
|
3925
|
+
}, U.regexp_groupSpecifier = function(e) {
|
|
3928
3926
|
if (e.eat(63)) {
|
|
3929
3927
|
this.regexp_eatGroupName(e) || e.raise("Invalid group");
|
|
3930
3928
|
var t = this.options.ecmaVersion >= 16, n = e.groupNames[e.lastStringValue];
|
|
@@ -3932,35 +3930,35 @@ W.regexp_eatPatternCharacters = function(e) {
|
|
|
3932
3930
|
else e.raise("Duplicate capture group name");
|
|
3933
3931
|
t ? (n || (e.groupNames[e.lastStringValue] = [])).push(e.branchID) : e.groupNames[e.lastStringValue] = !0;
|
|
3934
3932
|
}
|
|
3935
|
-
},
|
|
3933
|
+
}, U.regexp_eatGroupName = function(e) {
|
|
3936
3934
|
if (e.lastStringValue = "", e.eat(60)) {
|
|
3937
3935
|
if (this.regexp_eatRegExpIdentifierName(e) && e.eat(62)) return !0;
|
|
3938
3936
|
e.raise("Invalid capture group name");
|
|
3939
3937
|
}
|
|
3940
3938
|
return !1;
|
|
3941
|
-
},
|
|
3939
|
+
}, U.regexp_eatRegExpIdentifierName = function(e) {
|
|
3942
3940
|
if (e.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(e)) {
|
|
3943
3941
|
for (e.lastStringValue += A(e.lastIntValue); this.regexp_eatRegExpIdentifierPart(e);) e.lastStringValue += A(e.lastIntValue);
|
|
3944
3942
|
return !0;
|
|
3945
3943
|
}
|
|
3946
3944
|
return !1;
|
|
3947
|
-
},
|
|
3945
|
+
}, U.regexp_eatRegExpIdentifierStart = function(e) {
|
|
3948
3946
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3949
3947
|
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Rt(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3950
3948
|
};
|
|
3951
3949
|
function Rt(e) {
|
|
3952
3950
|
return y(e, !0) || e === 36 || e === 95;
|
|
3953
3951
|
}
|
|
3954
|
-
|
|
3952
|
+
U.regexp_eatRegExpIdentifierPart = function(e) {
|
|
3955
3953
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3956
3954
|
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), zt(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3957
3955
|
};
|
|
3958
3956
|
function zt(e) {
|
|
3959
3957
|
return b(e, !0) || e === 36 || e === 95 || e === 8204 || e === 8205;
|
|
3960
3958
|
}
|
|
3961
|
-
|
|
3959
|
+
U.regexp_eatAtomEscape = function(e) {
|
|
3962
3960
|
return this.regexp_eatBackReference(e) || this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e) || e.switchN && this.regexp_eatKGroupName(e) ? !0 : (e.switchU && (e.current() === 99 && e.raise("Invalid unicode escape"), e.raise("Invalid escape")), !1);
|
|
3963
|
-
},
|
|
3961
|
+
}, U.regexp_eatBackReference = function(e) {
|
|
3964
3962
|
var t = e.pos;
|
|
3965
3963
|
if (this.regexp_eatDecimalEscape(e)) {
|
|
3966
3964
|
var n = e.lastIntValue;
|
|
@@ -3969,34 +3967,34 @@ W.regexp_eatAtomEscape = function(e) {
|
|
|
3969
3967
|
e.pos = t;
|
|
3970
3968
|
}
|
|
3971
3969
|
return !1;
|
|
3972
|
-
},
|
|
3970
|
+
}, U.regexp_eatKGroupName = function(e) {
|
|
3973
3971
|
if (e.eat(107)) {
|
|
3974
3972
|
if (this.regexp_eatGroupName(e)) return e.backReferenceNames.push(e.lastStringValue), !0;
|
|
3975
3973
|
e.raise("Invalid named reference");
|
|
3976
3974
|
}
|
|
3977
3975
|
return !1;
|
|
3978
|
-
},
|
|
3976
|
+
}, U.regexp_eatCharacterEscape = function(e) {
|
|
3979
3977
|
return this.regexp_eatControlEscape(e) || this.regexp_eatCControlLetter(e) || this.regexp_eatZero(e) || this.regexp_eatHexEscapeSequence(e) || this.regexp_eatRegExpUnicodeEscapeSequence(e, !1) || !e.switchU && this.regexp_eatLegacyOctalEscapeSequence(e) || this.regexp_eatIdentityEscape(e);
|
|
3980
|
-
},
|
|
3978
|
+
}, U.regexp_eatCControlLetter = function(e) {
|
|
3981
3979
|
var t = e.pos;
|
|
3982
3980
|
if (e.eat(99)) {
|
|
3983
3981
|
if (this.regexp_eatControlLetter(e)) return !0;
|
|
3984
3982
|
e.pos = t;
|
|
3985
3983
|
}
|
|
3986
3984
|
return !1;
|
|
3987
|
-
},
|
|
3985
|
+
}, U.regexp_eatZero = function(e) {
|
|
3988
3986
|
return e.current() === 48 && !Yt(e.lookahead()) ? (e.lastIntValue = 0, e.advance(), !0) : !1;
|
|
3989
|
-
},
|
|
3987
|
+
}, U.regexp_eatControlEscape = function(e) {
|
|
3990
3988
|
var t = e.current();
|
|
3991
3989
|
return t === 116 ? (e.lastIntValue = 9, e.advance(), !0) : t === 110 ? (e.lastIntValue = 10, e.advance(), !0) : t === 118 ? (e.lastIntValue = 11, e.advance(), !0) : t === 102 ? (e.lastIntValue = 12, e.advance(), !0) : t === 114 ? (e.lastIntValue = 13, e.advance(), !0) : !1;
|
|
3992
|
-
},
|
|
3990
|
+
}, U.regexp_eatControlLetter = function(e) {
|
|
3993
3991
|
var t = e.current();
|
|
3994
3992
|
return Bt(t) ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
3995
3993
|
};
|
|
3996
3994
|
function Bt(e) {
|
|
3997
3995
|
return e >= 65 && e <= 90 || e >= 97 && e <= 122;
|
|
3998
3996
|
}
|
|
3999
|
-
|
|
3997
|
+
U.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
4000
3998
|
t === void 0 && (t = !1);
|
|
4001
3999
|
var n = e.pos, r = t || e.switchU;
|
|
4002
4000
|
if (e.eat(117)) {
|
|
@@ -4020,11 +4018,11 @@ W.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
|
4020
4018
|
function Vt(e) {
|
|
4021
4019
|
return e >= 0 && e <= 1114111;
|
|
4022
4020
|
}
|
|
4023
|
-
|
|
4021
|
+
U.regexp_eatIdentityEscape = function(e) {
|
|
4024
4022
|
if (e.switchU) return this.regexp_eatSyntaxCharacter(e) ? !0 : e.eat(47) ? (e.lastIntValue = 47, !0) : !1;
|
|
4025
4023
|
var t = e.current();
|
|
4026
4024
|
return t !== 99 && (!e.switchN || t !== 107) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
4027
|
-
},
|
|
4025
|
+
}, U.regexp_eatDecimalEscape = function(e) {
|
|
4028
4026
|
e.lastIntValue = 0;
|
|
4029
4027
|
var t = e.current();
|
|
4030
4028
|
if (t >= 49 && t <= 57) {
|
|
@@ -4035,15 +4033,15 @@ W.regexp_eatIdentityEscape = function(e) {
|
|
|
4035
4033
|
}
|
|
4036
4034
|
return !1;
|
|
4037
4035
|
};
|
|
4038
|
-
var Ht = 0,
|
|
4039
|
-
|
|
4036
|
+
var Ht = 0, G = 1, K = 2;
|
|
4037
|
+
U.regexp_eatCharacterClassEscape = function(e) {
|
|
4040
4038
|
var t = e.current();
|
|
4041
|
-
if (Ut(t)) return e.lastIntValue = -1, e.advance(),
|
|
4039
|
+
if (Ut(t)) return e.lastIntValue = -1, e.advance(), G;
|
|
4042
4040
|
var n = !1;
|
|
4043
4041
|
if (e.switchU && this.options.ecmaVersion >= 9 && ((n = t === 80) || t === 112)) {
|
|
4044
4042
|
e.lastIntValue = -1, e.advance();
|
|
4045
4043
|
var r;
|
|
4046
|
-
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r ===
|
|
4044
|
+
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r === K && e.raise("Invalid property name"), r;
|
|
4047
4045
|
e.raise("Invalid property name");
|
|
4048
4046
|
}
|
|
4049
4047
|
return Ht;
|
|
@@ -4051,13 +4049,13 @@ W.regexp_eatCharacterClassEscape = function(e) {
|
|
|
4051
4049
|
function Ut(e) {
|
|
4052
4050
|
return e === 100 || e === 68 || e === 115 || e === 83 || e === 119 || e === 87;
|
|
4053
4051
|
}
|
|
4054
|
-
|
|
4052
|
+
U.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
4055
4053
|
var t = e.pos;
|
|
4056
4054
|
if (this.regexp_eatUnicodePropertyName(e) && e.eat(61)) {
|
|
4057
4055
|
var n = e.lastStringValue;
|
|
4058
4056
|
if (this.regexp_eatUnicodePropertyValue(e)) {
|
|
4059
4057
|
var r = e.lastStringValue;
|
|
4060
|
-
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r),
|
|
4058
|
+
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r), G;
|
|
4061
4059
|
}
|
|
4062
4060
|
}
|
|
4063
4061
|
if (e.pos = t, this.regexp_eatLoneUnicodePropertyNameOrValue(e)) {
|
|
@@ -4065,13 +4063,13 @@ W.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
|
4065
4063
|
return this.regexp_validateUnicodePropertyNameOrValue(e, i);
|
|
4066
4064
|
}
|
|
4067
4065
|
return Ht;
|
|
4068
|
-
},
|
|
4069
|
-
|
|
4070
|
-
},
|
|
4071
|
-
if (e.unicodeProperties.binary.test(t)) return
|
|
4072
|
-
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return
|
|
4066
|
+
}, U.regexp_validateUnicodePropertyNameAndValue = function(e, t, n) {
|
|
4067
|
+
Se(e.unicodeProperties.nonBinary, t) || e.raise("Invalid property name"), e.unicodeProperties.nonBinary[t].test(n) || e.raise("Invalid property value");
|
|
4068
|
+
}, U.regexp_validateUnicodePropertyNameOrValue = function(e, t) {
|
|
4069
|
+
if (e.unicodeProperties.binary.test(t)) return G;
|
|
4070
|
+
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return K;
|
|
4073
4071
|
e.raise("Invalid property name");
|
|
4074
|
-
},
|
|
4072
|
+
}, U.regexp_eatUnicodePropertyName = function(e) {
|
|
4075
4073
|
var t = 0;
|
|
4076
4074
|
for (e.lastStringValue = ""; Wt(t = e.current());) e.lastStringValue += A(t), e.advance();
|
|
4077
4075
|
return e.lastStringValue !== "";
|
|
@@ -4079,7 +4077,7 @@ W.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
|
4079
4077
|
function Wt(e) {
|
|
4080
4078
|
return Bt(e) || e === 95;
|
|
4081
4079
|
}
|
|
4082
|
-
|
|
4080
|
+
U.regexp_eatUnicodePropertyValue = function(e) {
|
|
4083
4081
|
var t = 0;
|
|
4084
4082
|
for (e.lastStringValue = ""; Gt(t = e.current());) e.lastStringValue += A(t), e.advance();
|
|
4085
4083
|
return e.lastStringValue !== "";
|
|
@@ -4087,17 +4085,17 @@ W.regexp_eatUnicodePropertyValue = function(e) {
|
|
|
4087
4085
|
function Gt(e) {
|
|
4088
4086
|
return Wt(e) || Yt(e);
|
|
4089
4087
|
}
|
|
4090
|
-
|
|
4088
|
+
U.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
4091
4089
|
return this.regexp_eatUnicodePropertyValue(e);
|
|
4092
|
-
},
|
|
4090
|
+
}, U.regexp_eatCharacterClass = function(e) {
|
|
4093
4091
|
if (e.eat(91)) {
|
|
4094
4092
|
var t = e.eat(94), n = this.regexp_classContents(e);
|
|
4095
|
-
return e.eat(93) || e.raise("Unterminated character class"), t && n ===
|
|
4093
|
+
return e.eat(93) || e.raise("Unterminated character class"), t && n === K && e.raise("Negated character class may contain strings"), !0;
|
|
4096
4094
|
}
|
|
4097
4095
|
return !1;
|
|
4098
|
-
},
|
|
4099
|
-
return e.current() === 93 ?
|
|
4100
|
-
},
|
|
4096
|
+
}, U.regexp_classContents = function(e) {
|
|
4097
|
+
return e.current() === 93 ? G : e.switchV ? this.regexp_classSetExpression(e) : (this.regexp_nonEmptyClassRanges(e), G);
|
|
4098
|
+
}, U.regexp_nonEmptyClassRanges = function(e) {
|
|
4101
4099
|
for (; this.regexp_eatClassAtom(e);) {
|
|
4102
4100
|
var t = e.lastIntValue;
|
|
4103
4101
|
if (e.eat(45) && this.regexp_eatClassAtom(e)) {
|
|
@@ -4105,7 +4103,7 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4105
4103
|
e.switchU && (t === -1 || n === -1) && e.raise("Invalid character class"), t !== -1 && n !== -1 && t > n && e.raise("Range out of order in character class");
|
|
4106
4104
|
}
|
|
4107
4105
|
}
|
|
4108
|
-
},
|
|
4106
|
+
}, U.regexp_eatClassAtom = function(e) {
|
|
4109
4107
|
var t = e.pos;
|
|
4110
4108
|
if (e.eat(92)) {
|
|
4111
4109
|
if (this.regexp_eatClassEscape(e)) return !0;
|
|
@@ -4117,7 +4115,7 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4117
4115
|
}
|
|
4118
4116
|
var r = e.current();
|
|
4119
4117
|
return r === 93 ? !1 : (e.lastIntValue = r, e.advance(), !0);
|
|
4120
|
-
},
|
|
4118
|
+
}, U.regexp_eatClassEscape = function(e) {
|
|
4121
4119
|
var t = e.pos;
|
|
4122
4120
|
if (e.eat(98)) return e.lastIntValue = 8, !0;
|
|
4123
4121
|
if (e.switchU && e.eat(45)) return e.lastIntValue = 45, !0;
|
|
@@ -4126,13 +4124,13 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4126
4124
|
e.pos = t;
|
|
4127
4125
|
}
|
|
4128
4126
|
return this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e);
|
|
4129
|
-
},
|
|
4130
|
-
var t =
|
|
4127
|
+
}, U.regexp_classSetExpression = function(e) {
|
|
4128
|
+
var t = G, n;
|
|
4131
4129
|
if (!this.regexp_eatClassSetRange(e)) if (n = this.regexp_eatClassSetOperand(e)) {
|
|
4132
|
-
n ===
|
|
4130
|
+
n === K && (t = K);
|
|
4133
4131
|
for (var r = e.pos; e.eatChars([38, 38]);) {
|
|
4134
4132
|
if (e.current() !== 38 && (n = this.regexp_eatClassSetOperand(e))) {
|
|
4135
|
-
n !==
|
|
4133
|
+
n !== K && (t = G);
|
|
4136
4134
|
continue;
|
|
4137
4135
|
}
|
|
4138
4136
|
e.raise("Invalid character in character class");
|
|
@@ -4143,9 +4141,9 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4143
4141
|
} else e.raise("Invalid character in character class");
|
|
4144
4142
|
for (;;) if (!this.regexp_eatClassSetRange(e)) {
|
|
4145
4143
|
if (n = this.regexp_eatClassSetOperand(e), !n) return t;
|
|
4146
|
-
n ===
|
|
4144
|
+
n === K && (t = K);
|
|
4147
4145
|
}
|
|
4148
|
-
},
|
|
4146
|
+
}, U.regexp_eatClassSetRange = function(e) {
|
|
4149
4147
|
var t = e.pos;
|
|
4150
4148
|
if (this.regexp_eatClassSetCharacter(e)) {
|
|
4151
4149
|
var n = e.lastIntValue;
|
|
@@ -4156,13 +4154,13 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4156
4154
|
e.pos = t;
|
|
4157
4155
|
}
|
|
4158
4156
|
return !1;
|
|
4159
|
-
},
|
|
4160
|
-
return this.regexp_eatClassSetCharacter(e) ?
|
|
4161
|
-
},
|
|
4157
|
+
}, U.regexp_eatClassSetOperand = function(e) {
|
|
4158
|
+
return this.regexp_eatClassSetCharacter(e) ? G : this.regexp_eatClassStringDisjunction(e) || this.regexp_eatNestedClass(e);
|
|
4159
|
+
}, U.regexp_eatNestedClass = function(e) {
|
|
4162
4160
|
var t = e.pos;
|
|
4163
4161
|
if (e.eat(91)) {
|
|
4164
4162
|
var n = e.eat(94), r = this.regexp_classContents(e);
|
|
4165
|
-
if (e.eat(93)) return n && r ===
|
|
4163
|
+
if (e.eat(93)) return n && r === K && e.raise("Negated character class may contain strings"), r;
|
|
4166
4164
|
e.pos = t;
|
|
4167
4165
|
}
|
|
4168
4166
|
if (e.eat(92)) {
|
|
@@ -4171,7 +4169,7 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4171
4169
|
e.pos = t;
|
|
4172
4170
|
}
|
|
4173
4171
|
return null;
|
|
4174
|
-
},
|
|
4172
|
+
}, U.regexp_eatClassStringDisjunction = function(e) {
|
|
4175
4173
|
var t = e.pos;
|
|
4176
4174
|
if (e.eatChars([92, 113])) {
|
|
4177
4175
|
if (e.eat(123)) {
|
|
@@ -4181,13 +4179,13 @@ W.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
4181
4179
|
e.pos = t;
|
|
4182
4180
|
}
|
|
4183
4181
|
return null;
|
|
4184
|
-
},
|
|
4185
|
-
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) ===
|
|
4182
|
+
}, U.regexp_classStringDisjunctionContents = function(e) {
|
|
4183
|
+
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) === K && (t = K);
|
|
4186
4184
|
return t;
|
|
4187
|
-
},
|
|
4185
|
+
}, U.regexp_classString = function(e) {
|
|
4188
4186
|
for (var t = 0; this.regexp_eatClassSetCharacter(e);) t++;
|
|
4189
|
-
return t === 1 ?
|
|
4190
|
-
},
|
|
4187
|
+
return t === 1 ? G : K;
|
|
4188
|
+
}, U.regexp_eatClassSetCharacter = function(e) {
|
|
4191
4189
|
var t = e.pos;
|
|
4192
4190
|
if (e.eat(92)) return this.regexp_eatCharacterEscape(e) || this.regexp_eatClassSetReservedPunctuator(e) ? !0 : e.eat(98) ? (e.lastIntValue = 8, !0) : (e.pos = t, !1);
|
|
4193
4191
|
var n = e.current();
|
|
@@ -4199,24 +4197,24 @@ function Kt(e) {
|
|
|
4199
4197
|
function qt(e) {
|
|
4200
4198
|
return e === 40 || e === 41 || e === 45 || e === 47 || e >= 91 && e <= 93 || e >= 123 && e <= 125;
|
|
4201
4199
|
}
|
|
4202
|
-
|
|
4200
|
+
U.regexp_eatClassSetReservedPunctuator = function(e) {
|
|
4203
4201
|
var t = e.current();
|
|
4204
4202
|
return Jt(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
4205
4203
|
};
|
|
4206
4204
|
function Jt(e) {
|
|
4207
4205
|
return e === 33 || e === 35 || e === 37 || e === 38 || e === 44 || e === 45 || e >= 58 && e <= 62 || e === 64 || e === 96 || e === 126;
|
|
4208
4206
|
}
|
|
4209
|
-
|
|
4207
|
+
U.regexp_eatClassControlLetter = function(e) {
|
|
4210
4208
|
var t = e.current();
|
|
4211
4209
|
return Yt(t) || t === 95 ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
4212
|
-
},
|
|
4210
|
+
}, U.regexp_eatHexEscapeSequence = function(e) {
|
|
4213
4211
|
var t = e.pos;
|
|
4214
4212
|
if (e.eat(120)) {
|
|
4215
4213
|
if (this.regexp_eatFixedHexDigits(e, 2)) return !0;
|
|
4216
4214
|
e.switchU && e.raise("Invalid escape"), e.pos = t;
|
|
4217
4215
|
}
|
|
4218
4216
|
return !1;
|
|
4219
|
-
},
|
|
4217
|
+
}, U.regexp_eatDecimalDigits = function(e) {
|
|
4220
4218
|
var t = e.pos, n = 0;
|
|
4221
4219
|
for (e.lastIntValue = 0; Yt(n = e.current());) e.lastIntValue = 10 * e.lastIntValue + (n - 48), e.advance();
|
|
4222
4220
|
return e.pos !== t;
|
|
@@ -4224,7 +4222,7 @@ W.regexp_eatClassControlLetter = function(e) {
|
|
|
4224
4222
|
function Yt(e) {
|
|
4225
4223
|
return e >= 48 && e <= 57;
|
|
4226
4224
|
}
|
|
4227
|
-
|
|
4225
|
+
U.regexp_eatHexDigits = function(e) {
|
|
4228
4226
|
var t = e.pos, n = 0;
|
|
4229
4227
|
for (e.lastIntValue = 0; Xt(n = e.current());) e.lastIntValue = 16 * e.lastIntValue + Zt(n), e.advance();
|
|
4230
4228
|
return e.pos !== t;
|
|
@@ -4235,7 +4233,7 @@ function Xt(e) {
|
|
|
4235
4233
|
function Zt(e) {
|
|
4236
4234
|
return e >= 65 && e <= 70 ? 10 + (e - 65) : e >= 97 && e <= 102 ? 10 + (e - 97) : e - 48;
|
|
4237
4235
|
}
|
|
4238
|
-
|
|
4236
|
+
U.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
4239
4237
|
if (this.regexp_eatOctalDigit(e)) {
|
|
4240
4238
|
var t = e.lastIntValue;
|
|
4241
4239
|
if (this.regexp_eatOctalDigit(e)) {
|
|
@@ -4245,14 +4243,14 @@ W.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
|
4245
4243
|
return !0;
|
|
4246
4244
|
}
|
|
4247
4245
|
return !1;
|
|
4248
|
-
},
|
|
4246
|
+
}, U.regexp_eatOctalDigit = function(e) {
|
|
4249
4247
|
var t = e.current();
|
|
4250
4248
|
return Qt(t) ? (e.lastIntValue = t - 48, e.advance(), !0) : (e.lastIntValue = 0, !1);
|
|
4251
4249
|
};
|
|
4252
4250
|
function Qt(e) {
|
|
4253
4251
|
return e >= 48 && e <= 55;
|
|
4254
4252
|
}
|
|
4255
|
-
|
|
4253
|
+
U.regexp_eatFixedHexDigits = function(e, t) {
|
|
4256
4254
|
var n = e.pos;
|
|
4257
4255
|
e.lastIntValue = 0;
|
|
4258
4256
|
for (var r = 0; r < t; ++r) {
|
|
@@ -4263,13 +4261,13 @@ W.regexp_eatFixedHexDigits = function(e, t) {
|
|
|
4263
4261
|
return !0;
|
|
4264
4262
|
};
|
|
4265
4263
|
var $t = function(e) {
|
|
4266
|
-
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new
|
|
4267
|
-
},
|
|
4268
|
-
|
|
4264
|
+
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new De(e, e.startLoc, e.endLoc)), e.options.ranges && (this.range = [e.start, e.end]);
|
|
4265
|
+
}, q = P.prototype;
|
|
4266
|
+
q.next = function(e) {
|
|
4269
4267
|
!e && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new $t(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken();
|
|
4270
|
-
},
|
|
4268
|
+
}, q.getToken = function() {
|
|
4271
4269
|
return this.next(), new $t(this);
|
|
4272
|
-
}, typeof Symbol < "u" && (
|
|
4270
|
+
}, typeof Symbol < "u" && (q[Symbol.iterator] = function() {
|
|
4273
4271
|
var e = this;
|
|
4274
4272
|
return { next: function() {
|
|
4275
4273
|
var t = e.getToken();
|
|
@@ -4278,28 +4276,28 @@ J.next = function(e) {
|
|
|
4278
4276
|
value: t
|
|
4279
4277
|
};
|
|
4280
4278
|
} };
|
|
4281
|
-
}),
|
|
4279
|
+
}), q.nextToken = function() {
|
|
4282
4280
|
var e = this.curContext();
|
|
4283
4281
|
if ((!e || !e.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length) return this.finishToken(E.eof);
|
|
4284
4282
|
if (e.override) return e.override(this);
|
|
4285
4283
|
this.readToken(this.fullCharCodeAtPos());
|
|
4286
|
-
},
|
|
4284
|
+
}, q.readToken = function(e) {
|
|
4287
4285
|
return y(e, this.options.ecmaVersion >= 6) || e === 92 ? this.readWord() : this.getTokenFromCode(e);
|
|
4288
|
-
},
|
|
4286
|
+
}, q.fullCharCodeAt = function(e) {
|
|
4289
4287
|
var t = this.input.charCodeAt(e);
|
|
4290
4288
|
if (t <= 55295 || t >= 56320) return t;
|
|
4291
4289
|
var n = this.input.charCodeAt(e + 1);
|
|
4292
4290
|
return n <= 56319 || n >= 57344 ? t : (t << 10) + n - 56613888;
|
|
4293
|
-
},
|
|
4291
|
+
}, q.fullCharCodeAtPos = function() {
|
|
4294
4292
|
return this.fullCharCodeAt(this.pos);
|
|
4295
|
-
},
|
|
4293
|
+
}, q.skipBlockComment = function() {
|
|
4296
4294
|
var e = this.options.onComment && this.curPosition(), t = this.pos, n = this.input.indexOf("*/", this.pos += 2);
|
|
4297
|
-
if (n === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = n + 2, this.options.locations) for (var r = void 0, i = t; (r =
|
|
4295
|
+
if (n === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = n + 2, this.options.locations) for (var r = void 0, i = t; (r = _e(this.input, i, this.pos)) > -1;) ++this.curLine, i = this.lineStart = r;
|
|
4298
4296
|
this.options.onComment && this.options.onComment(!0, this.input.slice(t + 2, n), t, this.pos, e, this.curPosition());
|
|
4299
|
-
},
|
|
4300
|
-
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !
|
|
4297
|
+
}, q.skipLineComment = function(e) {
|
|
4298
|
+
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !ge(r);) r = this.input.charCodeAt(++this.pos);
|
|
4301
4299
|
this.options.onComment && this.options.onComment(!1, this.input.slice(t + e, this.pos), t, this.pos, n, this.curPosition());
|
|
4302
|
-
},
|
|
4300
|
+
}, q.skipSpace = function() {
|
|
4303
4301
|
loop: for (; this.pos < this.input.length;) {
|
|
4304
4302
|
var e = this.input.charCodeAt(this.pos);
|
|
4305
4303
|
switch (e) {
|
|
@@ -4324,40 +4322,40 @@ J.next = function(e) {
|
|
|
4324
4322
|
default: break loop;
|
|
4325
4323
|
}
|
|
4326
4324
|
break;
|
|
4327
|
-
default: if (e > 8 && e < 14 || e >= 5760 &&
|
|
4325
|
+
default: if (e > 8 && e < 14 || e >= 5760 && ve.test(String.fromCharCode(e))) ++this.pos;
|
|
4328
4326
|
else break loop;
|
|
4329
4327
|
}
|
|
4330
4328
|
}
|
|
4331
|
-
},
|
|
4329
|
+
}, q.finishToken = function(e, t) {
|
|
4332
4330
|
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
4333
4331
|
var n = this.type;
|
|
4334
4332
|
this.type = e, this.value = t, this.updateContext(n);
|
|
4335
|
-
},
|
|
4333
|
+
}, q.readToken_dot = function() {
|
|
4336
4334
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
4337
4335
|
if (e >= 48 && e <= 57) return this.readNumber(!0);
|
|
4338
4336
|
var t = this.input.charCodeAt(this.pos + 2);
|
|
4339
4337
|
return this.options.ecmaVersion >= 6 && e === 46 && t === 46 ? (this.pos += 3, this.finishToken(E.ellipsis)) : (++this.pos, this.finishToken(E.dot));
|
|
4340
|
-
},
|
|
4338
|
+
}, q.readToken_slash = function() {
|
|
4341
4339
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
4342
4340
|
return this.exprAllowed ? (++this.pos, this.readRegexp()) : e === 61 ? this.finishOp(E.assign, 2) : this.finishOp(E.slash, 1);
|
|
4343
|
-
},
|
|
4341
|
+
}, q.readToken_mult_modulo_exp = function(e) {
|
|
4344
4342
|
var t = this.input.charCodeAt(this.pos + 1), n = 1, r = e === 42 ? E.star : E.modulo;
|
|
4345
4343
|
return this.options.ecmaVersion >= 7 && e === 42 && t === 42 && (++n, r = E.starstar, t = this.input.charCodeAt(this.pos + 2)), t === 61 ? this.finishOp(E.assign, n + 1) : this.finishOp(r, n);
|
|
4346
|
-
},
|
|
4344
|
+
}, q.readToken_pipe_amp = function(e) {
|
|
4347
4345
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
4348
4346
|
return t === e ? this.options.ecmaVersion >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(E.assign, 3) : this.finishOp(e === 124 ? E.logicalOR : E.logicalAND, 2) : t === 61 ? this.finishOp(E.assign, 2) : this.finishOp(e === 124 ? E.bitwiseOR : E.bitwiseAND, 1);
|
|
4349
|
-
},
|
|
4347
|
+
}, q.readToken_caret = function() {
|
|
4350
4348
|
return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(E.assign, 2) : this.finishOp(E.bitwiseXOR, 1);
|
|
4351
|
-
},
|
|
4349
|
+
}, q.readToken_plus_min = function(e) {
|
|
4352
4350
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
4353
4351
|
return t === e ? t === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || D.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(E.incDec, 2) : t === 61 ? this.finishOp(E.assign, 2) : this.finishOp(E.plusMin, 1);
|
|
4354
|
-
},
|
|
4352
|
+
}, q.readToken_lt_gt = function(e) {
|
|
4355
4353
|
var t = this.input.charCodeAt(this.pos + 1), n = 1;
|
|
4356
4354
|
return t === e ? (n = e === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + n) === 61 ? this.finishOp(E.assign, n + 1) : this.finishOp(E.bitShift, n)) : t === 33 && e === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (t === 61 && (n = 2), this.finishOp(E.relational, n));
|
|
4357
|
-
},
|
|
4355
|
+
}, q.readToken_eq_excl = function(e) {
|
|
4358
4356
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
4359
4357
|
return t === 61 ? this.finishOp(E.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : e === 61 && t === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(E.arrow)) : this.finishOp(e === 61 ? E.eq : E.prefix, 1);
|
|
4360
|
-
},
|
|
4358
|
+
}, q.readToken_question = function() {
|
|
4361
4359
|
var e = this.options.ecmaVersion;
|
|
4362
4360
|
if (e >= 11) {
|
|
4363
4361
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
@@ -4368,11 +4366,11 @@ J.next = function(e) {
|
|
|
4368
4366
|
if (t === 63) return e >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(E.assign, 3) : this.finishOp(E.coalesce, 2);
|
|
4369
4367
|
}
|
|
4370
4368
|
return this.finishOp(E.question, 1);
|
|
4371
|
-
},
|
|
4369
|
+
}, q.readToken_numberSign = function() {
|
|
4372
4370
|
var e = this.options.ecmaVersion, t = 35;
|
|
4373
4371
|
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(), y(t, !0) || t === 92)) return this.finishToken(E.privateId, this.readWord1());
|
|
4374
4372
|
this.raise(this.pos, "Unexpected character '" + A(t) + "'");
|
|
4375
|
-
},
|
|
4373
|
+
}, q.getTokenFromCode = function(e) {
|
|
4376
4374
|
switch (e) {
|
|
4377
4375
|
case 46: return this.readToken_dot();
|
|
4378
4376
|
case 40: return ++this.pos, this.finishToken(E.parenL);
|
|
@@ -4422,10 +4420,10 @@ J.next = function(e) {
|
|
|
4422
4420
|
case 35: return this.readToken_numberSign();
|
|
4423
4421
|
}
|
|
4424
4422
|
this.raise(this.pos, "Unexpected character '" + A(e) + "'");
|
|
4425
|
-
},
|
|
4423
|
+
}, q.finishOp = function(e, t) {
|
|
4426
4424
|
var n = this.input.slice(this.pos, this.pos + t);
|
|
4427
4425
|
return this.pos += t, this.finishToken(e, n);
|
|
4428
|
-
},
|
|
4426
|
+
}, q.readRegexp = function() {
|
|
4429
4427
|
for (var e, t, n = this.pos;;) {
|
|
4430
4428
|
this.pos >= this.input.length && this.raise(n, "Unterminated regular expression");
|
|
4431
4429
|
var r = this.input.charAt(this.pos);
|
|
@@ -4442,7 +4440,7 @@ J.next = function(e) {
|
|
|
4442
4440
|
++this.pos;
|
|
4443
4441
|
var a = this.pos, o = this.readWord1();
|
|
4444
4442
|
this.containsEsc && this.unexpected(a);
|
|
4445
|
-
var s = this.regexpState ||= new
|
|
4443
|
+
var s = this.regexpState ||= new W(this);
|
|
4446
4444
|
s.reset(n, i, o), this.validateRegExpFlags(s), this.validateRegExpPattern(s);
|
|
4447
4445
|
var c = null;
|
|
4448
4446
|
try {
|
|
@@ -4453,7 +4451,7 @@ J.next = function(e) {
|
|
|
4453
4451
|
flags: o,
|
|
4454
4452
|
value: c
|
|
4455
4453
|
});
|
|
4456
|
-
},
|
|
4454
|
+
}, q.readInt = function(e, t, n) {
|
|
4457
4455
|
for (var r = this.options.ecmaVersion >= 12 && t === void 0, i = n && this.input.charCodeAt(this.pos) === 48, a = this.pos, o = 0, s = 0, c = 0, l = t ?? Infinity; c < l; ++c, ++this.pos) {
|
|
4458
4456
|
var u = this.input.charCodeAt(this.pos), d = void 0;
|
|
4459
4457
|
if (r && u === 95) {
|
|
@@ -4471,12 +4469,12 @@ function en(e, t) {
|
|
|
4471
4469
|
function tn(e) {
|
|
4472
4470
|
return typeof BigInt == "function" ? BigInt(e.replace(/_/g, "")) : null;
|
|
4473
4471
|
}
|
|
4474
|
-
|
|
4472
|
+
q.readRadixNumber = function(e) {
|
|
4475
4473
|
var t = this.pos;
|
|
4476
4474
|
this.pos += 2;
|
|
4477
4475
|
var n = this.readInt(e);
|
|
4478
4476
|
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n = tn(this.input.slice(t, this.pos)), ++this.pos) : y(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(E.num, n);
|
|
4479
|
-
},
|
|
4477
|
+
}, q.readNumber = function(e) {
|
|
4480
4478
|
var t = this.pos;
|
|
4481
4479
|
!e && this.readInt(10, void 0, !0) === null && this.raise(t, "Invalid number");
|
|
4482
4480
|
var n = this.pos - t >= 2 && this.input.charCodeAt(t) === 48;
|
|
@@ -4489,7 +4487,7 @@ J.readRadixNumber = function(e) {
|
|
|
4489
4487
|
n && /[89]/.test(this.input.slice(t, this.pos)) && (n = !1), r === 46 && !n && (++this.pos, this.readInt(10), r = this.input.charCodeAt(this.pos)), (r === 69 || r === 101) && !n && (r = this.input.charCodeAt(++this.pos), (r === 43 || r === 45) && ++this.pos, this.readInt(10) === null && this.raise(t, "Invalid number")), y(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
4490
4488
|
var a = en(this.input.slice(t, this.pos), n);
|
|
4491
4489
|
return this.finishToken(E.num, a);
|
|
4492
|
-
},
|
|
4490
|
+
}, q.readCodePoint = function() {
|
|
4493
4491
|
var e = this.input.charCodeAt(this.pos), t;
|
|
4494
4492
|
if (e === 123) {
|
|
4495
4493
|
this.options.ecmaVersion < 6 && this.unexpected();
|
|
@@ -4497,17 +4495,17 @@ J.readRadixNumber = function(e) {
|
|
|
4497
4495
|
t = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, t > 1114111 && this.invalidStringToken(n, "Code point out of bounds");
|
|
4498
4496
|
} else t = this.readHexChar(4);
|
|
4499
4497
|
return t;
|
|
4500
|
-
},
|
|
4498
|
+
}, q.readString = function(e) {
|
|
4501
4499
|
for (var t = "", n = ++this.pos;;) {
|
|
4502
4500
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
4503
4501
|
var r = this.input.charCodeAt(this.pos);
|
|
4504
4502
|
if (r === e) break;
|
|
4505
|
-
r === 92 ? (t += this.input.slice(n, this.pos), t += this.readEscapedChar(!1), n = this.pos) : r === 8232 || r === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (
|
|
4503
|
+
r === 92 ? (t += this.input.slice(n, this.pos), t += this.readEscapedChar(!1), n = this.pos) : r === 8232 || r === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (ge(r) && this.raise(this.start, "Unterminated string constant"), ++this.pos);
|
|
4506
4504
|
}
|
|
4507
4505
|
return t += this.input.slice(n, this.pos++), this.finishToken(E.string, t);
|
|
4508
4506
|
};
|
|
4509
4507
|
var nn = {};
|
|
4510
|
-
|
|
4508
|
+
q.tryReadTemplateToken = function() {
|
|
4511
4509
|
this.inTemplateElement = !0;
|
|
4512
4510
|
try {
|
|
4513
4511
|
this.readTmplToken();
|
|
@@ -4516,16 +4514,16 @@ J.tryReadTemplateToken = function() {
|
|
|
4516
4514
|
else throw e;
|
|
4517
4515
|
}
|
|
4518
4516
|
this.inTemplateElement = !1;
|
|
4519
|
-
},
|
|
4517
|
+
}, q.invalidStringToken = function(e, t) {
|
|
4520
4518
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw nn;
|
|
4521
4519
|
this.raise(e, t);
|
|
4522
|
-
},
|
|
4520
|
+
}, q.readTmplToken = function() {
|
|
4523
4521
|
for (var e = "", t = this.pos;;) {
|
|
4524
4522
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
4525
4523
|
var n = this.input.charCodeAt(this.pos);
|
|
4526
4524
|
if (n === 96 || n === 36 && this.input.charCodeAt(this.pos + 1) === 123) return this.pos === this.start && (this.type === E.template || this.type === E.invalidTemplate) ? n === 36 ? (this.pos += 2, this.finishToken(E.dollarBraceL)) : (++this.pos, this.finishToken(E.backQuote)) : (e += this.input.slice(t, this.pos), this.finishToken(E.template, e));
|
|
4527
4525
|
if (n === 92) e += this.input.slice(t, this.pos), e += this.readEscapedChar(!0), t = this.pos;
|
|
4528
|
-
else if (
|
|
4526
|
+
else if (ge(n)) {
|
|
4529
4527
|
switch (e += this.input.slice(t, this.pos), ++this.pos, n) {
|
|
4530
4528
|
case 13: this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
4531
4529
|
case 10:
|
|
@@ -4538,7 +4536,7 @@ J.tryReadTemplateToken = function() {
|
|
|
4538
4536
|
this.options.locations && (++this.curLine, this.lineStart = this.pos), t = this.pos;
|
|
4539
4537
|
} else ++this.pos;
|
|
4540
4538
|
}
|
|
4541
|
-
},
|
|
4539
|
+
}, q.readInvalidTemplateToken = function() {
|
|
4542
4540
|
for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) {
|
|
4543
4541
|
case "\\":
|
|
4544
4542
|
++this.pos;
|
|
@@ -4553,7 +4551,7 @@ J.tryReadTemplateToken = function() {
|
|
|
4553
4551
|
break;
|
|
4554
4552
|
}
|
|
4555
4553
|
this.raise(this.start, "Unterminated template");
|
|
4556
|
-
},
|
|
4554
|
+
}, q.readEscapedChar = function(e) {
|
|
4557
4555
|
var t = this.input.charCodeAt(++this.pos);
|
|
4558
4556
|
switch (++this.pos, t) {
|
|
4559
4557
|
case 110: return "\n";
|
|
@@ -4576,12 +4574,12 @@ J.tryReadTemplateToken = function() {
|
|
|
4576
4574
|
var r = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0], i = parseInt(r, 8);
|
|
4577
4575
|
return i > 255 && (r = r.slice(0, -1), i = parseInt(r, 8)), this.pos += r.length - 1, t = this.input.charCodeAt(this.pos), (r !== "0" || t === 56 || t === 57) && (this.strict || e) && this.invalidStringToken(this.pos - 1 - r.length, e ? "Octal literal in template string" : "Octal literal in strict mode"), String.fromCharCode(i);
|
|
4578
4576
|
}
|
|
4579
|
-
return
|
|
4577
|
+
return ge(t) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(t);
|
|
4580
4578
|
}
|
|
4581
|
-
},
|
|
4579
|
+
}, q.readHexChar = function(e) {
|
|
4582
4580
|
var t = this.pos, n = this.readInt(16, e);
|
|
4583
4581
|
return n === null && this.invalidStringToken(t, "Bad character escape sequence"), n;
|
|
4584
|
-
},
|
|
4582
|
+
}, q.readWord1 = function() {
|
|
4585
4583
|
this.containsEsc = !1;
|
|
4586
4584
|
for (var e = "", t = !0, n = this.pos, r = this.options.ecmaVersion >= 6; this.pos < this.input.length;) {
|
|
4587
4585
|
var i = this.fullCharCodeAtPos();
|
|
@@ -4596,35 +4594,35 @@ J.tryReadTemplateToken = function() {
|
|
|
4596
4594
|
t = !1;
|
|
4597
4595
|
}
|
|
4598
4596
|
return e + this.input.slice(n, this.pos);
|
|
4599
|
-
},
|
|
4597
|
+
}, q.readWord = function() {
|
|
4600
4598
|
var e = this.readWord1(), t = E.name;
|
|
4601
|
-
return this.keywords.test(e) && (t =
|
|
4602
|
-
},
|
|
4603
|
-
Parser:
|
|
4599
|
+
return this.keywords.test(e) && (t = me[e]), this.finishToken(t, e);
|
|
4600
|
+
}, P.acorn = {
|
|
4601
|
+
Parser: P,
|
|
4604
4602
|
version: "8.17.0",
|
|
4605
|
-
defaultOptions:
|
|
4606
|
-
Position:
|
|
4607
|
-
SourceLocation:
|
|
4608
|
-
getLineInfo:
|
|
4603
|
+
defaultOptions: ke,
|
|
4604
|
+
Position: Ee,
|
|
4605
|
+
SourceLocation: De,
|
|
4606
|
+
getLineInfo: Oe,
|
|
4609
4607
|
Node: dt,
|
|
4610
4608
|
TokenType: x,
|
|
4611
4609
|
tokTypes: E,
|
|
4612
|
-
keywordTypes:
|
|
4613
|
-
TokContext:
|
|
4614
|
-
tokContexts:
|
|
4610
|
+
keywordTypes: me,
|
|
4611
|
+
TokContext: z,
|
|
4612
|
+
tokContexts: B,
|
|
4615
4613
|
isIdentifierChar: b,
|
|
4616
4614
|
isIdentifierStart: y,
|
|
4617
4615
|
Token: $t,
|
|
4618
|
-
isNewLine:
|
|
4616
|
+
isNewLine: ge,
|
|
4619
4617
|
lineBreak: D,
|
|
4620
|
-
lineBreakG:
|
|
4621
|
-
nonASCIIwhitespace:
|
|
4618
|
+
lineBreakG: he,
|
|
4619
|
+
nonASCIIwhitespace: ve
|
|
4622
4620
|
};
|
|
4623
4621
|
function rn(e, t) {
|
|
4624
|
-
return
|
|
4622
|
+
return P.parse(e, t);
|
|
4625
4623
|
}
|
|
4626
4624
|
function an(e, t, n) {
|
|
4627
|
-
return
|
|
4625
|
+
return P.parseExpressionAt(e, t, n);
|
|
4628
4626
|
}
|
|
4629
4627
|
//#endregion
|
|
4630
4628
|
//#region src/transformer.ts
|
|
@@ -4885,14 +4883,14 @@ function cn(e, t, n, r, i) {
|
|
|
4885
4883
|
var a = [];
|
|
4886
4884
|
n ||= Y, (function e(r, i, o) {
|
|
4887
4885
|
var s = o || r.type, c = r !== a[a.length - 1];
|
|
4888
|
-
c && a.push(r),
|
|
4886
|
+
c && a.push(r), un(n, s, r, i, e), t[s] && t[s](r, i || a, a), c && a.pop();
|
|
4889
4887
|
})(e, r, i);
|
|
4890
4888
|
}
|
|
4891
4889
|
function ln(e, t, n) {
|
|
4892
4890
|
n(e, t);
|
|
4893
4891
|
}
|
|
4894
|
-
function
|
|
4895
|
-
function
|
|
4892
|
+
function J(e, t, n) {}
|
|
4893
|
+
function un(e, t, n, r, i) {
|
|
4896
4894
|
if (e[t] == null) throw Error("No walker function defined for node type " + t);
|
|
4897
4895
|
e[t](n, r, i);
|
|
4898
4896
|
}
|
|
@@ -4902,13 +4900,13 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
4902
4900
|
var a = i[r];
|
|
4903
4901
|
n(a, t, "Statement");
|
|
4904
4902
|
}
|
|
4905
|
-
}, Y.Statement = ln, Y.EmptyStatement =
|
|
4903
|
+
}, Y.Statement = ln, Y.EmptyStatement = J, Y.ExpressionStatement = Y.ParenthesizedExpression = Y.ChainExpression = function(e, t, n) {
|
|
4906
4904
|
return n(e.expression, t, "Expression");
|
|
4907
4905
|
}, Y.IfStatement = function(e, t, n) {
|
|
4908
4906
|
n(e.test, t, "Expression"), n(e.consequent, t, "Statement"), e.alternate && n(e.alternate, t, "Statement");
|
|
4909
4907
|
}, Y.LabeledStatement = function(e, t, n) {
|
|
4910
4908
|
return n(e.body, t, "Statement");
|
|
4911
|
-
}, Y.BreakStatement = Y.ContinueStatement =
|
|
4909
|
+
}, Y.BreakStatement = Y.ContinueStatement = J, Y.WithStatement = function(e, t, n) {
|
|
4912
4910
|
n(e.object, t, "Expression"), n(e.body, t, "Statement");
|
|
4913
4911
|
}, Y.SwitchStatement = function(e, t, n) {
|
|
4914
4912
|
n(e.discriminant, t, "Expression");
|
|
@@ -4938,7 +4936,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
4938
4936
|
n(e.left, t, "ForInit"), n(e.right, t, "Expression"), n(e.body, t, "Statement");
|
|
4939
4937
|
}, Y.ForInit = function(e, t, n) {
|
|
4940
4938
|
e.type === "VariableDeclaration" ? n(e, t) : n(e, t, "Expression");
|
|
4941
|
-
}, Y.DebuggerStatement =
|
|
4939
|
+
}, Y.DebuggerStatement = J, Y.FunctionDeclaration = function(e, t, n) {
|
|
4942
4940
|
return n(e, t, "Function");
|
|
4943
4941
|
}, Y.VariableDeclaration = function(e, t, n) {
|
|
4944
4942
|
for (var r = 0, i = e.declarations; r < i.length; r += 1) {
|
|
@@ -4956,7 +4954,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
4956
4954
|
n(e.body, t, e.expression ? "Expression" : "Statement");
|
|
4957
4955
|
}, Y.Pattern = function(e, t, n) {
|
|
4958
4956
|
e.type === "Identifier" ? n(e, t, "VariablePattern") : e.type === "MemberExpression" ? n(e, t, "MemberPattern") : n(e, t);
|
|
4959
|
-
}, Y.VariablePattern =
|
|
4957
|
+
}, Y.VariablePattern = J, Y.MemberPattern = ln, Y.RestElement = function(e, t, n) {
|
|
4960
4958
|
return n(e.argument, t, "Pattern");
|
|
4961
4959
|
}, Y.ArrayPattern = function(e, t, n) {
|
|
4962
4960
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
@@ -4968,7 +4966,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
4968
4966
|
var a = i[r];
|
|
4969
4967
|
a.type === "Property" ? (a.computed && n(a.key, t, "Expression"), n(a.value, t, "Pattern")) : a.type === "RestElement" && n(a.argument, t, "Pattern");
|
|
4970
4968
|
}
|
|
4971
|
-
}, Y.Expression = ln, Y.ThisExpression = Y.Super = Y.MetaProperty =
|
|
4969
|
+
}, Y.Expression = ln, Y.ThisExpression = Y.Super = Y.MetaProperty = J, Y.ArrayExpression = function(e, t, n) {
|
|
4972
4970
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
4973
4971
|
var a = i[r];
|
|
4974
4972
|
a && n(a, t, "Expression");
|
|
@@ -4992,7 +4990,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
4992
4990
|
var c = s[o];
|
|
4993
4991
|
n(c, t, "Expression");
|
|
4994
4992
|
}
|
|
4995
|
-
}, Y.TemplateElement =
|
|
4993
|
+
}, Y.TemplateElement = J, Y.UnaryExpression = Y.UpdateExpression = function(e, t, n) {
|
|
4996
4994
|
n(e.argument, t, "Expression");
|
|
4997
4995
|
}, Y.BinaryExpression = Y.LogicalExpression = function(e, t, n) {
|
|
4998
4996
|
n(e.left, t, "Expression"), n(e.right, t, "Expression");
|
|
@@ -5030,7 +5028,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
5030
5028
|
}
|
|
5031
5029
|
}, Y.ImportExpression = function(e, t, n) {
|
|
5032
5030
|
n(e.source, t, "Expression"), e.options && n(e.options, t, "Expression");
|
|
5033
|
-
}, Y.ImportSpecifier = Y.ImportDefaultSpecifier = Y.ImportNamespaceSpecifier = Y.Identifier = Y.PrivateIdentifier = Y.Literal =
|
|
5031
|
+
}, Y.ImportSpecifier = Y.ImportDefaultSpecifier = Y.ImportNamespaceSpecifier = Y.Identifier = Y.PrivateIdentifier = Y.Literal = J, Y.TaggedTemplateExpression = function(e, t, n) {
|
|
5034
5032
|
n(e.tag, t, "Expression"), n(e.quasi, t, "Expression");
|
|
5035
5033
|
}, Y.ClassDeclaration = Y.ClassExpression = function(e, t, n) {
|
|
5036
5034
|
return n(e, t, "Class");
|
|
@@ -5046,7 +5044,7 @@ Y.Program = Y.BlockStatement = Y.StaticBlock = function(e, t, n) {
|
|
|
5046
5044
|
};
|
|
5047
5045
|
//#endregion
|
|
5048
5046
|
//#region src/generator.ts
|
|
5049
|
-
var
|
|
5047
|
+
var dn = class {
|
|
5050
5048
|
ast;
|
|
5051
5049
|
bytecode = [];
|
|
5052
5050
|
constants = [];
|
|
@@ -5062,7 +5060,7 @@ var fn = class {
|
|
|
5062
5060
|
generate() {
|
|
5063
5061
|
if (this.bytecode = [], this.constants = [], this.nextRegisterId = 0, this.declaredVars = /* @__PURE__ */ new Set(), this.imports = [], this.bindingPositions = /* @__PURE__ */ new Map(), this.derivedBindings = [], this.pendingDerived = [], this.collectDeclaredVars(this.ast.body), this.processDerivedBindings(), this.ast.body.length === 0) {
|
|
5064
5062
|
let e = this.allocRegister();
|
|
5065
|
-
return this.emit(o.CREATE_FRAGMENT, e),
|
|
5063
|
+
return this.emit(o.CREATE_FRAGMENT, e), {
|
|
5066
5064
|
bytecode: this.bytecode,
|
|
5067
5065
|
constants: this.constants,
|
|
5068
5066
|
reactiveBindings: this.buildReactiveBindings(),
|
|
@@ -5073,12 +5071,11 @@ var fn = class {
|
|
|
5073
5071
|
}
|
|
5074
5072
|
if (this.ast.body.length === 1 && this.ast.body[0]?.type === r.Element) {
|
|
5075
5073
|
let e = this.allocRegister();
|
|
5076
|
-
this.compileElement(this.ast.body[0], e)
|
|
5074
|
+
this.compileElement(this.ast.body[0], e);
|
|
5077
5075
|
} else {
|
|
5078
5076
|
let e = this.allocRegister();
|
|
5079
5077
|
this.emit(o.CREATE_FRAGMENT, e);
|
|
5080
5078
|
for (let t of this.ast.body) this.compileNode(t, e);
|
|
5081
|
-
this.emit(o.RETURN, e);
|
|
5082
5079
|
}
|
|
5083
5080
|
return {
|
|
5084
5081
|
bytecode: this.bytecode,
|
|
@@ -5165,12 +5162,9 @@ var fn = class {
|
|
|
5165
5162
|
t.length > 0 && (a = this.compileNodesToSubModule(t), n.__drift_children__ = this.addConstant(a));
|
|
5166
5163
|
}
|
|
5167
5164
|
let s = Object.keys(n).length > 1 ? this.addConstant(n) : 255, c = this.bytecode.length;
|
|
5168
|
-
this.emit(o.MOUNT_COMPONENT, t, i, s);
|
|
5169
|
-
for (let t of e.attributes) t.type === r.Attribute && t.value !== null && typeof t.value != "string" && t.value.type === r.Interpolation && this.recordBindingPositions(t.value.expression, c
|
|
5170
|
-
if (a) for (let e of a.reactiveBindings) this.declaredVars.has(e.variable) && (this.bindingPositions.has(e.variable) || this.bindingPositions.set(e.variable, []), this.bindingPositions.get(e.variable).push(
|
|
5171
|
-
pc: c,
|
|
5172
|
-
opcode: o.MOUNT_COMPONENT
|
|
5173
|
-
}));
|
|
5165
|
+
this.emit(o.MOUNT_COMPONENT, t, i, s), this.emit(o.RETURN);
|
|
5166
|
+
for (let t of e.attributes) t.type === r.Attribute && t.value !== null && typeof t.value != "string" && t.value.type === r.Interpolation && this.recordBindingPositions(t.value.expression, c);
|
|
5167
|
+
if (a) for (let e of a.reactiveBindings) this.declaredVars.has(e.variable) && (this.bindingPositions.has(e.variable) || this.bindingPositions.set(e.variable, []), this.bindingPositions.get(e.variable).push(c));
|
|
5174
5168
|
} else {
|
|
5175
5169
|
this.emit(o.CREATE_ELEMENT, t, i);
|
|
5176
5170
|
for (let n of e.attributes) this.compileAttributeNode(n, t);
|
|
@@ -5191,7 +5185,7 @@ var fn = class {
|
|
|
5191
5185
|
this.emit(o.SET_ATTR, t, n, r, 0);
|
|
5192
5186
|
} else if (e.value.type === r.Interpolation) {
|
|
5193
5187
|
let r = this.addConstant(e.value.expression), i = this.bytecode.length;
|
|
5194
|
-
this.emit(o.SET_ATTR, t, n, r, 1), this.recordBindingPositions(e.value.expression, i
|
|
5188
|
+
this.emit(o.SET_ATTR, t, n, r, 1), this.emit(o.RETURN), this.recordBindingPositions(e.value.expression, i);
|
|
5195
5189
|
}
|
|
5196
5190
|
}
|
|
5197
5191
|
compileTextNode(e, t) {
|
|
@@ -5200,7 +5194,7 @@ var fn = class {
|
|
|
5200
5194
|
}
|
|
5201
5195
|
compileInterpolationNode(e, t) {
|
|
5202
5196
|
let n = this.allocRegister(), r = this.addConstant(e.expression), i = this.bytecode.length;
|
|
5203
|
-
this.emit(o.INTERPOLATE_TEXT, n, r), this.emit(o.APPEND_CHILD, t, n), this.recordBindingPositions(e.expression, i
|
|
5197
|
+
this.emit(o.INTERPOLATE_TEXT, n, r), this.emit(o.RETURN), this.emit(o.APPEND_CHILD, t, n), this.recordBindingPositions(e.expression, i);
|
|
5204
5198
|
}
|
|
5205
5199
|
compileCommentNode(e, t) {
|
|
5206
5200
|
let n = this.allocRegister(), r = this.addConstant(e.content);
|
|
@@ -5212,7 +5206,6 @@ var fn = class {
|
|
|
5212
5206
|
let a = this.allocRegister();
|
|
5213
5207
|
this.emit(o.CREATE_FRAGMENT, a);
|
|
5214
5208
|
for (let t of e) this.compileNode(t, a);
|
|
5215
|
-
this.emit(o.RETURN, a);
|
|
5216
5209
|
let s = {
|
|
5217
5210
|
bytecode: this.bytecode,
|
|
5218
5211
|
constants: this.constants,
|
|
@@ -5221,7 +5214,8 @@ var fn = class {
|
|
|
5221
5214
|
return this.bytecode = t, this.constants = n, this.nextRegisterId = r, this.bindingPositions = i, s;
|
|
5222
5215
|
}
|
|
5223
5216
|
collectDepsFromSubModule(e, t) {
|
|
5224
|
-
let n = new Set(
|
|
5217
|
+
let n = /* @__PURE__ */ new Set();
|
|
5218
|
+
for (let t = 0; t < e.reactiveBindings.length; t++) n.add(e.reactiveBindings[t].variable);
|
|
5225
5219
|
if (t) for (let e of this.extractIdentifiers(t)) this.declaredVars.has(e) && n.add(e);
|
|
5226
5220
|
return [...n];
|
|
5227
5221
|
}
|
|
@@ -5312,13 +5306,10 @@ var fn = class {
|
|
|
5312
5306
|
} catch {}
|
|
5313
5307
|
return t;
|
|
5314
5308
|
}
|
|
5315
|
-
recordBindingPositions(e, t
|
|
5309
|
+
recordBindingPositions(e, t) {
|
|
5316
5310
|
if (this.declaredVars.size === 0) return;
|
|
5317
|
-
let
|
|
5318
|
-
for (let e of
|
|
5319
|
-
pc: t,
|
|
5320
|
-
opcode: n
|
|
5321
|
-
}));
|
|
5311
|
+
let n = this.extractIdentifiers(e);
|
|
5312
|
+
for (let e of n) this.declaredVars.has(e) && (this.bindingPositions.has(e) || this.bindingPositions.set(e, []), this.bindingPositions.get(e).push(t));
|
|
5322
5313
|
}
|
|
5323
5314
|
buildReactiveBindings() {
|
|
5324
5315
|
let e = [];
|
|
@@ -5343,8 +5334,8 @@ var fn = class {
|
|
|
5343
5334
|
this.bytecode.push(e, ...t);
|
|
5344
5335
|
}
|
|
5345
5336
|
};
|
|
5346
|
-
function
|
|
5347
|
-
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ?
|
|
5337
|
+
function fn(e) {
|
|
5338
|
+
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ? fn(e.object) : null;
|
|
5348
5339
|
}
|
|
5349
5340
|
function X(e) {
|
|
5350
5341
|
let t = [];
|
|
@@ -5380,7 +5371,7 @@ function Z(e, t) {
|
|
|
5380
5371
|
function Q(e, t, n) {
|
|
5381
5372
|
return n && n.has(e) ? `(${e} = ${t})` : `(typeof setScopeValue === 'function' && scope ? setScopeValue(scope, ${JSON.stringify(e)}, ${t}) : ((scope || {})[${JSON.stringify(e)}] = ${t}))`;
|
|
5382
5373
|
}
|
|
5383
|
-
function
|
|
5374
|
+
function pn(e, t, n, r = { count: 0 }) {
|
|
5384
5375
|
let i = [];
|
|
5385
5376
|
if (!e) return i;
|
|
5386
5377
|
if (e.type === "Identifier") return i.push(Q(e.name, t, n)), i;
|
|
@@ -5389,7 +5380,7 @@ function mn(e, t, n, r = { count: 0 }) {
|
|
|
5389
5380
|
if (e.left?.type === "Identifier") i.push(Q(e.left.name, a, n));
|
|
5390
5381
|
else {
|
|
5391
5382
|
let t = `_t${r.count++}`;
|
|
5392
|
-
i.push(`const ${t} = ${a}`), i.push(...
|
|
5383
|
+
i.push(`const ${t} = ${a}`), i.push(...pn(e.left, t, n, r));
|
|
5393
5384
|
}
|
|
5394
5385
|
return i;
|
|
5395
5386
|
}
|
|
@@ -5404,11 +5395,11 @@ function mn(e, t, n, r = { count: 0 }) {
|
|
|
5404
5395
|
if (a.value.left?.type === "Identifier") i.push(Q(a.value.left.name, o, n));
|
|
5405
5396
|
else {
|
|
5406
5397
|
let e = `_t${r.count++}`;
|
|
5407
|
-
i.push(`const ${e} = ${o}`), i.push(...
|
|
5398
|
+
i.push(`const ${e} = ${o}`), i.push(...pn(a.value.left, e, n, r));
|
|
5408
5399
|
}
|
|
5409
5400
|
} else if (a.value?.type === "ObjectPattern" || a.value?.type === "ArrayPattern") {
|
|
5410
5401
|
let o = `_t${r.count++}`, s = `(${t} ? ${t}[${e}] : undefined)`;
|
|
5411
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5402
|
+
i.push(`const ${o} = ${s}`), i.push(...pn(a.value, o, n, r));
|
|
5412
5403
|
} else {
|
|
5413
5404
|
let r = a.value?.name || $(a.value, n);
|
|
5414
5405
|
if (r) {
|
|
@@ -5440,7 +5431,7 @@ function mn(e, t, n, r = { count: 0 }) {
|
|
|
5440
5431
|
if (t.left?.type === "Identifier") i.push(Q(t.left.name, s, n));
|
|
5441
5432
|
else {
|
|
5442
5433
|
let e = `_t${r.count++}`;
|
|
5443
|
-
i.push(`const ${e} = ${s}`), i.push(...
|
|
5434
|
+
i.push(`const ${e} = ${s}`), i.push(...pn(t.left, e, n, r));
|
|
5444
5435
|
}
|
|
5445
5436
|
} else if (t.type === "RestElement") {
|
|
5446
5437
|
let r = t.argument?.name || $(t.argument, n);
|
|
@@ -5450,7 +5441,7 @@ function mn(e, t, n, r = { count: 0 }) {
|
|
|
5450
5441
|
}
|
|
5451
5442
|
} else if (t.type === "ObjectPattern" || t.type === "ArrayPattern") {
|
|
5452
5443
|
let o = `_t${r.count++}`, s = `(${a} ? ${a}[${e}] : undefined)`;
|
|
5453
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5444
|
+
i.push(`const ${o} = ${s}`), i.push(...pn(t, o, n, r));
|
|
5454
5445
|
}
|
|
5455
5446
|
}
|
|
5456
5447
|
}
|
|
@@ -5478,7 +5469,7 @@ function $(e, t) {
|
|
|
5478
5469
|
case "CallExpression": {
|
|
5479
5470
|
let n = $(e.callee, t), r = e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : "", i = `(${n}${e.optional ? "?.(" : "("}${r}))`;
|
|
5480
5471
|
if (e.callee?.type === "MemberExpression" && e.callee.property?.type === "Identifier") {
|
|
5481
|
-
let n =
|
|
5472
|
+
let n = fn(e.callee.object), r = e.callee.property.name;
|
|
5482
5473
|
if (n && [
|
|
5483
5474
|
"push",
|
|
5484
5475
|
"pop",
|
|
@@ -5503,10 +5494,10 @@ function $(e, t) {
|
|
|
5503
5494
|
}
|
|
5504
5495
|
}
|
|
5505
5496
|
if (e.left?.type === "MemberExpression") {
|
|
5506
|
-
let r =
|
|
5497
|
+
let r = fn(e.left), i = `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5507
5498
|
if (r && (!t || !t.has(r))) return `(() => { const _res = ${i}; if (typeof setScopeValue === 'function' && scope && typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(r)})) setScopeValue(scope, ${JSON.stringify(r)}, scope[${JSON.stringify(r)}]); return _res; })()`;
|
|
5508
5499
|
}
|
|
5509
|
-
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${
|
|
5500
|
+
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${pn(e.left, "_val", t).join("; ")}; return _val; })(${n})` : `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5510
5501
|
}
|
|
5511
5502
|
case "UpdateExpression":
|
|
5512
5503
|
if (e.argument?.type === "Identifier") {
|
|
@@ -5516,7 +5507,7 @@ function $(e, t) {
|
|
|
5516
5507
|
return e.prefix ? `(typeof setScopeValue === 'function' ? (setScopeValue(scope, ${JSON.stringify(n)}, (Number(scope[${JSON.stringify(n)}]) || 0) ${r} 1), scope[${JSON.stringify(n)}]) : ((scope || {})[${JSON.stringify(n)}] = (Number((scope || {})[${JSON.stringify(n)}]) || 0) ${r} 1))` : `(() => { const _v = Number(scope[${JSON.stringify(n)}]) || 0; if (typeof setScopeValue === 'function') setScopeValue(scope, ${JSON.stringify(n)}, _v ${r} 1); else (scope || {})[${JSON.stringify(n)}] = _v ${r} 1; return _v; })()`;
|
|
5517
5508
|
}
|
|
5518
5509
|
if (e.argument?.type === "MemberExpression") {
|
|
5519
|
-
let n =
|
|
5510
|
+
let n = fn(e.argument), r = e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
5520
5511
|
if (n && (!t || !t.has(n))) return `(() => { const _res = ${r}; if (typeof setScopeValue === 'function' && scope && typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(n)})) setScopeValue(scope, ${JSON.stringify(n)}, scope[${JSON.stringify(n)}]); return _res; })()`;
|
|
5521
5512
|
}
|
|
5522
5513
|
return e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
@@ -5636,7 +5627,7 @@ function $(e, t) {
|
|
|
5636
5627
|
}
|
|
5637
5628
|
let n = [];
|
|
5638
5629
|
if (e.declarations) for (let r of e.declarations) if (r.id?.type === "ObjectPattern" || r.id?.type === "ArrayPattern") {
|
|
5639
|
-
let e = r.init ? $(r.init, t) : "undefined", i =
|
|
5630
|
+
let e = r.init ? $(r.init, t) : "undefined", i = pn(r.id, "_init", t);
|
|
5640
5631
|
n.push(`((_init) => { ${i.join("; ")}; return _init; })(${e})`);
|
|
5641
5632
|
} else {
|
|
5642
5633
|
let e = r.id?.name || $(r.id, t), i = r.init ? $(r.init, t) : "undefined";
|
|
@@ -5707,9 +5698,9 @@ function $(e, t) {
|
|
|
5707
5698
|
}
|
|
5708
5699
|
//#endregion
|
|
5709
5700
|
//#region src/index.ts
|
|
5710
|
-
function
|
|
5711
|
-
let n = new sn(new
|
|
5701
|
+
function mn(e, t = !1) {
|
|
5702
|
+
let n = new sn(new ne(new _(e)).parse()).transform(), r = new dn(n).generate();
|
|
5712
5703
|
return t && (console.log("--- Transformed AST ---"), console.log(JSON.stringify(n, null, 2)), console.log("--- Compiled Module ---"), console.log(JSON.stringify(r, null, 2))), r;
|
|
5713
5704
|
}
|
|
5714
5705
|
//#endregion
|
|
5715
|
-
export { r as ASTNodeType,
|
|
5706
|
+
export { r as ASTNodeType, dn as DriftGenerator, _ as DriftLexer, i as DriftLexerError, ne as DriftParser, a as DriftParserError, sn as DriftTransformer, n as ExprTokenKind, t as LexerStateKind, o as Opcode, e as TokenType, $ as astToJS, mn as compile, X as extractBindingNames, on as traverseTemplateAST };
|