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