]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/xl.js
Initial commit.
[flow-web.git] / static / highlight / languages / xl.js
1 /*! `xl` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: XL
8 Author: Christophe de Dinechin <christophe@taodyne.com>
9 Description: An extensible programming language, based on parse tree rewriting
10 Website: http://xlr.sf.net
11 */
12
13 function xl(hljs) {
14 const KWS = [
15 "if",
16 "then",
17 "else",
18 "do",
19 "while",
20 "until",
21 "for",
22 "loop",
23 "import",
24 "with",
25 "is",
26 "as",
27 "where",
28 "when",
29 "by",
30 "data",
31 "constant",
32 "integer",
33 "real",
34 "text",
35 "name",
36 "boolean",
37 "symbol",
38 "infix",
39 "prefix",
40 "postfix",
41 "block",
42 "tree"
43 ];
44 const BUILT_INS = [
45 "in",
46 "mod",
47 "rem",
48 "and",
49 "or",
50 "xor",
51 "not",
52 "abs",
53 "sign",
54 "floor",
55 "ceil",
56 "sqrt",
57 "sin",
58 "cos",
59 "tan",
60 "asin",
61 "acos",
62 "atan",
63 "exp",
64 "expm1",
65 "log",
66 "log2",
67 "log10",
68 "log1p",
69 "pi",
70 "at",
71 "text_length",
72 "text_range",
73 "text_find",
74 "text_replace",
75 "contains",
76 "page",
77 "slide",
78 "basic_slide",
79 "title_slide",
80 "title",
81 "subtitle",
82 "fade_in",
83 "fade_out",
84 "fade_at",
85 "clear_color",
86 "color",
87 "line_color",
88 "line_width",
89 "texture_wrap",
90 "texture_transform",
91 "texture",
92 "scale_?x",
93 "scale_?y",
94 "scale_?z?",
95 "translate_?x",
96 "translate_?y",
97 "translate_?z?",
98 "rotate_?x",
99 "rotate_?y",
100 "rotate_?z?",
101 "rectangle",
102 "circle",
103 "ellipse",
104 "sphere",
105 "path",
106 "line_to",
107 "move_to",
108 "quad_to",
109 "curve_to",
110 "theme",
111 "background",
112 "contents",
113 "locally",
114 "time",
115 "mouse_?x",
116 "mouse_?y",
117 "mouse_buttons"
118 ];
119 const BUILTIN_MODULES = [
120 "ObjectLoader",
121 "Animate",
122 "MovieCredits",
123 "Slides",
124 "Filters",
125 "Shading",
126 "Materials",
127 "LensFlare",
128 "Mapping",
129 "VLCAudioVideo",
130 "StereoDecoder",
131 "PointCloud",
132 "NetworkAccess",
133 "RemoteControl",
134 "RegExp",
135 "ChromaKey",
136 "Snowfall",
137 "NodeJS",
138 "Speech",
139 "Charts"
140 ];
141 const LITERALS = [
142 "true",
143 "false",
144 "nil"
145 ];
146 const KEYWORDS = {
147 $pattern: /[a-zA-Z][a-zA-Z0-9_?]*/,
148 keyword: KWS,
149 literal: LITERALS,
150 built_in: BUILT_INS.concat(BUILTIN_MODULES)
151 };
152
153 const DOUBLE_QUOTE_TEXT = {
154 className: 'string',
155 begin: '"',
156 end: '"',
157 illegal: '\\n'
158 };
159 const SINGLE_QUOTE_TEXT = {
160 className: 'string',
161 begin: '\'',
162 end: '\'',
163 illegal: '\\n'
164 };
165 const LONG_TEXT = {
166 className: 'string',
167 begin: '<<',
168 end: '>>'
169 };
170 const BASED_NUMBER = {
171 className: 'number',
172 begin: '[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?'
173 };
174 const IMPORT = {
175 beginKeywords: 'import',
176 end: '$',
177 keywords: KEYWORDS,
178 contains: [ DOUBLE_QUOTE_TEXT ]
179 };
180 const FUNCTION_DEFINITION = {
181 className: 'function',
182 begin: /[a-z][^\n]*->/,
183 returnBegin: true,
184 end: /->/,
185 contains: [
186 hljs.inherit(hljs.TITLE_MODE, { starts: {
187 endsWithParent: true,
188 keywords: KEYWORDS
189 } })
190 ]
191 };
192 return {
193 name: 'XL',
194 aliases: [ 'tao' ],
195 keywords: KEYWORDS,
196 contains: [
197 hljs.C_LINE_COMMENT_MODE,
198 hljs.C_BLOCK_COMMENT_MODE,
199 DOUBLE_QUOTE_TEXT,
200 SINGLE_QUOTE_TEXT,
201 LONG_TEXT,
202 FUNCTION_DEFINITION,
203 IMPORT,
204 BASED_NUMBER,
205 hljs.NUMBER_MODE
206 ]
207 };
208 }
209
210 return xl;
211
212 })();
213
214 hljs.registerLanguage('xl', hljsGrammar);
215 })();