roboconf.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. function roboconf(hljs) {
  9. var IDENTIFIER = '[a-zA-Z-_][^\\n{]+\\{';
  10. var PROPERTY = {
  11. className: 'attribute',
  12. begin: /[a-zA-Z-_]+/, end: /\s*:/, excludeEnd: true,
  13. starts: {
  14. end: ';',
  15. relevance: 0,
  16. contains: [
  17. {
  18. className: 'variable',
  19. begin: /\.[a-zA-Z-_]+/
  20. },
  21. {
  22. className: 'keyword',
  23. begin: /\(optional\)/
  24. }
  25. ]
  26. }
  27. };
  28. return {
  29. name: 'Roboconf',
  30. aliases: ['graph', 'instances'],
  31. case_insensitive: true,
  32. keywords: 'import',
  33. contains: [
  34. // Facet sections
  35. {
  36. begin: '^facet ' + IDENTIFIER,
  37. end: '}',
  38. keywords: 'facet',
  39. contains: [
  40. PROPERTY,
  41. hljs.HASH_COMMENT_MODE
  42. ]
  43. },
  44. // Instance sections
  45. {
  46. begin: '^\\s*instance of ' + IDENTIFIER,
  47. end: '}',
  48. keywords: 'name count channels instance-data instance-state instance of',
  49. illegal: /\S/,
  50. contains: [
  51. 'self',
  52. PROPERTY,
  53. hljs.HASH_COMMENT_MODE
  54. ]
  55. },
  56. // Component sections
  57. {
  58. begin: '^' + IDENTIFIER,
  59. end: '}',
  60. contains: [
  61. PROPERTY,
  62. hljs.HASH_COMMENT_MODE
  63. ]
  64. },
  65. // Comments
  66. hljs.HASH_COMMENT_MODE
  67. ]
  68. };
  69. }
  70. module.exports = roboconf;