summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/kdl.vim
blob: 97e8f93b61846096581fdf5954c0f772ad7ad143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
" Vim syntax file
" Language: KDL
" Maintainer: Aram Drevekenin <aram@poor.dev>
" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
" Latest Revision: 2024-06-16

" quit when a syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

syn match kdlNode '\v(\w|-|\=)' display
syn match kdlBool '\v(true|false)' display

syn keyword kdlTodo contained TODO FIXME XXX NOTE
syn region  kdlComment start="//"  end="$"   contains=kdlTodo,@Spell
syn region  kdlComment start="/\*" end="\*/" contains=kdlTodo,@Spell

" Regular int like number with - + or nothing in front
syn match kdlNumber '\d\+'
syn match kdlNumber '[-+]\d\+'

" Floating point number with decimal no E or e (+,-)
syn match kdlNumber '\d\+\.\d*' contained display
syn match kdlNumber '[-+]\d\+\.\d*' contained display

" Floating point like number with E and no decimal point (+,-)
syn match kdlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
syn match kdlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' contained display

" Floating point like number with E and decimal point (+,-)
syn match kdlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
syn match kdlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display

syn region kdlString start='"' end='"' skip='\\\\\|\\"' display

syn region kdlChildren start="{" end="}" contains=kdlString,kdlNumber,kdlNode,kdlBool,kdlComment

hi def link kdlTodo        Todo
hi def link kdlComment     Comment
hi def link kdlNode        Statement
hi def link kdlBool        Boolean
hi def link kdlString      String
hi def link kdlNumber      Number

let b:current_syntax = "kdl"

" vim: sw=2 sts=2 et