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