7
|
1 " Vim syntax file
|
375
|
2 " Language: YAML (YAML Ain't Markup Language)
|
839
|
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
|
1698
|
4 " Latest Revision: 2006-04-19
|
7
|
5
|
375
|
6 if exists("b:current_syntax")
|
7
|
7 finish
|
|
8 endif
|
|
9
|
375
|
10 let s:cpo_save = &cpo
|
|
11 set cpo&vim
|
7
|
12
|
1698
|
13 syn keyword yamlTodo contained TODO FIXME XXX NOTE
|
7
|
14
|
1698
|
15 syn region yamlComment display oneline start='\%(^\|\s\)#' end='$'
|
|
16 \ contains=yamlTodo,@Spell
|
7
|
17
|
1698
|
18 syn match yamlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
7
|
19
|
1698
|
20 syn match yamlAnchor '&.\+'
|
|
21
|
|
22 syn match yamlAlias '\*.\+'
|
7
|
23
|
1698
|
24 syn match yamlDelimiter '[-,:]'
|
|
25 syn match yamlBlock '[\[\]{}>|]'
|
|
26 syn match yamlOperator '[?+-]'
|
|
27 syn match yamlKey '\w\+\(\s\+\w\+\)*\ze\s*:'
|
7
|
28
|
1698
|
29 syn region yamlString start=+"+ skip=+\\"+ end=+"+
|
|
30 \ contains=yamlEscape
|
|
31 syn region yamlString start=+'+ skip=+''+ end=+'+
|
|
32 \ contains=yamlSingleEscape
|
|
33 syn match yamlEscape contained display +\\[\\"abefnrtv^0_ NLP]+
|
|
34 syn match yamlEscape contained display '\\x\x\{2}'
|
|
35 syn match yamlEscape contained display '\\u\x\{4}'
|
|
36 syn match yamlEscape contained display '\\U\x\{8}'
|
7
|
37 " TODO: how do we get 0x85, 0x2028, and 0x2029 into this?
|
1698
|
38 syn match yamlEscape display '\\\%(\r\n\|[\r\n]\)'
|
|
39 syn match yamlSingleEscape contained display +''+
|
7
|
40
|
375
|
41 " TODO: sexagecimal and fixed (20:30.15 and 1,230.15)
|
1698
|
42 syn match yamlNumber display
|
|
43 \ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\='
|
|
44 syn match yamlNumber display '0\o\+'
|
|
45 syn match yamlNumber display '0x\x\+'
|
|
46 syn match yamlNumber display '([+-]\=[iI]nf)'
|
|
47 syn match yamlNumber display '(NaN)'
|
7
|
48
|
1698
|
49 syn match yamlConstant '\<[~yn]\>'
|
|
50 syn keyword yamlConstant true True TRUE false False FALSE
|
|
51 syn keyword yamlConstant yes Yes on ON no No off OFF
|
|
52 syn keyword yamlConstant null Null NULL nil Nil NIL
|
7
|
53
|
1698
|
54 syn match yamlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\='
|
7
|
55
|
1698
|
56 syn region yamlDocumentHeader start='---' end='$' contains=yamlDirective
|
|
57 syn match yamlDocumentEnd '\.\.\.'
|
7
|
58
|
1698
|
59 syn match yamlDirective contained '%[^:]\+:.\+'
|
7
|
60
|
375
|
61 hi def link yamlTodo Todo
|
|
62 hi def link yamlComment Comment
|
|
63 hi def link yamlDocumentHeader PreProc
|
|
64 hi def link yamlDocumentEnd PreProc
|
|
65 hi def link yamlDirective Keyword
|
|
66 hi def link yamlNodeProperty Type
|
|
67 hi def link yamlAnchor Type
|
|
68 hi def link yamlAlias Type
|
|
69 hi def link yamlDelimiter Delimiter
|
|
70 hi def link yamlBlock Operator
|
|
71 hi def link yamlOperator Operator
|
|
72 hi def link yamlKey Identifier
|
|
73 hi def link yamlString String
|
|
74 hi def link yamlEscape SpecialChar
|
|
75 hi def link yamlSingleEscape SpecialChar
|
|
76 hi def link yamlNumber Number
|
|
77 hi def link yamlConstant Constant
|
|
78 hi def link yamlTimestamp Number
|
7
|
79
|
|
80 let b:current_syntax = "yaml"
|
|
81
|
375
|
82 let &cpo = s:cpo_save
|
|
83 unlet s:cpo_save
|