blob: 76f977ac1372c765d3267826c6417308dc8e3662 [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 Moolenaar9a7224b2012-04-30 15:56:52 +02004" Last Change: 2012 Apr 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:
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
19syn keyword dsType bit string
20syn keyword dsType int8 int16 int32 int64
21syn 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
28syn keyword dsCompound union choice on enum bitmask subtype
29syn keyword dsKeyword function return
30syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in
31syn keyword dsStorageClass const
32syn keyword dsTodo contained TODO FIXME XXX
33syn keyword dsSql sql sql_table sql_database sql_pragma
34syn keyword dsSql sql_integer sql_metadata sql_key
35
36" dsCommentGroup allows adding matches for special things in comments.
37syn cluster dsCommentGroup contains=dsTodo
38
39syn match dsOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:"
40
41syn match dsNumber display "\<\d\+\>"
42syn match dsNumberHex display "\<0[xX]\x\+\>"
43syn match dsNumberBin display "\<[01]\+[bB]\>" contains=dsBinaryB
44syn match dsBinaryB display contained "[bB]\>"
45syn match dsOctal display "\<0\o\+\>" contains=dsOctalZero
46syn match dsOctalZero display contained "\<0"
47
48syn match dsOctalError display "\<0\o*[89]\d*\>"
49
50syn match dsCommentError display "\*/"
51syn match dsCommentStartError display "/\*"me=e-1 contained
52
53syn region dsCommentL
54 \ start="//" skip="\\$" end="$" keepend
55 \ contains=@dsCommentGroup,@Spell
56syn region dsComment
57 \ matchgroup=dsCommentStart start="/\*" end="\*/"
58 \ contains=@dsCommentGroup,dsCommentStartError,@Spell extend
59
60syn region dsString
61 \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
62
63" Define the default highlighting.
64hi def link dsType Type
65hi def link dsEndian StorageClass
66hi def link dsStorageClass StorageClass
67hi def link dsAlign Label
68hi def link dsLabel Label
69hi def link dsOffset Label
70hi def link dsSql PreProc
71hi def link dsCompound Structure
72hi def link dsConditional Conditional
73hi def link dsKeyword Statement
74hi def link dsString String
75hi def link dsNumber Number
76hi def link dsNumberBin Number
77hi def link dsBinaryB Special
78hi def link dsOctal Number
79hi def link dsOctalZero Special
80hi def link dsOctalError Error
81hi def link dsNumberHex Number
82hi def link dsTodo Todo
83hi def link dsOperator Operator
84hi def link dsPackage Include
85hi def link dsCommentError Error
86hi def link dsCommentStartError Error
87hi def link dsCommentStart dsComment
88hi def link dsCommentL dsComment
89hi def link cCommentL dsComment
90hi def link dsComment Comment
91
92let b:current_syntax = "datascript"
Bram Moolenaar9a7224b2012-04-30 15:56:52 +020093
94let &cpo = s:keepcpo
95unlet s:keepcpo