roboconf.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. const IDENTIFIER = '[a-zA-Z-_][^\\n{]+\\{';
  10. const PROPERTY = {
  11. className: 'attribute',
  12. begin: /[a-zA-Z-_]+/,
  13. end: /\s*:/,
  14. 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. return {
  31. name: 'Roboconf',
  32. aliases: [
  33. 'graph',
  34. 'instances'
  35. ],
  36. case_insensitive: true,
  37. keywords: 'import',
  38. contains: [
  39. // Facet sections
  40. {
  41. begin: '^facet ' + IDENTIFIER,
  42. end: /\}/,
  43. keywords: 'facet',
  44. contains: [
  45. PROPERTY,
  46. hljs.HASH_COMMENT_MODE
  47. ]
  48. },
  49. // Instance sections
  50. {
  51. begin: '^\\s*instance of ' + IDENTIFIER,
  52. end: /\}/,
  53. keywords: 'name count channels instance-data instance-state instance of',
  54. illegal: /\S/,
  55. contains: [
  56. 'self',
  57. PROPERTY,
  58. hljs.HASH_COMMENT_MODE
  59. ]
  60. },
  61. // Component sections
  62. {
  63. begin: '^' + IDENTIFIER,
  64. end: /\}/,
  65. contains: [
  66. PROPERTY,
  67. hljs.HASH_COMMENT_MODE
  68. ]
  69. },
  70. // Comments
  71. hljs.HASH_COMMENT_MODE
  72. ]
  73. };
  74. }
  75. module.exports = roboconf;