jstoken.pp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. unit jstoken;
  2. {$mode objfpc}{$H+}
  3. interface
  4. type
  5. TJSToken = (tjsUnknown,
  6. // Specials
  7. tjsEOF,tjsWhiteSpace,tjsChar,tjsString, tjsIdentifier,tjsNumber, tjsComment,tjsREGEX, tjsRESERVED,
  8. tjsANDAND, tjsANDEQ,
  9. tjsBraceOpen,tjsBraceClose,tjsSQuaredBraceOpen,tjsSQuaredBraceClose,tjsCurlyBraceOpen,tjsCurlyBraceClose,
  10. tjsCOMMA,tjsCOLON, tjsDOT,tjsSEMICOLON, tjsASSIGN,tjsGT,tjsLT, tjsConditional,
  11. tjsPLUS,tjsMINUS,tjsMUL,tjsDIV,tjsAnd,tjsOR, tjsInv, tjsMod, tjsXOR, tjsNot,
  12. tjsEQ,
  13. tjsGE,
  14. tjsLE, tjsLSHIFT, tjsLSHIFTEQ,
  15. tjsMINUSEQ, tjsMINUSMINUS, tjsMODEQ,tjsDIVEQ,tjsXOREq,
  16. tjsNE,
  17. tjsOREQ, tjsOROR,
  18. tjsPLUSEQ, tjsPLUSPLUS,
  19. tjsURSHIFT, tjsURSHIFTEQ,
  20. tjsRSHIFT, tjsRSHIFTEQ,
  21. tjsSEQ, tjsSNE, tjsMULEQ,
  22. { Reserved words start here. They must be last }
  23. tjsBREAK,tjsCASE, tjsCATCH, tjsCONTINUE,
  24. tjsDEFAULT, tjsDELETE, tjsDO,
  25. tjsELSE,
  26. tjsFalse, tjsFINALLY, tjsFOR, tjsFUNCTION,
  27. tjsIF, tjsIN, tjsINSTANCEOF,
  28. tjsNEW,tjsNULL,
  29. tjsRETURN,
  30. tjsSWITCH,
  31. tjsTHIS, tjsTHROW, tjsTrue, tjsTRY, tjsTYPEOF,
  32. tjsVAR, tjsVOID,
  33. tjsWHILE, tjsWITH
  34. );
  35. const
  36. FirstKeyword = tjsBreak;
  37. LastKeyWord = tJSWith;
  38. TokenInfos: array[TJSToken] of string = ('unknown',
  39. // Specials
  40. 'EOF','whitespace','Char','String', 'identifier','number','comment','regular expression', 'reserved word',
  41. '&&','&=',
  42. '(',')','[',']','{','}',
  43. ',',':','.',';','=','>','<','?',
  44. '+','-','*','/','&','|','~','%','^','!',
  45. '==',
  46. '>=',
  47. '<=', '<<', '<<=',
  48. '-=', '--', '%=', '/=','^=',
  49. '!=',
  50. '|=', '||',
  51. '+=', '++',
  52. '>>>', '>>>=',
  53. '>>', '>>=',
  54. '===', '!==', '*=',
  55. // Identifiers last
  56. 'break','case','catch', 'continue',
  57. 'default','delete', 'do',
  58. 'else',
  59. 'false','finally', 'for', 'function',
  60. 'if', 'in', 'instanceof',
  61. 'new','null',
  62. 'return',
  63. 'switch',
  64. 'this', 'throw', 'true', 'try', 'typeof',
  65. 'var', 'void',
  66. 'while', 'with'
  67. );
  68. implementation
  69. end.