annotate runtime/syntax/sgml.vim @ 3184:074ddc768fea v7.3.362

updated for version 7.3.362 Problem: ml_get error when using ":g" with folded lines. Solution: Adjust the line number for changed_lines(). (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Wed, 30 Nov 2011 17:01:58 +0100
parents 7bc41231fbc7
children 43efa4f5a8ea
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: SGML
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 " Last Change: Tue, 27 Apr 2004 15:05:21 CEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Filenames: *.sgml,*.sgm
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 7
diff changeset
6 " $Id: sgml.vim,v 1.1 2004/06/13 17:52:57 vimboss Exp $
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 let s:sgml_cpo_save = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 set cpo&vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " mark illegal characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 syn match sgmlError "[<&]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " unicode numbers:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " provide different highlithing for unicode characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " inside strings and in plain text (character data).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " \u4e88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match sgmlUnicodeNumberAttr +\\u\x\{4}+ contained contains=sgmlUnicodeSpecifierAttr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn match sgmlUnicodeSpecifierAttr +\\u+ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn match sgmlUnicodeNumberData +\\u\x\{4}+ contained contains=sgmlUnicodeSpecifierData
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn match sgmlUnicodeSpecifierData +\\u+ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " strings inside character data or comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn region sgmlString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=sgmlEntity,sgmlUnicodeNumberAttr display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn region sgmlString contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=sgmlEntity,sgmlUnicodeNumberAttr display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " punctuation (within attributes) e.g. <tag sgml:foo.attribute ...>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " ^ ^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn match sgmlAttribPunct +[:.]+ contained display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 " no highlighting for sgmlEqual (sgmlEqual has no highlighting group)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn match sgmlEqual +=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 " attribute, everything before the '='
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 " PROVIDES: @sgmlAttribHook
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 " ^^^^^^^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn match sgmlAttrib
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 \ +[^-'"<]\@<=\<[a-zA-Z0-9.:]\+\>\([^'">]\@=\|$\)+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 \ contains=sgmlAttribPunct,@sgmlAttribHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " UNQUOTED value (not including the '=' -- sgmlEqual)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " PROVIDES: @sgmlValueHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " <tag foo.attribute = value>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " ^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syn match sgmlValue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 \ +[^"' =/!?<>][^ =/!?<>]*+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 \ contains=sgmlEntity,sgmlUnicodeNumberAttr,@sgmlValueHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 \ 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 " QUOTED value (not including the '=' -- sgmlEqual)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " PROVIDES: @sgmlValueHook
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 " <tag foo.attribute = 'value'>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " ^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 syn region sgmlValue contained start=+"+ skip=+\\\\\|\\"+ end=+"+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 \ contains=sgmlEntity,sgmlUnicodeNumberAttr,@sgmlValueHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 syn region sgmlValue contained start=+'+ skip=+\\\\\|\\'+ end=+'+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 \ contains=sgmlEntity,sgmlUnicodeNumberAttr,@sgmlValueHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " value, everything after (and including) the '='
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " no highlighting!
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 " <tag foo.attribute = "value">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 " ^^^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 " <tag foo.attribute = value>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 " ^^^^^^^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 syn match sgmlEqualValue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 \ +=\s*[^ =/!?<>]\++
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 \ contains=sgmlEqual,sgmlString,sgmlValue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 \ display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 " start tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 " use matchgroup=sgmlTag to skip over the leading '<'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 " see also sgmlEmptyTag below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 " PROVIDES: @sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 syn region sgmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 \ matchgroup=sgmlTag start=+<[^ /!?"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 \ matchgroup=sgmlTag end=+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 \ contains=sgmlError,sgmlAttrib,sgmlEqualValue,@sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 " tag content for empty tags. This is the same as sgmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 " above, except the `matchgroup=sgmlEndTag for highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 " the end '/>' differently.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 " PROVIDES: @sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 syn region sgmlEmptyTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 \ matchgroup=sgmlTag start=+<[^ /!?"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 \ matchgroup=sgmlEndTag end=+/>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 \ contains=sgmlError,sgmlAttrib,sgmlEqualValue,@sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 " end tag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 " highlight everything but not the trailing '>' which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 " was already highlighted by the containing sgmlRegion.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 " PROVIDES: @sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 " (should we provide a separate @sgmlEndTagHook ?)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 syn match sgmlEndTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 \ +</[^ /!?>"']\+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 \ contains=@sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 " [-- SGML SPECIFIC --]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " SGML specific
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 " tag content for abbreviated regions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 " PROVIDES: @sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 syn region sgmlAbbrTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 \ matchgroup=sgmlTag start=+<[^ /!?"']\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 \ matchgroup=sgmlTag end=+/+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 \ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 \ contains=sgmlError,sgmlAttrib,sgmlEqualValue,@sgmlTagHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 " SGML specific
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 " just highlight the trailing '/'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 syn match sgmlAbbrEndTag +/+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 " SGML specific
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 " abbreviated regions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 " No highlighing, highlighing is done by contained elements.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 " PROVIDES: @sgmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 " <bold/Im Anfang war das Wort/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 syn match sgmlAbbrRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 \ +<[^/!?>"']\+/\_[^/]\+/+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 \ contains=sgmlAbbrTag,sgmlAbbrEndTag,sgmlCdata,sgmlComment,sgmlEntity,sgmlUnicodeNumberData,@sgmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 " [-- END OF SGML SPECIFIC --]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 " real (non-empty) elements. We cannot do syntax folding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 " as in xml, because end tags may be optional in sgml depending
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 " on the dtd.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 " No highlighing, highlighing is done by contained elements.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 " PROVIDES: @sgmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 " <tag id="whoops">
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 " <!-- comment -->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 " <another.tag></another.tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 " <another.tag/>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 " some data
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 " </tag>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 " SGML specific:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 " compared to xmlRegion:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 " - removed folding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 " - added a single '/'in the start pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 syn region sgmlRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 \ start=+<\z([^ /!?>"']\+\)\(\(\_[^/>]*[^/!?]>\)\|>\)+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 \ end=+</\z1>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 \ contains=sgmlTag,sgmlEndTag,sgmlCdata,@sgmlRegionCluster,sgmlComment,sgmlEntity,sgmlUnicodeNumberData,@sgmlRegionHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 " empty tags. Just a container, no highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 " Compare this with sgmlTag.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 " EXAMPLE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 " <tag id="lola"/>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 " TODO use sgmlEmptyTag intead of sgmlTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 syn match sgmlEmptyRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 \ +<[^ /!?>"']\(\_[^"'<>]\|"\_[^"]*"\|'\_[^']*'\)*/>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 \ contains=sgmlEmptyTag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 " cluster which contains the above two elements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 syn cluster sgmlRegionCluster contains=sgmlRegion,sgmlEmptyRegion,sgmlAbbrRegion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 " &entities; compare with dtd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 syn match sgmlEntity "&[^; \t]*;" contains=sgmlEntityPunct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 syn match sgmlEntityPunct contained "[&.;]"
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 " The real comments (this implements the comments as defined by sgml,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 " but not all sgml pages actually conform to it. Errors are flagged.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 syn region sgmlComment start=+<!+ end=+>+ contains=sgmlCommentPart,sgmlString,sgmlCommentError,sgmlTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 syn keyword sgmlTodo contained TODO FIXME XXX display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 syn match sgmlCommentError contained "[^><!]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 syn region sgmlCommentPart contained start=+--+ end=+--+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 " CData sections
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 " PROVIDES: @sgmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 syn region sgmlCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 \ start=+<!\[CDATA\[+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 \ end=+]]>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 \ contains=sgmlCdataStart,sgmlCdataEnd,@sgmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 \ keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 \ extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 " using the following line instead leads to corrupt folding at CDATA regions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 " syn match sgmlCdata +<!\[CDATA\[\_.\{-}]]>+ contains=sgmlCdataStart,sgmlCdataEnd,@sgmlCdataHook
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 syn match sgmlCdataStart +<!\[CDATA\[+ contained contains=sgmlCdataCdata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 syn keyword sgmlCdataCdata CDATA contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 syn match sgmlCdataEnd +]]>+ contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 " Processing instructions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 " This allows "?>" inside strings -- good idea?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 syn region sgmlProcessing matchgroup=sgmlProcessingDelim start="<?" end="?>" contains=sgmlAttrib,sgmlEqualValue
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 " DTD -- we use dtd.vim here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 syn region sgmlDocType matchgroup=sgmlDocTypeDecl start="\c<!DOCTYPE"he=s+2,rs=s+2 end=">" contains=sgmlDocTypeKeyword,sgmlInlineDTD,sgmlString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 syn keyword sgmlDocTypeKeyword contained DOCTYPE PUBLIC SYSTEM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 syn region sgmlInlineDTD contained start="\[" end="]" contains=@sgmlDTD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 syn include @sgmlDTD <sfile>:p:h/dtd.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 " synchronizing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 " TODO !!! to be improved !!!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 syn sync match sgmlSyncDT grouphere sgmlDocType +\_.\(<!DOCTYPE\)\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 " syn sync match sgmlSyncDT groupthere NONE +]>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 syn sync match sgmlSync grouphere sgmlRegion +\_.\(<[^ /!?>"']\+\)\@=+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 " syn sync match sgmlSync grouphere sgmlRegion "<[^ /!?>"']*>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 syn sync match sgmlSync groupthere sgmlRegion +</[^ /!?>"']\+>+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 syn sync minlines=100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 " The default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 hi def link sgmlTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 hi def link sgmlTag Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 hi def link sgmlEndTag Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 " SGML specifig
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 hi def link sgmlAbbrEndTag Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 hi def link sgmlEmptyTag Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 hi def link sgmlEntity Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 hi def link sgmlEntityPunct Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 hi def link sgmlAttribPunct Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 hi def link sgmlAttrib Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 hi def link sgmlValue String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 hi def link sgmlString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 hi def link sgmlComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 hi def link sgmlCommentPart Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 hi def link sgmlCommentError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 hi def link sgmlError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 hi def link sgmlProcessingDelim Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 hi def link sgmlProcessing 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 sgmlCdata String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 hi def link sgmlCdataCdata Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 hi def link sgmlCdataStart Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 hi def link sgmlCdataEnd Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 hi def link sgmlDocTypeDecl Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 hi def link sgmlDocTypeKeyword Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 hi def link sgmlInlineDTD Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 hi def link sgmlUnicodeNumberAttr Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 hi def link sgmlUnicodeSpecifierAttr SpecialChar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 hi def link sgmlUnicodeNumberData Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 hi def link sgmlUnicodeSpecifierData SpecialChar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 let b:current_syntax = "sgml"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 let &cpo = s:sgml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 unlet s:sgml_cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 " vim: ts=8