@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/tsserver.js CHANGED
@@ -147,6 +147,7 @@ __export(server_exports, {
147
147
  PrivateIdentifierKind: () => PrivateIdentifierKind,
148
148
  ProcessLevel: () => ProcessLevel,
149
149
  QuotePreference: () => QuotePreference,
150
+ RegularExpressionFlags: () => RegularExpressionFlags,
150
151
  RelationComparisonResult: () => RelationComparisonResult,
151
152
  Rename: () => ts_Rename_exports,
152
153
  ScriptElementKind: () => ScriptElementKind,
@@ -273,6 +274,7 @@ __export(server_exports, {
273
274
  changeExtension: () => changeExtension,
274
275
  changesAffectModuleResolution: () => changesAffectModuleResolution,
275
276
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
277
+ characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
276
278
  childIsDecorated: () => childIsDecorated,
277
279
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
278
280
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -2029,6 +2031,7 @@ __export(server_exports, {
2029
2031
  reducePathComponents: () => reducePathComponents,
2030
2032
  refactor: () => ts_refactor_exports,
2031
2033
  regExpEscape: () => regExpEscape,
2034
+ regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
2032
2035
  relativeComplement: () => relativeComplement,
2033
2036
  removeAllComments: () => removeAllComments,
2034
2037
  removeEmitHelper: () => removeEmitHelper,
@@ -2323,7 +2326,7 @@ module.exports = __toCommonJS(server_exports);
2323
2326
 
2324
2327
  // src/compiler/corePublic.ts
2325
2328
  var versionMajorMinor = "5.3";
2326
- var version = `${versionMajorMinor}.0-insiders.20230921`;
2329
+ var version = `${versionMajorMinor}.0-insiders.20230922`;
2327
2330
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2328
2331
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2329
2332
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6235,6 +6238,20 @@ var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
6235
6238
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution";
6236
6239
  return GeneratedIdentifierFlags2;
6237
6240
  })(GeneratedIdentifierFlags || {});
6241
+ var RegularExpressionFlags = /* @__PURE__ */ ((RegularExpressionFlags2) => {
6242
+ RegularExpressionFlags2[RegularExpressionFlags2["None"] = 0] = "None";
6243
+ RegularExpressionFlags2[RegularExpressionFlags2["HasIndices"] = 1] = "HasIndices";
6244
+ RegularExpressionFlags2[RegularExpressionFlags2["Global"] = 2] = "Global";
6245
+ RegularExpressionFlags2[RegularExpressionFlags2["IgnoreCase"] = 4] = "IgnoreCase";
6246
+ RegularExpressionFlags2[RegularExpressionFlags2["Multiline"] = 8] = "Multiline";
6247
+ RegularExpressionFlags2[RegularExpressionFlags2["DotAll"] = 16] = "DotAll";
6248
+ RegularExpressionFlags2[RegularExpressionFlags2["Unicode"] = 32] = "Unicode";
6249
+ RegularExpressionFlags2[RegularExpressionFlags2["UnicodeSets"] = 64] = "UnicodeSets";
6250
+ RegularExpressionFlags2[RegularExpressionFlags2["Sticky"] = 128] = "Sticky";
6251
+ RegularExpressionFlags2[RegularExpressionFlags2["UnicodeMode"] = 96] = "UnicodeMode";
6252
+ RegularExpressionFlags2[RegularExpressionFlags2["Modifiers"] = 28] = "Modifiers";
6253
+ return RegularExpressionFlags2;
6254
+ })(RegularExpressionFlags || {});
6238
6255
  var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
6239
6256
  TokenFlags2[TokenFlags2["None"] = 0] = "None";
6240
6257
  TokenFlags2[TokenFlags2["PrecedingLineBreak"] = 1] = "PrecedingLineBreak";
@@ -6943,6 +6960,8 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6943
6960
  ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6944
6961
  ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6945
6962
  ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6963
+ ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6964
+ ScriptTarget11[ScriptTarget11["ES2024"] = 11] = "ES2024";
6946
6965
  ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6947
6966
  ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6948
6967
  ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
@@ -9607,6 +9626,43 @@ var Diagnostics = {
9607
9626
  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."),
9608
9627
  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."),
9609
9628
  _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."),
9629
+ _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."),
9630
+ Unknown_regular_expression_flag: diag(1497, 1 /* Error */, "Unknown_regular_expression_flag_1497", "Unknown regular expression flag."),
9631
+ Duplicate_regular_expression_flag: diag(1498, 1 /* Error */, "Duplicate_regular_expression_flag_1498", "Duplicate regular expression flag."),
9632
+ 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."),
9633
+ 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."),
9634
+ 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."),
9635
+ 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."),
9636
+ Incomplete_quantifier_Digit_expected: diag(1503, 1 /* Error */, "Incomplete_quantifier_Digit_expected_1503", "Incomplete quantifier. Digit expected."),
9637
+ Numbers_out_of_order_in_quantifier: diag(1504, 1 /* Error */, "Numbers_out_of_order_in_quantifier_1504", "Numbers out of order in quantifier."),
9638
+ There_is_nothing_available_for_repetition: diag(1505, 1 /* Error */, "There_is_nothing_available_for_repetition_1505", "There is nothing available for repetition."),
9639
+ 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?"),
9640
+ 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."),
9641
+ 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."),
9642
+ 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."),
9643
+ 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."),
9644
+ Undetermined_character_escape: diag(1511, 1 /* Error */, "Undetermined_character_escape_1511", "Undetermined character escape."),
9645
+ Expected_a_capturing_group_name: diag(1512, 1 /* Error */, "Expected_a_capturing_group_name_1512", "Expected a capturing group name."),
9646
+ 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."),
9647
+ 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."),
9648
+ 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."),
9649
+ 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."),
9650
+ 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."),
9651
+ Expected_a_class_set_oprand: diag(1518, 1 /* Error */, "Expected_a_class_set_oprand_1518", "Expected a class set oprand."),
9652
+ 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."),
9653
+ 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?"),
9654
+ Expected_a_Unicode_property_name: diag(1521, 1 /* Error */, "Expected_a_Unicode_property_name_1521", "Expected a Unicode property name."),
9655
+ Unknown_Unicode_property_name: diag(1522, 1 /* Error */, "Unknown_Unicode_property_name_1522", "Unknown Unicode property name."),
9656
+ Expected_a_Unicode_property_value: diag(1523, 1 /* Error */, "Expected_a_Unicode_property_value_1523", "Expected a Unicode property value."),
9657
+ Unknown_Unicode_property_value: diag(1524, 1 /* Error */, "Unknown_Unicode_property_value_1524", "Unknown Unicode property value."),
9658
+ 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."),
9659
+ 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."),
9660
+ Unknown_Unicode_property_name_or_value: diag(1527, 1 /* Error */, "Unknown_Unicode_property_name_or_value_1527", "Unknown Unicode property name or value."),
9661
+ 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."),
9662
+ _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."),
9663
+ 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."),
9664
+ 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."),
9665
+ 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."),
9610
9666
  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."),
9611
9667
  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."),
9612
9668
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -11204,7 +11260,7 @@ var Diagnostics = {
11204
11260
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
11205
11261
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
11206
11262
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
11207
- 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"),
11263
+ Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
11208
11264
  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"),
11209
11265
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
11210
11266
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -11440,6 +11496,26 @@ var textToToken = new Map(Object.entries({
11440
11496
  "#": 63 /* HashToken */,
11441
11497
  "`": 62 /* BacktickToken */
11442
11498
  }));
11499
+ var charToRegExpFlag = new Map(Object.entries({
11500
+ d: 1 /* HasIndices */,
11501
+ g: 2 /* Global */,
11502
+ i: 4 /* IgnoreCase */,
11503
+ m: 8 /* Multiline */,
11504
+ s: 16 /* DotAll */,
11505
+ u: 32 /* Unicode */,
11506
+ v: 64 /* UnicodeSets */,
11507
+ y: 128 /* Sticky */
11508
+ }));
11509
+ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
11510
+ [1 /* HasIndices */, 9 /* ES2022 */],
11511
+ [2 /* Global */, 0 /* ES3 */],
11512
+ [4 /* IgnoreCase */, 0 /* ES3 */],
11513
+ [8 /* Multiline */, 0 /* ES3 */],
11514
+ [16 /* DotAll */, 5 /* ES2018 */],
11515
+ [32 /* Unicode */, 2 /* ES2015 */],
11516
+ [64 /* UnicodeSets */, 11 /* ES2024 */],
11517
+ [128 /* Sticky */, 2 /* ES2015 */]
11518
+ ]);
11443
11519
  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];
11444
11520
  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];
11445
11521
  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];
@@ -11490,6 +11566,16 @@ function tokenToString(t) {
11490
11566
  function stringToToken(s) {
11491
11567
  return textToToken.get(s);
11492
11568
  }
11569
+ var regExpFlagChars = makeReverseMap(charToRegExpFlag);
11570
+ function regularExpressionFlagToCharacter(f) {
11571
+ return regExpFlagChars[f];
11572
+ }
11573
+ function characterToRegularExpressionFlag(c) {
11574
+ return charToRegExpFlag.get(c);
11575
+ }
11576
+ function regularExpressionFlagToFirstAvailableLanguageVersion(f) {
11577
+ return regExpFlagToFirstAvailableLanguageVersion.get(f);
11578
+ }
11493
11579
  function computeLineStarts(text) {
11494
11580
  const result = [];
11495
11581
  let pos = 0;
@@ -11586,8 +11672,11 @@ function isDigit(ch) {
11586
11672
  function isHexDigit(ch) {
11587
11673
  return isDigit(ch) || ch >= 65 /* A */ && ch <= 70 /* F */ || ch >= 97 /* a */ && ch <= 102 /* f */;
11588
11674
  }
11589
- function isCodePoint(code) {
11590
- return code <= 1114111;
11675
+ function isASCIILetter(ch) {
11676
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */;
11677
+ }
11678
+ function isWordCharacter(ch) {
11679
+ return isASCIILetter(ch) || isDigit(ch) || ch === 95 /* _ */;
11591
11680
  }
11592
11681
  function isOctalDigit(ch) {
11593
11682
  return ch >= 48 /* _0 */ && ch <= 55 /* _7 */;
@@ -11926,10 +12015,10 @@ function getShebang(text) {
11926
12015
  }
11927
12016
  }
11928
12017
  function isIdentifierStart(ch, languageVersion) {
11929
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
12018
+ return isASCIILetter(ch) || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
11930
12019
  }
11931
12020
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
11932
- 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
12021
+ return isWordCharacter(ch) || ch === 36 /* $ */ || // "-" and ":" are valid in JSX Identifiers
11933
12022
  (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
11934
12023
  }
11935
12024
  function isIdentifierText(name, languageVersion, identifierVariant) {
@@ -12248,7 +12337,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12248
12337
  result += text.substring(start3, pos);
12249
12338
  result += scanEscapeSequence(
12250
12339
  /*shouldEmitInvalidEscapeError*/
12251
- true
12340
+ true,
12341
+ /*isRegularExpression*/
12342
+ false
12252
12343
  );
12253
12344
  start3 = pos;
12254
12345
  continue;
@@ -12292,7 +12383,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12292
12383
  }
12293
12384
  if (currChar === 92 /* backslash */) {
12294
12385
  contents += text.substring(start3, pos);
12295
- contents += scanEscapeSequence(shouldEmitInvalidEscapeError);
12386
+ contents += scanEscapeSequence(
12387
+ shouldEmitInvalidEscapeError,
12388
+ /*isRegularExpression*/
12389
+ false
12390
+ );
12296
12391
  start3 = pos;
12297
12392
  continue;
12298
12393
  }
@@ -12312,7 +12407,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12312
12407
  tokenValue = contents;
12313
12408
  return resultingToken;
12314
12409
  }
12315
- function scanEscapeSequence(shouldEmitInvalidEscapeError) {
12410
+ function scanEscapeSequence(shouldEmitInvalidEscapeError, isRegularExpression) {
12316
12411
  const start3 = pos;
12317
12412
  pos++;
12318
12413
  if (pos >= end) {
@@ -12340,7 +12435,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12340
12435
  pos++;
12341
12436
  }
12342
12437
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12343
- if (shouldEmitInvalidEscapeError) {
12438
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12344
12439
  const code = parseInt(text.substring(start3 + 1, pos), 8);
12345
12440
  error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start3, pos - start3, "\\x" + code.toString(16).padStart(2, "0"));
12346
12441
  return String.fromCharCode(code);
@@ -12349,7 +12444,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12349
12444
  case 56 /* _8 */:
12350
12445
  case 57 /* _9 */:
12351
12446
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12352
- if (shouldEmitInvalidEscapeError) {
12447
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12353
12448
  error2(Diagnostics.Escape_sequence_0_is_not_allowed, start3, pos - start3, text.substring(start3, pos));
12354
12449
  return String.fromCharCode(ch);
12355
12450
  }
@@ -12371,62 +12466,42 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12371
12466
  case 34 /* doubleQuote */:
12372
12467
  return '"';
12373
12468
  case 117 /* u */:
12374
- if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
12375
- pos++;
12376
- const escapedValueString = scanMinimumNumberOfHexDigits(
12377
- 1,
12378
- /*canHaveSeparators*/
12379
- false
12380
- );
12381
- const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
12382
- if (escapedValue < 0) {
12383
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12384
- if (shouldEmitInvalidEscapeError) {
12385
- error2(Diagnostics.Hexadecimal_digit_expected);
12386
- }
12387
- return text.substring(start3, pos);
12388
- }
12389
- if (!isCodePoint(escapedValue)) {
12390
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12391
- if (shouldEmitInvalidEscapeError) {
12392
- error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
12393
- }
12394
- return text.substring(start3, pos);
12395
- }
12396
- if (pos >= end) {
12397
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12398
- if (shouldEmitInvalidEscapeError) {
12399
- error2(Diagnostics.Unexpected_end_of_text);
12400
- }
12401
- return text.substring(start3, pos);
12402
- }
12403
- if (text.charCodeAt(pos) !== 125 /* closeBrace */) {
12404
- tokenFlags |= 2048 /* ContainsInvalidEscape */;
12405
- if (shouldEmitInvalidEscapeError) {
12406
- error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12407
- }
12408
- return text.substring(start3, pos);
12409
- }
12410
- pos++;
12411
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12412
- return utf16EncodeAsString(escapedValue);
12469
+ if ((!isRegularExpression || shouldEmitInvalidEscapeError) && pos < end && text.charCodeAt(pos) === 123 /* openBrace */) {
12470
+ pos -= 2;
12471
+ return scanExtendedUnicodeEscape(isRegularExpression || shouldEmitInvalidEscapeError);
12413
12472
  }
12414
12473
  for (; pos < start3 + 6; pos++) {
12415
12474
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12416
12475
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12417
- if (shouldEmitInvalidEscapeError) {
12476
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12418
12477
  error2(Diagnostics.Hexadecimal_digit_expected);
12419
12478
  }
12420
12479
  return text.substring(start3, pos);
12421
12480
  }
12422
12481
  }
12423
12482
  tokenFlags |= 1024 /* UnicodeEscape */;
12424
- return String.fromCharCode(parseInt(text.substring(start3 + 2, pos), 16));
12483
+ const escapedValue = parseInt(text.substring(start3 + 2, pos), 16);
12484
+ const escapedValueString = String.fromCharCode(escapedValue);
12485
+ if (isRegularExpression && shouldEmitInvalidEscapeError && escapedValue >= 55296 && escapedValue <= 56319 && pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && text.charCodeAt(pos + 2) !== 123 /* openBrace */) {
12486
+ const nextStart = pos;
12487
+ let nextPos = pos + 2;
12488
+ for (; nextPos < nextStart + 6; nextPos++) {
12489
+ if (!isHexDigit(text.charCodeAt(pos))) {
12490
+ return escapedValueString;
12491
+ }
12492
+ }
12493
+ const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
12494
+ if (nextEscapedValue >= 56320 && nextEscapedValue <= 57343) {
12495
+ pos = nextPos;
12496
+ return escapedValueString + String.fromCharCode(nextEscapedValue);
12497
+ }
12498
+ }
12499
+ return escapedValueString;
12425
12500
  case 120 /* x */:
12426
12501
  for (; pos < start3 + 4; pos++) {
12427
12502
  if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) {
12428
12503
  tokenFlags |= 2048 /* ContainsInvalidEscape */;
12429
- if (shouldEmitInvalidEscapeError) {
12504
+ if (isRegularExpression || shouldEmitInvalidEscapeError) {
12430
12505
  error2(Diagnostics.Hexadecimal_digit_expected);
12431
12506
  }
12432
12507
  return text.substring(start3, pos);
@@ -12443,10 +12518,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12443
12518
  case 8233 /* paragraphSeparator */:
12444
12519
  return "";
12445
12520
  default:
12521
+ if (isRegularExpression && (shouldEmitInvalidEscapeError || isIdentifierPart(ch, languageVersion))) {
12522
+ error2(Diagnostics._0_is_not_a_valid_character_escape, pos - 2, 2, String.fromCharCode(ch));
12523
+ }
12446
12524
  return String.fromCharCode(ch);
12447
12525
  }
12448
12526
  }
12449
- function scanExtendedUnicodeEscape() {
12527
+ function scanExtendedUnicodeEscape(shouldEmitInvalidEscapeError = true) {
12528
+ const start3 = pos;
12529
+ pos += 3;
12530
+ const escapedStart = pos;
12450
12531
  const escapedValueString = scanMinimumNumberOfHexDigits(
12451
12532
  1,
12452
12533
  /*canHaveSeparators*/
@@ -12455,24 +12536,34 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12455
12536
  const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
12456
12537
  let isInvalidExtendedEscape = false;
12457
12538
  if (escapedValue < 0) {
12458
- error2(Diagnostics.Hexadecimal_digit_expected);
12539
+ if (shouldEmitInvalidEscapeError) {
12540
+ error2(Diagnostics.Hexadecimal_digit_expected);
12541
+ }
12459
12542
  isInvalidExtendedEscape = true;
12460
12543
  } else if (escapedValue > 1114111) {
12461
- error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive);
12544
+ if (shouldEmitInvalidEscapeError) {
12545
+ error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive, escapedStart, pos - escapedStart);
12546
+ }
12462
12547
  isInvalidExtendedEscape = true;
12463
12548
  }
12464
12549
  if (pos >= end) {
12465
- error2(Diagnostics.Unexpected_end_of_text);
12550
+ if (shouldEmitInvalidEscapeError) {
12551
+ error2(Diagnostics.Unexpected_end_of_text);
12552
+ }
12466
12553
  isInvalidExtendedEscape = true;
12467
12554
  } else if (text.charCodeAt(pos) === 125 /* closeBrace */) {
12468
12555
  pos++;
12469
12556
  } else {
12470
- error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12557
+ if (shouldEmitInvalidEscapeError) {
12558
+ error2(Diagnostics.Unterminated_Unicode_escape_sequence);
12559
+ }
12471
12560
  isInvalidExtendedEscape = true;
12472
12561
  }
12473
12562
  if (isInvalidExtendedEscape) {
12474
- return "";
12563
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
12564
+ return text.substring(start3, pos);
12475
12565
  }
12566
+ tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12476
12567
  return utf16EncodeAsString(escapedValue);
12477
12568
  }
12478
12569
  function peekUnicodeEscape() {
@@ -12514,8 +12605,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12514
12605
  } else if (ch === 92 /* backslash */) {
12515
12606
  ch = peekExtendedUnicodeEscape();
12516
12607
  if (ch >= 0 && isIdentifierPart(ch, languageVersion)) {
12517
- pos += 3;
12518
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12519
12608
  result += scanExtendedUnicodeEscape();
12520
12609
  start3 = pos;
12521
12610
  continue;
@@ -12986,8 +13075,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12986
13075
  case 92 /* backslash */:
12987
13076
  const extendedCookedChar = peekExtendedUnicodeEscape();
12988
13077
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
12989
- pos += 3;
12990
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
12991
13078
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
12992
13079
  return token = getIdentifierToken();
12993
13080
  }
@@ -13003,7 +13090,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13003
13090
  return token = 0 /* Unknown */;
13004
13091
  case 35 /* hash */:
13005
13092
  if (pos !== 0 && text[pos + 1] === "!") {
13006
- error2(Diagnostics.can_only_be_used_at_the_start_of_a_file);
13093
+ error2(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
13007
13094
  pos++;
13008
13095
  return token = 0 /* Unknown */;
13009
13096
  }
@@ -13012,8 +13099,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13012
13099
  pos++;
13013
13100
  const extendedCookedChar2 = peekExtendedUnicodeEscape();
13014
13101
  if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
13015
- pos += 3;
13016
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
13017
13102
  tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
13018
13103
  return token = 81 /* PrivateIdentifier */;
13019
13104
  }
@@ -13136,14 +13221,841 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13136
13221
  }
13137
13222
  p++;
13138
13223
  }
13139
- while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) {
13224
+ const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
13225
+ const endOfBody = p - (isUnterminated ? 0 : 1);
13226
+ let regExpFlags = 0 /* None */;
13227
+ while (p < end) {
13228
+ const ch = text.charCodeAt(p);
13229
+ if (!isIdentifierPart(ch, languageVersion)) {
13230
+ break;
13231
+ }
13232
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13233
+ if (flag === void 0) {
13234
+ error2(Diagnostics.Unknown_regular_expression_flag, p, 1);
13235
+ } else if (regExpFlags & flag) {
13236
+ error2(Diagnostics.Duplicate_regular_expression_flag, p, 1);
13237
+ } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
13238
+ error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
13239
+ } else {
13240
+ regExpFlags |= flag;
13241
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
13242
+ if (languageVersion < availableFrom) {
13243
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, p, 1, ScriptTarget[availableFrom]);
13244
+ }
13245
+ }
13140
13246
  p++;
13141
13247
  }
13142
- pos = p;
13248
+ pos = tokenStart + 1;
13249
+ const saveTokenPos = tokenStart;
13250
+ const saveTokenFlags = tokenFlags;
13251
+ scanRegularExpressionWorker(text.slice(0, endOfBody), endOfBody, regExpFlags, isUnterminated);
13252
+ if (!isUnterminated) {
13253
+ pos = p;
13254
+ }
13255
+ tokenStart = saveTokenPos;
13256
+ tokenFlags = saveTokenFlags;
13143
13257
  tokenValue = text.substring(tokenStart, pos);
13144
13258
  token = 14 /* RegularExpressionLiteral */;
13145
13259
  }
13146
13260
  return token;
13261
+ function scanRegularExpressionWorker(text2, end2, regExpFlags, isUnterminated) {
13262
+ const unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
13263
+ const unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13264
+ let mayContainStrings = false;
13265
+ let numberOfCapturingGroups = 0;
13266
+ const groupSpecifiers = /* @__PURE__ */ new Set();
13267
+ const groupNameReferences = [];
13268
+ const decimalEscapes = [];
13269
+ const namedCapturingGroups = [];
13270
+ function scanDisjunction(isInGroup) {
13271
+ while (true) {
13272
+ namedCapturingGroups.push(/* @__PURE__ */ new Set());
13273
+ scanAlternative(isInGroup);
13274
+ namedCapturingGroups.pop();
13275
+ if (text2.charCodeAt(pos) !== 124 /* bar */) {
13276
+ return;
13277
+ }
13278
+ pos++;
13279
+ }
13280
+ }
13281
+ function scanAlternative(isInGroup) {
13282
+ let isPreviousTermQuantifiable = false;
13283
+ while (pos < end2) {
13284
+ const start3 = pos;
13285
+ const ch = text2.charCodeAt(pos);
13286
+ switch (ch) {
13287
+ case 94 /* caret */:
13288
+ case 36 /* $ */:
13289
+ pos++;
13290
+ isPreviousTermQuantifiable = false;
13291
+ break;
13292
+ case 92 /* backslash */:
13293
+ pos++;
13294
+ switch (text2.charCodeAt(pos)) {
13295
+ case 98 /* b */:
13296
+ case 66 /* B */:
13297
+ pos++;
13298
+ isPreviousTermQuantifiable = false;
13299
+ break;
13300
+ default:
13301
+ scanAtomEscape();
13302
+ isPreviousTermQuantifiable = true;
13303
+ break;
13304
+ }
13305
+ break;
13306
+ case 40 /* openParen */:
13307
+ pos++;
13308
+ if (text2.charCodeAt(pos) === 63 /* question */) {
13309
+ pos++;
13310
+ switch (text2.charCodeAt(pos)) {
13311
+ case 61 /* equals */:
13312
+ case 33 /* exclamation */:
13313
+ pos++;
13314
+ isPreviousTermQuantifiable = false;
13315
+ break;
13316
+ case 60 /* lessThan */:
13317
+ const groupNameStart = pos;
13318
+ pos++;
13319
+ switch (text2.charCodeAt(pos)) {
13320
+ case 61 /* equals */:
13321
+ case 33 /* exclamation */:
13322
+ pos++;
13323
+ isPreviousTermQuantifiable = false;
13324
+ break;
13325
+ default:
13326
+ scanGroupName(
13327
+ /*isReference*/
13328
+ false
13329
+ );
13330
+ scanExpectedChar(62 /* greaterThan */);
13331
+ if (languageVersion < 5 /* ES2018 */) {
13332
+ error2(Diagnostics.Named_capturing_groups_are_only_available_when_targeting_ES2018_or_later, groupNameStart, pos - groupNameStart);
13333
+ }
13334
+ numberOfCapturingGroups++;
13335
+ isPreviousTermQuantifiable = true;
13336
+ break;
13337
+ }
13338
+ break;
13339
+ default:
13340
+ const start4 = pos;
13341
+ const setFlags = scanPatternModifiers();
13342
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13343
+ pos++;
13344
+ scanPatternModifiers(setFlags);
13345
+ if (pos === start4 + 1) {
13346
+ error2(Diagnostics.Subpattern_flags_must_be_present_when_there_is_a_minus_sign, start4, pos - start4);
13347
+ }
13348
+ }
13349
+ scanExpectedChar(58 /* colon */);
13350
+ isPreviousTermQuantifiable = true;
13351
+ break;
13352
+ }
13353
+ } else {
13354
+ numberOfCapturingGroups++;
13355
+ isPreviousTermQuantifiable = true;
13356
+ }
13357
+ scanDisjunction(
13358
+ /*isInGroup*/
13359
+ true
13360
+ );
13361
+ scanExpectedChar(41 /* closeParen */);
13362
+ break;
13363
+ case 123 /* openBrace */:
13364
+ pos++;
13365
+ const digitsStart = pos;
13366
+ scanDigits();
13367
+ const min2 = tokenValue;
13368
+ if (text2.charCodeAt(pos) === 44 /* comma */) {
13369
+ pos++;
13370
+ scanDigits();
13371
+ const max = tokenValue;
13372
+ if (!min2) {
13373
+ if (max || text2.charCodeAt(pos) === 125 /* closeBrace */) {
13374
+ error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13375
+ } else {
13376
+ if (unicodeMode) {
13377
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start3, 1, String.fromCharCode(ch));
13378
+ }
13379
+ isPreviousTermQuantifiable = true;
13380
+ break;
13381
+ }
13382
+ }
13383
+ if (max && Number.parseInt(min2) > Number.parseInt(max)) {
13384
+ error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13385
+ }
13386
+ } else if (!min2) {
13387
+ if (unicodeMode) {
13388
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start3, 1, String.fromCharCode(ch));
13389
+ }
13390
+ isPreviousTermQuantifiable = true;
13391
+ break;
13392
+ }
13393
+ scanExpectedChar(125 /* closeBrace */);
13394
+ pos--;
13395
+ case 42 /* asterisk */:
13396
+ case 43 /* plus */:
13397
+ case 63 /* question */:
13398
+ pos++;
13399
+ if (text2.charCodeAt(pos) === 63 /* question */) {
13400
+ pos++;
13401
+ }
13402
+ if (!isPreviousTermQuantifiable) {
13403
+ error2(Diagnostics.There_is_nothing_available_for_repetition, start3, pos - start3);
13404
+ }
13405
+ isPreviousTermQuantifiable = false;
13406
+ break;
13407
+ case 46 /* dot */:
13408
+ pos++;
13409
+ isPreviousTermQuantifiable = true;
13410
+ break;
13411
+ case 91 /* openBracket */:
13412
+ pos++;
13413
+ if (unicodeSetsMode) {
13414
+ scanClassSetExpression();
13415
+ } else {
13416
+ scanClassRanges();
13417
+ }
13418
+ scanExpectedChar(93 /* closeBracket */);
13419
+ isPreviousTermQuantifiable = true;
13420
+ break;
13421
+ case 41 /* closeParen */:
13422
+ if (isInGroup) {
13423
+ return;
13424
+ }
13425
+ case 93 /* closeBracket */:
13426
+ case 125 /* closeBrace */:
13427
+ if (isUnterminated && !isInGroup) {
13428
+ return;
13429
+ }
13430
+ if (unicodeMode) {
13431
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13432
+ }
13433
+ pos++;
13434
+ isPreviousTermQuantifiable = true;
13435
+ break;
13436
+ case 47 /* slash */:
13437
+ case 124 /* bar */:
13438
+ return;
13439
+ default:
13440
+ scanSourceCharacter();
13441
+ isPreviousTermQuantifiable = true;
13442
+ break;
13443
+ }
13444
+ }
13445
+ }
13446
+ function scanPatternModifiers(currFlags = 0 /* None */) {
13447
+ while (pos < end2) {
13448
+ const ch = text2.charCodeAt(pos);
13449
+ if (!isIdentifierPart(ch, languageVersion)) {
13450
+ break;
13451
+ }
13452
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13453
+ if (flag === void 0) {
13454
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13455
+ } else if (currFlags & flag) {
13456
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13457
+ } else if (!(flag & 28 /* Modifiers */)) {
13458
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, 1);
13459
+ } else {
13460
+ currFlags |= flag;
13461
+ const availableFrom = regularExpressionFlagToFirstAvailableLanguageVersion(flag);
13462
+ if (languageVersion < availableFrom) {
13463
+ error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, 1, ScriptTarget[availableFrom]);
13464
+ }
13465
+ }
13466
+ pos++;
13467
+ }
13468
+ return currFlags;
13469
+ }
13470
+ function scanAtomEscape() {
13471
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13472
+ switch (text2.charCodeAt(pos)) {
13473
+ case 107 /* k */:
13474
+ pos++;
13475
+ if (text2.charCodeAt(pos) === 60 /* lessThan */) {
13476
+ pos++;
13477
+ scanGroupName(
13478
+ /*isReference*/
13479
+ true
13480
+ );
13481
+ scanExpectedChar(62 /* greaterThan */);
13482
+ } else if (unicodeMode) {
13483
+ error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13484
+ }
13485
+ break;
13486
+ case 113 /* q */:
13487
+ if (unicodeSetsMode) {
13488
+ pos++;
13489
+ error2(Diagnostics.q_is_only_available_inside_character_class, pos - 2, 2);
13490
+ break;
13491
+ }
13492
+ default:
13493
+ scanCharacterClassEscape() || scanDecimalEscape() || scanCharacterEscape();
13494
+ break;
13495
+ }
13496
+ }
13497
+ function scanDecimalEscape() {
13498
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13499
+ const ch = text2.charCodeAt(pos);
13500
+ if (ch >= 49 /* _1 */ && ch <= 57 /* _9 */) {
13501
+ const start3 = pos;
13502
+ scanDigits();
13503
+ decimalEscapes.push({ pos: start3, end: pos, value: +tokenValue });
13504
+ return true;
13505
+ }
13506
+ return false;
13507
+ }
13508
+ function scanCharacterEscape() {
13509
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13510
+ let ch = text2.charCodeAt(pos);
13511
+ switch (ch) {
13512
+ case 99 /* c */:
13513
+ pos++;
13514
+ ch = text2.charCodeAt(pos);
13515
+ if (isASCIILetter(ch)) {
13516
+ pos++;
13517
+ return String.fromCharCode(ch & 31);
13518
+ }
13519
+ if (unicodeMode) {
13520
+ error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13521
+ }
13522
+ return String.fromCharCode(ch);
13523
+ case 94 /* caret */:
13524
+ case 36 /* $ */:
13525
+ case 47 /* slash */:
13526
+ case 92 /* backslash */:
13527
+ case 46 /* dot */:
13528
+ case 42 /* asterisk */:
13529
+ case 43 /* plus */:
13530
+ case 63 /* question */:
13531
+ case 40 /* openParen */:
13532
+ case 41 /* closeParen */:
13533
+ case 91 /* openBracket */:
13534
+ case 93 /* closeBracket */:
13535
+ case 123 /* openBrace */:
13536
+ case 125 /* closeBrace */:
13537
+ case 124 /* bar */:
13538
+ pos++;
13539
+ return String.fromCharCode(ch);
13540
+ default:
13541
+ if (pos >= end2) {
13542
+ error2(Diagnostics.Undetermined_character_escape, pos - 1, 1, ch);
13543
+ return "\\";
13544
+ }
13545
+ pos--;
13546
+ return scanEscapeSequence(
13547
+ /*shouldEmitInvalidEscapeError*/
13548
+ unicodeMode,
13549
+ /*isRegularExpression*/
13550
+ true
13551
+ );
13552
+ }
13553
+ }
13554
+ function scanGroupName(isReference) {
13555
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 60 /* lessThan */);
13556
+ tokenStart = pos;
13557
+ scanIdentifier(codePointAt(text2, pos), languageVersion);
13558
+ if (pos === tokenStart) {
13559
+ error2(Diagnostics.Expected_a_capturing_group_name);
13560
+ } else if (isReference) {
13561
+ groupNameReferences.push({ pos: tokenStart, end: pos, name: tokenValue });
13562
+ } else if (namedCapturingGroups.some((group2) => group2.has(tokenValue))) {
13563
+ error2(Diagnostics.Named_capturing_groups_with_the_same_name_must_be_mutually_exclusive_to_each_other, tokenStart, pos - tokenStart);
13564
+ } else {
13565
+ last(namedCapturingGroups).add(tokenValue);
13566
+ groupSpecifiers.add(tokenValue);
13567
+ }
13568
+ }
13569
+ function isClassContentExit(ch) {
13570
+ return ch === 93 /* closeBracket */ || pos >= end2;
13571
+ }
13572
+ function scanClassRanges() {
13573
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13574
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
13575
+ pos++;
13576
+ }
13577
+ while (pos < end2) {
13578
+ const ch = text2.charCodeAt(pos);
13579
+ if (isClassContentExit(ch)) {
13580
+ return;
13581
+ }
13582
+ const minStart = pos;
13583
+ const minCharacter = scanClassAtom();
13584
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13585
+ pos++;
13586
+ const ch2 = text2.charCodeAt(pos);
13587
+ if (isClassContentExit(ch2)) {
13588
+ return;
13589
+ }
13590
+ if (!minCharacter) {
13591
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, minStart, pos - 1 - minStart);
13592
+ }
13593
+ const maxStart = pos;
13594
+ const maxCharacter = scanClassAtom();
13595
+ if (!maxCharacter) {
13596
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, maxStart, pos - maxStart);
13597
+ continue;
13598
+ }
13599
+ if (!minCharacter) {
13600
+ continue;
13601
+ }
13602
+ const minCharacterValue = codePointAt(minCharacter, 0);
13603
+ const maxCharacterValue = codePointAt(maxCharacter, 0);
13604
+ if (minCharacter.length === charSize(minCharacterValue) && maxCharacter.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13605
+ error2(Diagnostics.Range_out_of_order_in_character_class, minStart, pos - minStart);
13606
+ }
13607
+ }
13608
+ }
13609
+ }
13610
+ function scanClassSetExpression() {
13611
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 91 /* openBracket */);
13612
+ let isCharacterComplement = false;
13613
+ if (text2.charCodeAt(pos) === 94 /* caret */) {
13614
+ pos++;
13615
+ isCharacterComplement = true;
13616
+ }
13617
+ let expressionMayContainStrings = false;
13618
+ let ch = text2.charCodeAt(pos);
13619
+ if (isClassContentExit(ch)) {
13620
+ return;
13621
+ }
13622
+ let start3 = pos;
13623
+ let oprand;
13624
+ switch (text2.slice(pos, pos + 2)) {
13625
+ case "--":
13626
+ case "&&":
13627
+ error2(Diagnostics.Expected_a_class_set_oprand);
13628
+ mayContainStrings = false;
13629
+ break;
13630
+ default:
13631
+ oprand = scanClassSetOprand();
13632
+ break;
13633
+ }
13634
+ switch (text2.charCodeAt(pos)) {
13635
+ case 45 /* minus */:
13636
+ if (text2.charCodeAt(pos + 1) === 45 /* minus */) {
13637
+ if (isCharacterComplement && mayContainStrings) {
13638
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start3, pos - start3);
13639
+ }
13640
+ expressionMayContainStrings = mayContainStrings;
13641
+ scanClassSetSubExpression(3 /* ClassSubtraction */);
13642
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13643
+ return;
13644
+ }
13645
+ break;
13646
+ case 38 /* ampersand */:
13647
+ if (text2.charCodeAt(pos + 1) === 38 /* ampersand */) {
13648
+ scanClassSetSubExpression(2 /* ClassIntersection */);
13649
+ if (isCharacterComplement && mayContainStrings) {
13650
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start3, pos - start3);
13651
+ }
13652
+ expressionMayContainStrings = mayContainStrings;
13653
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13654
+ return;
13655
+ } else {
13656
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13657
+ }
13658
+ break;
13659
+ default:
13660
+ if (isCharacterComplement && mayContainStrings) {
13661
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, start3, pos - start3);
13662
+ }
13663
+ expressionMayContainStrings = mayContainStrings;
13664
+ break;
13665
+ }
13666
+ while (pos < end2) {
13667
+ ch = text2.charCodeAt(pos);
13668
+ switch (ch) {
13669
+ case 45 /* minus */:
13670
+ pos++;
13671
+ ch = text2.charCodeAt(pos);
13672
+ if (isClassContentExit(ch)) {
13673
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13674
+ return;
13675
+ }
13676
+ if (ch === 45 /* minus */) {
13677
+ pos++;
13678
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13679
+ start3 = pos - 2;
13680
+ oprand = text2.slice(start3, pos);
13681
+ continue;
13682
+ } else {
13683
+ if (!oprand) {
13684
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, start3, pos - 1 - start3);
13685
+ }
13686
+ const secondStart = pos;
13687
+ const secondOprand = scanClassSetOprand();
13688
+ if (isCharacterComplement && mayContainStrings) {
13689
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, secondStart, pos - secondStart);
13690
+ }
13691
+ expressionMayContainStrings || (expressionMayContainStrings = mayContainStrings);
13692
+ if (!secondOprand) {
13693
+ error2(Diagnostics.A_character_class_range_must_not_be_bounded_by_another_character_class, secondStart, pos - secondStart);
13694
+ break;
13695
+ }
13696
+ if (!oprand) {
13697
+ break;
13698
+ }
13699
+ const minCharacterValue = codePointAt(oprand, 0);
13700
+ const maxCharacterValue = codePointAt(secondOprand, 0);
13701
+ if (oprand.length === charSize(minCharacterValue) && secondOprand.length === charSize(maxCharacterValue) && minCharacterValue > maxCharacterValue) {
13702
+ error2(Diagnostics.Range_out_of_order_in_character_class, start3, pos - start3);
13703
+ }
13704
+ }
13705
+ break;
13706
+ case 38 /* ampersand */:
13707
+ start3 = pos;
13708
+ pos++;
13709
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13710
+ pos++;
13711
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13712
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13713
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13714
+ pos++;
13715
+ }
13716
+ } else {
13717
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13718
+ }
13719
+ oprand = text2.slice(start3, pos);
13720
+ continue;
13721
+ }
13722
+ if (isClassContentExit(text2.charCodeAt(pos))) {
13723
+ break;
13724
+ }
13725
+ start3 = pos;
13726
+ switch (text2.slice(pos, pos + 2)) {
13727
+ case "--":
13728
+ case "&&":
13729
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos, 2);
13730
+ pos += 2;
13731
+ oprand = text2.slice(start3, pos);
13732
+ break;
13733
+ default:
13734
+ oprand = scanClassSetOprand();
13735
+ break;
13736
+ }
13737
+ }
13738
+ mayContainStrings = !isCharacterComplement && expressionMayContainStrings;
13739
+ }
13740
+ function scanClassSetSubExpression(expressionType) {
13741
+ let expressionMayContainStrings = mayContainStrings;
13742
+ while (pos < end2) {
13743
+ let ch = text2.charCodeAt(pos);
13744
+ if (isClassContentExit(ch)) {
13745
+ break;
13746
+ }
13747
+ switch (ch) {
13748
+ case 45 /* minus */:
13749
+ pos++;
13750
+ if (text2.charCodeAt(pos) === 45 /* minus */) {
13751
+ pos++;
13752
+ if (expressionType !== 3 /* ClassSubtraction */) {
13753
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13754
+ }
13755
+ } else {
13756
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 1, 1);
13757
+ }
13758
+ break;
13759
+ case 38 /* ampersand */:
13760
+ pos++;
13761
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13762
+ pos++;
13763
+ if (expressionType !== 2 /* ClassIntersection */) {
13764
+ error2(Diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, pos - 2, 2);
13765
+ }
13766
+ if (text2.charCodeAt(pos) === 38 /* ampersand */) {
13767
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13768
+ pos++;
13769
+ }
13770
+ } else {
13771
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos - 1, 1, String.fromCharCode(ch));
13772
+ }
13773
+ break;
13774
+ default:
13775
+ switch (expressionType) {
13776
+ case 3 /* ClassSubtraction */:
13777
+ error2(Diagnostics._0_expected, pos, 0, "--");
13778
+ break;
13779
+ case 2 /* ClassIntersection */:
13780
+ error2(Diagnostics._0_expected, pos, 0, "&&");
13781
+ break;
13782
+ default:
13783
+ break;
13784
+ }
13785
+ break;
13786
+ }
13787
+ ch = text2.charCodeAt(pos);
13788
+ if (isClassContentExit(ch)) {
13789
+ error2(Diagnostics.Expected_a_class_set_oprand);
13790
+ break;
13791
+ }
13792
+ scanClassSetOprand();
13793
+ expressionMayContainStrings && (expressionMayContainStrings = mayContainStrings);
13794
+ }
13795
+ mayContainStrings = expressionMayContainStrings;
13796
+ }
13797
+ function scanClassSetOprand() {
13798
+ mayContainStrings = false;
13799
+ switch (text2.charCodeAt(pos)) {
13800
+ case 91 /* openBracket */:
13801
+ pos++;
13802
+ scanClassSetExpression();
13803
+ scanExpectedChar(93 /* closeBracket */);
13804
+ return "";
13805
+ case 92 /* backslash */:
13806
+ pos++;
13807
+ if (scanCharacterClassEscape()) {
13808
+ return "";
13809
+ } else if (text2.charCodeAt(pos) === 113 /* q */) {
13810
+ pos++;
13811
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
13812
+ pos++;
13813
+ scanClassStringDisjunctionContents();
13814
+ scanExpectedChar(125 /* closeBrace */);
13815
+ return "";
13816
+ } else {
13817
+ error2(Diagnostics.q_must_be_followed_by_string_alternatives_enclosed_in_braces, pos - 2, 2);
13818
+ return "q";
13819
+ }
13820
+ }
13821
+ pos--;
13822
+ default:
13823
+ return scanClassSetCharacter();
13824
+ }
13825
+ }
13826
+ function scanClassStringDisjunctionContents() {
13827
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 123 /* openBrace */);
13828
+ let characterCount = 0;
13829
+ while (pos < end2) {
13830
+ const ch = text2.charCodeAt(pos);
13831
+ switch (ch) {
13832
+ case 125 /* closeBrace */:
13833
+ if (characterCount !== 1) {
13834
+ mayContainStrings = true;
13835
+ }
13836
+ return;
13837
+ case 124 /* bar */:
13838
+ if (characterCount !== 1) {
13839
+ mayContainStrings = true;
13840
+ }
13841
+ pos++;
13842
+ start2 = pos;
13843
+ characterCount = 0;
13844
+ break;
13845
+ default:
13846
+ scanClassSetCharacter();
13847
+ characterCount++;
13848
+ break;
13849
+ }
13850
+ }
13851
+ }
13852
+ function scanClassSetCharacter() {
13853
+ const ch = text2.charCodeAt(pos);
13854
+ if (ch === 92 /* backslash */) {
13855
+ pos++;
13856
+ const ch2 = text2.charCodeAt(pos);
13857
+ switch (ch2) {
13858
+ case 98 /* b */:
13859
+ pos++;
13860
+ return "\b";
13861
+ case 38 /* ampersand */:
13862
+ case 45 /* minus */:
13863
+ case 33 /* exclamation */:
13864
+ case 35 /* hash */:
13865
+ case 37 /* percent */:
13866
+ case 44 /* comma */:
13867
+ case 58 /* colon */:
13868
+ case 59 /* semicolon */:
13869
+ case 60 /* lessThan */:
13870
+ case 61 /* equals */:
13871
+ case 62 /* greaterThan */:
13872
+ case 64 /* at */:
13873
+ case 96 /* backtick */:
13874
+ case 126 /* tilde */:
13875
+ pos++;
13876
+ return String.fromCharCode(ch2);
13877
+ default:
13878
+ return scanCharacterEscape();
13879
+ }
13880
+ } else if (ch === text2.charCodeAt(pos + 1)) {
13881
+ switch (ch) {
13882
+ case 38 /* ampersand */:
13883
+ case 33 /* exclamation */:
13884
+ case 35 /* hash */:
13885
+ case 37 /* percent */:
13886
+ case 42 /* asterisk */:
13887
+ case 43 /* plus */:
13888
+ case 44 /* comma */:
13889
+ case 46 /* dot */:
13890
+ case 58 /* colon */:
13891
+ case 59 /* semicolon */:
13892
+ case 60 /* lessThan */:
13893
+ case 61 /* equals */:
13894
+ case 62 /* greaterThan */:
13895
+ case 63 /* question */:
13896
+ case 64 /* at */:
13897
+ case 96 /* backtick */:
13898
+ case 126 /* tilde */:
13899
+ error2(Diagnostics.A_character_class_must_not_contain_a_reserved_double_punctuator_Did_you_mean_to_escape_it_with_backslash, pos, 2);
13900
+ pos += 2;
13901
+ return text2.substring(pos - 2, pos);
13902
+ }
13903
+ }
13904
+ switch (ch) {
13905
+ case 47 /* slash */:
13906
+ case 40 /* openParen */:
13907
+ case 41 /* closeParen */:
13908
+ case 91 /* openBracket */:
13909
+ case 93 /* closeBracket */:
13910
+ case 123 /* openBrace */:
13911
+ case 125 /* closeBrace */:
13912
+ case 45 /* minus */:
13913
+ case 124 /* bar */:
13914
+ error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13915
+ pos++;
13916
+ return String.fromCharCode(ch);
13917
+ }
13918
+ return scanSourceCharacter();
13919
+ }
13920
+ function scanClassAtom() {
13921
+ if (text2.charCodeAt(pos) === 92 /* backslash */) {
13922
+ pos++;
13923
+ const ch = text2.charCodeAt(pos);
13924
+ switch (ch) {
13925
+ case 98 /* b */:
13926
+ pos++;
13927
+ return "\b";
13928
+ case 45 /* minus */:
13929
+ pos++;
13930
+ return String.fromCharCode(ch);
13931
+ default:
13932
+ if (scanCharacterClassEscape()) {
13933
+ return "";
13934
+ }
13935
+ return scanCharacterEscape();
13936
+ }
13937
+ } else {
13938
+ return scanSourceCharacter();
13939
+ }
13940
+ }
13941
+ function scanCharacterClassEscape() {
13942
+ Debug.assertEqual(text2.charCodeAt(pos - 1), 92 /* backslash */);
13943
+ let isCharacterComplement = false;
13944
+ const start3 = pos - 1;
13945
+ const ch = text2.charCodeAt(pos);
13946
+ switch (ch) {
13947
+ case 100 /* d */:
13948
+ case 68 /* D */:
13949
+ case 115 /* s */:
13950
+ case 83 /* S */:
13951
+ case 119 /* w */:
13952
+ case 87 /* W */:
13953
+ pos++;
13954
+ return true;
13955
+ case 80 /* P */:
13956
+ isCharacterComplement = true;
13957
+ case 112 /* p */:
13958
+ pos++;
13959
+ if (text2.charCodeAt(pos) === 123 /* openBrace */) {
13960
+ pos++;
13961
+ const propertyNameOrValueStart = pos;
13962
+ const propertyNameOrValue = scanWordCharacters();
13963
+ if (text2.charCodeAt(pos) === 61 /* equals */) {
13964
+ const propertyName = nonBinaryUnicodeProperties.get(propertyNameOrValue);
13965
+ if (pos === propertyNameOrValueStart) {
13966
+ error2(Diagnostics.Expected_a_Unicode_property_name);
13967
+ } else if (propertyName === void 0) {
13968
+ error2(Diagnostics.Unknown_Unicode_property_name, propertyNameOrValueStart, pos - propertyNameOrValueStart);
13969
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, nonBinaryUnicodeProperties.keys(), identity);
13970
+ if (suggestion) {
13971
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
13972
+ }
13973
+ }
13974
+ pos++;
13975
+ const propertyValueStart = pos;
13976
+ const propertyValue = scanWordCharacters();
13977
+ if (pos === propertyValueStart) {
13978
+ error2(Diagnostics.Expected_a_Unicode_property_value);
13979
+ } else if (propertyName !== void 0 && !valuesOfNonBinaryUnicodeProperties[propertyName].has(propertyValue)) {
13980
+ error2(Diagnostics.Unknown_Unicode_property_value, propertyValueStart, pos - propertyValueStart);
13981
+ const suggestion = getSpellingSuggestion(propertyValue, valuesOfNonBinaryUnicodeProperties[propertyName], identity);
13982
+ if (suggestion) {
13983
+ error2(Diagnostics.Did_you_mean_0, propertyValueStart, pos - propertyValueStart, suggestion);
13984
+ }
13985
+ }
13986
+ } else {
13987
+ if (pos === propertyNameOrValueStart) {
13988
+ error2(Diagnostics.Expected_a_Unicode_property_name_or_value);
13989
+ } else if (binaryUnicodePropertiesOfStrings.has(propertyNameOrValue)) {
13990
+ if (!unicodeSetsMode) {
13991
+ error2(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);
13992
+ } else if (isCharacterComplement) {
13993
+ error2(Diagnostics.Anything_that_would_possibly_match_more_than_a_single_character_is_invalid_inside_a_negated_character_class, propertyNameOrValueStart, pos - propertyNameOrValueStart);
13994
+ } else {
13995
+ mayContainStrings = true;
13996
+ }
13997
+ } else if (!valuesOfNonBinaryUnicodeProperties.General_Category.has(propertyNameOrValue) && !binaryUnicodeProperties.has(propertyNameOrValue)) {
13998
+ error2(Diagnostics.Unknown_Unicode_property_name_or_value, propertyNameOrValueStart, pos - propertyNameOrValueStart);
13999
+ const suggestion = getSpellingSuggestion(propertyNameOrValue, [...valuesOfNonBinaryUnicodeProperties.General_Category, ...binaryUnicodeProperties, ...binaryUnicodePropertiesOfStrings], identity);
14000
+ if (suggestion) {
14001
+ error2(Diagnostics.Did_you_mean_0, propertyNameOrValueStart, pos - propertyNameOrValueStart, suggestion);
14002
+ }
14003
+ }
14004
+ }
14005
+ scanExpectedChar(125 /* closeBrace */);
14006
+ if (!unicodeMode) {
14007
+ error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start3, pos - start3);
14008
+ }
14009
+ } else if (unicodeMode) {
14010
+ error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14011
+ }
14012
+ return true;
14013
+ }
14014
+ return false;
14015
+ }
14016
+ function scanWordCharacters() {
14017
+ let value = "";
14018
+ while (pos < end2) {
14019
+ const ch = text2.charCodeAt(pos);
14020
+ if (!isWordCharacter(ch)) {
14021
+ break;
14022
+ }
14023
+ value += String.fromCharCode(ch);
14024
+ pos++;
14025
+ }
14026
+ return value;
14027
+ }
14028
+ function scanSourceCharacter() {
14029
+ const size = unicodeMode ? charSize(codePointAt(text2, pos)) : 1;
14030
+ pos += size;
14031
+ return text2.substring(pos - size, pos);
14032
+ }
14033
+ function scanExpectedChar(ch) {
14034
+ if (text2.charCodeAt(pos) === ch) {
14035
+ pos++;
14036
+ } else {
14037
+ error2(Diagnostics._0_expected, pos, 0, String.fromCharCode(ch));
14038
+ }
14039
+ }
14040
+ scanDisjunction(
14041
+ /*isInGroup*/
14042
+ false
14043
+ );
14044
+ forEach(groupNameReferences, (reference) => {
14045
+ if (!groupSpecifiers.has(reference.name)) {
14046
+ error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
14047
+ }
14048
+ });
14049
+ forEach(decimalEscapes, (escape) => {
14050
+ if (escape.value > numberOfCapturingGroups) {
14051
+ if (numberOfCapturingGroups) {
14052
+ error2(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);
14053
+ } else {
14054
+ error2(Diagnostics.Decimal_escapes_are_invalid_when_there_are_no_capturing_groups_in_a_regular_expression, escape.pos, escape.end - escape.pos);
14055
+ }
14056
+ }
14057
+ });
14058
+ }
13147
14059
  }
