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