@typescript-deploys/pr-build 5.4.0-pr-56183-8 → 5.4.0-pr-55600-40

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/lib/tsc.js CHANGED
@@ -3795,6 +3795,24 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
3795
3795
  ScriptKind3[ScriptKind3["Deferred"] = 7] = "Deferred";
3796
3796
  return ScriptKind3;
3797
3797
  })(ScriptKind || {});
3798
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget3) => {
3799
+ ScriptTarget3[ScriptTarget3["ES3"] = 0] = "ES3";
3800
+ ScriptTarget3[ScriptTarget3["ES5"] = 1] = "ES5";
3801
+ ScriptTarget3[ScriptTarget3["ES2015"] = 2] = "ES2015";
3802
+ ScriptTarget3[ScriptTarget3["ES2016"] = 3] = "ES2016";
3803
+ ScriptTarget3[ScriptTarget3["ES2017"] = 4] = "ES2017";
3804
+ ScriptTarget3[ScriptTarget3["ES2018"] = 5] = "ES2018";
3805
+ ScriptTarget3[ScriptTarget3["ES2019"] = 6] = "ES2019";
3806
+ ScriptTarget3[ScriptTarget3["ES2020"] = 7] = "ES2020";
3807
+ ScriptTarget3[ScriptTarget3["ES2021"] = 8] = "ES2021";
3808
+ ScriptTarget3[ScriptTarget3["ES2022"] = 9] = "ES2022";
3809
+ ScriptTarget3[ScriptTarget3["ES2023"] = 10] = "ES2023";
3810
+ ScriptTarget3[ScriptTarget3["ES2024"] = 11] = "ES2024";
3811
+ ScriptTarget3[ScriptTarget3["ESNext"] = 99] = "ESNext";
3812
+ ScriptTarget3[ScriptTarget3["JSON"] = 100] = "JSON";
3813
+ ScriptTarget3[ScriptTarget3["Latest"] = 99 /* ESNext */] = "Latest";
3814
+ return ScriptTarget3;
3815
+ })(ScriptTarget || {});
3798
3816
  var TransformFlags = /* @__PURE__ */ ((TransformFlags3) => {
3799
3817
  TransformFlags3[TransformFlags3["None"] = 0] = "None";
3800
3818
  TransformFlags3[TransformFlags3["ContainsTypeScript"] = 1] = "ContainsTypeScript";
@@ -6107,6 +6125,43 @@ var Diagnostics = {
6107
6125
  The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
6108
6126
  _0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
6109
6127
  Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
6128
+ Unknown_regular_expression_flag: diag(1497, 1 /* Error */, "Unknown_regular_expression_flag_1497", "Unknown regular expression flag."),
6129
+ Duplicate_regular_expression_flag: diag(1498, 1 /* Error */, "Duplicate_regular_expression_flag_1498", "Duplicate regular expression flag."),
6130
+ This_regular_expression_flag_is_only_available_when_targeting_0_or_later: diag(1499, 1 /* Error */, "This_regular_expression_flag_is_only_available_when_targeting_0_or_later_1499", "This regular expression flag is only available when targeting '{0}' or later."),
6131
+ The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously: diag(1500, 1 /* Error */, "The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously_1500", "The Unicode (u) flag and the Unicode Sets (v) flag cannot be set simultaneously."),
6132
+ Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later: diag(1501, 1 /* Error */, "Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later_1501", "Named capturing groups are only available when targeting 'ES2018' or later."),
6133
+ Subpattern_flags_must_be_present_when_there_is_a_minus_sign: diag(1502, 1 /* Error */, "Subpattern_flags_must_be_present_when_there_is_a_minus_sign_1502", "Subpattern flags must be present when there is a minus sign."),
6134
+ Incomplete_quantifier_Digit_expected: diag(1503, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1503", "Incomplete quantifier. Digit expected."),
6135
+ Numbers_out_of_order_in_quantifier: diag(1504, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1504", "Numbers out of order in quantifier."),
6136
+ There_is_nothing_available_for_repetition: diag(1505, 1 /* Error */, "There_is_nothing_available_for_repetition_1505", "There is nothing available for repetition."),
6137
+ Unexpected_0_Did_you_mean_to_escape_it_with_backslash: diag(1506, 1 /* Error */, "Unexpected_0_Did_you_mean_to_escape_it_with_backslash_1506", "Unexpected '{0}'. Did you mean to escape it with backslash?"),
6138
+ This_regular_expression_flag_cannot_be_toggled_within_a_subpattern: diag(1507, 1 /* Error */, "This_regular_expression_flag_cannot_be_toggled_within_a_subpattern_1507", "This regular expression flag cannot be toggled within a subpattern."),
6139
+ k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets: diag(1508, 1 /* Error */, "k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets_1508", "'\\k' must be followed by a capturing group name enclosed in angle brackets."),
6140
+ q_is_only_available_inside_character_class: diag(1509, 1 /* Error */, "q_is_only_available_inside_character_class_1509", "'\\q' is only available inside character class."),
6141
+ c_must_be_followed_by_an_ASCII_letter: diag(1510, 1 /* Error */, "c_must_be_followed_by_an_ASCII_letter_1510", "'\\c' must be followed by an ASCII letter."),
6142
+ Undetermined_character_escape: diag(1511, 1 /* Error */, "Undetermined_character_escape_1511", "Undetermined character escape."),
6143
+ Expected_a_capturing_group_name: diag(1512, 1 /* Error */, "Expected_a_capturing_group_name_1512", "Expected a capturing group name."),
6144
+ Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other: diag(1513, 1 /* Error */, "Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other_1513", "Named capturing groups with the same name must be mutually exclusive to each other."),
6145
+ A_character_class_range_must_not_be_bounded_by_another_character_class: diag(1514, 1 /* Error */, "A_character_class_range_must_not_be_bounded_by_another_character_class_1514", "A character class range must not be bounded by another character class."),
6146
+ Range_out_of_order_in_character_class: diag(1515, 1 /* Error */, "Range_out_of_order_in_character_class_1515", "Range out of order in character class."),
6147
+ Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class: diag(1516, 1 /* Error */, "Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_characte_1516", "Anything that would possibly match more than a single character is invalid inside a negated character class."),
6148
+ Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead: diag(1517, 1 /* Error */, "Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead_1517", "Operators must not be mixed within a character class. Wrap it in a nested class instead."),
6149
+ Expected_a_class_set_oprand: diag(1518, 1 /* Error */, "Expected_a_class_set_oprand_1518", "Expected a class set oprand."),
6150
+ q_must_be_followed_by_string_alternatives_enclosed_in_braces: diag(1519, 1 /* Error */, "q_must_be_followed_by_string_alternatives_enclosed_in_braces_1519", "'\\q' must be followed by string alternatives enclosed in braces."),
6151
+ A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash: diag(1520, 1 /* Error */, "A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backs_1520", "A character class must not contain a reserved double punctuator. Did you mean to escape it with backslash?"),
6152
+ Expected_a_Unicode_property_name: diag(1521, 1 /* Error */, "Expected_a_Unicode_property_name_1521", "Expected a Unicode property name."),
6153
+ Unknown_Unicode_property_name: diag(1522, 1 /* Error */, "Unknown_Unicode_property_name_1522", "Unknown Unicode property name."),
6154
+ Expected_a_Unicode_property_value: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_value_1523", "Expected a Unicode property value."),
6155
+ Unknown_Unicode_property_value: diag(1524, 1 /* Error */, "Unknown_Unicode_property_value_1524", "Unknown Unicode property value."),
6156
+ Expected_a_Unicode_property_name_or_value: diag(1525, 1 /* Error */, "Expected_a_Unicode_property_name_or_value_1525", "Expected a Unicode property name or value."),
6157
+ Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set: diag(1526, 1 /* Error */, "Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_t_1526", "Any Unicode property that would possibly match more than a single character is only available when the Unicode Sets (v) flag is set."),
6158
+ Unknown_Unicode_property_name_or_value: diag(1527, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1527", "Unknown Unicode property name or value."),
6159
+ Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1528, 1 /* Error */, "Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v__1528", "Unicode property value expressions are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
6160
+ _0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces: diag(1529, 1 /* Error */, "_0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces_1529", "'\\{0}' must be followed by a Unicode property value expression enclosed in braces."),
6161
+ There_is_no_capturing_group_named_0_in_this_regular_expression: diag(1530, 1 /* Error */, "There_is_no_capturing_group_named_0_in_this_regular_expression_1530", "There is no capturing group named '{0}' in this regular expression."),
6162
+ A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression: diag(1531, 1 /* Error */, "A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_1531", "A decimal escape must refer to an existent capturing group. There are only {0} capturing groups in this regular expression."),
6163
+ Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression: diag(1532, 1 /* Error */, "Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression_1532", "Decimal escapes are invalid when there are no capturing groups in a regular expression."),
6164
+ _0_is_not_a_valid_character_escape: diag(1533, 1 /* Error */, "_0_is_not_a_valid_character_escape_1533", "'\\{0}' is not a valid character escape."),
6110
6165
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
6111
6166
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
6112
6167
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7949,6 +8004,26 @@ var textToToken = new Map(Object.entries({
7949
8004
  "#": 63 /* HashToken */,
7950
8005
  "`": 62 /* BacktickToken */
7951
8006
  }));
8007
+ var charToRegExpFlag = new Map(Object.entries({
8008
+ d: 1 /* HasIndices */,
8009
+ g: 2 /* Global */,
8010
+ i: 4 /* IgnoreCase */,
8011
+ m: 8 /* Multiline */,
8012
+ s: 16 /* DotAll */,
8013
+ u: 32 /* Unicode */,
8014
+ v: 64 /* UnicodeSets */,
8015
+ y: 128 /* Sticky */
8016
+ }));
8017
+ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
8018
+ [1 /* HasIndices */, 9 /* ES2022 */],
8019
+ [2 /* Global */, 0 /* ES3 */],
8020
+ [4 /* IgnoreCase */, 0 /* ES3 */],
8021
+ [8 /* Multiline */, 0 /* ES3 */],
8022
+ [16 /* DotAll */, 5 /* ES2018 */],
8023
+ [32 /* Unicode */, 2 /* ES2015 */],
8024
+ [64 /* UnicodeSets */, 11 /* ES2024 */],
8025
+ [128 /* Sticky */, 2 /* ES2015 */]
8026
+ ]);
7952
8027
  var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
7953
8028
  var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
7954
8029
  var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
@@ -7999,6 +8074,13 @@ function tokenToString(t) {
7999
8074
  function stringToToken(s) {
8000
8075
  return textToToken.get(s);
8001
8076
  }
8077
+ var regExpFlagChars = makeReverseMap(charToRegExpFlag);
8078
+ function characterToRegularExpressionFlag(c) {
8079
+ return charToRegExpFlag.get(c);
8080
+ }
8081
+ function regularExpressionFlagToFirstAvailableLanguageVersion(f) {
8082
+ return regExpFlagToFirstAvailableLanguageVersion.get(f);
8083
+ }
8002
8084
  function computeLineStarts(text) {
8003
8085
  const result = [];
8004
8086
  let pos = 0;
@@ -8095,8 +8177,11 @@ function isDigit(ch) {
8095
8177
  function isHexDigit(ch) {
8096
8178
  return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
8097
8179
  }
8098
- function isCodePoint(code) {
8099
- return code <= 1114111;
8180
+ function isASCIILetter(ch) {
8181
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
8182
+ }
8183
+ function isWordCharacter(ch) {
8184
+ return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
8100
8185
  }
8101
8186
  function isOctalDigit(ch) {
8102
8187
  return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
@@ -8414,10 +8499,10 @@ function getShebang(text) {
8414
8499
  }
8415
8500
  }
8416
8501
  function isIdentifierStart(ch, languageVersion) {
8417
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8502
+ return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8418
8503
  }
8419
8504
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
8420
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || // "-" and ":" are valid in JSX Identifiers
8505
+ return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
8421
8506
  (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
8422
8507
  }
8423
8508
  function isIdentifierText(name, languageVersion, identifierVariant) {
@@ -8738,7 +8823,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8738
8823
  result += text.substring(start2, pos);
8739
8824
  result += scanEscapeSequence(
8740
8825
  /*shouldEmitInvalidEscapeError*/
8741
- true
8826
+ true,
8827
+ /*isRegularExpression*/
8828
+ false
8742
8829
  );
8743
8830
  start2 = pos;
8744
8831
  continue;
@@ -8782,7 +8869,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8782
8869
  }
8783
8870
  if (currChar === 92 /* backslash */) {
8784
8871
  contents += text.substring(start2, pos);
8785
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8872
+ contents += scanEscapeSequence(
8873
+ shouldEmitInvalidEscapeError,
8874
+ /*isRegularExpression*/
8875
+ false
8876
+ );
8786
8877
  start2 = pos;
8787
8878
  continue;
8788
8879
  }
@@ -8802,7 +8893,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8802
8893
  tokenValue = contents;
8803
8894
  return resultingToken;
8804
8895
  }
8805
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8896
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
8806
8897
  const start2 = pos;
8807
8898
  pos++;
8808
8899
  if (pos >= end) {
@@ -8830,7 +8921,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8830
8921
  pos++;
8831
8922
  }
8832
8923
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8833
- if (shouldEmitInvalidEscapeError) {
8924
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8834
8925
  const code = parseInt(text.substring(start2 + 1, pos), 8);
8835
8926
  error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8836
8927
  return String.fromCharCode(code);
@@ -8839,7 +8930,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8839
8930
  case 56 /* _8 */:
8840
8931
  case 57 /* _9 */:
8841
8932
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8842
- if (shouldEmitInvalidEscapeError) {
8933
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8843
8934
  error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8844
8935
  return String.fromCharCode(ch);
8845
8936
  }
@@ -8861,62 +8952,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8861
8952
  case 34 /* doubleQuote */:
8862
8953
  return '"';
8863
8954
  case 117 /* u */:
8864
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8865
- pos++;
8866
- const escapedValueString = scanMinimumNumberOfHexDigits(
8867
- 1,
8868
- /*canHaveSeparators*/
8869
- false
8870
- );
8871
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8872
- if (escapedValue < 0) {
8873
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8874
- if (shouldEmitInvalidEscapeError) {
8875
- error(Diagnostics.Hexadecimal_digit_expected);
8876
- }
8877
- return text.substring(start2, pos);
8878
- }
8879
- if (!isCodePoint(escapedValue)) {
8880
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8881
- if (shouldEmitInvalidEscapeError) {
8882
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8883
- }
8884
- return text.substring(start2, pos);
8885
- }
8886
- if (pos >= end) {
8887
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8888
- if (shouldEmitInvalidEscapeError) {
8889
- error(Diagnostics.Unexpected_end_of_text);
8890
- }
8891
- return text.substring(start2, pos);
8892
- }
8893
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8894
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8895
- if (shouldEmitInvalidEscapeError) {
8896
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
8897
- }
8898
- return text.substring(start2, pos);
8899
- }
8900
- pos++;
8901
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8902
- return utf16EncodeAsString(escapedValue);
8955
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8956
+ pos -= 2;
8957
+ return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
8903
8958
  }
8904
8959
  for (; pos < start2 + 6; pos++) {
8905
8960
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8906
8961
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8907
- if (shouldEmitInvalidEscapeError) {
8962
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8908
8963
  error(Diagnostics.Hexadecimal_digit_expected);
8909
8964
  }
8910
8965
  return text.substring(start2, pos);
8911
8966
  }
8912
8967
  }
8913
8968
  tokenFlags |= 1024 /* UnicodeEscape */;
8914
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8969
+ const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
8970
+ const escapedValueString = String.fromCharCode(escapedValue);
8971
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
8972
+ const nextStart = pos;
8973
+ let nextPos = pos + 2;
8974
+ for (; nextPos < nextStart + 6; nextPos++) {
8975
+ if (!isHexDigit(text.charCodeAt(pos))) {
8976
+ return escapedValueString;
8977
+ }
8978
+ }
8979
+ const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
8980
+ if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
8981
+ pos = nextPos;
8982
+ return escapedValueString + String.fromCharCode(nextEscapedValue);
8983
+ }
8984
+ }
8985
+ return escapedValueString;
8915
8986
  case 120 /* x */:
8916
8987
  for (; pos < start2 + 4; pos++) {
8917
8988
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8918
8989
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8919
- if (shouldEmitInvalidEscapeError) {
8990
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8920
8991
  error(Diagnostics.Hexadecimal_digit_expected);
8921
8992
  }
8922
8993
  return text.substring(start2, pos);
@@ -8933,10 +9004,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8933
9004
  case 8233 /* paragraphSeparator */:
8934
9005
  return "";
8935
9006
  default:
9007
+ if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
9008
+ error(Diagnostics._0_is_not_a_valid_character_escape, pos - 2, 2, String.fromCharCode(ch));
9009
+ }
8936
9010
  return String.fromCharCode(ch);
8937
9011
  }
8938
9012
  }
8939
- function scanExtendedUnicodeEscape() {
9013
+ function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError = true) {
9014
+ const start2 = pos;
9015
+ pos += 3;
9016
+ const escapedStart = pos;
8940
9017
  const escapedValueString = scanMinimumNumberOfHexDigits(
8941
9018
  1,
8942
9019
  /*canHaveSeparators*/
@@ -8945,24 +9022,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8945
9022
  const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8946
9023
  let isInvalidExtendedEscape = false;
8947
9024
  if (escapedValue < 0) {
8948
- error(Diagnostics.Hexadecimal_digit_expected);
9025
+ if (shouldEmitInvalidEscapeError) {
9026
+ error(Diagnostics.Hexadecimal_digit_expected);
9027
+ }
8949
9028
  isInvalidExtendedEscape = true;
8950
9029
  } else if (escapedValue > 1114111) {
8951
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
9030
+ if (shouldEmitInvalidEscapeError) {
9031
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
9032
+ }
8952
9033
  isInvalidExtendedEscape = true;
8953
9034
  }
8954
9035
  if (pos >= end) {
8955
- error(Diagnostics.Unexpected_end_of_text);
9036
+ if (shouldEmitInvalidEscapeError) {
9037
+ error(Diagnostics.Unexpected_end_of_text);
9038
+ }
8956
9039
  isInvalidExtendedEscape = true;
8957
9040
  } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
8958
9041
  pos++;
8959
9042
  } else {
8960
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
9043
+ if (shouldEmitInvalidEscapeError) {
9044
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
9045
+ }
8961
9046
  isInvalidExtendedEscape = true;
8962
9047
  }
8963
9048
  if (isInvalidExtendedEscape) {
8964
- return "";
9049
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
9050
+ return text.substring(start2, pos);
8965
9051
  }
9052
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8966
9053
  return utf16EncodeAsString(escapedValue);
8967
9054
  }
8968
9055
  function peekUnicodeEscape() {
@@ -9004,8 +9091,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9004
9091
  } else if (ch === 92 /* backslash */) {
9005
9092
  ch = peekExtendedUnicodeEscape();
9006
9093
  if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
9007
- pos += 3;
9008
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9009
9094
  result += scanExtendedUnicodeEscape();
9010
9095
  start2 = pos;
9011
9096
  continue;
@@ -9476,8 +9561,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9476
9561
  case 92 /* backslash */:
9477
9562
  const extendedCookedChar = peekExtendedUnicodeEscape();
9478
9563
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9479
- pos += 3;
9480
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9481
9564
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
9482
9565
  return token = getIdentifierToken();
9483
9566
  }
@@ -9493,7 +9576,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9493
9576
  return token = 0 /* Unknown */;
9494
9577
  case 35 /* hash */:
9495
9578
  if (pos !== 0 && text[pos + 1] === "!") {
9496
- error(Diagnostics.can_only_be_used_at_the_start_of_a_file);
9579
+ error(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
9497
9580
  pos++;
9498
9581
  return token = 0 /* Unknown */;
9499
9582
  }
@@ -9502,8 +9585,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9502
9585
  pos++;
9503
9586
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
9504
9587
  if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
9505
- pos += 3;
9506
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9507
9588
  tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
9508
9589
  return token = 81 /* PrivateIdentifier */;
9509
9590
  }
@@ -9641,14 +9722,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9641
9722
  }
