temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 1 | " Protocol Buffers - Google's data interchange format |
kenton@google.com | 24bf56f | 2008-09-24 20:31:01 +0000 | [diff] [blame] | 2 | " Copyright 2008 Google Inc. All rights reserved. |
Feng Xiao | e428862 | 2014-10-01 16:26:23 -0700 | [diff] [blame] | 3 | " https://developers.google.com/protocol-buffers/ |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 4 | " |
kenton@google.com | 24bf56f | 2008-09-24 20:31:01 +0000 | [diff] [blame] | 5 | " Redistribution and use in source and binary forms, with or without |
| 6 | " modification, are permitted provided that the following conditions are |
| 7 | " met: |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 8 | " |
kenton@google.com | 24bf56f | 2008-09-24 20:31:01 +0000 | [diff] [blame] | 9 | " * Redistributions of source code must retain the above copyright |
| 10 | " notice, this list of conditions and the following disclaimer. |
| 11 | " * Redistributions in binary form must reproduce the above |
| 12 | " copyright notice, this list of conditions and the following disclaimer |
| 13 | " in the documentation and/or other materials provided with the |
| 14 | " distribution. |
| 15 | " * Neither the name of Google Inc. nor the names of its |
| 16 | " contributors may be used to endorse or promote products derived from |
| 17 | " this software without specific prior written permission. |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 18 | " |
kenton@google.com | 24bf56f | 2008-09-24 20:31:01 +0000 | [diff] [blame] | 19 | " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | " "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | " LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | " A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | " OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | " SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | " LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | " DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | " THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | " OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 30 | |
| 31 | " This is the Vim syntax file for Google Protocol Buffers. |
| 32 | " |
| 33 | " Usage: |
| 34 | " |
| 35 | " 1. cp proto.vim ~/.vim/syntax/ |
| 36 | " 2. Add the following to ~/.vimrc: |
| 37 | " |
| 38 | " augroup filetype |
| 39 | " au! BufRead,BufNewFile *.proto setfiletype proto |
| 40 | " augroup end |
temporal | 8ccb790 | 2008-07-31 01:43:34 +0000 | [diff] [blame] | 41 | " |
| 42 | " Or just create a new file called ~/.vim/ftdetect/proto.vim with the |
| 43 | " previous lines on it. |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 44 | |
| 45 | if version < 600 |
| 46 | syntax clear |
| 47 | elseif exists("b:current_syntax") |
| 48 | finish |
| 49 | endif |
| 50 | |
| 51 | syn case match |
| 52 | |
temporal | 8ccb790 | 2008-07-31 01:43:34 +0000 | [diff] [blame] | 53 | syn keyword pbTodo contained TODO FIXME XXX |
| 54 | syn cluster pbCommentGrp contains=pbTodo |
| 55 | |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 56 | syn keyword pbSyntax syntax import option |
Nobuaki Sukegawa | 33bb176 | 2014-11-25 23:05:30 +0900 | [diff] [blame] | 57 | syn keyword pbStructure package message group oneof |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 58 | syn keyword pbRepeat optional required repeated |
| 59 | syn keyword pbDefault default |
Bo Yang | 5db2173 | 2015-05-21 14:28:59 -0700 | [diff] [blame] | 60 | syn keyword pbExtend extend extensions to max reserved |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 61 | syn keyword pbRPC service rpc returns |
| 62 | |
| 63 | syn keyword pbType int32 int64 uint32 uint64 sint32 sint64 |
| 64 | syn keyword pbType fixed32 fixed64 sfixed32 sfixed64 |
| 65 | syn keyword pbType float double bool string bytes |
| 66 | syn keyword pbTypedef enum |
| 67 | syn keyword pbBool true false |
| 68 | |
| 69 | syn match pbInt /-\?\<\d\+\>/ |
| 70 | syn match pbInt /\<0[xX]\x+\>/ |
| 71 | syn match pbFloat /\<-\?\d*\(\.\d*\)\?/ |
lakshayg | 3cff48d | 2020-10-27 00:12:18 -0700 | [diff] [blame] | 72 | syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp,@Spell |
| 73 | syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp,@Spell |
| 74 | syn region pbString start=/"/ skip=/\\./ end=/"/ contains=@Spell |
| 75 | syn region pbString start=/'/ skip=/\\./ end=/'/ contains=@Spell |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 76 | |
| 77 | if version >= 508 || !exists("did_proto_syn_inits") |
| 78 | if version < 508 |
| 79 | let did_proto_syn_inits = 1 |
| 80 | command -nargs=+ HiLink hi link <args> |
| 81 | else |
| 82 | command -nargs=+ HiLink hi def link <args> |
| 83 | endif |
| 84 | |
temporal | 8ccb790 | 2008-07-31 01:43:34 +0000 | [diff] [blame] | 85 | HiLink pbTodo Todo |
| 86 | |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 87 | HiLink pbSyntax Include |
| 88 | HiLink pbStructure Structure |
| 89 | HiLink pbRepeat Repeat |
| 90 | HiLink pbDefault Keyword |
| 91 | HiLink pbExtend Keyword |
| 92 | HiLink pbRPC Keyword |
| 93 | HiLink pbType Type |
| 94 | HiLink pbTypedef Typedef |
| 95 | HiLink pbBool Boolean |
| 96 | |
| 97 | HiLink pbInt Number |
| 98 | HiLink pbFloat Float |
| 99 | HiLink pbComment Comment |
| 100 | HiLink pbString String |
| 101 | |
| 102 | delcommand HiLink |
| 103 | endif |
| 104 | |
| 105 | let b:current_syntax = "proto" |