@typescript-deploys/pr-build 5.6.0-pr-59106-14 → 5.6.0-pr-59106-19

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.
Files changed (3) hide show
  1. package/lib/tsc.js +344 -343
  2. package/lib/typescript.js +344 -343
  3. package/package.json +1 -1
package/lib/tsc.js CHANGED
@@ -8035,21 +8035,24 @@ var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
8035
8035
  [64 /* UnicodeSets */, 99 /* RegularExpressionFlagsUnicodeSets */],
8036
8036
  [128 /* Sticky */, 2 /* RegularExpressionFlagsSticky */]
8037
8037
  ]);
8038
- var charcodeToTokenInfoCommon = [];
8039
- var charcodeToTokenInfoUncommon = /* @__PURE__ */ new Map();
8038
+ var tokenCategoryLookup = [];
8039
+ var tokenCategoryLookupUncommon = /* @__PURE__ */ new Map();
8040
8040
  for (let i = 0; i < 127 /* maxAsciiCharacter */; i++) {
8041
- charcodeToTokenInfoCommon.push(0);
8041
+ tokenCategoryLookup.push(0 /* IdentifierOrUnknown */);
8042
8042
  }
8043
8043
  for (const [key, value] of [
8044
8044
  // Line Break Whitespace
8045
8045
  [10 /* lineFeed */, 1024 /* LineBreak */],
8046
8046
  [13 /* carriageReturn */, 1024 /* LineBreak */],
8047
+ [8232 /* lineSeparator */, 1024 /* LineBreak */],
8048
+ [8233 /* paragraphSeparator */, 1024 /* LineBreak */],
8047
8049
  // Single Line Whitespace
8050
+ [32 /* space */, 512 /* Whitespace */],
8048
8051
  [9 /* tab */, 512 /* Whitespace */],
8049
8052
  [11 /* verticalTab */, 512 /* Whitespace */],
8050
8053
  [12 /* formFeed */, 512 /* Whitespace */],
8051
- [32 /* space */, 512 /* Whitespace */],
8052
8054
  [160 /* nonBreakingSpace */, 512 /* Whitespace */],
8055
+ [133 /* nextLine */, 512 /* Whitespace */],
8053
8056
  [5760 /* ogham */, 512 /* Whitespace */],
8054
8057
  [8192 /* enQuad */, 512 /* Whitespace */],
8055
8058
  [8193 /* emQuad */, 512 /* Whitespace */],
@@ -8111,10 +8114,10 @@ for (const [key, value] of [
8111
8114
  [35 /* hash */, 4096 /* RecognizedMisc */],
8112
8115
  [65533 /* replacementCharacter */, 4096 /* RecognizedMisc */]
8113
8116
  ]) {
8114
- if (key < charcodeToTokenInfoCommon.length) {
8115
- charcodeToTokenInfoCommon[key] = value;
8117
+ if (key < tokenCategoryLookup.length) {
8118
+ tokenCategoryLookup[key] = value;
8116
8119
  } else {
8117
- charcodeToTokenInfoUncommon.set(key, value);
8120
+ tokenCategoryLookupUncommon.set(key, value);
8118
8121
  }
8119
8122
  }
8120
8123
  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];
@@ -9304,386 +9307,384 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9304
9307
  return token = 4 /* NewLineTrivia */;
9305
9308
  }
9306
9309
  }
