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