13148
14060
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
13149
14061
  const type = getDirectiveFromComment(text2.trimStart(), commentDirectiveRegEx);
@@ -13366,8 +14278,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13366
14278
  pos--;
13367
14279
  const extendedCookedChar = peekExtendedUnicodeEscape();
13368
14280
  if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
13369
- pos += 3;
13370
- tokenFlags |= 8 /* ExtendedUnicodeEscape */;
13371
14281
  tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
13372
14282
  return token = getIdentifierToken();
13373
14283
  }
@@ -13505,6 +14415,22 @@ var utf16EncodeAsStringWorker = String.fromCodePoint ? (codePoint) => String.fro
13505
14415
  function utf16EncodeAsString(codePoint) {
13506
14416
  return utf16EncodeAsStringWorker(codePoint);
13507
14417
  }
14418
+ var nonBinaryUnicodeProperties = new Map(Object.entries({
14419
+ General_Category: "General_Category",
14420
+ gc: "General_Category",
14421
+ Script: "Script",
14422
+ sc: "Script",
14423
+ Script_Extensions: "Script_Extensions",
14424
+ scx: "Script_Extensions"
14425
+ }));
14426
+ 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"]);
14427
+ 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"]);
14428
+ var valuesOfNonBinaryUnicodeProperties = {
14429
+ 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"]),
14430
+ 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"]),
14431
+ Script_Extensions: /* @__PURE__ */ new Set()
14432
+ // Currently empty
14433
+ };
13508
14434
 
