@typescript-deploys/pr-build 5.3.0-pr-55820-7 → 5.3.0-pr-55600-27

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20230921`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230922`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3782,6 +3782,24 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
3782
3782
  ScriptKind3[ScriptKind3["Deferred"] = 7] = "Deferred";
3783
3783
  return ScriptKind3;
3784
3784
  })(ScriptKind || {});
3785
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget3) => {
3786
+ ScriptTarget3[ScriptTarget3["ES3"] = 0] = "ES3";
3787
+ ScriptTarget3[ScriptTarget3["ES5"] = 1] = "ES5";
3788
+ ScriptTarget3[ScriptTarget3["ES2015"] = 2] = "ES2015";
3789
+ ScriptTarget3[ScriptTarget3["ES2016"] = 3] = "ES2016";
3790
+ ScriptTarget3[ScriptTarget3["ES2017"] = 4] = "ES2017";
3791
+ ScriptTarget3[ScriptTarget3["ES2018"] = 5] = "ES2018";
3792
+ ScriptTarget3[ScriptTarget3["ES2019"] = 6] = "ES2019";
3793
+ ScriptTarget3[ScriptTarget3["ES2020"] = 7] = "ES2020";
3794
+ ScriptTarget3[ScriptTarget3["ES2021"] = 8] = "ES2021";
3795
+ ScriptTarget3[ScriptTarget3["ES2022"] = 9] = "ES2022";
3796
+ ScriptTarget3[ScriptTarget3["ES2023"] = 10] = "ES2023";
3797
+ ScriptTarget3[ScriptTarget3["ES2024"] = 11] = "ES2024";
3798
+ ScriptTarget3[ScriptTarget3["ESNext"] = 99] = "ESNext";
3799
+ ScriptTarget3[ScriptTarget3["JSON"] = 100] = "JSON";
3800
+ ScriptTarget3[ScriptTarget3["Latest"] = 99 /* ESNext */] = "Latest";
3801
+ return ScriptTarget3;
3802
+ })(ScriptTarget || {});
3785
3803
  var TransformFlags = /* @__PURE__ */ ((TransformFlags3) => {
3786
3804
  TransformFlags3[TransformFlags3["None"] = 0] = "None";
3787
3805
  TransformFlags3[TransformFlags3["ContainsTypeScript"] = 1] = "ContainsTypeScript";
@@ -6092,6 +6110,43 @@ var Diagnostics = {
6092
6110
  The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration: diag(1493, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration_1493", "The left-hand side of a 'for...in' statement cannot be a 'using' declaration."),
6093
6111
  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."),
6094
6112
  _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."),
6113
+ _0_is_not_a_valid_character_escape: diag(1496, 1 /* Error */, "_0_is_not_a_valid_character_escape_1496", "'\\{0}' is not a valid character escape."),
6114
+ Unknown_regular_expression_flag: diag(1497, 1 /* Error */, "Unknown_regular_expression_flag_1497", "Unknown regular expression flag."),
6115
+ Duplicate_regular_expression_flag: diag(1498, 1 /* Error */, "Duplicate_regular_expression_flag_1498", "Duplicate regular expression flag."),
6116
+ 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."),
6117
+ 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."),
6118
+ 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."),
6119
+ 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."),
6120
+ Incomplete_quantifier_Digit_expected: diag(1503, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1503", "Incomplete quantifier. Digit expected."),
6121
+ Numbers_out_of_order_in_quantifier: diag(1504, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1504", "Numbers out of order in quantifier."),
6122
+ There_is_nothing_available_for_repetition: diag(1505, 1 /* Error */, "There_is_nothing_available_for_repetition_1505", "There is nothing available for repetition."),
6123
+ 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?"),
6124
+ 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."),
6125
+ 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."),
6126
+ 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."),
6127
+ 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."),
6128
+ Undetermined_character_escape: diag(1511, 1 /* Error */, "Undetermined_character_escape_1511", "Undetermined character escape."),
6129
+ Expected_a_capturing_group_name: diag(1512, 1 /* Error */, "Expected_a_capturing_group_name_1512", "Expected a capturing group name."),
6130
+ 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."),
6131
+ 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."),
6132
+ 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."),
6133
+ 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."),
6134
+ 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."),
6135
+ Expected_a_class_set_oprand: diag(1518, 1 /* Error */, "Expected_a_class_set_oprand_1518", "Expected a class set oprand."),
6136
+ 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."),
6137
+ 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?"),
6138
+ Expected_a_Unicode_property_name: diag(1521, 1 /* Error */, "Expected_a_Unicode_property_name_1521", "Expected a Unicode property name."),
6139
+ Unknown_Unicode_property_name: diag(1522, 1 /* Error */, "Unknown_Unicode_property_name_1522", "Unknown Unicode property name."),
6140
+ Expected_a_Unicode_property_value: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_value_1523", "Expected a Unicode property value."),
6141
+ Unknown_Unicode_property_value: diag(1524, 1 /* Error */, "Unknown_Unicode_property_value_1524", "Unknown Unicode property value."),
6142
+ 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."),
6143
+ 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."),
6144
+ Unknown_Unicode_property_name_or_value: diag(1527, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1527", "Unknown Unicode property name or value."),
6145
+ 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."),
6146
+ _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."),
6147
+ 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."),
6148
+ 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."),
6149
+ 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."),
6095
6150
  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."),
6096
6151
  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."),
6097
6152
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7689,7 +7744,7 @@ var Diagnostics = {
7689
7744
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
7690
7745
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
7691
7746
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
7692
- Can_only_convert_string_concatenations_and_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenations_and_string_literals_95154", "Can only convert string concatenations and string literals"),
7747
+ Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
7693
7748
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
7694
7749
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
7695
7750
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -7925,6 +7980,26 @@ var textToToken = new Map(Object.entries({
7925
7980
  "#": 63 /* HashToken */,
7926
7981
  "`": 62 /* BacktickToken */
7927
7982
  }));
7983
+ var charToRegExpFlag = new Map(Object.entries({
7984
+ d: 1 /* HasIndices */,
7985
+ g: 2 /* Global */,
7986
+ i: 4 /* IgnoreCase */,
7987
+ m: 8 /* Multiline */,
7988
+ s: 16 /* DotAll */,
7989
+ u: 32 /* Unicode */,
7990
+ v: 64 /* UnicodeSets */,
7991
+ y: 128 /* Sticky */
7992
+ }));
7993
+ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
7994
+ [1 /* HasIndices */, 9 /* ES2022 */],
7995
+ [2 /* Global */, 0 /* ES3 */],
7996
+ [4 /* IgnoreCase */, 0 /* ES3 */],
7997
+ [8 /* Multiline */, 0 /* ES3 */],
7998
+ [16 /* DotAll */, 5 /* ES2018 */],
7999
+ [32 /* Unicode */, 2 /* ES2015 */],
8000
+ [64 /* UnicodeSets */, 11 /* ES2024 */],
8001
+ [128 /* Sticky */, 2 /* ES2015 */]
8002
+ ]);
7928
8003
  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];
7929
8004
  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];
7930
8005
  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];
@@ -7975,6 +8050,13 @@ function tokenToString(t) {
7975
8050
  function stringToToken(s) {
7976
8051
  return textToToken.get(s);
7977
8052
  }
8053
+ var regExpFlagChars = makeReverseMap(charToRegExpFlag);
8054
+ function characterToRegularExpressionFlag(c) {
8055
+ return charToRegExpFlag.get(c);
8056
+ }
8057
+ function regularExpressionFlagToFirstAvailableLanguageVersion(f) {
8058
+ return regExpFlagToFirstAvailableLanguageVersion.get(f);
8059
+ }
7978
8060
  function computeLineStarts(text) {
7979
8061
  const result = [];
7980
8062
  let pos = 0;
@@ -8071,8 +8153,11 @@ function isDigit(ch) {
8071
8153
  function isHexDigit(ch) {
8072
8154
  return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
8073
8155
  }
8074
- function isCodePoint(code) {
8075
- return code <= 1114111;
8156
+ function isASCIILetter(ch) {
8157
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
8158
+ }
8159
+ function isWordCharacter(ch) {
8160
+ return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
8076
8161
  }
8077
8162
  function isOctalDigit(ch) {
8078
8163
  return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
@@ -8390,10 +8475,10 @@ function getShebang(text) {
8390
8475
  }
8391
8476
  }
8392
8477
  function isIdentifierStart(ch, languageVersion) {
8393
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8478
+ return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
8394
8479
  }
8395
8480
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
8396
- 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
8481
+ return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
8397
8482
  (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
8398
8483
  }
8399
8484
  function isIdentifierText(name, languageVersion, identifierVariant) {
@@ -8712,7 +8797,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8712
8797
  result += text.substring(start2, pos);
8713
8798
  result += scanEscapeSequence(
8714
8799
  /*shouldEmitInvalidEscapeError*/
8715
- true
8800
+ true,
8801
+ /*isRegularExpression*/
8802
+ false
8716
8803
  );
8717
8804
  start2 = pos;
8718
8805
  continue;
@@ -8756,7 +8843,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8756
8843
  }
8757
8844
  if (currChar === 92 /* backslash */) {
8758
8845
  contents += text.substring(start2, pos);
8759
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
8846
+ contents += scanEscapeSequence(
8847
+ shouldEmitInvalidEscapeError,
8848
+ /*isRegularExpression*/
8849
+ false
8850
+ );
8760
8851
  start2 = pos;
8761
8852
  continue;
8762
8853
  }
@@ -8776,7 +8867,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8776
8867
  tokenValue = contents;
8777
8868
  return resultingToken;
8778
8869
  }
8779
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
8870
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
8780
8871
  const start2 = pos;
8781
8872
  pos++;
8782
8873
  if (pos >= end) {
@@ -8804,7 +8895,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8804
8895
  pos++;
8805
8896
  }
8806
8897
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8807
- if (shouldEmitInvalidEscapeError) {
8898
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8808
8899
  const code = parseInt(text.substring(start2 + 1, pos), 8);
8809
8900
  error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + code.toString(16).padStart(2, "0"));
8810
8901
  return String.fromCharCode(code);
@@ -8813,7 +8904,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8813
8904
  case 56 /* _8 */:
8814
8905
  case 57 /* _9 */:
8815
8906
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8816
- if (shouldEmitInvalidEscapeError) {
8907
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8817
8908
  error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos));
8818
8909
  return String.fromCharCode(ch);
8819
8910
  }
@@ -8835,62 +8926,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8835
8926
  case 34 /* doubleQuote */:
8836
8927
  return '"';
8837
8928
  case 117 /* u */:
8838
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8839
- pos++;
8840
- const escapedValueString = scanMinimumNumberOfHexDigits(
8841
- 1,
8842
- /*canHaveSeparators*/
8843
- false
8844
- );
8845
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8846
- if (escapedValue < 0) {
8847
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8848
- if (shouldEmitInvalidEscapeError) {
8849
- error(Diagnostics.Hexadecimal_digit_expected);
8850
- }
8851
- return text.substring(start2, pos);
8852
- }
8853
- if (!isCodePoint(escapedValue)) {
8854
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8855
- if (shouldEmitInvalidEscapeError) {
8856
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
8857
- }
8858
- return text.substring(start2, pos);
8859
- }
8860
- if (pos >= end) {
8861
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8862
- if (shouldEmitInvalidEscapeError) {
8863
- error(Diagnostics.Unexpected_end_of_text);
8864
- }
8865
- return text.substring(start2, pos);
8866
- }
8867
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
8868
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
8869
- if (shouldEmitInvalidEscapeError) {
8870
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
8871
- }
8872
- return text.substring(start2, pos);
8873
- }
8874
- pos++;
8875
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8876
- return utf16EncodeAsString(escapedValue);
8929
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
8930
+ pos -= 2;
8931
+ return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
8877
8932
  }
8878
8933
  for (; pos < start2 + 6; pos++) {
8879
8934
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8880
8935
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8881
- if (shouldEmitInvalidEscapeError) {
8936
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8882
8937
  error(Diagnostics.Hexadecimal_digit_expected);
8883
8938
  }
8884
8939
  return text.substring(start2, pos);
8885
8940
  }
8886
8941
  }
8887
8942
  tokenFlags |= 1024 /* UnicodeEscape */;
8888
- return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16));
8943
+ const escapedValue = parseInt(text.substring(start2 + 2, pos), 16);
8944
+ const escapedValueString = String.fromCharCode(escapedValue);
8945
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
8946
+ const nextStart = pos;
8947
+ let nextPos = pos + 2;
8948
+ for (; nextPos < nextStart + 6; nextPos++) {
8949
+ if (!isHexDigit(text.charCodeAt(pos))) {
8950
+ return escapedValueString;
8951
+ }
8952
+ }
8953
+ const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
8954
+ if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
8955
+ pos = nextPos;
8956
+ return escapedValueString + String.fromCharCode(nextEscapedValue);
8957
+ }
8958
+ }
8959
+ return escapedValueString;
8889
8960
  case 120 /* x */:
