]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/processing.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / processing.js
1 /*! `processing` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Processing
7 Description: Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts.
8 Author: Erik Paluka <erik.paluka@gmail.com>
9 Website: https://processing.org
10 Category: graphics
11 */
12
13 function processing(hljs) {
14 const regex = hljs.regex;
15 const BUILT_INS = [
16 "displayHeight",
17 "displayWidth",
18 "mouseY",
19 "mouseX",
20 "mousePressed",
21 "pmouseX",
22 "pmouseY",
23 "key",
24 "keyCode",
25 "pixels",
26 "focused",
27 "frameCount",
28 "frameRate",
29 "height",
30 "width",
31 "size",
32 "createGraphics",
33 "beginDraw",
34 "createShape",
35 "loadShape",
36 "PShape",
37 "arc",
38 "ellipse",
39 "line",
40 "point",
41 "quad",
42 "rect",
43 "triangle",
44 "bezier",
45 "bezierDetail",
46 "bezierPoint",
47 "bezierTangent",
48 "curve",
49 "curveDetail",
50 "curvePoint",
51 "curveTangent",
52 "curveTightness",
53 "shape",
54 "shapeMode",
55 "beginContour",
56 "beginShape",
57 "bezierVertex",
58 "curveVertex",
59 "endContour",
60 "endShape",
61 "quadraticVertex",
62 "vertex",
63 "ellipseMode",
64 "noSmooth",
65 "rectMode",
66 "smooth",
67 "strokeCap",
68 "strokeJoin",
69 "strokeWeight",
70 "mouseClicked",
71 "mouseDragged",
72 "mouseMoved",
73 "mousePressed",
74 "mouseReleased",
75 "mouseWheel",
76 "keyPressed",
77 "keyPressedkeyReleased",
78 "keyTyped",
79 "print",
80 "println",
81 "save",
82 "saveFrame",
83 "day",
84 "hour",
85 "millis",
86 "minute",
87 "month",
88 "second",
89 "year",
90 "background",
91 "clear",
92 "colorMode",
93 "fill",
94 "noFill",
95 "noStroke",
96 "stroke",
97 "alpha",
98 "blue",
99 "brightness",
100 "color",
101 "green",
102 "hue",
103 "lerpColor",
104 "red",
105 "saturation",
106 "modelX",
107 "modelY",
108 "modelZ",
109 "screenX",
110 "screenY",
111 "screenZ",
112 "ambient",
113 "emissive",
114 "shininess",
115 "specular",
116 "add",
117 "createImage",
118 "beginCamera",
119 "camera",
120 "endCamera",
121 "frustum",
122 "ortho",
123 "perspective",
124 "printCamera",
125 "printProjection",
126 "cursor",
127 "frameRate",
128 "noCursor",
129 "exit",
130 "loop",
131 "noLoop",
132 "popStyle",
133 "pushStyle",
134 "redraw",
135 "binary",
136 "boolean",
137 "byte",
138 "char",
139 "float",
140 "hex",
141 "int",
142 "str",
143 "unbinary",
144 "unhex",
145 "join",
146 "match",
147 "matchAll",
148 "nf",
149 "nfc",
150 "nfp",
151 "nfs",
152 "split",
153 "splitTokens",
154 "trim",
155 "append",
156 "arrayCopy",
157 "concat",
158 "expand",
159 "reverse",
160 "shorten",
161 "sort",
162 "splice",
163 "subset",
164 "box",
165 "sphere",
166 "sphereDetail",
167 "createInput",
168 "createReader",
169 "loadBytes",
170 "loadJSONArray",
171 "loadJSONObject",
172 "loadStrings",
173 "loadTable",
174 "loadXML",
175 "open",
176 "parseXML",
177 "saveTable",
178 "selectFolder",
179 "selectInput",
180 "beginRaw",
181 "beginRecord",
182 "createOutput",
183 "createWriter",
184 "endRaw",
185 "endRecord",
186 "PrintWritersaveBytes",
187 "saveJSONArray",
188 "saveJSONObject",
189 "saveStream",
190 "saveStrings",
191 "saveXML",
192 "selectOutput",
193 "popMatrix",
194 "printMatrix",
195 "pushMatrix",
196 "resetMatrix",
197 "rotate",
198 "rotateX",
199 "rotateY",
200 "rotateZ",
201 "scale",
202 "shearX",
203 "shearY",
204 "translate",
205 "ambientLight",
206 "directionalLight",
207 "lightFalloff",
208 "lights",
209 "lightSpecular",
210 "noLights",
211 "normal",
212 "pointLight",
213 "spotLight",
214 "image",
215 "imageMode",
216 "loadImage",
217 "noTint",
218 "requestImage",
219 "tint",
220 "texture",
221 "textureMode",
222 "textureWrap",
223 "blend",
224 "copy",
225 "filter",
226 "get",
227 "loadPixels",
228 "set",
229 "updatePixels",
230 "blendMode",
231 "loadShader",
232 "PShaderresetShader",
233 "shader",
234 "createFont",
235 "loadFont",
236 "text",
237 "textFont",
238 "textAlign",
239 "textLeading",
240 "textMode",
241 "textSize",
242 "textWidth",
243 "textAscent",
244 "textDescent",
245 "abs",
246 "ceil",
247 "constrain",
248 "dist",
249 "exp",
250 "floor",
251 "lerp",
252 "log",
253 "mag",
254 "map",
255 "max",
256 "min",
257 "norm",
258 "pow",
259 "round",
260 "sq",
261 "sqrt",
262 "acos",
263 "asin",
264 "atan",
265 "atan2",
266 "cos",
267 "degrees",
268 "radians",
269 "sin",
270 "tan",
271 "noise",
272 "noiseDetail",
273 "noiseSeed",
274 "random",
275 "randomGaussian",
276 "randomSeed"
277 ];
278 const IDENT = hljs.IDENT_RE;
279 const FUNC_NAME = { variants: [
280 {
281 match: regex.concat(regex.either(...BUILT_INS), regex.lookahead(/\s*\(/)),
282 className: "built_in"
283 },
284 {
285 relevance: 0,
286 match: regex.concat(
287 /\b(?!for|if|while)/,
288 IDENT, regex.lookahead(/\s*\(/)),
289 className: "title.function"
290 }
291 ] };
292 const NEW_CLASS = {
293 match: [
294 /new\s+/,
295 IDENT
296 ],
297 className: {
298 1: "keyword",
299 2: "class.title"
300 }
301 };
302 const PROPERTY = {
303 relevance: 0,
304 match: [
305 /\./,
306 IDENT
307 ],
308 className: { 2: "property" }
309 };
310 const CLASS = {
311 variants: [
312 { match: [
313 /class/,
314 /\s+/,
315 IDENT,
316 /\s+/,
317 /extends/,
318 /\s+/,
319 IDENT
320 ] },
321 { match: [
322 /class/,
323 /\s+/,
324 IDENT
325 ] }
326 ],
327 className: {
328 1: "keyword",
329 3: "title.class",
330 5: "keyword",
331 7: "title.class.inherited"
332 }
333 };
334
335 const TYPES = [
336 "boolean",
337 "byte",
338 "char",
339 "color",
340 "double",
341 "float",
342 "int",
343 "long",
344 "short",
345 ];
346 const CLASSES = [
347 "BufferedReader",
348 "PVector",
349 "PFont",
350 "PImage",
351 "PGraphics",
352 "HashMap",
353 "String",
354 "Array",
355 "FloatDict",
356 "ArrayList",
357 "FloatList",
358 "IntDict",
359 "IntList",
360 "JSONArray",
361 "JSONObject",
362 "Object",
363 "StringDict",
364 "StringList",
365 "Table",
366 "TableRow",
367 "XML"
368 ];
369 const JAVA_KEYWORDS = [
370 "abstract",
371 "assert",
372 "break",
373 "case",
374 "catch",
375 "const",
376 "continue",
377 "default",
378 "else",
379 "enum",
380 "final",
381 "finally",
382 "for",
383 "if",
384 "import",
385 "instanceof",
386 "long",
387 "native",
388 "new",
389 "package",
390 "private",
391 "private",
392 "protected",
393 "protected",
394 "public",
395 "public",
396 "return",
397 "static",
398 "strictfp",
399 "switch",
400 "synchronized",
401 "throw",
402 "throws",
403 "transient",
404 "try",
405 "void",
406 "volatile",
407 "while"
408 ];
409
410 return {
411 name: 'Processing',
412 aliases: [ 'pde' ],
413 keywords: {
414 keyword: [ ...JAVA_KEYWORDS ],
415 literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI null true false',
416 title: 'setup draw',
417 variable: "super this",
418 built_in: [
419 ...BUILT_INS,
420 ...CLASSES
421 ],
422 type: TYPES
423 },
424 contains: [
425 CLASS,
426 NEW_CLASS,
427 FUNC_NAME,
428 PROPERTY,
429 hljs.C_LINE_COMMENT_MODE,
430 hljs.C_BLOCK_COMMENT_MODE,
431 hljs.APOS_STRING_MODE,
432 hljs.QUOTE_STRING_MODE,
433 hljs.C_NUMBER_MODE
434 ]
435 };
436 }
437
438 return processing;
439
440 })();
441 ;
442 export default hljsGrammar;