9307
- const tokenInfo = ch < charcodeToTokenInfoCommon.length ? charcodeToTokenInfoCommon[ch] : charcodeToTokenInfoUncommon.get(ch) ?? 0 /* None */;
9308
- if (tokenInfo !== 0 /* None */) {
9309
- if (tokenInfo & 512 /* Whitespace */) {
9310
- if (skipTrivia2) {
9311
- pos++;
9312
- continue;
9313
- } else {
9314
- while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
9315
- pos++;
9316
- }
9317
- return token = 5 /* WhitespaceTrivia */;
9318
- }
9310
+ const tokenCategory = ch < tokenCategoryLookup.length ? tokenCategoryLookup[ch] : tokenCategoryLookupUncommon.get(ch) ?? 0 /* IdentifierOrUnknown */;
9311
+ if (tokenCategory === 0 /* IdentifierOrUnknown */) {
9312
+ const identifierKind = scanIdentifier(ch, languageVersion);
9313
+ if (identifierKind) {
9314
+ return token = identifierKind;
9319
9315
  }
9320
- if (tokenInfo & 256 /* SimpleToken */) {
9316
+ const size = charSize(ch);
9317
+ error(Diagnostics.Invalid_character, pos, size);
9318
+ pos += size;
9319
+ return token = 0 /* Unknown */;
9320
+ }
9321
+ if (tokenCategory & 512 /* Whitespace */) {
9322
+ if (skipTrivia2) {
9321
9323
  pos++;
9322
- return token = tokenInfo & 255 /* SimpleTokenMask */;
9323
- }
9324
- if (tokenInfo & 2048 /* Digit */) {
9325
- if (ch === 48 /* _0 */) {
9326
- if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 88 /* X */ || charCodeUnchecked(pos + 1) === 120 /* x */)) {
9327
- pos += 2;
9328
- tokenValue = scanMinimumNumberOfHexDigits(
9329
- 1,
9330
- /*canHaveSeparators*/
9331
- true
9332
- );
9333
- if (!tokenValue) {
9334
- error(Diagnostics.Hexadecimal_digit_expected);
9335
- tokenValue = "0";
9336
- }
9337
- tokenValue = "0x" + tokenValue;
9338
- tokenFlags |= 64 /* HexSpecifier */;
9339
- return token = checkBigIntSuffix();
9340
- } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 66 /* B */ || charCodeUnchecked(pos + 1) === 98 /* b */)) {
9341
- pos += 2;
9342
- tokenValue = scanBinaryOrOctalDigits(
9343
- /* base */
9344
- 2
9345
- );
9346
- if (!tokenValue) {
9347
- error(Diagnostics.Binary_digit_expected);
9348
- tokenValue = "0";
9349
- }
9350
- tokenValue = "0b" + tokenValue;
9351
- tokenFlags |= 128 /* BinarySpecifier */;
9352
- return token = checkBigIntSuffix();
9353
- } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 79 /* O */ || charCodeUnchecked(pos + 1) === 111 /* o */)) {
9354
- pos += 2;
9355
- tokenValue = scanBinaryOrOctalDigits(
9356
- /* base */
9357
- 8
9358
- );
9359
- if (!tokenValue) {
9360
- error(Diagnostics.Octal_digit_expected);
9361
- tokenValue = "0";
9362
- }
9363
- tokenValue = "0o" + tokenValue;
9364
- tokenFlags |= 256 /* OctalSpecifier */;
9365
- return token = checkBigIntSuffix();
9366
- }
9324
+ continue;
9325
+ } else {
9326
+ while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
9327
+ pos++;
9367
9328
  }
9368
- return token = scanNumber();
9329
+ return token = 5 /* WhitespaceTrivia */;
9369
9330
  }
