jstoken.pp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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,
  32. { Reserved words start here. They must be last }
  33. tjsBREAK,tjsCASE, tjsCATCH, tjsCONTINUE,
  34. tjsDEFAULT, tjsDELETE, tjsDO,
  35. tjsELSE,
  36. tjsFalse, tjsFINALLY, tjsFOR, tjsFUNCTION,
  37. tjsIF, tjsIN, tjsINSTANCEOF,
  38. tjsNEW,tjsNULL,
  39. tjsRETURN,
  40. tjsSWITCH,
  41. tjsTHIS, tjsTHROW, tjsTrue, tjsTRY, tjsTYPEOF,
  42. tjsVAR, tjsVOID,
  43. tjsWHILE, tjsWITH
  44. );
  45. const
  46. FirstKeyword = tjsBreak;
  47. LastKeyWord = tJSWith;
  48. TokenInfos: array[TJSToken] of string = ('unknown',
  49. // Specials
  50. 'EOF','whitespace','Char','String', 'identifier','number','comment','regular expression', 'reserved word',
  51. '&&','&=',
  52. '(',')','[',']','{','}',
  53. ',',':','.',';','=','>','<','?',
  54. '+','-','*','/','&','|','~','%','^','!',
  55. '==',
  56. '>=',
  57. '<=', '<<', '<<=',
  58. '-=', '--', '%=', '/=','^=',
  59. '!=',
  60. '|=', '||',
  61. '+=', '++',
  62. '>>>', '>>>=',
  63. '>>', '>>=',
  64. '===', '!==', '*=',
  65. // Identifiers last
  66. 'break','case','catch', 'continue',
  67. 'default','delete', 'do',
  68. 'else',
  69. 'false','finally', 'for', 'function',
  70. 'if', 'in', 'instanceof',
  71. 'new','null',
  72. 'return',
  73. 'switch',
  74. 'this', 'throw', 'true', 'try', 'typeof',
  75. 'var', 'void',
  76. 'while', 'with'
  77. );
  78. implementation
  79. end.