8890
8961
  for (; pos < start2 + 4; pos++) {
8891
8962
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
8892
8963
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
8893
- if (shouldEmitInvalidEscapeError) {
8964
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
8894
8965
  error(Diagnostics.Hexadecimal_digit_expected);
8895
8966
  }
8896
8967
  return text.substring(start2, pos);
@@ -8907,10 +8978,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8907
8978
  case 8233 /* paragraphSeparator */:
8908
8979
  return "";
8909
8980
  default:
8981
+ if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
8982
+ error(Diagnostics._0_is_not_a_valid_character_escape, pos - 2, 2, String.fromCharCode(ch));
8983
+ }
8910
8984
  return String.fromCharCode(ch);
8911
8985
  }
8912
8986
  }
8913
- function scanExtendedUnicodeEscape() {
8987
+ function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError = true) {
8988
+ const start2 = pos;
8989
+ pos += 3;
8990
+ const escapedStart = pos;
8914
8991
  const escapedValueString = scanMinimumNumberOfHexDigits(
8915
8992
  1,
8916
8993
  /*canHaveSeparators*/
@@ -8919,24 +8996,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8919
8996
  const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
8920
8997
  let isInvalidExtendedEscape = false;
8921
8998
  if (escapedValue < 0) {
8922
- error(Diagnostics.Hexadecimal_digit_expected);
8999
+ if (shouldEmitInvalidEscapeError) {
9000
+ error(Diagnostics.Hexadecimal_digit_expected);
9001
+ }
8923
9002
  isInvalidExtendedEscape = true;
8924
9003
  } else if (escapedValue > 1114111) {
8925
- error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
9004
+ if (shouldEmitInvalidEscapeError) {
9005
+ error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
9006
+ }
8926
9007
  isInvalidExtendedEscape = true;
8927
9008
  }
8928
9009
  if (pos >= end) {
8929
- error(Diagnostics.Unexpected_end_of_text);
9010
+ if (shouldEmitInvalidEscapeError) {
9011
+ error(Diagnostics.Unexpected_end_of_text);
9012
+ }
8930
9013
  isInvalidExtendedEscape = true;
8931
9014
  } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
8932
9015
  pos++;
8933
9016
  } else {
8934
- error(Diagnostics.Unterminated_Unicode_escape_sequence);
9017
+ if (shouldEmitInvalidEscapeError) {
9018
+ error(Diagnostics.Unterminated_Unicode_escape_sequence);
9019
+ }
8935
9020
  isInvalidExtendedEscape = true;
8936
9021
  }
8937
9022
  if (isInvalidExtendedEscape) {
8938
- return "";
9023
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
9024
+ return text.substring(start2, pos);
8939
9025
  }
9026
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8940
9027
  return utf16EncodeAsString(escapedValue);
8941
9028
  }
