blob: 2b4ec513b43a3c06d9b66ebc333d6712d7e0b7d1 [file] [log] [blame]
Bram Moolenaar90df5502010-08-01 21:48:21 +02001" Vim syntax file
2" Language: Datascript
3" Maintainer: Dominique Pelle <dominique.pelle@gmail.com>
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +01004" Last Change: 2014 Feb 26
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:
8" http://datascript.berlios.de/DataScriptLanguageOverview.html
9
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020015let s:keepcpo= &cpo
16set cpo&vim
Bram Moolenaar90df5502010-08-01 21:48:21 +020017
18syn keyword dsPackage import package
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +010019syn keyword dsType bit bool string
20syn keyword dsType int int8 int16 int32 int64
Bram Moolenaar90df5502010-08-01 21:48:21 +020021syn keyword dsType uint8 uint16 uint32 uint64
22syn keyword dsType leint16 leint32 leint64
23syn keyword dsType leuint16 leuint32 leuint64
24syn keyword dsEndian little big
25syn keyword dsAlign align
26syn keyword dsLabel case default
27syn keyword dsConditional if condition
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +010028syn keyword dsBoolean true false
29syn keyword dsCompound union choice on enum bitmask subtype explicit
Bram Moolenaar90df5502010-08-01 21:48:21 +020030syn keyword dsKeyword function return
31syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in
32syn keyword dsStorageClass const
33syn keyword dsTodo contained TODO FIXME XXX
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +010034syn keyword dsSql sql sql_table sql_database sql_pragma sql_index
35syn keyword dsSql sql_integer sql_metadata sql_key foreign_key
Bram Moolenaar90df5502010-08-01 21:48:21 +020036
37" dsCommentGroup allows adding matches for special things in comments.
38syn cluster dsCommentGroup contains=dsTodo
39
40syn match dsOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:"
41
42syn match dsNumber display "\<\d\+\>"
43syn match dsNumberHex display "\<0[xX]\x\+\>"
44syn match dsNumberBin display "\<[01]\+[bB]\>" contains=dsBinaryB
45syn match dsBinaryB display contained "[bB]\>"
46syn match dsOctal display "\<0\o\+\>" contains=dsOctalZero
47syn match dsOctalZero display contained "\<0"
48
49syn match dsOctalError display "\<0\o*[89]\d*\>"
50
51syn match dsCommentError display "\*/"
52syn match dsCommentStartError display "/\*"me=e-1 contained
53
54syn region dsCommentL
55 \ start="//" skip="\\$" end="$" keepend
56 \ contains=@dsCommentGroup,@Spell
57syn region dsComment
58 \ matchgroup=dsCommentStart start="/\*" end="\*/"
59 \ contains=@dsCommentGroup,dsCommentStartError,@Spell extend
60
61syn region dsString
62 \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
63
64" Define the default highlighting.
65hi def link dsType Type
66hi def link dsEndian StorageClass
67hi def link dsStorageClass StorageClass
68hi def link dsAlign Label
69hi def link dsLabel Label
70hi def link dsOffset Label
71hi def link dsSql PreProc
72hi def link dsCompound Structure
73hi def link dsConditional Conditional
Bram Moolenaar76f3b1a2014-03-27 22:30:07 +010074hi def link dsBoolean Boolean
Bram Moolenaar90df5502010-08-01 21:48:21 +020075hi def link dsKeyword Statement
76hi def link dsString String
77hi def link dsNumber Number
78hi def link dsNumberBin Number
79hi def link dsBinaryB Special
80hi def link dsOctal Number
81hi def link dsOctalZero Special
82hi def link dsOctalError Error
83hi def link dsNumberHex Number
84hi def link dsTodo Todo
85hi def link dsOperator Operator
86hi def link dsPackage Include
87hi def link dsCommentError Error
88hi def link dsCommentStartError Error
89hi def link dsCommentStart dsComment
90hi def link dsCommentL dsComment
91hi def link cCommentL dsComment
92hi def link dsComment Comment
93
94let b:current_syntax = "datascript"
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020095
96let &cpo = s:keepcpo
97unlet s:keepcpo