9642
9723
  p++;
9643
9724
  }
9644
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
9725
+ const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
9726
+ const endOfBody = p - (isUnterminated ? 0 : 1);
9727
+ let regExpFlags = 0 /* None */;
9728
+ while (p < end) {
9729
+ const ch = text.charCodeAt(p);
9730
+ if (!isIdentifierPart(ch, languageVersion)) {
9731
+ break;
9732
+ }
9733
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9734
+ if (flag === void 0) {
9735
+ error(Diagnostics.Unknown_regular_expression_flag, p, 1);
9736
+ } else if (regExpFlags & flag) {
9737
+ error(Diagnostics.Duplicate_regular_expression_flag, p, 1);
9738
+ } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
9739
+ error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
9740
+ } else {
9741
+ regExpFlags |= flag;
9742
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
9743
+ if (languageVersion < availableFrom) {
9744
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, ScriptTarget[availableFrom]);
9745
+ }
9746
+ }
9645
9747
  p++;
9646
9748
  }
9647
- pos = p;
9749
+ pos = tokenStart + 1;
9750
+ const saveTokenPos = tokenStart;
9751
+ const saveTokenFlags = tokenFlags;
9752
+ scanRegularExpressionWorker(text.slice(0, endOfBody), endOfBody, regExpFlags, isUnterminated);
9753
+ if (!isUnterminated) {
9754
+ pos = p;
9755
+ }
9756
+ tokenStart = saveTokenPos;
9757
+ tokenFlags = saveTokenFlags;
9648
9758
  tokenValue = text.substring(tokenStart, pos);