8942
9029
  function peekUnicodeEscape() {
@@ -8978,8 +9065,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8978
9065
  } else if (ch === 92 /* backslash */) {
8979
9066
  ch = peekExtendedUnicodeEscape();
8980
9067
  if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
8981
- pos += 3;
8982
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
8983
9068
  result += scanExtendedUnicodeEscape();
8984
9069
  start2 = pos;
8985
9070
  continue;
@@ -9450,8 +9535,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9450
9535
  case 92 /* backslash */:
9451
9536
  const extendedCookedChar = peekExtendedUnicodeEscape();
9452
9537
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9453
- pos += 3;
9454
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9455
9538
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
9456
9539
  return token = getIdentifierToken();
9457
9540
  }
@@ -9467,7 +9550,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9467
9550
  return token = 0 /* Unknown */;
9468
9551
  case 35 /* hash */:
9469
9552
  if (pos !== 0 && text[pos + 1] === "!") {
9470
- error(Diagnostics.can_only_be_used_at_the_start_of_a_file);
9553
+ error(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
9471
9554
  pos++;
9472
9555
  return token = 0 /* Unknown */;
9473
9556
  }
@@ -9476,8 +9559,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9476
9559
  pos++;
9477
9560
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
9478
9561
  if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
9479
- pos += 3;
9480
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9481
9562
  tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
9482
9563
  return token = 81 /* PrivateIdentifier */;
9483
9564
  }
@@ -9600,14 +9681,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9600
9681
  }
9601
9682
  p++;
9602
9683
  }
9603
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
9684
+ const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
9685
+ const endOfBody = p - (isUnterminated ? 0 : 1);
9686
+ let regExpFlags = 0 /* None */;
9687
+ while (p < end) {
9688
+ const ch = text.charCodeAt(p);
9689
+ if (!isIdentifierPart(ch, languageVersion)) {
9690
+ break;
9691
+ }
9692
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9693
+ if (flag === void 0) {
9694
+ error(Diagnostics.Unknown_regular_expression_flag, p, 1);
9695
+ } else if (regExpFlags & flag) {
9696
+ error(Diagnostics.Duplicate_regular_expression_flag, p, 1);
9697
+ } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
9698
+ error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
9699
+ } else {
9700
+ regExpFlags |= flag;
9701
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
9702
+ if (languageVersion < availableFrom) {
9703
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, ScriptTarget[availableFrom]);
9704
+ }
9705
+ }
9604
9706
  p++;
9605
9707
  }
9606
- pos = p;
9708
+ pos = tokenStart + 1;
9709
+ const saveTokenPos = tokenStart;
9710
+ const saveTokenFlags = tokenFlags;
9711
+ scanRegularExpressionWorker(text.slice(0, endOfBody), endOfBody, regExpFlags, isUnterminated);
9712
+ if (!isUnterminated) {
9713
+ pos = p;
9714
+ }
9715
+ tokenStart = saveTokenPos;
9716
+ tokenFlags = saveTokenFlags;
9607
9717
  tokenValue = text.substring(tokenStart, pos);
9608
9718
  token = 14 /* RegularExpressionLiteral */;
9609
9719
  }
9610
9720
  return token;
