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