9370
- Debug.assert(tokenInfo & 4096 /* RecognizedMisc */);
9371
- switch (ch) {
9372
- case 33 /* exclamation */:
9373
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9374
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9375
- return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */;
9376
- }
9377
- return pos += 2, token = 36 /* ExclamationEqualsToken */;
9331
+ }
9332
+ if (tokenCategory & 1024 /* LineBreak */) {
9333
+ tokenFlags |= 1 /* PrecedingLineBreak */;
9334
+ pos += charSize(ch);
9335
+ continue;
9336
+ }
9337
+ if (tokenCategory & 256 /* SimpleToken */) {
9338
+ pos++;
9339
+ return token = tokenCategory & 255 /* SimpleTokenMask */;
9340
+ }
9341
+ if (tokenCategory & 2048 /* Digit */) {
9342
+ if (ch === 48 /* _0 */) {
9343
+ if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 88 /* X */ || charCodeUnchecked(pos + 1) === 120 /* x */)) {
9344
+ pos += 2;
9345
+ tokenValue = scanMinimumNumberOfHexDigits(
9346
+ 1,
9347
+ /*canHaveSeparators*/
9348
+ true
9349
+ );
9350
+ if (!tokenValue) {
9351
+ error(Diagnostics.Hexadecimal_digit_expected);
9352
+ tokenValue = "0";
9378
9353
  }
9379
- pos++;
9380
- return token = 54 /* ExclamationToken */;
9381
- case 34 /* doubleQuote */:
9382
- case 39 /* singleQuote */:
9383
- tokenValue = scanString();
9384
- return token = 11 /* StringLiteral */;
9385
- case 96 /* backtick */:
9386
- return token = scanTemplateAndSetTokenValue(
9387
- /*shouldEmitInvalidEscapeError*/
9388
- false
9354
+ tokenValue = "0x" + tokenValue;
9355
+ tokenFlags |= 64 /* HexSpecifier */;
9356
+ return token = checkBigIntSuffix();
9357
+ } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 66 /* B */ || charCodeUnchecked(pos + 1) === 98 /* b */)) {
9358
+ pos += 2;
9359
+ tokenValue = scanBinaryOrOctalDigits(
9360
+ /* base */
9361
+ 2
9389
9362
  );
9390
- case 37 /* percent */:
9391
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9392
- return pos += 2, token = 70 /* PercentEqualsToken */;
9363
+ if (!tokenValue) {
9364
+ error(Diagnostics.Binary_digit_expected);
9365
+ tokenValue = "0";
9393
9366
  }
9394
- pos++;
9395
- return token = 45 /* PercentToken */;
9396
- case 38 /* ampersand */:
9397
- if (charCodeUnchecked(pos + 1) === 38 /* ampersand */) {
9398
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9399
- return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */;
9400
- }
9401
- return pos += 2, token = 56 /* AmpersandAmpersandToken */;
9367
+ tokenValue = "0b" + tokenValue;
9368
+ tokenFlags |= 128 /* BinarySpecifier */;
9369
+ return token = checkBigIntSuffix();
9370
+ } else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === 79 /* O */ || charCodeUnchecked(pos + 1) === 111 /* o */)) {
9371
+ pos += 2;
9372
+ tokenValue = scanBinaryOrOctalDigits(
9373
+ /* base */
9374
+ 8
9375
+ );
9376
+ if (!tokenValue) {
9377
+ error(Diagnostics.Octal_digit_expected);
9378
+ tokenValue = "0";
9402
9379
  }
9403
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9404
- return pos += 2, token = 74 /* AmpersandEqualsToken */;
9380
+ tokenValue = "0o" + tokenValue;
9381
+ tokenFlags |= 256 /* OctalSpecifier */;
9382
+ return token = checkBigIntSuffix();
9383
+ }
9384
+ }
9385
+ return token = scanNumber();
9386
+ }
9387
+ if (!(tokenCategory & 4096 /* RecognizedMisc */)) Debug.fail(`Unhandled token category ${tokenCategory}`);
9388
+ switch (ch) {
9389
+ case 33 /* exclamation */:
9390
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9391
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9392
+ return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */;
9405
9393
  }
9406
- pos++;
9407
- return token = 51 /* AmpersandToken */;
9408
- case 42 /* asterisk */:
9409
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9410
- return pos += 2, token = 67 /* AsteriskEqualsToken */;
9394
+ return pos += 2, token = 36 /* ExclamationEqualsToken */;
9395
+ }
9396
+ pos++;
9397
+ return token = 54 /* ExclamationToken */;
9398
+ case 34 /* doubleQuote */:
9399
+ case 39 /* singleQuote */:
9400
+ tokenValue = scanString();
9401
+ return token = 11 /* StringLiteral */;
9402
+ case 96 /* backtick */:
9403
+ return token = scanTemplateAndSetTokenValue(
9404
+ /*shouldEmitInvalidEscapeError*/
9405
+ false
9406
+ );
9407
+ case 37 /* percent */:
9408
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9409
+ return pos += 2, token = 70 /* PercentEqualsToken */;
9410
+ }
9411
+ pos++;
9412
+ return token = 45 /* PercentToken */;
9413
+ case 38 /* ampersand */:
9414
+ if (charCodeUnchecked(pos + 1) === 38 /* ampersand */) {
9415
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9416
+ return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */;
9411
9417
  }
