Subversion Repositories SmartDukaan

Rev

Rev 30 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
30 ashish 1
" Vim syntax file
2
" Language: Thrift
3
" Maintainer: Martin Smith <martin@facebook.com>
4
" Last Change: $Date: $
5
" Copy to ~/.vim/
6
" Add to ~/.vimrc
7
"  au BufRead,BufNewFile *.thrift set filetype=thrift
8
"  au! Syntax thrift source ~/.vim/thrift.vim
9
"
10
" $Id: $
11
"
12
" Licensed to the Apache Software Foundation (ASF) under one
13
" or more contributor license agreements. See the NOTICE file
14
" distributed with this work for additional information
15
" regarding copyright ownership. The ASF licenses this file
16
" to you under the Apache License, Version 2.0 (the
17
" "License"); you may not use this file except in compliance
18
" with the License. You may obtain a copy of the License at
19
"
20
"   http://www.apache.org/licenses/LICENSE-2.0
21
"
22
" Unless required by applicable law or agreed to in writing,
23
" software distributed under the License is distributed on an
24
" "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
25
" KIND, either express or implied. See the License for the
26
" specific language governing permissions and limitations
27
" under the License.
28
"
29
 
30
if version < 600
31
  syntax clear
32
elseif exists("b:current_syntax")
33
  finish
34
endif
35
 
36
" Todo
37
syn keyword thriftTodo TODO todo FIXME fixme XXX xxx contained
38
 
39
" Comments
40
syn match thriftComment "#.*" contains=thriftTodo
41
syn region thriftComment start="/\*" end="\*/" contains=thriftTodo
42
syn match thriftComment "//.\{-}\(?>\|$\)\@="
43
 
44
" String
45
syn region thriftStringDouble matchgroup=None start=+"+  end=+"+
46
 
47
" Number
48
syn match thriftNumber "-\=\<\d\+\>" contained
49
 
50
" Keywords
51
syn keyword thriftKeyword namespace
52
syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
53
syn keyword thriftKeyword include cpp_include cpp_type const optional required
54
syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary
55
syn keyword thriftStructure map list set struct typedef exception enum throws
56
 
57
" Special
58
syn match thriftSpecial "\d\+:"
59
 
60
" Structure
61
syn keyword thriftStructure service oneway extends
62
"async"         { return tok_async;         }
63
"exception"     { return tok_xception;      }
64
"extends"       { return tok_extends;       }
65
"throws"        { return tok_throws;        }
66
"service"       { return tok_service;       }
67
"enum"          { return tok_enum;          }
68
"const"         { return tok_const;         }
69
 
70
if version >= 508 || !exists("did_thrift_syn_inits")
71
  if version < 508
72
    let did_thrift_syn_inits = 1
73
    command! -nargs=+ HiLink hi link <args>
74
  else
75
    command! -nargs=+ HiLink hi def link <args>
76
  endif
77
 
78
  HiLink thriftComment Comment
79
  HiLink thriftKeyword Special
80
  HiLink thriftBasicTypes Type
81
  HiLink thriftStructure StorageClass
82
  HiLink thriftTodo Todo
83
  HiLink thriftString String
84
  HiLink thriftNumber Number
85
  HiLink thriftSpecial Special
86
  HiLink thriftStructure Structure
87
 
88
  delcommand HiLink
89
endif
90
 
91
let b:current_syntax = "thrift"