meriyah 6.1.4 → 7.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/CHANGELOG.md +37 -0
- package/README.md +49 -32
- package/dist/meriyah.cjs +1116 -1069
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +1116 -1070
- package/dist/meriyah.umd.js +9230 -9183
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +5 -5
- package/dist/types/errors.d.ts +2 -1
- package/dist/types/estree.d.ts +36 -22
- package/dist/types/lexer/comments.d.ts +1 -1
- package/dist/types/lexer/common.d.ts +1 -1
- package/dist/types/lexer/identifier.d.ts +1 -1
- package/dist/types/lexer/jsx.d.ts +1 -1
- package/dist/types/lexer/scan.d.ts +1 -1
- package/dist/types/meriyah.d.ts +3 -2
- package/dist/types/options.d.ts +7 -4
- package/dist/types/parser/parser.d.ts +12 -11
- package/dist/types/parser/private-scope.d.ts +1 -1
- package/dist/types/parser/scope.d.ts +1 -1
- package/dist/types/parser.d.ts +1 -6
- package/dist/types/token.d.ts +3 -3
- package/dist/types/utilities.d.ts +1 -0
- package/package.json +2 -64
package/dist/meriyah.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
var version$1 = "7.1.0";
|
|
2
|
+
|
|
1
3
|
const unicodeLookup = ((compressed, lookup) => {
|
|
2
4
|
const result = new Uint32Array(69632);
|
|
3
5
|
let index = 0;
|
|
4
6
|
let subIndex = 0;
|
|
5
|
-
while (index <
|
|
7
|
+
while (index < 2597) {
|
|
6
8
|
const inst = compressed[index++];
|
|
7
9
|
if (inst < 0) {
|
|
8
10
|
subIndex -= inst;
|
|
@@ -20,78 +22,10 @@ const unicodeLookup = ((compressed, lookup) => {
|
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
return result;
|
|
23
|
-
})([-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]);
|
|
25
|
+
})([-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]);
|
|
24
26
|
const isIDContinue = (code) => (unicodeLookup[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
|
|
25
27
|
const isIDStart = (code) => (unicodeLookup[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
|
|
26
28
|
|
|
27
|
-
function advanceChar(parser) {
|
|
28
|
-
parser.column++;
|
|
29
|
-
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
30
|
-
}
|
|
31
|
-
function consumePossibleSurrogatePair(parser) {
|
|
32
|
-
const hi = parser.currentChar;
|
|
33
|
-
if ((hi & 0xfc00) !== 55296)
|
|
34
|
-
return 0;
|
|
35
|
-
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
36
|
-
if ((lo & 0xfc00) !== 56320)
|
|
37
|
-
return 0;
|
|
38
|
-
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
39
|
-
}
|
|
40
|
-
function consumeLineFeed(parser, state) {
|
|
41
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
42
|
-
parser.flags |= 1;
|
|
43
|
-
if ((state & 4) === 0) {
|
|
44
|
-
parser.column = 0;
|
|
45
|
-
parser.line++;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function scanNewLine(parser) {
|
|
49
|
-
parser.flags |= 1;
|
|
50
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
51
|
-
parser.column = 0;
|
|
52
|
-
parser.line++;
|
|
53
|
-
}
|
|
54
|
-
function isExoticECMAScriptWhitespace(ch) {
|
|
55
|
-
return (ch === 160 ||
|
|
56
|
-
ch === 65279 ||
|
|
57
|
-
ch === 133 ||
|
|
58
|
-
ch === 5760 ||
|
|
59
|
-
(ch >= 8192 && ch <= 8203) ||
|
|
60
|
-
ch === 8239 ||
|
|
61
|
-
ch === 8287 ||
|
|
62
|
-
ch === 12288 ||
|
|
63
|
-
ch === 8201 ||
|
|
64
|
-
ch === 65519);
|
|
65
|
-
}
|
|
66
|
-
function toHex(code) {
|
|
67
|
-
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
68
|
-
}
|
|
69
|
-
function convertTokenType(t) {
|
|
70
|
-
switch (t) {
|
|
71
|
-
case 134283266:
|
|
72
|
-
return 'NumericLiteral';
|
|
73
|
-
case 134283267:
|
|
74
|
-
return 'StringLiteral';
|
|
75
|
-
case 86021:
|
|
76
|
-
case 86022:
|
|
77
|
-
return 'BooleanLiteral';
|
|
78
|
-
case 86023:
|
|
79
|
-
return 'NullLiteral';
|
|
80
|
-
case 65540:
|
|
81
|
-
return 'RegularExpression';
|
|
82
|
-
case 67174408:
|
|
83
|
-
case 67174409:
|
|
84
|
-
case 131:
|
|
85
|
-
return 'TemplateLiteral';
|
|
86
|
-
default:
|
|
87
|
-
if ((t & 143360) === 143360)
|
|
88
|
-
return 'Identifier';
|
|
89
|
-
if ((t & 4096) === 4096)
|
|
90
|
-
return 'Keyword';
|
|
91
|
-
return 'Punctuator';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
29
|
const CharTypes = [
|
|
96
30
|
0,
|
|
97
31
|
0,
|
|
@@ -493,6 +427,74 @@ function isIdentifierPart(code) {
|
|
|
493
427
|
: isIDContinue(code) || (code === 8204 || code === 8205);
|
|
494
428
|
}
|
|
495
429
|
|
|
430
|
+
function advanceChar(parser) {
|
|
431
|
+
parser.column++;
|
|
432
|
+
return (parser.currentChar = parser.source.charCodeAt(++parser.index));
|
|
433
|
+
}
|
|
434
|
+
function consumePossibleSurrogatePair(parser) {
|
|
435
|
+
const hi = parser.currentChar;
|
|
436
|
+
if ((hi & 0xfc00) !== 55296)
|
|
437
|
+
return 0;
|
|
438
|
+
const lo = parser.source.charCodeAt(parser.index + 1);
|
|
439
|
+
if ((lo & 0xfc00) !== 56320)
|
|
440
|
+
return 0;
|
|
441
|
+
return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
|
|
442
|
+
}
|
|
443
|
+
function consumeLineFeed(parser, state) {
|
|
444
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
445
|
+
parser.flags |= 1;
|
|
446
|
+
if ((state & 4) === 0) {
|
|
447
|
+
parser.column = 0;
|
|
448
|
+
parser.line++;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function scanNewLine(parser) {
|
|
452
|
+
parser.flags |= 1;
|
|
453
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
454
|
+
parser.column = 0;
|
|
455
|
+
parser.line++;
|
|
456
|
+
}
|
|
457
|
+
function isExoticECMAScriptWhitespace(ch) {
|
|
458
|
+
return (ch === 160 ||
|
|
459
|
+
ch === 65279 ||
|
|
460
|
+
ch === 133 ||
|
|
461
|
+
ch === 5760 ||
|
|
462
|
+
(ch >= 8192 && ch <= 8203) ||
|
|
463
|
+
ch === 8239 ||
|
|
464
|
+
ch === 8287 ||
|
|
465
|
+
ch === 12288 ||
|
|
466
|
+
ch === 8201 ||
|
|
467
|
+
ch === 65519);
|
|
468
|
+
}
|
|
469
|
+
function toHex(code) {
|
|
470
|
+
return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
|
|
471
|
+
}
|
|
472
|
+
function convertTokenType(t) {
|
|
473
|
+
switch (t) {
|
|
474
|
+
case 134283266:
|
|
475
|
+
return 'NumericLiteral';
|
|
476
|
+
case 134283267:
|
|
477
|
+
return 'StringLiteral';
|
|
478
|
+
case 86021:
|
|
479
|
+
case 86022:
|
|
480
|
+
return 'BooleanLiteral';
|
|
481
|
+
case 86023:
|
|
482
|
+
return 'NullLiteral';
|
|
483
|
+
case 65540:
|
|
484
|
+
return 'RegularExpression';
|
|
485
|
+
case 67174408:
|
|
486
|
+
case 67174409:
|
|
487
|
+
case 131:
|
|
488
|
+
return 'TemplateLiteral';
|
|
489
|
+
default:
|
|
490
|
+
if ((t & 143360) === 143360)
|
|
491
|
+
return 'Identifier';
|
|
492
|
+
if ((t & 4096) === 4096)
|
|
493
|
+
return 'Keyword';
|
|
494
|
+
return 'Punctuator';
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
496
498
|
const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment'];
|
|
497
499
|
function skipHashBang(parser) {
|
|
498
500
|
const { source } = parser;
|
|
@@ -604,424 +606,6 @@ function skipMultiLineComment(parser, source, state) {
|
|
|
604
606
|
parser.report(18);
|
|
605
607
|
}
|
|
606
608
|
|
|
607
|
-
var RegexState;
|
|
608
|
-
(function (RegexState) {
|
|
609
|
-
RegexState[RegexState["Empty"] = 0] = "Empty";
|
|
610
|
-
RegexState[RegexState["Escape"] = 1] = "Escape";
|
|
611
|
-
RegexState[RegexState["Class"] = 2] = "Class";
|
|
612
|
-
})(RegexState || (RegexState = {}));
|
|
613
|
-
var RegexFlags;
|
|
614
|
-
(function (RegexFlags) {
|
|
615
|
-
RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
|
|
616
|
-
RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
|
|
617
|
-
RegexFlags[RegexFlags["Global"] = 2] = "Global";
|
|
618
|
-
RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
|
|
619
|
-
RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
|
|
620
|
-
RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
|
|
621
|
-
RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
|
|
622
|
-
RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
|
|
623
|
-
RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
|
|
624
|
-
})(RegexFlags || (RegexFlags = {}));
|
|
625
|
-
function scanRegularExpression(parser) {
|
|
626
|
-
const bodyStart = parser.index;
|
|
627
|
-
let preparseState = RegexState.Empty;
|
|
628
|
-
loop: while (true) {
|
|
629
|
-
const ch = parser.currentChar;
|
|
630
|
-
advanceChar(parser);
|
|
631
|
-
if (preparseState & RegexState.Escape) {
|
|
632
|
-
preparseState &= ~RegexState.Escape;
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
switch (ch) {
|
|
636
|
-
case 47:
|
|
637
|
-
if (!preparseState)
|
|
638
|
-
break loop;
|
|
639
|
-
else
|
|
640
|
-
break;
|
|
641
|
-
case 92:
|
|
642
|
-
preparseState |= RegexState.Escape;
|
|
643
|
-
break;
|
|
644
|
-
case 91:
|
|
645
|
-
preparseState |= RegexState.Class;
|
|
646
|
-
break;
|
|
647
|
-
case 93:
|
|
648
|
-
preparseState &= RegexState.Escape;
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
if (ch === 13 ||
|
|
653
|
-
ch === 10 ||
|
|
654
|
-
ch === 8232 ||
|
|
655
|
-
ch === 8233) {
|
|
656
|
-
parser.report(34);
|
|
657
|
-
}
|
|
658
|
-
if (parser.index >= parser.source.length) {
|
|
659
|
-
return parser.report(34);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
const bodyEnd = parser.index - 1;
|
|
663
|
-
let mask = RegexFlags.Empty;
|
|
664
|
-
let char = parser.currentChar;
|
|
665
|
-
const { index: flagStart } = parser;
|
|
666
|
-
while (isIdentifierPart(char)) {
|
|
667
|
-
switch (char) {
|
|
668
|
-
case 103:
|
|
669
|
-
if (mask & RegexFlags.Global)
|
|
670
|
-
parser.report(36, 'g');
|
|
671
|
-
mask |= RegexFlags.Global;
|
|
672
|
-
break;
|
|
673
|
-
case 105:
|
|
674
|
-
if (mask & RegexFlags.IgnoreCase)
|
|
675
|
-
parser.report(36, 'i');
|
|
676
|
-
mask |= RegexFlags.IgnoreCase;
|
|
677
|
-
break;
|
|
678
|
-
case 109:
|
|
679
|
-
if (mask & RegexFlags.Multiline)
|
|
680
|
-
parser.report(36, 'm');
|
|
681
|
-
mask |= RegexFlags.Multiline;
|
|
682
|
-
break;
|
|
683
|
-
case 117:
|
|
684
|
-
if (mask & RegexFlags.Unicode)
|
|
685
|
-
parser.report(36, 'u');
|
|
686
|
-
if (mask & RegexFlags.UnicodeSets)
|
|
687
|
-
parser.report(36, 'vu');
|
|
688
|
-
mask |= RegexFlags.Unicode;
|
|
689
|
-
break;
|
|
690
|
-
case 118:
|
|
691
|
-
if (mask & RegexFlags.Unicode)
|
|
692
|
-
parser.report(36, 'uv');
|
|
693
|
-
if (mask & RegexFlags.UnicodeSets)
|
|
694
|
-
parser.report(36, 'v');
|
|
695
|
-
mask |= RegexFlags.UnicodeSets;
|
|
696
|
-
break;
|
|
697
|
-
case 121:
|
|
698
|
-
if (mask & RegexFlags.Sticky)
|
|
699
|
-
parser.report(36, 'y');
|
|
700
|
-
mask |= RegexFlags.Sticky;
|
|
701
|
-
break;
|
|
702
|
-
case 115:
|
|
703
|
-
if (mask & RegexFlags.DotAll)
|
|
704
|
-
parser.report(36, 's');
|
|
705
|
-
mask |= RegexFlags.DotAll;
|
|
706
|
-
break;
|
|
707
|
-
case 100:
|
|
708
|
-
if (mask & RegexFlags.Indices)
|
|
709
|
-
parser.report(36, 'd');
|
|
710
|
-
mask |= RegexFlags.Indices;
|
|
711
|
-
break;
|
|
712
|
-
default:
|
|
713
|
-
parser.report(35);
|
|
714
|
-
}
|
|
715
|
-
char = advanceChar(parser);
|
|
716
|
-
}
|
|
717
|
-
const flags = parser.source.slice(flagStart, parser.index);
|
|
718
|
-
const pattern = parser.source.slice(bodyStart, bodyEnd);
|
|
719
|
-
parser.tokenRegExp = { pattern, flags };
|
|
720
|
-
if (parser.options.raw)
|
|
721
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
722
|
-
parser.tokenValue = validate(parser, pattern, flags);
|
|
723
|
-
return 65540;
|
|
724
|
-
}
|
|
725
|
-
function validate(parser, pattern, flags) {
|
|
726
|
-
try {
|
|
727
|
-
return new RegExp(pattern, flags);
|
|
728
|
-
}
|
|
729
|
-
catch {
|
|
730
|
-
try {
|
|
731
|
-
new RegExp(pattern, flags);
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
catch {
|
|
735
|
-
parser.report(34);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
function scanString(parser, context, quote) {
|
|
741
|
-
const { index: start } = parser;
|
|
742
|
-
let ret = '';
|
|
743
|
-
let char = advanceChar(parser);
|
|
744
|
-
let marker = parser.index;
|
|
745
|
-
while ((CharTypes[char] & 8) === 0) {
|
|
746
|
-
if (char === quote) {
|
|
747
|
-
ret += parser.source.slice(marker, parser.index);
|
|
748
|
-
advanceChar(parser);
|
|
749
|
-
if (parser.options.raw)
|
|
750
|
-
parser.tokenRaw = parser.source.slice(start, parser.index);
|
|
751
|
-
parser.tokenValue = ret;
|
|
752
|
-
return 134283267;
|
|
753
|
-
}
|
|
754
|
-
if ((char & 8) === 8 && char === 92) {
|
|
755
|
-
ret += parser.source.slice(marker, parser.index);
|
|
756
|
-
char = advanceChar(parser);
|
|
757
|
-
if (char < 0x7f || char === 8232 || char === 8233) {
|
|
758
|
-
const code = parseEscape(parser, context, char);
|
|
759
|
-
if (code >= 0)
|
|
760
|
-
ret += String.fromCodePoint(code);
|
|
761
|
-
else
|
|
762
|
-
handleStringError(parser, code, 0);
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
ret += String.fromCodePoint(char);
|
|
766
|
-
}
|
|
767
|
-
marker = parser.index + 1;
|
|
768
|
-
}
|
|
769
|
-
else if (char === 8232 || char === 8233) {
|
|
770
|
-
parser.column = -1;
|
|
771
|
-
parser.line++;
|
|
772
|
-
}
|
|
773
|
-
if (parser.index >= parser.end)
|
|
774
|
-
parser.report(16);
|
|
775
|
-
char = advanceChar(parser);
|
|
776
|
-
}
|
|
777
|
-
parser.report(16);
|
|
778
|
-
}
|
|
779
|
-
function parseEscape(parser, context, first, isTemplate = 0) {
|
|
780
|
-
switch (first) {
|
|
781
|
-
case 98:
|
|
782
|
-
return 8;
|
|
783
|
-
case 102:
|
|
784
|
-
return 12;
|
|
785
|
-
case 114:
|
|
786
|
-
return 13;
|
|
787
|
-
case 110:
|
|
788
|
-
return 10;
|
|
789
|
-
case 116:
|
|
790
|
-
return 9;
|
|
791
|
-
case 118:
|
|
792
|
-
return 11;
|
|
793
|
-
case 13: {
|
|
794
|
-
if (parser.index < parser.end) {
|
|
795
|
-
const nextChar = parser.source.charCodeAt(parser.index + 1);
|
|
796
|
-
if (nextChar === 10) {
|
|
797
|
-
parser.index = parser.index + 1;
|
|
798
|
-
parser.currentChar = nextChar;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
case 10:
|
|
803
|
-
case 8232:
|
|
804
|
-
case 8233:
|
|
805
|
-
parser.column = -1;
|
|
806
|
-
parser.line++;
|
|
807
|
-
return -1;
|
|
808
|
-
case 48:
|
|
809
|
-
case 49:
|
|
810
|
-
case 50:
|
|
811
|
-
case 51: {
|
|
812
|
-
let code = first - 48;
|
|
813
|
-
let index = parser.index + 1;
|
|
814
|
-
let column = parser.column + 1;
|
|
815
|
-
if (index < parser.end) {
|
|
816
|
-
const next = parser.source.charCodeAt(index);
|
|
817
|
-
if ((CharTypes[next] & 32) === 0) {
|
|
818
|
-
if (code !== 0 || CharTypes[next] & 512) {
|
|
819
|
-
if (context & 1 || isTemplate)
|
|
820
|
-
return -2;
|
|
821
|
-
parser.flags |= 64;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
else if (context & 1 || isTemplate) {
|
|
825
|
-
return -2;
|
|
826
|
-
}
|
|
827
|
-
else {
|
|
828
|
-
parser.currentChar = next;
|
|
829
|
-
code = (code << 3) | (next - 48);
|
|
830
|
-
index++;
|
|
831
|
-
column++;
|
|
832
|
-
if (index < parser.end) {
|
|
833
|
-
const next = parser.source.charCodeAt(index);
|
|
834
|
-
if (CharTypes[next] & 32) {
|
|
835
|
-
parser.currentChar = next;
|
|
836
|
-
code = (code << 3) | (next - 48);
|
|
837
|
-
index++;
|
|
838
|
-
column++;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
parser.flags |= 64;
|
|
842
|
-
}
|
|
843
|
-
parser.index = index - 1;
|
|
844
|
-
parser.column = column - 1;
|
|
845
|
-
}
|
|
846
|
-
return code;
|
|
847
|
-
}
|
|
848
|
-
case 52:
|
|
849
|
-
case 53:
|
|
850
|
-
case 54:
|
|
851
|
-
case 55: {
|
|
852
|
-
if (isTemplate || context & 1)
|
|
853
|
-
return -2;
|
|
854
|
-
let code = first - 48;
|
|
855
|
-
const index = parser.index + 1;
|
|
856
|
-
const column = parser.column + 1;
|
|
857
|
-
if (index < parser.end) {
|
|
858
|
-
const next = parser.source.charCodeAt(index);
|
|
859
|
-
if (CharTypes[next] & 32) {
|
|
860
|
-
code = (code << 3) | (next - 48);
|
|
861
|
-
parser.currentChar = next;
|
|
862
|
-
parser.index = index;
|
|
863
|
-
parser.column = column;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
parser.flags |= 64;
|
|
867
|
-
return code;
|
|
868
|
-
}
|
|
869
|
-
case 120: {
|
|
870
|
-
const ch1 = advanceChar(parser);
|
|
871
|
-
if ((CharTypes[ch1] & 64) === 0)
|
|
872
|
-
return -4;
|
|
873
|
-
const hi = toHex(ch1);
|
|
874
|
-
const ch2 = advanceChar(parser);
|
|
875
|
-
if ((CharTypes[ch2] & 64) === 0)
|
|
876
|
-
return -4;
|
|
877
|
-
const lo = toHex(ch2);
|
|
878
|
-
return (hi << 4) | lo;
|
|
879
|
-
}
|
|
880
|
-
case 117: {
|
|
881
|
-
const ch = advanceChar(parser);
|
|
882
|
-
if (parser.currentChar === 123) {
|
|
883
|
-
let code = 0;
|
|
884
|
-
while ((CharTypes[advanceChar(parser)] & 64) !== 0) {
|
|
885
|
-
code = (code << 4) | toHex(parser.currentChar);
|
|
886
|
-
if (code > 1114111)
|
|
887
|
-
return -5;
|
|
888
|
-
}
|
|
889
|
-
if (parser.currentChar < 1 || parser.currentChar !== 125) {
|
|
890
|
-
return -4;
|
|
891
|
-
}
|
|
892
|
-
return code;
|
|
893
|
-
}
|
|
894
|
-
else {
|
|
895
|
-
if ((CharTypes[ch] & 64) === 0)
|
|
896
|
-
return -4;
|
|
897
|
-
const ch2 = parser.source.charCodeAt(parser.index + 1);
|
|
898
|
-
if ((CharTypes[ch2] & 64) === 0)
|
|
899
|
-
return -4;
|
|
900
|
-
const ch3 = parser.source.charCodeAt(parser.index + 2);
|
|
901
|
-
if ((CharTypes[ch3] & 64) === 0)
|
|
902
|
-
return -4;
|
|
903
|
-
const ch4 = parser.source.charCodeAt(parser.index + 3);
|
|
904
|
-
if ((CharTypes[ch4] & 64) === 0)
|
|
905
|
-
return -4;
|
|
906
|
-
parser.index += 3;
|
|
907
|
-
parser.column += 3;
|
|
908
|
-
parser.currentChar = parser.source.charCodeAt(parser.index);
|
|
909
|
-
return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
case 56:
|
|
913
|
-
case 57:
|
|
914
|
-
if (isTemplate || !parser.options.webcompat || context & 1)
|
|
915
|
-
return -3;
|
|
916
|
-
parser.flags |= 4096;
|
|
917
|
-
default:
|
|
918
|
-
return first;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
function handleStringError(parser, code, isTemplate) {
|
|
922
|
-
switch (code) {
|
|
923
|
-
case -1:
|
|
924
|
-
return;
|
|
925
|
-
case -2:
|
|
926
|
-
parser.report(isTemplate ? 2 : 1);
|
|
927
|
-
case -3:
|
|
928
|
-
parser.report(isTemplate ? 3 : 14);
|
|
929
|
-
case -4:
|
|
930
|
-
parser.report(7);
|
|
931
|
-
case -5:
|
|
932
|
-
parser.report(104);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
function scanTemplate(parser, context) {
|
|
937
|
-
const { index: start } = parser;
|
|
938
|
-
let token = 67174409;
|
|
939
|
-
let ret = '';
|
|
940
|
-
let char = advanceChar(parser);
|
|
941
|
-
while (char !== 96) {
|
|
942
|
-
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
943
|
-
advanceChar(parser);
|
|
944
|
-
token = 67174408;
|
|
945
|
-
break;
|
|
946
|
-
}
|
|
947
|
-
else if (char === 92) {
|
|
948
|
-
char = advanceChar(parser);
|
|
949
|
-
if (char > 0x7e) {
|
|
950
|
-
ret += String.fromCodePoint(char);
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
953
|
-
const { index, line, column } = parser;
|
|
954
|
-
const code = parseEscape(parser, context | 1, char, 1);
|
|
955
|
-
if (code >= 0) {
|
|
956
|
-
ret += String.fromCodePoint(code);
|
|
957
|
-
}
|
|
958
|
-
else if (code !== -1 && context & 64) {
|
|
959
|
-
parser.index = index;
|
|
960
|
-
parser.line = line;
|
|
961
|
-
parser.column = column;
|
|
962
|
-
ret = null;
|
|
963
|
-
char = scanBadTemplate(parser, char);
|
|
964
|
-
if (char < 0)
|
|
965
|
-
token = 67174408;
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
else {
|
|
969
|
-
handleStringError(parser, code, 1);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
else if (parser.index < parser.end) {
|
|
974
|
-
if (char === 13 && parser.source.charCodeAt(parser.index) === 10) {
|
|
975
|
-
ret += String.fromCodePoint(char);
|
|
976
|
-
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
977
|
-
}
|
|
978
|
-
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
979
|
-
parser.column = -1;
|
|
980
|
-
parser.line++;
|
|
981
|
-
}
|
|
982
|
-
ret += String.fromCodePoint(char);
|
|
983
|
-
}
|
|
984
|
-
if (parser.index >= parser.end)
|
|
985
|
-
parser.report(17);
|
|
986
|
-
char = advanceChar(parser);
|
|
987
|
-
}
|
|
988
|
-
advanceChar(parser);
|
|
989
|
-
parser.tokenValue = ret;
|
|
990
|
-
parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
991
|
-
return token;
|
|
992
|
-
}
|
|
993
|
-
function scanBadTemplate(parser, ch) {
|
|
994
|
-
while (ch !== 96) {
|
|
995
|
-
switch (ch) {
|
|
996
|
-
case 36: {
|
|
997
|
-
const index = parser.index + 1;
|
|
998
|
-
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
999
|
-
parser.index = index;
|
|
1000
|
-
parser.column++;
|
|
1001
|
-
return -ch;
|
|
1002
|
-
}
|
|
1003
|
-
break;
|
|
1004
|
-
}
|
|
1005
|
-
case 10:
|
|
1006
|
-
case 8232:
|
|
1007
|
-
case 8233:
|
|
1008
|
-
parser.column = -1;
|
|
1009
|
-
parser.line++;
|
|
1010
|
-
}
|
|
1011
|
-
if (parser.index >= parser.end)
|
|
1012
|
-
parser.report(17);
|
|
1013
|
-
ch = advanceChar(parser);
|
|
1014
|
-
}
|
|
1015
|
-
return ch;
|
|
1016
|
-
}
|
|
1017
|
-
function scanTemplateTail(parser, context) {
|
|
1018
|
-
if (parser.index >= parser.end)
|
|
1019
|
-
parser.report(0);
|
|
1020
|
-
parser.index--;
|
|
1021
|
-
parser.column--;
|
|
1022
|
-
return scanTemplate(parser, context);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
609
|
const errorMessages = {
|
|
1026
610
|
[0]: 'Unexpected token',
|
|
1027
611
|
[30]: "Unexpected token: '%0'",
|
|
@@ -1193,7 +777,7 @@ const errorMessages = {
|
|
|
1193
777
|
[168]: 'Invalid optional chain from new expression',
|
|
1194
778
|
[169]: 'Cannot use "import.meta" outside a module',
|
|
1195
779
|
[170]: 'Leading decorators must be attached to a class declaration',
|
|
1196
|
-
[171]: 'An export name cannot include a lone surrogate
|
|
780
|
+
[171]: 'An export name cannot include a lone surrogate',
|
|
1197
781
|
[172]: 'A string literal cannot be used as an exported binding without `from`',
|
|
1198
782
|
[173]: "Private fields can't be accessed on super",
|
|
1199
783
|
[174]: "The only valid meta property for import is 'import.meta'",
|
|
@@ -1221,6 +805,244 @@ class ParseError extends SyntaxError {
|
|
|
1221
805
|
this.description = description;
|
|
1222
806
|
}
|
|
1223
807
|
}
|
|
808
|
+
const isParseError = (error) => error instanceof ParseError;
|
|
809
|
+
|
|
810
|
+
function getOwnProperty(object, key) {
|
|
811
|
+
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const KeywordDescTable = [
|
|
815
|
+
'end of source',
|
|
816
|
+
'identifier', 'number', 'string', 'regular expression',
|
|
817
|
+
'false', 'true', 'null',
|
|
818
|
+
'template continuation', 'template tail',
|
|
819
|
+
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
820
|
+
'++', '--',
|
|
821
|
+
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
822
|
+
'&=', '||=', '&&=', '??=',
|
|
823
|
+
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
824
|
+
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
825
|
+
'var', 'let', 'const',
|
|
826
|
+
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
827
|
+
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
828
|
+
'this', 'throw', 'try', 'while', 'with',
|
|
829
|
+
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
830
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
831
|
+
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
832
|
+
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
833
|
+
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
834
|
+
];
|
|
835
|
+
const descKeywordTable = {
|
|
836
|
+
this: 86111,
|
|
837
|
+
function: 86104,
|
|
838
|
+
if: 20569,
|
|
839
|
+
return: 20572,
|
|
840
|
+
var: 86088,
|
|
841
|
+
else: 20563,
|
|
842
|
+
for: 20567,
|
|
843
|
+
new: 86107,
|
|
844
|
+
in: 8673330,
|
|
845
|
+
typeof: 16863275,
|
|
846
|
+
while: 20578,
|
|
847
|
+
case: 20556,
|
|
848
|
+
break: 20555,
|
|
849
|
+
try: 20577,
|
|
850
|
+
catch: 20557,
|
|
851
|
+
delete: 16863276,
|
|
852
|
+
throw: 86112,
|
|
853
|
+
switch: 86110,
|
|
854
|
+
continue: 20559,
|
|
855
|
+
default: 20561,
|
|
856
|
+
instanceof: 8411187,
|
|
857
|
+
do: 20562,
|
|
858
|
+
void: 16863277,
|
|
859
|
+
finally: 20566,
|
|
860
|
+
async: 209005,
|
|
861
|
+
await: 209006,
|
|
862
|
+
class: 86094,
|
|
863
|
+
const: 86090,
|
|
864
|
+
constructor: 12399,
|
|
865
|
+
debugger: 20560,
|
|
866
|
+
export: 20564,
|
|
867
|
+
extends: 20565,
|
|
868
|
+
false: 86021,
|
|
869
|
+
from: 209011,
|
|
870
|
+
get: 209008,
|
|
871
|
+
implements: 36964,
|
|
872
|
+
import: 86106,
|
|
873
|
+
interface: 36965,
|
|
874
|
+
let: 241737,
|
|
875
|
+
null: 86023,
|
|
876
|
+
of: 471156,
|
|
877
|
+
package: 36966,
|
|
878
|
+
private: 36967,
|
|
879
|
+
protected: 36968,
|
|
880
|
+
public: 36969,
|
|
881
|
+
set: 209009,
|
|
882
|
+
static: 36970,
|
|
883
|
+
super: 86109,
|
|
884
|
+
true: 86022,
|
|
885
|
+
with: 20579,
|
|
886
|
+
yield: 241771,
|
|
887
|
+
enum: 86133,
|
|
888
|
+
eval: 537079926,
|
|
889
|
+
as: 77932,
|
|
890
|
+
arguments: 537079927,
|
|
891
|
+
target: 209029,
|
|
892
|
+
meta: 209030,
|
|
893
|
+
accessor: 12402,
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
897
|
+
while (isIdPart[advanceChar(parser)])
|
|
898
|
+
;
|
|
899
|
+
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
900
|
+
return parser.currentChar !== 92 && parser.currentChar <= 0x7e
|
|
901
|
+
? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
|
|
902
|
+
: scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
903
|
+
}
|
|
904
|
+
function scanUnicodeIdentifier(parser, context) {
|
|
905
|
+
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
906
|
+
if (!isIdentifierStart(cookedChar))
|
|
907
|
+
parser.report(5);
|
|
908
|
+
parser.tokenValue = String.fromCodePoint(cookedChar);
|
|
909
|
+
return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
|
|
910
|
+
}
|
|
911
|
+
function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
912
|
+
let start = parser.index;
|
|
913
|
+
while (parser.index < parser.end) {
|
|
914
|
+
if (parser.currentChar === 92) {
|
|
915
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
916
|
+
hasEscape = 1;
|
|
917
|
+
const code = scanIdentifierUnicodeEscape(parser);
|
|
918
|
+
if (!isIdentifierPart(code))
|
|
919
|
+
parser.report(5);
|
|
920
|
+
isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
|
|
921
|
+
parser.tokenValue += String.fromCodePoint(code);
|
|
922
|
+
start = parser.index;
|
|
923
|
+
}
|
|
924
|
+
else {
|
|
925
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
926
|
+
if (merged > 0) {
|
|
927
|
+
if (!isIdentifierPart(merged)) {
|
|
928
|
+
parser.report(20, String.fromCodePoint(merged));
|
|
929
|
+
}
|
|
930
|
+
parser.currentChar = merged;
|
|
931
|
+
parser.index++;
|
|
932
|
+
parser.column++;
|
|
933
|
+
}
|
|
934
|
+
else if (!isIdentifierPart(parser.currentChar)) {
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
advanceChar(parser);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (parser.index <= parser.end) {
|
|
941
|
+
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
942
|
+
}
|
|
943
|
+
const { length } = parser.tokenValue;
|
|
944
|
+
if (isValidAsKeyword && length >= 2 && length <= 11) {
|
|
945
|
+
const token = getOwnProperty(descKeywordTable, parser.tokenValue);
|
|
946
|
+
if (token === void 0)
|
|
947
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
948
|
+
if (!hasEscape)
|
|
949
|
+
return token;
|
|
950
|
+
if (token === 209006) {
|
|
951
|
+
if ((context & (2 | 2048)) === 0) {
|
|
952
|
+
return token | -2147483648;
|
|
953
|
+
}
|
|
954
|
+
return -2147483528;
|
|
955
|
+
}
|
|
956
|
+
if (context & 1) {
|
|
957
|
+
if (token === 36970) {
|
|
958
|
+
return -2147483527;
|
|
959
|
+
}
|
|
960
|
+
if ((token & 36864) === 36864) {
|
|
961
|
+
return -2147483527;
|
|
962
|
+
}
|
|
963
|
+
if ((token & 20480) === 20480) {
|
|
964
|
+
if (context & 262144 && (context & 8) === 0) {
|
|
965
|
+
return token | -2147483648;
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
return -2147483528;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return 209018 | -2147483648;
|
|
972
|
+
}
|
|
973
|
+
if (context & 262144 &&
|
|
974
|
+
(context & 8) === 0 &&
|
|
975
|
+
(token & 20480) === 20480) {
|
|
976
|
+
return token | -2147483648;
|
|
977
|
+
}
|
|
978
|
+
if (token === 241771) {
|
|
979
|
+
return context & 262144
|
|
980
|
+
? 209018 | -2147483648
|
|
981
|
+
: context & 1024
|
|
982
|
+
? -2147483528
|
|
983
|
+
: token | -2147483648;
|
|
984
|
+
}
|
|
985
|
+
if (token === 209005) {
|
|
986
|
+
return 209018 | -2147483648;
|
|
987
|
+
}
|
|
988
|
+
if ((token & 36864) === 36864) {
|
|
989
|
+
return token | 12288 | -2147483648;
|
|
990
|
+
}
|
|
991
|
+
return -2147483528;
|
|
992
|
+
}
|
|
993
|
+
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
994
|
+
}
|
|
995
|
+
function scanPrivateIdentifier(parser) {
|
|
996
|
+
let char = advanceChar(parser);
|
|
997
|
+
if (char === 92)
|
|
998
|
+
return 130;
|
|
999
|
+
const merged = consumePossibleSurrogatePair(parser);
|
|
1000
|
+
if (merged)
|
|
1001
|
+
char = merged;
|
|
1002
|
+
if (!isIdentifierStart(char))
|
|
1003
|
+
parser.report(96);
|
|
1004
|
+
return 130;
|
|
1005
|
+
}
|
|
1006
|
+
function scanIdentifierUnicodeEscape(parser) {
|
|
1007
|
+
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1008
|
+
parser.report(5);
|
|
1009
|
+
}
|
|
1010
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1011
|
+
parser.column += 2;
|
|
1012
|
+
return scanUnicodeEscape(parser);
|
|
1013
|
+
}
|
|
1014
|
+
function scanUnicodeEscape(parser) {
|
|
1015
|
+
let codePoint = 0;
|
|
1016
|
+
const char = parser.currentChar;
|
|
1017
|
+
if (char === 123) {
|
|
1018
|
+
const begin = parser.index - 2;
|
|
1019
|
+
while (CharTypes[advanceChar(parser)] & 64) {
|
|
1020
|
+
codePoint = (codePoint << 4) | toHex(parser.currentChar);
|
|
1021
|
+
if (codePoint > 1114111)
|
|
1022
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
|
|
1023
|
+
}
|
|
1024
|
+
if (parser.currentChar !== 125) {
|
|
1025
|
+
throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
|
|
1026
|
+
}
|
|
1027
|
+
advanceChar(parser);
|
|
1028
|
+
return codePoint;
|
|
1029
|
+
}
|
|
1030
|
+
if ((CharTypes[char] & 64) === 0)
|
|
1031
|
+
parser.report(7);
|
|
1032
|
+
const char2 = parser.source.charCodeAt(parser.index + 1);
|
|
1033
|
+
if ((CharTypes[char2] & 64) === 0)
|
|
1034
|
+
parser.report(7);
|
|
1035
|
+
const char3 = parser.source.charCodeAt(parser.index + 2);
|
|
1036
|
+
if ((CharTypes[char3] & 64) === 0)
|
|
1037
|
+
parser.report(7);
|
|
1038
|
+
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
1039
|
+
if ((CharTypes[char4] & 64) === 0)
|
|
1040
|
+
parser.report(7);
|
|
1041
|
+
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1042
|
+
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1043
|
+
parser.column += 4;
|
|
1044
|
+
return codePoint;
|
|
1045
|
+
}
|
|
1224
1046
|
|
|
1225
1047
|
function scanNumber(parser, context, kind) {
|
|
1226
1048
|
let char = parser.currentChar;
|
|
@@ -1369,475 +1191,472 @@ function scanNumber(parser, context, kind) {
|
|
|
1369
1191
|
}
|
|
1370
1192
|
else {
|
|
1371
1193
|
if ((char | 32) === 101) {
|
|
1372
|
-
char = advanceChar(parser);
|
|
1373
|
-
if (CharTypes[char] & 256)
|
|
1374
|
-
char = advanceChar(parser);
|
|
1375
|
-
const { index } = parser;
|
|
1376
|
-
if ((CharTypes[char] & 16) === 0)
|
|
1377
|
-
parser.report(11);
|
|
1378
|
-
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1379
|
-
char = parser.currentChar;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) {
|
|
1383
|
-
parser.report(13);
|
|
1384
|
-
}
|
|
1385
|
-
if (isBigInt) {
|
|
1386
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1387
|
-
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1388
|
-
return 134283388;
|
|
1389
|
-
}
|
|
1390
|
-
parser.tokenValue =
|
|
1391
|
-
kind & (1 | 2 | 8 | 4)
|
|
1392
|
-
? value
|
|
1393
|
-
: kind & 32
|
|
1394
|
-
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1395
|
-
: +value;
|
|
1396
|
-
if (parser.options.raw)
|
|
1397
|
-
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1398
|
-
return 134283266;
|
|
1399
|
-
}
|
|
1400
|
-
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1401
|
-
let allowSeparator = 0;
|
|
1402
|
-
let start = parser.index;
|
|
1403
|
-
let ret = '';
|
|
1404
|
-
while (CharTypes[char] & (16 | 4096)) {
|
|
1405
|
-
if (char === 95) {
|
|
1406
|
-
const { index } = parser;
|
|
1407
|
-
char = advanceChar(parser);
|
|
1408
|
-
if (char === 95) {
|
|
1409
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1410
|
-
}
|
|
1411
|
-
allowSeparator = 1;
|
|
1412
|
-
ret += parser.source.substring(start, index);
|
|
1413
|
-
start = parser.index;
|
|
1414
|
-
continue;
|
|
1415
|
-
}
|
|
1416
|
-
allowSeparator = 0;
|
|
1417
|
-
char = advanceChar(parser);
|
|
1418
|
-
}
|
|
1419
|
-
if (allowSeparator) {
|
|
1420
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1421
|
-
}
|
|
1422
|
-
return ret + parser.source.substring(start, parser.index);
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
const KeywordDescTable = [
|
|
1426
|
-
'end of source',
|
|
1427
|
-
'identifier', 'number', 'string', 'regular expression',
|
|
1428
|
-
'false', 'true', 'null',
|
|
1429
|
-
'template continuation', 'template tail',
|
|
1430
|
-
'=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
|
|
1431
|
-
'++', '--',
|
|
1432
|
-
'=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
|
|
1433
|
-
'&=', '||=', '&&=', '??=',
|
|
1434
|
-
'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
|
|
1435
|
-
'||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
|
|
1436
|
-
'var', 'let', 'const',
|
|
1437
|
-
'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
|
|
1438
|
-
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
1439
|
-
'this', 'throw', 'try', 'while', 'with',
|
|
1440
|
-
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
1441
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
1442
|
-
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
1443
|
-
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
1444
|
-
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
1445
|
-
];
|
|
1446
|
-
const descKeywordTable = {
|
|
1447
|
-
this: 86111,
|
|
1448
|
-
function: 86104,
|
|
1449
|
-
if: 20569,
|
|
1450
|
-
return: 20572,
|
|
1451
|
-
var: 86088,
|
|
1452
|
-
else: 20563,
|
|
1453
|
-
for: 20567,
|
|
1454
|
-
new: 86107,
|
|
1455
|
-
in: 8673330,
|
|
1456
|
-
typeof: 16863275,
|
|
1457
|
-
while: 20578,
|
|
1458
|
-
case: 20556,
|
|
1459
|
-
break: 20555,
|
|
1460
|
-
try: 20577,
|
|
1461
|
-
catch: 20557,
|
|
1462
|
-
delete: 16863276,
|
|
1463
|
-
throw: 86112,
|
|
1464
|
-
switch: 86110,
|
|
1465
|
-
continue: 20559,
|
|
1466
|
-
default: 20561,
|
|
1467
|
-
instanceof: 8411187,
|
|
1468
|
-
do: 20562,
|
|
1469
|
-
void: 16863277,
|
|
1470
|
-
finally: 20566,
|
|
1471
|
-
async: 209005,
|
|
1472
|
-
await: 209006,
|
|
1473
|
-
class: 86094,
|
|
1474
|
-
const: 86090,
|
|
1475
|
-
constructor: 12399,
|
|
1476
|
-
debugger: 20560,
|
|
1477
|
-
export: 20564,
|
|
1478
|
-
extends: 20565,
|
|
1479
|
-
false: 86021,
|
|
1480
|
-
from: 209011,
|
|
1481
|
-
get: 209008,
|
|
1482
|
-
implements: 36964,
|
|
1483
|
-
import: 86106,
|
|
1484
|
-
interface: 36965,
|
|
1485
|
-
let: 241737,
|
|
1486
|
-
null: 86023,
|
|
1487
|
-
of: 471156,
|
|
1488
|
-
package: 36966,
|
|
1489
|
-
private: 36967,
|
|
1490
|
-
protected: 36968,
|
|
1491
|
-
public: 36969,
|
|
1492
|
-
set: 209009,
|
|
1493
|
-
static: 36970,
|
|
1494
|
-
super: 86109,
|
|
1495
|
-
true: 86022,
|
|
1496
|
-
with: 20579,
|
|
1497
|
-
yield: 241771,
|
|
1498
|
-
enum: 86133,
|
|
1499
|
-
eval: 537079926,
|
|
1500
|
-
as: 77932,
|
|
1501
|
-
arguments: 537079927,
|
|
1502
|
-
target: 209029,
|
|
1503
|
-
meta: 209030,
|
|
1504
|
-
accessor: 12402,
|
|
1505
|
-
};
|
|
1506
|
-
|
|
1507
|
-
function matchOrInsertSemicolon(parser, context) {
|
|
1508
|
-
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
1509
|
-
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
1510
|
-
}
|
|
1511
|
-
if (!consumeOpt(parser, context, 1074790417)) {
|
|
1512
|
-
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
1516
|
-
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
1517
|
-
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
1518
|
-
return 1;
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
return 0;
|
|
1522
|
-
}
|
|
1523
|
-
function optionalBit(parser, context, t) {
|
|
1524
|
-
if (parser.getToken() !== t)
|
|
1525
|
-
return 0;
|
|
1526
|
-
nextToken(parser, context);
|
|
1527
|
-
return 1;
|
|
1528
|
-
}
|
|
1529
|
-
function consumeOpt(parser, context, t) {
|
|
1530
|
-
if (parser.getToken() !== t)
|
|
1531
|
-
return false;
|
|
1532
|
-
nextToken(parser, context);
|
|
1533
|
-
return true;
|
|
1534
|
-
}
|
|
1535
|
-
function consume(parser, context, t) {
|
|
1536
|
-
if (parser.getToken() !== t)
|
|
1537
|
-
parser.report(25, KeywordDescTable[t & 255]);
|
|
1538
|
-
nextToken(parser, context);
|
|
1539
|
-
}
|
|
1540
|
-
function reinterpretToPattern(parser, node) {
|
|
1541
|
-
switch (node.type) {
|
|
1542
|
-
case 'ArrayExpression': {
|
|
1543
|
-
node.type = 'ArrayPattern';
|
|
1544
|
-
const { elements } = node;
|
|
1545
|
-
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
1546
|
-
const element = elements[i];
|
|
1547
|
-
if (element)
|
|
1548
|
-
reinterpretToPattern(parser, element);
|
|
1549
|
-
}
|
|
1550
|
-
return;
|
|
1551
|
-
}
|
|
1552
|
-
case 'ObjectExpression': {
|
|
1553
|
-
node.type = 'ObjectPattern';
|
|
1554
|
-
const { properties } = node;
|
|
1555
|
-
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
1556
|
-
reinterpretToPattern(parser, properties[i]);
|
|
1557
|
-
}
|
|
1558
|
-
return;
|
|
1559
|
-
}
|
|
1560
|
-
case 'AssignmentExpression':
|
|
1561
|
-
node.type = 'AssignmentPattern';
|
|
1562
|
-
if (node.operator !== '=')
|
|
1563
|
-
parser.report(71);
|
|
1564
|
-
delete node.operator;
|
|
1565
|
-
reinterpretToPattern(parser, node.left);
|
|
1566
|
-
return;
|
|
1567
|
-
case 'Property':
|
|
1568
|
-
reinterpretToPattern(parser, node.value);
|
|
1569
|
-
return;
|
|
1570
|
-
case 'SpreadElement':
|
|
1571
|
-
node.type = 'RestElement';
|
|
1572
|
-
reinterpretToPattern(parser, node.argument);
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
1576
|
-
if (context & 1) {
|
|
1577
|
-
if ((t & 36864) === 36864) {
|
|
1578
|
-
parser.report(118);
|
|
1579
|
-
}
|
|
1580
|
-
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
1581
|
-
parser.report(119);
|
|
1194
|
+
char = advanceChar(parser);
|
|
1195
|
+
if (CharTypes[char] & 256)
|
|
1196
|
+
char = advanceChar(parser);
|
|
1197
|
+
const { index } = parser;
|
|
1198
|
+
if ((CharTypes[char] & 16) === 0)
|
|
1199
|
+
parser.report(11);
|
|
1200
|
+
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1201
|
+
char = parser.currentChar;
|
|
1582
1202
|
}
|
|
1583
1203
|
}
|
|
1584
|
-
if ((
|
|
1585
|
-
parser.report(
|
|
1204
|
+
if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) {
|
|
1205
|
+
parser.report(13);
|
|
1586
1206
|
}
|
|
1587
|
-
if (
|
|
1588
|
-
parser.
|
|
1207
|
+
if (isBigInt) {
|
|
1208
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1209
|
+
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1210
|
+
return 134283388;
|
|
1589
1211
|
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1212
|
+
parser.tokenValue =
|
|
1213
|
+
kind & (1 | 2 | 8 | 4)
|
|
1214
|
+
? value
|
|
1215
|
+
: kind & 32
|
|
1216
|
+
? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
|
|
1217
|
+
: +value;
|
|
1218
|
+
if (parser.options.raw)
|
|
1219
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1220
|
+
return 134283266;
|
|
1221
|
+
}
|
|
1222
|
+
function scanDecimalDigitsOrSeparator(parser, char) {
|
|
1223
|
+
let allowSeparator = 0;
|
|
1224
|
+
let start = parser.index;
|
|
1225
|
+
let ret = '';
|
|
1226
|
+
while (CharTypes[char] & (16 | 4096)) {
|
|
1227
|
+
if (char === 95) {
|
|
1228
|
+
const { index } = parser;
|
|
1229
|
+
char = advanceChar(parser);
|
|
1230
|
+
if (char === 95) {
|
|
1231
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
|
|
1232
|
+
}
|
|
1233
|
+
allowSeparator = 1;
|
|
1234
|
+
ret += parser.source.substring(start, index);
|
|
1235
|
+
start = parser.index;
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
allowSeparator = 0;
|
|
1239
|
+
char = advanceChar(parser);
|
|
1592
1240
|
}
|
|
1593
|
-
if (
|
|
1594
|
-
parser.
|
|
1241
|
+
if (allowSeparator) {
|
|
1242
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
|
|
1595
1243
|
}
|
|
1244
|
+
return ret + parser.source.substring(start, parser.index);
|
|
1596
1245
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1246
|
+
|
|
1247
|
+
var RegexState;
|
|
1248
|
+
(function (RegexState) {
|
|
1249
|
+
RegexState[RegexState["Empty"] = 0] = "Empty";
|
|
1250
|
+
RegexState[RegexState["Escape"] = 1] = "Escape";
|
|
1251
|
+
RegexState[RegexState["Class"] = 2] = "Class";
|
|
1252
|
+
})(RegexState || (RegexState = {}));
|
|
1253
|
+
var RegexFlags;
|
|
1254
|
+
(function (RegexFlags) {
|
|
1255
|
+
RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
|
|
1256
|
+
RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
|
|
1257
|
+
RegexFlags[RegexFlags["Global"] = 2] = "Global";
|
|
1258
|
+
RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
|
|
1259
|
+
RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
|
|
1260
|
+
RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
|
|
1261
|
+
RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
|
|
1262
|
+
RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
|
|
1263
|
+
RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
|
|
1264
|
+
})(RegexFlags || (RegexFlags = {}));
|
|
1265
|
+
function scanRegularExpression(parser) {
|
|
1266
|
+
const bodyStart = parser.index;
|
|
1267
|
+
let preparseState = RegexState.Empty;
|
|
1268
|
+
loop: while (true) {
|
|
1269
|
+
const ch = parser.currentChar;
|
|
1270
|
+
advanceChar(parser);
|
|
1271
|
+
if (preparseState & RegexState.Escape) {
|
|
1272
|
+
preparseState &= ~RegexState.Escape;
|
|
1601
1273
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1274
|
+
else {
|
|
1275
|
+
switch (ch) {
|
|
1276
|
+
case 47:
|
|
1277
|
+
if (!preparseState)
|
|
1278
|
+
break loop;
|
|
1279
|
+
else
|
|
1280
|
+
break;
|
|
1281
|
+
case 92:
|
|
1282
|
+
preparseState |= RegexState.Escape;
|
|
1283
|
+
break;
|
|
1284
|
+
case 91:
|
|
1285
|
+
preparseState |= RegexState.Class;
|
|
1286
|
+
break;
|
|
1287
|
+
case 93:
|
|
1288
|
+
preparseState &= RegexState.Escape;
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1604
1291
|
}
|
|
1605
|
-
if (
|
|
1606
|
-
|
|
1292
|
+
if (ch === 13 ||
|
|
1293
|
+
ch === 10 ||
|
|
1294
|
+
ch === 8232 ||
|
|
1295
|
+
ch === 8233) {
|
|
1296
|
+
parser.report(34);
|
|
1607
1297
|
}
|
|
1608
|
-
if (
|
|
1609
|
-
parser.report(
|
|
1298
|
+
if (parser.index >= parser.source.length) {
|
|
1299
|
+
return parser.report(34);
|
|
1610
1300
|
}
|
|
1611
1301
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1302
|
+
const bodyEnd = parser.index - 1;
|
|
1303
|
+
let mask = RegexFlags.Empty;
|
|
1304
|
+
let char = parser.currentChar;
|
|
1305
|
+
const { index: flagStart } = parser;
|
|
1306
|
+
while (isIdentifierPart(char)) {
|
|
1307
|
+
switch (char) {
|
|
1308
|
+
case 103:
|
|
1309
|
+
if (mask & RegexFlags.Global)
|
|
1310
|
+
parser.report(36, 'g');
|
|
1311
|
+
mask |= RegexFlags.Global;
|
|
1312
|
+
break;
|
|
1313
|
+
case 105:
|
|
1314
|
+
if (mask & RegexFlags.IgnoreCase)
|
|
1315
|
+
parser.report(36, 'i');
|
|
1316
|
+
mask |= RegexFlags.IgnoreCase;
|
|
1317
|
+
break;
|
|
1318
|
+
case 109:
|
|
1319
|
+
if (mask & RegexFlags.Multiline)
|
|
1320
|
+
parser.report(36, 'm');
|
|
1321
|
+
mask |= RegexFlags.Multiline;
|
|
1322
|
+
break;
|
|
1323
|
+
case 117:
|
|
1324
|
+
if (mask & RegexFlags.Unicode)
|
|
1325
|
+
parser.report(36, 'u');
|
|
1326
|
+
if (mask & RegexFlags.UnicodeSets)
|
|
1327
|
+
parser.report(36, 'vu');
|
|
1328
|
+
mask |= RegexFlags.Unicode;
|
|
1329
|
+
break;
|
|
1330
|
+
case 118:
|
|
1331
|
+
if (mask & RegexFlags.Unicode)
|
|
1332
|
+
parser.report(36, 'uv');
|
|
1333
|
+
if (mask & RegexFlags.UnicodeSets)
|
|
1334
|
+
parser.report(36, 'v');
|
|
1335
|
+
mask |= RegexFlags.UnicodeSets;
|
|
1336
|
+
break;
|
|
1337
|
+
case 121:
|
|
1338
|
+
if (mask & RegexFlags.Sticky)
|
|
1339
|
+
parser.report(36, 'y');
|
|
1340
|
+
mask |= RegexFlags.Sticky;
|
|
1341
|
+
break;
|
|
1342
|
+
case 115:
|
|
1343
|
+
if (mask & RegexFlags.DotAll)
|
|
1344
|
+
parser.report(36, 's');
|
|
1345
|
+
mask |= RegexFlags.DotAll;
|
|
1346
|
+
break;
|
|
1347
|
+
case 100:
|
|
1348
|
+
if (mask & RegexFlags.Indices)
|
|
1349
|
+
parser.report(36, 'd');
|
|
1350
|
+
mask |= RegexFlags.Indices;
|
|
1351
|
+
break;
|
|
1352
|
+
default:
|
|
1353
|
+
parser.report(35);
|
|
1643
1354
|
}
|
|
1644
|
-
|
|
1645
|
-
isIterationStatement = 0;
|
|
1646
|
-
labels = labels['$'];
|
|
1647
|
-
}
|
|
1648
|
-
return 0;
|
|
1649
|
-
}
|
|
1650
|
-
function validateAndDeclareLabel(parser, labels, name) {
|
|
1651
|
-
let set = labels;
|
|
1652
|
-
while (set) {
|
|
1653
|
-
if (set['$' + name])
|
|
1654
|
-
parser.report(136, name);
|
|
1655
|
-
set = set['$'];
|
|
1656
|
-
}
|
|
1657
|
-
labels['$' + name] = 1;
|
|
1658
|
-
}
|
|
1659
|
-
function isEqualTagName(elementName) {
|
|
1660
|
-
switch (elementName.type) {
|
|
1661
|
-
case 'JSXIdentifier':
|
|
1662
|
-
return elementName.name;
|
|
1663
|
-
case 'JSXNamespacedName':
|
|
1664
|
-
return elementName.namespace + ':' + elementName.name;
|
|
1665
|
-
case 'JSXMemberExpression':
|
|
1666
|
-
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
function isValidIdentifier(context, t) {
|
|
1670
|
-
if (context & (1 | 1024)) {
|
|
1671
|
-
if (context & 2 && t === 209006)
|
|
1672
|
-
return false;
|
|
1673
|
-
if (context & 1024 && t === 241771)
|
|
1674
|
-
return false;
|
|
1675
|
-
return (t & 12288) === 12288;
|
|
1676
|
-
}
|
|
1677
|
-
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
1678
|
-
}
|
|
1679
|
-
function classifyIdentifier(parser, context, t) {
|
|
1680
|
-
if ((t & 537079808) === 537079808) {
|
|
1681
|
-
if (context & 1)
|
|
1682
|
-
parser.report(119);
|
|
1683
|
-
parser.flags |= 512;
|
|
1355
|
+
char = advanceChar(parser);
|
|
1684
1356
|
}
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
1693
|
-
while (isIdPart[advanceChar(parser)])
|
|
1694
|
-
;
|
|
1695
|
-
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1696
|
-
return parser.currentChar !== 92 && parser.currentChar <= 0x7e
|
|
1697
|
-
? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
|
|
1698
|
-
: scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
1357
|
+
const flags = parser.source.slice(flagStart, parser.index);
|
|
1358
|
+
const pattern = parser.source.slice(bodyStart, bodyEnd);
|
|
1359
|
+
parser.tokenRegExp = { pattern, flags };
|
|
1360
|
+
if (parser.options.raw)
|
|
1361
|
+
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1362
|
+
parser.tokenValue = validate(parser, pattern, flags);
|
|
1363
|
+
return 65540;
|
|
1699
1364
|
}
|
|
1700
|
-
function
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1365
|
+
function validate(parser, pattern, flags) {
|
|
1366
|
+
try {
|
|
1367
|
+
return new RegExp(pattern, flags);
|
|
1368
|
+
}
|
|
1369
|
+
catch {
|
|
1370
|
+
if (!parser.options.validateRegex) {
|
|
1371
|
+
return null;
|
|
1372
|
+
}
|
|
1373
|
+
parser.report(34);
|
|
1374
|
+
}
|
|
1706
1375
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
parser.
|
|
1718
|
-
|
|
1376
|
+
|
|
1377
|
+
function scanString(parser, context, quote) {
|
|
1378
|
+
const { index: start } = parser;
|
|
1379
|
+
let ret = '';
|
|
1380
|
+
let char = advanceChar(parser);
|
|
1381
|
+
let marker = parser.index;
|
|
1382
|
+
while ((CharTypes[char] & 8) === 0) {
|
|
1383
|
+
if (char === quote) {
|
|
1384
|
+
ret += parser.source.slice(marker, parser.index);
|
|
1385
|
+
advanceChar(parser);
|
|
1386
|
+
if (parser.options.raw)
|
|
1387
|
+
parser.tokenRaw = parser.source.slice(start, parser.index);
|
|
1388
|
+
parser.tokenValue = ret;
|
|
1389
|
+
return 134283267;
|
|
1719
1390
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1391
|
+
if ((char & 8) === 8 && char === 92) {
|
|
1392
|
+
ret += parser.source.slice(marker, parser.index);
|
|
1393
|
+
char = advanceChar(parser);
|
|
1394
|
+
if (char < 0x7f || char === 8232 || char === 8233) {
|
|
1395
|
+
const code = parseEscape(parser, context, char);
|
|
1396
|
+
if (code >= 0)
|
|
1397
|
+
ret += String.fromCodePoint(code);
|
|
1398
|
+
else
|
|
1399
|
+
handleStringError(parser, code, 0);
|
|
1729
1400
|
}
|
|
1730
|
-
else
|
|
1731
|
-
|
|
1401
|
+
else {
|
|
1402
|
+
ret += String.fromCodePoint(char);
|
|
1732
1403
|
}
|
|
1733
|
-
|
|
1404
|
+
marker = parser.index + 1;
|
|
1734
1405
|
}
|
|
1406
|
+
else if (char === 8232 || char === 8233) {
|
|
1407
|
+
parser.column = -1;
|
|
1408
|
+
parser.line++;
|
|
1409
|
+
}
|
|
1410
|
+
if (parser.index >= parser.end)
|
|
1411
|
+
parser.report(16);
|
|
1412
|
+
char = advanceChar(parser);
|
|
1735
1413
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
return
|
|
1744
|
-
|
|
1745
|
-
return
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1414
|
+
parser.report(16);
|
|
1415
|
+
}
|
|
1416
|
+
function parseEscape(parser, context, first, isTemplate = 0) {
|
|
1417
|
+
switch (first) {
|
|
1418
|
+
case 98:
|
|
1419
|
+
return 8;
|
|
1420
|
+
case 102:
|
|
1421
|
+
return 12;
|
|
1422
|
+
case 114:
|
|
1423
|
+
return 13;
|
|
1424
|
+
case 110:
|
|
1425
|
+
return 10;
|
|
1426
|
+
case 116:
|
|
1427
|
+
return 9;
|
|
1428
|
+
case 118:
|
|
1429
|
+
return 11;
|
|
1430
|
+
case 13: {
|
|
1431
|
+
if (parser.index < parser.end) {
|
|
1432
|
+
const nextChar = parser.source.charCodeAt(parser.index + 1);
|
|
1433
|
+
if (nextChar === 10) {
|
|
1434
|
+
parser.index = parser.index + 1;
|
|
1435
|
+
parser.currentChar = nextChar;
|
|
1436
|
+
}
|
|
1749
1437
|
}
|
|
1750
|
-
return -2147483528;
|
|
1751
1438
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1439
|
+
case 10:
|
|
1440
|
+
case 8232:
|
|
1441
|
+
case 8233:
|
|
1442
|
+
parser.column = -1;
|
|
1443
|
+
parser.line++;
|
|
1444
|
+
return -1;
|
|
1445
|
+
case 48:
|
|
1446
|
+
case 49:
|
|
1447
|
+
case 50:
|
|
1448
|
+
case 51: {
|
|
1449
|
+
let code = first - 48;
|
|
1450
|
+
let index = parser.index + 1;
|
|
1451
|
+
let column = parser.column + 1;
|
|
1452
|
+
if (index < parser.end) {
|
|
1453
|
+
const next = parser.source.charCodeAt(index);
|
|
1454
|
+
if ((CharTypes[next] & 32) === 0) {
|
|
1455
|
+
if (code !== 0 || CharTypes[next] & 512) {
|
|
1456
|
+
if (context & 1 || isTemplate)
|
|
1457
|
+
return -2;
|
|
1458
|
+
parser.flags |= 64;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
else if (context & 1 || isTemplate) {
|
|
1462
|
+
return -2;
|
|
1463
|
+
}
|
|
1464
|
+
else {
|
|
1465
|
+
parser.currentChar = next;
|
|
1466
|
+
code = (code << 3) | (next - 48);
|
|
1467
|
+
index++;
|
|
1468
|
+
column++;
|
|
1469
|
+
if (index < parser.end) {
|
|
1470
|
+
const next = parser.source.charCodeAt(index);
|
|
1471
|
+
if (CharTypes[next] & 32) {
|
|
1472
|
+
parser.currentChar = next;
|
|
1473
|
+
code = (code << 3) | (next - 48);
|
|
1474
|
+
index++;
|
|
1475
|
+
column++;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
parser.flags |= 64;
|
|
1479
|
+
}
|
|
1480
|
+
parser.index = index - 1;
|
|
1481
|
+
parser.column = column - 1;
|
|
1755
1482
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1483
|
+
return code;
|
|
1484
|
+
}
|
|
1485
|
+
case 52:
|
|
1486
|
+
case 53:
|
|
1487
|
+
case 54:
|
|
1488
|
+
case 55: {
|
|
1489
|
+
if (isTemplate || context & 1)
|
|
1490
|
+
return -2;
|
|
1491
|
+
let code = first - 48;
|
|
1492
|
+
const index = parser.index + 1;
|
|
1493
|
+
const column = parser.column + 1;
|
|
1494
|
+
if (index < parser.end) {
|
|
1495
|
+
const next = parser.source.charCodeAt(index);
|
|
1496
|
+
if (CharTypes[next] & 32) {
|
|
1497
|
+
code = (code << 3) | (next - 48);
|
|
1498
|
+
parser.currentChar = next;
|
|
1499
|
+
parser.index = index;
|
|
1500
|
+
parser.column = column;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
parser.flags |= 64;
|
|
1504
|
+
return code;
|
|
1505
|
+
}
|
|
1506
|
+
case 120: {
|
|
1507
|
+
const ch1 = advanceChar(parser);
|
|
1508
|
+
if ((CharTypes[ch1] & 64) === 0)
|
|
1509
|
+
return -4;
|
|
1510
|
+
const hi = toHex(ch1);
|
|
1511
|
+
const ch2 = advanceChar(parser);
|
|
1512
|
+
if ((CharTypes[ch2] & 64) === 0)
|
|
1513
|
+
return -4;
|
|
1514
|
+
const lo = toHex(ch2);
|
|
1515
|
+
return (hi << 4) | lo;
|
|
1516
|
+
}
|
|
1517
|
+
case 117: {
|
|
1518
|
+
const ch = advanceChar(parser);
|
|
1519
|
+
if (parser.currentChar === 123) {
|
|
1520
|
+
let code = 0;
|
|
1521
|
+
while ((CharTypes[advanceChar(parser)] & 64) !== 0) {
|
|
1522
|
+
code = (code << 4) | toHex(parser.currentChar);
|
|
1523
|
+
if (code > 1114111)
|
|
1524
|
+
return -5;
|
|
1525
|
+
}
|
|
1526
|
+
if (parser.currentChar < 1 || parser.currentChar !== 125) {
|
|
1527
|
+
return -4;
|
|
1528
|
+
}
|
|
1529
|
+
return code;
|
|
1530
|
+
}
|
|
1531
|
+
else {
|
|
1532
|
+
if ((CharTypes[ch] & 64) === 0)
|
|
1533
|
+
return -4;
|
|
1534
|
+
const ch2 = parser.source.charCodeAt(parser.index + 1);
|
|
1535
|
+
if ((CharTypes[ch2] & 64) === 0)
|
|
1536
|
+
return -4;
|
|
1537
|
+
const ch3 = parser.source.charCodeAt(parser.index + 2);
|
|
1538
|
+
if ((CharTypes[ch3] & 64) === 0)
|
|
1539
|
+
return -4;
|
|
1540
|
+
const ch4 = parser.source.charCodeAt(parser.index + 3);
|
|
1541
|
+
if ((CharTypes[ch4] & 64) === 0)
|
|
1542
|
+
return -4;
|
|
1543
|
+
parser.index += 3;
|
|
1544
|
+
parser.column += 3;
|
|
1545
|
+
parser.currentChar = parser.source.charCodeAt(parser.index);
|
|
1546
|
+
return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
case 56:
|
|
1550
|
+
case 57:
|
|
1551
|
+
if (isTemplate || !parser.options.webcompat || context & 1)
|
|
1552
|
+
return -3;
|
|
1553
|
+
parser.flags |= 4096;
|
|
1554
|
+
default:
|
|
1555
|
+
return first;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
function handleStringError(parser, code, isTemplate) {
|
|
1559
|
+
switch (code) {
|
|
1560
|
+
case -1:
|
|
1561
|
+
return;
|
|
1562
|
+
case -2:
|
|
1563
|
+
parser.report(isTemplate ? 2 : 1);
|
|
1564
|
+
case -3:
|
|
1565
|
+
parser.report(isTemplate ? 3 : 14);
|
|
1566
|
+
case -4:
|
|
1567
|
+
parser.report(7);
|
|
1568
|
+
case -5:
|
|
1569
|
+
parser.report(104);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
function scanTemplate(parser, context) {
|
|
1574
|
+
const { index: start } = parser;
|
|
1575
|
+
let token = 67174409;
|
|
1576
|
+
let ret = '';
|
|
1577
|
+
let char = advanceChar(parser);
|
|
1578
|
+
while (char !== 96) {
|
|
1579
|
+
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
1580
|
+
advanceChar(parser);
|
|
1581
|
+
token = 67174408;
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1584
|
+
else if (char === 92) {
|
|
1585
|
+
char = advanceChar(parser);
|
|
1586
|
+
if (char > 0x7e) {
|
|
1587
|
+
ret += String.fromCodePoint(char);
|
|
1758
1588
|
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1589
|
+
else {
|
|
1590
|
+
const { index, line, column } = parser;
|
|
1591
|
+
const code = parseEscape(parser, context | 1, char, 1);
|
|
1592
|
+
if (code >= 0) {
|
|
1593
|
+
ret += String.fromCodePoint(code);
|
|
1594
|
+
}
|
|
1595
|
+
else if (code !== -1 && context & 64) {
|
|
1596
|
+
parser.index = index;
|
|
1597
|
+
parser.line = line;
|
|
1598
|
+
parser.column = column;
|
|
1599
|
+
ret = null;
|
|
1600
|
+
char = scanBadTemplate(parser, char);
|
|
1601
|
+
if (char < 0)
|
|
1602
|
+
token = 67174408;
|
|
1603
|
+
break;
|
|
1762
1604
|
}
|
|
1763
1605
|
else {
|
|
1764
|
-
|
|
1606
|
+
handleStringError(parser, code, 1);
|
|
1765
1607
|
}
|
|
1766
1608
|
}
|
|
1767
|
-
return 209018 | -2147483648;
|
|
1768
|
-
}
|
|
1769
|
-
if (context & 262144 &&
|
|
1770
|
-
(context & 8) === 0 &&
|
|
1771
|
-
(token & 20480) === 20480) {
|
|
1772
|
-
return token | -2147483648;
|
|
1773
|
-
}
|
|
1774
|
-
if (token === 241771) {
|
|
1775
|
-
return context & 262144
|
|
1776
|
-
? 209018 | -2147483648
|
|
1777
|
-
: context & 1024
|
|
1778
|
-
? -2147483528
|
|
1779
|
-
: token | -2147483648;
|
|
1780
|
-
}
|
|
1781
|
-
if (token === 209005) {
|
|
1782
|
-
return 209018 | -2147483648;
|
|
1783
1609
|
}
|
|
1784
|
-
if (
|
|
1785
|
-
|
|
1610
|
+
else if (parser.index < parser.end) {
|
|
1611
|
+
if (char === 13 && parser.source.charCodeAt(parser.index) === 10) {
|
|
1612
|
+
ret += String.fromCodePoint(char);
|
|
1613
|
+
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
1614
|
+
}
|
|
1615
|
+
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
1616
|
+
parser.column = -1;
|
|
1617
|
+
parser.line++;
|
|
1618
|
+
}
|
|
1619
|
+
ret += String.fromCodePoint(char);
|
|
1786
1620
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
}
|
|
1791
|
-
function scanPrivateIdentifier(parser) {
|
|
1792
|
-
let char = advanceChar(parser);
|
|
1793
|
-
if (char === 92)
|
|
1794
|
-
return 130;
|
|
1795
|
-
const merged = consumePossibleSurrogatePair(parser);
|
|
1796
|
-
if (merged)
|
|
1797
|
-
char = merged;
|
|
1798
|
-
if (!isIdentifierStart(char))
|
|
1799
|
-
parser.report(96);
|
|
1800
|
-
return 130;
|
|
1801
|
-
}
|
|
1802
|
-
function scanIdentifierUnicodeEscape(parser) {
|
|
1803
|
-
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
1804
|
-
parser.report(5);
|
|
1621
|
+
if (parser.index >= parser.end)
|
|
1622
|
+
parser.report(17);
|
|
1623
|
+
char = advanceChar(parser);
|
|
1805
1624
|
}
|
|
1806
|
-
|
|
1807
|
-
parser.
|
|
1808
|
-
|
|
1625
|
+
advanceChar(parser);
|
|
1626
|
+
parser.tokenValue = ret;
|
|
1627
|
+
parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
1628
|
+
return token;
|
|
1809
1629
|
}
|
|
1810
|
-
function
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1630
|
+
function scanBadTemplate(parser, ch) {
|
|
1631
|
+
while (ch !== 96) {
|
|
1632
|
+
switch (ch) {
|
|
1633
|
+
case 36: {
|
|
1634
|
+
const index = parser.index + 1;
|
|
1635
|
+
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
1636
|
+
parser.index = index;
|
|
1637
|
+
parser.column++;
|
|
1638
|
+
return -ch;
|
|
1639
|
+
}
|
|
1640
|
+
break;
|
|
1641
|
+
}
|
|
1642
|
+
case 10:
|
|
1643
|
+
case 8232:
|
|
1644
|
+
case 8233:
|
|
1645
|
+
parser.column = -1;
|
|
1646
|
+
parser.line++;
|
|
1822
1647
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1648
|
+
if (parser.index >= parser.end)
|
|
1649
|
+
parser.report(17);
|
|
1650
|
+
ch = advanceChar(parser);
|
|
1825
1651
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
if (
|
|
1830
|
-
parser.report(
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
const char4 = parser.source.charCodeAt(parser.index + 3);
|
|
1835
|
-
if ((CharTypes[char4] & 64) === 0)
|
|
1836
|
-
parser.report(7);
|
|
1837
|
-
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1838
|
-
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1839
|
-
parser.column += 4;
|
|
1840
|
-
return codePoint;
|
|
1652
|
+
return ch;
|
|
1653
|
+
}
|
|
1654
|
+
function scanTemplateTail(parser, context) {
|
|
1655
|
+
if (parser.index >= parser.end)
|
|
1656
|
+
parser.report(0);
|
|
1657
|
+
parser.index--;
|
|
1658
|
+
parser.column--;
|
|
1659
|
+
return scanTemplate(parser, context);
|
|
1841
1660
|
}
|
|
1842
1661
|
|
|
1843
1662
|
const TokenLookup = [
|
|
@@ -1980,7 +1799,6 @@ function nextToken(parser, context) {
|
|
|
1980
1799
|
function scanSingleToken(parser, context, state) {
|
|
1981
1800
|
const isStartOfLine = parser.index === 0;
|
|
1982
1801
|
const { source } = parser;
|
|
1983
|
-
let start = parser.currentLocation;
|
|
1984
1802
|
while (parser.index < parser.end) {
|
|
1985
1803
|
parser.tokenIndex = parser.index;
|
|
1986
1804
|
parser.tokenColumn = parser.column;
|
|
@@ -2050,7 +1868,6 @@ function scanSingleToken(parser, context, state) {
|
|
|
2050
1868
|
parser.column += 3;
|
|
2051
1869
|
parser.currentChar = source.charCodeAt((parser.index += 3));
|
|
2052
1870
|
state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenStart);
|
|
2053
|
-
start = parser.tokenStart;
|
|
2054
1871
|
continue;
|
|
2055
1872
|
}
|
|
2056
1873
|
return 8456256;
|
|
@@ -2131,8 +1948,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2131
1948
|
if (!parser.options.webcompat)
|
|
2132
1949
|
parser.report(112);
|
|
2133
1950
|
advanceChar(parser);
|
|
2134
|
-
state = skipSingleHTMLComment(parser, source, state, context, 3,
|
|
2135
|
-
start = parser.tokenStart;
|
|
1951
|
+
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
2136
1952
|
continue;
|
|
2137
1953
|
}
|
|
2138
1954
|
return 33619994;
|
|
@@ -2150,13 +1966,11 @@ function scanSingleToken(parser, context, state) {
|
|
|
2150
1966
|
if (ch === 47) {
|
|
2151
1967
|
advanceChar(parser);
|
|
2152
1968
|
state = skipSingleLineComment(parser, source, state, 0, parser.tokenStart);
|
|
2153
|
-
start = parser.tokenStart;
|
|
2154
1969
|
continue;
|
|
2155
1970
|
}
|
|
2156
1971
|
if (ch === 42) {
|
|
2157
1972
|
advanceChar(parser);
|
|
2158
1973
|
state = skipMultiLineComment(parser, source, state);
|
|
2159
|
-
start = parser.tokenStart;
|
|
2160
1974
|
continue;
|
|
2161
1975
|
}
|
|
2162
1976
|
if (context & 32) {
|
|
@@ -2190,7 +2004,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2190
2004
|
advanceChar(parser);
|
|
2191
2005
|
if (parser.currentChar === 61) {
|
|
2192
2006
|
advanceChar(parser);
|
|
2193
|
-
return
|
|
2007
|
+
return 4718632;
|
|
2194
2008
|
}
|
|
2195
2009
|
return 8913465;
|
|
2196
2010
|
}
|
|
@@ -2233,7 +2047,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2233
2047
|
advanceChar(parser);
|
|
2234
2048
|
if (parser.currentChar === 61) {
|
|
2235
2049
|
advanceChar(parser);
|
|
2236
|
-
return
|
|
2050
|
+
return 4718633;
|
|
2237
2051
|
}
|
|
2238
2052
|
return 8913720;
|
|
2239
2053
|
}
|
|
@@ -2249,7 +2063,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2249
2063
|
advanceChar(parser);
|
|
2250
2064
|
if (parser.currentChar === 61) {
|
|
2251
2065
|
advanceChar(parser);
|
|
2252
|
-
return
|
|
2066
|
+
return 4718634;
|
|
2253
2067
|
}
|
|
2254
2068
|
return 276824445;
|
|
2255
2069
|
}
|
|
@@ -2287,7 +2101,189 @@ function scanSingleToken(parser, context, state) {
|
|
|
2287
2101
|
parser.report(20, String.fromCodePoint(char));
|
|
2288
2102
|
}
|
|
2289
2103
|
}
|
|
2290
|
-
return 1048576;
|
|
2104
|
+
return 1048576;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
function matchOrInsertSemicolon(parser, context) {
|
|
2108
|
+
if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
|
|
2109
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
2110
|
+
}
|
|
2111
|
+
if (!consumeOpt(parser, context, 1074790417)) {
|
|
2112
|
+
parser.options.onInsertedSemicolon?.(parser.startIndex);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
|
|
2116
|
+
if (index - tokenIndex < 13 && tokenValue === 'use strict') {
|
|
2117
|
+
if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
|
|
2118
|
+
return 1;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
return 0;
|
|
2122
|
+
}
|
|
2123
|
+
function optionalBit(parser, context, t) {
|
|
2124
|
+
if (parser.getToken() !== t)
|
|
2125
|
+
return 0;
|
|
2126
|
+
nextToken(parser, context);
|
|
2127
|
+
return 1;
|
|
2128
|
+
}
|
|
2129
|
+
function consumeOpt(parser, context, t) {
|
|
2130
|
+
if (parser.getToken() !== t)
|
|
2131
|
+
return false;
|
|
2132
|
+
nextToken(parser, context);
|
|
2133
|
+
return true;
|
|
2134
|
+
}
|
|
2135
|
+
function consume(parser, context, t) {
|
|
2136
|
+
if (parser.getToken() !== t)
|
|
2137
|
+
parser.report(25, KeywordDescTable[t & 255]);
|
|
2138
|
+
nextToken(parser, context);
|
|
2139
|
+
}
|
|
2140
|
+
function reinterpretToPattern(parser, node) {
|
|
2141
|
+
switch (node.type) {
|
|
2142
|
+
case 'ArrayExpression': {
|
|
2143
|
+
node.type = 'ArrayPattern';
|
|
2144
|
+
const { elements } = node;
|
|
2145
|
+
for (let i = 0, n = elements.length; i < n; ++i) {
|
|
2146
|
+
const element = elements[i];
|
|
2147
|
+
if (element)
|
|
2148
|
+
reinterpretToPattern(parser, element);
|
|
2149
|
+
}
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
case 'ObjectExpression': {
|
|
2153
|
+
node.type = 'ObjectPattern';
|
|
2154
|
+
const { properties } = node;
|
|
2155
|
+
for (let i = 0, n = properties.length; i < n; ++i) {
|
|
2156
|
+
reinterpretToPattern(parser, properties[i]);
|
|
2157
|
+
}
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
case 'AssignmentExpression':
|
|
2161
|
+
node.type = 'AssignmentPattern';
|
|
2162
|
+
if (node.operator !== '=')
|
|
2163
|
+
parser.report(71);
|
|
2164
|
+
delete node.operator;
|
|
2165
|
+
reinterpretToPattern(parser, node.left);
|
|
2166
|
+
return;
|
|
2167
|
+
case 'Property':
|
|
2168
|
+
reinterpretToPattern(parser, node.value);
|
|
2169
|
+
return;
|
|
2170
|
+
case 'SpreadElement':
|
|
2171
|
+
node.type = 'RestElement';
|
|
2172
|
+
reinterpretToPattern(parser, node.argument);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2176
|
+
if (context & 1) {
|
|
2177
|
+
if ((t & 36864) === 36864) {
|
|
2178
|
+
parser.report(118);
|
|
2179
|
+
}
|
|
2180
|
+
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2181
|
+
parser.report(119);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
if ((t & 20480) === 20480 || t === -2147483528) {
|
|
2185
|
+
parser.report(102);
|
|
2186
|
+
}
|
|
2187
|
+
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
2188
|
+
parser.report(100);
|
|
2189
|
+
}
|
|
2190
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2191
|
+
parser.report(110);
|
|
2192
|
+
}
|
|
2193
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2194
|
+
parser.report(97, 'yield');
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
function validateFunctionName(parser, context, t) {
|
|
2198
|
+
if (context & 1) {
|
|
2199
|
+
if ((t & 36864) === 36864) {
|
|
2200
|
+
parser.report(118);
|
|
2201
|
+
}
|
|
2202
|
+
if ((t & 537079808) === 537079808) {
|
|
2203
|
+
parser.report(119);
|
|
2204
|
+
}
|
|
2205
|
+
if (t === -2147483527) {
|
|
2206
|
+
parser.report(95);
|
|
2207
|
+
}
|
|
2208
|
+
if (t === -2147483528) {
|
|
2209
|
+
parser.report(95);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
if ((t & 20480) === 20480) {
|
|
2213
|
+
parser.report(102);
|
|
2214
|
+
}
|
|
2215
|
+
if (context & (2048 | 2) && t === 209006) {
|
|
2216
|
+
parser.report(110);
|
|
2217
|
+
}
|
|
2218
|
+
if (context & (1024 | 1) && t === 241771) {
|
|
2219
|
+
parser.report(97, 'yield');
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
function isStrictReservedWord(parser, context, t) {
|
|
2223
|
+
if (t === 209006) {
|
|
2224
|
+
if (context & (2048 | 2))
|
|
2225
|
+
parser.report(110);
|
|
2226
|
+
parser.destructible |= 128;
|
|
2227
|
+
}
|
|
2228
|
+
if (t === 241771 && context & 1024)
|
|
2229
|
+
parser.report(97, 'yield');
|
|
2230
|
+
return ((t & 20480) === 20480 ||
|
|
2231
|
+
(t & 36864) === 36864 ||
|
|
2232
|
+
t == -2147483527);
|
|
2233
|
+
}
|
|
2234
|
+
function isPropertyWithPrivateFieldKey(expr) {
|
|
2235
|
+
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
2236
|
+
}
|
|
2237
|
+
function isValidLabel(parser, labels, name, isIterationStatement) {
|
|
2238
|
+
while (labels) {
|
|
2239
|
+
if (labels['$' + name]) {
|
|
2240
|
+
if (isIterationStatement)
|
|
2241
|
+
parser.report(137);
|
|
2242
|
+
return 1;
|
|
2243
|
+
}
|
|
2244
|
+
if (isIterationStatement && labels.loop)
|
|
2245
|
+
isIterationStatement = 0;
|
|
2246
|
+
labels = labels['$'];
|
|
2247
|
+
}
|
|
2248
|
+
return 0;
|
|
2249
|
+
}
|
|
2250
|
+
function validateAndDeclareLabel(parser, labels, name) {
|
|
2251
|
+
let set = labels;
|
|
2252
|
+
while (set) {
|
|
2253
|
+
if (set['$' + name])
|
|
2254
|
+
parser.report(136, name);
|
|
2255
|
+
set = set['$'];
|
|
2256
|
+
}
|
|
2257
|
+
labels['$' + name] = 1;
|
|
2258
|
+
}
|
|
2259
|
+
function isEqualTagName(elementName) {
|
|
2260
|
+
switch (elementName.type) {
|
|
2261
|
+
case 'JSXIdentifier':
|
|
2262
|
+
return elementName.name;
|
|
2263
|
+
case 'JSXNamespacedName':
|
|
2264
|
+
return elementName.namespace + ':' + elementName.name;
|
|
2265
|
+
case 'JSXMemberExpression':
|
|
2266
|
+
return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
function isValidIdentifier(context, t) {
|
|
2270
|
+
if (context & (1 | 1024)) {
|
|
2271
|
+
if (context & 2 && t === 209006)
|
|
2272
|
+
return false;
|
|
2273
|
+
if (context & 1024 && t === 241771)
|
|
2274
|
+
return false;
|
|
2275
|
+
return (t & 12288) === 12288;
|
|
2276
|
+
}
|
|
2277
|
+
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
2278
|
+
}
|
|
2279
|
+
function classifyIdentifier(parser, context, t) {
|
|
2280
|
+
if ((t & 537079808) === 537079808) {
|
|
2281
|
+
if (context & 1)
|
|
2282
|
+
parser.report(119);
|
|
2283
|
+
parser.flags |= 512;
|
|
2284
|
+
}
|
|
2285
|
+
if (!isValidIdentifier(context, t))
|
|
2286
|
+
parser.report(0);
|
|
2291
2287
|
}
|
|
2292
2288
|
|
|
2293
2289
|
const entities = {
|
|
@@ -4546,6 +4542,61 @@ function rescanJSXIdentifier(parser) {
|
|
|
4546
4542
|
return parser.getToken();
|
|
4547
4543
|
}
|
|
4548
4544
|
|
|
4545
|
+
function normalizeOptions(rawOptions) {
|
|
4546
|
+
const options = {
|
|
4547
|
+
validateRegex: true,
|
|
4548
|
+
...rawOptions,
|
|
4549
|
+
};
|
|
4550
|
+
if (options.module && !options.sourceType) {
|
|
4551
|
+
options.sourceType = 'module';
|
|
4552
|
+
}
|
|
4553
|
+
if (options.globalReturn && (!options.sourceType || options.sourceType === 'script')) {
|
|
4554
|
+
options.sourceType = 'commonjs';
|
|
4555
|
+
}
|
|
4556
|
+
return options;
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
class PrivateScope {
|
|
4560
|
+
parser;
|
|
4561
|
+
parent;
|
|
4562
|
+
refs = Object.create(null);
|
|
4563
|
+
privateIdentifiers = new Map();
|
|
4564
|
+
constructor(parser, parent) {
|
|
4565
|
+
this.parser = parser;
|
|
4566
|
+
this.parent = parent;
|
|
4567
|
+
}
|
|
4568
|
+
addPrivateIdentifier(name, kind) {
|
|
4569
|
+
const { privateIdentifiers } = this;
|
|
4570
|
+
let focusKind = kind & (32 | 768);
|
|
4571
|
+
if (!(focusKind & 768))
|
|
4572
|
+
focusKind |= 768;
|
|
4573
|
+
const value = privateIdentifiers.get(name);
|
|
4574
|
+
if (this.hasPrivateIdentifier(name) &&
|
|
4575
|
+
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4576
|
+
this.parser.report(146, name);
|
|
4577
|
+
}
|
|
4578
|
+
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4579
|
+
}
|
|
4580
|
+
addPrivateIdentifierRef(name) {
|
|
4581
|
+
this.refs[name] ??= [];
|
|
4582
|
+
this.refs[name].push(this.parser.tokenStart);
|
|
4583
|
+
}
|
|
4584
|
+
isPrivateIdentifierDefined(name) {
|
|
4585
|
+
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4586
|
+
}
|
|
4587
|
+
validatePrivateIdentifierRefs() {
|
|
4588
|
+
for (const name in this.refs) {
|
|
4589
|
+
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4590
|
+
const { index, line, column } = this.refs[name][0];
|
|
4591
|
+
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
hasPrivateIdentifier(name) {
|
|
4596
|
+
return this.privateIdentifiers.has(name);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
|
|
4549
4600
|
class Scope {
|
|
4550
4601
|
parser;
|
|
4551
4602
|
type;
|
|
@@ -4656,51 +4707,10 @@ function createArrowHeadParsingScope(parser, context, value) {
|
|
|
4656
4707
|
return scope;
|
|
4657
4708
|
}
|
|
4658
4709
|
|
|
4659
|
-
class PrivateScope {
|
|
4660
|
-
parser;
|
|
4661
|
-
parent;
|
|
4662
|
-
refs = Object.create(null);
|
|
4663
|
-
privateIdentifiers = new Map();
|
|
4664
|
-
constructor(parser, parent) {
|
|
4665
|
-
this.parser = parser;
|
|
4666
|
-
this.parent = parent;
|
|
4667
|
-
}
|
|
4668
|
-
addPrivateIdentifier(name, kind) {
|
|
4669
|
-
const { privateIdentifiers } = this;
|
|
4670
|
-
let focusKind = kind & (32 | 768);
|
|
4671
|
-
if (!(focusKind & 768))
|
|
4672
|
-
focusKind |= 768;
|
|
4673
|
-
const value = privateIdentifiers.get(name);
|
|
4674
|
-
if (this.hasPrivateIdentifier(name) &&
|
|
4675
|
-
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4676
|
-
this.parser.report(146, name);
|
|
4677
|
-
}
|
|
4678
|
-
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4679
|
-
}
|
|
4680
|
-
addPrivateIdentifierRef(name) {
|
|
4681
|
-
this.refs[name] ??= [];
|
|
4682
|
-
this.refs[name].push(this.parser.tokenStart);
|
|
4683
|
-
}
|
|
4684
|
-
isPrivateIdentifierDefined(name) {
|
|
4685
|
-
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
4686
|
-
}
|
|
4687
|
-
validatePrivateIdentifierRefs() {
|
|
4688
|
-
for (const name in this.refs) {
|
|
4689
|
-
if (!this.isPrivateIdentifierDefined(name)) {
|
|
4690
|
-
const { index, line, column } = this.refs[name][0];
|
|
4691
|
-
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
4692
|
-
}
|
|
4693
|
-
}
|
|
4694
|
-
}
|
|
4695
|
-
hasPrivateIdentifier(name) {
|
|
4696
|
-
return this.privateIdentifiers.has(name);
|
|
4697
|
-
}
|
|
4698
|
-
}
|
|
4699
|
-
|
|
4700
4710
|
class Parser {
|
|
4701
4711
|
source;
|
|
4702
|
-
options;
|
|
4703
4712
|
lastOnToken = null;
|
|
4713
|
+
options;
|
|
4704
4714
|
token = 1048576;
|
|
4705
4715
|
flags = 0;
|
|
4706
4716
|
index = 0;
|
|
@@ -4719,14 +4729,20 @@ class Parser {
|
|
|
4719
4729
|
currentChar = 0;
|
|
4720
4730
|
exportedNames = new Set();
|
|
4721
4731
|
exportedBindings = new Set();
|
|
4722
|
-
assignable =
|
|
4732
|
+
assignable = 0;
|
|
4723
4733
|
destructible = 0;
|
|
4724
4734
|
leadingDecorators = { decorators: [] };
|
|
4725
|
-
constructor(source,
|
|
4735
|
+
constructor(source, rawOptions = {}) {
|
|
4726
4736
|
this.source = source;
|
|
4727
|
-
this.options = options;
|
|
4728
4737
|
this.end = source.length;
|
|
4729
4738
|
this.currentChar = source.charCodeAt(0);
|
|
4739
|
+
this.options = normalizeOptions(rawOptions);
|
|
4740
|
+
if (Array.isArray(this.options.onComment)) {
|
|
4741
|
+
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4742
|
+
}
|
|
4743
|
+
if (Array.isArray(this.options.onToken)) {
|
|
4744
|
+
this.options.onToken = pushToken(this.options.onToken, this.options);
|
|
4745
|
+
}
|
|
4730
4746
|
}
|
|
4731
4747
|
getToken() {
|
|
4732
4748
|
return this.token;
|
|
@@ -4819,6 +4835,25 @@ class Parser {
|
|
|
4819
4835
|
}
|
|
4820
4836
|
return undefined;
|
|
4821
4837
|
}
|
|
4838
|
+
cloneIdentifier(original) {
|
|
4839
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
4840
|
+
}
|
|
4841
|
+
cloneStringLiteral(original) {
|
|
4842
|
+
return this.cloneLocationInformation({ ...original }, original);
|
|
4843
|
+
}
|
|
4844
|
+
cloneLocationInformation(node, original) {
|
|
4845
|
+
if (this.options.ranges) {
|
|
4846
|
+
node.range = [...original.range];
|
|
4847
|
+
}
|
|
4848
|
+
if (this.options.loc) {
|
|
4849
|
+
node.loc = {
|
|
4850
|
+
...original.loc,
|
|
4851
|
+
start: { ...original.loc.start },
|
|
4852
|
+
end: { ...original.loc.end },
|
|
4853
|
+
};
|
|
4854
|
+
}
|
|
4855
|
+
return node;
|
|
4856
|
+
}
|
|
4822
4857
|
}
|
|
4823
4858
|
function pushComment(comments, options) {
|
|
4824
4859
|
return function (type, value, start, end, loc) {
|
|
@@ -4854,26 +4889,14 @@ function pushToken(tokens, options) {
|
|
|
4854
4889
|
};
|
|
4855
4890
|
}
|
|
4856
4891
|
|
|
4857
|
-
function normalizeOptions(rawOptions) {
|
|
4858
|
-
const options = { ...rawOptions };
|
|
4859
|
-
if (options.onComment) {
|
|
4860
|
-
options.onComment = Array.isArray(options.onComment) ? pushComment(options.onComment, options) : options.onComment;
|
|
4861
|
-
}
|
|
4862
|
-
if (options.onToken) {
|
|
4863
|
-
options.onToken = Array.isArray(options.onToken) ? pushToken(options.onToken, options) : options.onToken;
|
|
4864
|
-
}
|
|
4865
|
-
return options;
|
|
4866
|
-
}
|
|
4867
|
-
|
|
4868
4892
|
function parseSource(source, rawOptions = {}, context = 0) {
|
|
4869
|
-
const
|
|
4870
|
-
if (options.module)
|
|
4893
|
+
const parser = new Parser(source, rawOptions);
|
|
4894
|
+
if (parser.options.sourceType === 'module')
|
|
4871
4895
|
context |= 2 | 1;
|
|
4872
|
-
if (options.
|
|
4873
|
-
context |= 4096;
|
|
4874
|
-
if (options.impliedStrict)
|
|
4896
|
+
if (parser.options.sourceType === 'commonjs')
|
|
4897
|
+
context |= 4096 | 65536;
|
|
4898
|
+
if (parser.options.impliedStrict)
|
|
4875
4899
|
context |= 1;
|
|
4876
|
-
const parser = new Parser(source, options);
|
|
4877
4900
|
skipHashBang(parser);
|
|
4878
4901
|
const scope = parser.createScopeIfLexical();
|
|
4879
4902
|
let body = [];
|
|
@@ -5760,7 +5783,7 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
5760
5783
|
}
|
|
5761
5784
|
else if (imported.type === 'Identifier') {
|
|
5762
5785
|
validateBindingIdentifier(parser, context, 16, token, 0);
|
|
5763
|
-
local = imported;
|
|
5786
|
+
local = parser.cloneIdentifier(imported);
|
|
5764
5787
|
}
|
|
5765
5788
|
else {
|
|
5766
5789
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
@@ -5901,7 +5924,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5901
5924
|
tmpExportedNames.push(parser.tokenValue);
|
|
5902
5925
|
tmpExportedBindings.push(parser.tokenValue);
|
|
5903
5926
|
}
|
|
5904
|
-
exported = local;
|
|
5927
|
+
exported = local.type === 'Literal' ? parser.cloneStringLiteral(local) : parser.cloneIdentifier(local);
|
|
5905
5928
|
}
|
|
5906
5929
|
specifiers.push(parser.finishNode({
|
|
5907
5930
|
type: 'ExportSpecifier',
|
|
@@ -5995,6 +6018,8 @@ function parseAssignmentExpression(parser, context, privateScope, inGroup, isPat
|
|
|
5995
6018
|
if ((token & 4194304) === 4194304) {
|
|
5996
6019
|
if (parser.assignable & 2)
|
|
5997
6020
|
parser.report(26);
|
|
6021
|
+
if ((token & 524288) === 524288 && parser.assignable & 4)
|
|
6022
|
+
parser.report(26);
|
|
5998
6023
|
if ((!isPattern && token === 1077936155 && left.type === 'ArrayExpression') ||
|
|
5999
6024
|
left.type === 'ObjectExpression') {
|
|
6000
6025
|
reinterpretToPattern(parser, left);
|
|
@@ -6360,7 +6385,12 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6360
6385
|
parser.flags = (parser.flags | 2048) ^ 2048;
|
|
6361
6386
|
}
|
|
6362
6387
|
const args = parseArguments(parser, context, privateScope, inGroup);
|
|
6363
|
-
parser.
|
|
6388
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
6389
|
+
parser.assignable = 4;
|
|
6390
|
+
}
|
|
6391
|
+
else {
|
|
6392
|
+
parser.assignable = 2;
|
|
6393
|
+
}
|
|
6364
6394
|
expr = parser.finishNode({
|
|
6365
6395
|
type: 'CallExpression',
|
|
6366
6396
|
callee: expr,
|
|
@@ -6428,7 +6458,12 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
6428
6458
|
}
|
|
6429
6459
|
else if (parser.getToken() === 67174411) {
|
|
6430
6460
|
const args = parseArguments(parser, context, privateScope, 0);
|
|
6431
|
-
parser.
|
|
6461
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
6462
|
+
parser.assignable = 4;
|
|
6463
|
+
}
|
|
6464
|
+
else {
|
|
6465
|
+
parser.assignable = 2;
|
|
6466
|
+
}
|
|
6432
6467
|
node = parser.finishNode({
|
|
6433
6468
|
type: 'CallExpression',
|
|
6434
6469
|
callee: expr,
|
|
@@ -6676,20 +6711,12 @@ function parseIdentifierOrStringLiteral(parser, context) {
|
|
|
6676
6711
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
6677
6712
|
}
|
|
6678
6713
|
}
|
|
6679
|
-
function validateStringWellFormed(parser, str) {
|
|
6680
|
-
const len = str.length;
|
|
6681
|
-
for (let i = 0; i < len; i++) {
|
|
6682
|
-
const code = str.charCodeAt(i);
|
|
6683
|
-
if ((code & 0xfc00) !== 55296)
|
|
6684
|
-
continue;
|
|
6685
|
-
if (code > 56319 || ++i >= len || (str.charCodeAt(i) & 0xfc00) !== 56320) {
|
|
6686
|
-
parser.report(171, JSON.stringify(str.charAt(i--)));
|
|
6687
|
-
}
|
|
6688
|
-
}
|
|
6689
|
-
}
|
|
6690
6714
|
function parseModuleExportName(parser, context) {
|
|
6691
6715
|
if (parser.getToken() === 134283267) {
|
|
6692
|
-
|
|
6716
|
+
const value = parser.tokenValue;
|
|
6717
|
+
if (!value.isWellFormed()) {
|
|
6718
|
+
parser.report(171);
|
|
6719
|
+
}
|
|
6693
6720
|
return parseLiteral(parser, context);
|
|
6694
6721
|
}
|
|
6695
6722
|
else if (parser.getToken() & 143360) {
|
|
@@ -6823,35 +6850,31 @@ function parseLiteral(parser, context) {
|
|
|
6823
6850
|
if (parser.getToken() === 134283388) {
|
|
6824
6851
|
return parseBigIntLiteral(parser, context);
|
|
6825
6852
|
}
|
|
6853
|
+
const node = {
|
|
6854
|
+
type: 'Literal',
|
|
6855
|
+
value: tokenValue,
|
|
6856
|
+
};
|
|
6857
|
+
if (parser.options.raw) {
|
|
6858
|
+
node.raw = tokenRaw;
|
|
6859
|
+
}
|
|
6826
6860
|
nextToken(parser, context);
|
|
6827
6861
|
parser.assignable = 2;
|
|
6828
|
-
return parser.finishNode(
|
|
6829
|
-
? {
|
|
6830
|
-
type: 'Literal',
|
|
6831
|
-
value: tokenValue,
|
|
6832
|
-
raw: tokenRaw,
|
|
6833
|
-
}
|
|
6834
|
-
: {
|
|
6835
|
-
type: 'Literal',
|
|
6836
|
-
value: tokenValue,
|
|
6837
|
-
}, tokenStart);
|
|
6862
|
+
return parser.finishNode(node, tokenStart);
|
|
6838
6863
|
}
|
|
6839
6864
|
function parseNullOrTrueOrFalseLiteral(parser, context) {
|
|
6840
6865
|
const start = parser.tokenStart;
|
|
6841
6866
|
const raw = KeywordDescTable[parser.getToken() & 255];
|
|
6842
6867
|
const value = parser.getToken() === 86023 ? null : raw === 'true';
|
|
6868
|
+
const node = {
|
|
6869
|
+
type: 'Literal',
|
|
6870
|
+
value,
|
|
6871
|
+
};
|
|
6872
|
+
if (parser.options.raw) {
|
|
6873
|
+
node.raw = raw;
|
|
6874
|
+
}
|
|
6843
6875
|
nextToken(parser, context);
|
|
6844
6876
|
parser.assignable = 2;
|
|
6845
|
-
return parser.finishNode(
|
|
6846
|
-
? {
|
|
6847
|
-
type: 'Literal',
|
|
6848
|
-
value,
|
|
6849
|
-
raw,
|
|
6850
|
-
}
|
|
6851
|
-
: {
|
|
6852
|
-
type: 'Literal',
|
|
6853
|
-
value,
|
|
6854
|
-
}, start);
|
|
6877
|
+
return parser.finishNode(node, start);
|
|
6855
6878
|
}
|
|
6856
6879
|
function parseThisExpression(parser, context) {
|
|
6857
6880
|
const { tokenStart } = parser;
|
|
@@ -7045,9 +7068,9 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7045
7068
|
}
|
|
7046
7069
|
else if (parser.getToken() !== 1077936155) {
|
|
7047
7070
|
destructible |=
|
|
7048
|
-
parser.assignable &
|
|
7049
|
-
?
|
|
7050
|
-
:
|
|
7071
|
+
parser.assignable & 1
|
|
7072
|
+
? 32
|
|
7073
|
+
: 16;
|
|
7051
7074
|
}
|
|
7052
7075
|
}
|
|
7053
7076
|
}
|
|
@@ -7077,9 +7100,9 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7077
7100
|
}
|
|
7078
7101
|
else if (parser.getToken() !== 1077936155) {
|
|
7079
7102
|
destructible |=
|
|
7080
|
-
parser.assignable &
|
|
7081
|
-
?
|
|
7082
|
-
:
|
|
7103
|
+
parser.assignable & 1
|
|
7104
|
+
? 32
|
|
7105
|
+
: 16;
|
|
7083
7106
|
}
|
|
7084
7107
|
}
|
|
7085
7108
|
}
|
|
@@ -7196,7 +7219,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7196
7219
|
if (parser.destructible & 8)
|
|
7197
7220
|
parser.report(71);
|
|
7198
7221
|
argument = parseMemberOrUpdateExpression(parser, context, privateScope, argument, inGroup, 0, tokenStart);
|
|
7199
|
-
destructible |= parser.assignable &
|
|
7222
|
+
destructible |= parser.assignable & 1 ? 0 : 16;
|
|
7200
7223
|
if ((parser.getToken() & 4194304) === 4194304) {
|
|
7201
7224
|
if (parser.getToken() !== 1077936155)
|
|
7202
7225
|
destructible |= 16;
|
|
@@ -7210,9 +7233,9 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7210
7233
|
argument = parseConditionalExpression(parser, context, privateScope, argument, tokenStart);
|
|
7211
7234
|
}
|
|
7212
7235
|
destructible |=
|
|
7213
|
-
parser.assignable &
|
|
7214
|
-
?
|
|
7215
|
-
:
|
|
7236
|
+
parser.assignable & 1
|
|
7237
|
+
? 32
|
|
7238
|
+
: 16;
|
|
7216
7239
|
}
|
|
7217
7240
|
}
|
|
7218
7241
|
else {
|
|
@@ -7241,7 +7264,9 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7241
7264
|
argument = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, argument);
|
|
7242
7265
|
}
|
|
7243
7266
|
destructible |=
|
|
7244
|
-
parser.assignable & 1
|
|
7267
|
+
parser.assignable & 1
|
|
7268
|
+
? 32
|
|
7269
|
+
: 16;
|
|
7245
7270
|
}
|
|
7246
7271
|
parser.destructible = destructible;
|
|
7247
7272
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
@@ -7366,7 +7391,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7366
7391
|
: 0;
|
|
7367
7392
|
value = parser.finishNode({
|
|
7368
7393
|
type: 'AssignmentPattern',
|
|
7369
|
-
left: parser.
|
|
7394
|
+
left: parser.cloneIdentifier(key),
|
|
7370
7395
|
right,
|
|
7371
7396
|
}, tokenStart);
|
|
7372
7397
|
}
|
|
@@ -7374,7 +7399,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7374
7399
|
destructible |=
|
|
7375
7400
|
(token === 209006 ? 128 : 0) |
|
|
7376
7401
|
(token === -2147483528 ? 16 : 0);
|
|
7377
|
-
value = parser.
|
|
7402
|
+
value = parser.cloneIdentifier(key);
|
|
7378
7403
|
}
|
|
7379
7404
|
}
|
|
7380
7405
|
else if (consumeOpt(parser, context | 32, 21)) {
|
|
@@ -7433,7 +7458,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7433
7458
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7434
7459
|
destructible = parser.destructible;
|
|
7435
7460
|
parser.assignable =
|
|
7436
|
-
destructible & 16
|
|
7461
|
+
destructible & 16
|
|
7462
|
+
? 2
|
|
7463
|
+
: 1;
|
|
7437
7464
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7438
7465
|
if (parser.assignable & 2)
|
|
7439
7466
|
destructible |= 16;
|
|
@@ -7455,9 +7482,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7455
7482
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7456
7483
|
}
|
|
7457
7484
|
destructible |=
|
|
7458
|
-
parser.assignable &
|
|
7459
|
-
?
|
|
7460
|
-
:
|
|
7485
|
+
parser.assignable & 1
|
|
7486
|
+
? 32
|
|
7487
|
+
: 16;
|
|
7461
7488
|
}
|
|
7462
7489
|
}
|
|
7463
7490
|
}
|
|
@@ -7614,7 +7641,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7614
7641
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7615
7642
|
destructible = parser.destructible;
|
|
7616
7643
|
parser.assignable =
|
|
7617
|
-
destructible & 16
|
|
7644
|
+
destructible & 16
|
|
7645
|
+
? 2
|
|
7646
|
+
: 1;
|
|
7618
7647
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7619
7648
|
if (parser.assignable & 2) {
|
|
7620
7649
|
destructible |= 16;
|
|
@@ -7634,9 +7663,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7634
7663
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7635
7664
|
}
|
|
7636
7665
|
destructible |=
|
|
7637
|
-
parser.assignable &
|
|
7638
|
-
?
|
|
7639
|
-
:
|
|
7666
|
+
parser.assignable & 1
|
|
7667
|
+
? 32
|
|
7668
|
+
: 16;
|
|
7640
7669
|
}
|
|
7641
7670
|
}
|
|
7642
7671
|
}
|
|
@@ -7665,7 +7694,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7665
7694
|
else if (parser.getToken() === 67174411) {
|
|
7666
7695
|
state |= 1;
|
|
7667
7696
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7668
|
-
destructible =
|
|
7697
|
+
destructible = 16;
|
|
7669
7698
|
}
|
|
7670
7699
|
else {
|
|
7671
7700
|
parser.report(134);
|
|
@@ -7685,11 +7714,11 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7685
7714
|
value = parseMemberOrUpdateExpression(parser, context, privateScope, value, inGroup, 0, tokenStart);
|
|
7686
7715
|
if ((parser.getToken() & 4194304) === 4194304) {
|
|
7687
7716
|
destructible |=
|
|
7688
|
-
parser.assignable &
|
|
7689
|
-
?
|
|
7690
|
-
: token === 1077936155
|
|
7717
|
+
parser.assignable & 1
|
|
7718
|
+
? token === 1077936155
|
|
7691
7719
|
? 0
|
|
7692
|
-
: 32
|
|
7720
|
+
: 32
|
|
7721
|
+
: 16;
|
|
7693
7722
|
value = parseAssignmentExpressionOrPattern(parser, context, privateScope, inGroup, isPattern, tokenStart, value);
|
|
7694
7723
|
}
|
|
7695
7724
|
else if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
@@ -7720,7 +7749,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7720
7749
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7721
7750
|
destructible = parser.destructible;
|
|
7722
7751
|
parser.assignable =
|
|
7723
|
-
destructible & 16
|
|
7752
|
+
destructible & 16
|
|
7753
|
+
? 2
|
|
7754
|
+
: 1;
|
|
7724
7755
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7725
7756
|
if (parser.assignable & 2)
|
|
7726
7757
|
destructible |= 16;
|
|
@@ -7745,9 +7776,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7745
7776
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7746
7777
|
}
|
|
7747
7778
|
destructible |=
|
|
7748
|
-
parser.assignable &
|
|
7749
|
-
?
|
|
7750
|
-
:
|
|
7779
|
+
parser.assignable & 1
|
|
7780
|
+
? 32
|
|
7781
|
+
: 16;
|
|
7751
7782
|
}
|
|
7752
7783
|
}
|
|
7753
7784
|
}
|
|
@@ -8352,6 +8383,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8352
8383
|
parser.report(48);
|
|
8353
8384
|
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 1, start);
|
|
8354
8385
|
}
|
|
8386
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8387
|
+
parser.assignable = 4;
|
|
8388
|
+
}
|
|
8389
|
+
else {
|
|
8390
|
+
parser.assignable = 2;
|
|
8391
|
+
}
|
|
8355
8392
|
return parser.finishNode({
|
|
8356
8393
|
type: 'CallExpression',
|
|
8357
8394
|
callee,
|
|
@@ -8425,7 +8462,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8425
8462
|
}
|
|
8426
8463
|
else {
|
|
8427
8464
|
expr = parseExpression(parser, context, privateScope, 1, 0, tokenStart);
|
|
8428
|
-
destructible =
|
|
8465
|
+
destructible = 0;
|
|
8429
8466
|
params.push(expr);
|
|
8430
8467
|
while (consumeOpt(parser, context | 32, 18)) {
|
|
8431
8468
|
params.push(parseExpression(parser, context, privateScope, 1, 0, tokenStart));
|
|
@@ -8433,7 +8470,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8433
8470
|
destructible |= parser.assignable;
|
|
8434
8471
|
consume(parser, context, 16);
|
|
8435
8472
|
parser.destructible = destructible | 16;
|
|
8436
|
-
parser.
|
|
8473
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8474
|
+
parser.assignable = 4;
|
|
8475
|
+
}
|
|
8476
|
+
else {
|
|
8477
|
+
parser.assignable = 2;
|
|
8478
|
+
}
|
|
8437
8479
|
return parser.finishNode({
|
|
8438
8480
|
type: 'CallExpression',
|
|
8439
8481
|
callee,
|
|
@@ -8471,7 +8513,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8471
8513
|
if (destructible & 8) {
|
|
8472
8514
|
parser.report(62);
|
|
8473
8515
|
}
|
|
8474
|
-
parser.
|
|
8516
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8517
|
+
parser.assignable = 4;
|
|
8518
|
+
}
|
|
8519
|
+
else {
|
|
8520
|
+
parser.assignable = 2;
|
|
8521
|
+
}
|
|
8475
8522
|
return parser.finishNode({
|
|
8476
8523
|
type: 'CallExpression',
|
|
8477
8524
|
callee,
|
|
@@ -8595,8 +8642,9 @@ function parseDecorators(parser, context, privateScope) {
|
|
|
8595
8642
|
function parseDecoratorList(parser, context, privateScope) {
|
|
8596
8643
|
const start = parser.tokenStart;
|
|
8597
8644
|
nextToken(parser, context | 32);
|
|
8645
|
+
const expressionStart = parser.tokenStart;
|
|
8598
8646
|
let expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
8599
|
-
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0,
|
|
8647
|
+
expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, expressionStart);
|
|
8600
8648
|
return parser.finishNode({
|
|
8601
8649
|
type: 'Decorator',
|
|
8602
8650
|
expression,
|
|
@@ -9183,17 +9231,15 @@ function parseJSXIdentifier(parser, context) {
|
|
|
9183
9231
|
}, start);
|
|
9184
9232
|
}
|
|
9185
9233
|
|
|
9186
|
-
var version$1 = "6.1.4";
|
|
9187
|
-
|
|
9188
9234
|
const version = version$1;
|
|
9189
9235
|
function parseScript(source, options) {
|
|
9190
|
-
return parseSource(source, options);
|
|
9236
|
+
return parseSource(source, { ...options, sourceType: 'script' });
|
|
9191
9237
|
}
|
|
9192
9238
|
function parseModule(source, options) {
|
|
9193
|
-
return parseSource(source, options,
|
|
9239
|
+
return parseSource(source, { ...options, sourceType: 'module' });
|
|
9194
9240
|
}
|
|
9195
9241
|
function parse(source, options) {
|
|
9196
9242
|
return parseSource(source, options);
|
|
9197
9243
|
}
|
|
9198
9244
|
|
|
9199
|
-
export { parse, parseModule, parseScript, version };
|
|
9245
|
+
export { isParseError, parse, parseModule, parseScript, version };
|