blob: 502e98852a2ee51385498eca117b1976161ccfad [file] [log] [blame]
Yinzuo Jiang011f2222024-07-29 20:51:05 +02001" Vim syntax file
2" Language: Thrift
3" Original Author: Martin Smith <martin@facebook.com>
4" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
5" Last Change: 2024/07/29
6" https://github.com/apache/thrift/blob/master/contrib/thrift.vim
7"
8" Licensed to the Apache Software Foundation (ASF) under one
9" or more contributor license agreements. See the NOTICE file
10" distributed with this work for additional information
11" regarding copyright ownership. The ASF licenses this file
12" to you under the Apache License, Version 2.0 (the
13" "License"); you may not use this file except in compliance
14" with the License. You may obtain a copy of the License at
15"
16" http://www.apache.org/licenses/LICENSE-2.0
17"
18" Unless required by applicable law or agreed to in writing,
19" software distributed under the License is distributed on an
20" "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21" KIND, either express or implied. See the License for the
22" specific language governing permissions and limitations
23" under the License.
24"
25
26if exists("b:current_syntax")
27 finish
28endif
29
30" Todo
31syn keyword thriftTodo TODO todo FIXME fixme XXX xxx contained
32
33" Comments
34syn match thriftComment "#.*" contains=thriftTodo
35syn region thriftComment start="/\*" end="\*/" contains=thriftTodo
36syn match thriftComment "//.\{-}\(?>\|$\)\@="
37
38" String
39syn region thriftStringDouble matchgroup=None start=+"+ end=+"+
40
41" Number
42syn match thriftNumber "-\=\<\d\+\>" contained
43
44" Keywords
45syn keyword thriftKeyword namespace
46syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
47syn keyword thriftKeyword include cpp_include cpp_type const optional required
48syn keyword thriftBasicTypes void bool byte i8 i16 i32 i64 double string binary
49syn keyword thriftStructure map list set struct typedef exception enum throws union
50
51" Special
52syn match thriftSpecial "\d\+:"
53
54" Structure
55syn keyword thriftStructure service oneway extends
56"async" { return tok_async; }
57"exception" { return tok_xception; }
58"extends" { return tok_extends; }
59"throws" { return tok_throws; }
60"service" { return tok_service; }
61"enum" { return tok_enum; }
62"const" { return tok_const; }
63
64hi def link thriftComment Comment
65hi def link thriftKeyword Special
66hi def link thriftBasicTypes Type
67hi def link thriftStructure StorageClass
68hi def link thriftTodo Todo
69hi def link thriftString String
70hi def link thriftNumber Number
71hi def link thriftSpecial Special
72hi def link thriftStructure Structure
73
74let b:current_syntax = "thrift"