zserio.vim (4394B)
1 " Vim syntax file 2 " Language: Zserio 3 " Maintainer: Dominique Pellé <dominique.pelle@gmail.com> 4 " Last Change: 2023 Jun 18 5 " 6 " Zserio is a serialization schema language for modeling binary 7 " data types, bitstreams or file formats. Based on the zserio 8 " language it is possible to automatically generate encoders and 9 " decoders for a given schema in various target languages 10 " (e.g. Java, C++, Python). 11 " 12 " Zserio is an evolution of the DataScript language. 13 " 14 " For more information, see: 15 " - http://zserio.org/ 16 " - https://github.com/ndsev/zserio 17 18 " quit when a syntax file was already loaded 19 if exists("b:current_syntax") 20 finish 21 endif 22 23 let s:keepcpo= &cpo 24 set cpo&vim 25 26 syn case match 27 28 syn keyword zserioPackage import package zserio_compatibility_version 29 syn keyword zserioType bit bool string 30 syn keyword zserioType int int8 int16 int32 int64 31 syn keyword zserioType uint8 uint16 uint32 uint64 32 syn keyword zserioType float16 float32 float64 33 syn keyword zserioType varint varint16 varint32 varint64 34 syn keyword zserioType varuint varsize varuint16 varuint32 varuint64 35 syn keyword zserioAlign align 36 syn keyword zserioLabel case default 37 syn keyword zserioConditional if condition 38 syn keyword zserioBoolean true false 39 syn keyword zserioCompound struct union choice on enum bitmask subtype 40 syn keyword zserioKeyword function return 41 syn keyword zserioOperator lengthof valueof instanceof numbits isset 42 syn keyword zserioRpc service pubsub topic publish subscribe 43 syn keyword zserioRule rule_group rule 44 syn keyword zserioStorageClass const implicit packed instantiate 45 syn keyword zserioTodo contained TODO FIXME XXX 46 syn keyword zserioSql sql sql_table sql_database sql_virtual sql_without_rowid 47 syn keyword zserioSql explicit using 48 49 " zserioCommentGroup allows adding matches for special things in comments. 50 syn cluster zserioCommentGroup contains=zserioTodo 51 52 syn match zserioOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:" 53 54 syn match zserioNumber display "\<\d\+\>" 55 syn match zserioNumberHex display "\<0[xX]\x\+\>" 56 syn match zserioNumberBin display "\<[01]\+[bB]\>" contains=zserioBinaryB 57 syn match zserioBinaryB display contained "[bB]\>" 58 syn match zserioOctal display "\<0\o\+\>" contains=zserioOctalZero 59 syn match zserioOctalZero display contained "\<0" 60 61 syn match zserioOctalError display "\<0\o*[89]\d*\>" 62 63 syn match zserioCommentError display "\*/" 64 syn match zserioCommentStartError display "/\*"me=e-1 contained 65 66 syn region zserioCommentL 67 \ start="//" skip="\\$" end="$" keepend 68 \ contains=@zserioCommentGroup,@Spell 69 syn region zserioComment 70 \ matchgroup=zserioCommentStart start="/\*" end="\*/" 71 \ contains=@zserioCommentGroup,zserioCommentStartError,@Spell extend 72 73 syn region zserioString 74 \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell 75 76 syn sync ccomment zserioComment 77 78 " Define the default highlighting. 79 hi def link zserioType Type 80 hi def link zserioEndian StorageClass 81 hi def link zserioStorageClass StorageClass 82 hi def link zserioAlign Label 83 hi def link zserioLabel Label 84 hi def link zserioOffset Label 85 hi def link zserioSql PreProc 86 hi def link zserioCompound Structure 87 hi def link zserioConditional Conditional 88 hi def link zserioBoolean Boolean 89 hi def link zserioKeyword Statement 90 hi def link zserioRpc Keyword 91 hi def link zserioRule Keyword 92 hi def link zserioString String 93 hi def link zserioNumber Number 94 hi def link zserioNumberBin Number 95 hi def link zserioBinaryB Special 96 hi def link zserioOctal Number 97 hi def link zserioOctalZero Special 98 hi def link zserioOctalError Error 99 hi def link zserioNumberHex Number 100 hi def link zserioTodo Todo 101 hi def link zserioOperator Operator 102 hi def link zserioPackage Include 103 hi def link zserioCommentError Error 104 hi def link zserioCommentStartError Error 105 hi def link zserioCommentStart zserioComment 106 hi def link zserioCommentL zserioComment 107 hi def link zserioComment Comment 108 109 let b:current_syntax = "zserio" 110 111 let &cpo = s:keepcpo 112 unlet s:keepcpo