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