monkey.js 2.1 KB

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