]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/monkey.js
Initial commit.
[flow-web.git] / static / highlight / languages / monkey.js
1 /*! `monkey` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Monkey
8 Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
9 Author: Arthur Bikmullin <devolonter@gmail.com>
10 Website: https://blitzresearch.itch.io/monkey2
11 Category: gaming
12 */
13
14 function monkey(hljs) {
15 const NUMBER = {
16 className: 'number',
17 relevance: 0,
18 variants: [
19 { begin: '[$][a-fA-F0-9]+' },
20 hljs.NUMBER_MODE
21 ]
22 };
23 const FUNC_DEFINITION = {
24 variants: [
25 { match: [
26 /(function|method)/,
27 /\s+/,
28 hljs.UNDERSCORE_IDENT_RE,
29 ] },
30 ],
31 scope: {
32 1: "keyword",
33 3: "title.function"
34 }
35 };
36 const CLASS_DEFINITION = {
37 variants: [
38 { match: [
39 /(class|interface|extends|implements)/,
40 /\s+/,
41 hljs.UNDERSCORE_IDENT_RE,
42 ] },
43 ],
44 scope: {
45 1: "keyword",
46 3: "title.class"
47 }
48 };
49 const BUILT_INS = [
50 "DebugLog",
51 "DebugStop",
52 "Error",
53 "Print",
54 "ACos",
55 "ACosr",
56 "ASin",
57 "ASinr",
58 "ATan",
59 "ATan2",
60 "ATan2r",
61 "ATanr",
62 "Abs",
63 "Abs",
64 "Ceil",
65 "Clamp",
66 "Clamp",
67 "Cos",
68 "Cosr",
69 "Exp",
70 "Floor",
71 "Log",
72 "Max",
73 "Max",
74 "Min",
75 "Min",
76 "Pow",
77 "Sgn",
78 "Sgn",
79 "Sin",
80 "Sinr",
81 "Sqrt",
82 "Tan",
83 "Tanr",
84 "Seed",
85 "PI",
86 "HALFPI",
87 "TWOPI"
88 ];
89 const LITERALS = [
90 "true",
91 "false",
92 "null"
93 ];
94 const KEYWORDS = [
95 "public",
96 "private",
97 "property",
98 "continue",
99 "exit",
100 "extern",
101 "new",
102 "try",
103 "catch",
104 "eachin",
105 "not",
106 "abstract",
107 "final",
108 "select",
109 "case",
110 "default",
111 "const",
112 "local",
113 "global",
114 "field",
115 "end",
116 "if",
117 "then",
118 "else",
119 "elseif",
120 "endif",
121 "while",
122 "wend",
123 "repeat",
124 "until",
125 "forever",
126 "for",
127 "to",
128 "step",
129 "next",
130 "return",
131 "module",
132 "inline",
133 "throw",
134 "import",
135 // not positive, but these are not literals
136 "and",
137 "or",
138 "shl",
139 "shr",
140 "mod"
141 ];
142
143 return {
144 name: 'Monkey',
145 case_insensitive: true,
146 keywords: {
147 keyword: KEYWORDS,
148 built_in: BUILT_INS,
149 literal: LITERALS
150 },
151 illegal: /\/\*/,
152 contains: [
153 hljs.COMMENT('#rem', '#end'),
154 hljs.COMMENT(
155 "'",
156 '$',
157 { relevance: 0 }
158 ),
159 FUNC_DEFINITION,
160 CLASS_DEFINITION,
161 {
162 className: 'variable.language',
163 begin: /\b(self|super)\b/
164 },
165 {
166 className: 'meta',
167 begin: /\s*#/,
168 end: '$',
169 keywords: { keyword: 'if else elseif endif end then' }
170 },
171 {
172 match: [
173 /^\s*/,
174 /strict\b/
175 ],
176 scope: { 2: "meta" }
177 },
178 {
179 beginKeywords: 'alias',
180 end: '=',
181 contains: [ hljs.UNDERSCORE_TITLE_MODE ]
182 },
183 hljs.QUOTE_STRING_MODE,
184 NUMBER
185 ]
186 };
187 }
188
189 return monkey;
190
191 })();
192
193 hljs.registerLanguage('monkey', hljsGrammar);
194 })();