neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

thrift.vim (2576B)


      1 " 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 
     26 if exists("b:current_syntax")
     27  finish
     28 endif
     29 
     30 " Todo
     31 syn keyword thriftTodo TODO todo FIXME fixme XXX xxx contained
     32 
     33 " Comments
     34 syn match thriftComment "#.*" contains=thriftTodo
     35 syn region thriftComment start="/\*" end="\*/" contains=thriftTodo
     36 syn match thriftComment "//.\{-}\(?>\|$\)\@="
     37 
     38 " String
     39 syn region thriftStringDouble matchgroup=None start=+"+  end=+"+
     40 
     41 " Number
     42 syn match thriftNumber "-\=\<\d\+\>" contained
     43 
     44 " Keywords
     45 syn keyword thriftKeyword namespace
     46 syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
     47 syn keyword thriftKeyword include cpp_include cpp_type const optional required
     48 syn keyword thriftBasicTypes void bool byte i8 i16 i32 i64 double string binary
     49 syn keyword thriftStructure map list set struct typedef exception enum throws union
     50 
     51 " Special
     52 syn match thriftSpecial "\d\+:"
     53 
     54 " Structure
     55 syn 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 
     64 hi def link thriftComment Comment
     65 hi def link thriftKeyword Special
     66 hi def link thriftBasicTypes Type
     67 hi def link thriftStructure StorageClass
     68 hi def link thriftTodo Todo
     69 hi def link thriftString String
     70 hi def link thriftNumber Number
     71 hi def link thriftSpecial Special
     72 hi def link thriftStructure Structure
     73 
     74 let b:current_syntax = "thrift"