9412
- if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
9413
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9414
- return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */;
9418
+ return pos += 2, token = 56 /* AmpersandAmpersandToken */;
9419
+ }
9420
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9421
+ return pos += 2, token = 74 /* AmpersandEqualsToken */;
9422
+ }
9423
+ pos++;
9424
+ return token = 51 /* AmpersandToken */;
9425
+ case 42 /* asterisk */:
9426
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9427
+ return pos += 2, token = 67 /* AsteriskEqualsToken */;
9428
+ }
9429
+ if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
9430
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9431
+ return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */;
9432
+ }
9433
+ return pos += 2, token = 43 /* AsteriskAsteriskToken */;
9434
+ }
9435
+ pos++;
9436
+ if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
9437
+ asteriskSeen = true;
9438
+ continue;
9439
+ }
9440
+ return token = 42 /* AsteriskToken */;
9441
+ case 43 /* plus */:
9442
+ if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
9443
+ return pos += 2, token = 46 /* PlusPlusToken */;
9444
+ }
9445
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9446
+ return pos += 2, token = 65 /* PlusEqualsToken */;
9447
+ }
9448
+ pos++;
9449
+ return token = 40 /* PlusToken */;
9450
+ case 45 /* minus */:
9451
+ if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
9452
+ return pos += 2, token = 47 /* MinusMinusToken */;
9453
+ }
9454
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9455
+ return pos += 2, token = 66 /* MinusEqualsToken */;
9456
+ }
9457
+ pos++;
9458
+ return token = 41 /* MinusToken */;
9459
+ case 46 /* dot */:
9460
+ if (isDigit(charCodeUnchecked(pos + 1))) {
9461
+ scanNumber();
9462
+ return token = 9 /* NumericLiteral */;
9463
+ }
9464
+ if (charCodeUnchecked(pos + 1) === 46 /* dot */ && charCodeUnchecked(pos + 2) === 46 /* dot */) {
9465
+ return pos += 3, token = 26 /* DotDotDotToken */;
9466
+ }
9467
+ pos++;
9468
+ return token = 25 /* DotToken */;
9469
+ case 47 /* slash */:
9470
+ if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
9471
+ pos += 2;
9472
+ while (pos < end) {
9473
+ if (isLineBreak(charCodeUnchecked(pos))) {
9474
+ break;
9415
9475
  }
9416
- return pos += 2, token = 43 /* AsteriskAsteriskToken */;
9476
+ pos++;
9417
9477
  }
9418
- pos++;
9419
- if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
9420
- asteriskSeen = true;
9478
+ commentDirectives = appendIfCommentDirective(
9479
+ commentDirectives,
9480
+ text.slice(tokenStart, pos),
9481
+ commentDirectiveRegExSingleLine,
9482
+ tokenStart
9483
+ );
9484
+ if (skipTrivia2) {
9421
9485
  continue;
9486
+ } else {
9487
+ return token = 2 /* SingleLineCommentTrivia */;
9422
9488
  }
