thrift.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Language: Thrift
  3. Author: Oleg Efimov <[email protected]>
  4. Description: Thrift message definition format
  5. Category: protocols
  6. */
  7. function(hljs) {
  8. var BUILT_IN_TYPES = 'bool byte i16 i32 i64 double string binary';
  9. return {
  10. keywords: {
  11. keyword:
  12. 'namespace const typedef struct enum service exception void oneway set list map required optional',
  13. built_in:
  14. BUILT_IN_TYPES,
  15. literal:
  16. 'true false'
  17. },
  18. contains: [
  19. hljs.QUOTE_STRING_MODE,
  20. hljs.NUMBER_MODE,
  21. hljs.C_LINE_COMMENT_MODE,
  22. hljs.C_BLOCK_COMMENT_MODE,
  23. {
  24. className: 'class',
  25. beginKeywords: 'struct enum service exception', end: /\{/,
  26. illegal: /\n/,
  27. contains: [
  28. hljs.inherit(hljs.TITLE_MODE, {
  29. starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
  30. })
  31. ]
  32. },
  33. {
  34. begin: '\\b(set|list|map)\\s*<', end: '>',
  35. keywords: BUILT_IN_TYPES,
  36. contains: ['self']
  37. }
  38. ]
  39. };
  40. }