protobuf.js 978 B

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