xref: /vim-8.2.3635/runtime/syntax/proto.vim (revision 577fadfc)
1" syntax file for Protocol Buffers - Google's data interchange format
2"
3" Copyright 2008 Google Inc.  All rights reserved.
4"
5" Permission is hereby granted, free of charge, to any person obtaining a copy
6" of this software and associated documentation files (the "Software"), to deal
7" in the Software without restriction, including without limitation the rights
8" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9" copies of the Software, and to permit persons to whom the Software is
10" furnished to do so, subject to the following conditions:
11"
12" The above copyright notice and this permission notice shall be included in
13" all copies or substantial portions of the Software.
14"
15" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21" THE SOFTWARE.
22"
23" http://code.google.com/p/protobuf/
24
25" quit when a syntax file was already loaded
26if exists("b:current_syntax")
27  finish
28endif
29
30syn case match
31
32syn keyword protoTodo       contained TODO FIXME XXX
33syn cluster protoCommentGrp contains=protoTodo
34
35syn keyword protoSyntax     syntax import option
36syn keyword protoStructure  package message group
37syn keyword protoRepeat     optional required repeated
38syn keyword protoDefault    default
39syn keyword protoExtend     extend extensions to max
40syn keyword protoRPC        service rpc returns
41
42syn keyword protoType      int32 int64 uint32 uint64 sint32 sint64
43syn keyword protoType      fixed32 fixed64 sfixed32 sfixed64
44syn keyword protoType      float double bool string bytes
45syn keyword protoTypedef   enum
46syn keyword protoBool      true false
47
48syn match   protoInt     /-\?\<\d\+\>/
49syn match   protoInt     /\<0[xX]\x+\>/
50syn match   protoFloat   /\<-\?\d*\(\.\d*\)\?/
51syn region  protoComment start="\/\*" end="\*\/" contains=@protoCommentGrp
52syn region  protoComment start="//" skip="\\$" end="$" keepend contains=@protoCommentGrp
53syn region  protoString  start=/"/ skip=/\\./ end=/"/
54syn region  protoString  start=/'/ skip=/\\./ end=/'/
55
56hi def link protoTodo         Todo
57
58hi def link protoSyntax       Include
59hi def link protoStructure    Structure
60hi def link protoRepeat       Repeat
61hi def link protoDefault      Keyword
62hi def link protoExtend       Keyword
63hi def link protoRPC          Keyword
64hi def link protoType         Type
65hi def link protoTypedef      Typedef
66hi def link protoBool         Boolean
67
68hi def link protoInt          Number
69hi def link protoFloat        Float
70hi def link protoComment      Comment
71hi def link protoString       String
72
73let b:current_syntax = "proto"
74