Bram Moolenaar | ec7944a | 2013-06-12 21:29:15 +0200 | [diff] [blame] | 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 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 25 | " quit when a syntax file was already loaded |
| 26 | if exists("b:current_syntax") |
Bram Moolenaar | ec7944a | 2013-06-12 21:29:15 +0200 | [diff] [blame] | 27 | finish |
| 28 | endif |
| 29 | |
| 30 | syn case match |
| 31 | |
| 32 | syn keyword protoTodo contained TODO FIXME XXX |
| 33 | syn cluster protoCommentGrp contains=protoTodo |
| 34 | |
| 35 | syn keyword protoSyntax syntax import option |
| 36 | syn keyword protoStructure package message group |
| 37 | syn keyword protoRepeat optional required repeated |
| 38 | syn keyword protoDefault default |
| 39 | syn keyword protoExtend extend extensions to max |
| 40 | syn keyword protoRPC service rpc returns |
| 41 | |
| 42 | syn keyword protoType int32 int64 uint32 uint64 sint32 sint64 |
| 43 | syn keyword protoType fixed32 fixed64 sfixed32 sfixed64 |
| 44 | syn keyword protoType float double bool string bytes |
| 45 | syn keyword protoTypedef enum |
| 46 | syn keyword protoBool true false |
| 47 | |
| 48 | syn match protoInt /-\?\<\d\+\>/ |
| 49 | syn match protoInt /\<0[xX]\x+\>/ |
| 50 | syn match protoFloat /\<-\?\d*\(\.\d*\)\?/ |
| 51 | syn region protoComment start="\/\*" end="\*\/" contains=@protoCommentGrp |
| 52 | syn region protoComment start="//" skip="\\$" end="$" keepend contains=@protoCommentGrp |
| 53 | syn region protoString start=/"/ skip=/\\./ end=/"/ |
| 54 | syn region protoString start=/'/ skip=/\\./ end=/'/ |
| 55 | |
| 56 | hi def link protoTodo Todo |
| 57 | |
| 58 | hi def link protoSyntax Include |
| 59 | hi def link protoStructure Structure |
| 60 | hi def link protoRepeat Repeat |
| 61 | hi def link protoDefault Keyword |
| 62 | hi def link protoExtend Keyword |
| 63 | hi def link protoRPC Keyword |
| 64 | hi def link protoType Type |
| 65 | hi def link protoTypedef Typedef |
| 66 | hi def link protoBool Boolean |
| 67 | |
| 68 | hi def link protoInt Number |
| 69 | hi def link protoFloat Float |
| 70 | hi def link protoComment Comment |
| 71 | hi def link protoString String |
| 72 | |
| 73 | let b:current_syntax = "proto" |