Added discussion feature to site.
[Assignment-Trapper.git] / sh_c.js
blob658472eb12d2726951df27f3f528b7d06e97d67e
1 if (! this.sh_languages) {
2   this.sh_languages = {};
4 sh_languages['c'] = [
5   [
6     [
7       /\/\/\//g,
8       'sh_comment',
9       1
10     ],
11     [
12       /\/\//g,
13       'sh_comment',
14       7
15     ],
16     [
17       /\/\*\*/g,
18       'sh_comment',
19       8
20     ],
21     [
22       /\/\*/g,
23       'sh_comment',
24       9
25     ],
26     [
27       /(\bstruct)([ \t]+)([A-Za-z0-9_]+)/g,
28       ['sh_keyword', 'sh_normal', 'sh_classname'],
29       -1
30     ],
31     [
32       /^[ \t]*#(?:[ \t]*include)/g,
33       'sh_preproc',
34       10,
35       1
36     ],
37     [
38       /^[ \t]*#(?:[ \t]*[A-Za-z0-9_]*)/g,
39       'sh_preproc',
40       -1
41     ],
42     [
43       /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
44       'sh_number',
45       -1
46     ],
47     [
48       /"/g,
49       'sh_string',
50       13
51     ],
52     [
53       /'/g,
54       'sh_string',
55       14
56     ],
57     [
58       /\b(?:__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|break|case|catch|cdecl|const|continue|default|do|else|enum|extern|for|goto|if|pascal|register|return|sizeof|static|struct|switch|typedef|union|volatile|while)\b/g,
59       'sh_keyword',
60       -1
61     ],
62     [
63       /\b(?:bool|char|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g,
64       'sh_type',
65       -1
66     ],
67     [
68       /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
69       'sh_symbol',
70       -1
71     ],
72     [
73       /\{|\}/g,
74       'sh_cbracket',
75       -1
76     ],
77     [
78       /(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,
79       'sh_function',
80       -1
81     ],
82     [
83       /([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,
84       ['sh_usertype', 'sh_usertype', 'sh_normal'],
85       -1
86     ]
87   ],
88   [
89     [
90       /$/g,
91       null,
92       -2
93     ],
94     [
95       /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
96       'sh_url',
97       -1
98     ],
99     [
100       /<\?xml/g,
101       'sh_preproc',
102       2,
103       1
104     ],
105     [
106       /<!DOCTYPE/g,
107       'sh_preproc',
108       4,
109       1
110     ],
111     [
112       /<!--/g,
113       'sh_comment',
114       5
115     ],
116     [
117       /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
118       'sh_keyword',
119       -1
120     ],
121     [
122       /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
123       'sh_keyword',
124       6,
125       1
126     ],
127     [
128       /&(?:[A-Za-z0-9]+);/g,
129       'sh_preproc',
130       -1
131     ],
132     [
133       /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
134       'sh_keyword',
135       -1
136     ],
137     [
138       /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
139       'sh_keyword',
140       6,
141       1
142     ],
143     [
144       /@[A-Za-z]+/g,
145       'sh_type',
146       -1
147     ],
148     [
149       /(?:TODO|FIXME|BUG)(?:[:]?)/g,
150       'sh_todo',
151       -1
152     ]
153   ],
154   [
155     [
156       /\?>/g,
157       'sh_preproc',
158       -2
159     ],
160     [
161       /([^=" \t>]+)([ \t]*)(=?)/g,
162       ['sh_type', 'sh_normal', 'sh_symbol'],
163       -1
164     ],
165     [
166       /"/g,
167       'sh_string',
168       3
169     ]
170   ],
171   [
172     [
173       /\\(?:\\|")/g,
174       null,
175       -1
176     ],
177     [
178       /"/g,
179       'sh_string',
180       -2
181     ]
182   ],
183   [
184     [
185       />/g,
186       'sh_preproc',
187       -2
188     ],
189     [
190       /([^=" \t>]+)([ \t]*)(=?)/g,
191       ['sh_type', 'sh_normal', 'sh_symbol'],
192       -1
193     ],
194     [
195       /"/g,
196       'sh_string',
197       3
198     ]
199   ],
200   [
201     [
202       /-->/g,
203       'sh_comment',
204       -2
205     ],
206     [
207       /<!--/g,
208       'sh_comment',
209       5
210     ]
211   ],
212   [
213     [
214       /(?:\/)?>/g,
215       'sh_keyword',
216       -2
217     ],
218     [
219       /([^=" \t>]+)([ \t]*)(=?)/g,
220       ['sh_type', 'sh_normal', 'sh_symbol'],
221       -1
222     ],
223     [
224       /"/g,
225       'sh_string',
226       3
227     ]
228   ],
229   [
230     [
231       /$/g,
232       null,
233       -2
234     ]
235   ],
236   [
237     [
238       /\*\//g,
239       'sh_comment',
240       -2
241     ],
242     [
243       /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
244       'sh_url',
245       -1
246     ],
247     [
248       /<\?xml/g,
249       'sh_preproc',
250       2,
251       1
252     ],
253     [
254       /<!DOCTYPE/g,
255       'sh_preproc',
256       4,
257       1
258     ],
259     [
260       /<!--/g,
261       'sh_comment',
262       5
263     ],
264     [
265       /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
266       'sh_keyword',
267       -1
268     ],
269     [
270       /<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
271       'sh_keyword',
272       6,
273       1
274     ],
275     [
276       /&(?:[A-Za-z0-9]+);/g,
277       'sh_preproc',
278       -1
279     ],
280     [
281       /<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
282       'sh_keyword',
283       -1
284     ],
285     [
286       /<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
287       'sh_keyword',
288       6,
289       1
290     ],
291     [
292       /@[A-Za-z]+/g,
293       'sh_type',
294       -1
295     ],
296     [
297       /(?:TODO|FIXME|BUG)(?:[:]?)/g,
298       'sh_todo',
299       -1
300     ]
301   ],
302   [
303     [
304       /\*\//g,
305       'sh_comment',
306       -2
307     ],
308     [
309       /(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
310       'sh_url',
311       -1
312     ],
313     [
314       /(?:TODO|FIXME|BUG)(?:[:]?)/g,
315       'sh_todo',
316       -1
317     ]
318   ],
319   [
320     [
321       /$/g,
322       null,
323       -2
324     ],
325     [
326       /</g,
327       'sh_string',
328       11
329     ],
330     [
331       /"/g,
332       'sh_string',
333       12
334     ],
335     [
336       /\/\/\//g,
337       'sh_comment',
338       1
339     ],
340     [
341       /\/\//g,
342       'sh_comment',
343       7
344     ],
345     [
346       /\/\*\*/g,
347       'sh_comment',
348       8
349     ],
350     [
351       /\/\*/g,
352       'sh_comment',
353       9
354     ]
355   ],
356   [
357     [
358       /$/g,
359       null,
360       -2
361     ],
362     [
363       />/g,
364       'sh_string',
365       -2
366     ]
367   ],
368   [
369     [
370       /$/g,
371       null,
372       -2
373     ],
374     [
375       /\\(?:\\|")/g,
376       null,
377       -1
378     ],
379     [
380       /"/g,
381       'sh_string',
382       -2
383     ]
384   ],
385   [
386     [
387       /"/g,
388       'sh_string',
389       -2
390     ],
391     [
392       /\\./g,
393       'sh_specialchar',
394       -1
395     ]
396   ],
397   [
398     [
399       /'/g,
400       'sh_string',
401       -2
402     ],
403     [
404       /\\./g,
405       'sh_specialchar',
406       -1
407     ]
408   ]