monkey.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Language: Monkey
  3. Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
  4. Author: Arthur Bikmullin <devolonter@gmail.com>
  5. Website: https://blitzresearch.itch.io/monkey2
  6. */
  7. function monkey(hljs) {
  8. const NUMBER = {
  9. className: 'number',
  10. relevance: 0,
  11. variants: [
  12. {
  13. begin: '[$][a-fA-F0-9]+'
  14. },
  15. hljs.NUMBER_MODE
  16. ]
  17. };
  18. return {
  19. name: 'Monkey',
  20. case_insensitive: true,
  21. keywords: {
  22. keyword: 'public private property continue exit extern new try catch ' +
  23. 'eachin not abstract final select case default const local global field ' +
  24. 'end if then else elseif endif while wend repeat until forever for ' +
  25. 'to step next return module inline throw import',
  26. built_in: 'DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil ' +
  27. 'Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI',
  28. literal: 'true false null and or shl shr mod'
  29. },
  30. illegal: /\/\*/,
  31. contains: [
  32. hljs.COMMENT('#rem', '#end'),
  33. hljs.COMMENT(
  34. "'",
  35. '$',
  36. {
  37. relevance: 0
  38. }
  39. ),
  40. {
  41. className: 'function',
  42. beginKeywords: 'function method',
  43. end: '[(=:]|$',
  44. illegal: /\n/,
  45. contains: [ hljs.UNDERSCORE_TITLE_MODE ]
  46. },
  47. {
  48. className: 'class',
  49. beginKeywords: 'class interface',
  50. end: '$',
  51. contains: [
  52. {
  53. beginKeywords: 'extends implements'
  54. },
  55. hljs.UNDERSCORE_TITLE_MODE
  56. ]
  57. },
  58. {
  59. className: 'built_in',
  60. begin: '\\b(self|super)\\b'
  61. },
  62. {
  63. className: 'meta',
  64. begin: '\\s*#',
  65. end: '$',
  66. keywords: {
  67. 'meta-keyword': 'if else elseif endif end then'
  68. }
  69. },
  70. {
  71. className: 'meta',
  72. begin: '^\\s*strict\\b'
  73. },
  74. {
  75. beginKeywords: 'alias',
  76. end: '=',
  77. contains: [ hljs.UNDERSCORE_TITLE_MODE ]
  78. },
  79. hljs.QUOTE_STRING_MODE,
  80. NUMBER
  81. ]
  82. };
  83. }
  84. module.exports = monkey;