capnproto.js 1.4 KB

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