13509
14435
  // src/compiler/utilitiesPublic.ts
13510
14436
  function isExternalModuleNameRelative(moduleName) {
@@ -31279,7 +32205,10 @@ var Parser;
31279
32205
  function parseErrorAtPosition(start2, length2, message, ...args) {
31280
32206
  const lastError = lastOrUndefined(parseDiagnostics);
31281
32207
  let result;
31282
- if (!lastError || start2 !== lastError.start) {
32208
+ if (message.category === 3 /* Message */ && lastError && start2 === lastError.start && length2 === lastError.length) {
32209
+ result = createDetachedDiagnostic(fileName, sourceText, start2, length2, message, ...args);
32210
+ addRelatedInfo(lastError, result);
32211
+ } else if (!lastError || start2 !== lastError.start) {
31283
32212
  result = createDetachedDiagnostic(fileName, sourceText, start2, length2, message, ...args);
31284
32213
  parseDiagnostics.push(result);
31285
32214
  }
@@ -31435,7 +32364,7 @@ var Parser;
31435
32364
  parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */);
31436
32365
  return;
31437
32366
  }
31438
- const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText);
32367
+ const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, identity) ?? getSpaceSuggestion(expressionText);
31439
32368
  if (suggestion) {
31440
32369
  parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion);
