thrift.js 942 B

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