annotate runtime/syntax/yaml.vim @ 19163:63beef1ca62c

Update runtime files. Commit: https://github.com/vim/vim/commit/ade0d39468014fd55d30f7647a1ac104baff4bc5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 21 22:33:58 2020 +0100 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Jan 2020 22:45:04 +0100
parents 8ac85adee561
children b9b335997b26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
2 " Language: YAML (YAML Ain't Markup Language) 1.2
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
3 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
4 " First author: Nikolai Weibull <now@bitwi.se>
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
5 " Latest Revision: 2015-03-28
18053
8ac85adee561 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6741
diff changeset
6 " removed duplicate yamlKeyValueDelimiter (pull #4799)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
8 if exists('b:current_syntax')
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
9 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
12 let s:cpo_save = &cpo
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
13 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
15 " Choose the schema to use
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
16 " TODO: Validate schema
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
17 if !exists('b:yaml_schema')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
18 if exists('g:yaml_schema')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
19 let b:yaml_schema = g:yaml_schema
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
20 else
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
21 let b:yaml_schema = 'core'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
22 endif
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
23 endif
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
24
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
25 let s:ns_char = '\%([\n\r\uFEFF \t]\@!\p\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
26 let s:ns_word_char = '[[:alnum:]_\-]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
27 let s:ns_uri_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$,.!~*''()[\]]\)'
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
28 let s:ns_tag_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$.~*''()]\)'
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
29 let s:c_ns_anchor_char = '\%([\n\r\uFEFF \t,[\]{}]\@!\p\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
30 let s:c_indicator = '[\-?:,[\]{}#&*!|>''"%@`]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
31 let s:c_flow_indicator = '[,[\]{}]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
32
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
33 let s:ns_char_without_c_indicator = substitute(s:ns_char, '\v\C[\zs', '\=s:c_indicator[1:-2]', '')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
34
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
35 let s:_collection = '[^\@!\(\%(\\\.\|\[^\\\]]\)\+\)]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
36 let s:_neg_collection = '[^\(\%(\\\.\|\[^\\\]]\)\+\)]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
37 function s:SimplifyToAssumeAllPrintable(p)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
38 return substitute(a:p, '\V\C\\%('.s:_collection.'\\@!\\p\\)', '[^\1]', '')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
39 endfunction
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
40 let s:ns_char = s:SimplifyToAssumeAllPrintable(s:ns_char)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
41 let s:ns_char_without_c_indicator = s:SimplifyToAssumeAllPrintable(s:ns_char_without_c_indicator)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
42 let s:c_ns_anchor_char = s:SimplifyToAssumeAllPrintable(s:c_ns_anchor_char)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
43
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
44 function s:SimplifyAdjacentCollections(p)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
45 return substitute(a:p, '\V\C'.s:_collection.'\\|'.s:_collection, '[\1\2]', 'g')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
46 endfunction
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
47 let s:ns_uri_char = s:SimplifyAdjacentCollections(s:ns_uri_char)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
48 let s:ns_tag_char = s:SimplifyAdjacentCollections(s:ns_tag_char)
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
49
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
50 let s:c_verbatim_tag = '!<'.s:ns_uri_char.'\+>'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
51 let s:c_named_tag_handle = '!'.s:ns_word_char.'\+!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
52 let s:c_secondary_tag_handle = '!!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
53 let s:c_primary_tag_handle = '!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
54 let s:c_tag_handle = '\%('.s:c_named_tag_handle.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
55 \ '\|'.s:c_secondary_tag_handle.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
56 \ '\|'.s:c_primary_tag_handle.'\)'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
57 let s:c_ns_shorthand_tag = s:c_tag_handle . s:ns_tag_char.'\+'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
58 let s:c_non_specific_tag = '!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
59 let s:c_ns_tag_property = s:c_verbatim_tag.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
60 \ '\|'.s:c_ns_shorthand_tag.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
61 \ '\|'.s:c_non_specific_tag
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
62
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
63 let s:c_ns_anchor_name = s:c_ns_anchor_char.'\+'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
64 let s:c_ns_anchor_property = '&'.s:c_ns_anchor_name
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
65 let s:c_ns_alias_node = '\*'.s:c_ns_anchor_name
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
66
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
67 let s:ns_directive_name = s:ns_char.'\+'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
68
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
69 let s:ns_local_tag_prefix = '!'.s:ns_uri_char.'*'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
70 let s:ns_global_tag_prefix = s:ns_tag_char.s:ns_uri_char.'*'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
71 let s:ns_tag_prefix = s:ns_local_tag_prefix.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
72 \ '\|'.s:ns_global_tag_prefix
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
73
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
74 let s:ns_plain_safe_out = s:ns_char
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
75 let s:ns_plain_safe_in = '\%('.s:c_flow_indicator.'\@!'.s:ns_char.'\)'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
76
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
77 let s:ns_plain_safe_in = substitute(s:ns_plain_safe_in, '\V\C\\%('.s:_collection.'\\@!'.s:_neg_collection.'\\)', '[^\1\2]', '')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
78 let s:ns_plain_safe_in_without_colhash = substitute(s:ns_plain_safe_in, '\V\C'.s:_neg_collection, '[^\1:#]', '')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
79 let s:ns_plain_safe_out_without_colhash = substitute(s:ns_plain_safe_out, '\V\C'.s:_neg_collection, '[^\1:#]', '')
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
80
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
81 let s:ns_plain_first_in = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_in.'\)\@=\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
82 let s:ns_plain_first_out = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_out.'\)\@=\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
83
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
84 let s:ns_plain_char_in = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_in.'\|'.s:ns_plain_safe_in_without_colhash.'\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
85 let s:ns_plain_char_out = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_out.'\|'.s:ns_plain_safe_out_without_colhash.'\)'
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
86
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
87 let s:ns_plain_out = s:ns_plain_first_out . s:ns_plain_char_out.'*'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
88 let s:ns_plain_in = s:ns_plain_first_in . s:ns_plain_char_in.'*'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
89
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
90
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
91 syn keyword yamlTodo contained TODO FIXME XXX NOTE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
93 syn region yamlComment display oneline start='\%\(^\|\s\)#' end='$'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
94 \ contains=yamlTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
96 execute 'syn region yamlDirective oneline start='.string('^\ze%'.s:ns_directive_name.'\s\+').' '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
97 \ 'end="$" '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
98 \ 'contains=yamlTAGDirective,'.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
99 \ 'yamlYAMLDirective,'.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
100 \ 'yamlReservedDirective '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
101 \ 'keepend'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
102
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
103 syn match yamlTAGDirective '%TAG\s\+' contained nextgroup=yamlTagHandle
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
104 execute 'syn match yamlTagHandle contained nextgroup=yamlTagPrefix '.string(s:c_tag_handle.'\s\+')
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
105 execute 'syn match yamlTagPrefix contained nextgroup=yamlComment ' . string(s:ns_tag_prefix)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
107 syn match yamlYAMLDirective '%YAML\s\+' contained nextgroup=yamlYAMLVersion
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
108 syn match yamlYAMLVersion '\d\+\.\d\+' contained nextgroup=yamlComment
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
109
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
110 execute 'syn match yamlReservedDirective contained nextgroup=yamlComment '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
111 \string('%\%(\%(TAG\|YAML\)\s\)\@!'.s:ns_directive_name)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
113 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
114 \ contains=yamlEscape
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
115 \ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
116 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'"
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
117 \ contains=yamlSingleEscape
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
118 \ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
119 syn match yamlEscape contained '\\\%([\\"abefnrtv\^0_ NLP\n]\|x\x\x\|u\x\{4}\|U\x\{8}\)'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
120 syn match yamlSingleEscape contained "''"
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
121
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
122 syn match yamlBlockScalarHeader contained '\s\+\zs[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\='
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
123
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
124 syn cluster yamlConstant contains=yamlBool,yamlNull
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
125
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
126 syn cluster yamlFlow contains=yamlFlowString,yamlFlowMapping,yamlFlowCollection
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
127 syn cluster yamlFlow add=yamlFlowMappingKey,yamlFlowMappingMerge
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
128 syn cluster yamlFlow add=@yamlConstant,yamlPlainScalar,yamlFloat
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
129 syn cluster yamlFlow add=yamlTimestamp,yamlInteger,yamlMappingKeyStart
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
130 syn cluster yamlFlow add=yamlComment
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
131 syn region yamlFlowMapping matchgroup=yamlFlowIndicator start='{' end='}' contains=@yamlFlow
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
132 syn region yamlFlowCollection matchgroup=yamlFlowIndicator start='\[' end='\]' contains=@yamlFlow
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
133
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
134 execute 'syn match yamlPlainScalar /'.s:ns_plain_out.'/'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
135 execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
136
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
137 syn match yamlMappingKeyStart '?\ze\s'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
138 syn match yamlMappingKeyStart '?' contained
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
139
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
140 execute 'syn match yamlFlowMappingKey /\%#=1'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:/ contained '.
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
141 \'nextgroup=yamlKeyValueDelimiter'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
142 syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
143
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
144 syn match yamlBlockCollectionItemStart '^\s*\zs-\%(\s\+-\)*\s' nextgroup=yamlBlockMappingKey,yamlBlockMappingMerge
5340
22da5ab9aaa1 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2608
diff changeset
145 " Use the old regexp engine, the NFA engine doesn't like all the \@ items.
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
146 execute 'syn match yamlBlockMappingKey /\%#=1^\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ '.
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
147 \'nextgroup=yamlKeyValueDelimiter'
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
148 execute 'syn match yamlBlockMappingKey /\%#=1\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ contained '.
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
149 \'nextgroup=yamlKeyValueDelimiter'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
150 syn match yamlBlockMappingMerge /^\s*\zs<<\ze:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
151 syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
153 syn match yamlKeyValueDelimiter /\s*:/ contained
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
154
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
155 syn cluster yamlScalarWithSpecials contains=yamlPlainScalar,yamlBlockMappingKey,yamlFlowMappingKey
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
156
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
157 let s:_bounder = s:SimplifyToAssumeAllPrintable('\%([[\]{}, \t]\@!\p\)')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
158 if b:yaml_schema is# 'json'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
159 syn keyword yamlNull null contained containedin=@yamlScalarWithSpecials
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
160 syn keyword yamlBool true false
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
161 exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(0\|-\=[1-9][0-9]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
162 exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(-\=[1-9][0-9]*\%(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|0\|-\=\.inf\|\.nan\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
163 elseif b:yaml_schema is# 'core'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
164 syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
165 syn keyword yamlBool true True TRUE false False FALSE contained containedin=@yamlScalarWithSpecials
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
166 exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
167 exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%([+-]\=\%(0\%(b[0-1_]\+\|[0-7_]\+\|x[0-9a-fA-F_]\+\)\=\|\%([1-9][0-9_]*\%(:[0-5]\=\d\)\+\)\)\|[1-9][0-9_]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
168 exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%([+-]\=\%(\%(\d[0-9_]*\)\.[0-9_]*\%([eE][+-]\=\d\+\)\=\|\.[0-9_]\+\%([eE][-+]\=[0-9]\+\)\=\|\d[0-9_]*\%(:[0-5]\=\d\)\+\.[0-9_]*\|\.\%(inf\|Inf\|INF\)\)\|\%(\.\%(nan\|NaN\|NAN\)\)\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
169 elseif b:yaml_schema is# 'pyyaml'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
170 syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
171 syn keyword yamlBool true True TRUE false False FALSE yes Yes YES no No NO on On ON off Off OFF contained containedin=@yamlScalarWithSpecials
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
172 exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
173 exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(\v[-+]?%(\d[0-9_]*)\.[0-9_]*%([eE][-+]\d+)?|\.[0-9_]+%([eE][-+]\d+)?|[-+]?\d[0-9_]*%(\:[0-5]?\d)+\.[0-9_]*|[-+]?\.%(inf|Inf|INF)|\.%(nan|NaN|NAN)\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
174 exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(\v[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?%(0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+|[-+]?[1-9][0-9_]*%(:[0-5]?\d)+\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
175 exe 'syn match yamlTimestamp /'.s:_bounder.'\@1<!\%(\v\d\d\d\d\-\d\d\-\d\d|\d\d\d\d \-\d\d? \-\d\d?%([Tt]|[ \t]+)\d\d?\:\d\d \:\d\d %(\.\d*)?%([ \t]*%(Z|[-+]\d\d?%(\:\d\d)?))?\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
176 elseif b:yaml_schema is# 'failsafe'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
177 " Nothing
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
178 endif
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
179 unlet s:_bounder
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
180
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
182 execute 'syn match yamlNodeTag '.string(s:c_ns_tag_property)
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
183 execute 'syn match yamlAnchor '.string(s:c_ns_anchor_property)
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
184 execute 'syn match yamlAlias '.string(s:c_ns_alias_node)
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
185
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
186 syn match yamlDocumentStart '^---\ze\%(\s\|$\)'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
187 syn match yamlDocumentEnd '^\.\.\.\ze\%(\s\|$\)'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
189 hi def link yamlTodo Todo
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
190 hi def link yamlComment Comment
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
191
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
192 hi def link yamlDocumentStart PreProc
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
193 hi def link yamlDocumentEnd PreProc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
195 hi def link yamlDirectiveName Keyword
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
197 hi def link yamlTAGDirective yamlDirectiveName
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
198 hi def link yamlTagHandle String
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
199 hi def link yamlTagPrefix String
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
201 hi def link yamlYAMLDirective yamlDirectiveName
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
202 hi def link yamlReservedDirective Error
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
203 hi def link yamlYAMLVersion Number
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
204
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
205 hi def link yamlString String
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
206 hi def link yamlFlowString yamlString
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
207 hi def link yamlFlowStringDelimiter yamlString
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
208 hi def link yamlEscape SpecialChar
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
209 hi def link yamlSingleEscape SpecialChar
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
210
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
211 hi def link yamlBlockCollectionItemStart Label
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
212 hi def link yamlBlockMappingKey Identifier
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
213 hi def link yamlBlockMappingMerge Special
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
214
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
215 hi def link yamlFlowMappingKey Identifier
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
216 hi def link yamlFlowMappingMerge Special
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
217
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
218 hi def link yamlMappingKeyStart Special
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
219 hi def link yamlFlowIndicator Special
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
220 hi def link yamlKeyValueDelimiter Special
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
221
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
222 hi def link yamlConstant Constant
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
223
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
224 hi def link yamlNull yamlConstant
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
225 hi def link yamlBool yamlConstant
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
226
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
227 hi def link yamlAnchor Type
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
228 hi def link yamlAlias Type
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
229 hi def link yamlNodeTag Type
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
230
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
231 hi def link yamlInteger Number
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
232 hi def link yamlFloat Float
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
233 hi def link yamlTimestamp Number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 let b:current_syntax = "yaml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
237 unlet s:ns_word_char s:ns_uri_char s:c_verbatim_tag s:c_named_tag_handle s:c_secondary_tag_handle s:c_primary_tag_handle s:c_tag_handle s:ns_tag_char s:c_ns_shorthand_tag s:c_non_specific_tag s:c_ns_tag_property s:c_ns_anchor_char s:c_ns_anchor_name s:c_ns_anchor_property s:c_ns_alias_node s:ns_char s:ns_directive_name s:ns_local_tag_prefix s:ns_global_tag_prefix s:ns_tag_prefix s:c_indicator s:ns_plain_safe_out s:c_flow_indicator s:ns_plain_safe_in s:ns_plain_first_in s:ns_plain_first_out s:ns_plain_char_in s:ns_plain_char_out s:ns_plain_out s:ns_plain_in s:ns_char_without_c_indicator s:ns_plain_safe_in_without_colhash s:ns_plain_safe_out_without_colhash
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
238 unlet s:_collection s:_neg_collection
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
239 delfunction s:SimplifyAdjacentCollections
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
240 delfunction s:SimplifyToAssumeAllPrintable
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
241
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
242 let &cpo = s:cpo_save
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
243 unlet s:cpo_save