l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

thrift.js (1144B)


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