-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.rbs.js
116 lines (114 loc) · 4.18 KB
/
source.rbs.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/soutaro/vscode-rbs-syntax>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.rbs'],
names: ['rbs'],
patterns: [
{include: '#comments'},
{include: '#keywords'},
{include: '#strings'}
],
repository: {
comments: {begin: '#', end: '\n', name: 'comment.line.number-sign'},
keywords: {
patterns: [
{
captures: {
1: {name: 'keyword.control.class.rbs'},
2: {name: 'entity.name.class'}
},
match: '\\b(class)\\s+((::)?([A-Z]\\w*(::))*[A-Z]\\w*)',
name: 'keyword.control.class.rbs'
},
{match: '\\b(type)\\b', name: 'keyword.control.type.rbs'},
{
captures: {
1: {name: 'keyword.control.def.rbs'},
2: {name: 'entity.name.function.rbs'}
},
match: '\\b(def)\\b([^:]+)',
name: 'keyword.control.def.rbs'
},
{match: '\\b(self)\\b', name: 'keyword.control.self.rbs'},
{match: '\\b(void)\\b', name: 'keyword.control.void.rbs'},
{match: '\\b(untyped)\\b', name: 'keyword.control.untyped.rbs'},
{match: '\\b(top)\\b', name: 'keyword.control.top.rbs'},
{match: '\\b(bot)\\b', name: 'keyword.control.bot.rbs'},
{match: '\\b(instance)\\b', name: 'keyword.control.instance.rbs'},
{match: '\\b(bool)\\b', name: 'keyword.control.bool.rbs'},
{match: '\\b(nil)\\b', name: 'keyword.control.nil.rbs'},
{match: '\\b(singleton)\\b', name: 'keyword.control.singleton.rbs'},
{
captures: {
1: {name: 'keyword.control.interface.rbs'},
2: {name: 'entity.name.class'}
},
match: '\\b(interface)\\s+((::)?([A-Z]\\w*(::))*_[A-Z]\\w*)',
name: 'keyword.control.interface.rbs'
},
{match: '\\b(end)\\b', name: 'keyword.control.end.rbs'},
{
captures: {
1: {name: 'keyword.control.include.rbs'},
2: {name: 'variable.other.constant.rbs'}
},
match: '\\b(include)\\s+((::)?([A-Z]\\w*(::))*_?[A-Z]\\w*)',
name: 'keyword.control.include.rbs'
},
{
captures: {
1: {name: 'keyword.control.extend.rbs'},
2: {name: 'variable.other.constant.rbs'}
},
match: '\\b(extend)\\s+((::)?([A-Z]\\w*(::))*_?[A-Z]\\w*)',
name: 'keyword.control.extend.rbs'
},
{
captures: {
1: {name: 'keyword.control.prepend.rbs'},
2: {name: 'variable.other.constant.rbs'}
},
match: '\\b(prepend)\\s+((::)?([A-Z]\\w*(::))*[A-Z]\\w*)',
name: 'keyword.control.prepend.rbs'
},
{
captures: {
1: {name: 'keyword.control.module.rbs'},
2: {name: 'entity.name.class'}
},
match: '\\b(module)\\s+((::)?([A-Z]\\w*(::))*[A-Z]\\w*)',
name: 'keyword.control.module.rbs'
},
{match: '\\b(attr_reader)\\b', name: 'keyword.control.attr_reader.rbs'},
{match: '\\b(attr_writer)\\b', name: 'keyword.control.attr_writer.rbs'},
{
match: '\\b(attr_accessor)\\b',
name: 'keyword.control.attr_accessor.rbs'
},
{match: '\\b(public)\\b', name: 'keyword.control.public.rbs'},
{match: '\\b(private)\\b', name: 'keyword.control.private.rbs'},
{match: '\\b(alias)\\b', name: 'keyword.control.alias.rbs'},
{match: '\\b(unchecked)\\b', name: 'keyword.control.unchecked.rbs'},
{match: '\\b(out)\\b', name: 'keyword.control.out.rbs'},
{match: '\\b(in)\\b', name: 'keyword.control.in.rbs'},
{match: '\\b(use)\\b', name: 'keyword.other.use.rbs'},
{match: '\\b(as)\\b', name: 'keyword.other.as.rbs'}
]
},
strings: {
begin: '"',
end: '"',
name: 'string.quoted.double.rbs',
patterns: [{match: '\\\\.', name: 'constant.character.escape.rbs'}]
}
},
scopeName: 'source.rbs'
}
export default grammar