UNPKG

meriyah

Version:

A 100% compliant, self-hosted javascript parser with high focus on both performance and stability

1,249 lines (1,238 loc) • 325 kB
'use strict'; var version$1 = "7.0.0"; const unicodeLookup = ((compressed, lookup) => { const result = new Uint32Array(69632); let index = 0; let subIndex = 0; while (index < 2597) { const inst = compressed[index++]; if (inst < 0) { subIndex -= inst; } else { let code = compressed[index++]; if (inst & 2) code = lookup[code]; if (inst & 1) { result.fill(code, subIndex, subIndex += compressed[index++]); } else { result[subIndex++] = code; } } } return result; })([-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]); const isIDContinue = (code) => (unicodeLookup[(code >>> 5) + 0] >>> code & 31 & 1) !== 0; const isIDStart = (code) => (unicodeLookup[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0; const CharTypes = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 | 1024, 0, 0, 8 | 2048, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8192, 0, 1 | 2, 0, 0, 8192, 0, 0, 0, 256, 0, 256 | 32768, 0, 0, 2 | 16 | 128 | 32 | 64, 2 | 16 | 128 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 512 | 64, 2 | 16 | 512 | 64, 0, 0, 16384, 0, 0, 0, 0, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 0, 1, 0, 0, 1 | 2 | 4096, 0, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 16384, 0, 0, 0, 0 ]; const isIdStart = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]; const isIdPart = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]; function isIdentifierStart(code) { return code <= 0x7F ? isIdStart[code] > 0 : isIDStart(code); } function isIdentifierPart(code) { return code <= 0x7F ? isIdPart[code] > 0 : isIDContinue(code) || (code === 8204 || code === 8205); } function advanceChar(parser) { parser.column++; return (parser.currentChar = parser.source.charCodeAt(++parser.index)); } function consumePossibleSurrogatePair(parser) { const hi = parser.currentChar; if ((hi & 0xfc00) !== 55296) return 0; const lo = parser.source.charCodeAt(parser.index + 1); if ((lo & 0xfc00) !== 56320) return 0; return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff); } function consumeLineFeed(parser, state) { parser.currentChar = parser.source.charCodeAt(++parser.index); parser.flags |= 1; if ((state & 4) === 0) { parser.column = 0; parser.line++; } } function scanNewLine(parser) { parser.flags |= 1; parser.currentChar = parser.source.charCodeAt(++parser.index); parser.column = 0; parser.line++; } function isExoticECMAScriptWhitespace(ch) { return (ch === 160 || ch === 65279 || ch === 133 || ch === 5760 || (ch >= 8192 && ch <= 8203) || ch === 8239 || ch === 8287 || ch === 12288 || ch === 8201 || ch === 65519); } function toHex(code) { return code < 65 ? code - 48 : (code - 65 + 10) & 0xf; } function convertTokenType(t) { switch (t) { case 134283266: return 'NumericLiteral'; case 134283267: return 'StringLiteral'; case 86021: case 86022: return 'BooleanLiteral'; case 86023: return 'NullLiteral'; case 65540: return 'RegularExpression'; case 67174408: case 67174409: case 131: return 'TemplateLiteral'; default: if ((t & 143360) === 143360) return 'Identifier'; if ((t & 4096) === 4096) return 'Keyword'; return 'Punctuator'; } } const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment']; function skipHashBang(parser) { const { source } = parser; if (parser.currentChar === 35 && source.charCodeAt(parser.index + 1) === 33) { advanceChar(parser); advanceChar(parser); skipSingleLineComment(parser, source, 0, 4, parser.tokenStart); } } function skipSingleHTMLComment(parser, source, state, context, type, start) { if (context & 2) parser.report(0); return skipSingleLineComment(parser, source, state, type, start); } function skipSingleLineComment(parser, source, state, type, start) { const { index } = parser; parser.tokenIndex = parser.index; parser.tokenLine = parser.line; parser.tokenColumn = parser.column; while (parser.index < parser.end) { if (CharTypes[parser.currentChar] & 8) { const isCR = parser.currentChar === 13; scanNewLine(parser); if (isCR && parser.index < parser.end && parser.currentChar === 10) parser.currentChar = source.charCodeAt(++parser.index); break; } else if ((parser.currentChar ^ 8232) <= 1) { scanNewLine(parser); break; } advanceChar(parser); parser.tokenIndex = parser.index; parser.tokenLine = parser.line; parser.tokenColumn = parser.column; } if (parser.options.onComment) { const loc = { start: { line: start.line, column: start.column, }, end: { line: parser.tokenLine, column: parser.tokenColumn, }, }; parser.options.onComment(CommentTypes[type & 0xff], source.slice(index, parser.tokenIndex), start.index, parser.tokenIndex, loc); } return state | 1; } function skipMultiLineComment(parser, source, state) { const { index } = parser; while (parser.index < parser.end) { if (parser.currentChar < 0x2b) { let skippedOneAsterisk = false; while (parser.currentChar === 42) { if (!skippedOneAsterisk) { state &= -5; skippedOneAsterisk = true; } if (advanceChar(parser) === 47) { advanceChar(parser); if (parser.options.onComment) { const loc = { start: { line: parser.tokenLine, column: parser.tokenColumn, }, end: { line: parser.line, column: parser.column, }, }; parser.options.onComment(CommentTypes[1 & 0xff], source.slice(index, parser.index - 2), index - 2, parser.index, loc); } parser.tokenIndex = parser.index; parser.tokenLine = parser.line; parser.tokenColumn = parser.column; return state; } } if (skippedOneAsterisk) { continue; } if (CharTypes[parser.currentChar] & 8) { if (parser.currentChar === 13) { state |= 1 | 4; scanNewLine(parser); } else { consumeLineFeed(parser, state); state = (state & -5) | 1; } } else { advanceChar(parser); } } else if ((parser.currentChar ^ 8232) <= 1) { state = (state & -5) | 1; scanNewLine(parser); } else { state &= -5; advanceChar(parser); } } parser.report(18); } const errorMessages = { [0]: 'Unexpected token', [30]: "Unexpected token: '%0'", [1]: 'Octal escape sequences are not allowed in strict mode', [2]: 'Octal escape sequences are not allowed in template strings', [3]: '\\8 and \\9 are not allowed in template strings', [4]: 'Private identifier #%0 is not defined', [5]: 'Illegal Unicode escape sequence', [6]: 'Invalid code point %0', [7]: 'Invalid hexadecimal escape sequence', [9]: 'Octal literals are not allowed in strict mode', [8]: 'Decimal integer literals with a leading zero are forbidden in strict mode', [10]: 'Expected number in radix %0', [151]: 'Invalid left-hand side assignment to a destructible right-hand side', [11]: 'Non-number found after exponent indicator', [12]: 'Invalid BigIntLiteral', [13]: 'No identifiers allowed directly after numeric literal', [14]: 'Escapes \\8 or \\9 are not syntactically valid escapes', [15]: 'Escapes \\8 or \\9 are not allowed in strict mode', [16]: 'Unterminated string literal', [17]: 'Unterminated template literal', [18]: 'Multiline comment was not closed properly', [19]: 'The identifier contained dynamic unicode escape that was not closed', [20]: "Illegal character '%0'", [21]: 'Missing hexadecimal digits', [22]: 'Invalid implicit octal', [23]: 'Invalid line break in string literal', [24]: 'Only unicode escapes are legal in identifier names', [25]: "Expected '%0'", [26]: 'Invalid left-hand side in assignment', [27]: 'Invalid left-hand side in async arrow', [28]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass', [29]: 'Member access on super must be in a method', [31]: 'Await expression not allowed in formal parameter', [32]: 'Yield expression not allowed in formal parameter', [95]: "Unexpected token: 'escaped keyword'", [33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses', [123]: 'Async functions can only be declared at the top level or inside a block', [34]: 'Unterminated regular expression', [35]: 'Unexpected regular expression flag', [36]: "Duplicate regular expression flag '%0'", [37]: '%0 functions must have exactly %1 argument%2', [38]: 'Setter function argument must not be a rest parameter', [39]: '%0 declaration must have a name in this context', [40]: 'Function name may not contain any reserved words or be eval or arguments in strict mode', [41]: 'The rest operator is missing an argument', [42]: 'A getter cannot be a generator', [43]: 'A setter cannot be a generator', [44]: 'A computed property name must be followed by a colon or paren', [134]: 'Object literal keys that are strings or numbers must be a method or have a colon', [46]: 'Found `* async x(){}` but this should be `async * x(){}`', [45]: 'Getters and setters can not be generators', [47]: "'%0' can not be generator method", [48]: "No line break is allowed after '=>'", [49]: 'The left-hand side of the arrow can only be destructed through assignment', [50]: 'The binding declaration is not destructible', [51]: 'Async arrow can not be followed by new expression', [52]: "Classes may not have a static property named 'prototype'", [53]: 'Class constructor may not be a %0', [54]: 'Duplicate constructor method in class', [55]: 'Invalid increment/decrement operand', [56]: 'Invalid use of `new` keyword on an increment/decrement expression', [57]: '`=>` is an invalid assignment target', [58]: 'Rest element may not have a trailing comma', [59]: 'Missing initializer in %0 declaration', [60]: "'for-%0' loop head declarations can not have an initializer", [61]: 'Invalid left-hand side in for-%0 loop: Must have a single binding', [62]: 'Invalid shorthand property initializer', [63]: 'Property name __proto__ appears more than once in object literal', [64]: 'Let is disallowed as a lexically bound name', [65]: "Invalid use of '%0' inside new expression", [66]: "Illegal 'use strict' directive in function with non-simple parameter list", [67]: 'Identifier "let" disallowed as left-hand side expression in strict mode', [68]: 'Illegal continue statement', [69]: 'Illegal break statement', [70]: 'Cannot have `let[...]` as a var name in strict mode', [71]: 'Invalid destructuring assignment target', [72]: 'Rest parameter may not have a default initializer', [73]: 'The rest argument must the be last parameter', [74]: 'Invalid rest argument', [76]: 'In strict mode code, functions can only be declared at top level or inside a block', [77]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement', [78]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement', [79]: "Class declaration can't appear in single-statement context", [80]: 'Invalid left-hand side in for-%0', [81]: 'Invalid assignment in for-%0', [82]: 'for await (... of ...) is only valid in async functions and async generators', [83]: 'The first token after the template expression should be a continuation of the template', [85]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode', [84]: '`let \n [` is a restricted production at the start of a statement', [86]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)', [87]: 'Catch clause parameter does not support default values', [88]: 'Missing catch or finally after try', [89]: 'More than one default clause in switch statement', [90]: 'Illegal newline after throw', [91]: 'Strict mode code may not include a with statement', [92]: 'Illegal return statement', [93]: 'The left hand side of the for-header binding declaration is not destructible', [94]: 'new.target only allowed within functions or static blocks', [96]: "'#' not followed by identifier", [102]: 'Invalid keyword', [101]: "Can not use 'let' as a class name", [100]: "'A lexical declaration can't define a 'let' binding", [99]: 'Can not use `let` as variable name in strict mode', [97]: "'%0' may not be used as an identifier in this context", [98]: 'Await is only valid in async functions', [103]: 'The %0 keyword can only be used with the module goal', [104]: 'Unicode codepoint must not be greater than 0x10FFFF', [105]: '%0 source must be string', [106]: 'Only a identifier or string can be used to indicate alias', [107]: "Only '*' or '{...}' can be imported after default", [108]: 'Trailing decorator may be followed by method', [109]: "Decorators can't be used with a constructor", [110]: 'Can not use `await` as identifier in module or async func', [111]: 'Can not use `await` as identifier in module', [112]: 'HTML comments are only allowed with web compatibility (Annex B)', [113]: "The identifier 'let' must not be in expression position in strict mode", [114]: 'Cannot assign to `eval` and `arguments` in strict mode', [115]: "The left-hand side of a for-of loop may not start with 'let'", [116]: 'Block body arrows can not be immediately invoked without a group', [117]: 'Block body arrows can not be immediately accessed without a group', [118]: 'Unexpected strict mode reserved word', [119]: 'Unexpected eval or arguments in strict mode', [120]: 'Decorators must not be followed by a semicolon', [121]: 'Calling delete on expression not allowed in strict mode', [122]: 'Pattern can not have a tail', [124]: 'Can not have a `yield` expression on the left side of a ternary', [125]: 'An arrow function can not have a postfix update operator', [126]: 'Invalid object literal key character after generator star', [127]: 'Private fields can not be deleted', [129]: 'Classes may not have a field called constructor', [128]: 'Classes may not have a private element named constructor', [130]: 'A class field initializer or static block may not contain arguments', [131]: 'Generators can only be declared at the top level or inside a block', [132]: 'Async methods are a restricted production and cannot have a newline following it', [133]: 'Unexpected character after object literal property name', [135]: 'Invalid key token', [136]: "Label '%0' has already been declared", [137]: 'continue statement must be nested within an iteration statement', [138]: "Undefined label '%0'", [139]: 'Trailing comma is disallowed inside import(...) arguments', [140]: 'Invalid binding in JSON import', [141]: 'import() requires exactly one argument', [142]: 'Cannot use new with import(...)', [143]: '... is not allowed in import()', [144]: "Expected '=>'", [145]: "Duplicate binding '%0'", [146]: 'Duplicate private identifier #%0', [147]: "Cannot export a duplicate name '%0'", [150]: 'Duplicate %0 for-binding', [148]: "Exported binding '%0' needs to refer to a top-level declared variable", [149]: 'Unexpected private field', [153]: 'Numeric separators are not allowed at the end of numeric literals', [152]: 'Only one underscore is allowed as numeric separator', [154]: 'JSX value should be either an expression or a quoted JSX text', [155]: 'Expected corresponding JSX closing tag for %0', [156]: 'Adjacent JSX elements must be wrapped in an enclosing tag', [157]: "JSX attributes must only be assigned a non-empty 'expression'", [158]: "'%0' has already been declared", [159]: "'%0' shadowed a catch clause binding", [160]: 'Dot property must be an identifier', [161]: 'Encountered invalid input after spread/rest argument', [162]: 'Catch without try', [163]: 'Finally without try', [164]: 'Expected corresponding closing tag for JSX fragment', [165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses', [166]: 'Invalid tagged template on optional chain', [167]: 'Invalid optional chain from super property', [168]: 'Invalid optional chain from new expression', [169]: 'Cannot use "import.meta" outside a module', [170]: 'Leading decorators must be attached to a class declaration', [171]: 'An export name cannot include a lone surrogate', [172]: 'A string literal cannot be used as an exported binding without `from`', [173]: "Private fields can't be accessed on super", [174]: "The only valid meta property for import is 'import.meta'", [175]: "'import.meta' must not contain escaped characters", [176]: 'cannot use "await" as identifier inside an async function', [177]: 'cannot use "await" in static blocks', }; class ParseError extends SyntaxError { start; end; range; loc; description; constructor(start, end, type, ...params) { const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]); const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description; super(message); this.start = start.index; this.end = end.index; this.range = [start.index, end.index]; this.loc = { start: { line: start.line, column: start.column }, end: { line: end.line, column: end.column }, }; this.description = description; } } function getOwnProperty(object, key) { return Object.hasOwn(object, key) ? object[key] : undefined; } const KeywordDescTable = [ 'end of source', 'identifier', 'number', 'string', 'regular expression', 'false', 'true', 'null', 'template continuation', 'template tail', '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '++', '--', '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=', '&=', '||=', '&&=', '??=', 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&', '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^', 'var', 'let', 'const', 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export', 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch', 'this', 'throw', 'try', 'while', 'with', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield', 'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of', 'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#', 'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField', 'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText' ]; const descKeywordTable = { this: 86111, function: 86104, if: 20569, return: 20572, var: 86088, else: 20563, for: 20567, new: 86107, in: 8673330, typeof: 16863275, while: 20578, case: 20556, break: 20555, try: 20577, catch: 20557, delete: 16863276, throw: 86112, switch: 86110, continue: 20559, default: 20561, instanceof: 8411187, do: 20562, void: 16863277, finally: 20566, async: 209005, await: 209006, class: 86094, const: 86090, constructor: 12399, debugger: 20560, export: 20564, extends: 20565, false: 86021, from: 209011, get: 209008, implements: 36964, import: 86106, interface: 36965, let: 241737, null: 86023, of: 471156, package: 36966, private: 36967, protected: 36968, public: 36969, set: 209009, static: 36970, super: 86109, true: 86022, with: 20579, yield: 241771, enum: 86133, eval: 537079926, as: 77932, arguments: 537079927, target: 209029, meta: 209030, accessor: 12402, }; function scanIdentifier(parser, context, isValidAsKeyword) { while (isIdPart[advanceChar(parser)]) ; parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index); return parser.currentChar !== 92 && parser.currentChar <= 0x7e ? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897) : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword); } function scanUnicodeIdentifier(parser, context) { const cookedChar = scanIdentifierUnicodeEscape(parser); if (!isIdentifierStart(cookedChar)) parser.report(5); parser.tokenValue = String.fromCodePoint(cookedChar); return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4); } function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) { let start = parser.index; while (parser.index < parser.end) { if (parser.currentChar === 92) { parser.tokenValue += parser.source.slice(start, parser.index); hasEscape = 1; const code = scanIdentifierUnicodeEscape(parser); if (!isIdentifierPart(code)) parser.report(5); isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4; parser.tokenValue += String.fromCodePoint(code); start = parser.index; } else { const merged = consumePossibleSurrogatePair(parser); if (merged > 0) { if (!isIdentifierPart(merged)) { parser.report(20, String.fromCodePoint(merged)); } parser.currentChar = merged; parser.index++; parser.column++; } else if (!isIdentifierPart(parser.currentChar)) { break; } advanceChar(parser); } } if (parser.index <= parser.end) { parser.tokenValue += parser.source.slice(start, parser.index); } const { length } = parser.tokenValue; if (isValidAsKeyword && length >= 2 && length <= 11) { const token = getOwnProperty(descKeywordTable, parser.tokenValue); if (token === void 0) return 208897 | (hasEscape ? -2147483648 : 0); if (!hasEscape) return token; if (token === 209006) { if ((context & (2 | 2048)) === 0) { return token | -2147483648; } return -2147483528; } if (context & 1) { if (token === 36970) { return -2147483527; } if ((token & 36864) === 36864) { return -2147483527; } if ((token & 20480) === 20480) { if (context & 262144 && (context & 8) === 0) { return token | -2147483648; } else { return -2147483528; } } return 209018 | -2147483648; } if (context & 262144 && (context & 8) === 0 && (token & 20480) === 20480) { return token | -2147483648; } if (token === 241771) { return context & 262144 ? 209018 | -2147483648 : context & 1024 ? -2147483528 : token | -2147483648; } if (token === 209005) { return 209018 | -2147483648; } if ((token & 36864) === 36864) { return token | 12288 | -2147483648; } return -2147483528; } return 208897 | (hasEscape ? -2147483648 : 0); } function scanPrivateIdentifier(parser) { let char = advanceChar(parser); if (char === 92) return 130; const merged = consumePossibleSurrogatePair(parser); if (merged) char = merged; if (!isIdentifierStart(char)) parser.report(96); return 130; } function scanIdentifierUnicodeEscape(parser) { if (parser.source.charCodeAt(parser.index + 1) !== 117) { parser.report(5); } parser.currentChar = parser.source.charCodeAt((parser.index += 2)); parser.column += 2; return scanUnicodeEscape(parser); } function scanUnicodeEscape(parser) { let codePoint = 0; const char = parser.currentChar; if (char === 123) { const begin = parser.index - 2; while (CharTypes[advanceChar(parser)] & 64) { codePoint = (codePoint << 4) | toHex(parser.currentChar); if (codePoint > 1114111) throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104); } if (parser.currentChar !== 125) { throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7); } advanceChar(parser); return codePoint; } if ((CharTypes[char] & 64) === 0) parser.report(7); const char2 = parser.source.charCodeAt(parser.index + 1); if ((CharTypes[char2] & 64) === 0) parser.report(7); const char3 = parser.source.charCodeAt(parser.index + 2); if ((CharTypes[char3] & 64) === 0) parser.report(7); const char4 = parser.source.charCodeAt(parser.index + 3); if ((CharTypes[char4] & 64) === 0) parser.report(7); codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4); parser.currentChar = parser.source.charCodeAt((parser.index += 4)); parser.column += 4; return codePoint; } function scanNumber(parser, context, kind) { let char = parser.currentChar; let value = 0; let digit = 9; let atStart = kind & 64 ? 0 : 1; let digits = 0; let allowSeparator = 0; if (kind & 64) { value = '.' + scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; if (char === 110) parser.report(12); } else { if (char === 48) { char = advanceChar(parser); if ((char | 32) === 120) { kind = 8 | 128; char = advanceChar(parser); while (CharTypes[char] & (64 | 4096)) { if (char === 95) { if (!allowSeparator) parser.report(152); allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 0x10 + toHex(char); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { parser.report(digits === 0 ? 21 : 153); } } else if ((char | 32) === 111) { kind = 4 | 128; char = advanceChar(parser); while (CharTypes[char] & (32 | 4096)) { if (char === 95) { if (!allowSeparator) { parser.report(152); } allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 8 + (char - 48); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { parser.report(digits === 0 ? 0 : 153); } } else if ((char | 32) === 98) { kind = 2 | 128; char = advanceChar(parser); while (CharTypes[char] & (128 | 4096)) { if (char === 95) { if (!allowSeparator) { parser.report(152); } allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 2 + (char - 48); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { parser.report(digits === 0 ? 0 : 153); } } else if (CharTypes[char] & 32) { if (context & 1) parser.report(1); kind = 1; while (CharTypes[char] & 16) { if (CharTypes[char] & 512) { kind = 32; atStart = 0; break; } value = value * 8 + (char - 48); char = advanceChar(parser); } } else if (CharTypes[char] & 512) { if (context & 1) parser.report(1); parser.flags |= 64; kind = 32; } else if (char === 95) { parser.report(0); } } if (kind & 48) { if (atStart) { while (digit >= 0 && CharTypes[char] & (16 | 4096)) { if (char === 95) { char = advanceChar(parser); if (char === 95 || kind & 32) { throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152); } allowSeparator = 1; continue; } allowSeparator = 0; value = 10 * value + (char - 48); char = advanceChar(parser); --digit; } if (allowSeparator) { throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153); } if (digit >= 0 && !isIdentifierStart(char) && char !== 46) { parser.tokenValue = value; if (parser.options.raw) parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index); return 134283266; } } value += scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; if (char === 46) { if (advanceChar(parser) === 95) parser.report(0); kind = 64; value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar); char = parser.currentChar; } } } const end = parser.index; let isBigInt = 0; if (char === 110 && kind & 128) { isBigInt = 1; char = advanceChar(parser); } else { if ((char | 32) === 101) { char = advanceChar(parser); if (CharTypes[char] & 256) char = advanceChar(parser); const { index } = parser; if ((CharTypes[char] & 16) === 0) parser.report(11); value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; } } if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) { parser.report(13); } if (isBigInt) { parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index); parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', '')); return 134283388; } parser.tokenValue = kind & (1 | 2 | 8 | 4) ? value : kind & 32 ? parseFloat(parser.source.substring(parser.tokenIndex, parser.index)) : +value; if (parser.options.raw) parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index); return 134283266; } function scanDecimalDigitsOrSeparator(parser, char) { let allowSeparator = 0; let start = parser.index; let ret = ''; while (CharTypes[char] & (16 | 4096)) { if (char === 95) { const { index } = parser; char = advanceChar(parser); if (char === 95) { throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152); } allowSeparator = 1; ret += parser.source.substring(start, index); start = parser.index; continue; } allowSeparator = 0; char = advanceChar(parser); } if (allowSeparator) { throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153); } return ret + parser.source.substring(start, parser.index); } var RegexState; (function (Rege