-
Notifications
You must be signed in to change notification settings - Fork 18
/
Protobuf.YAML-tmLanguage
157 lines (136 loc) · 4.26 KB
/
Protobuf.YAML-tmLanguage
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# [PackageDev] target_format: plist, ext: tmLanguage
name: Protocol Buffer
scopeName: source.proto
fileTypes: [proto]
uuid: 750ac1f3-b172-48de-b1a4-a3c310c4a293
patterns:
- include: '#comments'
- include: '#storagetypes'
- include: '#enum'
- include: '#message'
- include: '#option'
- include: '#constants'
- include: '#strings'
- include: '#oneof'
- include: '#packaging'
- include: '#service'
- name: constant.numeric.proto
match: \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b
repository:
comments:
patterns:
- name: comment.block.proto
begin: /\*
end: \*/
- name: comment.line.double-slash.proto
begin: //
end: $\n?
constants:
name: constant.language.proto
match: \b(true|false|max)\b
enum:
begin: (enum)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(\{)?
beginCaptures:
'1': {name: keyword.source.proto}
'3': {name: entity.name.class.message.proto}
end: \}
patterns:
- include: '#option'
- include: '#comments'
- name: keyword.source.proto
match: \b(to|extensions)\b
- match: ([A-Za-z][A-Za-z0-9_]*)(\s*)(=)(\s*)([0-9]*)
captures:
'1': {name: constant.other.proto}
'5': {name: constant.numeric.proto}
message:
begin: (message|extend)(\s+)([A-Za-z][A-Za-z0-9_.]*)(\s*)(\{)?
beginCaptures:
'1': {name: keyword.source.proto}
'3': {name: entity.name.class.message.proto}
end: \}
patterns:
- include: $self
- include: '#enum'
- include: '#option'
- include: '#comments'
- include: '#oneof'
- begin: (optional|repeated|required|to|extensions)(\s+)
beginCaptures:
'1': {name: keyword.source.proto}
end: ;
patterns:
- include: '#storagetypes'
- match: (map)<([A-Za-z][A-Za-z0-9_]*),\s*([A-Za-z][A-Za-z0-9_]*)>\s+([A-Za-z][A-Za-z0-9_]*)
captures:
'1': {name: keyword.source.proto}
'4': {name: entity.name.class.proto}
- match: ([A-Za-z][A-Za-z0-9_]*)(\s+)([A-Za-z][A-Za-z0-9_]*)
captures:
'1': {name: entity.name.class.proto}
- match: (\s*)(=)(\s*)([0-9]*)
captures:
'4': {name: constant.numeric.proto}
- begin: \[
end: \]
patterns:
- name: keyword.source.proto
match: default|packed|deprecated|lazy
- include: '#constants'
oneof:
begin: (oneof)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(\{)?
beginCaptures:
'1': {name: keyword.source.proto}
end: \}
patterns:
- include: '#option'
- include: '#comments'
- name: keyword.source.proto
match: \b(to|extensions)\b
- match: ([A-Za-z][A-Za-z0-9_]*)(\s+)([A-Za-z][A-Za-z0-9_]*)(\s*)(=)(\s*)([0-9]*)
captures:
'1': {name: entity.name.class.proto}
'7': {name: constant.numeric.proto}
option:
begin: (\b)(option)(\b)
beginCaptures:
'2': {name: keyword.source.proto}
end: ;
patterns:
- include: '#comments'
- include: '#strings'
- name: storage.type.proto
match: default|packed|optimize\_for|java\_package|java\_outer\_classname|go\_package|deprecated|lazy|\w+\_api\_version
- name: constant.language.proto
match: (CODE\_SIZE|SPEED)
packaging:
match: (package|import)(?=(\s+)(["]?[A-Za-z][A-Za-z0-9-_./]*["]?)(;))
captures:
'1': {name: keyword.source.proto}
'2': {name: entity.name.tag}
service:
begin: (service)(\s+)([A-Za-z][A-Za-z0-9_.]*)(\s*)(\{)?
beginCaptures:
'1': {name: keyword.source.proto}
'3': {name: entity.name.class.message.proto}
end: \}
patterns:
- include: '#comments'
- begin: (rpc)\s+([A-Za-z][A-Z-a-z0-9_.]+)\s*\((stream\s+)?([A-Za-z0-9_]+)\)\s+(returns)\s+\((stream\s+)?([A-Za-z0-9_.]+)\)\{?
beginCaptures:
'1': {name: keyword.source.proto}
'2': {name: entity.name.function}
'3': {name: keyword.source.proto}
'5': {name: keyword.source.proto}
'6': {name: keyword.source.proto}
end: \}|;
patterns:
- include: '#comments'
- include: '#option'
storagetypes:
name: storage.type.proto
match: \b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b
strings:
name: string.quoted.double.proto
begin: '"'
end: '"'