2024-01-16 21:26:16 +08:00
|
|
|
/*
|
|
|
|
Language: Monkey
|
|
|
|
Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
|
|
|
|
Author: Arthur Bikmullin <devolonter@gmail.com>
|
|
|
|
Website: https://blitzresearch.itch.io/monkey2
|
|
|
|
*/
|
|
|
|
|
|
|
|
function monkey(hljs) {
|
|
|
|
const NUMBER = {
|
|
|
|
className: 'number',
|
|
|
|
relevance: 0,
|
2023-12-18 13:12:25 +08:00
|
|
|
variants: [
|
|
|
|
{
|
|
|
|
begin: '[$][a-fA-F0-9]+'
|
|
|
|
},
|
|
|
|
hljs.NUMBER_MODE
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
2024-01-16 21:26:16 +08:00
|
|
|
name: 'Monkey',
|
2023-12-18 13:12:25 +08:00
|
|
|
case_insensitive: true,
|
|
|
|
keywords: {
|
|
|
|
keyword: 'public private property continue exit extern new try catch ' +
|
|
|
|
'eachin not abstract final select case default const local global field ' +
|
|
|
|
'end if then else elseif endif while wend repeat until forever for ' +
|
|
|
|
'to step next return module inline throw import',
|
|
|
|
|
|
|
|
built_in: 'DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil ' +
|
|
|
|
'Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI',
|
|
|
|
|
|
|
|
literal: 'true false null and or shl shr mod'
|
|
|
|
},
|
|
|
|
illegal: /\/\*/,
|
|
|
|
contains: [
|
|
|
|
hljs.COMMENT('#rem', '#end'),
|
|
|
|
hljs.COMMENT(
|
|
|
|
"'",
|
|
|
|
'$',
|
|
|
|
{
|
|
|
|
relevance: 0
|
|
|
|
}
|
|
|
|
),
|
|
|
|
{
|
|
|
|
className: 'function',
|
2024-01-16 21:26:16 +08:00
|
|
|
beginKeywords: 'function method',
|
|
|
|
end: '[(=:]|$',
|
2023-12-18 13:12:25 +08:00
|
|
|
illegal: /\n/,
|
2024-01-16 21:26:16 +08:00
|
|
|
contains: [ hljs.UNDERSCORE_TITLE_MODE ]
|
2023-12-18 13:12:25 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'class',
|
2024-01-16 21:26:16 +08:00
|
|
|
beginKeywords: 'class interface',
|
|
|
|
end: '$',
|
2023-12-18 13:12:25 +08:00
|
|
|
contains: [
|
|
|
|
{
|
|
|
|
beginKeywords: 'extends implements'
|
|
|
|
},
|
|
|
|
hljs.UNDERSCORE_TITLE_MODE
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'built_in',
|
|
|
|
begin: '\\b(self|super)\\b'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'meta',
|
2024-01-16 21:26:16 +08:00
|
|
|
begin: '\\s*#',
|
|
|
|
end: '$',
|
|
|
|
keywords: {
|
|
|
|
'meta-keyword': 'if else elseif endif end then'
|
|
|
|
}
|
2023-12-18 13:12:25 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
className: 'meta',
|
|
|
|
begin: '^\\s*strict\\b'
|
|
|
|
},
|
|
|
|
{
|
2024-01-16 21:26:16 +08:00
|
|
|
beginKeywords: 'alias',
|
|
|
|
end: '=',
|
|
|
|
contains: [ hljs.UNDERSCORE_TITLE_MODE ]
|
2023-12-18 13:12:25 +08:00
|
|
|
},
|
|
|
|
hljs.QUOTE_STRING_MODE,
|
|
|
|
NUMBER
|
|
|
|
]
|
2024-01-16 21:26:16 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = monkey;
|