roboconf.js 1.3 KB

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