github.com/evanw/esbuild@v0.21.4/internal/js_lexer/tables.go (about)

     1  package js_lexer
     2  
     3  var tokenToString = map[T]string{
     4  	TEndOfFile:   "end of file",
     5  	TSyntaxError: "syntax error",
     6  	THashbang:    "hashbang comment",
     7  
     8  	// Literals
     9  	TNoSubstitutionTemplateLiteral: "template literal",
    10  	TNumericLiteral:                "number",
    11  	TStringLiteral:                 "string",
    12  	TBigIntegerLiteral:             "bigint",
    13  
    14  	// Pseudo-literals
    15  	TTemplateHead:   "template literal",
    16  	TTemplateMiddle: "template literal",
    17  	TTemplateTail:   "template literal",
    18  
    19  	// Punctuation
    20  	TAmpersand:                         "\"&\"",
    21  	TAmpersandAmpersand:                "\"&&\"",
    22  	TAsterisk:                          "\"*\"",
    23  	TAsteriskAsterisk:                  "\"**\"",
    24  	TAt:                                "\"@\"",
    25  	TBar:                               "\"|\"",
    26  	TBarBar:                            "\"||\"",
    27  	TCaret:                             "\"^\"",
    28  	TCloseBrace:                        "\"}\"",
    29  	TCloseBracket:                      "\"]\"",
    30  	TCloseParen:                        "\")\"",
    31  	TColon:                             "\":\"",
    32  	TComma:                             "\",\"",
    33  	TDot:                               "\".\"",
    34  	TDotDotDot:                         "\"...\"",
    35  	TEqualsEquals:                      "\"==\"",
    36  	TEqualsEqualsEquals:                "\"===\"",
    37  	TEqualsGreaterThan:                 "\"=>\"",
    38  	TExclamation:                       "\"!\"",
    39  	TExclamationEquals:                 "\"!=\"",
    40  	TExclamationEqualsEquals:           "\"!==\"",
    41  	TGreaterThan:                       "\">\"",
    42  	TGreaterThanEquals:                 "\">=\"",
    43  	TGreaterThanGreaterThan:            "\">>\"",
    44  	TGreaterThanGreaterThanGreaterThan: "\">>>\"",
    45  	TLessThan:                          "\"<\"",
    46  	TLessThanEquals:                    "\"<=\"",
    47  	TLessThanLessThan:                  "\"<<\"",
    48  	TMinus:                             "\"-\"",
    49  	TMinusMinus:                        "\"--\"",
    50  	TOpenBrace:                         "\"{\"",
    51  	TOpenBracket:                       "\"[\"",
    52  	TOpenParen:                         "\"(\"",
    53  	TPercent:                           "\"%\"",
    54  	TPlus:                              "\"+\"",
    55  	TPlusPlus:                          "\"++\"",
    56  	TQuestion:                          "\"?\"",
    57  	TQuestionDot:                       "\"?.\"",
    58  	TQuestionQuestion:                  "\"??\"",
    59  	TSemicolon:                         "\";\"",
    60  	TSlash:                             "\"/\"",
    61  	TTilde:                             "\"~\"",
    62  
    63  	// Assignments
    64  	TAmpersandAmpersandEquals:                "\"&&=\"",
    65  	TAmpersandEquals:                         "\"&=\"",
    66  	TAsteriskAsteriskEquals:                  "\"**=\"",
    67  	TAsteriskEquals:                          "\"*=\"",
    68  	TBarBarEquals:                            "\"||=\"",
    69  	TBarEquals:                               "\"|=\"",
    70  	TCaretEquals:                             "\"^=\"",
    71  	TEquals:                                  "\"=\"",
    72  	TGreaterThanGreaterThanEquals:            "\">>=\"",
    73  	TGreaterThanGreaterThanGreaterThanEquals: "\">>>=\"",
    74  	TLessThanLessThanEquals:                  "\"<<=\"",
    75  	TMinusEquals:                             "\"-=\"",
    76  	TPercentEquals:                           "\"%=\"",
    77  	TPlusEquals:                              "\"+=\"",
    78  	TQuestionQuestionEquals:                  "\"??=\"",
    79  	TSlashEquals:                             "\"/=\"",
    80  
    81  	// Class-private fields and methods
    82  	TPrivateIdentifier: "private identifier",
    83  
    84  	// Identifiers
    85  	TIdentifier:     "identifier",
    86  	TEscapedKeyword: "escaped keyword",
    87  
    88  	// Reserved words
    89  	TBreak:      "\"break\"",
    90  	TCase:       "\"case\"",
    91  	TCatch:      "\"catch\"",
    92  	TClass:      "\"class\"",
    93  	TConst:      "\"const\"",
    94  	TContinue:   "\"continue\"",
    95  	TDebugger:   "\"debugger\"",
    96  	TDefault:    "\"default\"",
    97  	TDelete:     "\"delete\"",
    98  	TDo:         "\"do\"",
    99  	TElse:       "\"else\"",
   100  	TEnum:       "\"enum\"",
   101  	TExport:     "\"export\"",
   102  	TExtends:    "\"extends\"",
   103  	TFalse:      "\"false\"",
   104  	TFinally:    "\"finally\"",
   105  	TFor:        "\"for\"",
   106  	TFunction:   "\"function\"",
   107  	TIf:         "\"if\"",
   108  	TImport:     "\"import\"",
   109  	TIn:         "\"in\"",
   110  	TInstanceof: "\"instanceof\"",
   111  	TNew:        "\"new\"",
   112  	TNull:       "\"null\"",
   113  	TReturn:     "\"return\"",
   114  	TSuper:      "\"super\"",
   115  	TSwitch:     "\"switch\"",
   116  	TThis:       "\"this\"",
   117  	TThrow:      "\"throw\"",
   118  	TTrue:       "\"true\"",
   119  	TTry:        "\"try\"",
   120  	TTypeof:     "\"typeof\"",
   121  	TVar:        "\"var\"",
   122  	TVoid:       "\"void\"",
   123  	TWhile:      "\"while\"",
   124  	TWith:       "\"with\"",
   125  }
   126  
   127  // This is from https://github.com/microsoft/TypeScript/blob/master/src/compiler/transformers/jsx.ts
   128  var jsxEntity = map[string]rune{
   129  	"quot":     0x0022,
   130  	"amp":      0x0026,
   131  	"apos":     0x0027,
   132  	"lt":       0x003C,
   133  	"gt":       0x003E,
   134  	"nbsp":     0x00A0,
   135  	"iexcl":    0x00A1,
   136  	"cent":     0x00A2,
   137  	"pound":    0x00A3,
   138  	"curren":   0x00A4,
   139  	"yen":      0x00A5,
   140  	"brvbar":   0x00A6,
   141  	"sect":     0x00A7,
   142  	"uml":      0x00A8,
   143  	"copy":     0x00A9,
   144  	"ordf":     0x00AA,
   145  	"laquo":    0x00AB,
   146  	"not":      0x00AC,
   147  	"shy":      0x00AD,
   148  	"reg":      0x00AE,
   149  	"macr":     0x00AF,
   150  	"deg":      0x00B0,
   151  	"plusmn":   0x00B1,
   152  	"sup2":     0x00B2,
   153  	"sup3":     0x00B3,
   154  	"acute":    0x00B4,
   155  	"micro":    0x00B5,
   156  	"para":     0x00B6,
   157  	"middot":   0x00B7,
   158  	"cedil":    0x00B8,
   159  	"sup1":     0x00B9,
   160  	"ordm":     0x00BA,
   161  	"raquo":    0x00BB,
   162  	"frac14":   0x00BC,
   163  	"frac12":   0x00BD,
   164  	"frac34":   0x00BE,
   165  	"iquest":   0x00BF,
   166  	"Agrave":   0x00C0,
   167  	"Aacute":   0x00C1,
   168  	"Acirc":    0x00C2,
   169  	"Atilde":   0x00C3,
   170  	"Auml":     0x00C4,
   171  	"Aring":    0x00C5,
   172  	"AElig":    0x00C6,
   173  	"Ccedil":   0x00C7,
   174  	"Egrave":   0x00C8,
   175  	"Eacute":   0x00C9,
   176  	"Ecirc":    0x00CA,
   177  	"Euml":     0x00CB,
   178  	"Igrave":   0x00CC,
   179  	"Iacute":   0x00CD,
   180  	"Icirc":    0x00CE,
   181  	"Iuml":     0x00CF,
   182  	"ETH":      0x00D0,
   183  	"Ntilde":   0x00D1,
   184  	"Ograve":   0x00D2,
   185  	"Oacute":   0x00D3,
   186  	"Ocirc":    0x00D4,
   187  	"Otilde":   0x00D5,
   188  	"Ouml":     0x00D6,
   189  	"times":    0x00D7,
   190  	"Oslash":   0x00D8,
   191  	"Ugrave":   0x00D9,
   192  	"Uacute":   0x00DA,
   193  	"Ucirc":    0x00DB,
   194  	"Uuml":     0x00DC,
   195  	"Yacute":   0x00DD,
   196  	"THORN":    0x00DE,
   197  	"szlig":    0x00DF,
   198  	"agrave":   0x00E0,
   199  	"aacute":   0x00E1,
   200  	"acirc":    0x00E2,
   201  	"atilde":   0x00E3,
   202  	"auml":     0x00E4,
   203  	"aring":    0x00E5,
   204  	"aelig":    0x00E6,
   205  	"ccedil":   0x00E7,
   206  	"egrave":   0x00E8,
   207  	"eacute":   0x00E9,
   208  	"ecirc":    0x00EA,
   209  	"euml":     0x00EB,
   210  	"igrave":   0x00EC,
   211  	"iacute":   0x00ED,
   212  	"icirc":    0x00EE,
   213  	"iuml":     0x00EF,
   214  	"eth":      0x00F0,
   215  	"ntilde":   0x00F1,
   216  	"ograve":   0x00F2,
   217  	"oacute":   0x00F3,
   218  	"ocirc":    0x00F4,
   219  	"otilde":   0x00F5,
   220  	"ouml":     0x00F6,
   221  	"divide":   0x00F7,
   222  	"oslash":   0x00F8,
   223  	"ugrave":   0x00F9,
   224  	"uacute":   0x00FA,
   225  	"ucirc":    0x00FB,
   226  	"uuml":     0x00FC,
   227  	"yacute":   0x00FD,
   228  	"thorn":    0x00FE,
   229  	"yuml":     0x00FF,
   230  	"OElig":    0x0152,
   231  	"oelig":    0x0153,
   232  	"Scaron":   0x0160,
   233  	"scaron":   0x0161,
   234  	"Yuml":     0x0178,
   235  	"fnof":     0x0192,
   236  	"circ":     0x02C6,
   237  	"tilde":    0x02DC,
   238  	"Alpha":    0x0391,
   239  	"Beta":     0x0392,
   240  	"Gamma":    0x0393,
   241  	"Delta":    0x0394,
   242  	"Epsilon":  0x0395,
   243  	"Zeta":     0x0396,
   244  	"Eta":      0x0397,
   245  	"Theta":    0x0398,
   246  	"Iota":     0x0399,
   247  	"Kappa":    0x039A,
   248  	"Lambda":   0x039B,
   249  	"Mu":       0x039C,
   250  	"Nu":       0x039D,
   251  	"Xi":       0x039E,
   252  	"Omicron":  0x039F,
   253  	"Pi":       0x03A0,
   254  	"Rho":      0x03A1,
   255  	"Sigma":    0x03A3,
   256  	"Tau":      0x03A4,
   257  	"Upsilon":  0x03A5,
   258  	"Phi":      0x03A6,
   259  	"Chi":      0x03A7,
   260  	"Psi":      0x03A8,
   261  	"Omega":    0x03A9,
   262  	"alpha":    0x03B1,
   263  	"beta":     0x03B2,
   264  	"gamma":    0x03B3,
   265  	"delta":    0x03B4,
   266  	"epsilon":  0x03B5,
   267  	"zeta":     0x03B6,
   268  	"eta":      0x03B7,
   269  	"theta":    0x03B8,
   270  	"iota":     0x03B9,
   271  	"kappa":    0x03BA,
   272  	"lambda":   0x03BB,
   273  	"mu":       0x03BC,
   274  	"nu":       0x03BD,
   275  	"xi":       0x03BE,
   276  	"omicron":  0x03BF,
   277  	"pi":       0x03C0,
   278  	"rho":      0x03C1,
   279  	"sigmaf":   0x03C2,
   280  	"sigma":    0x03C3,
   281  	"tau":      0x03C4,
   282  	"upsilon":  0x03C5,
   283  	"phi":      0x03C6,
   284  	"chi":      0x03C7,
   285  	"psi":      0x03C8,
   286  	"omega":    0x03C9,
   287  	"thetasym": 0x03D1,
   288  	"upsih":    0x03D2,
   289  	"piv":      0x03D6,
   290  	"ensp":     0x2002,
   291  	"emsp":     0x2003,
   292  	"thinsp":   0x2009,
   293  	"zwnj":     0x200C,
   294  	"zwj":      0x200D,
   295  	"lrm":      0x200E,
   296  	"rlm":      0x200F,
   297  	"ndash":    0x2013,
   298  	"mdash":    0x2014,
   299  	"lsquo":    0x2018,
   300  	"rsquo":    0x2019,
   301  	"sbquo":    0x201A,
   302  	"ldquo":    0x201C,
   303  	"rdquo":    0x201D,
   304  	"bdquo":    0x201E,
   305  	"dagger":   0x2020,
   306  	"Dagger":   0x2021,
   307  	"bull":     0x2022,
   308  	"hellip":   0x2026,
   309  	"permil":   0x2030,
   310  	"prime":    0x2032,
   311  	"Prime":    0x2033,
   312  	"lsaquo":   0x2039,
   313  	"rsaquo":   0x203A,
   314  	"oline":    0x203E,
   315  	"frasl":    0x2044,
   316  	"euro":     0x20AC,
   317  	"image":    0x2111,
   318  	"weierp":   0x2118,
   319  	"real":     0x211C,
   320  	"trade":    0x2122,
   321  	"alefsym":  0x2135,
   322  	"larr":     0x2190,
   323  	"uarr":     0x2191,
   324  	"rarr":     0x2192,
   325  	"darr":     0x2193,
   326  	"harr":     0x2194,
   327  	"crarr":    0x21B5,
   328  	"lArr":     0x21D0,
   329  	"uArr":     0x21D1,
   330  	"rArr":     0x21D2,
   331  	"dArr":     0x21D3,
   332  	"hArr":     0x21D4,
   333  	"forall":   0x2200,
   334  	"part":     0x2202,
   335  	"exist":    0x2203,
   336  	"empty":    0x2205,
   337  	"nabla":    0x2207,
   338  	"isin":     0x2208,
   339  	"notin":    0x2209,
   340  	"ni":       0x220B,
   341  	"prod":     0x220F,
   342  	"sum":      0x2211,
   343  	"minus":    0x2212,
   344  	"lowast":   0x2217,
   345  	"radic":    0x221A,
   346  	"prop":     0x221D,
   347  	"infin":    0x221E,
   348  	"ang":      0x2220,
   349  	"and":      0x2227,
   350  	"or":       0x2228,
   351  	"cap":      0x2229,
   352  	"cup":      0x222A,
   353  	"int":      0x222B,
   354  	"there4":   0x2234,
   355  	"sim":      0x223C,
   356  	"cong":     0x2245,
   357  	"asymp":    0x2248,
   358  	"ne":       0x2260,
   359  	"equiv":    0x2261,
   360  	"le":       0x2264,
   361  	"ge":       0x2265,
   362  	"sub":      0x2282,
   363  	"sup":      0x2283,
   364  	"nsub":     0x2284,
   365  	"sube":     0x2286,
   366  	"supe":     0x2287,
   367  	"oplus":    0x2295,
   368  	"otimes":   0x2297,
   369  	"perp":     0x22A5,
   370  	"sdot":     0x22C5,
   371  	"lceil":    0x2308,
   372  	"rceil":    0x2309,
   373  	"lfloor":   0x230A,
   374  	"rfloor":   0x230B,
   375  	"lang":     0x2329,
   376  	"rang":     0x232A,
   377  	"loz":      0x25CA,
   378  	"spades":   0x2660,
   379  	"clubs":    0x2663,
   380  	"hearts":   0x2665,
   381  	"diams":    0x2666,
   382  }