31441
32370
  return;
@@ -42771,9 +43700,7 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
42771
43700
  extensionsToExtensionsArray(extensions),
42772
43701
  /*excludes*/
42773
43702
  void 0,
42774
- [
42775
- isDeclarationFileName(target) ? target.replace("*", "**/*") : changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))
42776
- ]
43703
+ [changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))]
42777
43704
  ).forEach((entry) => {
42778
43705
  entrypoints = appendIfUnique(entrypoints, {
42779
43706
  path: entry,
@@ -52442,7 +53369,7 @@ function createTypeChecker(host) {
52442
53369
  }
52443
53370
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
52444
53371
  }
52445
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
53372
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
52446
53373
  const name2 = typeParameterToName(type, context);
52447
53374
  context.approximateLength += idText(name2).length;
52448
53375
  return factory.createTypeReferenceNode(
@@ -53208,65 +54135,36 @@ function createTypeChecker(host) {
53208
54135
  true
53209
54136
  )[0];
53210
54137
  let cleanup;
53211
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
53212
- let pushFakeScope2 = function(kind2, addAll) {
53213
- Debug.assert(context.enclosingDeclaration);
53214
- let existingFakeScope;
53215
- if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
53216
- existingFakeScope = context.enclosingDeclaration;
53217
- } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
53218
- existingFakeScope = context.enclosingDeclaration.parent;
53219
- }
53220
- Debug.assertOptionalNode(existingFakeScope, isBlock);
53221
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
53222
- let newLocals;
53223
- addAll((name, symbol) => {
53224
- if (!locals.has(name)) {
53225
- newLocals = append(newLocals, name);
53226
- locals.set(name, symbol);
53227
- }
53228
- });
53229
- if (!newLocals)
53230
- return;
53231
- const oldCleanup = cleanup;
53232
- function undo() {
54138
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
54139
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
54140
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
54141
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
54142
+ let newLocals;
54143
+ for (const param of expandedParams) {
54144
+ if (!locals.has(param.escapedName)) {
54145
+ newLocals = append(newLocals, param.escapedName);
54146
+ locals.set(param.escapedName, param);
54147
+ }
54148
+ }
54149
+ if (newLocals) {
54150
+ let removeNewLocals2 = function() {
53233
54151
  forEach(newLocals, (s) => locals.delete(s));
53234
- oldCleanup == null ? void 0 : oldCleanup();
53235
- }
54152
+ };
54153
+ var removeNewLocals = removeNewLocals2;
53236
54154
  if (existingFakeScope) {
53237
- cleanup = undo;
54155
+ cleanup = removeNewLocals2;
53238
54156
  } else {
53239
54157
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
53240
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
54158
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
53241
54159
  fakeScope.locals = locals;
53242
54160
  const saveEnclosingDeclaration = context.enclosingDeclaration;
53243
54161
  setParent(fakeScope, saveEnclosingDeclaration);
53244
54162
  context.enclosingDeclaration = fakeScope;
53245
54163
  cleanup = () => {
53246
54164
  context.enclosingDeclaration = saveEnclosingDeclaration;
53247
- undo();
54165
+ removeNewLocals2();
53248
54166
  };
53249
54167
  }
53250
- };
53251
- var pushFakeScope = pushFakeScope2;
53252
- pushFakeScope2(
53253
- "params",
53254
- (add) => {
53255
- for (const param of expandedParams) {
53256
- add(param.escapedName, param);
53257
- }
53258
- }
53259
- );
53260
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53261
- pushFakeScope2(
53262
- "typeParams",
53263
- (add) => {
53264
- for (const typeParam of signature.typeParameters ?? emptyArray) {
53265
- const typeParamName = typeParameterToName(typeParam, context).escapedText;
53266
- add(typeParamName, typeParam.symbol);
53267
- }
53268
- }
53269
- );
53270
54168
  }
53271
54169
  }
53272
54170
  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));
