annotate runtime/syntax/sgml.vim @ 31980:13329cb9faee v9.0.1322

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