9423
- return token = 42 /* AsteriskToken */;
9424
- case 43 /* plus */:
9425
- if (charCodeUnchecked(pos + 1) === 43 /* plus */) {
9426
- return pos += 2, token = 46 /* PlusPlusToken */;
9427
- }
9428
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9429
- return pos += 2, token = 65 /* PlusEqualsToken */;
9430
- }
9431
- pos++;
9432
- return token = 40 /* PlusToken */;
9433
- case 45 /* minus */:
9434
- if (charCodeUnchecked(pos + 1) === 45 /* minus */) {
9435
- return pos += 2, token = 47 /* MinusMinusToken */;
9436
- }
9437
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9438
- return pos += 2, token = 66 /* MinusEqualsToken */;
9439
- }
9440
- pos++;
9441
- return token = 41 /* MinusToken */;
9442
- case 46 /* dot */:
9443
- if (isDigit(charCodeUnchecked(pos + 1))) {
9444
- scanNumber();
9445
- return token = 9 /* NumericLiteral */;
9446
- }
9447
- if (charCodeUnchecked(pos + 1) === 46 /* dot */ && charCodeUnchecked(pos + 2) === 46 /* dot */) {
9448
- return pos += 3, token = 26 /* DotDotDotToken */;
9449
- }
9450
- pos++;
9451
- return token = 25 /* DotToken */;
9452
- case 47 /* slash */:
9453
- if (charCodeUnchecked(pos + 1) === 47 /* slash */) {
9454
- pos += 2;
9455
- while (pos < end) {
9456
- if (isLineBreak(charCodeUnchecked(pos))) {
9457
- break;
9458
- }
9459
- pos++;
9460
- }
9461
- commentDirectives = appendIfCommentDirective(
9462
- commentDirectives,
9463
- text.slice(tokenStart, pos),
9464
- commentDirectiveRegExSingleLine,
9465
- tokenStart
9466
- );
9467
- if (skipTrivia2) {
9468
- continue;
9469
- } else {
9470
- return token = 2 /* SingleLineCommentTrivia */;
9471
- }
9472
- }
9473
- if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
9474
- pos += 2;
9475
- const isJSDoc2 = charCodeUnchecked(pos) === 42 /* asterisk */ && charCodeUnchecked(pos + 1) !== 47 /* slash */;
9476
- let commentClosed = false;
9477
- let lastLineStart = tokenStart;
9478
- while (pos < end) {
9479
- const ch2 = charCodeUnchecked(pos);
9480
- if (ch2 === 42 /* asterisk */ && charCodeUnchecked(pos + 1) === 47 /* slash */) {
9481
- pos += 2;
9482
- commentClosed = true;
9483
- break;
9484
- }
9485
- pos++;
9486
- if (isLineBreak(ch2)) {
9487
- lastLineStart = pos;
9488
- tokenFlags |= 1 /* PrecedingLineBreak */;
9489
- }
9490
- }
9491
- if (isJSDoc2 && shouldParseJSDoc()) {
9492
- tokenFlags |= 2 /* PrecedingJSDocComment */;
9493
- }
9494
- commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
9495
- if (!commentClosed) {
9496
- error(Diagnostics.Asterisk_Slash_expected);
9489
+ }
9490
+ if (charCodeUnchecked(pos + 1) === 42 /* asterisk */) {
9491
+ pos += 2;
9492
+ const isJSDoc2 = charCodeUnchecked(pos) === 42 /* asterisk */ && charCodeUnchecked(pos + 1) !== 47 /* slash */;
9493
+ let commentClosed = false;
9494
+ let lastLineStart = tokenStart;
9495
+ while (pos < end) {
9496
+ const ch2 = charCodeUnchecked(pos);
9497
+ if (ch2 === 42 /* asterisk */ && charCodeUnchecked(pos + 1) === 47 /* slash */) {
9498
+ pos += 2;
9499
+ commentClosed = true;
9500
+ break;
9497
9501
  }
9498
- if (skipTrivia2) {
9499
- continue;
9500
- } else {
9501
- if (!commentClosed) {
9502
- tokenFlags |= 4 /* Unterminated */;
9503
- }
9504
- return token = 3 /* MultiLineCommentTrivia */;
9502
+ pos++;
9503
+ if (isLineBreak(ch2)) {
9504
+ lastLineStart = pos;
9505
+ tokenFlags |= 1 /* PrecedingLineBreak */;
9505
9506
  }
9506
9507
  }
9507
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9508
- return pos += 2, token = 69 /* SlashEqualsToken */;
9508
+ if (isJSDoc2 && shouldParseJSDoc()) {
9509
+ tokenFlags |= 2 /* PrecedingJSDocComment */;
9509
9510
  }
9510
- pos++;
9511
- return token = 44 /* SlashToken */;
9512
- case 60 /* lessThan */:
9513
- if (isConflictMarkerTrivia(text, pos)) {
9514
- pos = scanConflictMarkerTrivia(text, pos, error);
9515
- if (skipTrivia2) {
9516
- continue;
9517
- } else {
9518
- return token = 7 /* ConflictMarkerTrivia */;
9519
- }
9511
+ commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
9512
+ if (!commentClosed) {
9513
+ error(Diagnostics.Asterisk_Slash_expected);
9520
9514
  }
9521
- if (charCodeUnchecked(pos + 1) === 60 /* lessThan */) {
9522
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9523
- return pos += 3, token = 71 /* LessThanLessThanEqualsToken */;
9515
+ if (skipTrivia2) {
9516
+ continue;
9517
+ } else {
9518
+ if (!commentClosed) {
9519
+ tokenFlags |= 4 /* Unterminated */;
9524
9520
  }
9525
- return pos += 2, token = 48 /* LessThanLessThanToken */;
9521
+ return token = 3 /* MultiLineCommentTrivia */;
9526
9522
  }
9527
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9528
- return pos += 2, token = 33 /* LessThanEqualsToken */;
9529
- }
9530
- if (languageVariant === 1 /* JSX */ && charCodeUnchecked(pos + 1) === 47 /* slash */ && charCodeUnchecked(pos + 2) !== 42 /* asterisk */) {
9531
- return pos += 2, token = 31 /* LessThanSlashToken */;
9523
+ }
9524
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9525
+ return pos += 2, token = 69 /* SlashEqualsToken */;
9526
+ }
9527
+ pos++;
9528
+ return token = 44 /* SlashToken */;
9529
+ case 60 /* lessThan */:
9530
+ if (isConflictMarkerTrivia(text, pos)) {
9531
+ pos = scanConflictMarkerTrivia(text, pos, error);
9532
+ if (skipTrivia2) {
9533
+ continue;
9534
+ } else {
9535
+ return token = 7 /* ConflictMarkerTrivia */;
9532
9536
  }
9533
- pos++;
9534
- return token = 30 /* LessThanToken */;
9535
- case 61 /* equals */:
9536
- if (isConflictMarkerTrivia(text, pos)) {
9537
- pos = scanConflictMarkerTrivia(text, pos, error);
9538
- if (skipTrivia2) {
9539
- continue;
9540
- } else {
9541
- return token = 7 /* ConflictMarkerTrivia */;
9542
- }
9537
+ }
9538
+ if (charCodeUnchecked(pos + 1) === 60 /* lessThan */) {
9539
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9540
+ return pos += 3, token = 71 /* LessThanLessThanEqualsToken */;
9543
9541
  }
9544
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9545
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9546
- return pos += 3, token = 37 /* EqualsEqualsEqualsToken */;
9547
- }
9548
- return pos += 2, token = 35 /* EqualsEqualsToken */;
9542
+ return pos += 2, token = 48 /* LessThanLessThanToken */;
9543
+ }
9544
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9545
+ return pos += 2, token = 33 /* LessThanEqualsToken */;
9546
+ }
9547
+ if (languageVariant === 1 /* JSX */ && charCodeUnchecked(pos + 1) === 47 /* slash */ && charCodeUnchecked(pos + 2) !== 42 /* asterisk */) {
9548
+ return pos += 2, token = 31 /* LessThanSlashToken */;
9549
+ }
9550
+ pos++;
9551
+ return token = 30 /* LessThanToken */;
9552
+ case 61 /* equals */:
9553
+ if (isConflictMarkerTrivia(text, pos)) {
9554
+ pos = scanConflictMarkerTrivia(text, pos, error);
9555
+ if (skipTrivia2) {
9556
+ continue;
9557
+ } else {
9558
+ return token = 7 /* ConflictMarkerTrivia */;
9549
9559
  }
9550
- if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
9551
- return pos += 2, token = 39 /* EqualsGreaterThanToken */;
9560
+ }
9561
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9562
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9563
+ return pos += 3, token = 37 /* EqualsEqualsEqualsToken */;
9552
9564
  }