9649
9759
  token = 14 /* RegularExpressionLiteral */;
9650
9760
  }
9651
9761
  return token;
9762
+ function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
9763
+ const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
9764
+ const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
9765
+ let mayContainStrings = false;
9766
+ let numberOfCapturingGroups = 0;
9767
+ const groupSpecifiers = /* @__PURE__ */ new Set();
9768
+ const groupNameReferences = [];
9769
+ const decimalEscapes = [];
9770
+ const namedCapturingGroups = [];
9771
+ function scanDisjunction(isInGroup) {
9772
+ while (true) {
9773
+ namedCapturingGroups.push(/* @__PURE__ */ new Set());
9774
+ scanAlternative(isInGroup);
9775
+ namedCapturingGroups.pop();
9776
+ if (text2.charCodeAt(pos) !== 124 /* bar */) {
9777
+ return;
9778
+ }
9779
+ pos++;
9780
+ }
9781
+ }
9782
+ function scanAlternative(isInGroup) {
9783
+ let isPreviousTermQuantifiable = false;
9784
+ while (pos < end2) {
9785
+ const start2 = pos;
9786
+ const ch = text2.charCodeAt(pos);
9787
+ switch (ch) {
9788
+ case 94 /* caret */:
9789
+ case 36 /* $ */:
9790
+ pos++;
9791
+ isPreviousTermQuantifiable = false;
9792
+ break;
9793
+ case 92 /* backslash */:
9794
+ pos++;
9795
+ switch (text2.charCodeAt(pos)) {
9796
+ case 98 /* b */:
9797
+ case 66 /* B */:
9798
+ pos++;
9799
+ isPreviousTermQuantifiable = false;
9800
+ break;
9801
+ default:
9802
+ scanAtomEscape();
9803
+ isPreviousTermQuantifiable = true;
9804
+ break;
9805
+ }
9806
+ break;
9807
+ case 40 /* openParen */:
9808
+ pos++;
9809
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9810
+ pos++;
9811
+ switch (text2.charCodeAt(pos)) {
9812
+ case 61 /* equals */:
9813
+ case 33 /* exclamation */:
9814
+ pos++;
9815
+ isPreviousTermQuantifiable = false;
9816
+ break;
9817
+ case 60 /* lessThan */:
9818
+ const groupNameStart = pos;
9819
+ pos++;
9820
+ switch (text2.charCodeAt(pos)) {
9821
+ case 61 /* equals */:
9822
+ case 33 /* exclamation */:
9823
+ pos++;
9824
+ isPreviousTermQuantifiable = false;
9825
+ break;
9826
+ default:
9827
+ scanGroupName(
9828
+ /*isReference*/
9829
+ false
9830
+ );
9831
+ scanExpectedChar(62 /* greaterThan */);
9832
+ if (languageVersion < 5 /* ES2018 */) {
9833
+ error(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
9834
+ }
9835
+ numberOfCapturingGroups++;
9836
+ isPreviousTermQuantifiable = true;
9837
+ break;
9838
+ }
9839
+ break;
9840
+ default:
9841
+ const start3 = pos;
9842
+ const setFlags = scanPatternModifiers();
9843
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
9844
+ pos++;
9845
+ scanPatternModifiers(setFlags);
9846
+ if (pos === start3 + 1) {
9847
+ error(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
9848
+ }
9849
+ }
9850
+ scanExpectedChar(58 /* colon */);
9851
+ isPreviousTermQuantifiable = true;
9852
+ break;
9853
+ }
9854
+ } else {
9855
+ numberOfCapturingGroups++;
9856
+ isPreviousTermQuantifiable = true;
9857
+ }
9858
+ scanDisjunction(
9859
+ /*isInGroup*/
9860
+ true
9861
+ );
9862
+ scanExpectedChar(41 /* closeParen */);
9863
+ break;
9864
+ case 123 /* openBrace */:
9865
+ pos++;
9866
+ const digitsStart = pos;
9867
+ scanDigits();
9868
+ const min2 = tokenValue;
9869
+ if (text2.charCodeAt(pos) === 44 /* comma */) {
9870
+ pos++;
9871
+ scanDigits();
9872
+ const max = tokenValue;
9873
+ if (!min2) {
9874
+ if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
9875
+ error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
9876
+ } else {
9877
+ if (unicodeMode) {
9878
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9879
+ }
9880
+ isPreviousTermQuantifiable = true;
9881
+ break;
9882
+ }
9883
+ }
9884
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
9885
+ error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
9886
+ }
9887
+ } else if (!min2) {
9888
+ if (unicodeMode) {
9889
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9890
+ }
9891
+ isPreviousTermQuantifiable = true;
9892
+ break;
9893
+ }
9894
+ scanExpectedChar(125 /* closeBrace */);
9895
+ pos--;
9896
+ case 42 /* asterisk */:
9897
+ case 43 /* plus */:
9898
+ case 63 /* question */:
9899
+ pos++;
9900
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9901
+ pos++;
9902
+ }
9903
+ if (!isPreviousTermQuantifiable) {
9904
+ error(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
9905
+ }
9906
+ isPreviousTermQuantifiable = false;
9907
+ break;
9908
+ case 46 /* dot */:
9909
+ pos++;
9910
+ isPreviousTermQuantifiable = true;
9911
+ break;
9912
+ case 91 /* openBracket */:
9913
+ pos++;
9914
+ if (unicodeSetsMode) {
9915
+ scanClassSetExpression();
9916
+ } else {
9917
+ scanClassRanges();
9918
+ }
9919
+ scanExpectedChar(93 /* closeBracket */);
9920
+ isPreviousTermQuantifiable = true;
9921
+ break;
9922
+ case 41 /* closeParen */:
9923
+ if (isInGroup) {
9924
+ return;
9925
+ }
9926
+ case 93 /* closeBracket */:
9927
+ case 125 /* closeBrace */:
9928
+ if (isUnterminated && !isInGroup) {
9929
+ return;
9930
+ }
9931
+ if (unicodeMode) {
9932
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
9933
+ }
9934
+ pos++;
9935
+ isPreviousTermQuantifiable = true;
9936
+ break;
9937
+ case 47 /* slash */:
9938
+ case 124 /* bar */:
9939
+ return;
9940
+ default:
9941
+ scanSourceCharacter();
9942
+ isPreviousTermQuantifiable = true;
9943
+ break;
9944
+ }
9945
+ }
9946
+ }
9947
+ function scanPatternModifiers(currFlags = 0 /* None */) {
9948
+ while (pos < end2) {
9949
+ const ch = text2.charCodeAt(pos);
9950
+ if (!isIdentifierPart(ch, languageVersion)) {
9951
+ break;
9952
+ }
9953
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9954
+ if (flag === void 0) {
9955
+ error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
9956
+ } else if (currFlags & flag) {
9957
+ error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
9958
+ } else if (!(flag & 28 /* Modifiers */)) {
9959
+ error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
9960
+ } else {
9961
+ currFlags |= flag;
9962
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
9963
+ if (languageVersion < availableFrom) {
9964
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, ScriptTarget[availableFrom]);
9965
+ }
9966
+ }
9967
+ pos++;
9968
+ }
9969
+ return currFlags;
9970
+ }
9971
+ function scanAtomEscape() {
9972
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
9973
+ switch (text2.charCodeAt(pos)) {
9974
+ case 107 /* k */:
9975
+ pos++;
9976
+ if (text2.charCodeAt(pos) === 60 /* lessThan */) {
9977
+ pos++;
9978
+ scanGroupName(
9979
+ /*isReference*/
9980
+ true
9981
+ );
9982
+ scanExpectedChar(62 /* greaterThan */);
9983
+ } else if (unicodeMode) {
9984
+ error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
9985
+ }
9986
+ break;
9987
+ case 113 /* q */:
9988
+ if (unicodeSetsMode) {
9989
+ pos++;
9990
+ error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
9991
+ break;
9992
+ }
9993
+ default:
9994
+ scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape();
9995
+ break;
9996
+ }
9997
+ }
9998
+ function scanDecimalEscape() {
9999
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10000
+ const ch = text2.charCodeAt(pos);
10001
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
10002
+ const start2 = pos;
10003
+ scanDigits();
10004
+ decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
10005
+ return true;
10006
+ }
10007
+ return false;
10008
+ }
10009
+ function scanCharacterEscape() {
10010
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10011
+ let ch = text2.charCodeAt(pos);
10012
+ switch (ch) {
10013
+ case 99 /* c */:
10014
+ pos++;
10015
+ ch = text2.charCodeAt(pos);
10016
+ if (isASCIILetter(ch)) {
10017
+ pos++;
10018
+ return String.fromCharCode(ch & 31);
10019
+ }
10020
+ if (unicodeMode) {
10021
+ error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
10022
+ }
10023
+ return String.fromCharCode(ch);
10024
+ case 94 /* caret */:
10025
+ case 36 /* $ */:
10026
+ case 47 /* slash */:
10027
+ case 92 /* backslash */:
10028
+ case 46 /* dot */:
10029
+ case 42 /* asterisk */:
10030
+ case 43 /* plus */:
10031
+ case 63 /* question */:
10032
+ case 40 /* openParen */:
10033
+ case 41 /* closeParen */:
10034
+ case 91 /* openBracket */:
10035
+ case 93 /* closeBracket */:
10036
+ case 123 /* openBrace */:
10037
+ case 125 /* closeBrace */:
10038
+ case 124 /* bar */:
10039
+ pos++;
10040
+ return String.fromCharCode(ch);
10041
+ default:
10042
+ if (pos >= end2) {
10043
+ error(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
10044
+ return "\\";
10045
+ }
10046
+ pos--;
10047
+ return scanEscapeSequence(
10048
+ /*shouldEmitInvalidEscapeError*/
10049
+ unicodeMode,
10050
+ /*isRegularExpression*/
10051
+ true
10052
+ );
10053
+ }
10054
+ }
10055
+ function scanGroupName(isReference) {
10056
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
10057
+ tokenStart = pos;
10058
+ scanIdentifier(codePointAt(text2, pos), languageVersion);
10059
+ if (pos === tokenStart) {
10060
+ error(Diagnostics.Expected_a_capturing_group_name);
10061
+ } else if (isReference) {
10062
+ groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
10063
+ } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
10064
+ error(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
10065
+ } else {
10066
+ last(namedCapturingGroups).add(tokenValue);
10067
+ groupSpecifiers.add(tokenValue);
10068
+ }
10069
+ }
10070
+ function isClassContentExit(ch) {
10071
+ return ch === 93 /* closeBracket */ || pos >= end2;
10072
+ }
10073
+ function scanClassRanges() {
10074
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10075
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10076
+ pos++;
10077
+ }
10078
+ while (pos < end2) {
10079
+ const ch = text2.charCodeAt(pos);
10080
+ if (isClassContentExit(ch)) {
10081
+ return;
10082
+ }
10083
+ const minStart = pos;
10084
+ const minCharacter = scanClassAtom();
10085
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10086
+ pos++;
10087
+ const ch2 = text2.charCodeAt(pos);
10088
+ if (isClassContentExit(ch2)) {
10089
+ return;
10090
+ }
10091
+ if (!minCharacter) {
10092
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
10093
+ }
10094
+ const maxStart = pos;
10095
+ const maxCharacter = scanClassAtom();
10096
+ if (!maxCharacter) {
10097
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
10098
+ continue;
10099
+ }
10100
+ if (!minCharacter) {
10101
+ continue;
10102
+ }
10103
+ const minCharacterValue = codePointAt(minCharacter, 0);
10104
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
10105
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10106
+ error(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
10107
+ }
10108
+ }
10109
+ }
10110
+ }
10111
+ function scanClassSetExpression() {
10112
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10113
+ let isCharacterComplement = false;
10114
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10115
+ pos++;
10116
+ isCharacterComplement = true;
10117
+ }
10118
+ let expressionMayContainStrings = false;
10119
+ let ch = text2.charCodeAt(pos);
10120
+ if (isClassContentExit(ch)) {
10121
+ return;
10122
+ }
10123
+ let start2 = pos;
10124
+ let oprand;
10125
+ switch (text2.slice(pos, pos + 2)) {
10126
+ case "--":
10127
+ case "&&":
10128
+ error(Diagnostics.Expected_a_class_set_oprand);
10129
+ mayContainStrings = false;
10130
+ break;
10131
+ default:
10132
+ oprand = scanClassSetOprand();
10133
+ break;
10134
+ }
10135
+ switch (text2.charCodeAt(pos)) {
10136
+ case 45 /* minus */:
10137
+ if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
10138
+ if (isCharacterComplement && mayContainStrings) {
10139
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10140
+ }
10141
+ expressionMayContainStrings = mayContainStrings;
10142
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
10143
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10144
+ return;
10145
+ }
10146
+ break;
10147
+ case 38 /* ampersand */:
10148
+ if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
10149
+ scanClassSetSubExpression(2 /* ClassIntersection */);
10150
+ if (isCharacterComplement && mayContainStrings) {
10151
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10152
+ }
10153
+ expressionMayContainStrings = mayContainStrings;
10154
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10155
+ return;
10156
+ } else {
10157
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10158
+ }
10159
+ break;
10160
+ default:
10161
+ if (isCharacterComplement && mayContainStrings) {
10162
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10163
+ }
10164
+ expressionMayContainStrings = mayContainStrings;
10165
+ break;
10166
+ }
10167
+ while (pos < end2) {
10168
+ ch = text2.charCodeAt(pos);
10169
+ switch (ch) {
10170
+ case 45 /* minus */:
10171
+ pos++;
10172
+ ch = text2.charCodeAt(pos);
10173
+ if (isClassContentExit(ch)) {
10174
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10175
+ return;
10176
+ }
10177
+ if (ch === 45 /* minus */) {
10178
+ pos++;
10179
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10180
+ start2 = pos - 2;
10181
+ oprand = text2.slice(start2, pos);
10182
+ continue;
10183
+ } else {
10184
+ if (!oprand) {
10185
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
10186
+ }
10187
+ const secondStart = pos;
10188
+ const secondOprand = scanClassSetOprand();
10189
+ if (isCharacterComplement && mayContainStrings) {
10190
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
10191
+ }
10192
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
10193
+ if (!secondOprand) {
10194
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
10195
+ break;
10196
+ }
10197
+ if (!oprand) {
10198
+ break;
10199
+ }
10200
+ const minCharacterValue = codePointAt(oprand, 0);
10201
+ const maxCharacterValue = codePointAt(secondOprand, 0);
10202
+ if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10203
+ error(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
10204
+ }
10205
+ }
10206
+ break;
10207
+ case 38 /* ampersand */:
10208
+ start2 = pos;
10209
+ pos++;
10210
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10211
+ pos++;
10212
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10213
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10214
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10215
+ pos++;
10216
+ }
10217
+ } else {
10218
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10219
+ }
10220
+ oprand = text2.slice(start2, pos);
10221
+ continue;
10222
+ }
10223
+ if (isClassContentExit(text2.charCodeAt(pos))) {
10224
+ break;
10225
+ }
10226
+ start2 = pos;
10227
+ switch (text2.slice(pos, pos + 2)) {
10228
+ case "--":
10229
+ case "&&":
10230
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
10231
+ pos += 2;
10232
+ oprand = text2.slice(start2, pos);
10233
+ break;
10234
+ default:
10235
+ oprand = scanClassSetOprand();
10236
+ break;
10237
+ }
10238
+ }
10239
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10240
+ }
10241
+ function scanClassSetSubExpression(expressionType) {
10242
+ let expressionMayContainStrings = mayContainStrings;
10243
+ while (pos < end2) {
10244
+ let ch = text2.charCodeAt(pos);
10245
+ if (isClassContentExit(ch)) {
10246
+ break;
10247
+ }
10248
+ switch (ch) {
10249
+ case 45 /* minus */:
10250
+ pos++;
10251
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10252
+ pos++;
10253
+ if (expressionType !== 3 /* ClassSubtraction */) {
10254
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10255
+ }
10256
+ } else {
10257
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
10258
+ }
10259
+ break;
10260
+ case 38 /* ampersand */:
10261
+ pos++;
10262
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10263
+ pos++;
10264
+ if (expressionType !== 2 /* ClassIntersection */) {
10265
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10266
+ }
10267
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10268
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10269
+ pos++;
10270
+ }
10271
+ } else {
10272
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10273
+ }
10274
+ break;
10275
+ default:
10276
+ switch (expressionType) {
10277
+ case 3 /* ClassSubtraction */:
10278
+ error(Diagnostics._0_expected, pos, 0, "--");
10279
+ break;
10280
+ case 2 /* ClassIntersection */:
10281
+ error(Diagnostics._0_expected, pos, 0, "&&");
10282
+ break;
10283
+ default:
10284
+ break;
10285
+ }
10286
+ break;
10287
+ }
10288
+ ch = text2.charCodeAt(pos);
10289
+ if (isClassContentExit(ch)) {
10290
+ error(Diagnostics.Expected_a_class_set_oprand);
10291
+ break;
10292
+ }
10293
+ scanClassSetOprand();
10294
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
10295
+ }
10296
+ mayContainStrings = expressionMayContainStrings;
10297
+ }
10298
+ function scanClassSetOprand() {
10299
+ mayContainStrings = false;
10300
+ switch (text2.charCodeAt(pos)) {
10301
+ case 91 /* openBracket */:
10302
+ pos++;
10303
+ scanClassSetExpression();
10304
+ scanExpectedChar(93 /* closeBracket */);
10305
+ return "";
10306
+ case 92 /* backslash */:
10307
+ pos++;
10308
+ if (scanCharacterClassEscape()) {
10309
+ return "";
10310
+ } else if (text2.charCodeAt(pos) === 113 /* q */) {
10311
+ pos++;
10312
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10313
+ pos++;
10314
+ scanClassStringDisjunctionContents();
10315
+ scanExpectedChar(125 /* closeBrace */);
10316
+ return "";
10317
+ } else {
10318
+ error(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
10319
+ return "q";
10320
+ }
10321
+ }
10322
+ pos--;
10323
+ default:
10324
+ return scanClassSetCharacter();
10325
+ }
10326
+ }
10327
+ function scanClassStringDisjunctionContents() {
10328
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
10329
+ let characterCount = 0;
10330
+ while (pos < end2) {
10331
+ const ch = text2.charCodeAt(pos);
10332
+ switch (ch) {
10333
+ case 125 /* closeBrace */:
10334
+ if (characterCount !== 1) {
10335
+ mayContainStrings = true;
10336
+ }
10337
+ return;
10338
+ case 124 /* bar */:
10339
+ if (characterCount !== 1) {
10340
+ mayContainStrings = true;
10341
+ }
10342
+ pos++;
10343
+ start = pos;
10344
+ characterCount = 0;
10345
+ break;
10346
+ default:
10347
+ scanClassSetCharacter();
10348
+ characterCount++;
10349
+ break;
10350
+ }
10351
+ }
10352
+ }
10353
+ function scanClassSetCharacter() {
10354
+ const ch = text2.charCodeAt(pos);
10355
+ if (ch === 92 /* backslash */) {
10356
+ pos++;
10357
+ const ch2 = text2.charCodeAt(pos);
10358
+ switch (ch2) {
10359
+ case 98 /* b */:
10360
+ pos++;
10361
+ return "\b";
10362
+ case 38 /* ampersand */:
10363
+ case 45 /* minus */:
10364
+ case 33 /* exclamation */:
10365
+ case 35 /* hash */:
10366
+ case 37 /* percent */:
10367
+ case 44 /* comma */:
10368
+ case 58 /* colon */:
10369
+ case 59 /* semicolon */:
10370
+ case 60 /* lessThan */:
10371
+ case 61 /* equals */:
10372
+ case 62 /* greaterThan */:
10373
+ case 64 /* at */:
10374
+ case 96 /* backtick */:
10375
+ case 126 /* tilde */:
10376
+ pos++;
10377
+ return String.fromCharCode(ch2);
10378
+ default:
10379
+ return scanCharacterEscape();
10380
+ }
10381
+ } else if (ch === text2.charCodeAt(pos + 1)) {
10382
+ switch (ch) {
10383
+ case 38 /* ampersand */:
10384
+ case 33 /* exclamation */:
10385
+ case 35 /* hash */:
10386
+ case 37 /* percent */:
10387
+ case 42 /* asterisk */:
10388
+ case 43 /* plus */:
10389
+ case 44 /* comma */:
10390
+ case 46 /* dot */:
10391
+ case 58 /* colon */:
10392
+ case 59 /* semicolon */:
10393
+ case 60 /* lessThan */:
10394
+ case 61 /* equals */:
10395
+ case 62 /* greaterThan */:
10396
+ case 63 /* question */:
10397
+ case 64 /* at */:
10398
+ case 96 /* backtick */:
10399
+ case 126 /* tilde */:
10400
+ error(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
10401
+ pos += 2;
10402
+ return text2.substring(pos - 2, pos);
10403
+ }
10404
+ }
10405
+ switch (ch) {
10406
+ case 47 /* slash */:
10407
+ case 40 /* openParen */:
10408
+ case 41 /* closeParen */:
10409
+ case 91 /* openBracket */:
10410
+ case 93 /* closeBracket */:
10411
+ case 123 /* openBrace */:
10412
+ case 125 /* closeBrace */:
10413
+ case 45 /* minus */:
10414
+ case 124 /* bar */:
10415
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10416
+ pos++;
10417
+ return String.fromCharCode(ch);
10418
+ }
10419
+ return scanSourceCharacter();
10420
+ }
10421
+ function scanClassAtom() {
10422
+ if (text2.charCodeAt(pos) === 92 /* backslash */) {
10423
+ pos++;
10424
+ const ch = text2.charCodeAt(pos);
10425
+ switch (ch) {
10426
+ case 98 /* b */:
10427
+ pos++;
10428
+ return "\b";
10429
+ case 45 /* minus */:
10430
+ pos++;
10431
+ return String.fromCharCode(ch);
10432
+ default:
10433
+ if (scanCharacterClassEscape()) {
10434
+ return "";
10435
+ }
10436
+ return scanCharacterEscape();
10437
+ }
10438
+ } else {
10439
+ return scanSourceCharacter();
10440
+ }
10441
+ }
10442
+ function scanCharacterClassEscape() {
10443
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10444
+ let isCharacterComplement = false;
10445
+ const start2 = pos - 1;
10446
+ const ch = text2.charCodeAt(pos);
10447
+ switch (ch) {
10448
+ case 100 /* d */:
10449
+ case 68 /* D */:
10450
+ case 115 /* s */:
10451
+ case 83 /* S */:
10452
+ case 119 /* w */:
10453
+ case 87 /* W */:
10454
+ pos++;
10455
+ return true;
10456
+ case 80 /* P */:
10457
+ isCharacterComplement = true;
10458
+ case 112 /* p */:
10459
+ pos++;
10460
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10461
+ pos++;
10462
+ const propertyNameOrValueStart = pos;
10463
+ const propertyNameOrValue = scanWordCharacters();
10464
+ if (text2.charCodeAt(pos) === 61 /* equals */) {
10465
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
10466
+ if (pos === propertyNameOrValueStart) {
10467
+ error(Diagnostics.Expected_a_Unicode_property_name);
10468
+ } else if (propertyName === void 0) {
10469
+ error(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10470
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
10471
+ if (suggestion) {
10472
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10473
+ }
10474
+ }
10475
+ pos++;
10476
+ const propertyValueStart = pos;
10477
+ const propertyValue = scanWordCharacters();
10478
+ if (pos === propertyValueStart) {
10479
+ error(Diagnostics.Expected_a_Unicode_property_value);
10480
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
10481
+ error(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
10482
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
10483
+ if (suggestion) {
10484
+ error(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
10485
+ }
10486
+ }
10487
+ } else {
10488
+ if (pos === propertyNameOrValueStart) {
10489
+ error(Diagnostics.Expected_a_Unicode_property_name_or_value);
10490
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
10491
+ if (!unicodeSetsMode) {
10492
+ error(Diagnostics.Any_Unicode_property_that_would_possibly_match_more_than_a_single_character_is_only_available_when_the_Unicode_Sets_v_flag_is_set, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10493
+ } else if (isCharacterComplement) {
10494
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10495
+ } else {
10496
+ mayContainStrings = true;
10497
+ }
10498
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
10499
+ error(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10500
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
10501
+ if (suggestion) {
10502
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10503
+ }
10504
+ }
10505
+ }
10506
+ scanExpectedChar(125 /* closeBrace */);
10507
+ if (!unicodeMode) {
10508
+ error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
10509
+ }
10510
+ } else if (unicodeMode) {
10511
+ error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
10512
+ }
10513
+ return true;
10514
+ }
10515
+ return false;
10516
+ }
10517
+ function scanWordCharacters() {
10518
+ let value = "";
10519
+ while (pos < end2) {
10520
+ const ch = text2.charCodeAt(pos);
10521
+ if (!isWordCharacter(ch)) {
10522
+ break;
10523
+ }
10524
+ value += String.fromCharCode(ch);
10525
+ pos++;
10526
+ }
10527
+ return value;
10528
+ }
10529
+ function scanSourceCharacter() {
10530
+ const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
10531
+ pos += size;
10532
+ return text2.substring(pos - size, pos);
10533
+ }
10534
+ function scanExpectedChar(ch) {
10535
+ if (text2.charCodeAt(pos) === ch) {
10536
+ pos++;
10537
+ } else {
10538
+ error(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
10539
+ }
10540
+ }
10541
+ scanDisjunction(
10542
+ /*isInGroup*/
10543
+ false
10544
+ );
10545
+ forEach(groupNameReferences, (reference) => {
10546
+ if (!groupSpecifiers.has(reference.name)) {
10547
+ error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
10548
+ }
10549
+ });
10550
+ forEach(decimalEscapes, (escape) => {
10551
+ if (escape.value > numberOfCapturingGroups) {
10552
+ if (numberOfCapturingGroups) {
10553
+ error(Diagnostics.A_decimal_escape_must_refer_to_an_existent_capturing_group_There_are_only_0_capturing_groups_in_this_regular_expression, escape.pos, escape.end - escape.pos, numberOfCapturingGroups);
10554
+ } else {
10555
+ error(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
10556
+ }
10557
+ }
10558
+ });
10559
+ }
9652
10560
  }
9653
10561
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
9654
10562
  const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
@@ -9871,8 +10779,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9871
10779
  pos--;
9872
10780
  const extendedCookedChar = peekExtendedUnicodeEscape();
9873
10781
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9874
- pos += 3;
9875
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9876
10782
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
9877
10783
  return token = getIdentifierToken();
9878
10784
  }
@@ -10013,6 +10919,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
10013
10919
  function utf16EncodeAsString(codePoint) {
10014
10920
  return utf16EncodeAsStringWorker(codePoint);
10015
10921
  }
10922
+ var nonBinaryUnicodeProperties = new Map(Object.entries({
10923
+ General_Category: "General_Category",
10924
+ gc: "General_Category",
10925
+ Script: "Script",
10926
+ sc: "Script",
10927
+ Script_Extensions: "Script_Extensions",
10928
+ scx: "Script_Extensions"
10929
+ }));
10930
+ var binaryUnicodeProperties = /* @__PURE__ */ new Set(["ASCII", "ASCII_Hex_Digit", "AHex", "Alphabetic", "Alpha", "Any", "Assigned", "Bidi_Control", "Bidi_C", "Bidi_Mirrored", "Bidi_M", "Case_Ignorable", "CI", "Cased", "Changes_When_Casefolded", "CWCF", "Changes_When_Casemapped", "CWCM", "Changes_When_Lowercased", "CWL", "Changes_When_NFKC_Casefolded", "CWKCF", "Changes_When_Titlecased", "CWT", "Changes_When_Uppercased", "CWU", "Dash", "Default_Ignorable_Code_Point", "DI", "Deprecated", "Dep", "Diacritic", "Dia", "Emoji", "Emoji_Component", "EComp", "Emoji_Modifier", "EMod", "Emoji_Modifier_Base", "EBase", "Emoji_Presentation", "EPres", "Extended_Pictographic", "ExtPict", "Extender", "Ext", "Grapheme_Base", "Gr_Base", "Grapheme_Extend", "Gr_Ext", "Hex_Digit", "Hex", "IDS_Binary_Operator", "IDSB", "IDS_Trinary_Operator", "IDST", "ID_Continue", "IDC", "ID_Start", "IDS", "Ideographic", "Ideo", "Join_Control", "Join_C", "Logical_Order_Exception", "LOE", "Lowercase", "Lower", "Math", "Noncharacter_Code_Point", "NChar", "Pattern_Syntax", "Pat_Syn", "Pattern_White_Space", "Pat_WS", "Quotation_Mark", "QMark", "Radical", "Regional_Indicator", "RI", "Sentence_Terminal", "STerm", "Soft_Dotted", "SD", "Terminal_Punctuation", "Term", "Unified_Ideograph", "UIdeo", "Uppercase", "Upper", "Variation_Selector", "VS", "White_Space", "space", "XID_Continue", "XIDC", "XID_Start", "XIDS"]);
10931
+ var binaryUnicodePropertiesOfStrings = /* @__PURE__ */ new Set(["Basic_Emoji", "Emoji_Keycap_Sequence", "RGI_Emoji_Modifier_Sequence", "RGI_Emoji_Flag_Sequence", "RGI_Emoji_Tag_Sequence", "RGI_Emoji_ZWJ_Sequence", "RGI_Emoji"]);
10932
+ var valuesOfNonBinaryUnicodeProperties = {
10933
+ General_Category: /* @__PURE__ */ new Set(["C", "Other", "Cc", "Control", "cntrl", "Cf", "Format", "Cn", "Unassigned", "Co", "Private_Use", "Cs", "Surrogate", "L", "Letter", "LC", "Cased_Letter", "Ll", "Lowercase_Letter", "Lm", "Modifier_Letter", "Lo", "Other_Letter", "Lt", "Titlecase_Letter", "Lu", "Uppercase_Letter", "M", "Mark", "Combining_Mark", "Mc", "Spacing_Mark", "Me", "Enclosing_Mark", "Mn", "Nonspacing_Mark", "N", "Number", "Nd", "Decimal_Number", "digit", "Nl", "Letter_Number", "No", "Other_Number", "P", "Punctuation", "punct", "Pc", "Connector_Punctuation", "Pd", "Dash_Punctuation", "Pe", "Close_Punctuation", "Pf", "Final_Punctuation", "Pi", "Initial_Punctuation", "Po", "Other_Punctuation", "Ps", "Open_Punctuation", "S", "Symbol", "Sc", "Currency_Symbol", "Sk", "Modifier_Symbol", "Sm", "Math_Symbol", "So", "Other_Symbol", "Z", "Separator", "Zl", "Line_Separator", "Zp", "Paragraph_Separator", "Zs", "Space_Separator"]),
10934
+ Script: /* @__PURE__ */ new Set(["Adlm", "Adlam", "Aghb", "Caucasian_Albanian", "Ahom", "Ahom", "Arab", "Arabic", "Armi", "Imperial_Aramaic", "Armn", "Armenian", "Avst", "Avestan", "Bali", "Balinese", "Bamu", "Bamum", "Bass", "Bassa_Vah", "Batk", "Batak", "Beng", "Bengali", "Bhks", "Bhaiksuki", "Bopo", "Bopomofo", "Brah", "Brahmi", "Brai", "Braille", "Bugi", "Buginese", "Buhd", "Buhid", "Cakm", "Chakma", "Cans", "Canadian_Aboriginal", "Cari", "Carian", "Cham", "Cham", "Cher", "Cherokee", "Chrs", "Chorasmian", "Copt", "Coptic", "Qaac", "Cpmn", "Cypro_Minoan", "Cprt", "Cypriot", "Cyrl", "Cyrillic", "Deva", "Devanagari", "Diak", "Dives_Akuru", "Dogr", "Dogra", "Dsrt", "Deseret", "Dupl", "Duployan", "Egyp", "Egyptian_Hieroglyphs", "Elba", "Elbasan", "Elym", "Elymaic", "Ethi", "Ethiopic", "Geor", "Georgian", "Glag", "Glagolitic", "Gong", "Gunjala_Gondi", "Gonm", "Masaram_Gondi", "Goth", "Gothic", "Gran", "Grantha", "Grek", "Greek", "Gujr", "Gujarati", "Guru", "Gurmukhi", "Hang", "Hangul", "Hani", "Han", "Hano", "Hanunoo", "Hatr", "Hatran", "Hebr", "Hebrew", "Hira", "Hiragana", "Hluw", "Anatolian_Hieroglyphs", "Hmng", "Pahawh_Hmong", "Hmnp", "Nyiakeng_Puachue_Hmong", "Hrkt", "Katakana_Or_Hiragana", "Hung", "Old_Hungarian", "Ital", "Old_Italic", "Java", "Javanese", "Kali", "Kayah_Li", "Kana", "Katakana", "Kawi", "Kawi", "Khar", "Kharoshthi", "Khmr", "Khmer", "Khoj", "Khojki", "Kits", "Khitan_Small_Script", "Knda", "Kannada", "Kthi", "Kaithi", "Lana", "Tai_Tham", "Laoo", "Lao", "Latn", "Latin", "Lepc", "Lepcha", "Limb", "Limbu", "Lina", "Linear_A", "Linb", "Linear_B", "Lisu", "Lisu", "Lyci", "Lycian", "Lydi", "Lydian", "Mahj", "Mahajani", "Maka", "Makasar", "Mand", "Mandaic", "Mani", "Manichaean", "Marc", "Marchen", "Medf", "Medefaidrin", "Mend", "Mende_Kikakui", "Merc", "Meroitic_Cursive", "Mero", "Meroitic_Hieroglyphs", "Mlym", "Malayalam", "Modi", "Modi", "Mong", "Mongolian", "Mroo", "Mro", "Mtei", "Meetei_Mayek", "Mult", "Multani", "Mymr", "Myanmar", "Nagm", "Nag_Mundari", "Nand", "Nandinagari", "Narb", "Old_North_Arabian", "Nbat", "Nabataean", "Newa", "Newa", "Nkoo", "Nko", "Nshu", "Nushu", "Ogam", "Ogham", "Olck", "Ol_Chiki", "Orkh", "Old_Turkic", "Orya", "Oriya", "Osge", "Osage", "Osma", "Osmanya", "Ougr", "Old_Uyghur", "Palm", "Palmyrene", "Pauc", "Pau_Cin_Hau", "Perm", "Old_Permic", "Phag", "Phags_Pa", "Phli", "Inscriptional_Pahlavi", "Phlp", "Psalter_Pahlavi", "Phnx", "Phoenician", "Plrd", "Miao", "Prti", "Inscriptional_Parthian", "Rjng", "Rejang", "Rohg", "Hanifi_Rohingya", "Runr", "Runic", "Samr", "Samaritan", "Sarb", "Old_South_Arabian", "Saur", "Saurashtra", "Sgnw", "SignWriting", "Shaw", "Shavian", "Shrd", "Sharada", "Sidd", "Siddham", "Sind", "Khudawadi", "Sinh", "Sinhala", "Sogd", "Sogdian", "Sogo", "Old_Sogdian", "Sora", "Sora_Sompeng", "Soyo", "Soyombo", "Sund", "Sundanese", "Sylo", "Syloti_Nagri", "Syrc", "Syriac", "Tagb", "Tagbanwa", "Takr", "Takri", "Tale", "Tai_Le", "Talu", "New_Tai_Lue", "Taml", "Tamil", "Tang", "Tangut", "Tavt", "Tai_Viet", "Telu", "Telugu", "Tfng", "Tifinagh", "Tglg", "Tagalog", "Thaa", "Thaana", "Thai", "Thai", "Tibt", "Tibetan", "Tirh", "Tirhuta", "Tnsa", "Tangsa", "Toto", "Toto", "Ugar", "Ugaritic", "Vaii", "Vai", "Vith", "Vithkuqi", "Wara", "Warang_Citi", "Wcho", "Wancho", "Xpeo", "Old_Persian", "Xsux", "Cuneiform", "Yezi", "Yezidi", "Yiii", "Yi", "Zanb", "Zanabazar_Square", "Zinh", "Inherited", "Qaai", "Zyyy", "Common", "Zzzz", "Unknown"]),
10935
+ Script_Extensions: /* @__PURE__ */ new Set()
10936
+ // Currently empty
10937
+ };
10016
10938
 
10017
10939
  // src/compiler/utilitiesPublic.ts
10018
10940
  function isExternalModuleNameRelative(moduleName) {
@@ -27022,7 +27944,10 @@ var Parser;
27022
27944
  function parseErrorAtPosition(start, length2, message, ...args) {
27023
27945
  const lastError = lastOrUndefined(parseDiagnostics);
27024
27946
  let result;
27025
- if (!lastError || start !== lastError.start) {
27947
+ if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
27948
+ result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
27949
+ addRelatedInfo(lastError, result);
27950
+ } else if (!lastError || start !== lastError.start) {
27026
27951
  result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
27027
27952
  parseDiagnostics.push(result);
27028
27953
  }
@@ -27178,7 +28103,7 @@ var Parser;
27178
28103
  parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
27179
28104
  return;
27180
28105
  }
27181
- const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText);
28106
+ const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
27182
28107
  if (suggestion) {
27183
28108
  parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
27184
28109
  return;
@@ -68111,17 +69036,6 @@ function createTypeChecker(host) {
68111
69036
  isTypeAssignableTo
68112
69037
  );
68113
69038
  }
68114
- function filterContextualTypeForLiteralExpressionOfObject(node, contextualType) {
68115
- if (!isLiteralExpressionOfObject(node)) {
68116
- return contextualType;
68117
- }
68118
- return filterType(contextualType, (t) => {
68119
- if (!t.symbol || !(t.symbol.flags & 32 /* Class */)) {
68120
- return true;
68121
- }
68122
- return every(getPropertiesOfType(t), (p) => !p.valueDeclaration || !isNamedDeclaration(p.valueDeclaration) || !isPrivateIdentifier(p.valueDeclaration.name) && !(getDeclarationModifierFlagsFromSymbol(p) & 6 /* NonPublicAccessibilityModifier */));
68123
- });
68124
- }
68125
69039
  function getApparentTypeOfContextualType(node, contextFlags) {
68126
69040
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
68127
69041
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
@@ -68165,6 +69079,7 @@ function createTypeChecker(host) {
68165
69079
  return type;
68166
69080
  }
68167
69081
  function getContextualType(node, contextFlags) {
69082
+ var _a;
68168
69083
  if (node.flags & 67108864 /* InWithStatement */) {
68169
69084
  return void 0;
68170
69085
  }
@@ -68176,14 +69091,6 @@ function createTypeChecker(host) {
68176
69091
  if (index >= 0) {
68177
69092
  return contextualTypes[index];
68178
69093
  }
68179
- const contextualType = getContextualTypeWorker(node, contextFlags);
68180
- if (!contextualType) {
68181
- return void 0;
68182
- }
68183
- return filterContextualTypeForLiteralExpressionOfObject(node, contextualType);
68184
- }
68185
- function getContextualTypeWorker(node, contextFlags) {
68186
- var _a;
68187
69094
  const { parent } = node;
68188
69095
  switch (parent.kind) {
68189
69096
  case 260 /* VariableDeclaration */:
@@ -74964,11 +75871,10 @@ function createTypeChecker(host) {
74964
75871
  return node;
74965
75872
  }
74966
75873
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
74967
- const filteredContextualType = filterContextualTypeForLiteralExpressionOfObject(node, contextualType);
74968
75874
  const contextNode = getContextNode(node);
74969
75875
  pushContextualType(
74970
75876
  contextNode,
74971
- filteredContextualType,
75877
+ contextualType,
74972
75878
  /*isCache*/
74973
75879
  false
74974
75880
  );
@@ -74978,7 +75884,7 @@ function createTypeChecker(host) {
74978
75884
  inferenceContext.intraExpressionInferenceSites = void 0;
74979
75885
  }
74980
75886
  const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(
74981
- filteredContextualType,
75887
+ contextualType,
74982
75888
  node,
74983
75889
  /*contextFlags*/
74984
75890
  void 0