]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/capnproto.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / capnproto.js
1 /*! `capnproto` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Cap’n Proto
7 Author: Oleg Efimov <efimovov@gmail.com>
8 Description: Cap’n Proto message definition format
9 Website: https://capnproto.org/capnp-tool.html
10 Category: protocols
11 */
12
13 /** @type LanguageFn */
14 function capnproto(hljs) {
15 const KEYWORDS = [
16 "struct",
17 "enum",
18 "interface",
19 "union",
20 "group",
21 "import",
22 "using",
23 "const",
24 "annotation",
25 "extends",
26 "in",
27 "of",
28 "on",
29 "as",
30 "with",
31 "from",
32 "fixed"
33 ];
34 const TYPES = [
35 "Void",
36 "Bool",
37 "Int8",
38 "Int16",
39 "Int32",
40 "Int64",
41 "UInt8",
42 "UInt16",
43 "UInt32",
44 "UInt64",
45 "Float32",
46 "Float64",
47 "Text",
48 "Data",
49 "AnyPointer",
50 "AnyStruct",
51 "Capability",
52 "List"
53 ];
54 const LITERALS = [
55 "true",
56 "false"
57 ];
58 const CLASS_DEFINITION = {
59 variants: [
60 { match: [
61 /(struct|enum|interface)/,
62 /\s+/,
63 hljs.IDENT_RE
64 ] },
65 { match: [
66 /extends/,
67 /\s*\(/,
68 hljs.IDENT_RE,
69 /\s*\)/
70 ] }
71 ],
72 scope: {
73 1: "keyword",
74 3: "title.class"
75 }
76 };
77 return {
78 name: 'Cap’n Proto',
79 aliases: [ 'capnp' ],
80 keywords: {
81 keyword: KEYWORDS,
82 type: TYPES,
83 literal: LITERALS
84 },
85 contains: [
86 hljs.QUOTE_STRING_MODE,
87 hljs.NUMBER_MODE,
88 hljs.HASH_COMMENT_MODE,
89 {
90 className: 'meta',
91 begin: /@0x[\w\d]{16};/,
92 illegal: /\n/
93 },
94 {
95 className: 'symbol',
96 begin: /@\d+\b/
97 },
98 CLASS_DEFINITION
99 ]
100 };
101 }
102
103 return capnproto;
104
105 })();
106 ;
107 export default hljsGrammar;