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