@@ -53810,7 +54708,7 @@ function createTypeChecker(host) {
53810
54708
  return identifier;
53811
54709
  }
53812
54710
  }
53813
- function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
54711
+ function typeParameterShadowsNameInScope(escapedName, context, type) {
53814
54712
  const result = resolveName(
53815
54713
  context.enclosingDeclaration,
53816
54714
  escapedName,
@@ -53821,8 +54719,11 @@ function createTypeChecker(host) {
53821
54719
  /*isUse*/
53822
54720
  false
53823
54721
  );
53824
- if (result && result.flags & 262144 /* TypeParameter */) {
53825
- return result !== type.symbol;
54722
+ if (result) {
54723
+ if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
54724
+ return false;
54725
+ }
54726
+ return true;
53826
54727
  }
53827
54728
  return false;
53828
54729
  }
@@ -53848,7 +54749,7 @@ function createTypeChecker(host) {
53848
54749
  const rawtext = result.escapedText;
53849
54750
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
53850
54751
  let text = rawtext;
53851
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
54752
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
53852
54753
  i++;
53853
54754
  text = `${rawtext}_${i}`;
53854
54755
  }
@@ -53859,7 +54760,7 @@ function createTypeChecker(host) {
53859
54760
  }
53860
54761
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
53861
54762
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
53862
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
54763
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
53863
54764
  }
