protobuf.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. Language: Protocol Buffers
  3. Author: Dan Tao <[email protected]>
  4. Description: Protocol buffer message definition format
  5. Category: protocols
  6. */
  7. function(hljs) {
  8. return {
  9. keywords: {
  10. keyword: 'package import option optional required repeated group',
  11. built_in: 'double float int32 int64 uint32 uint64 sint32 sint64 ' +
  12. 'fixed32 fixed64 sfixed32 sfixed64 bool string bytes',
  13. literal: 'true false'
  14. },
  15. contains: [
  16. hljs.QUOTE_STRING_MODE,
  17. hljs.NUMBER_MODE,
  18. hljs.C_LINE_COMMENT_MODE,
  19. {
  20. className: 'class',
  21. beginKeywords: 'message enum service', end: /\{/,
  22. illegal: /\n/,
  23. contains: [
  24. hljs.inherit(hljs.TITLE_MODE, {
  25. starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
  26. })
  27. ]
  28. },
  29. {
  30. className: 'function',
  31. beginKeywords: 'rpc',
  32. end: /;/, excludeEnd: true,
  33. keywords: 'rpc returns'
  34. },
  35. {
  36. begin: /^\s*[A-Z_]+/,
  37. end: /\s*=/, excludeEnd: true
  38. }
  39. ]
  40. };
  41. }