9721
+ function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
9722
+ const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
9723
+ const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
9724
+ let mayContainStrings = false;
9725
+ let numberOfCapturingGroups = 0;
9726
+ const groupSpecifiers = /* @__PURE__ */ new Set();
9727
+ const groupNameReferences = [];
9728
+ const decimalEscapes = [];
9729
+ const namedCapturingGroups = [];
9730
+ function scanDisjunction(isInGroup) {
9731
+ while (true) {
9732
+ namedCapturingGroups.push(/* @__PURE__ */ new Set());
9733
+ scanAlternative(isInGroup);
9734
+ namedCapturingGroups.pop();
9735
+ if (text2.charCodeAt(pos) !== 124 /* bar */) {
9736
+ return;
9737
+ }
9738
+ pos++;
9739
+ }
9740
+ }
9741
+ function scanAlternative(isInGroup) {
9742
+ let isPreviousTermQuantifiable = false;
9743
+ while (pos < end2) {
9744
+ const start2 = pos;
9745
+ const ch = text2.charCodeAt(pos);
9746
+ switch (ch) {
9747
+ case 94 /* caret */:
9748
+ case 36 /* $ */:
9749
+ pos++;
9750
+ isPreviousTermQuantifiable = false;
9751
+ break;
9752
+ case 92 /* backslash */:
9753
+ pos++;
9754
+ switch (text2.charCodeAt(pos)) {
9755
+ case 98 /* b */:
9756
+ case 66 /* B */:
9757
+ pos++;
9758
+ isPreviousTermQuantifiable = false;
9759
+ break;
9760
+ default:
9761
+ scanAtomEscape();
9762
+ isPreviousTermQuantifiable = true;
9763
+ break;
9764
+ }
9765
+ break;
9766
+ case 40 /* openParen */:
9767
+ pos++;
9768
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9769
+ pos++;
9770
+ switch (text2.charCodeAt(pos)) {
9771
+ case 61 /* equals */:
9772
+ case 33 /* exclamation */:
9773
+ pos++;
9774
+ isPreviousTermQuantifiable = false;
9775
+ break;
9776
+ case 60 /* lessThan */:
9777
+ const groupNameStart = pos;
9778
+ pos++;
9779
+ switch (text2.charCodeAt(pos)) {
9780
+ case 61 /* equals */:
9781
+ case 33 /* exclamation */:
9782
+ pos++;
9783
+ isPreviousTermQuantifiable = false;
9784
+ break;
9785
+ default:
9786
+ scanGroupName(
9787
+ /*isReference*/
9788
+ false
9789
+ );
9790
+ scanExpectedChar(62 /* greaterThan */);
9791
+ if (languageVersion < 5 /* ES2018 */) {
9792
+ error(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
9793
+ }
9794
+ numberOfCapturingGroups++;
9795
+ isPreviousTermQuantifiable = true;
9796
+ break;
9797
+ }
9798
+ break;
9799
+ default:
9800
+ const start3 = pos;
9801
+ const setFlags = scanPatternModifiers();
9802
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
9803
+ pos++;
9804
+ scanPatternModifiers(setFlags);
9805
+ if (pos === start3 + 1) {
9806
+ error(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start3, pos - start3);
9807
+ }
9808
+ }
9809
+ scanExpectedChar(58 /* colon */);
9810
+ isPreviousTermQuantifiable = true;
9811
+ break;
9812
+ }
9813
+ } else {
9814
+ numberOfCapturingGroups++;
9815
+ isPreviousTermQuantifiable = true;
9816
+ }
9817
+ scanDisjunction(
9818
+ /*isInGroup*/
9819
+ true
9820
+ );
9821
+ scanExpectedChar(41 /* closeParen */);
9822
+ break;
9823
+ case 123 /* openBrace */:
9824
+ pos++;
9825
+ const digitsStart = pos;
9826
+ scanDigits();
9827
+ const min2 = tokenValue;
9828
+ if (text2.charCodeAt(pos) === 44 /* comma */) {
9829
+ pos++;
9830
+ scanDigits();
9831
+ const max = tokenValue;
9832
+ if (!min2) {
9833
+ if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
9834
+ error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
9835
+ } else {
9836
+ if (unicodeMode) {
9837
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9838
+ }
9839
+ isPreviousTermQuantifiable = true;
9840
+ break;
9841
+ }
9842
+ }
9843
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
9844
+ error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
9845
+ }
9846
+ } else if (!min2) {
9847
+ if (unicodeMode) {
9848
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
9849
+ }
9850
+ isPreviousTermQuantifiable = true;
9851
+ break;
9852
+ }
9853
+ scanExpectedChar(125 /* closeBrace */);
9854
+ pos--;
9855
+ case 42 /* asterisk */:
9856
+ case 43 /* plus */:
9857
+ case 63 /* question */:
9858
+ pos++;
9859
+ if (text2.charCodeAt(pos) === 63 /* question */) {
9860
+ pos++;
9861
+ }
9862
+ if (!isPreviousTermQuantifiable) {
9863
+ error(Diagnostics.There_is_nothing_available_for_repetition, start2, pos - start2);
9864
+ }
9865
+ isPreviousTermQuantifiable = false;
9866
+ break;
9867
+ case 46 /* dot */:
9868
+ pos++;
9869
+ isPreviousTermQuantifiable = true;
9870
+ break;
9871
+ case 91 /* openBracket */:
9872
+ pos++;
9873
+ if (unicodeSetsMode) {
9874
+ scanClassSetExpression();
9875
+ } else {
9876
+ scanClassRanges();
9877
+ }
9878
+ scanExpectedChar(93 /* closeBracket */);
9879
+ isPreviousTermQuantifiable = true;
9880
+ break;
9881
+ case 41 /* closeParen */:
9882
+ if (isInGroup) {
9883
+ return;
9884
+ }
9885
+ case 93 /* closeBracket */:
9886
+ case 125 /* closeBrace */:
9887
+ if (isUnterminated && !isInGroup) {
9888
+ return;
9889
+ }
9890
+ if (unicodeMode) {
9891
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
9892
+ }
9893
+ pos++;
9894
+ isPreviousTermQuantifiable = true;
9895
+ break;
9896
+ case 47 /* slash */:
9897
+ case 124 /* bar */:
9898
+ return;
9899
+ default:
9900
+ scanSourceCharacter();
9901
+ isPreviousTermQuantifiable = true;
9902
+ break;
9903
+ }
9904
+ }
9905
+ }
9906
+ function scanPatternModifiers(currFlags = 0 /* None */) {
9907
+ while (pos < end2) {
9908
+ const ch = text2.charCodeAt(pos);
9909
+ if (!isIdentifierPart(ch, languageVersion)) {
9910
+ break;
9911
+ }
9912
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
9913
+ if (flag === void 0) {
9914
+ error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
9915
+ } else if (currFlags & flag) {
9916
+ error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
9917
+ } else if (!(flag & 28 /* Modifiers */)) {
9918
+ error(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
9919
+ } else {
9920
+ currFlags |= flag;
9921
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
9922
+ if (languageVersion < availableFrom) {
9923
+ error(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, ScriptTarget[availableFrom]);
9924
+ }
9925
+ }
9926
+ pos++;
9927
+ }
9928
+ return currFlags;
9929
+ }
9930
+ function scanAtomEscape() {
9931
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
9932
+ switch (text2.charCodeAt(pos)) {
9933
+ case 107 /* k */:
9934
+ pos++;
9935
+ if (text2.charCodeAt(pos) === 60 /* lessThan */) {
9936
+ pos++;
9937
+ scanGroupName(
9938
+ /*isReference*/
9939
+ true
9940
+ );
9941
+ scanExpectedChar(62 /* greaterThan */);
9942
+ } else if (unicodeMode) {
9943
+ error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
9944
+ }
9945
+ break;
9946
+ case 113 /* q */:
9947
+ if (unicodeSetsMode) {
9948
+ pos++;
9949
+ error(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
9950
+ break;
9951
+ }
9952
+ default:
9953
+ scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape();
9954
+ break;
9955
+ }
9956
+ }
9957
+ function scanDecimalEscape() {
9958
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
9959
+ const ch = text2.charCodeAt(pos);
9960
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
9961
+ const start2 = pos;
9962
+ scanDigits();
9963
+ decimalEscapes.push({ pos: start2, end: pos, value: +tokenValue });
9964
+ return true;
9965
+ }
9966
+ return false;
9967
+ }
9968
+ function scanCharacterEscape() {
9969
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
9970
+ let ch = text2.charCodeAt(pos);
9971
+ switch (ch) {
9972
+ case 99 /* c */:
9973
+ pos++;
9974
+ ch = text2.charCodeAt(pos);
9975
+ if (isASCIILetter(ch)) {
9976
+ pos++;
9977
+ return String.fromCharCode(ch & 31);
9978
+ }
9979
+ if (unicodeMode) {
9980
+ error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
9981
+ }
9982
+ return String.fromCharCode(ch);
9983
+ case 94 /* caret */:
9984
+ case 36 /* $ */:
9985
+ case 47 /* slash */:
9986
+ case 92 /* backslash */:
9987
+ case 46 /* dot */:
9988
+ case 42 /* asterisk */:
9989
+ case 43 /* plus */:
9990
+ case 63 /* question */:
9991
+ case 40 /* openParen */:
9992
+ case 41 /* closeParen */:
9993
+ case 91 /* openBracket */:
9994
+ case 93 /* closeBracket */:
9995
+ case 123 /* openBrace */:
9996
+ case 125 /* closeBrace */:
9997
+ case 124 /* bar */:
9998
+ pos++;
9999
+ return String.fromCharCode(ch);
10000
+ default:
10001
+ if (pos >= end2) {
10002
+ error(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
10003
+ return "\\";
10004
+ }
10005
+ pos--;
10006
+ return scanEscapeSequence(
10007
+ /*shouldEmitInvalidEscapeError*/
10008
+ unicodeMode,
10009
+ /*isRegularExpression*/
10010
+ true
10011
+ );
10012
+ }
10013
+ }
10014
+ function scanGroupName(isReference) {
10015
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
10016
+ tokenStart = pos;
10017
+ scanIdentifier(codePointAt(text2, pos), languageVersion);
10018
+ if (pos === tokenStart) {
10019
+ error(Diagnostics.Expected_a_capturing_group_name);
10020
+ } else if (isReference) {
10021
+ groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
10022
+ } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
10023
+ error(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
10024
+ } else {
10025
+ last(namedCapturingGroups).add(tokenValue);
10026
+ groupSpecifiers.add(tokenValue);
10027
+ }
10028
+ }
10029
+ function isClassContentExit(ch) {
10030
+ return ch === 93 /* closeBracket */ || pos >= end2;
10031
+ }
10032
+ function scanClassRanges() {
10033
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10034
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10035
+ pos++;
10036
+ }
10037
+ while (pos < end2) {
10038
+ const ch = text2.charCodeAt(pos);
10039
+ if (isClassContentExit(ch)) {
10040
+ return;
10041
+ }
10042
+ const minStart = pos;
10043
+ const minCharacter = scanClassAtom();
10044
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10045
+ pos++;
10046
+ const ch2 = text2.charCodeAt(pos);
10047
+ if (isClassContentExit(ch2)) {
10048
+ return;
10049
+ }
10050
+ if (!minCharacter) {
10051
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
10052
+ }
10053
+ const maxStart = pos;
10054
+ const maxCharacter = scanClassAtom();
10055
+ if (!maxCharacter) {
10056
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
10057
+ continue;
10058
+ }
10059
+ if (!minCharacter) {
10060
+ continue;
10061
+ }
10062
+ const minCharacterValue = codePointAt(minCharacter, 0);
10063
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
10064
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10065
+ error(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
10066
+ }
10067
+ }
10068
+ }
10069
+ }
10070
+ function scanClassSetExpression() {
10071
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
10072
+ let isCharacterComplement = false;
10073
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
10074
+ pos++;
10075
+ isCharacterComplement = true;
10076
+ }
10077
+ let expressionMayContainStrings = false;
10078
+ let ch = text2.charCodeAt(pos);
10079
+ if (isClassContentExit(ch)) {
10080
+ return;
10081
+ }
10082
+ let start2 = pos;
10083
+ let oprand;
10084
+ switch (text2.slice(pos, pos + 2)) {
10085
+ case "--":
10086
+ case "&&":
10087
+ error(Diagnostics.Expected_a_class_set_oprand);
10088
+ mayContainStrings = false;
10089
+ break;
10090
+ default:
10091
+ oprand = scanClassSetOprand();
10092
+ break;
10093
+ }
10094
+ switch (text2.charCodeAt(pos)) {
10095
+ case 45 /* minus */:
10096
+ if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
10097
+ if (isCharacterComplement && mayContainStrings) {
10098
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10099
+ }
10100
+ expressionMayContainStrings = mayContainStrings;
10101
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
10102
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10103
+ return;
10104
+ }
10105
+ break;
10106
+ case 38 /* ampersand */:
10107
+ if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
10108
+ scanClassSetSubExpression(2 /* ClassIntersection */);
10109
+ if (isCharacterComplement && mayContainStrings) {
10110
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10111
+ }
10112
+ expressionMayContainStrings = mayContainStrings;
10113
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10114
+ return;
10115
+ } else {
10116
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10117
+ }
10118
+ break;
10119
+ default:
10120
+ if (isCharacterComplement && mayContainStrings) {
10121
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start2, pos - start2);
10122
+ }
10123
+ expressionMayContainStrings = mayContainStrings;
10124
+ break;
10125
+ }
10126
+ while (pos < end2) {
10127
+ ch = text2.charCodeAt(pos);
10128
+ switch (ch) {
10129
+ case 45 /* minus */:
10130
+ pos++;
10131
+ ch = text2.charCodeAt(pos);
10132
+ if (isClassContentExit(ch)) {
10133
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10134
+ return;
10135
+ }
10136
+ if (ch === 45 /* minus */) {
10137
+ pos++;
10138
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10139
+ start2 = pos - 2;
10140
+ oprand = text2.slice(start2, pos);
10141
+ continue;
10142
+ } else {
10143
+ if (!oprand) {
10144
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start2, pos - 1 - start2);
10145
+ }
10146
+ const secondStart = pos;
10147
+ const secondOprand = scanClassSetOprand();
10148
+ if (isCharacterComplement && mayContainStrings) {
10149
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
10150
+ }
10151
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
10152
+ if (!secondOprand) {
10153
+ error(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
10154
+ break;
10155
+ }
10156
+ if (!oprand) {
10157
+ break;
10158
+ }
10159
+ const minCharacterValue = codePointAt(oprand, 0);
10160
+ const maxCharacterValue = codePointAt(secondOprand, 0);
10161
+ if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
10162
+ error(Diagnostics.Range_out_of_order_in_character_class, start2, pos - start2);
10163
+ }
10164
+ }
10165
+ break;
10166
+ case 38 /* ampersand */:
10167
+ start2 = pos;
10168
+ pos++;
10169
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10170
+ pos++;
10171
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10172
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10173
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10174
+ pos++;
10175
+ }
10176
+ } else {
10177
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10178
+ }
10179
+ oprand = text2.slice(start2, pos);
10180
+ continue;
10181
+ }
10182
+ if (isClassContentExit(text2.charCodeAt(pos))) {
10183
+ break;
10184
+ }
10185
+ start2 = pos;
10186
+ switch (text2.slice(pos, pos + 2)) {
10187
+ case "--":
10188
+ case "&&":
10189
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
10190
+ pos += 2;
10191
+ oprand = text2.slice(start2, pos);
10192
+ break;
10193
+ default:
10194
+ oprand = scanClassSetOprand();
10195
+ break;
10196
+ }
10197
+ }
10198
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
10199
+ }
10200
+ function scanClassSetSubExpression(expressionType) {
10201
+ let expressionMayContainStrings = mayContainStrings;
10202
+ while (pos < end2) {
10203
+ let ch = text2.charCodeAt(pos);
10204
+ if (isClassContentExit(ch)) {
10205
+ break;
10206
+ }
10207
+ switch (ch) {
10208
+ case 45 /* minus */:
10209
+ pos++;
10210
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
10211
+ pos++;
10212
+ if (expressionType !== 3 /* ClassSubtraction */) {
10213
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10214
+ }
10215
+ } else {
10216
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
10217
+ }
10218
+ break;
10219
+ case 38 /* ampersand */:
10220
+ pos++;
10221
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10222
+ pos++;
10223
+ if (expressionType !== 2 /* ClassIntersection */) {
10224
+ error(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
10225
+ }
10226
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
10227
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10228
+ pos++;
10229
+ }
10230
+ } else {
10231
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
10232
+ }
10233
+ break;
10234
+ default:
10235
+ switch (expressionType) {
10236
+ case 3 /* ClassSubtraction */:
10237
+ error(Diagnostics._0_expected, pos, 0, "--");
10238
+ break;
10239
+ case 2 /* ClassIntersection */:
10240
+ error(Diagnostics._0_expected, pos, 0, "&&");
10241
+ break;
10242
+ default:
10243
+ break;
10244
+ }
10245
+ break;
10246
+ }
10247
+ ch = text2.charCodeAt(pos);
10248
+ if (isClassContentExit(ch)) {
10249
+ error(Diagnostics.Expected_a_class_set_oprand);
10250
+ break;
10251
+ }
10252
+ scanClassSetOprand();
10253
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
10254
+ }
10255
+ mayContainStrings = expressionMayContainStrings;
10256
+ }
10257
+ function scanClassSetOprand() {
10258
+ mayContainStrings = false;
10259
+ switch (text2.charCodeAt(pos)) {
10260
+ case 91 /* openBracket */:
10261
+ pos++;
10262
+ scanClassSetExpression();
10263
+ scanExpectedChar(93 /* closeBracket */);
10264
+ return "";
10265
+ case 92 /* backslash */:
10266
+ pos++;
10267
+ if (scanCharacterClassEscape()) {
10268
+ return "";
10269
+ } else if (text2.charCodeAt(pos) === 113 /* q */) {
10270
+ pos++;
10271
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10272
+ pos++;
10273
+ scanClassStringDisjunctionContents();
10274
+ scanExpectedChar(125 /* closeBrace */);
10275
+ return "";
10276
+ } else {
10277
+ error(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
10278
+ return "q";
10279
+ }
10280
+ }
10281
+ pos--;
10282
+ default:
10283
+ return scanClassSetCharacter();
10284
+ }
10285
+ }
10286
+ function scanClassStringDisjunctionContents() {
10287
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
10288
+ let characterCount = 0;
10289
+ while (pos < end2) {
10290
+ const ch = text2.charCodeAt(pos);
10291
+ switch (ch) {
10292
+ case 125 /* closeBrace */:
10293
+ if (characterCount !== 1) {
10294
+ mayContainStrings = true;
10295
+ }
10296
+ return;
10297
+ case 124 /* bar */:
10298
+ if (characterCount !== 1) {
10299
+ mayContainStrings = true;
10300
+ }
10301
+ pos++;
10302
+ start = pos;
10303
+ characterCount = 0;
10304
+ break;
10305
+ default:
10306
+ scanClassSetCharacter();
10307
+ characterCount++;
10308
+ break;
10309
+ }
10310
+ }
10311
+ }
10312
+ function scanClassSetCharacter() {
10313
+ const ch = text2.charCodeAt(pos);
10314
+ if (ch === 92 /* backslash */) {
10315
+ pos++;
10316
+ const ch2 = text2.charCodeAt(pos);
10317
+ switch (ch2) {
10318
+ case 98 /* b */:
10319
+ pos++;
10320
+ return "\b";
10321
+ case 38 /* ampersand */:
10322
+ case 45 /* minus */:
10323
+ case 33 /* exclamation */:
10324
+ case 35 /* hash */:
10325
+ case 37 /* percent */:
10326
+ case 44 /* comma */:
10327
+ case 58 /* colon */:
10328
+ case 59 /* semicolon */:
10329
+ case 60 /* lessThan */:
10330
+ case 61 /* equals */:
10331
+ case 62 /* greaterThan */:
10332
+ case 64 /* at */:
10333
+ case 96 /* backtick */:
10334
+ case 126 /* tilde */:
10335
+ pos++;
10336
+ return String.fromCharCode(ch2);
10337
+ default:
10338
+ return scanCharacterEscape();
10339
+ }
10340
+ } else if (ch === text2.charCodeAt(pos + 1)) {
10341
+ switch (ch) {
10342
+ case 38 /* ampersand */:
10343
+ case 33 /* exclamation */:
10344
+ case 35 /* hash */:
10345
+ case 37 /* percent */:
10346
+ case 42 /* asterisk */:
10347
+ case 43 /* plus */:
10348
+ case 44 /* comma */:
10349
+ case 46 /* dot */:
10350
+ case 58 /* colon */:
10351
+ case 59 /* semicolon */:
10352
+ case 60 /* lessThan */:
10353
+ case 61 /* equals */:
10354
+ case 62 /* greaterThan */:
10355
+ case 63 /* question */:
10356
+ case 64 /* at */:
10357
+ case 96 /* backtick */:
10358
+ case 126 /* tilde */:
10359
+ error(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
10360
+ pos += 2;
10361
+ return text2.substring(pos - 2, pos);
10362
+ }
10363
+ }
10364
+ switch (ch) {
10365
+ case 47 /* slash */:
10366
+ case 40 /* openParen */:
10367
+ case 41 /* closeParen */:
10368
+ case 91 /* openBracket */:
10369
+ case 93 /* closeBracket */:
10370
+ case 123 /* openBrace */:
10371
+ case 125 /* closeBrace */:
10372
+ case 45 /* minus */:
10373
+ case 124 /* bar */:
10374
+ error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
10375
+ pos++;
10376
+ return String.fromCharCode(ch);
10377
+ }
10378
+ return scanSourceCharacter();
10379
+ }
10380
+ function scanClassAtom() {
10381
+ if (text2.charCodeAt(pos) === 92 /* backslash */) {
10382
+ pos++;
10383
+ const ch = text2.charCodeAt(pos);
10384
+ switch (ch) {
10385
+ case 98 /* b */:
10386
+ pos++;
10387
+ return "\b";
10388
+ case 45 /* minus */:
10389
+ pos++;
10390
+ return String.fromCharCode(ch);
10391
+ default:
10392
+ if (scanCharacterClassEscape()) {
10393
+ return "";
10394
+ }
10395
+ return scanCharacterEscape();
10396
+ }
10397
+ } else {
10398
+ return scanSourceCharacter();
10399
+ }
10400
+ }
10401
+ function scanCharacterClassEscape() {
10402
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
10403
+ let isCharacterComplement = false;
10404
+ const start2 = pos - 1;
10405
+ const ch = text2.charCodeAt(pos);
10406
+ switch (ch) {
10407
+ case 100 /* d */:
10408
+ case 68 /* D */:
10409
+ case 115 /* s */:
10410
+ case 83 /* S */:
10411
+ case 119 /* w */:
10412
+ case 87 /* W */:
10413
+ pos++;
10414
+ return true;
10415
+ case 80 /* P */:
10416
+ isCharacterComplement = true;
10417
+ case 112 /* p */:
10418
+ pos++;
10419
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
10420
+ pos++;
10421
+ const propertyNameOrValueStart = pos;
10422
+ const propertyNameOrValue = scanWordCharacters();
10423
+ if (text2.charCodeAt(pos) === 61 /* equals */) {
10424
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
10425
+ if (pos === propertyNameOrValueStart) {
10426
+ error(Diagnostics.Expected_a_Unicode_property_name);
10427
+ } else if (propertyName === void 0) {
10428
+ error(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10429
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
10430
+ if (suggestion) {
10431
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10432
+ }
10433
+ }
10434
+ pos++;
10435
+ const propertyValueStart = pos;
10436
+ const propertyValue = scanWordCharacters();
10437
+ if (pos === propertyValueStart) {
10438
+ error(Diagnostics.Expected_a_Unicode_property_value);
10439
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
10440
+ error(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
10441
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
10442
+ if (suggestion) {
10443
+ error(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
10444
+ }
10445
+ }
10446
+ } else {
10447
+ if (pos === propertyNameOrValueStart) {
10448
+ error(Diagnostics.Expected_a_Unicode_property_name_or_value);
10449
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
10450
+ if (!unicodeSetsMode) {
10451
+ 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);
10452
+ } else if (isCharacterComplement) {
10453
+ error(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10454
+ } else {
10455
+ mayContainStrings = true;
10456
+ }
10457
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
10458
+ error(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
10459
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
10460
+ if (suggestion) {
10461
+ error(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
10462
+ }
10463
+ }
10464
+ }
10465
+ scanExpectedChar(125 /* closeBrace */);
10466
+ if (!unicodeMode) {
10467
+ 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);
10468
+ }
10469
+ } else if (unicodeMode) {
10470
+ error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
10471
+ }
10472
+ return true;
10473
+ }
10474
+ return false;
10475
+ }
10476
+ function scanWordCharacters() {
10477
+ let value = "";
10478
+ while (pos < end2) {
10479
+ const ch = text2.charCodeAt(pos);
10480
+ if (!isWordCharacter(ch)) {
10481
+ break;
10482
+ }
10483
+ value += String.fromCharCode(ch);
10484
+ pos++;
10485
+ }
10486
+ return value;
10487
+ }
10488
+ function scanSourceCharacter() {
10489
+ const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
10490
+ pos += size;
10491
+ return text2.substring(pos - size, pos);
10492
+ }
10493
+ function scanExpectedChar(ch) {
10494
+ if (text2.charCodeAt(pos) === ch) {
10495
+ pos++;
10496
+ } else {
10497
+ error(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
10498
+ }
10499
+ }
10500
+ scanDisjunction(
10501
+ /*isInGroup*/
10502
+ false
10503
+ );
10504
+ forEach(groupNameReferences, (reference) => {
10505
+ if (!groupSpecifiers.has(reference.name)) {
10506
+ error(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
10507
+ }
10508
+ });
10509
+ forEach(decimalEscapes, (escape) => {
10510
+ if (escape.value > numberOfCapturingGroups) {
10511
+ if (numberOfCapturingGroups) {
10512
+ 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);
10513
+ } else {
10514
+ error(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
10515
+ }
10516
+ }
10517
+ });
10518
+ }
9611
10519
  }
9612
10520
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
9613
10521
  const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
@@ -9830,8 +10738,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9830
10738
  pos--;
9831
10739
  const extendedCookedChar = peekExtendedUnicodeEscape();
9832
10740
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9833
- pos += 3;
9834
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
9835
10741
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
9836
10742
  return token = getIdentifierToken();
9837
10743
  }
@@ -9969,6 +10875,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
9969
10875
  function utf16EncodeAsString(codePoint) {
9970
10876
  return utf16EncodeAsStringWorker(codePoint);
9971
10877
  }
10878
+ var nonBinaryUnicodeProperties = new Map(Object.entries({
10879
+ General_Category: "General_Category",
10880
+ gc: "General_Category",
10881
+ Script: "Script",
10882
+ sc: "Script",
10883
+ Script_Extensions: "Script_Extensions",
10884
+ scx: "Script_Extensions"
10885
+ }));
10886
+ 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"]);
10887
+ 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"]);
10888
+ var valuesOfNonBinaryUnicodeProperties = {
10889
+ 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"]),
10890
+ 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"]),
10891
+ Script_Extensions: /* @__PURE__ */ new Set()
10892
+ // Currently empty
10893
+ };
9972
10894
 
9973
10895
  // src/compiler/utilitiesPublic.ts
9974
10896
  function isExternalModuleNameRelative(moduleName) {
@@ -26894,7 +27816,10 @@ var Parser;
26894
27816
  function parseErrorAtPosition(start, length2, message, ...args) {
26895
27817
  const lastError = lastOrUndefined(parseDiagnostics);
26896
27818
  let result;
26897
- if (!lastError || start !== lastError.start) {
27819
+ if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
27820
+ result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
27821
+ addRelatedInfo(lastError, result);
27822
+ } else if (!lastError || start !== lastError.start) {
26898
27823
  result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
26899
27824
  parseDiagnostics.push(result);
26900
27825
  }
@@ -27050,7 +27975,7 @@ var Parser;
27050
27975
  parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
27051
27976
  return;
27052
27977
  }
27053
- const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText);
27978
+ const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
27054
27979
  if (suggestion) {
27055
27980
  parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
27056
27981
  return;
@@ -47749,7 +48674,7 @@ function createTypeChecker(host) {
47749
48674
  }
47750
48675
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
47751
48676
  }
47752
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
48677
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
47753
48678
  const name2 = typeParameterToName(type, context);
47754
48679
  context.approximateLength += idText(name2).length;
47755
48680
  return factory.createTypeReferenceNode(
@@ -48515,65 +49440,36 @@ function createTypeChecker(host) {
48515
49440
  true
48516
49441
  )[0];
48517
49442
  let cleanup;
48518
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
48519
- let pushFakeScope2 = function(kind2, addAll) {
48520
- Debug.assert(context.enclosingDeclaration);
48521
- let existingFakeScope;
48522
- if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
48523
- existingFakeScope = context.enclosingDeclaration;
48524
- } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
48525
- existingFakeScope = context.enclosingDeclaration.parent;
48526
- }
48527
- Debug.assertOptionalNode(existingFakeScope, isBlock);
48528
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
48529
- let newLocals;
48530
- addAll((name, symbol) => {
48531
- if (!locals.has(name)) {
48532
- newLocals = append(newLocals, name);
48533
- locals.set(name, symbol);
48534
- }
48535
- });
48536
- if (!newLocals)
48537
- return;
48538
- const oldCleanup = cleanup;
48539
- function undo() {
49443
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
49444
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
49445
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
49446
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
49447
+ let newLocals;
49448
+ for (const param of expandedParams) {
49449
+ if (!locals.has(param.escapedName)) {
49450
+ newLocals = append(newLocals, param.escapedName);
49451
+ locals.set(param.escapedName, param);
49452
+ }
49453
+ }
49454
+ if (newLocals) {
49455
+ let removeNewLocals2 = function() {
48540
49456
  forEach(newLocals, (s) => locals.delete(s));
48541
- oldCleanup == null ? void 0 : oldCleanup();
48542
- }
49457
+ };
49458
+ var removeNewLocals = removeNewLocals2;
48543
49459
  if (existingFakeScope) {
48544
- cleanup = undo;
49460
+ cleanup = removeNewLocals2;
48545
49461
  } else {
48546
49462
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
48547
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
49463
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
48548
49464
  fakeScope.locals = locals;
48549
49465
  const saveEnclosingDeclaration = context.enclosingDeclaration;
48550
49466
  setParent(fakeScope, saveEnclosingDeclaration);
48551
49467
  context.enclosingDeclaration = fakeScope;
48552
49468
  cleanup = () => {
48553
49469
  context.enclosingDeclaration = saveEnclosingDeclaration;
48554
- undo();
49470
+ removeNewLocals2();
48555
49471
  };
48556
49472
  }
48557
- };
48558
- var pushFakeScope = pushFakeScope2;
48559
- pushFakeScope2(
48560
- "params",
48561
- (add) => {
48562
- for (const param of expandedParams) {
48563
- add(param.escapedName, param);
48564
- }
48565
- }
48566
- );
48567
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
48568
- pushFakeScope2(
48569
- "typeParams",
48570
- (add) => {
48571
- for (const typeParam of signature.typeParameters ?? emptyArray) {
48572
- const typeParamName = typeParameterToName(typeParam, context).escapedText;
48573
- add(typeParamName, typeParam.symbol);
48574
- }
48575
- }
48576
- );
48577
49473
  }
48578
49474
  }
48579
49475
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
@@ -49117,7 +50013,7 @@ function createTypeChecker(host) {
49117
50013
  return identifier;
49118
50014
  }
49119
50015
  }
