meriyah 6.1.4 → 7.0.0

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