UNPKG

1.32 kBJavaScriptView Raw
1/*
2Language: Protocol Buffers
3Author: Dan Tao <daniel.tao@gmail.com>
4Description: Protocol buffer message definition format
5Website: https://developers.google.com/protocol-buffers/docs/proto3
6Category: protocols
7*/
8
9function protobuf(hljs) {
10 return {
11 name: 'Protocol Buffers',
12 keywords: {
13 keyword: 'package import option optional required repeated group oneof',
14 built_in: 'double float int32 int64 uint32 uint64 sint32 sint64 ' +
15 'fixed32 fixed64 sfixed32 sfixed64 bool string bytes',
16 literal: '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: 'message enum service', 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 className: 'function',
35 beginKeywords: 'rpc',
36 end: /[{;]/, excludeEnd: true,
37 keywords: 'rpc returns'
38 },
39 { // match enum items (relevance)
40 // BLAH = ...;
41 begin: /^\s*[A-Z_]+(?=\s*=[^\n]+;$)/
42 }
43 ]
44 };
45}
46
47export { protobuf as default };