9553
- pos++;
9554
- return token = 64 /* EqualsToken */;
9555
- case 62 /* greaterThan */:
9556
- if (isConflictMarkerTrivia(text, pos)) {
9557
- pos = scanConflictMarkerTrivia(text, pos, error);
9558
- if (skipTrivia2) {
9559
- continue;
9560
- } else {
9561
- return token = 7 /* ConflictMarkerTrivia */;
9562
- }
9565
+ return pos += 2, token = 35 /* EqualsEqualsToken */;
9566
+ }
9567
+ if (charCodeUnchecked(pos + 1) === 62 /* greaterThan */) {
9568
+ return pos += 2, token = 39 /* EqualsGreaterThanToken */;
9569
+ }
9570
+ pos++;
9571
+ return token = 64 /* EqualsToken */;
9572
+ case 62 /* greaterThan */:
9573
+ if (isConflictMarkerTrivia(text, pos)) {
9574
+ pos = scanConflictMarkerTrivia(text, pos, error);
9575
+ if (skipTrivia2) {
9576
+ continue;
9577
+ } else {
9578
+ return token = 7 /* ConflictMarkerTrivia */;
9563
9579
  }
9564
- pos++;
9565
- return token = 32 /* GreaterThanToken */;
9566
- case 63 /* question */:
9567
- if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
9568
- return pos += 2, token = 29 /* QuestionDotToken */;
9580
+ }
9581
+ pos++;
9582
+ return token = 32 /* GreaterThanToken */;
9583
+ case 63 /* question */:
9584
+ if (charCodeUnchecked(pos + 1) === 46 /* dot */ && !isDigit(charCodeUnchecked(pos + 2))) {
9585
+ return pos += 2, token = 29 /* QuestionDotToken */;
9586
+ }
9587
+ if (charCodeUnchecked(pos + 1) === 63 /* question */) {
9588
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9589
+ return pos += 3, token = 78 /* QuestionQuestionEqualsToken */;
9569
9590
  }
