UNPKG

1.58 kBJavaScriptView Raw
1/*
2Language: Roboconf
3Author: Vincent Zurczak <vzurczak@linagora.com>
4Description: Syntax highlighting for Roboconf's DSL
5Website: http://roboconf.net
6Category: config
7*/
8
9function roboconf(hljs) {
10 const IDENTIFIER = '[a-zA-Z-_][^\\n{]+\\{';
11
12 const PROPERTY = {
13 className: 'attribute',
14 begin: /[a-zA-Z-_]+/,
15 end: /\s*:/,
16 excludeEnd: true,
17 starts: {
18 end: ';',
19 relevance: 0,
20 contains: [
21 {
22 className: 'variable',
23 begin: /\.[a-zA-Z-_]+/
24 },
25 {
26 className: 'keyword',
27 begin: /\(optional\)/
28 }
29 ]
30 }
31 };
32
33 return {
34 name: 'Roboconf',
35 aliases: [
36 'graph',
37 'instances'
38 ],
39 case_insensitive: true,
40 keywords: 'import',
41 contains: [
42 // Facet sections
43 {
44 begin: '^facet ' + IDENTIFIER,
45 end: /\}/,
46 keywords: 'facet',
47 contains: [
48 PROPERTY,
49 hljs.HASH_COMMENT_MODE
50 ]
51 },
52
53 // Instance sections
54 {
55 begin: '^\\s*instance of ' + IDENTIFIER,
56 end: /\}/,
57 keywords: 'name count channels instance-data instance-state instance of',
58 illegal: /\S/,
59 contains: [
60 'self',
61 PROPERTY,
62 hljs.HASH_COMMENT_MODE
63 ]
64 },
65
66 // Component sections
67 {
68 begin: '^' + IDENTIFIER,
69 end: /\}/,
70 contains: [
71 PROPERTY,
72 hljs.HASH_COMMENT_MODE
73 ]
74 },
75
76 // Comments
77 hljs.HASH_COMMENT_MODE
78 ]
79 };
80}
81
82export { roboconf as default };