]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/rsl.js
Initial commit.
[flow-web.git] / static / highlight / languages / rsl.js
1 /*! `rsl` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: RenderMan RSL
8 Author: Konstantin Evdokimenko <qewerty@gmail.com>
9 Contributors: Shuen-Huei Guan <drake.guan@gmail.com>
10 Website: https://renderman.pixar.com/resources/RenderMan_20/shadingLanguage.html
11 Category: graphics
12 */
13
14 function rsl(hljs) {
15 const BUILT_INS = [
16 "abs",
17 "acos",
18 "ambient",
19 "area",
20 "asin",
21 "atan",
22 "atmosphere",
23 "attribute",
24 "calculatenormal",
25 "ceil",
26 "cellnoise",
27 "clamp",
28 "comp",
29 "concat",
30 "cos",
31 "degrees",
32 "depth",
33 "Deriv",
34 "diffuse",
35 "distance",
36 "Du",
37 "Dv",
38 "environment",
39 "exp",
40 "faceforward",
41 "filterstep",
42 "floor",
43 "format",
44 "fresnel",
45 "incident",
46 "length",
47 "lightsource",
48 "log",
49 "match",
50 "max",
51 "min",
52 "mod",
53 "noise",
54 "normalize",
55 "ntransform",
56 "opposite",
57 "option",
58 "phong",
59 "pnoise",
60 "pow",
61 "printf",
62 "ptlined",
63 "radians",
64 "random",
65 "reflect",
66 "refract",
67 "renderinfo",
68 "round",
69 "setcomp",
70 "setxcomp",
71 "setycomp",
72 "setzcomp",
73 "shadow",
74 "sign",
75 "sin",
76 "smoothstep",
77 "specular",
78 "specularbrdf",
79 "spline",
80 "sqrt",
81 "step",
82 "tan",
83 "texture",
84 "textureinfo",
85 "trace",
86 "transform",
87 "vtransform",
88 "xcomp",
89 "ycomp",
90 "zcomp"
91 ];
92
93 const TYPES = [
94 "matrix",
95 "float",
96 "color",
97 "point",
98 "normal",
99 "vector"
100 ];
101
102 const KEYWORDS = [
103 "while",
104 "for",
105 "if",
106 "do",
107 "return",
108 "else",
109 "break",
110 "extern",
111 "continue"
112 ];
113
114 const CLASS_DEFINITION = {
115 match: [
116 /(surface|displacement|light|volume|imager)/,
117 /\s+/,
118 hljs.IDENT_RE,
119 ],
120 scope: {
121 1: "keyword",
122 3: "title.class",
123 }
124 };
125
126 return {
127 name: 'RenderMan RSL',
128 keywords: {
129 keyword: KEYWORDS,
130 built_in: BUILT_INS,
131 type: TYPES
132 },
133 illegal: '</',
134 contains: [
135 hljs.C_LINE_COMMENT_MODE,
136 hljs.C_BLOCK_COMMENT_MODE,
137 hljs.QUOTE_STRING_MODE,
138 hljs.APOS_STRING_MODE,
139 hljs.C_NUMBER_MODE,
140 {
141 className: 'meta',
142 begin: '#',
143 end: '$'
144 },
145 CLASS_DEFINITION,
146 {
147 beginKeywords: 'illuminate illuminance gather',
148 end: '\\('
149 }
150 ]
151 };
152 }
153
154 return rsl;
155
156 })();
157
158 hljs.registerLanguage('rsl', hljsGrammar);
159 })();