9570
- if (charCodeUnchecked(pos + 1) === 63 /* question */) {
9571
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9572
- return pos += 3, token = 78 /* QuestionQuestionEqualsToken */;
9573
- }
9574
- return pos += 2, token = 61 /* QuestionQuestionToken */;
9591
+ return pos += 2, token = 61 /* QuestionQuestionToken */;
9592
+ }
9593
+ pos++;
9594
+ return token = 58 /* QuestionToken */;
9595
+ case 94 /* caret */:
9596
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9597
+ return pos += 2, token = 79 /* CaretEqualsToken */;
9598
+ }
9599
+ pos++;
9600
+ return token = 53 /* CaretToken */;
9601
+ case 124 /* bar */:
9602
+ if (isConflictMarkerTrivia(text, pos)) {
9603
+ pos = scanConflictMarkerTrivia(text, pos, error);
9604
+ if (skipTrivia2) {
9605
+ continue;
9606
+ } else {
9607
+ return token = 7 /* ConflictMarkerTrivia */;
9575
9608
  }
9576
- pos++;
9577
- return token = 58 /* QuestionToken */;
9578
- case 94 /* caret */:
9579
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9580
- return pos += 2, token = 79 /* CaretEqualsToken */;
9609
+ }
9610
+ if (charCodeUnchecked(pos + 1) === 124 /* bar */) {
9611
+ if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9612
+ return pos += 3, token = 76 /* BarBarEqualsToken */;
9581
9613
  }
