requirejs-esm 4.0.0 → 4.1.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/README.md +7 -1
- package/dist/api.js +1094 -1053
- package/dist/api.js.map +1 -1
- package/dist/plugin.js +1108 -1055
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -3
- package/src/api.d.ts +26 -0
- package/src/plugin.js +14 -2
- package/src/transform.js +18 -2
- package/src/transformer/amd.js +5 -0
- package/src/transformer/esm.js +11 -0
- package/src/transformer/index.js +1 -1
package/dist/plugin.js
CHANGED
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
const result = new Uint32Array(69632);
|
|
173
173
|
let index = 0;
|
|
174
174
|
let subIndex = 0;
|
|
175
|
-
while (index <
|
|
175
|
+
while (index < 2597) {
|
|
176
176
|
const inst = compressed[index++];
|
|
177
177
|
if (inst < 0) {
|
|
178
178
|
subIndex -= inst;
|
|
@@ -190,78 +190,10 @@
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
return result;
|
|
193
|
-
})([-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]);
|
|
193
|
+
})([-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]);
|
|
194
194
|
const isIDContinue = (code) => (unicodeLookup[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
|
|
195
195
|
const isIDStart = (code) => (unicodeLookup[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
|
|
196
196
|
|
|
197
|
-
function advanceChar(parser) {
|
|
198
|
-
parser.column++;
|
|
199
|
-
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
200
|
-
}
|
|
201
|
-
function consumePossibleSurrogatePair(parser) {
|
|
202
|
-
const hi = parser.currentChar;
|
|
203
|
-
if ((hi & 0xfc00) !== 55296)
|
|
204
|
-
return 0;
|
|
205
|
-
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
206
|
-
if ((lo & 0xfc00) !== 56320)
|
|
207
|
-
return 0;
|
|
208
|
-
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
209
|
-
}
|
|
210
|
-
function consumeLineFeed(parser, state) {
|
|
211
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
212
|
-
parser.flags |= 1;
|
|
213
|
-
if ((state & 4) === 0) {
|
|
214
|
-
parser.column = 0;
|
|
215
|
-
parser.line++;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function scanNewLine(parser) {
|
|
219
|
-
parser.flags |= 1;
|
|
220
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
221
|
-
parser.column = 0;
|
|
222
|
-
parser.line++;
|
|
223
|
-
}
|
|
224
|
-
function isExoticECMAScriptWhitespace(ch) {
|
|
225
|
-
return (ch === 160 ||
|
|
226
|
-
ch === 65279 ||
|
|
227
|
-
ch === 133 ||
|
|
228
|
-
ch === 5760 ||
|
|
229
|
-
(ch >= 8192 && ch <= 8203) ||
|
|
230
|
-
ch === 8239 ||
|
|
231
|
-
ch === 8287 ||
|
|
232
|
-
ch === 12288 ||
|
|
233
|
-
ch === 8201 ||
|
|
234
|
-
ch === 65519);
|
|
235
|
-
}
|
|
236
|
-
function toHex(code) {
|
|
237
|
-
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
238
|
-
}
|
|
239
|
-
function convertTokenType(t) {
|
|
240
|
-
switch (t) {
|
|
241
|
-
case 134283266:
|
|
242
|
-
return 'NumericLiteral';
|
|
243
|
-
case 134283267:
|
|
244
|
-
return 'StringLiteral';
|
|
245
|
-
case 86021:
|
|
246
|
-
case 86022:
|
|
247
|
-
return 'BooleanLiteral';
|
|
248
|
-
case 86023:
|
|
249
|
-
return 'NullLiteral';
|
|
250
|
-
case 65540:
|
|
251
|
-
return 'RegularExpression';
|
|
252
|
-
case 67174408:
|
|
253
|
-
case 67174409:
|
|
254
|
-
case 131:
|
|
255
|
-
return 'TemplateLiteral';
|
|
256
|
-
default:
|
|
257
|
-
if ((t & 143360) === 143360)
|
|
258
|
-
return 'Identifier';
|
|
259
|
-
if ((t & 4096) === 4096)
|
|
260
|
-
return 'Keyword';
|
|
261
|
-
return 'Punctuator';
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
197
|
const CharTypes = [
|
|
266
198
|
0,
|
|
267
199
|
0,
|
|
@@ -663,6 +595,74 @@
|
|
|
663
595
|
: isIDContinue(code) || (code === 8204 || code === 8205);
|
|
664
596
|
}
|
|
665
597
|
|
|
598
|
+
function advanceChar(parser) {
|
|
599
|
+
parser.column++;
|
|
600
|
+
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
601
|
+
}
|
|
602
|
+
function consumePossibleSurrogatePair(parser) {
|
|
603
|
+
const hi = parser.currentChar;
|
|
604
|
+
if ((hi & 0xfc00) !== 55296)
|
|
605
|
+
return 0;
|
|
606
|
+
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
607
|
+
if ((lo & 0xfc00) !== 56320)
|
|
608
|
+
return 0;
|
|
609
|
+
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
610
|
+
}
|
|
611
|
+
function consumeLineFeed(parser, state) {
|
|
612
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
613
|
+
parser.flags |= 1;
|
|
614
|
+
if ((state & 4) === 0) {
|
|
615
|
+
parser.column = 0;
|
|
616
|
+
parser.line++;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function scanNewLine(parser) {
|
|
620
|
+
parser.flags |= 1;
|
|
621
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
622
|
+
parser.column = 0;
|
|
623
|
+
parser.line++;
|
|
624
|
+
}
|
|
625
|
+
function isExoticECMAScriptWhitespace(ch) {
|
|
626
|
+
return (ch === 160 ||
|
|
627
|
+
ch === 65279 ||
|
|
628
|
+
ch === 133 ||
|
|
629
|
+
ch === 5760 ||
|
|
630
|
+
(ch >= 8192 && ch <= 8203) ||
|
|
631
|
+
ch === 8239 ||
|
|
632
|
+
ch === 8287 ||
|
|
633
|
+
ch === 12288 ||
|
|
634
|
+
ch === 8201 ||
|
|
635
|
+
ch === 65519);
|
|
636
|
+
}
|
|
637
|
+
function toHex(code) {
|
|
638
|
+
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
639
|
+
}
|
|
640
|
+
function convertTokenType(t) {
|
|
641
|
+
switch (t) {
|
|
642
|
+
case 134283266:
|
|
643
|
+
return 'NumericLiteral';
|
|
644
|
+
case 134283267:
|
|
645
|
+
return 'StringLiteral';
|
|
646
|
+
case 86021:
|
|
647
|
+
case 86022:
|
|
648
|
+
return 'BooleanLiteral';
|
|
649
|
+
case 86023:
|
|
650
|
+
return 'NullLiteral';
|
|
651
|
+
case 65540:
|
|
652
|
+
return 'RegularExpression';
|
|
653
|
+
case 67174408:
|
|
654
|
+
case 67174409:
|
|
655
|
+
case 131:
|
|
656
|
+
return 'TemplateLiteral';
|
|
657
|
+
default:
|
|
658
|
+
if ((t & 143360) === 143360)
|
|
659
|
+
return 'Identifier';
|
|
660
|
+
if ((t & 4096) === 4096)
|
|
661
|
+
return 'Keyword';
|
|
662
|
+
return 'Punctuator';
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
666
|
const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment'];
|
|
667
667
|
function skipHashBang(parser) {
|
|
668
668
|
const { source } = parser;
|
|
@@ -774,63 +774,700 @@
|
|
|
774
774
|
parser.report(18);
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
777
|
+
const errorMessages = {
|
|
778
|
+
[0]: 'Unexpected token',
|
|
779
|
+
[30]: "Unexpected token: '%0'",
|
|
780
|
+
[1]: 'Octal escape sequences are not allowed in strict mode',
|
|
781
|
+
[2]: 'Octal escape sequences are not allowed in template strings',
|
|
782
|
+
[3]: '\\8 and \\9 are not allowed in template strings',
|
|
783
|
+
[4]: 'Private identifier #%0 is not defined',
|
|
784
|
+
[5]: 'Illegal Unicode escape sequence',
|
|
785
|
+
[6]: 'Invalid code point %0',
|
|
786
|
+
[7]: 'Invalid hexadecimal escape sequence',
|
|
787
|
+
[9]: 'Octal literals are not allowed in strict mode',
|
|
788
|
+
[8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
|
|
789
|
+
[10]: 'Expected number in radix %0',
|
|
790
|
+
[151]: 'Invalid left-hand side assignment to a destructible right-hand side',
|
|
791
|
+
[11]: 'Non-number found after exponent indicator',
|
|
792
|
+
[12]: 'Invalid BigIntLiteral',
|
|
793
|
+
[13]: 'No identifiers allowed directly after numeric literal',
|
|
794
|
+
[14]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
|
|
795
|
+
[15]: 'Escapes \\8 or \\9 are not allowed in strict mode',
|
|
796
|
+
[16]: 'Unterminated string literal',
|
|
797
|
+
[17]: 'Unterminated template literal',
|
|
798
|
+
[18]: 'Multiline comment was not closed properly',
|
|
799
|
+
[19]: 'The identifier contained dynamic unicode escape that was not closed',
|
|
800
|
+
[20]: "Illegal character '%0'",
|
|
801
|
+
[21]: 'Missing hexadecimal digits',
|
|
802
|
+
[22]: 'Invalid implicit octal',
|
|
803
|
+
[23]: 'Invalid line break in string literal',
|
|
804
|
+
[24]: 'Only unicode escapes are legal in identifier names',
|
|
805
|
+
[25]: "Expected '%0'",
|
|
806
|
+
[26]: 'Invalid left-hand side in assignment',
|
|
807
|
+
[27]: 'Invalid left-hand side in async arrow',
|
|
808
|
+
[28]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',
|
|
809
|
+
[29]: 'Member access on super must be in a method',
|
|
810
|
+
[31]: 'Await expression not allowed in formal parameter',
|
|
811
|
+
[32]: 'Yield expression not allowed in formal parameter',
|
|
812
|
+
[95]: "Unexpected token: 'escaped keyword'",
|
|
813
|
+
[33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
|
|
814
|
+
[123]: 'Async functions can only be declared at the top level or inside a block',
|
|
815
|
+
[34]: 'Unterminated regular expression',
|
|
816
|
+
[35]: 'Unexpected regular expression flag',
|
|
817
|
+
[36]: "Duplicate regular expression flag '%0'",
|
|
818
|
+
[37]: '%0 functions must have exactly %1 argument%2',
|
|
819
|
+
[38]: 'Setter function argument must not be a rest parameter',
|
|
820
|
+
[39]: '%0 declaration must have a name in this context',
|
|
821
|
+
[40]: 'Function name may not contain any reserved words or be eval or arguments in strict mode',
|
|
822
|
+
[41]: 'The rest operator is missing an argument',
|
|
823
|
+
[42]: 'A getter cannot be a generator',
|
|
824
|
+
[43]: 'A setter cannot be a generator',
|
|
825
|
+
[44]: 'A computed property name must be followed by a colon or paren',
|
|
826
|
+
[134]: 'Object literal keys that are strings or numbers must be a method or have a colon',
|
|
827
|
+
[46]: 'Found `* async x(){}` but this should be `async * x(){}`',
|
|
828
|
+
[45]: 'Getters and setters can not be generators',
|
|
829
|
+
[47]: "'%0' can not be generator method",
|
|
830
|
+
[48]: "No line break is allowed after '=>'",
|
|
831
|
+
[49]: 'The left-hand side of the arrow can only be destructed through assignment',
|
|
832
|
+
[50]: 'The binding declaration is not destructible',
|
|
833
|
+
[51]: 'Async arrow can not be followed by new expression',
|
|
834
|
+
[52]: "Classes may not have a static property named 'prototype'",
|
|
835
|
+
[53]: 'Class constructor may not be a %0',
|
|
836
|
+
[54]: 'Duplicate constructor method in class',
|
|
837
|
+
[55]: 'Invalid increment/decrement operand',
|
|
838
|
+
[56]: 'Invalid use of `new` keyword on an increment/decrement expression',
|
|
839
|
+
[57]: '`=>` is an invalid assignment target',
|
|
840
|
+
[58]: 'Rest element may not have a trailing comma',
|
|
841
|
+
[59]: 'Missing initializer in %0 declaration',
|
|
842
|
+
[60]: "'for-%0' loop head declarations can not have an initializer",
|
|
843
|
+
[61]: 'Invalid left-hand side in for-%0 loop: Must have a single binding',
|
|
844
|
+
[62]: 'Invalid shorthand property initializer',
|
|
845
|
+
[63]: 'Property name __proto__ appears more than once in object literal',
|
|
846
|
+
[64]: 'Let is disallowed as a lexically bound name',
|
|
847
|
+
[65]: "Invalid use of '%0' inside new expression",
|
|
848
|
+
[66]: "Illegal 'use strict' directive in function with non-simple parameter list",
|
|
849
|
+
[67]: 'Identifier "let" disallowed as left-hand side expression in strict mode',
|
|
850
|
+
[68]: 'Illegal continue statement',
|
|
851
|
+
[69]: 'Illegal break statement',
|
|
852
|
+
[70]: 'Cannot have `let[...]` as a var name in strict mode',
|
|
853
|
+
[71]: 'Invalid destructuring assignment target',
|
|
854
|
+
[72]: 'Rest parameter may not have a default initializer',
|
|
855
|
+
[73]: 'The rest argument must the be last parameter',
|
|
856
|
+
[74]: 'Invalid rest argument',
|
|
857
|
+
[76]: 'In strict mode code, functions can only be declared at top level or inside a block',
|
|
858
|
+
[77]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
|
|
859
|
+
[78]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement',
|
|
860
|
+
[79]: "Class declaration can't appear in single-statement context",
|
|
861
|
+
[80]: 'Invalid left-hand side in for-%0',
|
|
862
|
+
[81]: 'Invalid assignment in for-%0',
|
|
863
|
+
[82]: 'for await (... of ...) is only valid in async functions and async generators',
|
|
864
|
+
[83]: 'The first token after the template expression should be a continuation of the template',
|
|
865
|
+
[85]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode',
|
|
866
|
+
[84]: '`let \n [` is a restricted production at the start of a statement',
|
|
867
|
+
[86]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)',
|
|
868
|
+
[87]: 'Catch clause parameter does not support default values',
|
|
869
|
+
[88]: 'Missing catch or finally after try',
|
|
870
|
+
[89]: 'More than one default clause in switch statement',
|
|
871
|
+
[90]: 'Illegal newline after throw',
|
|
872
|
+
[91]: 'Strict mode code may not include a with statement',
|
|
873
|
+
[92]: 'Illegal return statement',
|
|
874
|
+
[93]: 'The left hand side of the for-header binding declaration is not destructible',
|
|
875
|
+
[94]: 'new.target only allowed within functions or static blocks',
|
|
876
|
+
[96]: "'#' not followed by identifier",
|
|
877
|
+
[102]: 'Invalid keyword',
|
|
878
|
+
[101]: "Can not use 'let' as a class name",
|
|
879
|
+
[100]: "'A lexical declaration can't define a 'let' binding",
|
|
880
|
+
[99]: 'Can not use `let` as variable name in strict mode',
|
|
881
|
+
[97]: "'%0' may not be used as an identifier in this context",
|
|
882
|
+
[98]: 'Await is only valid in async functions',
|
|
883
|
+
[103]: 'The %0 keyword can only be used with the module goal',
|
|
884
|
+
[104]: 'Unicode codepoint must not be greater than 0x10FFFF',
|
|
885
|
+
[105]: '%0 source must be string',
|
|
886
|
+
[106]: 'Only a identifier or string can be used to indicate alias',
|
|
887
|
+
[107]: "Only '*' or '{...}' can be imported after default",
|
|
888
|
+
[108]: 'Trailing decorator may be followed by method',
|
|
889
|
+
[109]: "Decorators can't be used with a constructor",
|
|
890
|
+
[110]: 'Can not use `await` as identifier in module or async func',
|
|
891
|
+
[111]: 'Can not use `await` as identifier in module',
|
|
892
|
+
[112]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
893
|
+
[113]: "The identifier 'let' must not be in expression position in strict mode",
|
|
894
|
+
[114]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
895
|
+
[115]: "The left-hand side of a for-of loop may not start with 'let'",
|
|
896
|
+
[116]: 'Block body arrows can not be immediately invoked without a group',
|
|
897
|
+
[117]: 'Block body arrows can not be immediately accessed without a group',
|
|
898
|
+
[118]: 'Unexpected strict mode reserved word',
|
|
899
|
+
[119]: 'Unexpected eval or arguments in strict mode',
|
|
900
|
+
[120]: 'Decorators must not be followed by a semicolon',
|
|
901
|
+
[121]: 'Calling delete on expression not allowed in strict mode',
|
|
902
|
+
[122]: 'Pattern can not have a tail',
|
|
903
|
+
[124]: 'Can not have a `yield` expression on the left side of a ternary',
|
|
904
|
+
[125]: 'An arrow function can not have a postfix update operator',
|
|
905
|
+
[126]: 'Invalid object literal key character after generator star',
|
|
906
|
+
[127]: 'Private fields can not be deleted',
|
|
907
|
+
[129]: 'Classes may not have a field called constructor',
|
|
908
|
+
[128]: 'Classes may not have a private element named constructor',
|
|
909
|
+
[130]: 'A class field initializer or static block may not contain arguments',
|
|
910
|
+
[131]: 'Generators can only be declared at the top level or inside a block',
|
|
911
|
+
[132]: 'Async methods are a restricted production and cannot have a newline following it',
|
|
912
|
+
[133]: 'Unexpected character after object literal property name',
|
|
913
|
+
[135]: 'Invalid key token',
|
|
914
|
+
[136]: "Label '%0' has already been declared",
|
|
915
|
+
[137]: 'continue statement must be nested within an iteration statement',
|
|
916
|
+
[138]: "Undefined label '%0'",
|
|
917
|
+
[139]: 'Trailing comma is disallowed inside import(...) arguments',
|
|
918
|
+
[140]: 'Invalid binding in JSON import',
|
|
919
|
+
[141]: 'import() requires exactly one argument',
|
|
920
|
+
[142]: 'Cannot use new with import(...)',
|
|
921
|
+
[143]: '... is not allowed in import()',
|
|
922
|
+
[144]: "Expected '=>'",
|
|
923
|
+
[145]: "Duplicate binding '%0'",
|
|
924
|
+
[146]: 'Duplicate private identifier #%0',
|
|
925
|
+
[147]: "Cannot export a duplicate name '%0'",
|
|
926
|
+
[150]: 'Duplicate %0 for-binding',
|
|
927
|
+
[148]: "Exported binding '%0' needs to refer to a top-level declared variable",
|
|
928
|
+
[149]: 'Unexpected private field',
|
|
929
|
+
[153]: 'Numeric separators are not allowed at the end of numeric literals',
|
|
930
|
+
[152]: 'Only one underscore is allowed as numeric separator',
|
|
931
|
+
[154]: 'JSX value should be either an expression or a quoted JSX text',
|
|
932
|
+
[155]: 'Expected corresponding JSX closing tag for %0',
|
|
933
|
+
[156]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
|
|
934
|
+
[157]: "JSX attributes must only be assigned a non-empty 'expression'",
|
|
935
|
+
[158]: "'%0' has already been declared",
|
|
936
|
+
[159]: "'%0' shadowed a catch clause binding",
|
|
937
|
+
[160]: 'Dot property must be an identifier',
|
|
938
|
+
[161]: 'Encountered invalid input after spread/rest argument',
|
|
939
|
+
[162]: 'Catch without try',
|
|
940
|
+
[163]: 'Finally without try',
|
|
941
|
+
[164]: 'Expected corresponding closing tag for JSX fragment',
|
|
942
|
+
[165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
|
|
943
|
+
[166]: 'Invalid tagged template on optional chain',
|
|
944
|
+
[167]: 'Invalid optional chain from super property',
|
|
945
|
+
[168]: 'Invalid optional chain from new expression',
|
|
946
|
+
[169]: 'Cannot use "import.meta" outside a module',
|
|
947
|
+
[170]: 'Leading decorators must be attached to a class declaration',
|
|
948
|
+
[171]: 'An export name cannot include a lone surrogate',
|
|
949
|
+
[172]: 'A string literal cannot be used as an exported binding without `from`',
|
|
950
|
+
[173]: "Private fields can't be accessed on super",
|
|
951
|
+
[174]: "The only valid meta property for import is 'import.meta'",
|
|
952
|
+
[175]: "'import.meta' must not contain escaped characters",
|
|
953
|
+
[176]: 'cannot use "await" as identifier inside an async function',
|
|
954
|
+
[177]: 'cannot use "await" in static blocks',
|
|
955
|
+
};
|
|
956
|
+
class ParseError extends SyntaxError {
|
|
957
|
+
start;
|
|
958
|
+
end;
|
|
959
|
+
range;
|
|
960
|
+
loc;
|
|
961
|
+
description;
|
|
962
|
+
constructor(start, end, type, ...params) {
|
|
963
|
+
const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
|
|
964
|
+
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
965
|
+
super(message);
|
|
966
|
+
this.start = start.index;
|
|
967
|
+
this.end = end.index;
|
|
968
|
+
this.range = [start.index, end.index];
|
|
969
|
+
this.loc = {
|
|
970
|
+
start: { line: start.line, column: start.column },
|
|
971
|
+
end: { line: end.line, column: end.column },
|
|
972
|
+
};
|
|
973
|
+
this.description = description;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function getOwnProperty(object, key) {
|
|
978
|
+
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const KeywordDescTable = [
|
|
982
|
+
'end of source',
|
|
983
|
+
'identifier', 'number', 'string', 'regular expression',
|
|
984
|
+
'false', 'true', 'null',
|
|
985
|
+
'template continuation', 'template tail',
|
|
986
|
+
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
987
|
+
'++', '--',
|
|
988
|
+
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
989
|
+
'&=', '||=', '&&=', '??=',
|
|
990
|
+
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
991
|
+
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
992
|
+
'var', 'let', 'const',
|
|
993
|
+
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
994
|
+
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
995
|
+
'this', 'throw', 'try', 'while', 'with',
|
|
996
|
+
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
997
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
998
|
+
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
999
|
+
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
1000
|
+
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
1001
|
+
];
|
|
1002
|
+
const descKeywordTable = {
|
|
1003
|
+
this: 86111,
|
|
1004
|
+
function: 86104,
|
|
1005
|
+
if: 20569,
|
|
1006
|
+
return: 20572,
|
|
1007
|
+
var: 86088,
|
|
1008
|
+
else: 20563,
|
|
1009
|
+
for: 20567,
|
|
1010
|
+
new: 86107,
|
|
1011
|
+
in: 8673330,
|
|
1012
|
+
typeof: 16863275,
|
|
1013
|
+
while: 20578,
|
|
1014
|
+
case: 20556,
|
|
1015
|
+
break: 20555,
|
|
1016
|
+
try: 20577,
|
|
1017
|
+
catch: 20557,
|
|
1018
|
+
delete: 16863276,
|
|
1019
|
+
throw: 86112,
|
|
1020
|
+
switch: 86110,
|
|
1021
|
+
continue: 20559,
|
|
1022
|
+
default: 20561,
|
|
1023
|
+
instanceof: 8411187,
|
|
1024
|
+
do: 20562,
|
|
1025
|
+
void: 16863277,
|
|
1026
|
+
finally: 20566,
|
|
1027
|
+
async: 209005,
|
|
1028
|
+
await: 209006,
|
|
1029
|
+
class: 86094,
|
|
1030
|
+
const: 86090,
|
|
1031
|
+
constructor: 12399,
|
|
1032
|
+
debugger: 20560,
|
|
1033
|
+
export: 20564,
|
|
1034
|
+
extends: 20565,
|
|
1035
|
+
false: 86021,
|
|
1036
|
+
from: 209011,
|
|
1037
|
+
get: 209008,
|
|
1038
|
+
implements: 36964,
|
|
1039
|
+
import: 86106,
|
|
1040
|
+
interface: 36965,
|
|
1041
|
+
let: 241737,
|
|
1042
|
+
null: 86023,
|
|
1043
|
+
of: 471156,
|
|
1044
|
+
package: 36966,
|
|
1045
|
+
private: 36967,
|
|
1046
|
+
protected: 36968,
|
|
1047
|
+
public: 36969,
|
|
1048
|
+
set: 209009,
|
|
1049
|
+
static: 36970,
|
|
1050
|
+
super: 86109,
|
|
1051
|
+
true: 86022,
|
|
1052
|
+
with: 20579,
|
|
1053
|
+
yield: 241771,
|
|
1054
|
+
enum: 86133,
|
|
1055
|
+
eval: 537079926,
|
|
1056
|
+
as: 77932,
|
|
1057
|
+
arguments: 537079927,
|
|
1058
|
+
target: 209029,
|
|
1059
|
+
meta: 209030,
|
|
1060
|
+
accessor: 12402,
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
1064
|
+
while (isIdPart[advanceChar(parser)])
|
|
1065
|
+
;
|
|
1066
|
+
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1067
|
+
return parser.currentChar !== 92 && parser.currentChar <= 0x7e
|
|
1068
|
+
? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
|
|
1069
|
+
: scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
1070
|
+
}
|
|
1071
|
+
function scanUnicodeIdentifier(parser, context) {
|
|
1072
|
+
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
1073
|
+
if (!isIdentifierStart$1(cookedChar))
|
|
1074
|
+
parser.report(5);
|
|
1075
|
+
parser.tokenValue = String.fromCodePoint(cookedChar);
|
|
1076
|
+
return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
|
|
1077
|
+
}
|
|
1078
|
+
function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
1079
|
+
let start = parser.index;
|
|
1080
|
+
while (parser.index < parser.end) {
|
|
1081
|
+
if (parser.currentChar === 92) {
|
|
1082
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
1083
|
+
hasEscape = 1;
|
|
1084
|
+
const code = scanIdentifierUnicodeEscape(parser);
|
|
1085
|
+
if (!isIdentifierPart(code))
|
|
1086
|
+
parser.report(5);
|
|
1087
|
+
isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
|
|
1088
|
+
parser.tokenValue += String.fromCodePoint(code);
|
|
1089
|
+
start = parser.index;
|
|
803
1090
|
}
|
|
804
1091
|
else {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
break;
|
|
814
|
-
case 91:
|
|
815
|
-
preparseState |= RegexState.Class;
|
|
816
|
-
break;
|
|
817
|
-
case 93:
|
|
818
|
-
preparseState &= RegexState.Escape;
|
|
819
|
-
break;
|
|
1092
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
1093
|
+
if (merged > 0) {
|
|
1094
|
+
if (!isIdentifierPart(merged)) {
|
|
1095
|
+
parser.report(20, String.fromCodePoint(merged));
|
|
1096
|
+
}
|
|
1097
|
+
parser.currentChar = merged;
|
|
1098
|
+
parser.index++;
|
|
1099
|
+
parser.column++;
|
|
820
1100
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
ch === 8233) {
|
|
826
|
-
parser.report(34);
|
|
827
|
-
}
|
|
828
|
-
if (parser.index >= parser.source.length) {
|
|
829
|
-
return parser.report(34);
|
|
1101
|
+
else if (!isIdentifierPart(parser.currentChar)) {
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
advanceChar(parser);
|
|
830
1105
|
}
|
|
831
1106
|
}
|
|
832
|
-
|
|
833
|
-
|
|
1107
|
+
if (parser.index <= parser.end) {
|
|
1108
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
1109
|
+
}
|
|
1110
|
+
const { length } = parser.tokenValue;
|
|
1111
|
+
if (isValidAsKeyword && length >= 2 && length <= 11) {
|
|
1112
|
+
const token = getOwnProperty(descKeywordTable, parser.tokenValue);
|
|
1113
|
+
if (token === void 0)
|
|
1114
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
1115
|
+
if (!hasEscape)
|
|
1116
|
+
return token;
|
|
1117
|
+
if (token === 209006) {
|
|
1118
|
+
if ((context & (2 | 2048)) === 0) {
|
|
1119
|
+
return token | -2147483648;
|
|
1120
|
+
}
|
|
1121
|
+
return -2147483528;
|
|
1122
|
+
}
|
|
1123
|
+
if (context & 1) {
|
|
1124
|
+
if (token === 36970) {
|
|
1125
|
+
return -2147483527;
|
|
1126
|
+
}
|
|
1127
|
+
if ((token & 36864) === 36864) {
|
|
1128
|
+
return -2147483527;
|
|
1129
|
+
}
|
|
1130
|
+
if ((token & 20480) === 20480) {
|
|
1131
|
+
if (context & 262144 && (context & 8) === 0) {
|
|
1132
|
+
return token | -2147483648;
|
|
1133
|
+
}
|
|
1134
|
+
else {
|
|
1135
|
+
return -2147483528;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
return 209018 | -2147483648;
|
|
1139
|
+
}
|
|
1140
|
+
if (context & 262144 &&
|
|
1141
|
+
(context & 8) === 0 &&
|
|
1142
|
+
(token & 20480) === 20480) {
|
|
1143
|
+
return token | -2147483648;
|
|
1144
|
+
}
|
|
1145
|
+
if (token === 241771) {
|
|
1146
|
+
return context & 262144
|
|
1147
|
+
? 209018 | -2147483648
|
|
1148
|
+
: context & 1024
|
|
1149
|
+
? -2147483528
|
|
1150
|
+
: token | -2147483648;
|
|
1151
|
+
}
|
|
1152
|
+
if (token === 209005) {
|
|
1153
|
+
return 209018 | -2147483648;
|
|
1154
|
+
}
|
|
1155
|
+
if ((token & 36864) === 36864) {
|
|
1156
|
+
return token | 12288 | -2147483648;
|
|
1157
|
+
}
|
|
1158
|
+
return -2147483528;
|
|
1159
|
+
}
|
|
1160
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
1161
|
+
}
|
|
1162
|
+
function scanPrivateIdentifier(parser) {
|
|
1163
|
+
let char = advanceChar(parser);
|
|
1164
|
+
if (char === 92)
|
|
1165
|
+
return 130;
|
|
1166
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
1167
|
+
if (merged)
|
|
1168
|
+
char = merged;
|
|
1169
|
+
if (!isIdentifierStart$1(char))
|
|
1170
|
+
parser.report(96);
|
|
1171
|
+
return 130;
|
|
1172
|
+
}
|
|
1173
|
+
function scanIdentifierUnicodeEscape(parser) {
|
|
1174
|
+
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1175
|
+
parser.report(5);
|
|
1176
|
+
}
|
|
1177
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1178
|
+
parser.column += 2;
|
|
1179
|
+
return scanUnicodeEscape(parser);
|
|
1180
|
+
}
|
|
1181
|
+
function scanUnicodeEscape(parser) {
|
|
1182
|
+
let codePoint = 0;
|
|
1183
|
+
const char = parser.currentChar;
|
|
1184
|
+
if (char === 123) {
|
|
1185
|
+
const begin = parser.index - 2;
|
|
1186
|
+
while (CharTypes[advanceChar(parser)] & 64) {
|
|
1187
|
+
codePoint = (codePoint << 4) | toHex(parser.currentChar);
|
|
1188
|
+
if (codePoint > 1114111)
|
|
1189
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
|
|
1190
|
+
}
|
|
1191
|
+
if (parser.currentChar !== 125) {
|
|
1192
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
|
|
1193
|
+
}
|
|
1194
|
+
advanceChar(parser);
|
|
1195
|
+
return codePoint;
|
|
1196
|
+
}
|
|
1197
|
+
if ((CharTypes[char] & 64) === 0)
|
|
1198
|
+
parser.report(7);
|
|
1199
|
+
const char2 = parser.source.charCodeAt(parser.index + 1);
|
|
1200
|
+
if ((CharTypes[char2] & 64) === 0)
|
|
1201
|
+
parser.report(7);
|
|
1202
|
+
const char3 = parser.source.charCodeAt(parser.index + 2);
|
|
1203
|
+
if ((CharTypes[char3] & 64) === 0)
|
|
1204
|
+
parser.report(7);
|
|
1205
|
+
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
1206
|
+
if ((CharTypes[char4] & 64) === 0)
|
|
1207
|
+
parser.report(7);
|
|
1208
|
+
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1209
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1210
|
+
parser.column += 4;
|
|
1211
|
+
return codePoint;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
function scanNumber(parser, context, kind) {
|
|
1215
|
+
let char = parser.currentChar;
|
|
1216
|
+
let value = 0;
|
|
1217
|
+
let digit = 9;
|
|
1218
|
+
let atStart = kind & 64 ? 0 : 1;
|
|
1219
|
+
let digits = 0;
|
|
1220
|
+
let allowSeparator = 0;
|
|
1221
|
+
if (kind & 64) {
|
|
1222
|
+
value = '.' + scanDecimalDigitsOrSeparator(parser, char);
|
|
1223
|
+
char = parser.currentChar;
|
|
1224
|
+
if (char === 110)
|
|
1225
|
+
parser.report(12);
|
|
1226
|
+
}
|
|
1227
|
+
else {
|
|
1228
|
+
if (char === 48) {
|
|
1229
|
+
char = advanceChar(parser);
|
|
1230
|
+
if ((char | 32) === 120) {
|
|
1231
|
+
kind = 8 | 128;
|
|
1232
|
+
char = advanceChar(parser);
|
|
1233
|
+
while (CharTypes[char] & (64 | 4096)) {
|
|
1234
|
+
if (char === 95) {
|
|
1235
|
+
if (!allowSeparator)
|
|
1236
|
+
parser.report(152);
|
|
1237
|
+
allowSeparator = 0;
|
|
1238
|
+
char = advanceChar(parser);
|
|
1239
|
+
continue;
|
|
1240
|
+
}
|
|
1241
|
+
allowSeparator = 1;
|
|
1242
|
+
value = value * 0x10 + toHex(char);
|
|
1243
|
+
digits++;
|
|
1244
|
+
char = advanceChar(parser);
|
|
1245
|
+
}
|
|
1246
|
+
if (digits === 0 || !allowSeparator) {
|
|
1247
|
+
parser.report(digits === 0 ? 21 : 153);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
else if ((char | 32) === 111) {
|
|
1251
|
+
kind = 4 | 128;
|
|
1252
|
+
char = advanceChar(parser);
|
|
1253
|
+
while (CharTypes[char] & (32 | 4096)) {
|
|
1254
|
+
if (char === 95) {
|
|
1255
|
+
if (!allowSeparator) {
|
|
1256
|
+
parser.report(152);
|
|
1257
|
+
}
|
|
1258
|
+
allowSeparator = 0;
|
|
1259
|
+
char = advanceChar(parser);
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1262
|
+
allowSeparator = 1;
|
|
1263
|
+
value = value * 8 + (char - 48);
|
|
1264
|
+
digits++;
|
|
1265
|
+
char = advanceChar(parser);
|
|
1266
|
+
}
|
|
1267
|
+
if (digits === 0 || !allowSeparator) {
|
|
1268
|
+
parser.report(digits === 0 ? 0 : 153);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
else if ((char | 32) === 98) {
|
|
1272
|
+
kind = 2 | 128;
|
|
1273
|
+
char = advanceChar(parser);
|
|
1274
|
+
while (CharTypes[char] & (128 | 4096)) {
|
|
1275
|
+
if (char === 95) {
|
|
1276
|
+
if (!allowSeparator) {
|
|
1277
|
+
parser.report(152);
|
|
1278
|
+
}
|
|
1279
|
+
allowSeparator = 0;
|
|
1280
|
+
char = advanceChar(parser);
|
|
1281
|
+
continue;
|
|
1282
|
+
}
|
|
1283
|
+
allowSeparator = 1;
|
|
1284
|
+
value = value * 2 + (char - 48);
|
|
1285
|
+
digits++;
|
|
1286
|
+
char = advanceChar(parser);
|
|
1287
|
+
}
|
|
1288
|
+
if (digits === 0 || !allowSeparator) {
|
|
1289
|
+
parser.report(digits === 0 ? 0 : 153);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
else if (CharTypes[char] & 32) {
|
|
1293
|
+
if (context & 1)
|
|
1294
|
+
parser.report(1);
|
|
1295
|
+
kind = 1;
|
|
1296
|
+
while (CharTypes[char] & 16) {
|
|
1297
|
+
if (CharTypes[char] & 512) {
|
|
1298
|
+
kind = 32;
|
|
1299
|
+
atStart = 0;
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
value = value * 8 + (char - 48);
|
|
1303
|
+
char = advanceChar(parser);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
else if (CharTypes[char] & 512) {
|
|
1307
|
+
if (context & 1)
|
|
1308
|
+
parser.report(1);
|
|
1309
|
+
parser.flags |= 64;
|
|
1310
|
+
kind = 32;
|
|
1311
|
+
}
|
|
1312
|
+
else if (char === 95) {
|
|
1313
|
+
parser.report(0);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (kind & 48) {
|
|
1317
|
+
if (atStart) {
|
|
1318
|
+
while (digit >= 0 && CharTypes[char] & (16 | 4096)) {
|
|
1319
|
+
if (char === 95) {
|
|
1320
|
+
char = advanceChar(parser);
|
|
1321
|
+
if (char === 95 || kind & 32) {
|
|
1322
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1323
|
+
}
|
|
1324
|
+
allowSeparator = 1;
|
|
1325
|
+
continue;
|
|
1326
|
+
}
|
|
1327
|
+
allowSeparator = 0;
|
|
1328
|
+
value = 10 * value + (char - 48);
|
|
1329
|
+
char = advanceChar(parser);
|
|
1330
|
+
--digit;
|
|
1331
|
+
}
|
|
1332
|
+
if (allowSeparator) {
|
|
1333
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1334
|
+
}
|
|
1335
|
+
if (digit >= 0 && !isIdentifierStart$1(char) && char !== 46) {
|
|
1336
|
+
parser.tokenValue = value;
|
|
1337
|
+
if (parser.options.raw)
|
|
1338
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1339
|
+
return 134283266;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
value += scanDecimalDigitsOrSeparator(parser, char);
|
|
1343
|
+
char = parser.currentChar;
|
|
1344
|
+
if (char === 46) {
|
|
1345
|
+
if (advanceChar(parser) === 95)
|
|
1346
|
+
parser.report(0);
|
|
1347
|
+
kind = 64;
|
|
1348
|
+
value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar);
|
|
1349
|
+
char = parser.currentChar;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
const end = parser.index;
|
|
1354
|
+
let isBigInt = 0;
|
|
1355
|
+
if (char === 110 && kind & 128) {
|
|
1356
|
+
isBigInt = 1;
|
|
1357
|
+
char = advanceChar(parser);
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
if ((char | 32) === 101) {
|
|
1361
|
+
char = advanceChar(parser);
|
|
1362
|
+
if (CharTypes[char] & 256)
|
|
1363
|
+
char = advanceChar(parser);
|
|
1364
|
+
const { index } = parser;
|
|
1365
|
+
if ((CharTypes[char] & 16) === 0)
|
|
1366
|
+
parser.report(11);
|
|
1367
|
+
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1368
|
+
char = parser.currentChar;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart$1(char)) {
|
|
1372
|
+
parser.report(13);
|
|
1373
|
+
}
|
|
1374
|
+
if (isBigInt) {
|
|
1375
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1376
|
+
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1377
|
+
return 134283388;
|
|
1378
|
+
}
|
|
1379
|
+
parser.tokenValue =
|
|
1380
|
+
kind & (1 | 2 | 8 | 4)
|
|
1381
|
+
? value
|
|
1382
|
+
: kind & 32
|
|
1383
|
+
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1384
|
+
: +value;
|
|
1385
|
+
if (parser.options.raw)
|
|
1386
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1387
|
+
return 134283266;
|
|
1388
|
+
}
|
|
1389
|
+
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1390
|
+
let allowSeparator = 0;
|
|
1391
|
+
let start = parser.index;
|
|
1392
|
+
let ret = '';
|
|
1393
|
+
while (CharTypes[char] & (16 | 4096)) {
|
|
1394
|
+
if (char === 95) {
|
|
1395
|
+
const { index } = parser;
|
|
1396
|
+
char = advanceChar(parser);
|
|
1397
|
+
if (char === 95) {
|
|
1398
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1399
|
+
}
|
|
1400
|
+
allowSeparator = 1;
|
|
1401
|
+
ret += parser.source.substring(start, index);
|
|
1402
|
+
start = parser.index;
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
allowSeparator = 0;
|
|
1406
|
+
char = advanceChar(parser);
|
|
1407
|
+
}
|
|
1408
|
+
if (allowSeparator) {
|
|
1409
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1410
|
+
}
|
|
1411
|
+
return ret + parser.source.substring(start, parser.index);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
var RegexState;
|
|
1415
|
+
(function (RegexState) {
|
|
1416
|
+
RegexState[RegexState["Empty"] = 0] = "Empty";
|
|
1417
|
+
RegexState[RegexState["Escape"] = 1] = "Escape";
|
|
1418
|
+
RegexState[RegexState["Class"] = 2] = "Class";
|
|
1419
|
+
})(RegexState || (RegexState = {}));
|
|
1420
|
+
var RegexFlags;
|
|
1421
|
+
(function (RegexFlags) {
|
|
1422
|
+
RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
|
|
1423
|
+
RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
|
|
1424
|
+
RegexFlags[RegexFlags["Global"] = 2] = "Global";
|
|
1425
|
+
RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
|
|
1426
|
+
RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
|
|
1427
|
+
RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
|
|
1428
|
+
RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
|
|
1429
|
+
RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
|
|
1430
|
+
RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
|
|
1431
|
+
})(RegexFlags || (RegexFlags = {}));
|
|
1432
|
+
function scanRegularExpression(parser) {
|
|
1433
|
+
const bodyStart = parser.index;
|
|
1434
|
+
let preparseState = RegexState.Empty;
|
|
1435
|
+
loop: while (true) {
|
|
1436
|
+
const ch = parser.currentChar;
|
|
1437
|
+
advanceChar(parser);
|
|
1438
|
+
if (preparseState & RegexState.Escape) {
|
|
1439
|
+
preparseState &= ~RegexState.Escape;
|
|
1440
|
+
}
|
|
1441
|
+
else {
|
|
1442
|
+
switch (ch) {
|
|
1443
|
+
case 47:
|
|
1444
|
+
if (!preparseState)
|
|
1445
|
+
break loop;
|
|
1446
|
+
else
|
|
1447
|
+
break;
|
|
1448
|
+
case 92:
|
|
1449
|
+
preparseState |= RegexState.Escape;
|
|
1450
|
+
break;
|
|
1451
|
+
case 91:
|
|
1452
|
+
preparseState |= RegexState.Class;
|
|
1453
|
+
break;
|
|
1454
|
+
case 93:
|
|
1455
|
+
preparseState &= RegexState.Escape;
|
|
1456
|
+
break;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
if (ch === 13 ||
|
|
1460
|
+
ch === 10 ||
|
|
1461
|
+
ch === 8232 ||
|
|
1462
|
+
ch === 8233) {
|
|
1463
|
+
parser.report(34);
|
|
1464
|
+
}
|
|
1465
|
+
if (parser.index >= parser.source.length) {
|
|
1466
|
+
return parser.report(34);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
const bodyEnd = parser.index - 1;
|
|
1470
|
+
let mask = RegexFlags.Empty;
|
|
834
1471
|
let char = parser.currentChar;
|
|
835
1472
|
const { index: flagStart } = parser;
|
|
836
1473
|
while (isIdentifierPart(char)) {
|
|
@@ -897,13 +1534,10 @@
|
|
|
897
1534
|
return new RegExp(pattern, flags);
|
|
898
1535
|
}
|
|
899
1536
|
catch {
|
|
900
|
-
|
|
901
|
-
new RegExp(pattern, flags);
|
|
1537
|
+
if (!parser.options.validateRegex) {
|
|
902
1538
|
return null;
|
|
903
1539
|
}
|
|
904
|
-
|
|
905
|
-
parser.report(34);
|
|
906
|
-
}
|
|
1540
|
+
parser.report(34);
|
|
907
1541
|
}
|
|
908
1542
|
}
|
|
909
1543
|
|
|
@@ -1192,824 +1826,6 @@
|
|
|
1192
1826
|
return scanTemplate(parser, context);
|
|
1193
1827
|
}
|
|
1194
1828
|
|
|
1195
|
-
const errorMessages = {
|
|
1196
|
-
[0]: 'Unexpected token',
|
|
1197
|
-
[30]: "Unexpected token: '%0'",
|
|
1198
|
-
[1]: 'Octal escape sequences are not allowed in strict mode',
|
|
1199
|
-
[2]: 'Octal escape sequences are not allowed in template strings',
|
|
1200
|
-
[3]: '\\8 and \\9 are not allowed in template strings',
|
|
1201
|
-
[4]: 'Private identifier #%0 is not defined',
|
|
1202
|
-
[5]: 'Illegal Unicode escape sequence',
|
|
1203
|
-
[6]: 'Invalid code point %0',
|
|
1204
|
-
[7]: 'Invalid hexadecimal escape sequence',
|
|
1205
|
-
[9]: 'Octal literals are not allowed in strict mode',
|
|
1206
|
-
[8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
|
|
1207
|
-
[10]: 'Expected number in radix %0',
|
|
1208
|
-
[151]: 'Invalid left-hand side assignment to a destructible right-hand side',
|
|
1209
|
-
[11]: 'Non-number found after exponent indicator',
|
|
1210
|
-
[12]: 'Invalid BigIntLiteral',
|
|
1211
|
-
[13]: 'No identifiers allowed directly after numeric literal',
|
|
1212
|
-
[14]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
|
|
1213
|
-
[15]: 'Escapes \\8 or \\9 are not allowed in strict mode',
|
|
1214
|
-
[16]: 'Unterminated string literal',
|
|
1215
|
-
[17]: 'Unterminated template literal',
|
|
1216
|
-
[18]: 'Multiline comment was not closed properly',
|
|
1217
|
-
[19]: 'The identifier contained dynamic unicode escape that was not closed',
|
|
1218
|
-
[20]: "Illegal character '%0'",
|
|
1219
|
-
[21]: 'Missing hexadecimal digits',
|
|
1220
|
-
[22]: 'Invalid implicit octal',
|
|
1221
|
-
[23]: 'Invalid line break in string literal',
|
|
1222
|
-
[24]: 'Only unicode escapes are legal in identifier names',
|
|
1223
|
-
[25]: "Expected '%0'",
|
|
1224
|
-
[26]: 'Invalid left-hand side in assignment',
|
|
1225
|
-
[27]: 'Invalid left-hand side in async arrow',
|
|
1226
|
-
[28]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',
|
|
1227
|
-
[29]: 'Member access on super must be in a method',
|
|
1228
|
-
[31]: 'Await expression not allowed in formal parameter',
|
|
1229
|
-
[32]: 'Yield expression not allowed in formal parameter',
|
|
1230
|
-
[95]: "Unexpected token: 'escaped keyword'",
|
|
1231
|
-
[33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
|
|
1232
|
-
[123]: 'Async functions can only be declared at the top level or inside a block',
|
|
1233
|
-
[34]: 'Unterminated regular expression',
|
|
1234
|
-
[35]: 'Unexpected regular expression flag',
|
|
1235
|
-
[36]: "Duplicate regular expression flag '%0'",
|
|
1236
|
-
[37]: '%0 functions must have exactly %1 argument%2',
|
|
1237
|
-
[38]: 'Setter function argument must not be a rest parameter',
|
|
1238
|
-
[39]: '%0 declaration must have a name in this context',
|
|
1239
|
-
[40]: 'Function name may not contain any reserved words or be eval or arguments in strict mode',
|
|
1240
|
-
[41]: 'The rest operator is missing an argument',
|
|
1241
|
-
[42]: 'A getter cannot be a generator',
|
|
1242
|
-
[43]: 'A setter cannot be a generator',
|
|
1243
|
-
[44]: 'A computed property name must be followed by a colon or paren',
|
|
1244
|
-
[134]: 'Object literal keys that are strings or numbers must be a method or have a colon',
|
|
1245
|
-
[46]: 'Found `* async x(){}` but this should be `async * x(){}`',
|
|
1246
|
-
[45]: 'Getters and setters can not be generators',
|
|
1247
|
-
[47]: "'%0' can not be generator method",
|
|
1248
|
-
[48]: "No line break is allowed after '=>'",
|
|
1249
|
-
[49]: 'The left-hand side of the arrow can only be destructed through assignment',
|
|
1250
|
-
[50]: 'The binding declaration is not destructible',
|
|
1251
|
-
[51]: 'Async arrow can not be followed by new expression',
|
|
1252
|
-
[52]: "Classes may not have a static property named 'prototype'",
|
|
1253
|
-
[53]: 'Class constructor may not be a %0',
|
|
1254
|
-
[54]: 'Duplicate constructor method in class',
|
|
1255
|
-
[55]: 'Invalid increment/decrement operand',
|
|
1256
|
-
[56]: 'Invalid use of `new` keyword on an increment/decrement expression',
|
|
1257
|
-
[57]: '`=>` is an invalid assignment target',
|
|
1258
|
-
[58]: 'Rest element may not have a trailing comma',
|
|
1259
|
-
[59]: 'Missing initializer in %0 declaration',
|
|
1260
|
-
[60]: "'for-%0' loop head declarations can not have an initializer",
|
|
1261
|
-
[61]: 'Invalid left-hand side in for-%0 loop: Must have a single binding',
|
|
1262
|
-
[62]: 'Invalid shorthand property initializer',
|
|
1263
|
-
[63]: 'Property name __proto__ appears more than once in object literal',
|
|
1264
|
-
[64]: 'Let is disallowed as a lexically bound name',
|
|
1265
|
-
[65]: "Invalid use of '%0' inside new expression",
|
|
1266
|
-
[66]: "Illegal 'use strict' directive in function with non-simple parameter list",
|
|
1267
|
-
[67]: 'Identifier "let" disallowed as left-hand side expression in strict mode',
|
|
1268
|
-
[68]: 'Illegal continue statement',
|
|
1269
|
-
[69]: 'Illegal break statement',
|
|
1270
|
-
[70]: 'Cannot have `let[...]` as a var name in strict mode',
|
|
1271
|
-
[71]: 'Invalid destructuring assignment target',
|
|
1272
|
-
[72]: 'Rest parameter may not have a default initializer',
|
|
1273
|
-
[73]: 'The rest argument must the be last parameter',
|
|
1274
|
-
[74]: 'Invalid rest argument',
|
|
1275
|
-
[76]: 'In strict mode code, functions can only be declared at top level or inside a block',
|
|
1276
|
-
[77]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
|
|
1277
|
-
[78]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement',
|
|
1278
|
-
[79]: "Class declaration can't appear in single-statement context",
|
|
1279
|
-
[80]: 'Invalid left-hand side in for-%0',
|
|
1280
|
-
[81]: 'Invalid assignment in for-%0',
|
|
1281
|
-
[82]: 'for await (... of ...) is only valid in async functions and async generators',
|
|
1282
|
-
[83]: 'The first token after the template expression should be a continuation of the template',
|
|
1283
|
-
[85]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode',
|
|
1284
|
-
[84]: '`let \n [` is a restricted production at the start of a statement',
|
|
1285
|
-
[86]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)',
|
|
1286
|
-
[87]: 'Catch clause parameter does not support default values',
|
|
1287
|
-
[88]: 'Missing catch or finally after try',
|
|
1288
|
-
[89]: 'More than one default clause in switch statement',
|
|
1289
|
-
[90]: 'Illegal newline after throw',
|
|
1290
|
-
[91]: 'Strict mode code may not include a with statement',
|
|
1291
|
-
[92]: 'Illegal return statement',
|
|
1292
|
-
[93]: 'The left hand side of the for-header binding declaration is not destructible',
|
|
1293
|
-
[94]: 'new.target only allowed within functions or static blocks',
|
|
1294
|
-
[96]: "'#' not followed by identifier",
|
|
1295
|
-
[102]: 'Invalid keyword',
|
|
1296
|
-
[101]: "Can not use 'let' as a class name",
|
|
1297
|
-
[100]: "'A lexical declaration can't define a 'let' binding",
|
|
1298
|
-
[99]: 'Can not use `let` as variable name in strict mode',
|
|
1299
|
-
[97]: "'%0' may not be used as an identifier in this context",
|
|
1300
|
-
[98]: 'Await is only valid in async functions',
|
|
1301
|
-
[103]: 'The %0 keyword can only be used with the module goal',
|
|
1302
|
-
[104]: 'Unicode codepoint must not be greater than 0x10FFFF',
|
|
1303
|
-
[105]: '%0 source must be string',
|
|
1304
|
-
[106]: 'Only a identifier or string can be used to indicate alias',
|
|
1305
|
-
[107]: "Only '*' or '{...}' can be imported after default",
|
|
1306
|
-
[108]: 'Trailing decorator may be followed by method',
|
|
1307
|
-
[109]: "Decorators can't be used with a constructor",
|
|
1308
|
-
[110]: 'Can not use `await` as identifier in module or async func',
|
|
1309
|
-
[111]: 'Can not use `await` as identifier in module',
|
|
1310
|
-
[112]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
1311
|
-
[113]: "The identifier 'let' must not be in expression position in strict mode",
|
|
1312
|
-
[114]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
1313
|
-
[115]: "The left-hand side of a for-of loop may not start with 'let'",
|
|
1314
|
-
[116]: 'Block body arrows can not be immediately invoked without a group',
|
|
1315
|
-
[117]: 'Block body arrows can not be immediately accessed without a group',
|
|
1316
|
-
[118]: 'Unexpected strict mode reserved word',
|
|
1317
|
-
[119]: 'Unexpected eval or arguments in strict mode',
|
|
1318
|
-
[120]: 'Decorators must not be followed by a semicolon',
|
|
1319
|
-
[121]: 'Calling delete on expression not allowed in strict mode',
|
|
1320
|
-
[122]: 'Pattern can not have a tail',
|
|
1321
|
-
[124]: 'Can not have a `yield` expression on the left side of a ternary',
|
|
1322
|
-
[125]: 'An arrow function can not have a postfix update operator',
|
|
1323
|
-
[126]: 'Invalid object literal key character after generator star',
|
|
1324
|
-
[127]: 'Private fields can not be deleted',
|
|
1325
|
-
[129]: 'Classes may not have a field called constructor',
|
|
1326
|
-
[128]: 'Classes may not have a private element named constructor',
|
|
1327
|
-
[130]: 'A class field initializer or static block may not contain arguments',
|
|
1328
|
-
[131]: 'Generators can only be declared at the top level or inside a block',
|
|
1329
|
-
[132]: 'Async methods are a restricted production and cannot have a newline following it',
|
|
1330
|
-
[133]: 'Unexpected character after object literal property name',
|
|
1331
|
-
[135]: 'Invalid key token',
|
|
1332
|
-
[136]: "Label '%0' has already been declared",
|
|
1333
|
-
[137]: 'continue statement must be nested within an iteration statement',
|
|
1334
|
-
[138]: "Undefined label '%0'",
|
|
1335
|
-
[139]: 'Trailing comma is disallowed inside import(...) arguments',
|
|
1336
|
-
[140]: 'Invalid binding in JSON import',
|
|
1337
|
-
[141]: 'import() requires exactly one argument',
|
|
1338
|
-
[142]: 'Cannot use new with import(...)',
|
|
1339
|
-
[143]: '... is not allowed in import()',
|
|
1340
|
-
[144]: "Expected '=>'",
|
|
1341
|
-
[145]: "Duplicate binding '%0'",
|
|
1342
|
-
[146]: 'Duplicate private identifier #%0',
|
|
1343
|
-
[147]: "Cannot export a duplicate name '%0'",
|
|
1344
|
-
[150]: 'Duplicate %0 for-binding',
|
|
1345
|
-
[148]: "Exported binding '%0' needs to refer to a top-level declared variable",
|
|
1346
|
-
[149]: 'Unexpected private field',
|
|
1347
|
-
[153]: 'Numeric separators are not allowed at the end of numeric literals',
|
|
1348
|
-
[152]: 'Only one underscore is allowed as numeric separator',
|
|
1349
|
-
[154]: 'JSX value should be either an expression or a quoted JSX text',
|
|
1350
|
-
[155]: 'Expected corresponding JSX closing tag for %0',
|
|
1351
|
-
[156]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
|
|
1352
|
-
[157]: "JSX attributes must only be assigned a non-empty 'expression'",
|
|
1353
|
-
[158]: "'%0' has already been declared",
|
|
1354
|
-
[159]: "'%0' shadowed a catch clause binding",
|
|
1355
|
-
[160]: 'Dot property must be an identifier',
|
|
1356
|
-
[161]: 'Encountered invalid input after spread/rest argument',
|
|
1357
|
-
[162]: 'Catch without try',
|
|
1358
|
-
[163]: 'Finally without try',
|
|
1359
|
-
[164]: 'Expected corresponding closing tag for JSX fragment',
|
|
1360
|
-
[165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
|
|
1361
|
-
[166]: 'Invalid tagged template on optional chain',
|
|
1362
|
-
[167]: 'Invalid optional chain from super property',
|
|
1363
|
-
[168]: 'Invalid optional chain from new expression',
|
|
1364
|
-
[169]: 'Cannot use "import.meta" outside a module',
|
|
1365
|
-
[170]: 'Leading decorators must be attached to a class declaration',
|
|
1366
|
-
[171]: 'An export name cannot include a lone surrogate, found %0',
|
|
1367
|
-
[172]: 'A string literal cannot be used as an exported binding without `from`',
|
|
1368
|
-
[173]: "Private fields can't be accessed on super",
|
|
1369
|
-
[174]: "The only valid meta property for import is 'import.meta'",
|
|
1370
|
-
[175]: "'import.meta' must not contain escaped characters",
|
|
1371
|
-
[176]: 'cannot use "await" as identifier inside an async function',
|
|
1372
|
-
[177]: 'cannot use "await" in static blocks',
|
|
1373
|
-
};
|
|
1374
|
-
class ParseError extends SyntaxError {
|
|
1375
|
-
start;
|
|
1376
|
-
end;
|
|
1377
|
-
range;
|
|
1378
|
-
loc;
|
|
1379
|
-
description;
|
|
1380
|
-
constructor(start, end, type, ...params) {
|
|
1381
|
-
const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
|
|
1382
|
-
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
1383
|
-
super(message);
|
|
1384
|
-
this.start = start.index;
|
|
1385
|
-
this.end = end.index;
|
|
1386
|
-
this.range = [start.index, end.index];
|
|
1387
|
-
this.loc = {
|
|
1388
|
-
start: { line: start.line, column: start.column },
|
|
1389
|
-
end: { line: end.line, column: end.column },
|
|
1390
|
-
};
|
|
1391
|
-
this.description = description;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
function scanNumber(parser, context, kind) {
|
|
1396
|
-
let char = parser.currentChar;
|
|
1397
|
-
let value = 0;
|
|
1398
|
-
let digit = 9;
|
|
1399
|
-
let atStart = kind & 64 ? 0 : 1;
|
|
1400
|
-
let digits = 0;
|
|
1401
|
-
let allowSeparator = 0;
|
|
1402
|
-
if (kind & 64) {
|
|
1403
|
-
value = '.' + scanDecimalDigitsOrSeparator(parser, char);
|
|
1404
|
-
char = parser.currentChar;
|
|
1405
|
-
if (char === 110)
|
|
1406
|
-
parser.report(12);
|
|
1407
|
-
}
|
|
1408
|
-
else {
|
|
1409
|
-
if (char === 48) {
|
|
1410
|
-
char = advanceChar(parser);
|
|
1411
|
-
if ((char | 32) === 120) {
|
|
1412
|
-
kind = 8 | 128;
|
|
1413
|
-
char = advanceChar(parser);
|
|
1414
|
-
while (CharTypes[char] & (64 | 4096)) {
|
|
1415
|
-
if (char === 95) {
|
|
1416
|
-
if (!allowSeparator)
|
|
1417
|
-
parser.report(152);
|
|
1418
|
-
allowSeparator = 0;
|
|
1419
|
-
char = advanceChar(parser);
|
|
1420
|
-
continue;
|
|
1421
|
-
}
|
|
1422
|
-
allowSeparator = 1;
|
|
1423
|
-
value = value * 0x10 + toHex(char);
|
|
1424
|
-
digits++;
|
|
1425
|
-
char = advanceChar(parser);
|
|
1426
|
-
}
|
|
1427
|
-
if (digits === 0 || !allowSeparator) {
|
|
1428
|
-
parser.report(digits === 0 ? 21 : 153);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
else if ((char | 32) === 111) {
|
|
1432
|
-
kind = 4 | 128;
|
|
1433
|
-
char = advanceChar(parser);
|
|
1434
|
-
while (CharTypes[char] & (32 | 4096)) {
|
|
1435
|
-
if (char === 95) {
|
|
1436
|
-
if (!allowSeparator) {
|
|
1437
|
-
parser.report(152);
|
|
1438
|
-
}
|
|
1439
|
-
allowSeparator = 0;
|
|
1440
|
-
char = advanceChar(parser);
|
|
1441
|
-
continue;
|
|
1442
|
-
}
|
|
1443
|
-
allowSeparator = 1;
|
|
1444
|
-
value = value * 8 + (char - 48);
|
|
1445
|
-
digits++;
|
|
1446
|
-
char = advanceChar(parser);
|
|
1447
|
-
}
|
|
1448
|
-
if (digits === 0 || !allowSeparator) {
|
|
1449
|
-
parser.report(digits === 0 ? 0 : 153);
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
else if ((char | 32) === 98) {
|
|
1453
|
-
kind = 2 | 128;
|
|
1454
|
-
char = advanceChar(parser);
|
|
1455
|
-
while (CharTypes[char] & (128 | 4096)) {
|
|
1456
|
-
if (char === 95) {
|
|
1457
|
-
if (!allowSeparator) {
|
|
1458
|
-
parser.report(152);
|
|
1459
|
-
}
|
|
1460
|
-
allowSeparator = 0;
|
|
1461
|
-
char = advanceChar(parser);
|
|
1462
|
-
continue;
|
|
1463
|
-
}
|
|
1464
|
-
allowSeparator = 1;
|
|
1465
|
-
value = value * 2 + (char - 48);
|
|
1466
|
-
digits++;
|
|
1467
|
-
char = advanceChar(parser);
|
|
1468
|
-
}
|
|
1469
|
-
if (digits === 0 || !allowSeparator) {
|
|
1470
|
-
parser.report(digits === 0 ? 0 : 153);
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
else if (CharTypes[char] & 32) {
|
|
1474
|
-
if (context & 1)
|
|
1475
|
-
parser.report(1);
|
|
1476
|
-
kind = 1;
|
|
1477
|
-
while (CharTypes[char] & 16) {
|
|
1478
|
-
if (CharTypes[char] & 512) {
|
|
1479
|
-
kind = 32;
|
|
1480
|
-
atStart = 0;
|
|
1481
|
-
break;
|
|
1482
|
-
}
|
|
1483
|
-
value = value * 8 + (char - 48);
|
|
1484
|
-
char = advanceChar(parser);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
else if (CharTypes[char] & 512) {
|
|
1488
|
-
if (context & 1)
|
|
1489
|
-
parser.report(1);
|
|
1490
|
-
parser.flags |= 64;
|
|
1491
|
-
kind = 32;
|
|
1492
|
-
}
|
|
1493
|
-
else if (char === 95) {
|
|
1494
|
-
parser.report(0);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
if (kind & 48) {
|
|
1498
|
-
if (atStart) {
|
|
1499
|
-
while (digit >= 0 && CharTypes[char] & (16 | 4096)) {
|
|
1500
|
-
if (char === 95) {
|
|
1501
|
-
char = advanceChar(parser);
|
|
1502
|
-
if (char === 95 || kind & 32) {
|
|
1503
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1504
|
-
}
|
|
1505
|
-
allowSeparator = 1;
|
|
1506
|
-
continue;
|
|
1507
|
-
}
|
|
1508
|
-
allowSeparator = 0;
|
|
1509
|
-
value = 10 * value + (char - 48);
|
|
1510
|
-
char = advanceChar(parser);
|
|
1511
|
-
--digit;
|
|
1512
|
-
}
|
|
1513
|
-
if (allowSeparator) {
|
|
1514
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1515
|
-
}
|
|
1516
|
-
if (digit >= 0 && !isIdentifierStart$1(char) && char !== 46) {
|
|
1517
|
-
parser.tokenValue = value;
|
|
1518
|
-
if (parser.options.raw)
|
|
1519
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1520
|
-
return 134283266;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
value += scanDecimalDigitsOrSeparator(parser, char);
|
|
1524
|
-
char = parser.currentChar;
|
|
1525
|
-
if (char === 46) {
|
|
1526
|
-
if (advanceChar(parser) === 95)
|
|
1527
|
-
parser.report(0);
|
|
1528
|
-
kind = 64;
|
|
1529
|
-
value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar);
|
|
1530
|
-
char = parser.currentChar;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
const end = parser.index;
|
|
1535
|
-
let isBigInt = 0;
|
|
1536
|
-
if (char === 110 && kind & 128) {
|
|
1537
|
-
isBigInt = 1;
|
|
1538
|
-
char = advanceChar(parser);
|
|
1539
|
-
}
|
|
1540
|
-
else {
|
|
1541
|
-
if ((char | 32) === 101) {
|
|
1542
|
-
char = advanceChar(parser);
|
|
1543
|
-
if (CharTypes[char] & 256)
|
|
1544
|
-
char = advanceChar(parser);
|
|
1545
|
-
const { index } = parser;
|
|
1546
|
-
if ((CharTypes[char] & 16) === 0)
|
|
1547
|
-
parser.report(11);
|
|
1548
|
-
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1549
|
-
char = parser.currentChar;
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart$1(char)) {
|
|
1553
|
-
parser.report(13);
|
|
1554
|
-
}
|
|
1555
|
-
if (isBigInt) {
|
|
1556
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1557
|
-
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1558
|
-
return 134283388;
|
|
1559
|
-
}
|
|
1560
|
-
parser.tokenValue =
|
|
1561
|
-
kind & (1 | 2 | 8 | 4)
|
|
1562
|
-
? value
|
|
1563
|
-
: kind & 32
|
|
1564
|
-
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1565
|
-
: +value;
|
|
1566
|
-
if (parser.options.raw)
|
|
1567
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1568
|
-
return 134283266;
|
|
1569
|
-
}
|
|
1570
|
-
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1571
|
-
let allowSeparator = 0;
|
|
1572
|
-
let start = parser.index;
|
|
1573
|
-
let ret = '';
|
|
1574
|
-
while (CharTypes[char] & (16 | 4096)) {
|
|
1575
|
-
if (char === 95) {
|
|
1576
|
-
const { index } = parser;
|
|
1577
|
-
char = advanceChar(parser);
|
|
1578
|
-
if (char === 95) {
|
|
1579
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1580
|
-
}
|
|
1581
|
-
allowSeparator = 1;
|
|
1582
|
-
ret += parser.source.substring(start, index);
|
|
1583
|
-
start = parser.index;
|
|
1584
|
-
continue;
|
|
1585
|
-
}
|
|
1586
|
-
allowSeparator = 0;
|
|
1587
|
-
char = advanceChar(parser);
|
|
1588
|
-
}
|
|
1589
|
-
if (allowSeparator) {
|
|
1590
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1591
|
-
}
|
|
1592
|
-
return ret + parser.source.substring(start, parser.index);
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
const KeywordDescTable = [
|
|
1596
|
-
'end of source',
|
|
1597
|
-
'identifier', 'number', 'string', 'regular expression',
|
|
1598
|
-
'false', 'true', 'null',
|
|
1599
|
-
'template continuation', 'template tail',
|
|
1600
|
-
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
1601
|
-
'++', '--',
|
|
1602
|
-
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
1603
|
-
'&=', '||=', '&&=', '??=',
|
|
1604
|
-
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
1605
|
-
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
1606
|
-
'var', 'let', 'const',
|
|
1607
|
-
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
1608
|
-
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
1609
|
-
'this', 'throw', 'try', 'while', 'with',
|
|
1610
|
-
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
1611
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
1612
|
-
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
1613
|
-
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
1614
|
-
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
1615
|
-
];
|
|
1616
|
-
const descKeywordTable = {
|
|
1617
|
-
this: 86111,
|
|
1618
|
-
function: 86104,
|
|
1619
|
-
if: 20569,
|
|
1620
|
-
return: 20572,
|
|
1621
|
-
var: 86088,
|
|
1622
|
-
else: 20563,
|
|
1623
|
-
for: 20567,
|
|
1624
|
-
new: 86107,
|
|
1625
|
-
in: 8673330,
|
|
1626
|
-
typeof: 16863275,
|
|
1627
|
-
while: 20578,
|
|
1628
|
-
case: 20556,
|
|
1629
|
-
break: 20555,
|
|
1630
|
-
try: 20577,
|
|
1631
|
-
catch: 20557,
|
|
1632
|
-
delete: 16863276,
|
|
1633
|
-
throw: 86112,
|
|
1634
|
-
switch: 86110,
|
|
1635
|
-
continue: 20559,
|
|
1636
|
-
default: 20561,
|
|
1637
|
-
instanceof: 8411187,
|
|
1638
|
-
do: 20562,
|
|
1639
|
-
void: 16863277,
|
|
1640
|
-
finally: 20566,
|
|
1641
|
-
async: 209005,
|
|
1642
|
-
await: 209006,
|
|
1643
|
-
class: 86094,
|
|
1644
|
-
const: 86090,
|
|
1645
|
-
constructor: 12399,
|
|
1646
|
-
debugger: 20560,
|
|
1647
|
-
export: 20564,
|
|
1648
|
-
extends: 20565,
|
|
1649
|
-
false: 86021,
|
|
1650
|
-
from: 209011,
|
|
1651
|
-
get: 209008,
|
|
1652
|
-
implements: 36964,
|
|
1653
|
-
import: 86106,
|
|
1654
|
-
interface: 36965,
|
|
1655
|
-
let: 241737,
|
|
1656
|
-
null: 86023,
|
|
1657
|
-
of: 471156,
|
|
1658
|
-
package: 36966,
|
|
1659
|
-
private: 36967,
|
|
1660
|
-
protected: 36968,
|
|
1661
|
-
public: 36969,
|
|
1662
|
-
set: 209009,
|
|
1663
|
-
static: 36970,
|
|
1664
|
-
super: 86109,
|
|
1665
|
-
true: 86022,
|
|
1666
|
-
with: 20579,
|
|
1667
|
-
yield: 241771,
|
|
1668
|
-
enum: 86133,
|
|
1669
|
-
eval: 537079926,
|
|
1670
|
-
as: 77932,
|
|
1671
|
-
arguments: 537079927,
|
|
1672
|
-
target: 209029,
|
|
1673
|
-
meta: 209030,
|
|
1674
|
-
accessor: 12402,
|
|
1675
|
-
};
|
|
1676
|
-
|
|
1677
|
-
function matchOrInsertSemicolon(parser, context) {
|
|
1678
|
-
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
1679
|
-
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
1680
|
-
}
|
|
1681
|
-
if (!consumeOpt(parser, context, 1074790417)) {
|
|
1682
|
-
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
1686
|
-
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
1687
|
-
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
1688
|
-
return 1;
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
return 0;
|
|
1692
|
-
}
|
|
1693
|
-
function optionalBit(parser, context, t) {
|
|
1694
|
-
if (parser.getToken() !== t)
|
|
1695
|
-
return 0;
|
|
1696
|
-
nextToken(parser, context);
|
|
1697
|
-
return 1;
|
|
1698
|
-
}
|
|
1699
|
-
function consumeOpt(parser, context, t) {
|
|
1700
|
-
if (parser.getToken() !== t)
|
|
1701
|
-
return false;
|
|
1702
|
-
nextToken(parser, context);
|
|
1703
|
-
return true;
|
|
1704
|
-
}
|
|
1705
|
-
function consume(parser, context, t) {
|
|
1706
|
-
if (parser.getToken() !== t)
|
|
1707
|
-
parser.report(25, KeywordDescTable[t & 255]);
|
|
1708
|
-
nextToken(parser, context);
|
|
1709
|
-
}
|
|
1710
|
-
function reinterpretToPattern(parser, node) {
|
|
1711
|
-
switch (node.type) {
|
|
1712
|
-
case 'ArrayExpression': {
|
|
1713
|
-
node.type = 'ArrayPattern';
|
|
1714
|
-
const { elements } = node;
|
|
1715
|
-
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
1716
|
-
const element = elements[i];
|
|
1717
|
-
if (element)
|
|
1718
|
-
reinterpretToPattern(parser, element);
|
|
1719
|
-
}
|
|
1720
|
-
return;
|
|
1721
|
-
}
|
|
1722
|
-
case 'ObjectExpression': {
|
|
1723
|
-
node.type = 'ObjectPattern';
|
|
1724
|
-
const { properties } = node;
|
|
1725
|
-
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
1726
|
-
reinterpretToPattern(parser, properties[i]);
|
|
1727
|
-
}
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
case 'AssignmentExpression':
|
|
1731
|
-
node.type = 'AssignmentPattern';
|
|
1732
|
-
if (node.operator !== '=')
|
|
1733
|
-
parser.report(71);
|
|
1734
|
-
delete node.operator;
|
|
1735
|
-
reinterpretToPattern(parser, node.left);
|
|
1736
|
-
return;
|
|
1737
|
-
case 'Property':
|
|
1738
|
-
reinterpretToPattern(parser, node.value);
|
|
1739
|
-
return;
|
|
1740
|
-
case 'SpreadElement':
|
|
1741
|
-
node.type = 'RestElement';
|
|
1742
|
-
reinterpretToPattern(parser, node.argument);
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
1746
|
-
if (context & 1) {
|
|
1747
|
-
if ((t & 36864) === 36864) {
|
|
1748
|
-
parser.report(118);
|
|
1749
|
-
}
|
|
1750
|
-
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
1751
|
-
parser.report(119);
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
if ((t & 20480) === 20480 || t === -2147483528) {
|
|
1755
|
-
parser.report(102);
|
|
1756
|
-
}
|
|
1757
|
-
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
1758
|
-
parser.report(100);
|
|
1759
|
-
}
|
|
1760
|
-
if (context & (2048 | 2) && t === 209006) {
|
|
1761
|
-
parser.report(110);
|
|
1762
|
-
}
|
|
1763
|
-
if (context & (1024 | 1) && t === 241771) {
|
|
1764
|
-
parser.report(97, 'yield');
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
function validateFunctionName(parser, context, t) {
|
|
1768
|
-
if (context & 1) {
|
|
1769
|
-
if ((t & 36864) === 36864) {
|
|
1770
|
-
parser.report(118);
|
|
1771
|
-
}
|
|
1772
|
-
if ((t & 537079808) === 537079808) {
|
|
1773
|
-
parser.report(119);
|
|
1774
|
-
}
|
|
1775
|
-
if (t === -2147483527) {
|
|
1776
|
-
parser.report(95);
|
|
1777
|
-
}
|
|
1778
|
-
if (t === -2147483528) {
|
|
1779
|
-
parser.report(95);
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
if ((t & 20480) === 20480) {
|
|
1783
|
-
parser.report(102);
|
|
1784
|
-
}
|
|
1785
|
-
if (context & (2048 | 2) && t === 209006) {
|
|
1786
|
-
parser.report(110);
|
|
1787
|
-
}
|
|
1788
|
-
if (context & (1024 | 1) && t === 241771) {
|
|
1789
|
-
parser.report(97, 'yield');
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
function isStrictReservedWord$1(parser, context, t) {
|
|
1793
|
-
if (t === 209006) {
|
|
1794
|
-
if (context & (2048 | 2))
|
|
1795
|
-
parser.report(110);
|
|
1796
|
-
parser.destructible |= 128;
|
|
1797
|
-
}
|
|
1798
|
-
if (t === 241771 && context & 1024)
|
|
1799
|
-
parser.report(97, 'yield');
|
|
1800
|
-
return ((t & 20480) === 20480 ||
|
|
1801
|
-
(t & 36864) === 36864 ||
|
|
1802
|
-
t == -2147483527);
|
|
1803
|
-
}
|
|
1804
|
-
function isPropertyWithPrivateFieldKey(expr) {
|
|
1805
|
-
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
1806
|
-
}
|
|
1807
|
-
function isValidLabel(parser, labels, name, isIterationStatement) {
|
|
1808
|
-
while (labels) {
|
|
1809
|
-
if (labels['$' + name]) {
|
|
1810
|
-
if (isIterationStatement)
|
|
1811
|
-
parser.report(137);
|
|
1812
|
-
return 1;
|
|
1813
|
-
}
|
|
1814
|
-
if (isIterationStatement && labels.loop)
|
|
1815
|
-
isIterationStatement = 0;
|
|
1816
|
-
labels = labels['$'];
|
|
1817
|
-
}
|
|
1818
|
-
return 0;
|
|
1819
|
-
}
|
|
1820
|
-
function validateAndDeclareLabel(parser, labels, name) {
|
|
1821
|
-
let set = labels;
|
|
1822
|
-
while (set) {
|
|
1823
|
-
if (set['$' + name])
|
|
1824
|
-
parser.report(136, name);
|
|
1825
|
-
set = set['$'];
|
|
1826
|
-
}
|
|
1827
|
-
labels['$' + name] = 1;
|
|
1828
|
-
}
|
|
1829
|
-
function isEqualTagName(elementName) {
|
|
1830
|
-
switch (elementName.type) {
|
|
1831
|
-
case 'JSXIdentifier':
|
|
1832
|
-
return elementName.name;
|
|
1833
|
-
case 'JSXNamespacedName':
|
|
1834
|
-
return elementName.namespace + ':' + elementName.name;
|
|
1835
|
-
case 'JSXMemberExpression':
|
|
1836
|
-
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
function isValidIdentifier$1(context, t) {
|
|
1840
|
-
if (context & (1 | 1024)) {
|
|
1841
|
-
if (context & 2 && t === 209006)
|
|
1842
|
-
return false;
|
|
1843
|
-
if (context & 1024 && t === 241771)
|
|
1844
|
-
return false;
|
|
1845
|
-
return (t & 12288) === 12288;
|
|
1846
|
-
}
|
|
1847
|
-
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
1848
|
-
}
|
|
1849
|
-
function classifyIdentifier(parser, context, t) {
|
|
1850
|
-
if ((t & 537079808) === 537079808) {
|
|
1851
|
-
if (context & 1)
|
|
1852
|
-
parser.report(119);
|
|
1853
|
-
parser.flags |= 512;
|
|
1854
|
-
}
|
|
1855
|
-
if (!isValidIdentifier$1(context, t))
|
|
1856
|
-
parser.report(0);
|
|
1857
|
-
}
|
|
1858
|
-
function getOwnProperty(object, key) {
|
|
1859
|
-
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
1863
|
-
while (isIdPart[advanceChar(parser)])
|
|
1864
|
-
;
|
|
1865
|
-
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1866
|
-
return parser.currentChar !== 92 && parser.currentChar <= 0x7e
|
|
1867
|
-
? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
|
|
1868
|
-
: scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
1869
|
-
}
|
|
1870
|
-
function scanUnicodeIdentifier(parser, context) {
|
|
1871
|
-
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
1872
|
-
if (!isIdentifierStart$1(cookedChar))
|
|
1873
|
-
parser.report(5);
|
|
1874
|
-
parser.tokenValue = String.fromCodePoint(cookedChar);
|
|
1875
|
-
return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
|
|
1876
|
-
}
|
|
1877
|
-
function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
1878
|
-
let start = parser.index;
|
|
1879
|
-
while (parser.index < parser.end) {
|
|
1880
|
-
if (parser.currentChar === 92) {
|
|
1881
|
-
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
1882
|
-
hasEscape = 1;
|
|
1883
|
-
const code = scanIdentifierUnicodeEscape(parser);
|
|
1884
|
-
if (!isIdentifierPart(code))
|
|
1885
|
-
parser.report(5);
|
|
1886
|
-
isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
|
|
1887
|
-
parser.tokenValue += String.fromCodePoint(code);
|
|
1888
|
-
start = parser.index;
|
|
1889
|
-
}
|
|
1890
|
-
else {
|
|
1891
|
-
const merged = consumePossibleSurrogatePair(parser);
|
|
1892
|
-
if (merged > 0) {
|
|
1893
|
-
if (!isIdentifierPart(merged)) {
|
|
1894
|
-
parser.report(20, String.fromCodePoint(merged));
|
|
1895
|
-
}
|
|
1896
|
-
parser.currentChar = merged;
|
|
1897
|
-
parser.index++;
|
|
1898
|
-
parser.column++;
|
|
1899
|
-
}
|
|
1900
|
-
else if (!isIdentifierPart(parser.currentChar)) {
|
|
1901
|
-
break;
|
|
1902
|
-
}
|
|
1903
|
-
advanceChar(parser);
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
if (parser.index <= parser.end) {
|
|
1907
|
-
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
1908
|
-
}
|
|
1909
|
-
const { length } = parser.tokenValue;
|
|
1910
|
-
if (isValidAsKeyword && length >= 2 && length <= 11) {
|
|
1911
|
-
const token = getOwnProperty(descKeywordTable, parser.tokenValue);
|
|
1912
|
-
if (token === void 0)
|
|
1913
|
-
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
1914
|
-
if (!hasEscape)
|
|
1915
|
-
return token;
|
|
1916
|
-
if (token === 209006) {
|
|
1917
|
-
if ((context & (2 | 2048)) === 0) {
|
|
1918
|
-
return token | -2147483648;
|
|
1919
|
-
}
|
|
1920
|
-
return -2147483528;
|
|
1921
|
-
}
|
|
1922
|
-
if (context & 1) {
|
|
1923
|
-
if (token === 36970) {
|
|
1924
|
-
return -2147483527;
|
|
1925
|
-
}
|
|
1926
|
-
if ((token & 36864) === 36864) {
|
|
1927
|
-
return -2147483527;
|
|
1928
|
-
}
|
|
1929
|
-
if ((token & 20480) === 20480) {
|
|
1930
|
-
if (context & 262144 && (context & 8) === 0) {
|
|
1931
|
-
return token | -2147483648;
|
|
1932
|
-
}
|
|
1933
|
-
else {
|
|
1934
|
-
return -2147483528;
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
return 209018 | -2147483648;
|
|
1938
|
-
}
|
|
1939
|
-
if (context & 262144 &&
|
|
1940
|
-
(context & 8) === 0 &&
|
|
1941
|
-
(token & 20480) === 20480) {
|
|
1942
|
-
return token | -2147483648;
|
|
1943
|
-
}
|
|
1944
|
-
if (token === 241771) {
|
|
1945
|
-
return context & 262144
|
|
1946
|
-
? 209018 | -2147483648
|
|
1947
|
-
: context & 1024
|
|
1948
|
-
? -2147483528
|
|
1949
|
-
: token | -2147483648;
|
|
1950
|
-
}
|
|
1951
|
-
if (token === 209005) {
|
|
1952
|
-
return 209018 | -2147483648;
|
|
1953
|
-
}
|
|
1954
|
-
if ((token & 36864) === 36864) {
|
|
1955
|
-
return token | 12288 | -2147483648;
|
|
1956
|
-
}
|
|
1957
|
-
return -2147483528;
|
|
1958
|
-
}
|
|
1959
|
-
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
1960
|
-
}
|
|
1961
|
-
function scanPrivateIdentifier(parser) {
|
|
1962
|
-
let char = advanceChar(parser);
|
|
1963
|
-
if (char === 92)
|
|
1964
|
-
return 130;
|
|
1965
|
-
const merged = consumePossibleSurrogatePair(parser);
|
|
1966
|
-
if (merged)
|
|
1967
|
-
char = merged;
|
|
1968
|
-
if (!isIdentifierStart$1(char))
|
|
1969
|
-
parser.report(96);
|
|
1970
|
-
return 130;
|
|
1971
|
-
}
|
|
1972
|
-
function scanIdentifierUnicodeEscape(parser) {
|
|
1973
|
-
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1974
|
-
parser.report(5);
|
|
1975
|
-
}
|
|
1976
|
-
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1977
|
-
parser.column += 2;
|
|
1978
|
-
return scanUnicodeEscape(parser);
|
|
1979
|
-
}
|
|
1980
|
-
function scanUnicodeEscape(parser) {
|
|
1981
|
-
let codePoint = 0;
|
|
1982
|
-
const char = parser.currentChar;
|
|
1983
|
-
if (char === 123) {
|
|
1984
|
-
const begin = parser.index - 2;
|
|
1985
|
-
while (CharTypes[advanceChar(parser)] & 64) {
|
|
1986
|
-
codePoint = (codePoint << 4) | toHex(parser.currentChar);
|
|
1987
|
-
if (codePoint > 1114111)
|
|
1988
|
-
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
|
|
1989
|
-
}
|
|
1990
|
-
if (parser.currentChar !== 125) {
|
|
1991
|
-
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
|
|
1992
|
-
}
|
|
1993
|
-
advanceChar(parser);
|
|
1994
|
-
return codePoint;
|
|
1995
|
-
}
|
|
1996
|
-
if ((CharTypes[char] & 64) === 0)
|
|
1997
|
-
parser.report(7);
|
|
1998
|
-
const char2 = parser.source.charCodeAt(parser.index + 1);
|
|
1999
|
-
if ((CharTypes[char2] & 64) === 0)
|
|
2000
|
-
parser.report(7);
|
|
2001
|
-
const char3 = parser.source.charCodeAt(parser.index + 2);
|
|
2002
|
-
if ((CharTypes[char3] & 64) === 0)
|
|
2003
|
-
parser.report(7);
|
|
2004
|
-
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
2005
|
-
if ((CharTypes[char4] & 64) === 0)
|
|
2006
|
-
parser.report(7);
|
|
2007
|
-
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
2008
|
-
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
2009
|
-
parser.column += 4;
|
|
2010
|
-
return codePoint;
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
1829
|
const TokenLookup = [
|
|
2014
1830
|
128,
|
|
2015
1831
|
128,
|
|
@@ -2150,7 +1966,6 @@
|
|
|
2150
1966
|
function scanSingleToken(parser, context, state) {
|
|
2151
1967
|
const isStartOfLine = parser.index === 0;
|
|
2152
1968
|
const { source } = parser;
|
|
2153
|
-
let start = parser.currentLocation;
|
|
2154
1969
|
while (parser.index < parser.end) {
|
|
2155
1970
|
parser.tokenIndex = parser.index;
|
|
2156
1971
|
parser.tokenColumn = parser.column;
|
|
@@ -2220,7 +2035,6 @@
|
|
|
2220
2035
|
parser.column += 3;
|
|
2221
2036
|
parser.currentChar = source.charCodeAt((parser.index += 3));
|
|
2222
2037
|
state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenStart);
|
|
2223
|
-
start = parser.tokenStart;
|
|
2224
2038
|
continue;
|
|
2225
2039
|
}
|
|
2226
2040
|
return 8456256;
|
|
@@ -2301,8 +2115,7 @@
|
|
|
2301
2115
|
if (!parser.options.webcompat)
|
|
2302
2116
|
parser.report(112);
|
|
2303
2117
|
advanceChar(parser);
|
|
2304
|
-
state = skipSingleHTMLComment(parser, source, state, context, 3,
|
|
2305
|
-
start = parser.tokenStart;
|
|
2118
|
+
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
2306
2119
|
continue;
|
|
2307
2120
|
}
|
|
2308
2121
|
return 33619994;
|
|
@@ -2320,13 +2133,11 @@
|
|
|
2320
2133
|
if (ch === 47) {
|
|
2321
2134
|
advanceChar(parser);
|
|
2322
2135
|
state = skipSingleLineComment(parser, source, state, 0, parser.tokenStart);
|
|
2323
|
-
start = parser.tokenStart;
|
|
2324
2136
|
continue;
|
|
2325
2137
|
}
|
|
2326
2138
|
if (ch === 42) {
|
|
2327
2139
|
advanceChar(parser);
|
|
2328
2140
|
state = skipMultiLineComment(parser, source, state);
|
|
2329
|
-
start = parser.tokenStart;
|
|
2330
2141
|
continue;
|
|
2331
2142
|
}
|
|
2332
2143
|
if (context & 32) {
|
|
@@ -2460,6 +2271,188 @@
|
|
|
2460
2271
|
return 1048576;
|
|
2461
2272
|
}
|
|
2462
2273
|
|
|
2274
|
+
function matchOrInsertSemicolon(parser, context) {
|
|
2275
|
+
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
2276
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
2277
|
+
}
|
|
2278
|
+
if (!consumeOpt(parser, context, 1074790417)) {
|
|
2279
|
+
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
2283
|
+
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
2284
|
+
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
2285
|
+
return 1;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
return 0;
|
|
2289
|
+
}
|
|
2290
|
+
function optionalBit(parser, context, t) {
|
|
2291
|
+
if (parser.getToken() !== t)
|
|
2292
|
+
return 0;
|
|
2293
|
+
nextToken(parser, context);
|
|
2294
|
+
return 1;
|
|
2295
|
+
}
|
|
2296
|
+
function consumeOpt(parser, context, t) {
|
|
2297
|
+
if (parser.getToken() !== t)
|
|
2298
|
+
return false;
|
|
2299
|
+
nextToken(parser, context);
|
|
2300
|
+
return true;
|
|
2301
|
+
}
|
|
2302
|
+
function consume(parser, context, t) {
|
|
2303
|
+
if (parser.getToken() !== t)
|
|
2304
|
+
parser.report(25, KeywordDescTable[t & 255]);
|
|
2305
|
+
nextToken(parser, context);
|
|
2306
|
+
}
|
|
2307
|
+
function reinterpretToPattern(parser, node) {
|
|
2308
|
+
switch (node.type) {
|
|
2309
|
+
case 'ArrayExpression': {
|
|
2310
|
+
node.type = 'ArrayPattern';
|
|
2311
|
+
const { elements } = node;
|
|
2312
|
+
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
2313
|
+
const element = elements[i];
|
|
2314
|
+
if (element)
|
|
2315
|
+
reinterpretToPattern(parser, element);
|
|
2316
|
+
}
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
case 'ObjectExpression': {
|
|
2320
|
+
node.type = 'ObjectPattern';
|
|
2321
|
+
const { properties } = node;
|
|
2322
|
+
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
2323
|
+
reinterpretToPattern(parser, properties[i]);
|
|
2324
|
+
}
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
case 'AssignmentExpression':
|
|
2328
|
+
node.type = 'AssignmentPattern';
|
|
2329
|
+
if (node.operator !== '=')
|
|
2330
|
+
parser.report(71);
|
|
2331
|
+
delete node.operator;
|
|
2332
|
+
reinterpretToPattern(parser, node.left);
|
|
2333
|
+
return;
|
|
2334
|
+
case 'Property':
|
|
2335
|
+
reinterpretToPattern(parser, node.value);
|
|
2336
|
+
return;
|
|
2337
|
+
case 'SpreadElement':
|
|
2338
|
+
node.type = 'RestElement';
|
|
2339
|
+
reinterpretToPattern(parser, node.argument);
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2343
|
+
if (context & 1) {
|
|
2344
|
+
if ((t & 36864) === 36864) {
|
|
2345
|
+
parser.report(118);
|
|
2346
|
+
}
|
|
2347
|
+
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2348
|
+
parser.report(119);
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
if ((t & 20480) === 20480 || t === -2147483528) {
|
|
2352
|
+
parser.report(102);
|
|
2353
|
+
}
|
|
2354
|
+
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
2355
|
+
parser.report(100);
|
|
2356
|
+
}
|
|
2357
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2358
|
+
parser.report(110);
|
|
2359
|
+
}
|
|
2360
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2361
|
+
parser.report(97, 'yield');
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
function validateFunctionName(parser, context, t) {
|
|
2365
|
+
if (context & 1) {
|
|
2366
|
+
if ((t & 36864) === 36864) {
|
|
2367
|
+
parser.report(118);
|
|
2368
|
+
}
|
|
2369
|
+
if ((t & 537079808) === 537079808) {
|
|
2370
|
+
parser.report(119);
|
|
2371
|
+
}
|
|
2372
|
+
if (t === -2147483527) {
|
|
2373
|
+
parser.report(95);
|
|
2374
|
+
}
|
|
2375
|
+
if (t === -2147483528) {
|
|
2376
|
+
parser.report(95);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
if ((t & 20480) === 20480) {
|
|
2380
|
+
parser.report(102);
|
|
2381
|
+
}
|
|
2382
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2383
|
+
parser.report(110);
|
|
2384
|
+
}
|
|
2385
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2386
|
+
parser.report(97, 'yield');
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
function isStrictReservedWord$1(parser, context, t) {
|
|
2390
|
+
if (t === 209006) {
|
|
2391
|
+
if (context & (2048 | 2))
|
|
2392
|
+
parser.report(110);
|
|
2393
|
+
parser.destructible |= 128;
|
|
2394
|
+
}
|
|
2395
|
+
if (t === 241771 && context & 1024)
|
|
2396
|
+
parser.report(97, 'yield');
|
|
2397
|
+
return ((t & 20480) === 20480 ||
|
|
2398
|
+
(t & 36864) === 36864 ||
|
|
2399
|
+
t == -2147483527);
|
|
2400
|
+
}
|
|
2401
|
+
function isPropertyWithPrivateFieldKey(expr) {
|
|
2402
|
+
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
2403
|
+
}
|
|
2404
|
+
function isValidLabel(parser, labels, name, isIterationStatement) {
|
|
2405
|
+
while (labels) {
|
|
2406
|
+
if (labels['$' + name]) {
|
|
2407
|
+
if (isIterationStatement)
|
|
2408
|
+
parser.report(137);
|
|
2409
|
+
return 1;
|
|
2410
|
+
}
|
|
2411
|
+
if (isIterationStatement && labels.loop)
|
|
2412
|
+
isIterationStatement = 0;
|
|
2413
|
+
labels = labels['$'];
|
|
2414
|
+
}
|
|
2415
|
+
return 0;
|
|
2416
|
+
}
|
|
2417
|
+
function validateAndDeclareLabel(parser, labels, name) {
|
|
2418
|
+
let set = labels;
|
|
2419
|
+
while (set) {
|
|
2420
|
+
if (set['$' + name])
|
|
2421
|
+
parser.report(136, name);
|
|
2422
|
+
set = set['$'];
|
|
2423
|
+
}
|
|
2424
|
+
labels['$' + name] = 1;
|
|
2425
|
+
}
|
|
2426
|
+
function isEqualTagName(elementName) {
|
|
2427
|
+
switch (elementName.type) {
|
|
2428
|
+
case 'JSXIdentifier':
|
|
2429
|
+
return elementName.name;
|
|
2430
|
+
case 'JSXNamespacedName':
|
|
2431
|
+
return elementName.namespace + ':' + elementName.name;
|
|
2432
|
+
case 'JSXMemberExpression':
|
|
2433
|
+
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
function isValidIdentifier$1(context, t) {
|
|
2437
|
+
if (context & (1 | 1024)) {
|
|
2438
|
+
if (context & 2 && t === 209006)
|
|
2439
|
+
return false;
|
|
2440
|
+
if (context & 1024 && t === 241771)
|
|
2441
|
+
return false;
|
|
2442
|
+
return (t & 12288) === 12288;
|
|
2443
|
+
}
|
|
2444
|
+
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
2445
|
+
}
|
|
2446
|
+
function classifyIdentifier(parser, context, t) {
|
|
2447
|
+
if ((t & 537079808) === 537079808) {
|
|
2448
|
+
if (context & 1)
|
|
2449
|
+
parser.report(119);
|
|
2450
|
+
parser.flags |= 512;
|
|
2451
|
+
}
|
|
2452
|
+
if (!isValidIdentifier$1(context, t))
|
|
2453
|
+
parser.report(0);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2463
2456
|
const entities = {
|
|
2464
2457
|
AElig: '\u00C6',
|
|
2465
2458
|
AMP: '\u0026',
|
|
@@ -4716,6 +4709,61 @@
|
|
|
4716
4709
|
return parser.getToken();
|
|
4717
4710
|
}
|
|
4718
4711
|
|
|
4712
|
+
function normalizeOptions(rawOptions) {
|
|
4713
|
+
const options = {
|
|
4714
|
+
validateRegex: true,
|
|
4715
|
+
...rawOptions,
|
|
4716
|
+
};
|
|
4717
|
+
if (options.module && !options.sourceType) {
|
|
4718
|
+
options.sourceType = 'module';
|
|
4719
|
+
}
|
|
4720
|
+
if (options.globalReturn && (!options.sourceType || options.sourceType === 'script')) {
|
|
4721
|
+
options.sourceType = 'commonjs';
|
|
4722
|
+
}
|
|
4723
|
+
return options;
|
|
4724
|
+
}
|
|
4725
|
+
|
|
4726
|
+
class PrivateScope {
|
|
4727
|
+
parser;
|
|
4728
|
+
parent;
|
|
4729
|
+
refs = Object.create(null);
|
|
4730
|
+
privateIdentifiers = new Map();
|
|
4731
|
+
constructor(parser, parent) {
|
|
4732
|
+
this.parser = parser;
|
|
4733
|
+
this.parent = parent;
|
|
4734
|
+
}
|
|
4735
|
+
addPrivateIdentifier(name, kind) {
|
|
4736
|
+
const { privateIdentifiers } = this;
|
|
4737
|
+
let focusKind = kind & (32 | 768);
|
|
4738
|
+
if (!(focusKind & 768))
|
|
4739
|
+
focusKind |= 768;
|
|
4740
|
+
const value = privateIdentifiers.get(name);
|
|
4741
|
+
if (this.hasPrivateIdentifier(name) &&
|
|
4742
|
+
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4743
|
+
this.parser.report(146, name);
|
|
4744
|
+
}
|
|
4745
|
+
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4746
|
+
}
|
|
4747
|
+
addPrivateIdentifierRef(name) {
|
|
4748
|
+
this.refs[name] ??= [];
|
|
4749
|
+
this.refs[name].push(this.parser.tokenStart);
|
|
4750
|
+
}
|
|
4751
|
+
isPrivateIdentifierDefined(name) {
|
|
4752
|
+
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4753
|
+
}
|
|
4754
|
+
validatePrivateIdentifierRefs() {
|
|
4755
|
+
for (const name in this.refs) {
|
|
4756
|
+
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4757
|
+
const { index, line, column } = this.refs[name][0];
|
|
4758
|
+
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
hasPrivateIdentifier(name) {
|
|
4763
|
+
return this.privateIdentifiers.has(name);
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
|
|
4719
4767
|
class Scope {
|
|
4720
4768
|
parser;
|
|
4721
4769
|
type;
|
|
@@ -4826,51 +4874,10 @@
|
|
|
4826
4874
|
return scope;
|
|
4827
4875
|
}
|
|
4828
4876
|
|
|
4829
|
-
class PrivateScope {
|
|
4830
|
-
parser;
|
|
4831
|
-
parent;
|
|
4832
|
-
refs = Object.create(null);
|
|
4833
|
-
privateIdentifiers = new Map();
|
|
4834
|
-
constructor(parser, parent) {
|
|
4835
|
-
this.parser = parser;
|
|
4836
|
-
this.parent = parent;
|
|
4837
|
-
}
|
|
4838
|
-
addPrivateIdentifier(name, kind) {
|
|
4839
|
-
const { privateIdentifiers } = this;
|
|
4840
|
-
let focusKind = kind & (32 | 768);
|
|
4841
|
-
if (!(focusKind & 768))
|
|
4842
|
-
focusKind |= 768;
|
|
4843
|
-
const value = privateIdentifiers.get(name);
|
|
4844
|
-
if (this.hasPrivateIdentifier(name) &&
|
|
4845
|
-
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4846
|
-
this.parser.report(146, name);
|
|
4847
|
-
}
|
|
4848
|
-
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4849
|
-
}
|
|
4850
|
-
addPrivateIdentifierRef(name) {
|
|
4851
|
-
this.refs[name] ??= [];
|
|
4852
|
-
this.refs[name].push(this.parser.tokenStart);
|
|
4853
|
-
}
|
|
4854
|
-
isPrivateIdentifierDefined(name) {
|
|
4855
|
-
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4856
|
-
}
|
|
4857
|
-
validatePrivateIdentifierRefs() {
|
|
4858
|
-
for (const name in this.refs) {
|
|
4859
|
-
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4860
|
-
const { index, line, column } = this.refs[name][0];
|
|
4861
|
-
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4862
|
-
}
|
|
4863
|
-
}
|
|
4864
|
-
}
|
|
4865
|
-
hasPrivateIdentifier(name) {
|
|
4866
|
-
return this.privateIdentifiers.has(name);
|
|
4867
|
-
}
|
|
4868
|
-
}
|
|
4869
|
-
|
|
4870
4877
|
class Parser {
|
|
4871
4878
|
source;
|
|
4872
|
-
options;
|
|
4873
4879
|
lastOnToken = null;
|
|
4880
|
+
options;
|
|
4874
4881
|
token = 1048576;
|
|
4875
4882
|
flags = 0;
|
|
4876
4883
|
index = 0;
|
|
@@ -4892,11 +4899,17 @@
|
|
|
4892
4899
|
assignable = 1;
|
|
4893
4900
|
destructible = 0;
|
|
4894
4901
|
leadingDecorators = { decorators: [] };
|
|
4895
|
-
constructor(source,
|
|
4902
|
+
constructor(source, rawOptions = {}) {
|
|
4896
4903
|
this.source = source;
|
|
4897
|
-
this.options = options;
|
|
4898
4904
|
this.end = source.length;
|
|
4899
4905
|
this.currentChar = source.charCodeAt(0);
|
|
4906
|
+
this.options = normalizeOptions(rawOptions);
|
|
4907
|
+
if (Array.isArray(this.options.onComment)) {
|
|
4908
|
+
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4909
|
+
}
|
|
4910
|
+
if (Array.isArray(this.options.onToken)) {
|
|
4911
|
+
this.options.onToken = pushToken(this.options.onToken, this.options);
|
|
4912
|
+
}
|
|
4900
4913
|
}
|
|
4901
4914
|
getToken() {
|
|
4902
4915
|
return this.token;
|
|
@@ -4989,6 +5002,25 @@
|
|
|
4989
5002
|
}
|
|
4990
5003
|
return undefined;
|
|
4991
5004
|
}
|
|
5005
|
+
cloneIdentifier(original) {
|
|
5006
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
5007
|
+
}
|
|
5008
|
+
cloneStringLiteral(original) {
|
|
5009
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
5010
|
+
}
|
|
5011
|
+
cloneLocationInformation(node, original) {
|
|
5012
|
+
if (this.options.ranges) {
|
|
5013
|
+
node.range = [...original.range];
|
|
5014
|
+
}
|
|
5015
|
+
if (this.options.loc) {
|
|
5016
|
+
node.loc = {
|
|
5017
|
+
...original.loc,
|
|
5018
|
+
start: { ...original.loc.start },
|
|
5019
|
+
end: { ...original.loc.end },
|
|
5020
|
+
};
|
|
5021
|
+
}
|
|
5022
|
+
return node;
|
|
5023
|
+
}
|
|
4992
5024
|
}
|
|
4993
5025
|
function pushComment(comments, options) {
|
|
4994
5026
|
return function (type, value, start, end, loc) {
|
|
@@ -5024,26 +5056,14 @@
|
|
|
5024
5056
|
};
|
|
5025
5057
|
}
|
|
5026
5058
|
|
|
5027
|
-
function normalizeOptions(rawOptions) {
|
|
5028
|
-
const options = { ...rawOptions };
|
|
5029
|
-
if (options.onComment) {
|
|
5030
|
-
options.onComment = Array.isArray(options.onComment) ? pushComment(options.onComment, options) : options.onComment;
|
|
5031
|
-
}
|
|
5032
|
-
if (options.onToken) {
|
|
5033
|
-
options.onToken = Array.isArray(options.onToken) ? pushToken(options.onToken, options) : options.onToken;
|
|
5034
|
-
}
|
|
5035
|
-
return options;
|
|
5036
|
-
}
|
|
5037
|
-
|
|
5038
5059
|
function parseSource(source, rawOptions = {}, context = 0) {
|
|
5039
|
-
const
|
|
5040
|
-
if (options.module)
|
|
5060
|
+
const parser = new Parser(source, rawOptions);
|
|
5061
|
+
if (parser.options.sourceType === 'module')
|
|
5041
5062
|
context |= 2 | 1;
|
|
5042
|
-
if (options.
|
|
5043
|
-
context |= 4096;
|
|
5044
|
-
if (options.impliedStrict)
|
|
5063
|
+
if (parser.options.sourceType === 'commonjs')
|
|
5064
|
+
context |= 4096 | 65536;
|
|
5065
|
+
if (parser.options.impliedStrict)
|
|
5045
5066
|
context |= 1;
|
|
5046
|
-
const parser = new Parser(source, options);
|
|
5047
5067
|
skipHashBang(parser);
|
|
5048
5068
|
const scope = parser.createScopeIfLexical();
|
|
5049
5069
|
let body = [];
|
|
@@ -5930,7 +5950,7 @@
|
|
|
5930
5950
|
}
|
|
5931
5951
|
else if (imported.type === 'Identifier') {
|
|
5932
5952
|
validateBindingIdentifier(parser, context, 16, token, 0);
|
|
5933
|
-
local = imported;
|
|
5953
|
+
local = parser.cloneIdentifier(imported);
|
|
5934
5954
|
}
|
|
5935
5955
|
else {
|
|
5936
5956
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
@@ -6071,7 +6091,7 @@
|
|
|
6071
6091
|
tmpExportedNames.push(parser.tokenValue);
|
|
6072
6092
|
tmpExportedBindings.push(parser.tokenValue);
|
|
6073
6093
|
}
|
|
6074
|
-
exported = local;
|
|
6094
|
+
exported = local.type === 'Literal' ? parser.cloneStringLiteral(local) : parser.cloneIdentifier(local);
|
|
6075
6095
|
}
|
|
6076
6096
|
specifiers.push(parser.finishNode({
|
|
6077
6097
|
type: 'ExportSpecifier',
|
|
@@ -6846,20 +6866,12 @@
|
|
|
6846
6866
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
6847
6867
|
}
|
|
6848
6868
|
}
|
|
6849
|
-
function validateStringWellFormed(parser, str) {
|
|
6850
|
-
const len = str.length;
|
|
6851
|
-
for (let i = 0; i < len; i++) {
|
|
6852
|
-
const code = str.charCodeAt(i);
|
|
6853
|
-
if ((code & 0xfc00) !== 55296)
|
|
6854
|
-
continue;
|
|
6855
|
-
if (code > 56319 || ++i >= len || (str.charCodeAt(i) & 0xfc00) !== 56320) {
|
|
6856
|
-
parser.report(171, JSON.stringify(str.charAt(i--)));
|
|
6857
|
-
}
|
|
6858
|
-
}
|
|
6859
|
-
}
|
|
6860
6869
|
function parseModuleExportName(parser, context) {
|
|
6861
6870
|
if (parser.getToken() === 134283267) {
|
|
6862
|
-
|
|
6871
|
+
const value = parser.tokenValue;
|
|
6872
|
+
if (!value.isWellFormed()) {
|
|
6873
|
+
parser.report(171);
|
|
6874
|
+
}
|
|
6863
6875
|
return parseLiteral(parser, context);
|
|
6864
6876
|
}
|
|
6865
6877
|
else if (parser.getToken() & 143360) {
|
|
@@ -6993,35 +7005,31 @@
|
|
|
6993
7005
|
if (parser.getToken() === 134283388) {
|
|
6994
7006
|
return parseBigIntLiteral(parser, context);
|
|
6995
7007
|
}
|
|
7008
|
+
const node = {
|
|
7009
|
+
type: 'Literal',
|
|
7010
|
+
value: tokenValue,
|
|
7011
|
+
};
|
|
7012
|
+
if (parser.options.raw) {
|
|
7013
|
+
node.raw = tokenRaw;
|
|
7014
|
+
}
|
|
6996
7015
|
nextToken(parser, context);
|
|
6997
7016
|
parser.assignable = 2;
|
|
6998
|
-
return parser.finishNode(
|
|
6999
|
-
? {
|
|
7000
|
-
type: 'Literal',
|
|
7001
|
-
value: tokenValue,
|
|
7002
|
-
raw: tokenRaw,
|
|
7003
|
-
}
|
|
7004
|
-
: {
|
|
7005
|
-
type: 'Literal',
|
|
7006
|
-
value: tokenValue,
|
|
7007
|
-
}, tokenStart);
|
|
7017
|
+
return parser.finishNode(node, tokenStart);
|
|
7008
7018
|
}
|
|
7009
7019
|
function parseNullOrTrueOrFalseLiteral(parser, context) {
|
|
7010
7020
|
const start = parser.tokenStart;
|
|
7011
7021
|
const raw = KeywordDescTable[parser.getToken() & 255];
|
|
7012
7022
|
const value = parser.getToken() === 86023 ? null : raw === 'true';
|
|
7023
|
+
const node = {
|
|
7024
|
+
type: 'Literal',
|
|
7025
|
+
value,
|
|
7026
|
+
};
|
|
7027
|
+
if (parser.options.raw) {
|
|
7028
|
+
node.raw = raw;
|
|
7029
|
+
}
|
|
7013
7030
|
nextToken(parser, context);
|
|
7014
7031
|
parser.assignable = 2;
|
|
7015
|
-
return parser.finishNode(
|
|
7016
|
-
? {
|
|
7017
|
-
type: 'Literal',
|
|
7018
|
-
value,
|
|
7019
|
-
raw,
|
|
7020
|
-
}
|
|
7021
|
-
: {
|
|
7022
|
-
type: 'Literal',
|
|
7023
|
-
value,
|
|
7024
|
-
}, start);
|
|
7032
|
+
return parser.finishNode(node, start);
|
|
7025
7033
|
}
|
|
7026
7034
|
function parseThisExpression(parser, context) {
|
|
7027
7035
|
const { tokenStart } = parser;
|
|
@@ -7536,7 +7544,7 @@
|
|
|
7536
7544
|
: 0;
|
|
7537
7545
|
value = parser.finishNode({
|
|
7538
7546
|
type: 'AssignmentPattern',
|
|
7539
|
-
left: parser.
|
|
7547
|
+
left: parser.cloneIdentifier(key),
|
|
7540
7548
|
right,
|
|
7541
7549
|
}, tokenStart);
|
|
7542
7550
|
}
|
|
@@ -7544,7 +7552,7 @@
|
|
|
7544
7552
|
destructible |=
|
|
7545
7553
|
(token === 209006 ? 128 : 0) |
|
|
7546
7554
|
(token === -2147483528 ? 16 : 0);
|
|
7547
|
-
value = parser.
|
|
7555
|
+
value = parser.cloneIdentifier(key);
|
|
7548
7556
|
}
|
|
7549
7557
|
}
|
|
7550
7558
|
else if (consumeOpt(parser, context | 32, 21)) {
|
|
@@ -8765,8 +8773,9 @@
|
|
|
8765
8773
|
function parseDecoratorList(parser, context, privateScope) {
|
|
8766
8774
|
const start = parser.tokenStart;
|
|
8767
8775
|
nextToken(parser, context | 32);
|
|
8776
|
+
const expressionStart = parser.tokenStart;
|
|
8768
8777
|
let expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
8769
|
-
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0,
|
|
8778
|
+
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, expressionStart);
|
|
8770
8779
|
return parser.finishNode({
|
|
8771
8780
|
type: 'Decorator',
|
|
8772
8781
|
expression,
|
|
@@ -9353,7 +9362,7 @@
|
|
|
9353
9362
|
}, start);
|
|
9354
9363
|
}
|
|
9355
9364
|
function parseModule(source, options) {
|
|
9356
|
-
return parseSource(source, options,
|
|
9365
|
+
return parseSource(source, { ...options, sourceType: 'module' });
|
|
9357
9366
|
}
|
|
9358
9367
|
|
|
9359
9368
|
// Astring is a tiny and fast JavaScript code generator from an ESTree-compliant AST.
|
|
@@ -86419,6 +86428,8 @@
|
|
|
86419
86428
|
|
|
86420
86429
|
// Updates dependency paths to be prefixed by `esm!` or otherwise updated.
|
|
86421
86430
|
function updateAmdDeps(amd, options) {
|
|
86431
|
+
options.onBeforeUpdate?.(amd);
|
|
86432
|
+
|
|
86422
86433
|
const { deps } = amd;
|
|
86423
86434
|
if (!deps) return
|
|
86424
86435
|
|
|
@@ -86438,6 +86449,9 @@
|
|
|
86438
86449
|
}
|
|
86439
86450
|
}
|
|
86440
86451
|
}
|
|
86452
|
+
|
|
86453
|
+
updated ||= options.onAfterUpdate?.(amd);
|
|
86454
|
+
|
|
86441
86455
|
return updated
|
|
86442
86456
|
}
|
|
86443
86457
|
|
|
@@ -86536,6 +86550,11 @@
|
|
|
86536
86550
|
|
|
86537
86551
|
// Transforms the module format from ESM to AMD.
|
|
86538
86552
|
function transformEsmToAmd(program, options) {
|
|
86553
|
+
options.onBeforeTransform?.({
|
|
86554
|
+
...options,
|
|
86555
|
+
program
|
|
86556
|
+
});
|
|
86557
|
+
|
|
86539
86558
|
const { body } = program;
|
|
86540
86559
|
let { length } = body;
|
|
86541
86560
|
|
|
@@ -86796,6 +86815,12 @@
|
|
|
86796
86815
|
|
|
86797
86816
|
buildAmdModule(program, options, importPaths, importVars, namedImports);
|
|
86798
86817
|
|
|
86818
|
+
options.onAfterTransform?.({
|
|
86819
|
+
...options,
|
|
86820
|
+
program,
|
|
86821
|
+
callbackBody: body
|
|
86822
|
+
});
|
|
86823
|
+
|
|
86799
86824
|
function addExportStatement({ exported, local }) {
|
|
86800
86825
|
const asName = exported.name;
|
|
86801
86826
|
if (asName !== 'default') {
|
|
@@ -86885,7 +86910,7 @@
|
|
|
86885
86910
|
result.amd = true;
|
|
86886
86911
|
if (options.resolvePath) {
|
|
86887
86912
|
for (const amd of amds) {
|
|
86888
|
-
result.updated
|
|
86913
|
+
result.updated ||= updateAmdDeps(amd, options);
|
|
86889
86914
|
}
|
|
86890
86915
|
}
|
|
86891
86916
|
} else {
|
|
@@ -86907,12 +86932,28 @@
|
|
|
86907
86932
|
useStrict,
|
|
86908
86933
|
// Enable source maps, can be an object with booleans { inline, content }.
|
|
86909
86934
|
// If set to true, the object will be set to { inline: true, content: true }.
|
|
86910
|
-
sourceMap
|
|
86935
|
+
sourceMap,
|
|
86936
|
+
// ESM transformation callbacks.
|
|
86937
|
+
onBeforeTransform,
|
|
86938
|
+
onAfterTransform,
|
|
86939
|
+
// AMD update callbacks.
|
|
86940
|
+
onBeforeUpdate,
|
|
86941
|
+
onAfterUpdate
|
|
86911
86942
|
} = {}) {
|
|
86912
86943
|
// const ast = parse(text, { ecmaVersion, sourceType: 'module', locations: true })
|
|
86913
86944
|
let ast = parseModule(text, { next: true, loc: true });
|
|
86914
86945
|
|
|
86915
|
-
const options = {
|
|
86946
|
+
const options = {
|
|
86947
|
+
sourceFileName: file,
|
|
86948
|
+
pluginName,
|
|
86949
|
+
resolvePath,
|
|
86950
|
+
originalResolvePath: resolvePath$1,
|
|
86951
|
+
useStrict,
|
|
86952
|
+
onBeforeTransform,
|
|
86953
|
+
onAfterTransform,
|
|
86954
|
+
onBeforeUpdate,
|
|
86955
|
+
onAfterUpdate
|
|
86956
|
+
};
|
|
86916
86957
|
const { updated } = transformAst(ast, options);
|
|
86917
86958
|
|
|
86918
86959
|
let code, map;
|
|
@@ -86964,7 +87005,13 @@
|
|
|
86964
87005
|
// Enable console logging.
|
|
86965
87006
|
verbose,
|
|
86966
87007
|
// Directory to save a copy of the transformed modules.
|
|
86967
|
-
debugDir
|
|
87008
|
+
debugDir,
|
|
87009
|
+
// ESM transformation callbacks.
|
|
87010
|
+
onBeforeTransform,
|
|
87011
|
+
onAfterTransform,
|
|
87012
|
+
// AMD update callbacks.
|
|
87013
|
+
onBeforeUpdate,
|
|
87014
|
+
onAfterUpdate
|
|
86968
87015
|
} = typeof module !== 'undefined' && module.config && module.config() || {};
|
|
86969
87016
|
|
|
86970
87017
|
const buildMap = {};
|
|
@@ -87045,7 +87092,13 @@
|
|
|
87045
87092
|
// Always produce the source maps when transpiling in the browser, otherwise
|
|
87046
87093
|
// the debugging would me impossible. When building and bundling, check if
|
|
87047
87094
|
// the source maps were enabled for the output.
|
|
87048
|
-
sourceMap: sourceMap || !isBuild
|
|
87095
|
+
sourceMap: sourceMap || !isBuild,
|
|
87096
|
+
// ESM transformation callbacks.
|
|
87097
|
+
onBeforeTransform,
|
|
87098
|
+
onAfterTransform,
|
|
87099
|
+
// AMD update callbacks.
|
|
87100
|
+
onBeforeUpdate,
|
|
87101
|
+
onAfterUpdate
|
|
87049
87102
|
}));
|
|
87050
87103
|
if (!updated) {
|
|
87051
87104
|
verbose && console.log('esm: retaining', name);
|