capnproto.js (1585B)
1 /* 2 Language: Cap’n Proto 3 Author: Oleg Efimov <efimovov@gmail.com> 4 Description: Cap’n Proto message definition format 5 Website: https://capnproto.org/capnp-tool.html 6 Category: protocols 7 */ 8 9 /** @type LanguageFn */ 10 function capnproto(hljs) { 11 return { 12 name: 'Cap’n Proto', 13 aliases: ['capnp'], 14 keywords: { 15 keyword: 16 'struct enum interface union group import using const annotation extends in of on as with from fixed', 17 built_in: 18 'Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 ' + 19 'Text Data AnyPointer AnyStruct Capability List', 20 literal: 21 'true false' 22 }, 23 contains: [ 24 hljs.QUOTE_STRING_MODE, 25 hljs.NUMBER_MODE, 26 hljs.HASH_COMMENT_MODE, 27 { 28 className: 'meta', 29 begin: /@0x[\w\d]{16};/, 30 illegal: /\n/ 31 }, 32 { 33 className: 'symbol', 34 begin: /@\d+\b/ 35 }, 36 { 37 className: 'class', 38 beginKeywords: 'struct enum', end: /\{/, 39 illegal: /\n/, 40 contains: [ 41 hljs.inherit(hljs.TITLE_MODE, { 42 starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title 43 }) 44 ] 45 }, 46 { 47 className: 'class', 48 beginKeywords: 'interface', end: /\{/, 49 illegal: /\n/, 50 contains: [ 51 hljs.inherit(hljs.TITLE_MODE, { 52 starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title 53 }) 54 ] 55 } 56 ] 57 }; 58 } 59 60 module.exports = capnproto;