annotate runtime/syntax/yaml.vim @ 8037:9dea1571b352 v7.4.1313

commit https://github.com/vim/vim/commit/bfa1ffca8bcce92c030d8366036a316954f1ee69 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 13 18:40:30 2016 +0100 patch 7.4.1313 Problem: MS-Windows: Using socket after it was closed causes an exception. Solution: Don't give an error when handling WM_NETBEANS. Re-enable tests for MS-Windows.
author Christian Brabandt <cb@256bit.org>
date Sat, 13 Feb 2016 18:45:04 +0100
parents fbc1131f0ba5
children 8ac85adee561
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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
7 if exists('b:current_syntax')
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
8 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
375
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
11 let s:cpo_save = &cpo
f14cbd913415 updated for version 7.0097
vimboss
parents: 7
diff changeset
12 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
14 " Choose the schema to use
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
15 " TODO: Validate schema
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
16 if !exists('b:yaml_schema')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
17 if exists('g:yaml_schema')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
18 let b:yaml_schema = g:yaml_schema
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
19 else
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
20 let b:yaml_schema = 'core'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
21 endif
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
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
24 let s:ns_char = '\%([\n\r\uFEFF \t]\@!\p\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
25 let s:ns_word_char = '[[:alnum:]_\-]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
26 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
27 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
28 let s:c_ns_anchor_char = '\%([\n\r\uFEFF \t,[\]{}]\@!\p\)'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
29 let s:c_indicator = '[\-?:,[\]{}#&*!|>''"%@`]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
30 let s:c_flow_indicator = '[,[\]{}]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
31
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
32 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
33
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
34 let s:_collection = '[^\@!\(\%(\\\.\|\[^\\\]]\)\+\)]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
35 let s:_neg_collection = '[^\(\%(\\\.\|\[^\\\]]\)\+\)]'
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
36 function s:SimplifyToAssumeAllPrintable(p)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
37 return substitute(a:p, '\V\C\\%('.s:_collection.'\\@!\\p\\)', '[^\1]', '')
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
38 endfunction
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
39 let s:ns_char = s:SimplifyToAssumeAllPrintable(s:ns_char)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
40 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
41 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
42
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
43 function s:SimplifyAdjacentCollections(p)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
44 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
45 endfunction
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
46 let s:ns_uri_char = s:SimplifyAdjacentCollections(s:ns_uri_char)
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
47 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
48
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
49 let s:c_verbatim_tag = '!<'.s:ns_uri_char.'\+>'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
50 let s:c_named_tag_handle = '!'.s:ns_word_char.'\+!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
51 let s:c_secondary_tag_handle = '!!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
52 let s:c_primary_tag_handle = '!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
53 let s:c_tag_handle = '\%('.s:c_named_tag_handle.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
54 \ '\|'.s:c_secondary_tag_handle.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
55 \ '\|'.s:c_primary_tag_handle.'\)'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
56 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
57 let s:c_non_specific_tag = '!'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
58 let s:c_ns_tag_property = s:c_verbatim_tag.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
59 \ '\|'.s:c_ns_shorthand_tag.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
60 \ '\|'.s:c_non_specific_tag
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
61
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
62 let s:c_ns_anchor_name = s:c_ns_anchor_char.'\+'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
63 let s:c_ns_anchor_property = '&'.s:c_ns_anchor_name
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
64 let s:c_ns_alias_node = '\*'.s:c_ns_anchor_name
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
65
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
66 let s:ns_directive_name = s:ns_char.'\+'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
67
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
68 let s:ns_local_tag_prefix = '!'.s:ns_uri_char.'*'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
69 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
70 let s:ns_tag_prefix = s:ns_local_tag_prefix.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
71 \ '\|'.s:ns_global_tag_prefix
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
72
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
73 let s:ns_plain_safe_out = s:ns_char
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
74 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
75
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
76 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
77 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
78 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
79
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
80 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
81 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
82
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
83 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
84 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
85
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
86 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
87 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
88
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
89
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
90 syn keyword yamlTodo contained TODO FIXME XXX NOTE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
92 syn region yamlComment display oneline start='\%\(^\|\s\)#' end='$'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
93 \ contains=yamlTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
95 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
96 \ 'end="$" '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
97 \ 'contains=yamlTAGDirective,'.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
98 \ 'yamlYAMLDirective,'.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
99 \ 'yamlReservedDirective '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
100 \ 'keepend'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
101
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
102 syn match yamlTAGDirective '%TAG\s\+' contained nextgroup=yamlTagHandle
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
103 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
104 execute 'syn match yamlTagPrefix contained nextgroup=yamlComment ' . string(s:ns_tag_prefix)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
106 syn match yamlYAMLDirective '%YAML\s\+' contained nextgroup=yamlYAMLVersion
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
107 syn match yamlYAMLVersion '\d\+\.\d\+' contained nextgroup=yamlComment
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
108
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
109 execute 'syn match yamlReservedDirective contained nextgroup=yamlComment '.
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
110 \string('%\%(\%(TAG\|YAML\)\s\)\@!'.s:ns_directive_name)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
112 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
113 \ contains=yamlEscape
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
114 \ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
115 syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'"
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
116 \ contains=yamlSingleEscape
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
117 \ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
118 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
119 syn match yamlSingleEscape contained "''"
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
120
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
121 syn match yamlBlockScalarHeader contained '\s\+\zs[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\='
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
122
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
123 syn cluster yamlConstant contains=yamlBool,yamlNull
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
124
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
125 syn cluster yamlFlow contains=yamlFlowString,yamlFlowMapping,yamlFlowCollection
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
126 syn cluster yamlFlow add=yamlFlowMappingKey,yamlFlowMappingMerge
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
127 syn cluster yamlFlow add=@yamlConstant,yamlPlainScalar,yamlFloat
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
128 syn cluster yamlFlow add=yamlTimestamp,yamlInteger,yamlMappingKeyStart
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
129 syn cluster yamlFlow add=yamlComment
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
130 syn region yamlFlowMapping matchgroup=yamlFlowIndicator start='{' end='}' contains=@yamlFlow
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
131 syn region yamlFlowCollection matchgroup=yamlFlowIndicator start='\[' end='\]' contains=@yamlFlow
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
132
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
133 execute 'syn match yamlPlainScalar /'.s:ns_plain_out.'/'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
134 execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
135
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
136 syn match yamlMappingKeyStart '?\ze\s'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
137 syn match yamlMappingKeyStart '?' contained
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
138
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
139 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
140 \'nextgroup=yamlKeyValueDelimiter'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
141 syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
142
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
143 syn match yamlBlockCollectionItemStart '^\s*\zs-\%(\s\+-\)*\s' nextgroup=yamlBlockMappingKey,yamlBlockMappingMerge
5340
22da5ab9aaa1 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2608
diff changeset
144 " 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
145 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
146 \'nextgroup=yamlKeyValueDelimiter'
6741
fbc1131f0ba5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5340
diff changeset
147 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
148 \'nextgroup=yamlKeyValueDelimiter'
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
149 syn match yamlBlockMappingMerge /^\s*\zs<<\ze:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
150 syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151
2581
e8a482a7fa6c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2552
diff changeset
152 syn match yamlKeyValueDelimiter /\s*:/ contained
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