49120
- function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
50016
+ function typeParameterShadowsNameInScope(escapedName, context, type) {
49121
50017
  const result = resolveName(
49122
50018
  context.enclosingDeclaration,
49123
50019
  escapedName,
@@ -49128,8 +50024,11 @@ function createTypeChecker(host) {
49128
50024
  /*isUse*/
49129
50025
  false
49130
50026
  );
49131
- if (result && result.flags & 262144 /* TypeParameter */) {
49132
- return result !== type.symbol;
50027
+ if (result) {
50028
+ if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
50029
+ return false;
50030
+ }
50031
+ return true;
49133
50032
  }
49134
50033
  return false;
49135
50034
  }
@@ -49155,7 +50054,7 @@ function createTypeChecker(host) {
49155
50054
  const rawtext = result.escapedText;
49156
50055
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
49157
50056
  let text = rawtext;
49158
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
50057
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
49159
50058
  i++;
49160
50059
  text = `${rawtext}_${i}`;
49161
50060
  }
@@ -49166,7 +50065,7 @@ function createTypeChecker(host) {
49166
50065
  }
49167
50066
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
49168
50067
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
49169
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
50068
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
49170
50069
  }
49171
50070
  return result;
49172
50071
  }
@@ -49311,10 +50210,7 @@ function createTypeChecker(host) {
49311
50210
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
49312
50211
  }
