-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.capnp.js
69 lines (67 loc) · 1.93 KB
/
source.capnp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed permissive.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.capnp'],
names: ["cap'n-proto"],
patterns: [
{
captures: {
1: {name: 'keyword.other.struct.capnp'},
2: {name: 'entity.name.type.capnp'}
},
match: '\\b(struct)(?:\\s+([A-Za-z]+))?'
},
{
match: '\\b(using|import|union|enum|const|interface|annotation)\\b',
name: 'keyword.other.capnp'
},
{
match:
':(Void|Bool|U?Int(8|16|32|64)|Float(32|64)|Text|Data|List\\([.a-zA-Z0-9()]*\\)|Object|union|group)',
name: 'storage.type.builtin.capnp'
},
{match: ':[.a-zA-Z0-9()]+', name: 'storage.type.custom.capnp'},
{match: '\\b(true|false|void)\\b', name: 'constant.language.capnp'},
{
match: '\\b(0x[0-9A-Fa-f]+|\\d+(\\.\\d+)?)\\b',
name: 'constant.numeric.capnp'
},
{match: '@0x[0-9A-Fa-f]+', name: 'constant.numeric.unique-id.capnp'},
{match: '@\\d+', name: 'constant.numeric.ordinal.capnp'},
{
begin: '"',
end: '"',
name: 'string.quoted.double.capnp',
patterns: [{match: '\\.', name: 'constant.character.escape.capnp'}]
},
{
begin: '(^[ \\t]+)?(?=#)',
beginCaptures: {
1: {name: 'punctuation.whitespace.comment.leading.capnp'}
},
end: '(?!\\G)',
patterns: [
{
begin: '#',
beginCaptures: {0: {name: 'punctuation.definition.comment.capnp'}},
end: '\\n',
name: 'comment.line.number-sign.capnp'
}
]
},
{
captures: {
1: {name: 'punctuation.section.block.begin.capnp'},
2: {name: 'punctuation.section.block.end.capnp'}
},
match: '(\\{)(\\})'
}
],
scopeName: 'source.capnp'
}
export default grammar