53864
54765
  return result;
53865
54766
  }
@@ -54004,10 +54905,7 @@ function createTypeChecker(host) {
54004
54905
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
54005
54906
  }
54006
54907
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
54007
- while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
54008
- enclosingDeclaration = enclosingDeclaration.parent;
54009
- }
54010
- return enclosingDeclaration;
54908
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
54011
54909
  }
54012
54910
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
54013
54911
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -54087,7 +54985,7 @@ function createTypeChecker(host) {
54087
54985
  }
54088
54986
  if (isIdentifier(node)) {
54089
54987
  const type = getDeclaredTypeOfSymbol(sym);
54090
- const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
54988
+ const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
54091
54989
  name.symbol = sym;
54092
54990
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
54093
54991
  }
@@ -57930,28 +58828,7 @@ function createTypeChecker(host) {
57930
58828
  }
57931
58829
  }
57932
58830
  }
57933
- let resolved = combineSymbolTables(earlySymbols, lateSymbols);
57934
- if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
57935
- for (const decl of symbol.declarations) {
57936
- const original = getSymbolLinks(decl.symbol)[resolutionKind];
57937
- if (!resolved) {
57938
- resolved = original;
57939
- continue;
57940
- }
57941
- if (!original)
57942
- continue;
57943
- original.forEach((s, name) => {
57944
- const existing = resolved.get(name);
57945
- if (!existing)
57946
- resolved.set(name, s);
57947
- else if (existing === s)
57948
- return;
57949
- else
57950
- resolved.set(name, mergeSymbol(existing, s));
57951
- });
57952
- }
57953
- }
57954
- links[resolutionKind] = resolved || emptySymbols;
58831
+ links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
57955
58832
  }
