meriyah 6.1.4 → 7.0.0
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/CHANGELOG.md +18 -0
- package/README.md +31 -31
- package/dist/meriyah.cjs +1068 -1059
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +1068 -1059
- package/dist/meriyah.umd.js +9192 -9183
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +1 -2
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/estree.d.ts +36 -22
- package/dist/types/lexer/comments.d.ts +1 -1
- package/dist/types/lexer/common.d.ts +1 -1
- package/dist/types/lexer/identifier.d.ts +1 -1
- package/dist/types/lexer/jsx.d.ts +1 -1
- package/dist/types/lexer/scan.d.ts +1 -1
- package/dist/types/meriyah.d.ts +2 -2
- package/dist/types/options.d.ts +7 -4
- package/dist/types/parser/parser.d.ts +10 -9
- package/dist/types/parser/private-scope.d.ts +1 -1
- package/dist/types/parser/scope.d.ts +1 -1
- package/dist/types/parser.d.ts +1 -6
- package/dist/types/utilities.d.ts +1 -0
- package/package.json +7 -4
package/dist/meriyah.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var version$1 = "7.0.0";
|
|
4
|
+
|
|
3
5
|
const unicodeLookup = ((compressed, lookup) => {
|
|
4
6
|
const result = new Uint32Array(69632);
|
|
5
7
|
let index = 0;
|
|
6
8
|
let subIndex = 0;
|
|
7
|
-
while (index <
|
|
9
|
+
while (index < 2597) {
|
|
8
10
|
const inst = compressed[index++];
|
|
9
11
|
if (inst < 0) {
|
|
10
12
|
subIndex -= inst;
|
|
@@ -22,78 +24,10 @@ const unicodeLookup = ((compressed, lookup) => {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
return result;
|
|
25
|
-
})([-1, 2, 26, 2, 27, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 63, 2, 64, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 65, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 66, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 18, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 60, 2, 7, 2, 6, 0, 4286611199, 3, 0, 2, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 0, 65472, 2, 3, 0, 4093640191, 0, 660618719, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1616920031, 0, 982991, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 71, 0, 4284449919, 0, 851904, 2, 4, 2, 12, 0, 67076095, -1, 2, 72, 0, 1073741743, 0, 4093607775, -1, 0, 50331649, 0, 3265266687, 2, 33, 0, 4294844415, 0, 4278190047, 2, 20, 2, 137, -1, 3, 0, 2, 2, 23, 2, 0, 2, 10, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 74, 2, 0, 2, 75, 2, 76, 2, 77, 2, 0, 2, 78, 2, 0, 2, 11, 0, 261632, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 79, 2, 5, 3, 0, 2, 2, 80, 0, 2151677951, 2, 29, 2, 9, 0, 909311, 3, 0, 2, 0, 814743551, 2, 49, 0, 67090432, 3, 0, 2, 2, 42, 2, 0, 2, 6, 2, 0, 2, 30, 2, 8, 0, 268374015, 2, 110, 2, 51, 2, 0, 2, 81, 0, 134153215, -1, 2, 7, 2, 0, 2, 8, 0, 2684354559, 0, 67044351, 0, 3221160064, 2, 17, -1, 3, 0, 2, 2, 53, 0, 1046528, 3, 0, 3, 2, 9, 2, 0, 2, 54, 0, 4294960127, 2, 10, 2, 6, 2, 11, 0, 4294377472, 2, 12, 3, 0, 16, 2, 13, 2, 0, 2, 82, 2, 10, 2, 0, 2, 83, 2, 84, 2, 85, 0, 12288, 2, 55, 0, 1048577, 2, 86, 2, 14, -1, 2, 14, 0, 131042, 2, 87, 2, 88, 2, 89, 2, 0, 2, 34, -83, 3, 0, 7, 0, 1046559, 2, 0, 2, 15, 2, 0, 0, 2147516671, 2, 21, 3, 90, 2, 2, 0, -16, 2, 91, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 3, 0, 2, 2, 28, 2, 16, 3, 0, 2, 2, 17, 2, 0, -1, 2, 18, -16, 3, 0, 206, -2, 3, 0, 692, 2, 73, -1, 2, 18, 2, 10, 3, 0, 8, 2, 93, 2, 133, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 94, 2, 95, 3, 0, 2, 2, 96, 2, 0, 2, 97, 2, 46, 2, 0, 0, 4351, 2, 0, 2, 9, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 24, 2, 9, 2, 20, 3, 0, 2, 0, 67076097, 2, 8, 2, 0, 2, 21, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 101, 2, 102, 2, 22, 2, 23, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 103, 2, 104, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 3774349439, 2, 105, 2, 106, 3, 0, 2, 2, 19, 2, 107, 3, 0, 10, 2, 10, 2, 18, 2, 0, 2, 47, 2, 0, 2, 31, 2, 108, 2, 25, 0, 1638399, 0, 57344, 2, 109, 3, 0, 3, 2, 20, 2, 26, 2, 27, 2, 5, 2, 28, 2, 0, 2, 8, 2, 111, -1, 2, 112, 2, 113, 2, 114, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -3, 0, 536870912, -4, 2, 20, 2, 0, 2, 36, 0, 1, 2, 0, 2, 67, 2, 6, 2, 12, 2, 10, 2, 0, 2, 115, -1, 3, 0, 4, 2, 10, 2, 23, 2, 116, 2, 7, 2, 0, 2, 117, 2, 0, 2, 118, 2, 119, 2, 120, 2, 0, 2, 9, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 121, 2, 122, -2, 2, 123, 2, 124, 2, 30, 2, 21, 2, 8, -2, 2, 125, 2, 30, 2, 32, -2, 2, 0, 2, 39, -2, 0, 4277137519, 0, 2269118463, -1, 3, 20, 2, -1, 2, 33, 2, 38, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 48, 2, 0, 0, 4294950463, 2, 37, -7, 2, 0, 0, 203775, 2, 57, 0, 4026531840, 2, 20, 2, 43, 2, 36, 2, 18, 2, 37, 2, 18, 2, 126, 2, 21, 3, 0, 2, 2, 38, 0, 2151677888, 2, 0, 2, 12, 0, 4294901764, 2, 144, 2, 0, 2, 58, 2, 56, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 128, 2, 39, 0, 3, -1, 2, 129, 2, 130, 2, 0, 0, 67045375, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, 2, 132, 2, 41, 0, 1046437, 0, 6, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 42, 2, 23, 2, 50, 2, 11, 2, 61, 2, 38, -5, 2, 0, 2, 12, -3, 3, 0, 2, 0, 2147484671, 2, 134, 0, 4190109695, 2, 52, -2, 2, 135, 0, 4244635647, 0, 27, 2, 0, 2, 8, 2, 43, 2, 0, 2, 68, 2, 18, 2, 0, 2, 42, -6, 2, 0, 2, 45, 2, 59, 2, 44, 2, 45, 2, 46, 2, 47, 0, 8388351, -2, 2, 136, 0, 3028287487, 2, 48, 2, 138, 0, 33259519, 2, 49, -9, 2, 21, 0, 4294836223, 0, 3355443199, 0, 134152199, -2, 2, 69, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 17, 3, 0, 6, 2, 50, -81, 2, 18, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 2, 30, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 0, 2, 32, -54, 3, 0, 17, 2, 42, 2, 8, 2, 23, 2, 0, 2, 8, 2, 23, 2, 51, 2, 0, 2, 21, 2, 52, 2, 139, 2, 25, -13, 2, 0, 2, 53, -6, 3, 0, 2, -4, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 196635, 3, 0, 191, 2, 54, 3, 0, 38, 2, 30, 2, 55, 2, 34, -278, 2, 140, 3, 0, 9, 2, 141, 2, 142, 2, 56, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 143, 0, 1677656575, -130, 2, 26, -16, 2, 0, 2, 24, 2, 38, -16, 0, 4161266656, 0, 4071, 0, 15360, -4, 2, 57, -13, 3, 0, 2, 2, 58, 2, 0, 2, 145, 2, 146, 2, 62, 2, 0, 2, 147, 2, 148, 2, 149, 3, 0, 10, 2, 150, 2, 151, 2, 22, 3, 58, 2, 3, 152, 2, 3, 59, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 92, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -34, 2, 8, 2, 154, -6, 0, 4194303871, 0, 4294903771, 2, 0, 2, 60, 2, 100, -3, 2, 0, 0, 1073684479, 0, 17407, -9, 2, 18, 2, 17, 2, 0, 2, 32, -14, 2, 18, 2, 32, -6, 2, 18, 2, 12, -15, 2, 155, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 61, -37, 2, 62, 2, 156, 2, 157, 2, 158, 2, 159, 2, 160, -105, 2, 26, -32, 3, 0, 1335, -1, 3, 0, 129, 2, 32, 3, 0, 6, 2, 10, 3, 0, 180, 2, 161, 3, 0, 233, 2, 162, 3, 0, 18, 2, 10, -77, 3, 0, 16, 2, 10, -47, 3, 0, 154, 2, 6, 3, 0, 130, 2, 25, -22250, 3, 0, 7, 2, 25, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 63, 2, 64, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 65, 2, 0, 2, 34, -1, 2, 18, 2, 66, -1, 2, 0, 0, 2047, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 25, 2, 67, 3, 0, 2, 0, 131135, 2, 98, 0, 70256639, 0, 71303167, 0, 272, 2, 42, 2, 6, 0, 32511, 2, 0, 2, 49, -1, 2, 99, 2, 68, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 70, 2, 69, 0, 33554435, 2, 131, 2, 70, 0, 2952790016, 0, 131075, 0, 3594373096, 0, 67094296, 2, 69, -1, 0, 4294828000, 0, 603979263, 0, 654311424, 0, 3, 0, 4294828001, 0, 602930687, 0, 1610612736, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 71, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 72, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 33, 2, 73, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 74, 2, 0, 2, 75, 2, 76, 2, 77, 2, 0, 2, 78, 2, 0, 2, 12, -1, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 79, 2, 5, 3, 0, 2, 2, 80, 0, 2147745791, 3, 19, 2, 0, 122879, 2, 0, 2, 9, 0, 276824064, -2, 3, 0, 2, 2, 42, 2, 0, 0, 4294903295, 2, 0, 2, 30, 2, 8, -1, 2, 18, 2, 51, 2, 0, 2, 81, 2, 49, -1, 2, 21, 2, 0, 2, 29, -2, 0, 128, -2, 2, 28, 2, 9, 0, 8160, -1, 2, 127, 0, 4227907585, 2, 0, 2, 37, 2, 0, 2, 50, 0, 4227915776, 2, 10, 2, 6, 2, 11, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 13, 2, 0, 2, 82, 2, 10, 2, 0, 2, 83, 2, 84, 2, 85, -3, 2, 86, 2, 14, -3, 2, 87, 2, 88, 2, 89, 2, 0, 2, 34, -83, 3, 0, 7, 0, 817183, 2, 0, 2, 15, 2, 0, 0, 33023, 2, 21, 3, 90, 2, -17, 2, 91, 0, 524157950, 2, 4, 2, 0, 2, 92, 2, 4, 2, 0, 2, 22, 2, 28, 2, 16, 3, 0, 2, 2, 17, 2, 0, -1, 2, 18, -16, 3, 0, 206, -2, 3, 0, 692, 2, 73, -1, 2, 18, 2, 10, 3, 0, 8, 2, 93, 0, 3072, 2, 0, 0, 2147516415, 2, 10, 3, 0, 2, 2, 25, 2, 94, 2, 95, 3, 0, 2, 2, 96, 2, 0, 2, 97, 2, 46, 0, 4294965179, 0, 7, 2, 0, 2, 9, 2, 95, 2, 9, -1, 0, 1761345536, 2, 98, 0, 4294901823, 2, 38, 2, 20, 2, 99, 2, 35, 2, 100, 0, 2080440287, 2, 0, 2, 34, 2, 153, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 101, 2, 102, 2, 22, 2, 23, 3, 0, 3, 0, 7, 3, 0, 349, 2, 103, 2, 104, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 2700607615, 2, 105, 2, 106, 3, 0, 2, 2, 19, 2, 107, 3, 0, 10, 2, 10, 2, 18, 2, 0, 2, 47, 2, 0, 2, 31, 2, 108, -3, 2, 109, 3, 0, 3, 2, 20, -1, 3, 5, 2, 2, 110, 2, 0, 2, 8, 2, 111, -1, 2, 112, 2, 113, 2, 114, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -8, 2, 20, 2, 0, 2, 36, -1, 2, 0, 2, 67, 2, 6, 2, 30, 2, 10, 2, 0, 2, 115, -1, 3, 0, 4, 2, 10, 2, 18, 2, 116, 2, 7, 2, 0, 2, 117, 2, 0, 2, 118, 2, 119, 2, 120, 2, 0, 2, 9, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 121, 2, 122, -2, 2, 123, 2, 124, 2, 30, 2, 21, 2, 8, -2, 2, 125, 2, 30, 2, 32, -2, 2, 0, 2, 39, -2, 0, 4277075969, 2, 30, -1, 3, 20, 2, -1, 2, 33, 2, 126, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 50, 2, 98, 0, 4294934591, 2, 37, -7, 2, 0, 0, 197631, 2, 57, -1, 2, 20, 2, 43, 2, 37, 2, 18, 0, 3, 2, 18, 2, 126, 2, 21, 2, 127, 2, 54, -1, 0, 2490368, 2, 127, 2, 25, 2, 18, 2, 34, 2, 127, 2, 38, 0, 4294901904, 0, 4718591, 2, 127, 2, 35, 0, 335544350, -1, 2, 128, 0, 2147487743, 0, 1, -1, 2, 129, 2, 130, 2, 8, -1, 2, 131, 2, 70, 0, 3758161920, 0, 3, 2, 132, 0, 12582911, 0, 655360, -1, 2, 0, 2, 29, 0, 2147485568, 0, 3, 2, 0, 2, 25, 0, 176, -5, 2, 0, 2, 17, 0, 251658240, -1, 2, 0, 2, 25, 0, 16, -1, 2, 0, 0, 16779263, -2, 2, 12, -1, 2, 38, -5, 2, 0, 2, 133, -3, 3, 0, 2, 2, 55, 2, 134, 0, 2147549183, 0, 2, -2, 2, 135, 2, 36, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, 2, 18, 2, 0, 2, 42, -6, 2, 0, 0, 1, 2, 59, 2, 17, 0, 1, 2, 46, 2, 25, -3, 2, 136, 2, 36, 2, 137, 2, 138, 0, 16778239, -10, 2, 35, 0, 4294836212, 2, 9, -3, 2, 69, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 17, 3, 0, 6, 2, 50, -81, 2, 18, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 0, 126, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 10, -55, 3, 0, 17, 2, 42, 2, 8, 2, 18, 2, 0, 2, 8, 2, 18, 2, 60, 2, 0, 2, 25, 2, 50, 2, 139, 2, 25, -13, 2, 0, 2, 73, -6, 3, 0, 2, -4, 3, 0, 2, 0, 67583, -1, 2, 107, -2, 0, 11, 3, 0, 191, 2, 54, 3, 0, 38, 2, 30, 2, 55, 2, 34, -278, 2, 140, 3, 0, 9, 2, 141, 2, 142, 2, 56, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 143, 2, 144, -187, 3, 0, 2, 2, 58, 2, 0, 2, 145, 2, 146, 2, 62, 2, 0, 2, 147, 2, 148, 2, 149, 3, 0, 10, 2, 150, 2, 151, 2, 22, 3, 58, 2, 3, 152, 2, 3, 59, 2, 2, 153, -57, 2, 8, 2, 154, -7, 2, 18, 2, 0, 2, 60, -4, 2, 0, 0, 1065361407, 0, 16384, -9, 2, 18, 2, 60, 2, 0, 2, 133, -14, 2, 18, 2, 133, -6, 2, 18, 0, 81919, -15, 2, 155, 3, 0, 6, 2, 126, -1, 3, 0, 2, 0, 2063, -37, 2, 62, 2, 156, 2, 157, 2, 158, 2, 159, 2, 160, -138, 3, 0, 1335, -1, 3, 0, 129, 2, 32, 3, 0, 6, 2, 10, 3, 0, 180, 2, 161, 3, 0, 233, 2, 162, 3, 0, 18, 2, 10, -77, 3, 0, 16, 2, 10, -47, 3, 0, 154, 2, 6, 3, 0, 130, 2, 25, -28386], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 4294903807, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4294901759, 32767, 4294901760, 262143, 536870911, 8388607, 4160749567, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967264, 2097151, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 63, 127, 3238002687, 4294549487, 4290772991, 33554431, 4294901888, 4286578687, 67043329, 4294705152, 4294770687, 67043583, 1023, 15, 2047999, 67043343, 67051519, 16777215, 2147483648, 4294902000, 28, 4292870143, 4294966783, 16383, 67047423, 4294967279, 262083, 20511, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 535511039, 4294966272, 4294967280, 32768, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 4294967232, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4160684047, 4290246655, 469499899, 4294967231, 134086655, 4294966591, 2445279231, 3670015, 31, 4294967288, 4294705151, 3221208447, 4294902271, 4294549472, 4294921215, 4095, 4285526655, 4294966527, 4294966143, 64, 4294966719, 3774873592, 1877934080, 262151, 2555904, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4294934527, 4087, 2016, 2147446655, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 4294901761]);
|
|
27
|
+
})([-1, 2, 26, 2, 27, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 61, 2, 62, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 63, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 64, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 58, 2, 7, 2, 6, 0, 4286643967, 3, 0, 2, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 0, 65472, 2, 3, 0, 4093640191, 0, 929054175, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1885355487, 0, 982991, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 69, 0, 4284449919, 0, 851904, 2, 4, 2, 12, 0, 67076095, -1, 2, 70, 0, 1073741743, 0, 4093607775, -1, 0, 50331649, 0, 3265266687, 2, 33, 0, 4294844415, 0, 4278190047, 2, 20, 2, 137, -1, 3, 0, 2, 2, 23, 2, 0, 2, 9, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 72, 2, 0, 2, 73, 2, 74, 2, 75, 2, 0, 2, 76, 2, 0, 2, 11, 0, 261632, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 77, 2, 5, 3, 0, 2, 2, 78, 0, 2151677951, 2, 29, 2, 10, 0, 909311, 3, 0, 2, 0, 814743551, 2, 48, 0, 67090432, 3, 0, 2, 2, 42, 2, 0, 2, 6, 2, 0, 2, 30, 2, 8, 0, 268374015, 2, 108, 2, 51, 2, 0, 2, 79, 0, 134153215, -1, 2, 7, 2, 0, 2, 8, 0, 2684354559, 0, 67044351, 0, 3221160064, 2, 9, 2, 18, 3, 0, 2, 2, 53, 0, 1046528, 3, 0, 3, 2, 10, 2, 0, 2, 127, 0, 4294960127, 2, 9, 2, 6, 2, 11, 0, 4294377472, 2, 12, 3, 0, 16, 2, 13, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, 0, 12288, 2, 54, 0, 1048577, 2, 84, 2, 14, -1, 2, 14, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 34, -83, 3, 0, 7, 0, 1046559, 2, 0, 2, 15, 2, 0, 0, 2147516671, 2, 21, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 3, 0, 2, 2, 28, 2, 16, 3, 0, 2, 2, 49, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 692, 2, 71, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 18, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 92, 2, 93, 3, 0, 2, 2, 94, 2, 0, 2, 20, 2, 95, 2, 0, 0, 4351, 2, 0, 2, 10, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 24, 2, 10, 2, 20, 3, 0, 2, 0, 67076097, 2, 8, 2, 0, 2, 21, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 99, 2, 100, 2, 22, 2, 23, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 101, 2, 102, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 3774349439, 2, 103, 2, 104, 3, 0, 2, 2, 19, 2, 105, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 46, 2, 0, 2, 31, 2, 106, 2, 25, 0, 1638399, 0, 57344, 2, 107, 3, 0, 3, 2, 20, 2, 26, 2, 27, 2, 5, 2, 28, 2, 0, 2, 8, 2, 109, -1, 2, 110, 2, 111, 2, 112, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -3, 0, 536870912, -4, 2, 20, 2, 0, 2, 36, 0, 1, 2, 0, 2, 65, 2, 6, 2, 12, 2, 9, 2, 0, 2, 113, -1, 3, 0, 4, 2, 9, 2, 23, 2, 114, 2, 7, 2, 0, 2, 115, 2, 0, 2, 116, 2, 117, 2, 118, 2, 0, 2, 10, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 119, 2, 120, -2, 2, 121, 2, 122, 2, 30, 2, 21, 2, 8, -2, 2, 123, 2, 30, 3, 32, 2, -1, 2, 0, 2, 39, -2, 0, 4277137519, 0, 2269118463, -1, 3, 20, 2, -1, 2, 33, 2, 38, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 47, 2, 0, 0, 4294950463, 2, 37, -7, 2, 0, 0, 203775, 2, 125, 0, 4227858432, 2, 20, 2, 43, 2, 36, 2, 17, 2, 37, 2, 17, 2, 124, 2, 21, 3, 0, 2, 2, 38, 0, 2151677888, 2, 0, 2, 12, 0, 4294901764, 2, 145, 2, 0, 2, 56, 2, 55, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 128, 2, 39, 0, 3, -1, 2, 129, 2, 130, 2, 0, 0, 67045375, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, 2, 132, 2, 41, 0, 1046437, 0, 6, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 42, 2, 23, 2, 50, 2, 11, 2, 59, 2, 38, -5, 2, 0, 2, 12, -3, 3, 0, 2, 0, 2147484671, 2, 133, 0, 4190109695, 2, 52, -2, 2, 134, 0, 4244635647, 0, 27, 2, 0, 2, 8, 2, 43, 2, 0, 2, 66, 2, 17, 2, 0, 2, 42, -3, 2, 31, -2, 2, 0, 2, 45, 2, 57, 2, 44, 2, 45, 2, 135, 2, 46, 0, 8388351, -2, 2, 136, 0, 3028287487, 2, 47, 2, 138, 0, 33259519, 2, 23, 2, 7, 2, 48, -7, 2, 21, 0, 4294836223, 0, 3355443199, 0, 134152199, -2, 2, 67, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -81, 2, 17, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 2, 30, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 0, 2, 32, -54, 3, 0, 17, 2, 42, 2, 8, 2, 23, 2, 0, 2, 8, 2, 23, 2, 51, 2, 0, 2, 21, 2, 52, 2, 139, 2, 25, -13, 2, 0, 2, 53, -6, 3, 0, 2, -1, 2, 140, 2, 10, -1, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 8323099, 3, 0, 230, 2, 30, 2, 54, 2, 8, -3, 3, 0, 3, 2, 35, -271, 2, 141, 3, 0, 9, 2, 142, 2, 143, 2, 55, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 144, 0, 1677656575, -130, 2, 26, -16, 2, 0, 2, 24, 2, 38, -16, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 56, 2, 0, 2, 146, 2, 147, 2, 60, 2, 0, 2, 148, 2, 149, 2, 150, 3, 0, 10, 2, 151, 2, 152, 2, 22, 3, 56, 2, 3, 153, 2, 3, 57, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -34, 2, 8, 2, 155, -6, 0, 4194303871, 0, 4294903771, 2, 0, 2, 58, 2, 98, -3, 2, 0, 0, 1073684479, 0, 17407, -9, 2, 17, 2, 49, 2, 0, 2, 32, -14, 2, 17, 2, 32, -6, 2, 17, 2, 12, -6, 2, 8, 0, 3225419775, -7, 2, 156, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 59, -37, 2, 60, 2, 157, 2, 158, 2, 159, 2, 160, 2, 161, -105, 2, 26, -32, 3, 0, 1335, -1, 3, 0, 136, 2, 9, 3, 0, 180, 2, 24, 3, 0, 233, 2, 162, 3, 0, 18, 2, 9, -77, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 6, 3, 0, 264, 2, 32, -22116, 3, 0, 7, 2, 25, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 61, 2, 62, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 63, 2, 0, 2, 34, -1, 2, 17, 2, 64, -1, 2, 0, 0, 2047, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 25, 2, 65, 3, 0, 2, 0, 131135, 2, 96, 0, 70256639, 0, 71303167, 0, 272, 2, 42, 2, 6, 0, 65279, 2, 0, 2, 48, -1, 2, 97, 2, 66, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 68, 2, 67, 0, 33554435, 2, 131, 2, 68, 0, 2952790016, 0, 131075, 0, 3594373096, 0, 67094296, 2, 67, -1, 0, 4294828000, 0, 603979263, 0, 922746880, 0, 3, 0, 4294828001, 0, 602930687, 0, 1879048192, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 69, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 70, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 33, 2, 71, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 72, 2, 0, 2, 73, 2, 74, 2, 75, 2, 0, 2, 76, 2, 0, 2, 12, -1, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 77, 2, 5, 3, 0, 2, 2, 78, 0, 2147745791, 3, 19, 2, 0, 122879, 2, 0, 2, 10, 0, 276824064, -2, 3, 0, 2, 2, 42, 2, 0, 0, 4294903295, 2, 0, 2, 30, 2, 8, -1, 2, 17, 2, 51, 2, 0, 2, 79, 2, 48, -1, 2, 21, 2, 0, 2, 29, -2, 0, 128, -2, 2, 28, 2, 10, 0, 8160, -1, 2, 126, 0, 4227907585, 2, 0, 2, 37, 2, 0, 2, 50, 0, 4227915776, 2, 9, 2, 6, 2, 11, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 13, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 14, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 34, -83, 3, 0, 7, 0, 817183, 2, 0, 2, 15, 2, 0, 0, 33023, 2, 21, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 22, 2, 28, 2, 16, 3, 0, 2, 2, 49, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 692, 2, 71, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 25, 2, 92, 2, 93, 3, 0, 2, 2, 94, 2, 0, 2, 20, 2, 95, 0, 4294965179, 0, 7, 2, 0, 2, 10, 2, 93, 2, 10, -1, 0, 1761345536, 2, 96, 0, 4294901823, 2, 38, 2, 20, 2, 97, 2, 35, 2, 98, 0, 2080440287, 2, 0, 2, 34, 2, 154, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 99, 2, 100, 2, 22, 2, 23, 3, 0, 3, 0, 7, 3, 0, 349, 2, 101, 2, 102, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 2700607615, 2, 103, 2, 104, 3, 0, 2, 2, 19, 2, 105, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 46, 2, 0, 2, 31, 2, 106, -3, 2, 107, 3, 0, 3, 2, 20, -1, 3, 5, 2, 2, 108, 2, 0, 2, 8, 2, 109, -1, 2, 110, 2, 111, 2, 112, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -8, 2, 20, 2, 0, 2, 36, -1, 2, 0, 2, 65, 2, 6, 2, 30, 2, 9, 2, 0, 2, 113, -1, 3, 0, 4, 2, 9, 2, 17, 2, 114, 2, 7, 2, 0, 2, 115, 2, 0, 2, 116, 2, 117, 2, 118, 2, 0, 2, 10, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 119, 2, 120, -2, 2, 121, 2, 122, 2, 30, 2, 21, 2, 8, -2, 2, 123, 2, 30, 3, 32, 2, -1, 2, 0, 2, 39, -2, 0, 4277075969, 2, 30, -1, 3, 20, 2, -1, 2, 33, 2, 124, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 50, 2, 96, 0, 4294934591, 2, 37, -7, 2, 0, 0, 197631, 2, 125, -1, 2, 20, 2, 43, 2, 37, 2, 17, 0, 3, 2, 17, 2, 124, 2, 21, 2, 126, 2, 127, -1, 0, 2490368, 2, 126, 2, 25, 2, 17, 2, 34, 2, 126, 2, 38, 0, 4294901904, 0, 4718591, 2, 126, 2, 35, 0, 335544350, -1, 2, 128, 0, 2147487743, 0, 1, -1, 2, 129, 2, 130, 2, 8, -1, 2, 131, 2, 68, 0, 3758161920, 0, 3, 2, 132, 0, 12582911, 0, 655360, -1, 2, 0, 2, 29, 0, 2147485568, 0, 3, 2, 0, 2, 25, 0, 176, -5, 2, 0, 2, 49, 0, 251658240, -1, 2, 0, 2, 25, 0, 16, -1, 2, 0, 0, 16779263, -2, 2, 12, -1, 2, 38, -5, 2, 0, 2, 18, -3, 3, 0, 2, 2, 54, 2, 133, 0, 2147549183, 0, 2, -2, 2, 134, 2, 36, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, 2, 17, 2, 0, 2, 42, -6, 2, 0, 0, 1, 2, 57, 2, 49, 0, 1, 2, 135, 2, 25, -3, 2, 136, 2, 36, 2, 137, 2, 138, 0, 16778239, 2, 17, 2, 7, -8, 2, 35, 0, 4294836212, 2, 10, -3, 2, 67, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -81, 2, 17, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 0, 126, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 9, -55, 3, 0, 17, 2, 42, 2, 8, 2, 17, 2, 0, 2, 8, 2, 17, 2, 58, 2, 0, 2, 25, 2, 50, 2, 139, 2, 25, -13, 2, 0, 2, 71, -6, 3, 0, 2, -1, 2, 140, 2, 10, -1, 3, 0, 2, 0, 67583, -1, 2, 105, -2, 0, 8126475, 3, 0, 230, 2, 30, 2, 54, 2, 8, -3, 3, 0, 3, 2, 35, -271, 2, 141, 3, 0, 9, 2, 142, 2, 143, 2, 55, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 144, 2, 145, -187, 3, 0, 2, 2, 56, 2, 0, 2, 146, 2, 147, 2, 60, 2, 0, 2, 148, 2, 149, 2, 150, 3, 0, 10, 2, 151, 2, 152, 2, 22, 3, 56, 2, 3, 153, 2, 3, 57, 2, 2, 154, -57, 2, 8, 2, 155, -7, 2, 17, 2, 0, 2, 58, -4, 2, 0, 0, 1065361407, 0, 16384, -9, 2, 17, 2, 58, 2, 0, 2, 18, -14, 2, 17, 2, 18, -6, 2, 17, 0, 81919, -6, 2, 8, 0, 3223273399, -7, 2, 156, 3, 0, 6, 2, 124, -1, 3, 0, 2, 0, 2063, -37, 2, 60, 2, 157, 2, 158, 2, 159, 2, 160, 2, 161, -138, 3, 0, 1335, -1, 3, 0, 136, 2, 9, 3, 0, 180, 2, 24, 3, 0, 233, 2, 162, 3, 0, 18, 2, 9, -77, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 6, 3, 0, 264, 2, 32, -28252], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 4294903807, 268435455, 2147483647, 1073741823, 1048575, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4294901759, 4294901760, 4095, 262143, 536870911, 8388607, 4160749567, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967264, 2097151, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 63, 127, 3238002687, 4294549487, 4290772991, 33554431, 4294901888, 4286578687, 67043329, 4294770687, 67043583, 1023, 32767, 15, 2047999, 67043343, 67051519, 2147483648, 4294902000, 4292870143, 4294966783, 16383, 67047423, 4294967279, 262083, 20511, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 4294836224, 4294966272, 4294967280, 32768, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 4294967232, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4160684047, 4290246655, 469499899, 4294967231, 134086655, 4294966591, 2445279231, 3670015, 31, 252, 4294967288, 16777215, 4294705151, 3221208447, 4294902271, 4294549472, 4294921215, 4285526655, 4294966527, 4294705152, 4294966143, 64, 4294966719, 3774873592, 4194303999, 1877934080, 262151, 2555904, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4294934527, 4087, 2016, 2147446655, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901761]);
|
|
26
28
|
const isIDContinue = (code) => (unicodeLookup[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
|
|
27
29
|
const isIDStart = (code) => (unicodeLookup[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
|
|
28
30
|
|
|
29
|
-
function advanceChar(parser) {
|
|
30
|
-
parser.column++;
|
|
31
|
-
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
32
|
-
}
|
|
33
|
-
function consumePossibleSurrogatePair(parser) {
|
|
34
|
-
const hi = parser.currentChar;
|
|
35
|
-
if ((hi & 0xfc00) !== 55296)
|
|
36
|
-
return 0;
|
|
37
|
-
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
38
|
-
if ((lo & 0xfc00) !== 56320)
|
|
39
|
-
return 0;
|
|
40
|
-
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
41
|
-
}
|
|
42
|
-
function consumeLineFeed(parser, state) {
|
|
43
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
44
|
-
parser.flags |= 1;
|
|
45
|
-
if ((state & 4) === 0) {
|
|
46
|
-
parser.column = 0;
|
|
47
|
-
parser.line++;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function scanNewLine(parser) {
|
|
51
|
-
parser.flags |= 1;
|
|
52
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
53
|
-
parser.column = 0;
|
|
54
|
-
parser.line++;
|
|
55
|
-
}
|
|
56
|
-
function isExoticECMAScriptWhitespace(ch) {
|
|
57
|
-
return (ch === 160 ||
|
|
58
|
-
ch === 65279 ||
|
|
59
|
-
ch === 133 ||
|
|
60
|
-
ch === 5760 ||
|
|
61
|
-
(ch >= 8192 && ch <= 8203) ||
|
|
62
|
-
ch === 8239 ||
|
|
63
|
-
ch === 8287 ||
|
|
64
|
-
ch === 12288 ||
|
|
65
|
-
ch === 8201 ||
|
|
66
|
-
ch === 65519);
|
|
67
|
-
}
|
|
68
|
-
function toHex(code) {
|
|
69
|
-
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
70
|
-
}
|
|
71
|
-
function convertTokenType(t) {
|
|
72
|
-
switch (t) {
|
|
73
|
-
case 134283266:
|
|
74
|
-
return 'NumericLiteral';
|
|
75
|
-
case 134283267:
|
|
76
|
-
return 'StringLiteral';
|
|
77
|
-
case 86021:
|
|
78
|
-
case 86022:
|
|
79
|
-
return 'BooleanLiteral';
|
|
80
|
-
case 86023:
|
|
81
|
-
return 'NullLiteral';
|
|
82
|
-
case 65540:
|
|
83
|
-
return 'RegularExpression';
|
|
84
|
-
case 67174408:
|
|
85
|
-
case 67174409:
|
|
86
|
-
case 131:
|
|
87
|
-
return 'TemplateLiteral';
|
|
88
|
-
default:
|
|
89
|
-
if ((t & 143360) === 143360)
|
|
90
|
-
return 'Identifier';
|
|
91
|
-
if ((t & 4096) === 4096)
|
|
92
|
-
return 'Keyword';
|
|
93
|
-
return 'Punctuator';
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
31
|
const CharTypes = [
|
|
98
32
|
0,
|
|
99
33
|
0,
|
|
@@ -495,6 +429,74 @@ function isIdentifierPart(code) {
|
|
|
495
429
|
: isIDContinue(code) || (code === 8204 || code === 8205);
|
|
496
430
|
}
|
|
497
431
|
|
|
432
|
+
function advanceChar(parser) {
|
|
433
|
+
parser.column++;
|
|
434
|
+
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
435
|
+
}
|
|
436
|
+
function consumePossibleSurrogatePair(parser) {
|
|
437
|
+
const hi = parser.currentChar;
|
|
438
|
+
if ((hi & 0xfc00) !== 55296)
|
|
439
|
+
return 0;
|
|
440
|
+
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
441
|
+
if ((lo & 0xfc00) !== 56320)
|
|
442
|
+
return 0;
|
|
443
|
+
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
444
|
+
}
|
|
445
|
+
function consumeLineFeed(parser, state) {
|
|
446
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
447
|
+
parser.flags |= 1;
|
|
448
|
+
if ((state & 4) === 0) {
|
|
449
|
+
parser.column = 0;
|
|
450
|
+
parser.line++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function scanNewLine(parser) {
|
|
454
|
+
parser.flags |= 1;
|
|
455
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
456
|
+
parser.column = 0;
|
|
457
|
+
parser.line++;
|
|
458
|
+
}
|
|
459
|
+
function isExoticECMAScriptWhitespace(ch) {
|
|
460
|
+
return (ch === 160 ||
|
|
461
|
+
ch === 65279 ||
|
|
462
|
+
ch === 133 ||
|
|
463
|
+
ch === 5760 ||
|
|
464
|
+
(ch >= 8192 && ch <= 8203) ||
|
|
465
|
+
ch === 8239 ||
|
|
466
|
+
ch === 8287 ||
|
|
467
|
+
ch === 12288 ||
|
|
468
|
+
ch === 8201 ||
|
|
469
|
+
ch === 65519);
|
|
470
|
+
}
|
|
471
|
+
function toHex(code) {
|
|
472
|
+
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
473
|
+
}
|
|
474
|
+
function convertTokenType(t) {
|
|
475
|
+
switch (t) {
|
|
476
|
+
case 134283266:
|
|
477
|
+
return 'NumericLiteral';
|
|
478
|
+
case 134283267:
|
|
479
|
+
return 'StringLiteral';
|
|
480
|
+
case 86021:
|
|
481
|
+
case 86022:
|
|
482
|
+
return 'BooleanLiteral';
|
|
483
|
+
case 86023:
|
|
484
|
+
return 'NullLiteral';
|
|
485
|
+
case 65540:
|
|
486
|
+
return 'RegularExpression';
|
|
487
|
+
case 67174408:
|
|
488
|
+
case 67174409:
|
|
489
|
+
case 131:
|
|
490
|
+
return 'TemplateLiteral';
|
|
491
|
+
default:
|
|
492
|
+
if ((t & 143360) === 143360)
|
|
493
|
+
return 'Identifier';
|
|
494
|
+
if ((t & 4096) === 4096)
|
|
495
|
+
return 'Keyword';
|
|
496
|
+
return 'Punctuator';
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
498
500
|
const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment'];
|
|
499
501
|
function skipHashBang(parser) {
|
|
500
502
|
const { source } = parser;
|
|
@@ -606,424 +608,6 @@ function skipMultiLineComment(parser, source, state) {
|
|
|
606
608
|
parser.report(18);
|
|
607
609
|
}
|
|
608
610
|
|
|
609
|
-
var RegexState;
|
|
610
|
-
(function (RegexState) {
|
|
611
|
-
RegexState[RegexState["Empty"] = 0] = "Empty";
|
|
612
|
-
RegexState[RegexState["Escape"] = 1] = "Escape";
|
|
613
|
-
RegexState[RegexState["Class"] = 2] = "Class";
|
|
614
|
-
})(RegexState || (RegexState = {}));
|
|
615
|
-
var RegexFlags;
|
|
616
|
-
(function (RegexFlags) {
|
|
617
|
-
RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
|
|
618
|
-
RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
|
|
619
|
-
RegexFlags[RegexFlags["Global"] = 2] = "Global";
|
|
620
|
-
RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
|
|
621
|
-
RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
|
|
622
|
-
RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
|
|
623
|
-
RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
|
|
624
|
-
RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
|
|
625
|
-
RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
|
|
626
|
-
})(RegexFlags || (RegexFlags = {}));
|
|
627
|
-
function scanRegularExpression(parser) {
|
|
628
|
-
const bodyStart = parser.index;
|
|
629
|
-
let preparseState = RegexState.Empty;
|
|
630
|
-
loop: while (true) {
|
|
631
|
-
const ch = parser.currentChar;
|
|
632
|
-
advanceChar(parser);
|
|
633
|
-
if (preparseState & RegexState.Escape) {
|
|
634
|
-
preparseState &= ~RegexState.Escape;
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
switch (ch) {
|
|
638
|
-
case 47:
|
|
639
|
-
if (!preparseState)
|
|
640
|
-
break loop;
|
|
641
|
-
else
|
|
642
|
-
break;
|
|
643
|
-
case 92:
|
|
644
|
-
preparseState |= RegexState.Escape;
|
|
645
|
-
break;
|
|
646
|
-
case 91:
|
|
647
|
-
preparseState |= RegexState.Class;
|
|
648
|
-
break;
|
|
649
|
-
case 93:
|
|
650
|
-
preparseState &= RegexState.Escape;
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (ch === 13 ||
|
|
655
|
-
ch === 10 ||
|
|
656
|
-
ch === 8232 ||
|
|
657
|
-
ch === 8233) {
|
|
658
|
-
parser.report(34);
|
|
659
|
-
}
|
|
660
|
-
if (parser.index >= parser.source.length) {
|
|
661
|
-
return parser.report(34);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
const bodyEnd = parser.index - 1;
|
|
665
|
-
let mask = RegexFlags.Empty;
|
|
666
|
-
let char = parser.currentChar;
|
|
667
|
-
const { index: flagStart } = parser;
|
|
668
|
-
while (isIdentifierPart(char)) {
|
|
669
|
-
switch (char) {
|
|
670
|
-
case 103:
|
|
671
|
-
if (mask & RegexFlags.Global)
|
|
672
|
-
parser.report(36, 'g');
|
|
673
|
-
mask |= RegexFlags.Global;
|
|
674
|
-
break;
|
|
675
|
-
case 105:
|
|
676
|
-
if (mask & RegexFlags.IgnoreCase)
|
|
677
|
-
parser.report(36, 'i');
|
|
678
|
-
mask |= RegexFlags.IgnoreCase;
|
|
679
|
-
break;
|
|
680
|
-
case 109:
|
|
681
|
-
if (mask & RegexFlags.Multiline)
|
|
682
|
-
parser.report(36, 'm');
|
|
683
|
-
mask |= RegexFlags.Multiline;
|
|
684
|
-
break;
|
|
685
|
-
case 117:
|
|
686
|
-
if (mask & RegexFlags.Unicode)
|
|
687
|
-
parser.report(36, 'u');
|
|
688
|
-
if (mask & RegexFlags.UnicodeSets)
|
|
689
|
-
parser.report(36, 'vu');
|
|
690
|
-
mask |= RegexFlags.Unicode;
|
|
691
|
-
break;
|
|
692
|
-
case 118:
|
|
693
|
-
if (mask & RegexFlags.Unicode)
|
|
694
|
-
parser.report(36, 'uv');
|
|
695
|
-
if (mask & RegexFlags.UnicodeSets)
|
|
696
|
-
parser.report(36, 'v');
|
|
697
|
-
mask |= RegexFlags.UnicodeSets;
|
|
698
|
-
break;
|
|
699
|
-
case 121:
|
|
700
|
-
if (mask & RegexFlags.Sticky)
|
|
701
|
-
parser.report(36, 'y');
|
|
702
|
-
mask |= RegexFlags.Sticky;
|
|
703
|
-
break;
|
|
704
|
-
case 115:
|
|
705
|
-
if (mask & RegexFlags.DotAll)
|
|
706
|
-
parser.report(36, 's');
|
|
707
|
-
mask |= RegexFlags.DotAll;
|
|
708
|
-
break;
|
|
709
|
-
case 100:
|
|
710
|
-
if (mask & RegexFlags.Indices)
|
|
711
|
-
parser.report(36, 'd');
|
|
712
|
-
mask |= RegexFlags.Indices;
|
|
713
|
-
break;
|
|
714
|
-
default:
|
|
715
|
-
parser.report(35);
|
|
716
|
-
}
|
|
717
|
-
char = advanceChar(parser);
|
|
718
|
-
}
|
|
719
|
-
const flags = parser.source.slice(flagStart, parser.index);
|
|
720
|
-
const pattern = parser.source.slice(bodyStart, bodyEnd);
|
|
721
|
-
parser.tokenRegExp = { pattern, flags };
|
|
722
|
-
if (parser.options.raw)
|
|
723
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
724
|
-
parser.tokenValue = validate(parser, pattern, flags);
|
|
725
|
-
return 65540;
|
|
726
|
-
}
|
|
727
|
-
function validate(parser, pattern, flags) {
|
|
728
|
-
try {
|
|
729
|
-
return new RegExp(pattern, flags);
|
|
730
|
-
}
|
|
731
|
-
catch {
|
|
732
|
-
try {
|
|
733
|
-
new RegExp(pattern, flags);
|
|
734
|
-
return null;
|
|
735
|
-
}
|
|
736
|
-
catch {
|
|
737
|
-
parser.report(34);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
function scanString(parser, context, quote) {
|
|
743
|
-
const { index: start } = parser;
|
|
744
|
-
let ret = '';
|
|
745
|
-
let char = advanceChar(parser);
|
|
746
|
-
let marker = parser.index;
|
|
747
|
-
while ((CharTypes[char] & 8) === 0) {
|
|
748
|
-
if (char === quote) {
|
|
749
|
-
ret += parser.source.slice(marker, parser.index);
|
|
750
|
-
advanceChar(parser);
|
|
751
|
-
if (parser.options.raw)
|
|
752
|
-
parser.tokenRaw = parser.source.slice(start, parser.index);
|
|
753
|
-
parser.tokenValue = ret;
|
|
754
|
-
return 134283267;
|
|
755
|
-
}
|
|
756
|
-
if ((char & 8) === 8 && char === 92) {
|
|
757
|
-
ret += parser.source.slice(marker, parser.index);
|
|
758
|
-
char = advanceChar(parser);
|
|
759
|
-
if (char < 0x7f || char === 8232 || char === 8233) {
|
|
760
|
-
const code = parseEscape(parser, context, char);
|
|
761
|
-
if (code >= 0)
|
|
762
|
-
ret += String.fromCodePoint(code);
|
|
763
|
-
else
|
|
764
|
-
handleStringError(parser, code, 0);
|
|
765
|
-
}
|
|
766
|
-
else {
|
|
767
|
-
ret += String.fromCodePoint(char);
|
|
768
|
-
}
|
|
769
|
-
marker = parser.index + 1;
|
|
770
|
-
}
|
|
771
|
-
else if (char === 8232 || char === 8233) {
|
|
772
|
-
parser.column = -1;
|
|
773
|
-
parser.line++;
|
|
774
|
-
}
|
|
775
|
-
if (parser.index >= parser.end)
|
|
776
|
-
parser.report(16);
|
|
777
|
-
char = advanceChar(parser);
|
|
778
|
-
}
|
|
779
|
-
parser.report(16);
|
|
780
|
-
}
|
|
781
|
-
function parseEscape(parser, context, first, isTemplate = 0) {
|
|
782
|
-
switch (first) {
|
|
783
|
-
case 98:
|
|
784
|
-
return 8;
|
|
785
|
-
case 102:
|
|
786
|
-
return 12;
|
|
787
|
-
case 114:
|
|
788
|
-
return 13;
|
|
789
|
-
case 110:
|
|
790
|
-
return 10;
|
|
791
|
-
case 116:
|
|
792
|
-
return 9;
|
|
793
|
-
case 118:
|
|
794
|
-
return 11;
|
|
795
|
-
case 13: {
|
|
796
|
-
if (parser.index < parser.end) {
|
|
797
|
-
const nextChar = parser.source.charCodeAt(parser.index + 1);
|
|
798
|
-
if (nextChar === 10) {
|
|
799
|
-
parser.index = parser.index + 1;
|
|
800
|
-
parser.currentChar = nextChar;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
case 10:
|
|
805
|
-
case 8232:
|
|
806
|
-
case 8233:
|
|
807
|
-
parser.column = -1;
|
|
808
|
-
parser.line++;
|
|
809
|
-
return -1;
|
|
810
|
-
case 48:
|
|
811
|
-
case 49:
|
|
812
|
-
case 50:
|
|
813
|
-
case 51: {
|
|
814
|
-
let code = first - 48;
|
|
815
|
-
let index = parser.index + 1;
|
|
816
|
-
let column = parser.column + 1;
|
|
817
|
-
if (index < parser.end) {
|
|
818
|
-
const next = parser.source.charCodeAt(index);
|
|
819
|
-
if ((CharTypes[next] & 32) === 0) {
|
|
820
|
-
if (code !== 0 || CharTypes[next] & 512) {
|
|
821
|
-
if (context & 1 || isTemplate)
|
|
822
|
-
return -2;
|
|
823
|
-
parser.flags |= 64;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
else if (context & 1 || isTemplate) {
|
|
827
|
-
return -2;
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
parser.currentChar = next;
|
|
831
|
-
code = (code << 3) | (next - 48);
|
|
832
|
-
index++;
|
|
833
|
-
column++;
|
|
834
|
-
if (index < parser.end) {
|
|
835
|
-
const next = parser.source.charCodeAt(index);
|
|
836
|
-
if (CharTypes[next] & 32) {
|
|
837
|
-
parser.currentChar = next;
|
|
838
|
-
code = (code << 3) | (next - 48);
|
|
839
|
-
index++;
|
|
840
|
-
column++;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
parser.flags |= 64;
|
|
844
|
-
}
|
|
845
|
-
parser.index = index - 1;
|
|
846
|
-
parser.column = column - 1;
|
|
847
|
-
}
|
|
848
|
-
return code;
|
|
849
|
-
}
|
|
850
|
-
case 52:
|
|
851
|
-
case 53:
|
|
852
|
-
case 54:
|
|
853
|
-
case 55: {
|
|
854
|
-
if (isTemplate || context & 1)
|
|
855
|
-
return -2;
|
|
856
|
-
let code = first - 48;
|
|
857
|
-
const index = parser.index + 1;
|
|
858
|
-
const column = parser.column + 1;
|
|
859
|
-
if (index < parser.end) {
|
|
860
|
-
const next = parser.source.charCodeAt(index);
|
|
861
|
-
if (CharTypes[next] & 32) {
|
|
862
|
-
code = (code << 3) | (next - 48);
|
|
863
|
-
parser.currentChar = next;
|
|
864
|
-
parser.index = index;
|
|
865
|
-
parser.column = column;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
parser.flags |= 64;
|
|
869
|
-
return code;
|
|
870
|
-
}
|
|
871
|
-
case 120: {
|
|
872
|
-
const ch1 = advanceChar(parser);
|
|
873
|
-
if ((CharTypes[ch1] & 64) === 0)
|
|
874
|
-
return -4;
|
|
875
|
-
const hi = toHex(ch1);
|
|
876
|
-
const ch2 = advanceChar(parser);
|
|
877
|
-
if ((CharTypes[ch2] & 64) === 0)
|
|
878
|
-
return -4;
|
|
879
|
-
const lo = toHex(ch2);
|
|
880
|
-
return (hi << 4) | lo;
|
|
881
|
-
}
|
|
882
|
-
case 117: {
|
|
883
|
-
const ch = advanceChar(parser);
|
|
884
|
-
if (parser.currentChar === 123) {
|
|
885
|
-
let code = 0;
|
|
886
|
-
while ((CharTypes[advanceChar(parser)] & 64) !== 0) {
|
|
887
|
-
code = (code << 4) | toHex(parser.currentChar);
|
|
888
|
-
if (code > 1114111)
|
|
889
|
-
return -5;
|
|
890
|
-
}
|
|
891
|
-
if (parser.currentChar < 1 || parser.currentChar !== 125) {
|
|
892
|
-
return -4;
|
|
893
|
-
}
|
|
894
|
-
return code;
|
|
895
|
-
}
|
|
896
|
-
else {
|
|
897
|
-
if ((CharTypes[ch] & 64) === 0)
|
|
898
|
-
return -4;
|
|
899
|
-
const ch2 = parser.source.charCodeAt(parser.index + 1);
|
|
900
|
-
if ((CharTypes[ch2] & 64) === 0)
|
|
901
|
-
return -4;
|
|
902
|
-
const ch3 = parser.source.charCodeAt(parser.index + 2);
|
|
903
|
-
if ((CharTypes[ch3] & 64) === 0)
|
|
904
|
-
return -4;
|
|
905
|
-
const ch4 = parser.source.charCodeAt(parser.index + 3);
|
|
906
|
-
if ((CharTypes[ch4] & 64) === 0)
|
|
907
|
-
return -4;
|
|
908
|
-
parser.index += 3;
|
|
909
|
-
parser.column += 3;
|
|
910
|
-
parser.currentChar = parser.source.charCodeAt(parser.index);
|
|
911
|
-
return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
case 56:
|
|
915
|
-
case 57:
|
|
916
|
-
if (isTemplate || !parser.options.webcompat || context & 1)
|
|
917
|
-
return -3;
|
|
918
|
-
parser.flags |= 4096;
|
|
919
|
-
default:
|
|
920
|
-
return first;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
function handleStringError(parser, code, isTemplate) {
|
|
924
|
-
switch (code) {
|
|
925
|
-
case -1:
|
|
926
|
-
return;
|
|
927
|
-
case -2:
|
|
928
|
-
parser.report(isTemplate ? 2 : 1);
|
|
929
|
-
case -3:
|
|
930
|
-
parser.report(isTemplate ? 3 : 14);
|
|
931
|
-
case -4:
|
|
932
|
-
parser.report(7);
|
|
933
|
-
case -5:
|
|
934
|
-
parser.report(104);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
function scanTemplate(parser, context) {
|
|
939
|
-
const { index: start } = parser;
|
|
940
|
-
let token = 67174409;
|
|
941
|
-
let ret = '';
|
|
942
|
-
let char = advanceChar(parser);
|
|
943
|
-
while (char !== 96) {
|
|
944
|
-
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
945
|
-
advanceChar(parser);
|
|
946
|
-
token = 67174408;
|
|
947
|
-
break;
|
|
948
|
-
}
|
|
949
|
-
else if (char === 92) {
|
|
950
|
-
char = advanceChar(parser);
|
|
951
|
-
if (char > 0x7e) {
|
|
952
|
-
ret += String.fromCodePoint(char);
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
const { index, line, column } = parser;
|
|
956
|
-
const code = parseEscape(parser, context | 1, char, 1);
|
|
957
|
-
if (code >= 0) {
|
|
958
|
-
ret += String.fromCodePoint(code);
|
|
959
|
-
}
|
|
960
|
-
else if (code !== -1 && context & 64) {
|
|
961
|
-
parser.index = index;
|
|
962
|
-
parser.line = line;
|
|
963
|
-
parser.column = column;
|
|
964
|
-
ret = null;
|
|
965
|
-
char = scanBadTemplate(parser, char);
|
|
966
|
-
if (char < 0)
|
|
967
|
-
token = 67174408;
|
|
968
|
-
break;
|
|
969
|
-
}
|
|
970
|
-
else {
|
|
971
|
-
handleStringError(parser, code, 1);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
else if (parser.index < parser.end) {
|
|
976
|
-
if (char === 13 && parser.source.charCodeAt(parser.index) === 10) {
|
|
977
|
-
ret += String.fromCodePoint(char);
|
|
978
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
979
|
-
}
|
|
980
|
-
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
981
|
-
parser.column = -1;
|
|
982
|
-
parser.line++;
|
|
983
|
-
}
|
|
984
|
-
ret += String.fromCodePoint(char);
|
|
985
|
-
}
|
|
986
|
-
if (parser.index >= parser.end)
|
|
987
|
-
parser.report(17);
|
|
988
|
-
char = advanceChar(parser);
|
|
989
|
-
}
|
|
990
|
-
advanceChar(parser);
|
|
991
|
-
parser.tokenValue = ret;
|
|
992
|
-
parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
993
|
-
return token;
|
|
994
|
-
}
|
|
995
|
-
function scanBadTemplate(parser, ch) {
|
|
996
|
-
while (ch !== 96) {
|
|
997
|
-
switch (ch) {
|
|
998
|
-
case 36: {
|
|
999
|
-
const index = parser.index + 1;
|
|
1000
|
-
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
1001
|
-
parser.index = index;
|
|
1002
|
-
parser.column++;
|
|
1003
|
-
return -ch;
|
|
1004
|
-
}
|
|
1005
|
-
break;
|
|
1006
|
-
}
|
|
1007
|
-
case 10:
|
|
1008
|
-
case 8232:
|
|
1009
|
-
case 8233:
|
|
1010
|
-
parser.column = -1;
|
|
1011
|
-
parser.line++;
|
|
1012
|
-
}
|
|
1013
|
-
if (parser.index >= parser.end)
|
|
1014
|
-
parser.report(17);
|
|
1015
|
-
ch = advanceChar(parser);
|
|
1016
|
-
}
|
|
1017
|
-
return ch;
|
|
1018
|
-
}
|
|
1019
|
-
function scanTemplateTail(parser, context) {
|
|
1020
|
-
if (parser.index >= parser.end)
|
|
1021
|
-
parser.report(0);
|
|
1022
|
-
parser.index--;
|
|
1023
|
-
parser.column--;
|
|
1024
|
-
return scanTemplate(parser, context);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
611
|
const errorMessages = {
|
|
1028
612
|
[0]: 'Unexpected token',
|
|
1029
613
|
[30]: "Unexpected token: '%0'",
|
|
@@ -1195,7 +779,7 @@ const errorMessages = {
|
|
|
1195
779
|
[168]: 'Invalid optional chain from new expression',
|
|
1196
780
|
[169]: 'Cannot use "import.meta" outside a module',
|
|
1197
781
|
[170]: 'Leading decorators must be attached to a class declaration',
|
|
1198
|
-
[171]: 'An export name cannot include a lone surrogate
|
|
782
|
+
[171]: 'An export name cannot include a lone surrogate',
|
|
1199
783
|
[172]: 'A string literal cannot be used as an exported binding without `from`',
|
|
1200
784
|
[173]: "Private fields can't be accessed on super",
|
|
1201
785
|
[174]: "The only valid meta property for import is 'import.meta'",
|
|
@@ -1224,6 +808,243 @@ class ParseError extends SyntaxError {
|
|
|
1224
808
|
}
|
|
1225
809
|
}
|
|
1226
810
|
|
|
811
|
+
function getOwnProperty(object, key) {
|
|
812
|
+
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const KeywordDescTable = [
|
|
816
|
+
'end of source',
|
|
817
|
+
'identifier', 'number', 'string', 'regular expression',
|
|
818
|
+
'false', 'true', 'null',
|
|
819
|
+
'template continuation', 'template tail',
|
|
820
|
+
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
821
|
+
'++', '--',
|
|
822
|
+
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
823
|
+
'&=', '||=', '&&=', '??=',
|
|
824
|
+
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
825
|
+
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
826
|
+
'var', 'let', 'const',
|
|
827
|
+
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
828
|
+
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
829
|
+
'this', 'throw', 'try', 'while', 'with',
|
|
830
|
+
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
831
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
832
|
+
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
833
|
+
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
834
|
+
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
835
|
+
];
|
|
836
|
+
const descKeywordTable = {
|
|
837
|
+
this: 86111,
|
|
838
|
+
function: 86104,
|
|
839
|
+
if: 20569,
|
|
840
|
+
return: 20572,
|
|
841
|
+
var: 86088,
|
|
842
|
+
else: 20563,
|
|
843
|
+
for: 20567,
|
|
844
|
+
new: 86107,
|
|
845
|
+
in: 8673330,
|
|
846
|
+
typeof: 16863275,
|
|
847
|
+
while: 20578,
|
|
848
|
+
case: 20556,
|
|
849
|
+
break: 20555,
|
|
850
|
+
try: 20577,
|
|
851
|
+
catch: 20557,
|
|
852
|
+
delete: 16863276,
|
|
853
|
+
throw: 86112,
|
|
854
|
+
switch: 86110,
|
|
855
|
+
continue: 20559,
|
|
856
|
+
default: 20561,
|
|
857
|
+
instanceof: 8411187,
|
|
858
|
+
do: 20562,
|
|
859
|
+
void: 16863277,
|
|
860
|
+
finally: 20566,
|
|
861
|
+
async: 209005,
|
|
862
|
+
await: 209006,
|
|
863
|
+
class: 86094,
|
|
864
|
+
const: 86090,
|
|
865
|
+
constructor: 12399,
|
|
866
|
+
debugger: 20560,
|
|
867
|
+
export: 20564,
|
|
868
|
+
extends: 20565,
|
|
869
|
+
false: 86021,
|
|
870
|
+
from: 209011,
|
|
871
|
+
get: 209008,
|
|
872
|
+
implements: 36964,
|
|
873
|
+
import: 86106,
|
|
874
|
+
interface: 36965,
|
|
875
|
+
let: 241737,
|
|
876
|
+
null: 86023,
|
|
877
|
+
of: 471156,
|
|
878
|
+
package: 36966,
|
|
879
|
+
private: 36967,
|
|
880
|
+
protected: 36968,
|
|
881
|
+
public: 36969,
|
|
882
|
+
set: 209009,
|
|
883
|
+
static: 36970,
|
|
884
|
+
super: 86109,
|
|
885
|
+
true: 86022,
|
|
886
|
+
with: 20579,
|
|
887
|
+
yield: 241771,
|
|
888
|
+
enum: 86133,
|
|
889
|
+
eval: 537079926,
|
|
890
|
+
as: 77932,
|
|
891
|
+
arguments: 537079927,
|
|
892
|
+
target: 209029,
|
|
893
|
+
meta: 209030,
|
|
894
|
+
accessor: 12402,
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
898
|
+
while (isIdPart[advanceChar(parser)])
|
|
899
|
+
;
|
|
900
|
+
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
901
|
+
return parser.currentChar !== 92 && parser.currentChar <= 0x7e
|
|
902
|
+
? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
|
|
903
|
+
: scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
904
|
+
}
|
|
905
|
+
function scanUnicodeIdentifier(parser, context) {
|
|
906
|
+
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
907
|
+
if (!isIdentifierStart(cookedChar))
|
|
908
|
+
parser.report(5);
|
|
909
|
+
parser.tokenValue = String.fromCodePoint(cookedChar);
|
|
910
|
+
return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
|
|
911
|
+
}
|
|
912
|
+
function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
913
|
+
let start = parser.index;
|
|
914
|
+
while (parser.index < parser.end) {
|
|
915
|
+
if (parser.currentChar === 92) {
|
|
916
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
917
|
+
hasEscape = 1;
|
|
918
|
+
const code = scanIdentifierUnicodeEscape(parser);
|
|
919
|
+
if (!isIdentifierPart(code))
|
|
920
|
+
parser.report(5);
|
|
921
|
+
isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
|
|
922
|
+
parser.tokenValue += String.fromCodePoint(code);
|
|
923
|
+
start = parser.index;
|
|
924
|
+
}
|
|
925
|
+
else {
|
|
926
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
927
|
+
if (merged > 0) {
|
|
928
|
+
if (!isIdentifierPart(merged)) {
|
|
929
|
+
parser.report(20, String.fromCodePoint(merged));
|
|
930
|
+
}
|
|
931
|
+
parser.currentChar = merged;
|
|
932
|
+
parser.index++;
|
|
933
|
+
parser.column++;
|
|
934
|
+
}
|
|
935
|
+
else if (!isIdentifierPart(parser.currentChar)) {
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
advanceChar(parser);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
if (parser.index <= parser.end) {
|
|
942
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
943
|
+
}
|
|
944
|
+
const { length } = parser.tokenValue;
|
|
945
|
+
if (isValidAsKeyword && length >= 2 && length <= 11) {
|
|
946
|
+
const token = getOwnProperty(descKeywordTable, parser.tokenValue);
|
|
947
|
+
if (token === void 0)
|
|
948
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
949
|
+
if (!hasEscape)
|
|
950
|
+
return token;
|
|
951
|
+
if (token === 209006) {
|
|
952
|
+
if ((context & (2 | 2048)) === 0) {
|
|
953
|
+
return token | -2147483648;
|
|
954
|
+
}
|
|
955
|
+
return -2147483528;
|
|
956
|
+
}
|
|
957
|
+
if (context & 1) {
|
|
958
|
+
if (token === 36970) {
|
|
959
|
+
return -2147483527;
|
|
960
|
+
}
|
|
961
|
+
if ((token & 36864) === 36864) {
|
|
962
|
+
return -2147483527;
|
|
963
|
+
}
|
|
964
|
+
if ((token & 20480) === 20480) {
|
|
965
|
+
if (context & 262144 && (context & 8) === 0) {
|
|
966
|
+
return token | -2147483648;
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
return -2147483528;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return 209018 | -2147483648;
|
|
973
|
+
}
|
|
974
|
+
if (context & 262144 &&
|
|
975
|
+
(context & 8) === 0 &&
|
|
976
|
+
(token & 20480) === 20480) {
|
|
977
|
+
return token | -2147483648;
|
|
978
|
+
}
|
|
979
|
+
if (token === 241771) {
|
|
980
|
+
return context & 262144
|
|
981
|
+
? 209018 | -2147483648
|
|
982
|
+
: context & 1024
|
|
983
|
+
? -2147483528
|
|
984
|
+
: token | -2147483648;
|
|
985
|
+
}
|
|
986
|
+
if (token === 209005) {
|
|
987
|
+
return 209018 | -2147483648;
|
|
988
|
+
}
|
|
989
|
+
if ((token & 36864) === 36864) {
|
|
990
|
+
return token | 12288 | -2147483648;
|
|
991
|
+
}
|
|
992
|
+
return -2147483528;
|
|
993
|
+
}
|
|
994
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
995
|
+
}
|
|
996
|
+
function scanPrivateIdentifier(parser) {
|
|
997
|
+
let char = advanceChar(parser);
|
|
998
|
+
if (char === 92)
|
|
999
|
+
return 130;
|
|
1000
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
1001
|
+
if (merged)
|
|
1002
|
+
char = merged;
|
|
1003
|
+
if (!isIdentifierStart(char))
|
|
1004
|
+
parser.report(96);
|
|
1005
|
+
return 130;
|
|
1006
|
+
}
|
|
1007
|
+
function scanIdentifierUnicodeEscape(parser) {
|
|
1008
|
+
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1009
|
+
parser.report(5);
|
|
1010
|
+
}
|
|
1011
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1012
|
+
parser.column += 2;
|
|
1013
|
+
return scanUnicodeEscape(parser);
|
|
1014
|
+
}
|
|
1015
|
+
function scanUnicodeEscape(parser) {
|
|
1016
|
+
let codePoint = 0;
|
|
1017
|
+
const char = parser.currentChar;
|
|
1018
|
+
if (char === 123) {
|
|
1019
|
+
const begin = parser.index - 2;
|
|
1020
|
+
while (CharTypes[advanceChar(parser)] & 64) {
|
|
1021
|
+
codePoint = (codePoint << 4) | toHex(parser.currentChar);
|
|
1022
|
+
if (codePoint > 1114111)
|
|
1023
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
|
|
1024
|
+
}
|
|
1025
|
+
if (parser.currentChar !== 125) {
|
|
1026
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
|
|
1027
|
+
}
|
|
1028
|
+
advanceChar(parser);
|
|
1029
|
+
return codePoint;
|
|
1030
|
+
}
|
|
1031
|
+
if ((CharTypes[char] & 64) === 0)
|
|
1032
|
+
parser.report(7);
|
|
1033
|
+
const char2 = parser.source.charCodeAt(parser.index + 1);
|
|
1034
|
+
if ((CharTypes[char2] & 64) === 0)
|
|
1035
|
+
parser.report(7);
|
|
1036
|
+
const char3 = parser.source.charCodeAt(parser.index + 2);
|
|
1037
|
+
if ((CharTypes[char3] & 64) === 0)
|
|
1038
|
+
parser.report(7);
|
|
1039
|
+
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
1040
|
+
if ((CharTypes[char4] & 64) === 0)
|
|
1041
|
+
parser.report(7);
|
|
1042
|
+
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1043
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1044
|
+
parser.column += 4;
|
|
1045
|
+
return codePoint;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1227
1048
|
function scanNumber(parser, context, kind) {
|
|
1228
1049
|
let char = parser.currentChar;
|
|
1229
1050
|
let value = 0;
|
|
@@ -1359,487 +1180,484 @@ function scanNumber(parser, context, kind) {
|
|
|
1359
1180
|
parser.report(0);
|
|
1360
1181
|
kind = 64;
|
|
1361
1182
|
value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar);
|
|
1362
|
-
char = parser.currentChar;
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
const end = parser.index;
|
|
1367
|
-
let isBigInt = 0;
|
|
1368
|
-
if (char === 110 && kind & 128) {
|
|
1369
|
-
isBigInt = 1;
|
|
1370
|
-
char = advanceChar(parser);
|
|
1371
|
-
}
|
|
1372
|
-
else {
|
|
1373
|
-
if ((char | 32) === 101) {
|
|
1374
|
-
char = advanceChar(parser);
|
|
1375
|
-
if (CharTypes[char] & 256)
|
|
1376
|
-
char = advanceChar(parser);
|
|
1377
|
-
const { index } = parser;
|
|
1378
|
-
if ((CharTypes[char] & 16) === 0)
|
|
1379
|
-
parser.report(11);
|
|
1380
|
-
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1381
|
-
char = parser.currentChar;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) {
|
|
1385
|
-
parser.report(13);
|
|
1386
|
-
}
|
|
1387
|
-
if (isBigInt) {
|
|
1388
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1389
|
-
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1390
|
-
return 134283388;
|
|
1391
|
-
}
|
|
1392
|
-
parser.tokenValue =
|
|
1393
|
-
kind & (1 | 2 | 8 | 4)
|
|
1394
|
-
? value
|
|
1395
|
-
: kind & 32
|
|
1396
|
-
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1397
|
-
: +value;
|
|
1398
|
-
if (parser.options.raw)
|
|
1399
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1400
|
-
return 134283266;
|
|
1401
|
-
}
|
|
1402
|
-
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1403
|
-
let allowSeparator = 0;
|
|
1404
|
-
let start = parser.index;
|
|
1405
|
-
let ret = '';
|
|
1406
|
-
while (CharTypes[char] & (16 | 4096)) {
|
|
1407
|
-
if (char === 95) {
|
|
1408
|
-
const { index } = parser;
|
|
1409
|
-
char = advanceChar(parser);
|
|
1410
|
-
if (char === 95) {
|
|
1411
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1412
|
-
}
|
|
1413
|
-
allowSeparator = 1;
|
|
1414
|
-
ret += parser.source.substring(start, index);
|
|
1415
|
-
start = parser.index;
|
|
1416
|
-
continue;
|
|
1417
|
-
}
|
|
1418
|
-
allowSeparator = 0;
|
|
1419
|
-
char = advanceChar(parser);
|
|
1420
|
-
}
|
|
1421
|
-
if (allowSeparator) {
|
|
1422
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1423
|
-
}
|
|
1424
|
-
return ret + parser.source.substring(start, parser.index);
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
const KeywordDescTable = [
|
|
1428
|
-
'end of source',
|
|
1429
|
-
'identifier', 'number', 'string', 'regular expression',
|
|
1430
|
-
'false', 'true', 'null',
|
|
1431
|
-
'template continuation', 'template tail',
|
|
1432
|
-
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
1433
|
-
'++', '--',
|
|
1434
|
-
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
1435
|
-
'&=', '||=', '&&=', '??=',
|
|
1436
|
-
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
1437
|
-
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
1438
|
-
'var', 'let', 'const',
|
|
1439
|
-
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
1440
|
-
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
1441
|
-
'this', 'throw', 'try', 'while', 'with',
|
|
1442
|
-
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
1443
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
1444
|
-
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
1445
|
-
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
1446
|
-
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
1447
|
-
];
|
|
1448
|
-
const descKeywordTable = {
|
|
1449
|
-
this: 86111,
|
|
1450
|
-
function: 86104,
|
|
1451
|
-
if: 20569,
|
|
1452
|
-
return: 20572,
|
|
1453
|
-
var: 86088,
|
|
1454
|
-
else: 20563,
|
|
1455
|
-
for: 20567,
|
|
1456
|
-
new: 86107,
|
|
1457
|
-
in: 8673330,
|
|
1458
|
-
typeof: 16863275,
|
|
1459
|
-
while: 20578,
|
|
1460
|
-
case: 20556,
|
|
1461
|
-
break: 20555,
|
|
1462
|
-
try: 20577,
|
|
1463
|
-
catch: 20557,
|
|
1464
|
-
delete: 16863276,
|
|
1465
|
-
throw: 86112,
|
|
1466
|
-
switch: 86110,
|
|
1467
|
-
continue: 20559,
|
|
1468
|
-
default: 20561,
|
|
1469
|
-
instanceof: 8411187,
|
|
1470
|
-
do: 20562,
|
|
1471
|
-
void: 16863277,
|
|
1472
|
-
finally: 20566,
|
|
1473
|
-
async: 209005,
|
|
1474
|
-
await: 209006,
|
|
1475
|
-
class: 86094,
|
|
1476
|
-
const: 86090,
|
|
1477
|
-
constructor: 12399,
|
|
1478
|
-
debugger: 20560,
|
|
1479
|
-
export: 20564,
|
|
1480
|
-
extends: 20565,
|
|
1481
|
-
false: 86021,
|
|
1482
|
-
from: 209011,
|
|
1483
|
-
get: 209008,
|
|
1484
|
-
implements: 36964,
|
|
1485
|
-
import: 86106,
|
|
1486
|
-
interface: 36965,
|
|
1487
|
-
let: 241737,
|
|
1488
|
-
null: 86023,
|
|
1489
|
-
of: 471156,
|
|
1490
|
-
package: 36966,
|
|
1491
|
-
private: 36967,
|
|
1492
|
-
protected: 36968,
|
|
1493
|
-
public: 36969,
|
|
1494
|
-
set: 209009,
|
|
1495
|
-
static: 36970,
|
|
1496
|
-
super: 86109,
|
|
1497
|
-
true: 86022,
|
|
1498
|
-
with: 20579,
|
|
1499
|
-
yield: 241771,
|
|
1500
|
-
enum: 86133,
|
|
1501
|
-
eval: 537079926,
|
|
1502
|
-
as: 77932,
|
|
1503
|
-
arguments: 537079927,
|
|
1504
|
-
target: 209029,
|
|
1505
|
-
meta: 209030,
|
|
1506
|
-
accessor: 12402,
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
|
-
function matchOrInsertSemicolon(parser, context) {
|
|
1510
|
-
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
1511
|
-
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
1512
|
-
}
|
|
1513
|
-
if (!consumeOpt(parser, context, 1074790417)) {
|
|
1514
|
-
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
1518
|
-
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
1519
|
-
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
1520
|
-
return 1;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
return 0;
|
|
1524
|
-
}
|
|
1525
|
-
function optionalBit(parser, context, t) {
|
|
1526
|
-
if (parser.getToken() !== t)
|
|
1527
|
-
return 0;
|
|
1528
|
-
nextToken(parser, context);
|
|
1529
|
-
return 1;
|
|
1530
|
-
}
|
|
1531
|
-
function consumeOpt(parser, context, t) {
|
|
1532
|
-
if (parser.getToken() !== t)
|
|
1533
|
-
return false;
|
|
1534
|
-
nextToken(parser, context);
|
|
1535
|
-
return true;
|
|
1536
|
-
}
|
|
1537
|
-
function consume(parser, context, t) {
|
|
1538
|
-
if (parser.getToken() !== t)
|
|
1539
|
-
parser.report(25, KeywordDescTable[t & 255]);
|
|
1540
|
-
nextToken(parser, context);
|
|
1541
|
-
}
|
|
1542
|
-
function reinterpretToPattern(parser, node) {
|
|
1543
|
-
switch (node.type) {
|
|
1544
|
-
case 'ArrayExpression': {
|
|
1545
|
-
node.type = 'ArrayPattern';
|
|
1546
|
-
const { elements } = node;
|
|
1547
|
-
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
1548
|
-
const element = elements[i];
|
|
1549
|
-
if (element)
|
|
1550
|
-
reinterpretToPattern(parser, element);
|
|
1551
|
-
}
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
case 'ObjectExpression': {
|
|
1555
|
-
node.type = 'ObjectPattern';
|
|
1556
|
-
const { properties } = node;
|
|
1557
|
-
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
1558
|
-
reinterpretToPattern(parser, properties[i]);
|
|
1559
|
-
}
|
|
1560
|
-
return;
|
|
1561
|
-
}
|
|
1562
|
-
case 'AssignmentExpression':
|
|
1563
|
-
node.type = 'AssignmentPattern';
|
|
1564
|
-
if (node.operator !== '=')
|
|
1565
|
-
parser.report(71);
|
|
1566
|
-
delete node.operator;
|
|
1567
|
-
reinterpretToPattern(parser, node.left);
|
|
1568
|
-
return;
|
|
1569
|
-
case 'Property':
|
|
1570
|
-
reinterpretToPattern(parser, node.value);
|
|
1571
|
-
return;
|
|
1572
|
-
case 'SpreadElement':
|
|
1573
|
-
node.type = 'RestElement';
|
|
1574
|
-
reinterpretToPattern(parser, node.argument);
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
1578
|
-
if (context & 1) {
|
|
1579
|
-
if ((t & 36864) === 36864) {
|
|
1580
|
-
parser.report(118);
|
|
1183
|
+
char = parser.currentChar;
|
|
1184
|
+
}
|
|
1581
1185
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1186
|
+
}
|
|
1187
|
+
const end = parser.index;
|
|
1188
|
+
let isBigInt = 0;
|
|
1189
|
+
if (char === 110 && kind & 128) {
|
|
1190
|
+
isBigInt = 1;
|
|
1191
|
+
char = advanceChar(parser);
|
|
1192
|
+
}
|
|
1193
|
+
else {
|
|
1194
|
+
if ((char | 32) === 101) {
|
|
1195
|
+
char = advanceChar(parser);
|
|
1196
|
+
if (CharTypes[char] & 256)
|
|
1197
|
+
char = advanceChar(parser);
|
|
1198
|
+
const { index } = parser;
|
|
1199
|
+
if ((CharTypes[char] & 16) === 0)
|
|
1200
|
+
parser.report(11);
|
|
1201
|
+
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1202
|
+
char = parser.currentChar;
|
|
1584
1203
|
}
|
|
1585
1204
|
}
|
|
1586
|
-
if ((
|
|
1587
|
-
parser.report(
|
|
1205
|
+
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) {
|
|
1206
|
+
parser.report(13);
|
|
1588
1207
|
}
|
|
1589
|
-
if (
|
|
1590
|
-
parser.
|
|
1208
|
+
if (isBigInt) {
|
|
1209
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1210
|
+
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1211
|
+
return 134283388;
|
|
1591
1212
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1213
|
+
parser.tokenValue =
|
|
1214
|
+
kind & (1 | 2 | 8 | 4)
|
|
1215
|
+
? value
|
|
1216
|
+
: kind & 32
|
|
1217
|
+
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1218
|
+
: +value;
|
|
1219
|
+
if (parser.options.raw)
|
|
1220
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1221
|
+
return 134283266;
|
|
1222
|
+
}
|
|
1223
|
+
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1224
|
+
let allowSeparator = 0;
|
|
1225
|
+
let start = parser.index;
|
|
1226
|
+
let ret = '';
|
|
1227
|
+
while (CharTypes[char] & (16 | 4096)) {
|
|
1228
|
+
if (char === 95) {
|
|
1229
|
+
const { index } = parser;
|
|
1230
|
+
char = advanceChar(parser);
|
|
1231
|
+
if (char === 95) {
|
|
1232
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1233
|
+
}
|
|
1234
|
+
allowSeparator = 1;
|
|
1235
|
+
ret += parser.source.substring(start, index);
|
|
1236
|
+
start = parser.index;
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
allowSeparator = 0;
|
|
1240
|
+
char = advanceChar(parser);
|
|
1594
1241
|
}
|
|
1595
|
-
if (
|
|
1596
|
-
parser.
|
|
1242
|
+
if (allowSeparator) {
|
|
1243
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1597
1244
|
}
|
|
1245
|
+
return ret + parser.source.substring(start, parser.index);
|
|
1598
1246
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1247
|
+
|
|
1248
|
+
var RegexState;
|
|
1249
|
+
(function (RegexState) {
|
|
1250
|
+
RegexState[RegexState["Empty"] = 0] = "Empty";
|
|
1251
|
+
RegexState[RegexState["Escape"] = 1] = "Escape";
|
|
1252
|
+
RegexState[RegexState["Class"] = 2] = "Class";
|
|
1253
|
+
})(RegexState || (RegexState = {}));
|
|
1254
|
+
var RegexFlags;
|
|
1255
|
+
(function (RegexFlags) {
|
|
1256
|
+
RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
|
|
1257
|
+
RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
|
|
1258
|
+
RegexFlags[RegexFlags["Global"] = 2] = "Global";
|
|
1259
|
+
RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
|
|
1260
|
+
RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
|
|
1261
|
+
RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
|
|
1262
|
+
RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
|
|
1263
|
+
RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
|
|
1264
|
+
RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
|
|
1265
|
+
})(RegexFlags || (RegexFlags = {}));
|
|
1266
|
+
function scanRegularExpression(parser) {
|
|
1267
|
+
const bodyStart = parser.index;
|
|
1268
|
+
let preparseState = RegexState.Empty;
|
|
1269
|
+
loop: while (true) {
|
|
1270
|
+
const ch = parser.currentChar;
|
|
1271
|
+
advanceChar(parser);
|
|
1272
|
+
if (preparseState & RegexState.Escape) {
|
|
1273
|
+
preparseState &= ~RegexState.Escape;
|
|
1603
1274
|
}
|
|
1604
|
-
|
|
1605
|
-
|
|
1275
|
+
else {
|
|
1276
|
+
switch (ch) {
|
|
1277
|
+
case 47:
|
|
1278
|
+
if (!preparseState)
|
|
1279
|
+
break loop;
|
|
1280
|
+
else
|
|
1281
|
+
break;
|
|
1282
|
+
case 92:
|
|
1283
|
+
preparseState |= RegexState.Escape;
|
|
1284
|
+
break;
|
|
1285
|
+
case 91:
|
|
1286
|
+
preparseState |= RegexState.Class;
|
|
1287
|
+
break;
|
|
1288
|
+
case 93:
|
|
1289
|
+
preparseState &= RegexState.Escape;
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1606
1292
|
}
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1293
|
+
if (ch === 13 ||
|
|
1294
|
+
ch === 10 ||
|
|
1295
|
+
ch === 8232 ||
|
|
1296
|
+
ch === 8233) {
|
|
1297
|
+
parser.report(34);
|
|
1609
1298
|
}
|
|
1610
|
-
if (
|
|
1611
|
-
parser.report(
|
|
1299
|
+
if (parser.index >= parser.source.length) {
|
|
1300
|
+
return parser.report(34);
|
|
1612
1301
|
}
|
|
1613
1302
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1303
|
+
const bodyEnd = parser.index - 1;
|
|
1304
|
+
let mask = RegexFlags.Empty;
|
|
1305
|
+
let char = parser.currentChar;
|
|
1306
|
+
const { index: flagStart } = parser;
|
|
1307
|
+
while (isIdentifierPart(char)) {
|
|
1308
|
+
switch (char) {
|
|
1309
|
+
case 103:
|
|
1310
|
+
if (mask & RegexFlags.Global)
|
|
1311
|
+
parser.report(36, 'g');
|
|
1312
|
+
mask |= RegexFlags.Global;
|
|
1313
|
+
break;
|
|
1314
|
+
case 105:
|
|
1315
|
+
if (mask & RegexFlags.IgnoreCase)
|
|
1316
|
+
parser.report(36, 'i');
|
|
1317
|
+
mask |= RegexFlags.IgnoreCase;
|
|
1318
|
+
break;
|
|
1319
|
+
case 109:
|
|
1320
|
+
if (mask & RegexFlags.Multiline)
|
|
1321
|
+
parser.report(36, 'm');
|
|
1322
|
+
mask |= RegexFlags.Multiline;
|
|
1323
|
+
break;
|
|
1324
|
+
case 117:
|
|
1325
|
+
if (mask & RegexFlags.Unicode)
|
|
1326
|
+
parser.report(36, 'u');
|
|
1327
|
+
if (mask & RegexFlags.UnicodeSets)
|
|
1328
|
+
parser.report(36, 'vu');
|
|
1329
|
+
mask |= RegexFlags.Unicode;
|
|
1330
|
+
break;
|
|
1331
|
+
case 118:
|
|
1332
|
+
if (mask & RegexFlags.Unicode)
|
|
1333
|
+
parser.report(36, 'uv');
|
|
1334
|
+
if (mask & RegexFlags.UnicodeSets)
|
|
1335
|
+
parser.report(36, 'v');
|
|
1336
|
+
mask |= RegexFlags.UnicodeSets;
|
|
1337
|
+
break;
|
|
1338
|
+
case 121:
|
|
1339
|
+
if (mask & RegexFlags.Sticky)
|
|
1340
|
+
parser.report(36, 'y');
|
|
1341
|
+
mask |= RegexFlags.Sticky;
|
|
1342
|
+
break;
|
|
1343
|
+
case 115:
|
|
1344
|
+
if (mask & RegexFlags.DotAll)
|
|
1345
|
+
parser.report(36, 's');
|
|
1346
|
+
mask |= RegexFlags.DotAll;
|
|
1347
|
+
break;
|
|
1348
|
+
case 100:
|
|
1349
|
+
if (mask & RegexFlags.Indices)
|
|
1350
|
+
parser.report(36, 'd');
|
|
1351
|
+
mask |= RegexFlags.Indices;
|
|
1352
|
+
break;
|
|
1353
|
+
default:
|
|
1354
|
+
parser.report(35);
|
|
1645
1355
|
}
|
|
1646
|
-
|
|
1647
|
-
isIterationStatement = 0;
|
|
1648
|
-
labels = labels['$'];
|
|
1649
|
-
}
|
|
1650
|
-
return 0;
|
|
1651
|
-
}
|
|
1652
|
-
function validateAndDeclareLabel(parser, labels, name) {
|
|
1653
|
-
let set = labels;
|
|
1654
|
-
while (set) {
|
|
1655
|
-
if (set['$' + name])
|
|
1656
|
-
parser.report(136, name);
|
|
1657
|
-
set = set['$'];
|
|
1658
|
-
}
|
|
1659
|
-
labels['$' + name] = 1;
|
|
1660
|
-
}
|
|
1661
|
-
function isEqualTagName(elementName) {
|
|
1662
|
-
switch (elementName.type) {
|
|
1663
|
-
case 'JSXIdentifier':
|
|
1664
|
-
return elementName.name;
|
|
1665
|
-
case 'JSXNamespacedName':
|
|
1666
|
-
return elementName.namespace + ':' + elementName.name;
|
|
1667
|
-
case 'JSXMemberExpression':
|
|
1668
|
-
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
function isValidIdentifier(context, t) {
|
|
1672
|
-
if (context & (1 | 1024)) {
|
|
1673
|
-
if (context & 2 && t === 209006)
|
|
1674
|
-
return false;
|
|
1675
|
-
if (context & 1024 && t === 241771)
|
|
1676
|
-
return false;
|
|
1677
|
-
return (t & 12288) === 12288;
|
|
1678
|
-
}
|
|
1679
|
-
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
1680
|
-
}
|
|
1681
|
-
function classifyIdentifier(parser, context, t) {
|
|
1682
|
-
if ((t & 537079808) === 537079808) {
|
|
1683
|
-
if (context & 1)
|
|
1684
|
-
parser.report(119);
|
|
1685
|
-
parser.flags |= 512;
|
|
1356
|
+
char = advanceChar(parser);
|
|
1686
1357
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1358
|
+
const flags = parser.source.slice(flagStart, parser.index);
|
|
1359
|
+
const pattern = parser.source.slice(bodyStart, bodyEnd);
|
|
1360
|
+
parser.tokenRegExp = { pattern, flags };
|
|
1361
|
+
if (parser.options.raw)
|
|
1362
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1363
|
+
parser.tokenValue = validate(parser, pattern, flags);
|
|
1364
|
+
return 65540;
|
|
1689
1365
|
}
|
|
1690
|
-
function
|
|
1691
|
-
|
|
1366
|
+
function validate(parser, pattern, flags) {
|
|
1367
|
+
try {
|
|
1368
|
+
return new RegExp(pattern, flags);
|
|
1369
|
+
}
|
|
1370
|
+
catch {
|
|
1371
|
+
if (!parser.options.validateRegex) {
|
|
1372
|
+
return null;
|
|
1373
|
+
}
|
|
1374
|
+
parser.report(34);
|
|
1375
|
+
}
|
|
1692
1376
|
}
|
|
1693
1377
|
|
|
1694
|
-
function
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1378
|
+
function scanString(parser, context, quote) {
|
|
1379
|
+
const { index: start } = parser;
|
|
1380
|
+
let ret = '';
|
|
1381
|
+
let char = advanceChar(parser);
|
|
1382
|
+
let marker = parser.index;
|
|
1383
|
+
while ((CharTypes[char] & 8) === 0) {
|
|
1384
|
+
if (char === quote) {
|
|
1385
|
+
ret += parser.source.slice(marker, parser.index);
|
|
1386
|
+
advanceChar(parser);
|
|
1387
|
+
if (parser.options.raw)
|
|
1388
|
+
parser.tokenRaw = parser.source.slice(start, parser.index);
|
|
1389
|
+
parser.tokenValue = ret;
|
|
1390
|
+
return 134283267;
|
|
1391
|
+
}
|
|
1392
|
+
if ((char & 8) === 8 && char === 92) {
|
|
1393
|
+
ret += parser.source.slice(marker, parser.index);
|
|
1394
|
+
char = advanceChar(parser);
|
|
1395
|
+
if (char < 0x7f || char === 8232 || char === 8233) {
|
|
1396
|
+
const code = parseEscape(parser, context, char);
|
|
1397
|
+
if (code >= 0)
|
|
1398
|
+
ret += String.fromCodePoint(code);
|
|
1399
|
+
else
|
|
1400
|
+
handleStringError(parser, code, 0);
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1403
|
+
ret += String.fromCodePoint(char);
|
|
1404
|
+
}
|
|
1405
|
+
marker = parser.index + 1;
|
|
1406
|
+
}
|
|
1407
|
+
else if (char === 8232 || char === 8233) {
|
|
1408
|
+
parser.column = -1;
|
|
1409
|
+
parser.line++;
|
|
1410
|
+
}
|
|
1411
|
+
if (parser.index >= parser.end)
|
|
1412
|
+
parser.report(16);
|
|
1413
|
+
char = advanceChar(parser);
|
|
1414
|
+
}
|
|
1415
|
+
parser.report(16);
|
|
1708
1416
|
}
|
|
1709
|
-
function
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1417
|
+
function parseEscape(parser, context, first, isTemplate = 0) {
|
|
1418
|
+
switch (first) {
|
|
1419
|
+
case 98:
|
|
1420
|
+
return 8;
|
|
1421
|
+
case 102:
|
|
1422
|
+
return 12;
|
|
1423
|
+
case 114:
|
|
1424
|
+
return 13;
|
|
1425
|
+
case 110:
|
|
1426
|
+
return 10;
|
|
1427
|
+
case 116:
|
|
1428
|
+
return 9;
|
|
1429
|
+
case 118:
|
|
1430
|
+
return 11;
|
|
1431
|
+
case 13: {
|
|
1432
|
+
if (parser.index < parser.end) {
|
|
1433
|
+
const nextChar = parser.source.charCodeAt(parser.index + 1);
|
|
1434
|
+
if (nextChar === 10) {
|
|
1435
|
+
parser.index = parser.index + 1;
|
|
1436
|
+
parser.currentChar = nextChar;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1721
1439
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1440
|
+
case 10:
|
|
1441
|
+
case 8232:
|
|
1442
|
+
case 8233:
|
|
1443
|
+
parser.column = -1;
|
|
1444
|
+
parser.line++;
|
|
1445
|
+
return -1;
|
|
1446
|
+
case 48:
|
|
1447
|
+
case 49:
|
|
1448
|
+
case 50:
|
|
1449
|
+
case 51: {
|
|
1450
|
+
let code = first - 48;
|
|
1451
|
+
let index = parser.index + 1;
|
|
1452
|
+
let column = parser.column + 1;
|
|
1453
|
+
if (index < parser.end) {
|
|
1454
|
+
const next = parser.source.charCodeAt(index);
|
|
1455
|
+
if ((CharTypes[next] & 32) === 0) {
|
|
1456
|
+
if (code !== 0 || CharTypes[next] & 512) {
|
|
1457
|
+
if (context & 1 || isTemplate)
|
|
1458
|
+
return -2;
|
|
1459
|
+
parser.flags |= 64;
|
|
1460
|
+
}
|
|
1727
1461
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1462
|
+
else if (context & 1 || isTemplate) {
|
|
1463
|
+
return -2;
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
parser.currentChar = next;
|
|
1467
|
+
code = (code << 3) | (next - 48);
|
|
1468
|
+
index++;
|
|
1469
|
+
column++;
|
|
1470
|
+
if (index < parser.end) {
|
|
1471
|
+
const next = parser.source.charCodeAt(index);
|
|
1472
|
+
if (CharTypes[next] & 32) {
|
|
1473
|
+
parser.currentChar = next;
|
|
1474
|
+
code = (code << 3) | (next - 48);
|
|
1475
|
+
index++;
|
|
1476
|
+
column++;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
parser.flags |= 64;
|
|
1480
|
+
}
|
|
1481
|
+
parser.index = index - 1;
|
|
1482
|
+
parser.column = column - 1;
|
|
1731
1483
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1484
|
+
return code;
|
|
1485
|
+
}
|
|
1486
|
+
case 52:
|
|
1487
|
+
case 53:
|
|
1488
|
+
case 54:
|
|
1489
|
+
case 55: {
|
|
1490
|
+
if (isTemplate || context & 1)
|
|
1491
|
+
return -2;
|
|
1492
|
+
let code = first - 48;
|
|
1493
|
+
const index = parser.index + 1;
|
|
1494
|
+
const column = parser.column + 1;
|
|
1495
|
+
if (index < parser.end) {
|
|
1496
|
+
const next = parser.source.charCodeAt(index);
|
|
1497
|
+
if (CharTypes[next] & 32) {
|
|
1498
|
+
code = (code << 3) | (next - 48);
|
|
1499
|
+
parser.currentChar = next;
|
|
1500
|
+
parser.index = index;
|
|
1501
|
+
parser.column = column;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
parser.flags |= 64;
|
|
1505
|
+
return code;
|
|
1506
|
+
}
|
|
1507
|
+
case 120: {
|
|
1508
|
+
const ch1 = advanceChar(parser);
|
|
1509
|
+
if ((CharTypes[ch1] & 64) === 0)
|
|
1510
|
+
return -4;
|
|
1511
|
+
const hi = toHex(ch1);
|
|
1512
|
+
const ch2 = advanceChar(parser);
|
|
1513
|
+
if ((CharTypes[ch2] & 64) === 0)
|
|
1514
|
+
return -4;
|
|
1515
|
+
const lo = toHex(ch2);
|
|
1516
|
+
return (hi << 4) | lo;
|
|
1517
|
+
}
|
|
1518
|
+
case 117: {
|
|
1519
|
+
const ch = advanceChar(parser);
|
|
1520
|
+
if (parser.currentChar === 123) {
|
|
1521
|
+
let code = 0;
|
|
1522
|
+
while ((CharTypes[advanceChar(parser)] & 64) !== 0) {
|
|
1523
|
+
code = (code << 4) | toHex(parser.currentChar);
|
|
1524
|
+
if (code > 1114111)
|
|
1525
|
+
return -5;
|
|
1526
|
+
}
|
|
1527
|
+
if (parser.currentChar < 1 || parser.currentChar !== 125) {
|
|
1528
|
+
return -4;
|
|
1529
|
+
}
|
|
1530
|
+
return code;
|
|
1531
|
+
}
|
|
1532
|
+
else {
|
|
1533
|
+
if ((CharTypes[ch] & 64) === 0)
|
|
1534
|
+
return -4;
|
|
1535
|
+
const ch2 = parser.source.charCodeAt(parser.index + 1);
|
|
1536
|
+
if ((CharTypes[ch2] & 64) === 0)
|
|
1537
|
+
return -4;
|
|
1538
|
+
const ch3 = parser.source.charCodeAt(parser.index + 2);
|
|
1539
|
+
if ((CharTypes[ch3] & 64) === 0)
|
|
1540
|
+
return -4;
|
|
1541
|
+
const ch4 = parser.source.charCodeAt(parser.index + 3);
|
|
1542
|
+
if ((CharTypes[ch4] & 64) === 0)
|
|
1543
|
+
return -4;
|
|
1544
|
+
parser.index += 3;
|
|
1545
|
+
parser.column += 3;
|
|
1546
|
+
parser.currentChar = parser.source.charCodeAt(parser.index);
|
|
1547
|
+
return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4);
|
|
1734
1548
|
}
|
|
1735
|
-
advanceChar(parser);
|
|
1736
1549
|
}
|
|
1550
|
+
case 56:
|
|
1551
|
+
case 57:
|
|
1552
|
+
if (isTemplate || !parser.options.webcompat || context & 1)
|
|
1553
|
+
return -3;
|
|
1554
|
+
parser.flags |= 4096;
|
|
1555
|
+
default:
|
|
1556
|
+
return first;
|
|
1737
1557
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1558
|
+
}
|
|
1559
|
+
function handleStringError(parser, code, isTemplate) {
|
|
1560
|
+
switch (code) {
|
|
1561
|
+
case -1:
|
|
1562
|
+
return;
|
|
1563
|
+
case -2:
|
|
1564
|
+
parser.report(isTemplate ? 2 : 1);
|
|
1565
|
+
case -3:
|
|
1566
|
+
parser.report(isTemplate ? 3 : 14);
|
|
1567
|
+
case -4:
|
|
1568
|
+
parser.report(7);
|
|
1569
|
+
case -5:
|
|
1570
|
+
parser.report(104);
|
|
1740
1571
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
function scanTemplate(parser, context) {
|
|
1575
|
+
const { index: start } = parser;
|
|
1576
|
+
let token = 67174409;
|
|
1577
|
+
let ret = '';
|
|
1578
|
+
let char = advanceChar(parser);
|
|
1579
|
+
while (char !== 96) {
|
|
1580
|
+
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
1581
|
+
advanceChar(parser);
|
|
1582
|
+
token = 67174408;
|
|
1583
|
+
break;
|
|
1753
1584
|
}
|
|
1754
|
-
if (
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
if ((token & 36864) === 36864) {
|
|
1759
|
-
return -2147483527;
|
|
1585
|
+
else if (char === 92) {
|
|
1586
|
+
char = advanceChar(parser);
|
|
1587
|
+
if (char > 0x7e) {
|
|
1588
|
+
ret += String.fromCodePoint(char);
|
|
1760
1589
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1590
|
+
else {
|
|
1591
|
+
const { index, line, column } = parser;
|
|
1592
|
+
const code = parseEscape(parser, context | 1, char, 1);
|
|
1593
|
+
if (code >= 0) {
|
|
1594
|
+
ret += String.fromCodePoint(code);
|
|
1595
|
+
}
|
|
1596
|
+
else if (code !== -1 && context & 64) {
|
|
1597
|
+
parser.index = index;
|
|
1598
|
+
parser.line = line;
|
|
1599
|
+
parser.column = column;
|
|
1600
|
+
ret = null;
|
|
1601
|
+
char = scanBadTemplate(parser, char);
|
|
1602
|
+
if (char < 0)
|
|
1603
|
+
token = 67174408;
|
|
1604
|
+
break;
|
|
1764
1605
|
}
|
|
1765
1606
|
else {
|
|
1766
|
-
|
|
1607
|
+
handleStringError(parser, code, 1);
|
|
1767
1608
|
}
|
|
1768
1609
|
}
|
|
1769
|
-
return 209018 | -2147483648;
|
|
1770
|
-
}
|
|
1771
|
-
if (context & 262144 &&
|
|
1772
|
-
(context & 8) === 0 &&
|
|
1773
|
-
(token & 20480) === 20480) {
|
|
1774
|
-
return token | -2147483648;
|
|
1775
|
-
}
|
|
1776
|
-
if (token === 241771) {
|
|
1777
|
-
return context & 262144
|
|
1778
|
-
? 209018 | -2147483648
|
|
1779
|
-
: context & 1024
|
|
1780
|
-
? -2147483528
|
|
1781
|
-
: token | -2147483648;
|
|
1782
|
-
}
|
|
1783
|
-
if (token === 209005) {
|
|
1784
|
-
return 209018 | -2147483648;
|
|
1785
1610
|
}
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
1611
|
+
else if (parser.index < parser.end) {
|
|
1612
|
+
if (char === 13 && parser.source.charCodeAt(parser.index) === 10) {
|
|
1613
|
+
ret += String.fromCodePoint(char);
|
|
1614
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
1615
|
+
}
|
|
1616
|
+
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
1617
|
+
parser.column = -1;
|
|
1618
|
+
parser.line++;
|
|
1619
|
+
}
|
|
1620
|
+
ret += String.fromCodePoint(char);
|
|
1788
1621
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
function scanPrivateIdentifier(parser) {
|
|
1794
|
-
let char = advanceChar(parser);
|
|
1795
|
-
if (char === 92)
|
|
1796
|
-
return 130;
|
|
1797
|
-
const merged = consumePossibleSurrogatePair(parser);
|
|
1798
|
-
if (merged)
|
|
1799
|
-
char = merged;
|
|
1800
|
-
if (!isIdentifierStart(char))
|
|
1801
|
-
parser.report(96);
|
|
1802
|
-
return 130;
|
|
1803
|
-
}
|
|
1804
|
-
function scanIdentifierUnicodeEscape(parser) {
|
|
1805
|
-
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1806
|
-
parser.report(5);
|
|
1622
|
+
if (parser.index >= parser.end)
|
|
1623
|
+
parser.report(17);
|
|
1624
|
+
char = advanceChar(parser);
|
|
1807
1625
|
}
|
|
1808
|
-
|
|
1809
|
-
parser.
|
|
1810
|
-
|
|
1626
|
+
advanceChar(parser);
|
|
1627
|
+
parser.tokenValue = ret;
|
|
1628
|
+
parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
1629
|
+
return token;
|
|
1811
1630
|
}
|
|
1812
|
-
function
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1631
|
+
function scanBadTemplate(parser, ch) {
|
|
1632
|
+
while (ch !== 96) {
|
|
1633
|
+
switch (ch) {
|
|
1634
|
+
case 36: {
|
|
1635
|
+
const index = parser.index + 1;
|
|
1636
|
+
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
1637
|
+
parser.index = index;
|
|
1638
|
+
parser.column++;
|
|
1639
|
+
return -ch;
|
|
1640
|
+
}
|
|
1641
|
+
break;
|
|
1642
|
+
}
|
|
1643
|
+
case 10:
|
|
1644
|
+
case 8232:
|
|
1645
|
+
case 8233:
|
|
1646
|
+
parser.column = -1;
|
|
1647
|
+
parser.line++;
|
|
1824
1648
|
}
|
|
1825
|
-
|
|
1826
|
-
|
|
1649
|
+
if (parser.index >= parser.end)
|
|
1650
|
+
parser.report(17);
|
|
1651
|
+
ch = advanceChar(parser);
|
|
1827
1652
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
if (
|
|
1832
|
-
parser.report(
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
1837
|
-
if ((CharTypes[char4] & 64) === 0)
|
|
1838
|
-
parser.report(7);
|
|
1839
|
-
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1840
|
-
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1841
|
-
parser.column += 4;
|
|
1842
|
-
return codePoint;
|
|
1653
|
+
return ch;
|
|
1654
|
+
}
|
|
1655
|
+
function scanTemplateTail(parser, context) {
|
|
1656
|
+
if (parser.index >= parser.end)
|
|
1657
|
+
parser.report(0);
|
|
1658
|
+
parser.index--;
|
|
1659
|
+
parser.column--;
|
|
1660
|
+
return scanTemplate(parser, context);
|
|
1843
1661
|
}
|
|
1844
1662
|
|
|
1845
1663
|
const TokenLookup = [
|
|
@@ -1982,7 +1800,6 @@ function nextToken(parser, context) {
|
|
|
1982
1800
|
function scanSingleToken(parser, context, state) {
|
|
1983
1801
|
const isStartOfLine = parser.index === 0;
|
|
1984
1802
|
const { source } = parser;
|
|
1985
|
-
let start = parser.currentLocation;
|
|
1986
1803
|
while (parser.index < parser.end) {
|
|
1987
1804
|
parser.tokenIndex = parser.index;
|
|
1988
1805
|
parser.tokenColumn = parser.column;
|
|
@@ -2052,7 +1869,6 @@ function scanSingleToken(parser, context, state) {
|
|
|
2052
1869
|
parser.column += 3;
|
|
2053
1870
|
parser.currentChar = source.charCodeAt((parser.index += 3));
|
|
2054
1871
|
state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenStart);
|
|
2055
|
-
start = parser.tokenStart;
|
|
2056
1872
|
continue;
|
|
2057
1873
|
}
|
|
2058
1874
|
return 8456256;
|
|
@@ -2133,8 +1949,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2133
1949
|
if (!parser.options.webcompat)
|
|
2134
1950
|
parser.report(112);
|
|
2135
1951
|
advanceChar(parser);
|
|
2136
|
-
state = skipSingleHTMLComment(parser, source, state, context, 3,
|
|
2137
|
-
start = parser.tokenStart;
|
|
1952
|
+
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
2138
1953
|
continue;
|
|
2139
1954
|
}
|
|
2140
1955
|
return 33619994;
|
|
@@ -2152,13 +1967,11 @@ function scanSingleToken(parser, context, state) {
|
|
|
2152
1967
|
if (ch === 47) {
|
|
2153
1968
|
advanceChar(parser);
|
|
2154
1969
|
state = skipSingleLineComment(parser, source, state, 0, parser.tokenStart);
|
|
2155
|
-
start = parser.tokenStart;
|
|
2156
1970
|
continue;
|
|
2157
1971
|
}
|
|
2158
1972
|
if (ch === 42) {
|
|
2159
1973
|
advanceChar(parser);
|
|
2160
1974
|
state = skipMultiLineComment(parser, source, state);
|
|
2161
|
-
start = parser.tokenStart;
|
|
2162
1975
|
continue;
|
|
2163
1976
|
}
|
|
2164
1977
|
if (context & 32) {
|
|
@@ -2269,27 +2082,209 @@ function scanSingleToken(parser, context, state) {
|
|
|
2269
2082
|
}
|
|
2270
2083
|
}
|
|
2271
2084
|
}
|
|
2272
|
-
else {
|
|
2273
|
-
if ((char ^ 8232) <= 1) {
|
|
2274
|
-
state = (state & -5) | 1;
|
|
2275
|
-
scanNewLine(parser);
|
|
2276
|
-
continue;
|
|
2277
|
-
}
|
|
2278
|
-
const merged = consumePossibleSurrogatePair(parser);
|
|
2279
|
-
if (merged > 0)
|
|
2280
|
-
char = merged;
|
|
2281
|
-
if (isIDStart(char)) {
|
|
2282
|
-
parser.tokenValue = '';
|
|
2283
|
-
return scanIdentifierSlowCase(parser, context, 0, 0);
|
|
2284
|
-
}
|
|
2285
|
-
if (isExoticECMAScriptWhitespace(char)) {
|
|
2286
|
-
advanceChar(parser);
|
|
2287
|
-
continue;
|
|
2288
|
-
}
|
|
2289
|
-
parser.report(20, String.fromCodePoint(char));
|
|
2085
|
+
else {
|
|
2086
|
+
if ((char ^ 8232) <= 1) {
|
|
2087
|
+
state = (state & -5) | 1;
|
|
2088
|
+
scanNewLine(parser);
|
|
2089
|
+
continue;
|
|
2090
|
+
}
|
|
2091
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
2092
|
+
if (merged > 0)
|
|
2093
|
+
char = merged;
|
|
2094
|
+
if (isIDStart(char)) {
|
|
2095
|
+
parser.tokenValue = '';
|
|
2096
|
+
return scanIdentifierSlowCase(parser, context, 0, 0);
|
|
2097
|
+
}
|
|
2098
|
+
if (isExoticECMAScriptWhitespace(char)) {
|
|
2099
|
+
advanceChar(parser);
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2102
|
+
parser.report(20, String.fromCodePoint(char));
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return 1048576;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
function matchOrInsertSemicolon(parser, context) {
|
|
2109
|
+
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
2110
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
2111
|
+
}
|
|
2112
|
+
if (!consumeOpt(parser, context, 1074790417)) {
|
|
2113
|
+
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
2117
|
+
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
2118
|
+
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
2119
|
+
return 1;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return 0;
|
|
2123
|
+
}
|
|
2124
|
+
function optionalBit(parser, context, t) {
|
|
2125
|
+
if (parser.getToken() !== t)
|
|
2126
|
+
return 0;
|
|
2127
|
+
nextToken(parser, context);
|
|
2128
|
+
return 1;
|
|
2129
|
+
}
|
|
2130
|
+
function consumeOpt(parser, context, t) {
|
|
2131
|
+
if (parser.getToken() !== t)
|
|
2132
|
+
return false;
|
|
2133
|
+
nextToken(parser, context);
|
|
2134
|
+
return true;
|
|
2135
|
+
}
|
|
2136
|
+
function consume(parser, context, t) {
|
|
2137
|
+
if (parser.getToken() !== t)
|
|
2138
|
+
parser.report(25, KeywordDescTable[t & 255]);
|
|
2139
|
+
nextToken(parser, context);
|
|
2140
|
+
}
|
|
2141
|
+
function reinterpretToPattern(parser, node) {
|
|
2142
|
+
switch (node.type) {
|
|
2143
|
+
case 'ArrayExpression': {
|
|
2144
|
+
node.type = 'ArrayPattern';
|
|
2145
|
+
const { elements } = node;
|
|
2146
|
+
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
2147
|
+
const element = elements[i];
|
|
2148
|
+
if (element)
|
|
2149
|
+
reinterpretToPattern(parser, element);
|
|
2150
|
+
}
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
case 'ObjectExpression': {
|
|
2154
|
+
node.type = 'ObjectPattern';
|
|
2155
|
+
const { properties } = node;
|
|
2156
|
+
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
2157
|
+
reinterpretToPattern(parser, properties[i]);
|
|
2158
|
+
}
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
case 'AssignmentExpression':
|
|
2162
|
+
node.type = 'AssignmentPattern';
|
|
2163
|
+
if (node.operator !== '=')
|
|
2164
|
+
parser.report(71);
|
|
2165
|
+
delete node.operator;
|
|
2166
|
+
reinterpretToPattern(parser, node.left);
|
|
2167
|
+
return;
|
|
2168
|
+
case 'Property':
|
|
2169
|
+
reinterpretToPattern(parser, node.value);
|
|
2170
|
+
return;
|
|
2171
|
+
case 'SpreadElement':
|
|
2172
|
+
node.type = 'RestElement';
|
|
2173
|
+
reinterpretToPattern(parser, node.argument);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2177
|
+
if (context & 1) {
|
|
2178
|
+
if ((t & 36864) === 36864) {
|
|
2179
|
+
parser.report(118);
|
|
2180
|
+
}
|
|
2181
|
+
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2182
|
+
parser.report(119);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
if ((t & 20480) === 20480 || t === -2147483528) {
|
|
2186
|
+
parser.report(102);
|
|
2187
|
+
}
|
|
2188
|
+
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
2189
|
+
parser.report(100);
|
|
2190
|
+
}
|
|
2191
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2192
|
+
parser.report(110);
|
|
2193
|
+
}
|
|
2194
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2195
|
+
parser.report(97, 'yield');
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
function validateFunctionName(parser, context, t) {
|
|
2199
|
+
if (context & 1) {
|
|
2200
|
+
if ((t & 36864) === 36864) {
|
|
2201
|
+
parser.report(118);
|
|
2202
|
+
}
|
|
2203
|
+
if ((t & 537079808) === 537079808) {
|
|
2204
|
+
parser.report(119);
|
|
2205
|
+
}
|
|
2206
|
+
if (t === -2147483527) {
|
|
2207
|
+
parser.report(95);
|
|
2208
|
+
}
|
|
2209
|
+
if (t === -2147483528) {
|
|
2210
|
+
parser.report(95);
|
|
2290
2211
|
}
|
|
2291
2212
|
}
|
|
2292
|
-
|
|
2213
|
+
if ((t & 20480) === 20480) {
|
|
2214
|
+
parser.report(102);
|
|
2215
|
+
}
|
|
2216
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2217
|
+
parser.report(110);
|
|
2218
|
+
}
|
|
2219
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2220
|
+
parser.report(97, 'yield');
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
function isStrictReservedWord(parser, context, t) {
|
|
2224
|
+
if (t === 209006) {
|
|
2225
|
+
if (context & (2048 | 2))
|
|
2226
|
+
parser.report(110);
|
|
2227
|
+
parser.destructible |= 128;
|
|
2228
|
+
}
|
|
2229
|
+
if (t === 241771 && context & 1024)
|
|
2230
|
+
parser.report(97, 'yield');
|
|
2231
|
+
return ((t & 20480) === 20480 ||
|
|
2232
|
+
(t & 36864) === 36864 ||
|
|
2233
|
+
t == -2147483527);
|
|
2234
|
+
}
|
|
2235
|
+
function isPropertyWithPrivateFieldKey(expr) {
|
|
2236
|
+
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
2237
|
+
}
|
|
2238
|
+
function isValidLabel(parser, labels, name, isIterationStatement) {
|
|
2239
|
+
while (labels) {
|
|
2240
|
+
if (labels['$' + name]) {
|
|
2241
|
+
if (isIterationStatement)
|
|
2242
|
+
parser.report(137);
|
|
2243
|
+
return 1;
|
|
2244
|
+
}
|
|
2245
|
+
if (isIterationStatement && labels.loop)
|
|
2246
|
+
isIterationStatement = 0;
|
|
2247
|
+
labels = labels['$'];
|
|
2248
|
+
}
|
|
2249
|
+
return 0;
|
|
2250
|
+
}
|
|
2251
|
+
function validateAndDeclareLabel(parser, labels, name) {
|
|
2252
|
+
let set = labels;
|
|
2253
|
+
while (set) {
|
|
2254
|
+
if (set['$' + name])
|
|
2255
|
+
parser.report(136, name);
|
|
2256
|
+
set = set['$'];
|
|
2257
|
+
}
|
|
2258
|
+
labels['$' + name] = 1;
|
|
2259
|
+
}
|
|
2260
|
+
function isEqualTagName(elementName) {
|
|
2261
|
+
switch (elementName.type) {
|
|
2262
|
+
case 'JSXIdentifier':
|
|
2263
|
+
return elementName.name;
|
|
2264
|
+
case 'JSXNamespacedName':
|
|
2265
|
+
return elementName.namespace + ':' + elementName.name;
|
|
2266
|
+
case 'JSXMemberExpression':
|
|
2267
|
+
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
function isValidIdentifier(context, t) {
|
|
2271
|
+
if (context & (1 | 1024)) {
|
|
2272
|
+
if (context & 2 && t === 209006)
|
|
2273
|
+
return false;
|
|
2274
|
+
if (context & 1024 && t === 241771)
|
|
2275
|
+
return false;
|
|
2276
|
+
return (t & 12288) === 12288;
|
|
2277
|
+
}
|
|
2278
|
+
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
2279
|
+
}
|
|
2280
|
+
function classifyIdentifier(parser, context, t) {
|
|
2281
|
+
if ((t & 537079808) === 537079808) {
|
|
2282
|
+
if (context & 1)
|
|
2283
|
+
parser.report(119);
|
|
2284
|
+
parser.flags |= 512;
|
|
2285
|
+
}
|
|
2286
|
+
if (!isValidIdentifier(context, t))
|
|
2287
|
+
parser.report(0);
|
|
2293
2288
|
}
|
|
2294
2289
|
|
|
2295
2290
|
const entities = {
|
|
@@ -4548,6 +4543,61 @@ function rescanJSXIdentifier(parser) {
|
|
|
4548
4543
|
return parser.getToken();
|
|
4549
4544
|
}
|
|
4550
4545
|
|
|
4546
|
+
function normalizeOptions(rawOptions) {
|
|
4547
|
+
const options = {
|
|
4548
|
+
validateRegex: true,
|
|
4549
|
+
...rawOptions,
|
|
4550
|
+
};
|
|
4551
|
+
if (options.module && !options.sourceType) {
|
|
4552
|
+
options.sourceType = 'module';
|
|
4553
|
+
}
|
|
4554
|
+
if (options.globalReturn && (!options.sourceType || options.sourceType === 'script')) {
|
|
4555
|
+
options.sourceType = 'commonjs';
|
|
4556
|
+
}
|
|
4557
|
+
return options;
|
|
4558
|
+
}
|
|
4559
|
+
|
|
4560
|
+
class PrivateScope {
|
|
4561
|
+
parser;
|
|
4562
|
+
parent;
|
|
4563
|
+
refs = Object.create(null);
|
|
4564
|
+
privateIdentifiers = new Map();
|
|
4565
|
+
constructor(parser, parent) {
|
|
4566
|
+
this.parser = parser;
|
|
4567
|
+
this.parent = parent;
|
|
4568
|
+
}
|
|
4569
|
+
addPrivateIdentifier(name, kind) {
|
|
4570
|
+
const { privateIdentifiers } = this;
|
|
4571
|
+
let focusKind = kind & (32 | 768);
|
|
4572
|
+
if (!(focusKind & 768))
|
|
4573
|
+
focusKind |= 768;
|
|
4574
|
+
const value = privateIdentifiers.get(name);
|
|
4575
|
+
if (this.hasPrivateIdentifier(name) &&
|
|
4576
|
+
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4577
|
+
this.parser.report(146, name);
|
|
4578
|
+
}
|
|
4579
|
+
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4580
|
+
}
|
|
4581
|
+
addPrivateIdentifierRef(name) {
|
|
4582
|
+
this.refs[name] ??= [];
|
|
4583
|
+
this.refs[name].push(this.parser.tokenStart);
|
|
4584
|
+
}
|
|
4585
|
+
isPrivateIdentifierDefined(name) {
|
|
4586
|
+
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4587
|
+
}
|
|
4588
|
+
validatePrivateIdentifierRefs() {
|
|
4589
|
+
for (const name in this.refs) {
|
|
4590
|
+
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4591
|
+
const { index, line, column } = this.refs[name][0];
|
|
4592
|
+
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
hasPrivateIdentifier(name) {
|
|
4597
|
+
return this.privateIdentifiers.has(name);
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4551
4601
|
class Scope {
|
|
4552
4602
|
parser;
|
|
4553
4603
|
type;
|
|
@@ -4658,51 +4708,10 @@ function createArrowHeadParsingScope(parser, context, value) {
|
|
|
4658
4708
|
return scope;
|
|
4659
4709
|
}
|
|
4660
4710
|
|
|
4661
|
-
class PrivateScope {
|
|
4662
|
-
parser;
|
|
4663
|
-
parent;
|
|
4664
|
-
refs = Object.create(null);
|
|
4665
|
-
privateIdentifiers = new Map();
|
|
4666
|
-
constructor(parser, parent) {
|
|
4667
|
-
this.parser = parser;
|
|
4668
|
-
this.parent = parent;
|
|
4669
|
-
}
|
|
4670
|
-
addPrivateIdentifier(name, kind) {
|
|
4671
|
-
const { privateIdentifiers } = this;
|
|
4672
|
-
let focusKind = kind & (32 | 768);
|
|
4673
|
-
if (!(focusKind & 768))
|
|
4674
|
-
focusKind |= 768;
|
|
4675
|
-
const value = privateIdentifiers.get(name);
|
|
4676
|
-
if (this.hasPrivateIdentifier(name) &&
|
|
4677
|
-
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4678
|
-
this.parser.report(146, name);
|
|
4679
|
-
}
|
|
4680
|
-
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4681
|
-
}
|
|
4682
|
-
addPrivateIdentifierRef(name) {
|
|
4683
|
-
this.refs[name] ??= [];
|
|
4684
|
-
this.refs[name].push(this.parser.tokenStart);
|
|
4685
|
-
}
|
|
4686
|
-
isPrivateIdentifierDefined(name) {
|
|
4687
|
-
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4688
|
-
}
|
|
4689
|
-
validatePrivateIdentifierRefs() {
|
|
4690
|
-
for (const name in this.refs) {
|
|
4691
|
-
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4692
|
-
const { index, line, column } = this.refs[name][0];
|
|
4693
|
-
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4694
|
-
}
|
|
4695
|
-
}
|
|
4696
|
-
}
|
|
4697
|
-
hasPrivateIdentifier(name) {
|
|
4698
|
-
return this.privateIdentifiers.has(name);
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
|
|
4702
4711
|
class Parser {
|
|
4703
4712
|
source;
|
|
4704
|
-
options;
|
|
4705
4713
|
lastOnToken = null;
|
|
4714
|
+
options;
|
|
4706
4715
|
token = 1048576;
|
|
4707
4716
|
flags = 0;
|
|
4708
4717
|
index = 0;
|
|
@@ -4724,11 +4733,17 @@ class Parser {
|
|
|
4724
4733
|
assignable = 1;
|
|
4725
4734
|
destructible = 0;
|
|
4726
4735
|
leadingDecorators = { decorators: [] };
|
|
4727
|
-
constructor(source,
|
|
4736
|
+
constructor(source, rawOptions = {}) {
|
|
4728
4737
|
this.source = source;
|
|
4729
|
-
this.options = options;
|
|
4730
4738
|
this.end = source.length;
|
|
4731
4739
|
this.currentChar = source.charCodeAt(0);
|
|
4740
|
+
this.options = normalizeOptions(rawOptions);
|
|
4741
|
+
if (Array.isArray(this.options.onComment)) {
|
|
4742
|
+
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4743
|
+
}
|
|
4744
|
+
if (Array.isArray(this.options.onToken)) {
|
|
4745
|
+
this.options.onToken = pushToken(this.options.onToken, this.options);
|
|
4746
|
+
}
|
|
4732
4747
|
}
|
|
4733
4748
|
getToken() {
|
|
4734
4749
|
return this.token;
|
|
@@ -4821,6 +4836,25 @@ class Parser {
|
|
|
4821
4836
|
}
|
|
4822
4837
|
return undefined;
|
|
4823
4838
|
}
|
|
4839
|
+
cloneIdentifier(original) {
|
|
4840
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
4841
|
+
}
|
|
4842
|
+
cloneStringLiteral(original) {
|
|
4843
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
4844
|
+
}
|
|
4845
|
+
cloneLocationInformation(node, original) {
|
|
4846
|
+
if (this.options.ranges) {
|
|
4847
|
+
node.range = [...original.range];
|
|
4848
|
+
}
|
|
4849
|
+
if (this.options.loc) {
|
|
4850
|
+
node.loc = {
|
|
4851
|
+
...original.loc,
|
|
4852
|
+
start: { ...original.loc.start },
|
|
4853
|
+
end: { ...original.loc.end },
|
|
4854
|
+
};
|
|
4855
|
+
}
|
|
4856
|
+
return node;
|
|
4857
|
+
}
|
|
4824
4858
|
}
|
|
4825
4859
|
function pushComment(comments, options) {
|
|
4826
4860
|
return function (type, value, start, end, loc) {
|
|
@@ -4856,26 +4890,14 @@ function pushToken(tokens, options) {
|
|
|
4856
4890
|
};
|
|
4857
4891
|
}
|
|
4858
4892
|
|
|
4859
|
-
function normalizeOptions(rawOptions) {
|
|
4860
|
-
const options = { ...rawOptions };
|
|
4861
|
-
if (options.onComment) {
|
|
4862
|
-
options.onComment = Array.isArray(options.onComment) ? pushComment(options.onComment, options) : options.onComment;
|
|
4863
|
-
}
|
|
4864
|
-
if (options.onToken) {
|
|
4865
|
-
options.onToken = Array.isArray(options.onToken) ? pushToken(options.onToken, options) : options.onToken;
|
|
4866
|
-
}
|
|
4867
|
-
return options;
|
|
4868
|
-
}
|
|
4869
|
-
|
|
4870
4893
|
function parseSource(source, rawOptions = {}, context = 0) {
|
|
4871
|
-
const
|
|
4872
|
-
if (options.module)
|
|
4894
|
+
const parser = new Parser(source, rawOptions);
|
|
4895
|
+
if (parser.options.sourceType === 'module')
|
|
4873
4896
|
context |= 2 | 1;
|
|
4874
|
-
if (options.
|
|
4875
|
-
context |= 4096;
|
|
4876
|
-
if (options.impliedStrict)
|
|
4897
|
+
if (parser.options.sourceType === 'commonjs')
|
|
4898
|
+
context |= 4096 | 65536;
|
|
4899
|
+
if (parser.options.impliedStrict)
|
|
4877
4900
|
context |= 1;
|
|
4878
|
-
const parser = new Parser(source, options);
|
|
4879
4901
|
skipHashBang(parser);
|
|
4880
4902
|
const scope = parser.createScopeIfLexical();
|
|
4881
4903
|
let body = [];
|
|
@@ -5762,7 +5784,7 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
5762
5784
|
}
|
|
5763
5785
|
else if (imported.type === 'Identifier') {
|
|
5764
5786
|
validateBindingIdentifier(parser, context, 16, token, 0);
|
|
5765
|
-
local = imported;
|
|
5787
|
+
local = parser.cloneIdentifier(imported);
|
|
5766
5788
|
}
|
|
5767
5789
|
else {
|
|
5768
5790
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
@@ -5903,7 +5925,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5903
5925
|
tmpExportedNames.push(parser.tokenValue);
|
|
5904
5926
|
tmpExportedBindings.push(parser.tokenValue);
|
|
5905
5927
|
}
|
|
5906
|
-
exported = local;
|
|
5928
|
+
exported = local.type === 'Literal' ? parser.cloneStringLiteral(local) : parser.cloneIdentifier(local);
|
|
5907
5929
|
}
|
|
5908
5930
|
specifiers.push(parser.finishNode({
|
|
5909
5931
|
type: 'ExportSpecifier',
|
|
@@ -6678,20 +6700,12 @@ function parseIdentifierOrStringLiteral(parser, context) {
|
|
|
6678
6700
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
6679
6701
|
}
|
|
6680
6702
|
}
|
|
6681
|
-
function validateStringWellFormed(parser, str) {
|
|
6682
|
-
const len = str.length;
|
|
6683
|
-
for (let i = 0; i < len; i++) {
|
|
6684
|
-
const code = str.charCodeAt(i);
|
|
6685
|
-
if ((code & 0xfc00) !== 55296)
|
|
6686
|
-
continue;
|
|
6687
|
-
if (code > 56319 || ++i >= len || (str.charCodeAt(i) & 0xfc00) !== 56320) {
|
|
6688
|
-
parser.report(171, JSON.stringify(str.charAt(i--)));
|
|
6689
|
-
}
|
|
6690
|
-
}
|
|
6691
|
-
}
|
|
6692
6703
|
function parseModuleExportName(parser, context) {
|
|
6693
6704
|
if (parser.getToken() === 134283267) {
|
|
6694
|
-
|
|
6705
|
+
const value = parser.tokenValue;
|
|
6706
|
+
if (!value.isWellFormed()) {
|
|
6707
|
+
parser.report(171);
|
|
6708
|
+
}
|
|
6695
6709
|
return parseLiteral(parser, context);
|
|
6696
6710
|
}
|
|
6697
6711
|
else if (parser.getToken() & 143360) {
|
|
@@ -6825,35 +6839,31 @@ function parseLiteral(parser, context) {
|
|
|
6825
6839
|
if (parser.getToken() === 134283388) {
|
|
6826
6840
|
return parseBigIntLiteral(parser, context);
|
|
6827
6841
|
}
|
|
6842
|
+
const node = {
|
|
6843
|
+
type: 'Literal',
|
|
6844
|
+
value: tokenValue,
|
|
6845
|
+
};
|
|
6846
|
+
if (parser.options.raw) {
|
|
6847
|
+
node.raw = tokenRaw;
|
|
6848
|
+
}
|
|
6828
6849
|
nextToken(parser, context);
|
|
6829
6850
|
parser.assignable = 2;
|
|
6830
|
-
return parser.finishNode(
|
|
6831
|
-
? {
|
|
6832
|
-
type: 'Literal',
|
|
6833
|
-
value: tokenValue,
|
|
6834
|
-
raw: tokenRaw,
|
|
6835
|
-
}
|
|
6836
|
-
: {
|
|
6837
|
-
type: 'Literal',
|
|
6838
|
-
value: tokenValue,
|
|
6839
|
-
}, tokenStart);
|
|
6851
|
+
return parser.finishNode(node, tokenStart);
|
|
6840
6852
|
}
|
|
6841
6853
|
function parseNullOrTrueOrFalseLiteral(parser, context) {
|
|
6842
6854
|
const start = parser.tokenStart;
|
|
6843
6855
|
const raw = KeywordDescTable[parser.getToken() & 255];
|
|
6844
6856
|
const value = parser.getToken() === 86023 ? null : raw === 'true';
|
|
6857
|
+
const node = {
|
|
6858
|
+
type: 'Literal',
|
|
6859
|
+
value,
|
|
6860
|
+
};
|
|
6861
|
+
if (parser.options.raw) {
|
|
6862
|
+
node.raw = raw;
|
|
6863
|
+
}
|
|
6845
6864
|
nextToken(parser, context);
|
|
6846
6865
|
parser.assignable = 2;
|
|
6847
|
-
return parser.finishNode(
|
|
6848
|
-
? {
|
|
6849
|
-
type: 'Literal',
|
|
6850
|
-
value,
|
|
6851
|
-
raw,
|
|
6852
|
-
}
|
|
6853
|
-
: {
|
|
6854
|
-
type: 'Literal',
|
|
6855
|
-
value,
|
|
6856
|
-
}, start);
|
|
6866
|
+
return parser.finishNode(node, start);
|
|
6857
6867
|
}
|
|
6858
6868
|
function parseThisExpression(parser, context) {
|
|
6859
6869
|
const { tokenStart } = parser;
|
|
@@ -7368,7 +7378,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7368
7378
|
: 0;
|
|
7369
7379
|
value = parser.finishNode({
|
|
7370
7380
|
type: 'AssignmentPattern',
|
|
7371
|
-
left: parser.
|
|
7381
|
+
left: parser.cloneIdentifier(key),
|
|
7372
7382
|
right,
|
|
7373
7383
|
}, tokenStart);
|
|
7374
7384
|
}
|
|
@@ -7376,7 +7386,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7376
7386
|
destructible |=
|
|
7377
7387
|
(token === 209006 ? 128 : 0) |
|
|
7378
7388
|
(token === -2147483528 ? 16 : 0);
|
|
7379
|
-
value = parser.
|
|
7389
|
+
value = parser.cloneIdentifier(key);
|
|
7380
7390
|
}
|
|
7381
7391
|
}
|
|
7382
7392
|
else if (consumeOpt(parser, context | 32, 21)) {
|
|
@@ -8597,8 +8607,9 @@ function parseDecorators(parser, context, privateScope) {
|
|
|
8597
8607
|
function parseDecoratorList(parser, context, privateScope) {
|
|
8598
8608
|
const start = parser.tokenStart;
|
|
8599
8609
|
nextToken(parser, context | 32);
|
|
8610
|
+
const expressionStart = parser.tokenStart;
|
|
8600
8611
|
let expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
8601
|
-
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0,
|
|
8612
|
+
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, expressionStart);
|
|
8602
8613
|
return parser.finishNode({
|
|
8603
8614
|
type: 'Decorator',
|
|
8604
8615
|
expression,
|
|
@@ -9185,14 +9196,12 @@ function parseJSXIdentifier(parser, context) {
|
|
|
9185
9196
|
}, start);
|
|
9186
9197
|
}
|
|
9187
9198
|
|
|
9188
|
-
var version$1 = "6.1.4";
|
|
9189
|
-
|
|
9190
9199
|
const version = version$1;
|
|
9191
9200
|
function parseScript(source, options) {
|
|
9192
|
-
return parseSource(source, options);
|
|
9201
|
+
return parseSource(source, { ...options, sourceType: 'script' });
|
|
9193
9202
|
}
|
|
9194
9203
|
function parseModule(source, options) {
|
|
9195
|
-
return parseSource(source, options,
|
|
9204
|
+
return parseSource(source, { ...options, sourceType: 'module' });
|
|
9196
9205
|
}
|
|
9197
9206
|
function parse(source, options) {
|
|
9198
9207
|
return parseSource(source, options);
|