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