roboconf.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Language: Roboconf
  3. Author: Vincent Zurczak <[email protected]>
  4. Website: http://roboconf.net
  5. Description: Syntax highlighting for Roboconf's DSL
  6. Category: config
  7. */
  8. function(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. aliases: ['graph', 'instances'],
  30. case_insensitive: true,
  31. keywords: 'import',
  32. contains: [
  33. // Facet sections
  34. {
  35. begin: '^facet ' + IDENTIFIER,
  36. end: '}',
  37. keywords: 'facet',
  38. contains: [
  39. PROPERTY,
  40. hljs.HASH_COMMENT_MODE
  41. ]
  42. },
  43. // Instance sections
  44. {
  45. begin: '^\\s*instance of ' + IDENTIFIER,
  46. end: '}',
  47. keywords: 'name count channels instance-data instance-state instance of',
  48. illegal: /\S/,
  49. contains: [
  50. 'self',
  51. PROPERTY,
  52. hljs.HASH_COMMENT_MODE
  53. ]
  54. },
  55. // Component sections
  56. {
  57. begin: '^' + IDENTIFIER,
  58. end: '}',
  59. contains: [
  60. PROPERTY,
  61. hljs.HASH_COMMENT_MODE
  62. ]
  63. },
  64. // Comments
  65. hljs.HASH_COMMENT_MODE
  66. ]
  67. };
  68. }