datascript.vim (3807B)
1 " Vim syntax file 2 " Language: DataScript 3 " Maintainer: Dominique Pelle <dominique.pelle@gmail.com> 4 " Last Change: 2015 Jul 30 5 " 6 " DataScript is a formal language for modelling binary datatypes, 7 " bitstreams or file formats. For more information, see: 8 " 9 " http://dstools.sourceforge.net/DataScriptLanguageOverview.html 10 11 " quit when a syntax file was already loaded 12 if exists("b:current_syntax") 13 finish 14 endif 15 let s:keepcpo= &cpo 16 set cpo&vim 17 18 syn keyword dsPackage import package 19 syn keyword dsType bit bool string 20 syn keyword dsType int int8 int16 int32 int64 21 syn keyword dsType uint8 uint16 uint32 uint64 22 syn keyword dsType varint16 varint32 varint64 23 syn keyword dsType varuint16 varuint32 varuint64 24 syn keyword dsType leint16 leint32 leint64 25 syn keyword dsType leuint16 leuint32 leuint64 26 syn keyword dsEndian little big 27 syn keyword dsAlign align 28 syn keyword dsLabel case default 29 syn keyword dsConditional if condition 30 syn keyword dsBoolean true false 31 syn keyword dsCompound union choice on enum bitmask subtype explicit 32 syn keyword dsKeyword function return 33 syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in 34 syn keyword dsStorageClass const 35 syn keyword dsTodo contained TODO FIXME XXX 36 syn keyword dsSql sql sql_table sql_database sql_pragma sql_index 37 syn keyword dsSql sql_integer sql_metadata sql_key sql_virtual 38 syn keyword dsSql using reference_key foreign_key to 39 40 " dsCommentGroup allows adding matches for special things in comments. 41 syn cluster dsCommentGroup contains=dsTodo 42 43 syn match dsOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:" 44 45 syn match dsNumber display "\<\d\+\>" 46 syn match dsNumberHex display "\<0[xX]\x\+\>" 47 syn match dsNumberBin display "\<[01]\+[bB]\>" contains=dsBinaryB 48 syn match dsBinaryB display contained "[bB]\>" 49 syn match dsOctal display "\<0\o\+\>" contains=dsOctalZero 50 syn match dsOctalZero display contained "\<0" 51 52 syn match dsOctalError display "\<0\o*[89]\d*\>" 53 54 syn match dsCommentError display "\*/" 55 syn match dsCommentStartError display "/\*"me=e-1 contained 56 57 syn region dsCommentL 58 \ start="//" skip="\\$" end="$" keepend 59 \ contains=@dsCommentGroup,@Spell 60 syn region dsComment 61 \ matchgroup=dsCommentStart start="/\*" end="\*/" 62 \ contains=@dsCommentGroup,dsCommentStartError,@Spell extend 63 64 syn region dsString 65 \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell 66 67 syn sync ccomment dsComment 68 69 " Define the default highlighting. 70 hi def link dsType Type 71 hi def link dsEndian StorageClass 72 hi def link dsStorageClass StorageClass 73 hi def link dsAlign Label 74 hi def link dsLabel Label 75 hi def link dsOffset Label 76 hi def link dsSql PreProc 77 hi def link dsCompound Structure 78 hi def link dsConditional Conditional 79 hi def link dsBoolean Boolean 80 hi def link dsKeyword Statement 81 hi def link dsString String 82 hi def link dsNumber Number 83 hi def link dsNumberBin Number 84 hi def link dsBinaryB Special 85 hi def link dsOctal Number 86 hi def link dsOctalZero Special 87 hi def link dsOctalError Error 88 hi def link dsNumberHex Number 89 hi def link dsTodo Todo 90 hi def link dsOperator Operator 91 hi def link dsPackage Include 92 hi def link dsCommentError Error 93 hi def link dsCommentStartError Error 94 hi def link dsCommentStart dsComment 95 hi def link dsCommentL dsComment 96 hi def link cCommentL dsComment 97 hi def link dsComment Comment 98 99 let b:current_syntax = "datascript" 100 101 let &cpo = s:keepcpo 102 unlet s:keepcpo