9582
- pos++;
9583
- return token = 53 /* CaretToken */;
9584
- case 124 /* bar */:
9585
- if (isConflictMarkerTrivia(text, pos)) {
9586
- pos = scanConflictMarkerTrivia(text, pos, error);
9614
+ return pos += 2, token = 57 /* BarBarToken */;
9615
+ }
9616
+ if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9617
+ return pos += 2, token = 75 /* BarEqualsToken */;
9618
+ }
9619
+ pos++;
9620
+ return token = 52 /* BarToken */;
9621
+ case 92 /* backslash */:
9622
+ const extendedCookedChar = peekExtendedUnicodeEscape();
9623
+ if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9624
+ tokenValue = scanExtendedUnicodeEscape(
9625
+ /*shouldEmitInvalidEscapeError*/
9626
+ true
9627
+ ) + scanIdentifierParts();
9628
+ return token = getIdentifierToken();
9629
+ }
9630
+ const cookedChar = peekUnicodeEscape();
9631
+ if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
9632
+ pos += 6;
9633
+ tokenFlags |= 1024 /* UnicodeEscape */;
9634
+ tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
9635
+ return token = getIdentifierToken();
9636
+ }
9637
+ error(Diagnostics.Invalid_character);
9638
+ pos++;
9639
+ return token = 0 /* Unknown */;
9640
+ case 35 /* hash */:
9641
+ const charAfterHash = codePointUnchecked(pos + 1);
9642
+ if (charAfterHash === 33 /* exclamation */) {
9643
+ if (pos === 0) {
9644
+ pos = scanShebangTrivia(text, pos);
9587
9645
  if (skipTrivia2) {
9588
9646
  continue;
9589
9647
  } else {
9590
- return token = 7 /* ConflictMarkerTrivia */;
9648
+ return token = 6 /* ShebangTrivia */;
9591
9649
  }
9650
+ } else if (pos !== 0) {
9651
+ error(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
9652
+ pos++;
9653
+ return token = 0 /* Unknown */;
9592
9654
  }
9593
- if (charCodeUnchecked(pos + 1) === 124 /* bar */) {
9594
- if (charCodeUnchecked(pos + 2) === 61 /* equals */) {
9595
- return pos += 3, token = 76 /* BarBarEqualsToken */;
9596
- }
9597
- return pos += 2, token = 57 /* BarBarToken */;
9598
- }
9599
- if (charCodeUnchecked(pos + 1) === 61 /* equals */) {
9600
- return pos += 2, token = 75 /* BarEqualsToken */;
9601
- }
9655
+ }
9656
+ if (charAfterHash === 92 /* backslash */) {
9602
9657
  pos++;
9603
- return token = 52 /* BarToken */;
9604
- case 92 /* backslash */:
9605
- const extendedCookedChar = peekExtendedUnicodeEscape();
9606
- if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
9607
- tokenValue = scanExtendedUnicodeEscape(
9658
+ const extendedCookedChar2 = peekExtendedUnicodeEscape();
9659
+ if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
9660
+ tokenValue = "#" + scanExtendedUnicodeEscape(
9608
9661
  /*shouldEmitInvalidEscapeError*/
9609
9662
  true
9610
9663
  ) + scanIdentifierParts();
9611
- return token = getIdentifierToken();
9664
+ return token = 81 /* PrivateIdentifier */;
9612
9665
  }
9613
- const cookedChar = peekUnicodeEscape();
9614
- if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
9666
+ const cookedChar2 = peekUnicodeEscape();
9667
+ if (cookedChar2 >= 0 && isIdentifierStart(cookedChar2, languageVersion)) {
9615
9668
  pos += 6;
9616
9669
  tokenFlags |= 1024 /* UnicodeEscape */;
9617
- tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
9618
- return token = getIdentifierToken();
9670
+ tokenValue = "#" + String.fromCharCode(cookedChar2) + scanIdentifierParts();
9671
+ return token = 81 /* PrivateIdentifier */;
9619
9672
  }
9620
- error(Diagnostics.Invalid_character);
9673
+ pos--;
9674
+ }
9675
+ if (isIdentifierStart(charAfterHash, languageVersion)) {
9621
9676
  pos++;
9622
- return token = 0 /* Unknown */;
9623
- case 35 /* hash */:
9624
- const charAfterHash = codePointUnchecked(pos + 1);
9625
- if (charAfterHash === 33 /* exclamation */) {
9626
- if (pos === 0) {
9627
- pos = scanShebangTrivia(text, pos);
9628
- if (skipTrivia2) {
9629
- continue;
9630
- } else {
9631
- return token = 6 /* ShebangTrivia */;
9632
- }
9633
- } else if (pos !== 0) {
9634
- error(Diagnostics.can_only_be_used_at_the_start_of_a_file, pos, 2);
9635
- pos++;
9636
- return token = 0 /* Unknown */;
9637
- }
9638
- }
9639
- if (charAfterHash === 92 /* backslash */) {
9640
- pos++;
9641
- const extendedCookedChar2 = peekExtendedUnicodeEscape();
9642
- if (extendedCookedChar2 >= 0 && isIdentifierStart(extendedCookedChar2, languageVersion)) {
9643
- tokenValue = "#" + scanExtendedUnicodeEscape(
9644
- /*shouldEmitInvalidEscapeError*/
9645
- true
9646
- ) + scanIdentifierParts();
9647
- return token = 81 /* PrivateIdentifier */;
9648
- }
9649
- const cookedChar2 = peekUnicodeEscape();
9650
- if (cookedChar2 >= 0 && isIdentifierStart(cookedChar2, languageVersion)) {
9651
- pos += 6;
9652
- tokenFlags |= 1024 /* UnicodeEscape */;
9653
- tokenValue = "#" + String.fromCharCode(cookedChar2) + scanIdentifierParts();
9654
- return token = 81 /* PrivateIdentifier */;
9655
- }
9656
- pos--;
9657
- }
9658
- if (isIdentifierStart(charAfterHash, languageVersion)) {
9659
- pos++;
9660
- scanIdentifier(charAfterHash, languageVersion);
9661
- } else {
9662
- tokenValue = "#";
9663
- error(Diagnostics.Invalid_character, pos++, charSize(ch));
9664
- }
9665
- return token = 81 /* PrivateIdentifier */;
9666
- case 65533 /* replacementCharacter */:
9667
- error(Diagnostics.File_appears_to_be_binary, 0, 0);
9668
- pos = end;
9669
- return token = 8 /* NonTextFileMarkerTrivia */;
9670
- }
9671
- }
9672
- const identifierKind = scanIdentifier(ch, languageVersion);
9673
- if (identifierKind) {
9674
- return token = identifierKind;
9675
- } else if (isWhiteSpaceSingleLine(ch)) {
9676
- pos += charSize(ch);
9677
- continue;
9678
- } else if (isLineBreak(ch)) {
9679
- tokenFlags |= 1 /* PrecedingLineBreak */;
9680
- pos += charSize(ch);
9681
- continue;
9677
+ scanIdentifier(charAfterHash, languageVersion);
9678
+ } else {
9679
+ tokenValue = "#";
9680
+ error(Diagnostics.Invalid_character, pos++, charSize(ch));
9681
+ }
9682
+ return token = 81 /* PrivateIdentifier */;
9683
+ case 65533 /* replacementCharacter */:
9684
+ error(Diagnostics.File_appears_to_be_binary, 0, 0);
9685
+ pos = end;
9686
+ return token = 8 /* NonTextFileMarkerTrivia */;
9682
9687
  }
9683
- const size = charSize(ch);
9684
- error(Diagnostics.Invalid_character, pos, size);
9685
- pos += size;
9686
- return token = 0 /* Unknown */;
9687
9688
  }
9688
9689
  }
9689
9690
  function shouldParseJSDoc() {