annotate runtime/syntax/xml.vim @ 32399:18dd2b5d008c v9.0.1531

patch 9.0.1531: crash when register contents ends up being invalid Commit: https://github.com/vim/vim/commit/d1ae8366aff286d41e7f5bc513cc0a1af5130aad Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 9 17:09:30 2023 +0100 patch 9.0.1531: crash when register contents ends up being invalid Problem: Crash when register contents ends up being invalid. Solution: Check "y_array" is not NULL.
author Bram Moolenaar <Bram@vim.org>
date Tue, 09 May 2023 18:15:03 +0200
parents f0d7cb510ce3
children
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
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
2 " Language: XML
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
3 " Maintainer: Christian Brabandt <cb@256bit.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
4 " Repository: https://github.com/chrisbra/vim-xml-ftplugin
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
5 " Previous Maintainer: Johannes Zellner <johannes@zellner.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
6 " Author: Paul Siegmann <pauls@euronet.nl>
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
7 " Last Changed: Nov 03, 2019
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Filenames: *.xml
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
9 " Last Change:
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
10 " 20190923 - Fix xmlEndTag to match xmlTag (vim/vim#884)
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
11 " 20190924 - Fix xmlAttribute property (amadeus/vim-xml@d8ce1c946)
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
12 " 20191103 - Enable spell checking globally
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
13 " 20210428 - Improve syntax synchronizing
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " CONFIGURATION:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " syntax folding can be turned on by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " let g:xml_syntax_folding = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " before the syntax file gets loaded (e.g. in ~/.vimrc).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " This might slow down syntax highlighting significantly,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " especially for large files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " CREDITS:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " The original version was derived by Paul Siegmann from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Claudio Fleiner's html.vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " REFERENCES:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " [1] http://www.w3.org/TR/2000/REC-xml-20001006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " [2] http://www.w3.org/XML/1998/06/xmlspec-report-19980910.htm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " as <hirauchi@kiwi.ne.jp> pointed out according to reference [1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " 2.3 Common Syntactic Constructs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " [5] Name ::= (Letter | '_' | ':') (NameChar)*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " NOTE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " 1) empty tag delimiters "/>" inside attribute values (strings)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " confuse syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " 2) for large files, folding can be pretty slow, especially when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " loading a file the first time and viewoptions contains 'folds'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " so that folds of previous sessions are applied.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Don't use 'foldmethod=syntax' in this case.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 if exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 let s:xml_cpo_save = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 set cpo&vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
57 " Allow spell checking in tag values,
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
58 " there is no syntax region for that,
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
59 " so enable spell checking in top-level elements
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
60 " <tag>This text is spell checked</tag>
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
61 syn spell toplevel
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
62
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " mark illegal characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match xmlError "[<&]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 " strings (inside tags) aka VALUES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " ^^^^^^^
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
72 syn region xmlString contained start=+"+ end=+"+ contains=xmlEntity,@Spell display
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
73 syn region xmlString contained start=+'+ end=+'+ contains=xmlEntity,@Spell display
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " punctuation (within attributes) e.g. <tag xml:foo.attribute ...>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 " ^ ^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 " syn match xmlAttribPunct +[-:._]+ contained display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 syn match xmlAttribPunct +[:.]+ contained display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " no highlighting for xmlEqual (xmlEqual has no highlighting group)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn match xmlEqual +=+ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " attribute, everything before the '='
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " PROVIDES: @xmlAttribHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 " ^^^^^^^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 syn match xmlAttrib
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
95 \ +[-'"<]\@1<!\<[a-zA-Z:_][-.0-9a-zA-Z:_]*\>\%(['"]\@!\|$\)+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 \ contains=xmlAttribPunct,@xmlAttribHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " namespace spec
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " PROVIDES: @xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " <xsl:for-each select = "lola">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 " ^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 if exists("g:xml_namespace_transparent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 syn match xmlNamespace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
112 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+[:]\@=+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 \ contains=@xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 \ transparent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 syn match xmlNamespace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
119 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+[:]\@=+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 \ contains=@xmlNamespaceHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 " tag name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 " PROVIDES: @xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 " ^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 syn match xmlTagName
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
136 \ +\%(<\|</\)\@2<=[^ /!?<>"']\++
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 \ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 " start tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 " use matchgroup=xmlTag to skip over the leading '<'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 " PROVIDES: @xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 " <tag id="whoops">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 " s^^^^^^^^^^^^^^^e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 syn region xmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 \ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 \ matchgroup=xmlTag end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 \ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " highlight the end tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 " PROVIDES: @xmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 " (should we provide a separate @xmlEndTagHook ?)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 " </tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 " ^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 "
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
171 syn region xmlEndTag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
172 \ matchgroup=xmlTag start=+</[^ /!?<>"']\@=+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
173 \ matchgroup=xmlTag end=+>+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 \ contained
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
175 \ contains=xmlTagName,xmlNamespace,xmlAttribPunct,@xmlTagHook
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 " tag elements with syntax-folding.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 " NOTE: NO HIGHLIGHTING -- highlighting is done by contained elements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 " PROVIDES: @xmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " <tag id="whoops">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 " <!-- comment -->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 " <another.tag></another.tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 " <empty.tag/>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 " some data
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 " </tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 syn region xmlRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 \ start=+<\z([^ /!?<>"']\+\)+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 \ skip=+<!--\_.\{-}-->+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 \ end=+</\z1\_\s\{-}>+
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
195 \ end=+/>+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 \ fold
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
197 \ contains=xmlTag,xmlEndTag,xmlCdata,xmlRegion,xmlComment,xmlEntity,xmlProcessing,@xmlRegionHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 " - contained attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 " - xmlRegion not defined
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 syn region xmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 \ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 \ matchgroup=xmlTag end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 \ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
212 syn region xmlEndTag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
213 \ matchgroup=xmlTag start=+</[^ /!?<>"']\@=+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
214 \ matchgroup=xmlTag end=+>+
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 4869
diff changeset
215 \ contains=xmlTagName,xmlNamespace,xmlAttribPunct,@xmlTagHook
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 " &entities; compare with dtd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 syn match xmlEntity "&[^; \t]*;" contains=xmlEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 syn match xmlEntityPunct contained "[&.;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 " The real comments (this implements the comments as defined by xml,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 " but not all xml pages actually conform to it. Errors are flagged.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 syn region xmlComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 \ start=+<!+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 \ end=+>+
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
231 \ contains=xmlCommentStart,xmlCommentError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 \ fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 " - fold attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 syn region xmlComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 \ start=+<!+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 \ end=+>+
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
243 \ contains=xmlCommentStart,xmlCommentError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
248 syn match xmlCommentStart contained "<!" nextgroup=xmlCommentPart
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 7
diff changeset
249 syn keyword xmlTodo contained TODO FIXME XXX
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 syn match xmlCommentError contained "[^><!]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 syn region xmlCommentPart
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 \ start=+--+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 \ end=+--+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 \ contained
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
255 \ contains=xmlTodo,@xmlCommentHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 " CData sections
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 " PROVIDES: @xmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 syn region xmlCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 \ start=+<!\[CDATA\[+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 \ end=+]]>+
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 236
diff changeset
265 \ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook,@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 " using the following line instead leads to corrupt folding at CDATA regions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 " syn match xmlCdata +<!\[CDATA\[\_.\{-}]]>+ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 syn match xmlCdataStart +<!\[CDATA\[+ contained contains=xmlCdataCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 syn keyword xmlCdataCdata CDATA contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 syn match xmlCdataEnd +]]>+ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 " Processing instructions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 " This allows "?>" inside strings -- good idea?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 syn region xmlProcessing matchgroup=xmlProcessingDelim start="<?" end="?>" contains=xmlAttrib,xmlEqual,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 " DTD -- we use dtd.vim here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 syn region xmlDocType matchgroup=xmlDocTypeDecl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 \ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 \ fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 \ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 " no syntax folding:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 " - fold attribute removed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 syn region xmlDocType matchgroup=xmlDocTypeDecl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 \ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 \ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 syn keyword xmlDocTypeKeyword contained DOCTYPE PUBLIC SYSTEM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 syn region xmlInlineDTD contained matchgroup=xmlDocTypeDecl start="\[" end="]" contains=@xmlDTD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 syn include @xmlDTD <sfile>:p:h/dtd.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 unlet b:current_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 " synchronizing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
307 syn sync match xmlSyncComment grouphere xmlComment +<!--+
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
308 syn sync match xmlSyncComment groupthere NONE +-->+
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
309
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
310 " The following is slow on large documents (and the doctype is optional
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
311 " syn sync match xmlSyncDT grouphere xmlDocType +\_.\(<!DOCTYPE\)\@=+
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 " syn sync match xmlSyncDT groupthere NONE +]>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 if exists('g:xml_syntax_folding')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 syn sync match xmlSync grouphere xmlRegion +\_.\(<[^ /!?<>"']\+\)\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 " syn sync match xmlSync grouphere xmlRegion "<[^ /!?<>"']*>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 syn sync match xmlSync groupthere xmlRegion +</[^ /!?<>"']\+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
320 syn sync minlines=100 maxlines=200
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 " The default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 hi def link xmlTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 hi def link xmlTag Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 hi def link xmlTagName Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 hi def link xmlEndTag Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 if !exists("g:xml_namespace_transparent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 hi def link xmlNamespace Tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 hi def link xmlEntity Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 hi def link xmlEntityPunct Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 hi def link xmlAttribPunct Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 hi def link xmlAttrib Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 hi def link xmlString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 hi def link xmlComment Comment
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 826
diff changeset
339 hi def link xmlCommentStart xmlComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 hi def link xmlCommentPart Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 hi def link xmlCommentError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 hi def link xmlError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 hi def link xmlProcessingDelim Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 hi def link xmlProcessing Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 hi def link xmlCdata String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 hi def link xmlCdataCdata Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 hi def link xmlCdataStart Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 hi def link xmlCdataEnd Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 hi def link xmlDocTypeDecl Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 hi def link xmlDocTypeKeyword Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 hi def link xmlInlineDTD Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 let b:current_syntax = "xml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 let &cpo = s:xml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 unlet s:xml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18790
diff changeset
361 " vim: ts=4