57956
58833
  return links[resolutionKind];
57957
58834
  }
@@ -140699,16 +141576,12 @@ function getRefactorActionsToConvertToTemplateString(context) {
140699
141576
  const { file, startPosition } = context;
140700
141577
  const node = getNodeOrParentOfParentheses(file, startPosition);
140701
141578
  const maybeBinary = getParentBinaryExpression(node);
140702
- const nodeIsStringLiteral = isStringLiteral(maybeBinary);
140703
141579
  const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
140704
- if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
140705
- return emptyArray;
140706
- }
140707
- if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) {
141580
+ if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
140708
141581
  refactorInfo.actions.push(convertStringAction);
140709
141582
  return [refactorInfo];
140710
141583
  } else if (context.preferences.provideRefactorNotApplicableReason) {
140711
- refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) });
141584
+ refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation) });
140712
141585
  return [refactorInfo];
140713
141586
  }
140714
141587
  return emptyArray;
@@ -161888,7 +162761,7 @@ function isPathRelativeToScript(path) {
161888
162761
  }
161889
162762
  return false;
161890
162763
  }
161891
- var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\3"]*)$/;
162764
+ var tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s*<reference\s+(path|types)\s*=\s*(?:'|"))([^\x03"]*)$/;
161892
162765
  var nodeModulesDependencyKeys = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
161893
162766
  function containsSlash(fragment) {
161894
162767
  return fragment.includes(directorySeparator);
@@ -172658,6 +173531,7 @@ __export(ts_exports2, {
172658
173531
  PrivateIdentifierKind: () => PrivateIdentifierKind,
172659
173532
  ProcessLevel: () => ProcessLevel,
172660
173533
  QuotePreference: () => QuotePreference,
173534
+ RegularExpressionFlags: () => RegularExpressionFlags,
172661
173535
  RelationComparisonResult: () => RelationComparisonResult,
172662
173536
  Rename: () => ts_Rename_exports,
172663
173537
  ScriptElementKind: () => ScriptElementKind,
@@ -172784,6 +173658,7 @@ __export(ts_exports2, {
172784
173658
  changeExtension: () => changeExtension,
172785
173659
  changesAffectModuleResolution: () => changesAffectModuleResolution,
172786
173660
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
173661
+ characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
172787
173662
  childIsDecorated: () => childIsDecorated,
172788
173663
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
172789
173664
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -174540,6 +175415,7 @@ __export(ts_exports2, {
174540
175415
  reducePathComponents: () => reducePathComponents,
174541
175416
  refactor: () => ts_refactor_exports,
174542
175417
  regExpEscape: () => regExpEscape,
175418
+ regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
174543
175419
  relativeComplement: () => relativeComplement,
174544
175420
  removeAllComments: () => removeAllComments,
174545
175421
  removeEmitHelper: () => removeEmitHelper,
@@ -187223,6 +188099,7 @@ start(initializeNodeSystem(), require("os").platform());
187223
188099
  PrivateIdentifierKind,
187224
188100
  ProcessLevel,
187225
188101
  QuotePreference,
188102
+ RegularExpressionFlags,
187226
188103
  RelationComparisonResult,
187227
188104
  Rename,
187228
188105
  ScriptElementKind,
@@ -187349,6 +188226,7 @@ start(initializeNodeSystem(), require("os").platform());
187349
188226
  changeExtension,
187350
188227
  changesAffectModuleResolution,
187351
188228
  changesAffectingProgramStructure,
188229
+ characterToRegularExpressionFlag,
187352
188230
  childIsDecorated,
187353
188231
  classElementOrClassElementParameterIsDecorated,
187354
188232
  classHasClassThisAssignment,
@@ -189105,6 +189983,7 @@ start(initializeNodeSystem(), require("os").platform());
189105
189983
  reducePathComponents,
189106
189984
  refactor,
189107
189985
  regExpEscape,
189986
+ regularExpressionFlagToCharacter,
189108
189987
  relativeComplement,
189109
189988
  removeAllComments,
189110
189989
  removeEmitHelper,