robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Felipe MoralesMerge pull request #3270 from ZyX-I/shada-support321db59ca1

master
5.5 KiB125 linesraw
1if exists("b:current_syntax")
2    finish
3endif
4
5syntax match ShaDaEntryHeader
6      \ '^\u.\{-} with timestamp \d\{4}-\d\d-\d\dT\d\d:\d\d:\d\d:$'
7syntax match ShaDaEntryName '^\u.\{-}\ze with' contained
8      \ containedin=ShaDaEntryHeader
9syntax match ShaDaEntryTimestamp 'timestamp \zs\d\{4}-\d\d-\d\dT\d\d:\d\d:\d\d'
10      \ contained containedin=ShaDaEntryHeader
11syntax match ShaDaEntryTimestampNumber '\d\+' contained
12      \ containedin=ShaDaEntryTimestamp
13
14syntax match ShaDaComment '^\s*#.*$'
15
16syntax region ShaDaEntryMapLong start='^  % Key_*  Description_*  Value$'
17      \ end='^  %\|^\S'me=s-1 contains=ShaDaComment,ShaDaEntryMapLongEntryStart
18syntax region ShaDaEntryMapShort start='^  % Key_*  Value$'
19      \ end='^  %\|^\S'me=s-1 contains=ShaDaComment,ShaDaEntryMapShortEntryStart
20syntax match ShaDaEntryMapHeader '^  % Key_*  \(Description_*  \)\?Value$'
21      \ contained containedin=ShaDaEntryMapLong,ShaDaEntryMapShort
22syntax match ShaDaEntryMapLongEntryStart '^  + 'hs=e-2,he=e-1
23      \ nextgroup=ShaDaEntryMapLongKey
24syntax match ShaDaEntryMapLongKey '\S\+  \+\ze\S'he=e-2 contained
25      \ nextgroup=ShaDaEntryMapLongDescription
26syntax match ShaDaEntryMapLongDescription '.\{-}  \ze\S'he=e-2 contained
27      \ nextgroup=@ShaDaEntryMsgpackValue
28syntax match ShaDaEntryMapShortEntryStart '^  + 'hs=e-2,he=e-1 contained
29      \ nextgroup=ShaDaEntryMapShortKey
30syntax match ShaDaEntryMapShortKey '\S\+  \+\ze\S'he=e-2 contained
31      \ nextgroup=@ShaDaEntryMsgpackValue
32syntax match ShaDaEntryMapBinArrayStart '^  | - 'hs=e-4,he=e-1 contained
33      \ containedin=ShaDaEntryMapLong,ShaDaEntryMapShort
34      \ nextgroup=@ShaDaEntryMsgpackValue
35
36syntax region ShaDaEntryArray start='^  @ Description_*  Value$'
37      \ end='^\S'me=s-1 keepend
38      \ contains=ShaDaComment,ShaDaEntryArrayEntryStart,ShaDaEntryArrayHeader
39syntax match ShaDaEntryArrayHeader '^  @ Description_*  Value$' contained
40syntax match ShaDaEntryArrayEntryStart '^  - 'hs=e-2,he=e-1
41      \ nextgroup=ShaDaEntryArrayDescription
42syntax match ShaDaEntryArrayDescription '.\{-}  \ze\S'he=e-2 contained
43      \ nextgroup=@ShaDaEntryMsgpackValue
44
45syntax match ShaDaEntryRawMsgpack '^  = ' nextgroup=@ShaDaEntryMsgpackValue
46
47syntax cluster ShaDaEntryMsgpackValue
48      \ add=ShaDaMsgpackKeyword,ShaDaMsgpackShaDaKeyword
49      \ add=ShaDaMsgpackInteger,ShaDaMsgpackCharacter,ShaDaMsgpackFloat
50      \ add=ShaDaMsgpackBinaryString,ShaDaMsgpackString,ShaDaMsgpackExt
51      \ add=ShaDaMsgpackArray,ShaDaMsgpackMap
52      \ add=ShaDaMsgpackMultilineArray
53syntax keyword ShaDaMsgpackKeyword contained NIL TRUE FALSE
54syntax keyword ShaDaMsgpackShaDaKeyword contained
55      \ CMD SEARCH EXPR INPUT DEBUG
56      \ CHARACTERWISE LINEWISE BLOCKWISE
57syntax region ShaDaMsgpackBinaryString matchgroup=ShaDaMsgpackStringQuotes
58      \ start='"' skip='\\"' end='"' contained keepend
59syntax match ShaDaMsgpackBinaryStringEscape '\\[\\0n"]'
60      \ contained containedin=ShaDaMsgpackBinaryString
61syntax match ShaDaMsgpackString '=' contained nextgroup=ShaDaMsgpackBinaryString
62syntax match ShaDaMsgpackExt '+(-\?\d\+)' contained
63      \ nextgroup=ShaDaMsgpackBinaryString
64syntax match ShaDaMsgpackExtType '-\?\d\+' contained containedin=ShaDaMsgpackExt
65syntax match ShaDaMsgpackCharacter /'.'/ contained
66syntax match ShaDaMsgpackInteger '-\?\%(0x\x\{,16}\|\d\+\)' contained
67syntax match ShaDaMsgpackFloat '-\?\d\+\.\d\+\%(e[+-]\?\d\+\)\?' contained
68syntax region ShaDaMsgpackArray matchgroup=ShaDaMsgpackArrayBraces
69      \ start='\[' end='\]' contained
70      \ contains=@ShaDaEntryMsgpackValue,ShaDaMsgpackComma
71syntax region ShaDaMsgpackMap matchgroup=ShaDaMsgpackMapBraces
72      \ start='{' end='}' contained
73      \ contains=@ShaDaEntryMsgpackValue,ShaDaMsgpackComma,ShaDaMsgpackColon
74syntax match ShaDaMsgpackComma ',' contained
75syntax match ShaDaMsgpackColon ':' contained
76syntax match ShaDaMsgpackMultilineArray '@' contained
77
78hi def link ShaDaComment Comment
79hi def link ShaDaEntryNumber Number
80hi def link ShaDaEntryTimestamp Operator
81hi def link ShaDaEntryName Keyword
82
83hi def link ShaDaEntryMapHeader PreProc
84
85hi def link ShaDaEntryMapEntryStart Label
86hi def link ShaDaEntryMapLongEntryStart ShaDaEntryMapEntryStart
87hi def link ShaDaEntryMapShortEntryStart ShaDaEntryMapEntryStart
88hi def link ShaDaEntryMapBinArrayStart ShaDaEntryMapEntryStart
89hi def link ShaDaEntryArrayEntryStart ShaDaEntryMapEntryStart
90
91hi def link ShaDaEntryMapKey String
92hi def link ShaDaEntryMapLongKey ShaDaEntryMapKey
93hi def link ShaDaEntryMapShortKey ShaDaEntryMapKey
94
95hi def link ShaDaEntryMapDescription Comment
96hi def link ShaDaEntryMapLongDescription ShaDaEntryMapDescription
97hi def link ShaDaEntryMapShortDescription ShaDaEntryMapDescription
98
99hi def link ShaDaEntryArrayHeader PreProc
100
101hi def link ShaDaEntryArrayDescription ShaDaEntryMapDescription
102
103hi def link ShaDaMsgpackKeyword Keyword
104hi def link ShaDaMsgpackShaDaKeyword ShaDaMsgpackKeyword
105hi def link ShaDaMsgpackCharacter Character
106hi def link ShaDaMsgpackInteger Number
107hi def link ShaDaMsgpackFloat Float
108
109hi def link ShaDaMsgpackBinaryString String
110hi def link ShaDaMsgpackBinaryStringEscape SpecialChar
111hi def link ShaDaMsgpackExtType Typedef
112
113hi def link ShaDaMsgpackStringQuotes Operator
114hi def link ShaDaMsgpackString ShaDaMsgpackStringQuotes
115hi def link ShaDaMsgpackExt ShaDaMsgpackStringQuotes
116
117hi def link ShaDaMsgpackMapBraces Operator
118hi def link ShaDaMsgpackArrayBraces ShaDaMsgpackMapBraces
119
120hi def link ShaDaMsgpackComma Operator
121hi def link ShaDaMsgpackColon ShaDaMsgpackComma
122
123hi def link ShaDaMsgpackMultilineArray Operator
124
125let b:current_syntax = "shada"