@@ -1366,6 +1366,136 @@ public enum RawTokenKind: Equatable, Hashable {
1366
1366
}
1367
1367
}
1368
1368
1369
+ public var nameForDiagnostics : String {
1370
+ switch self {
1371
+ case . eof: return " end of file "
1372
+ case . associatedtypeKeyword: return " associatedtype "
1373
+ case . classKeyword: return " class "
1374
+ case . deinitKeyword: return " deinit "
1375
+ case . enumKeyword: return " enum "
1376
+ case . extensionKeyword: return " extension "
1377
+ case . funcKeyword: return " func "
1378
+ case . importKeyword: return " import "
1379
+ case . initKeyword: return " init "
1380
+ case . inoutKeyword: return " inout "
1381
+ case . letKeyword: return " let "
1382
+ case . operatorKeyword: return " operator "
1383
+ case . precedencegroupKeyword: return " precedencegroup "
1384
+ case . protocolKeyword: return " protocol "
1385
+ case . structKeyword: return " struct "
1386
+ case . subscriptKeyword: return " subscript "
1387
+ case . typealiasKeyword: return " typealias "
1388
+ case . varKeyword: return " var "
1389
+ case . fileprivateKeyword: return " fileprivate "
1390
+ case . internalKeyword: return " internal "
1391
+ case . privateKeyword: return " private "
1392
+ case . publicKeyword: return " public "
1393
+ case . staticKeyword: return " static "
1394
+ case . deferKeyword: return " defer "
1395
+ case . ifKeyword: return " if "
1396
+ case . guardKeyword: return " guard "
1397
+ case . doKeyword: return " do "
1398
+ case . repeatKeyword: return " repeat "
1399
+ case . elseKeyword: return " else "
1400
+ case . forKeyword: return " for "
1401
+ case . inKeyword: return " in "
1402
+ case . whileKeyword: return " while "
1403
+ case . returnKeyword: return " return "
1404
+ case . breakKeyword: return " break "
1405
+ case . continueKeyword: return " continue "
1406
+ case . fallthroughKeyword: return " fallthrough "
1407
+ case . switchKeyword: return " switch "
1408
+ case . caseKeyword: return " case "
1409
+ case . defaultKeyword: return " default "
1410
+ case . whereKeyword: return " where "
1411
+ case . catchKeyword: return " catch "
1412
+ case . throwKeyword: return " throw "
1413
+ case . asKeyword: return " as "
1414
+ case . anyKeyword: return " Any "
1415
+ case . falseKeyword: return " false "
1416
+ case . isKeyword: return " is "
1417
+ case . nilKeyword: return " nil "
1418
+ case . rethrowsKeyword: return " rethrows "
1419
+ case . superKeyword: return " super "
1420
+ case . selfKeyword: return " self "
1421
+ case . capitalSelfKeyword: return " Self "
1422
+ case . trueKeyword: return " true "
1423
+ case . tryKeyword: return " try "
1424
+ case . throwsKeyword: return " throws "
1425
+ case . __file__Keyword: return " __FILE__ "
1426
+ case . __line__Keyword: return " __LINE__ "
1427
+ case . __column__Keyword: return " __COLUMN__ "
1428
+ case . __function__Keyword: return " __FUNCTION__ "
1429
+ case . __dso_handle__Keyword: return " __DSO_HANDLE__ "
1430
+ case . wildcardKeyword: return " _ "
1431
+ case . leftParen: return " ( "
1432
+ case . rightParen: return " ) "
1433
+ case . leftBrace: return " { "
1434
+ case . rightBrace: return " } "
1435
+ case . leftSquareBracket: return " [ "
1436
+ case . rightSquareBracket: return " ] "
1437
+ case . leftAngle: return " < "
1438
+ case . rightAngle: return " > "
1439
+ case . period: return " . "
1440
+ case . prefixPeriod: return " . "
1441
+ case . comma: return " , "
1442
+ case . ellipsis: return " ... "
1443
+ case . colon: return " : "
1444
+ case . semicolon: return " ; "
1445
+ case . equal: return " = "
1446
+ case . atSign: return " @ "
1447
+ case . pound: return " # "
1448
+ case . prefixAmpersand: return " & "
1449
+ case . arrow: return " -> "
1450
+ case . backtick: return " ` "
1451
+ case . backslash: return " \\ "
1452
+ case . exclamationMark: return " ! "
1453
+ case . postfixQuestionMark: return " ? "
1454
+ case . infixQuestionMark: return " ? "
1455
+ case . stringQuote: return " \" "
1456
+ case . singleQuote: return " \' "
1457
+ case . multilineStringQuote: return " \" \" \" "
1458
+ case . poundKeyPathKeyword: return " #keyPath "
1459
+ case . poundLineKeyword: return " #line "
1460
+ case . poundSelectorKeyword: return " #selector "
1461
+ case . poundFileKeyword: return " #file "
1462
+ case . poundFileIDKeyword: return " #fileID "
1463
+ case . poundFilePathKeyword: return " #filePath "
1464
+ case . poundColumnKeyword: return " #column "
1465
+ case . poundFunctionKeyword: return " #function "
1466
+ case . poundDsohandleKeyword: return " #dsohandle "
1467
+ case . poundAssertKeyword: return " #assert "
1468
+ case . poundSourceLocationKeyword: return " #sourceLocation "
1469
+ case . poundWarningKeyword: return " #warning "
1470
+ case . poundErrorKeyword: return " #error "
1471
+ case . poundIfKeyword: return " #if "
1472
+ case . poundElseKeyword: return " #else "
1473
+ case . poundElseifKeyword: return " #elseif "
1474
+ case . poundEndifKeyword: return " #endif "
1475
+ case . poundAvailableKeyword: return " #available "
1476
+ case . poundUnavailableKeyword: return " #unavailable "
1477
+ case . poundFileLiteralKeyword: return " file reference "
1478
+ case . poundImageLiteralKeyword: return " image "
1479
+ case . poundColorLiteralKeyword: return " color "
1480
+ case . integerLiteral: return " integer literal "
1481
+ case . floatingLiteral: return " floating literal "
1482
+ case . stringLiteral: return " string literal "
1483
+ case . regexLiteral: return " regex literal "
1484
+ case . unknown: return " token "
1485
+ case . identifier: return " identifier "
1486
+ case . unspacedBinaryOperator: return " binary operator "
1487
+ case . spacedBinaryOperator: return " binary operator "
1488
+ case . postfixOperator: return " postfix operator "
1489
+ case . prefixOperator: return " prefix operator "
1490
+ case . dollarIdentifier: return " dollar identifier "
1491
+ case . contextualKeyword: return " keyword "
1492
+ case . rawStringDelimiter: return " raw string delimiter "
1493
+ case . stringSegment: return " string segment "
1494
+ case . stringInterpolationAnchor: return " string interpolation anchor "
1495
+ case . yield: return " yield "
1496
+ }
1497
+ }
1498
+
1369
1499
/// Returns `true` if the token is a Swift keyword.
1370
1500
///
1371
1501
/// Keywords are reserved unconditionally for use by Swift and may not
0 commit comments