proto.vim 2.9 KB

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