capnproto.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module.exports = function(hljs) {
  2. return {
  3. aliases: ['capnp'],
  4. keywords: {
  5. keyword:
  6. 'struct enum interface union group import using const annotation extends in of on as with from fixed',
  7. built_in:
  8. 'Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 ' +
  9. 'Text Data AnyPointer AnyStruct Capability List',
  10. literal:
  11. 'true false'
  12. },
  13. contains: [
  14. hljs.QUOTE_STRING_MODE,
  15. hljs.NUMBER_MODE,
  16. hljs.HASH_COMMENT_MODE,
  17. {
  18. className: 'meta',
  19. begin: /@0x[\w\d]{16};/,
  20. illegal: /\n/
  21. },
  22. {
  23. className: 'symbol',
  24. begin: /@\d+\b/
  25. },
  26. {
  27. className: 'class',
  28. beginKeywords: 'struct enum', end: /\{/,
  29. illegal: /\n/,
  30. contains: [
  31. hljs.inherit(hljs.TITLE_MODE, {
  32. starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
  33. })
  34. ]
  35. },
  36. {
  37. className: 'class',
  38. beginKeywords: 'interface', end: /\{/,
  39. illegal: /\n/,
  40. contains: [
  41. hljs.inherit(hljs.TITLE_MODE, {
  42. starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
  43. })
  44. ]
  45. }
  46. ]
  47. };
  48. };