jstoken.pp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. { *********************************************************************
  2. This file is part of the Free Component Library (FCL)
  3. Copyright (c) 2016 Michael Van Canneyt.
  4. Javascript token definitions
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit jstoken;
  12. {$mode objfpc}{$H+}
  13. interface
  14. type
  15. TJSToken = (tjsUnknown,
  16. // Specials
  17. tjsEOF,tjsWhiteSpace,tjsChar,tjsString{this bites TJSString}, tjsIdentifier,tjsNumber, tjsComment,tjsREGEX, tjsRESERVED,
  18. tjsANDAND, tjsANDEQ,
  19. tjsBraceOpen,tjsBraceClose,tjsSQuaredBraceOpen,tjsSQuaredBraceClose,tjsCurlyBraceOpen,tjsCurlyBraceClose,
  20. tjsCOMMA,tjsCOLON, tjsDOT,tjsSEMICOLON, tjsASSIGN,tjsGT,tjsLT, tjsConditional,
  21. tjsPLUS,tjsMINUS,tjsMUL,tjsDIV,tjsAnd,tjsOR, tjsInv, tjsMod, tjsXOR, tjsNot,
  22. tjsEQ,
  23. tjsGE,
  24. tjsLE, tjsLSHIFT, tjsLSHIFTEQ,
  25. tjsMINUSEQ, tjsMINUSMINUS, tjsMODEQ,tjsDIVEQ,tjsXOREq,
  26. tjsNE,
  27. tjsOREQ, tjsOROR,
  28. tjsPLUSEQ, tjsPLUSPLUS,
  29. tjsURSHIFT, tjsURSHIFTEQ,
  30. tjsRSHIFT, tjsRSHIFTEQ,
  31. tjsSEQ, tjsSNE, tjsMULEQ, tjsArrow, tjsEllipsis,
  32. { Reserved words start here. They must be last }
  33. tjsAWAIT, tjsBREAK, tjsCASE, tjsCATCH, tjsCLASS, tjsCONST, tjsCONTINUE,
  34. tjsDEBUGGER, tjsDEFAULT, tjsDELETE, tjsDO,
  35. tjsELSE, tjsENUM, tjsEXPORT, tjsEXTENDS,
  36. tjsFALSE, tjsFINALLY, tjsFOR, tjsFUNCTION,
  37. tjsIF, tjsIMPORT, tjsIN, tjsINSTANCEOF,
  38. tjsLet,
  39. tjsNEW, tjsNULL,
  40. tjsRETURN,
  41. tjsSUPER, tjsSWITCH,
  42. tjsTHIS, tjsTHROW, tjsTrue, tjsTRY, tjsTYPEOF,
  43. tjsVAR, tjsVOID,
  44. tjsWHILE, tjsWITH,
  45. tjsYield
  46. );
  47. TJSTokens = Set of TJSToken;
  48. const
  49. FirstKeyword = tjsAwait;
  50. LastKeyWord = tJSYield;
  51. TokenInfos: array[TJSToken] of String = ('unknown',
  52. // Specials
  53. 'EOF','whitespace','Char','String', 'identifier','number','comment','regular expression', 'reserved word',
  54. '&&','&=',
  55. '(',')','[',']','{','}',
  56. ',',':','.',';','=','>','<','?',
  57. '+','-','*','/','&','|','~','%','^','!',
  58. '==',
  59. '>=',
  60. '<=', '<<', '<<=',
  61. '-=', '--', '%=', '/=','^=',
  62. '!=',
  63. '|=', '||',
  64. '+=', '++',
  65. '>>>', '>>>=',
  66. '>>', '>>=',
  67. '===', '!==', '*=', '=>', '...',
  68. // Identifiers last
  69. 'await', 'break','case','catch', 'class','const','continue',
  70. 'debugger','default','delete', 'do',
  71. 'else','enum','export','extends',
  72. 'false','finally', 'for', 'function',
  73. 'if', 'import', 'in', 'instanceof',
  74. 'let',
  75. 'new','null',
  76. 'return',
  77. 'super', 'switch',
  78. 'this', 'throw', 'true', 'try', 'typeof',
  79. 'var', 'void',
  80. 'while', 'with',
  81. 'yield'
  82. );
  83. implementation
  84. end.