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