49313
50212
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
49314
- while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
49315
- enclosingDeclaration = enclosingDeclaration.parent;
49316
- }
49317
- return enclosingDeclaration;
50213
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
49318
50214
  }
49319
50215
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
49320
50216
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -49394,7 +50290,7 @@ function createTypeChecker(host) {
49394
50290
  }
49395
50291
  if (isIdentifier(node)) {
49396
50292
  const type = getDeclaredTypeOfSymbol(sym);
49397
- const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
50293
+ const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
49398
50294
  name.symbol = sym;
49399
50295
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
49400
50296
  }
@@ -53237,28 +54133,7 @@ function createTypeChecker(host) {
53237
54133
  }
53238
54134
  }
53239
54135
  }
53240
- let resolved = combineSymbolTables(earlySymbols, lateSymbols);
53241
- if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
53242
- for (const decl of symbol.declarations) {
53243
- const original = getSymbolLinks(decl.symbol)[resolutionKind];
53244
- if (!resolved) {
53245
- resolved = original;
53246
- continue;
53247
- }
53248
- if (!original)
53249
- continue;
53250
- original.forEach((s, name) => {
53251
- const existing = resolved.get(name);
53252
- if (!existing)
53253
- resolved.set(name, s);
53254
- else if (existing === s)
53255
- return;
53256
- else
53257
- resolved.set(name, mergeSymbol(existing, s));
53258
- });
53259
- }
53260
- }
53261
- links[resolutionKind] = resolved || emptySymbols;
54136
+ links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
53262
54137
  }
53263
54138
  return links[resolutionKind];
53264
54139
  }