annotate runtime/syntax/xml.vim @ 9603:20e7be5d99ac v7.4.2079

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