Add support for :winpos
[MacVim.git] / runtime / syntax / dtd.vim
blob76778ba881321081db3bd906f232358f6817e13c
1 " Vim syntax file
2 " Language:     DTD (Document Type Definition for XML)
3 " Maintainer:   Johannes Zellner <johannes@zellner.org>
4 "               Author and previous maintainer:
5 "               Daniel Amyot <damyot@site.uottawa.ca>
6 " Last Change:  Tue, 27 Apr 2004 14:54:59 CEST
7 " Filenames:    *.dtd
9 " REFERENCES:
10 "   http://www.w3.org/TR/html40/
11 "   http://www.w3.org/TR/NOTE-html-970421
13 " TODO:
14 "   - improve synchronizing.
16 if version < 600
17     syntax clear
18     let __dtd_cpo_save__ = &cpo
19     set cpo&
20 else
21     if exists("b:current_syntax")
22         finish
23     endif
24     let s:dtd_cpo_save = &cpo
25     set cpo&vim
26 endif
28 if !exists("dtd_ignore_case")
29     " I prefer having the case takes into consideration.
30     syn case match
31 else
32     syn case ignore
33 endif
36 " the following line makes the opening <! and
37 " closing > highlighted using 'dtdFunction'.
39 " PROVIDES: @dtdTagHook
41 syn region dtdTag matchgroup=dtdFunction
42     \ start=+<!+ end=+>+ matchgroup=NONE
43     \ contains=dtdTag,dtdTagName,dtdError,dtdComment,dtdString,dtdAttrType,dtdAttrDef,dtdEnum,dtdParamEntityInst,dtdParamEntityDecl,dtdCard,@dtdTagHook
45 if !exists("dtd_no_tag_errors")
46     " mark everything as an error which starts with a <!
47     " and is not overridden later. If this is annoying,
48     " it can be switched off by setting the variable
49     " dtd_no_tag_errors.
50     syn region dtdError contained start=+<!+lc=2 end=+>+
51 endif
53 " if this is a html like comment hightlight also
54 " the opening <! and the closing > as Comment.
55 syn region dtdComment           start=+<![ \t]*--+ end=+-->+ contains=dtdTodo,@Spell
58 " proper DTD comment
59 syn region dtdComment contained start=+--+ end=+--+ contains=dtdTodo,@Spell
62 " Start tags (keywords). This is contained in dtdFunction.
63 " Note that everything not contained here will be marked
64 " as error.
65 syn match dtdTagName contained +<!\(ATTLIST\|DOCTYPE\|ELEMENT\|ENTITY\|NOTATION\|SHORTREF\|USEMAP\|\[\)+lc=2,hs=s+2
68 " wildcards and operators
69 syn match  dtdCard contained "|"
70 syn match  dtdCard contained ","
71 " evenutally overridden by dtdEntity
72 syn match  dtdCard contained "&"
73 syn match  dtdCard contained "?"
74 syn match  dtdCard contained "\*"
75 syn match  dtdCard contained "+"
77 " ...and finally, special cases.
78 syn match  dtdCard      "ANY"
79 syn match  dtdCard      "EMPTY"
81 if !exists("dtd_no_param_entities")
83     " highlight parameter entity declarations
84     " and instances. Note that the closing `;'
85     " is optional.
87     " instances
88     syn region dtdParamEntityInst oneline matchgroup=dtdParamEntityPunct
89         \ start="%[-_a-zA-Z0-9.]\+"he=s+1,rs=s+1
90         \ skip=+[-_a-zA-Z0-9.]+
91         \ end=";\|\>"
92         \ matchgroup=NONE contains=dtdParamEntityPunct
93     syn match  dtdParamEntityPunct contained "\."
95     " declarations
96     " syn region dtdParamEntityDecl oneline matchgroup=dtdParamEntityDPunct start=+<!ENTITY % +lc=8 skip=+[-_a-zA-Z0-9.]+ matchgroup=NONE end="\>" contains=dtdParamEntityDPunct
97     syn match dtdParamEntityDecl +<!ENTITY % [-_a-zA-Z0-9.]*+lc=8 contains=dtdParamEntityDPunct
98     syn match  dtdParamEntityDPunct contained "%\|\."
100 endif
102 " &entities; compare with xml
103 syn match   dtdEntity                 "&[^; \t]*;" contains=dtdEntityPunct
104 syn match   dtdEntityPunct  contained "[&.;]"
106 " Strings are between quotes
107 syn region dtdString    start=+"+ skip=+\\\\\|\\"+  end=+"+ contains=dtdAttrDef,dtdAttrType,dtdEnum,dtdParamEntityInst,dtdEntity,dtdCard
108 syn region dtdString    start=+'+ skip=+\\\\\|\\'+  end=+'+ contains=dtdAttrDef,dtdAttrType,dtdEnum,dtdParamEntityInst,dtdEntity,dtdCard
110 " Enumeration of elements or data between parenthesis
112 " PROVIDES: @dtdEnumHook
114 syn region dtdEnum matchgroup=dtdType start="(" end=")" matchgroup=NONE contains=dtdEnum,dtdParamEntityInst,dtdCard,@dtdEnumHook
116 "Attribute types
117 syn keyword dtdAttrType NMTOKEN  ENTITIES  NMTOKENS  ID  CDATA
118 syn keyword dtdAttrType IDREF  IDREFS
119 " ENTITY has to treated special for not overriding <!ENTITY
120 syn match   dtdAttrType +[^!]\<ENTITY+
122 "Attribute Definitions
123 syn match  dtdAttrDef   "#REQUIRED"
124 syn match  dtdAttrDef   "#IMPLIED"
125 syn match  dtdAttrDef   "#FIXED"
127 syn case match
128 " define some common keywords to mark TODO
129 " and important sections inside comments.
130 syn keyword dtdTodo contained TODO FIXME XXX
132 syn sync lines=250
134 " Define the default highlighting.
135 " For version 5.7 and earlier: only when not done already
136 " For version 5.8 and later: only when an item doesn't have highlighting yet
137 if version >= 508 || !exists("did_dtd_syn_inits")
138     if version < 508
139         let did_dtd_syn_inits = 1
140         command -nargs=+ HiLink hi link <args>
141     else
142         command -nargs=+ HiLink hi def link <args>
143     endif
145     " The default highlighting.
146     HiLink dtdFunction          Function
147     HiLink dtdTag               Normal
148     HiLink dtdType              Type
149     HiLink dtdAttrType          dtdType
150     HiLink dtdAttrDef           dtdType
151     HiLink dtdConstant          Constant
152     HiLink dtdString            dtdConstant
153     HiLink dtdEnum              dtdConstant
154     HiLink dtdCard              dtdFunction
156     HiLink dtdEntity            Statement
157     HiLink dtdEntityPunct       dtdType
158     HiLink dtdParamEntityInst   dtdConstant
159     HiLink dtdParamEntityPunct  dtdType
160     HiLink dtdParamEntityDecl   dtdType
161     HiLink dtdParamEntityDPunct dtdComment
163     HiLink dtdComment           Comment
164     HiLink dtdTagName           Statement
165     HiLink dtdError             Error
166     HiLink dtdTodo              Todo
168     delcommand HiLink
169 endif
171 if version < 600
172     let &cpo = __dtd_cpo_save__
173     unlet __dtd_cpo_save__
174 else
175     let &cpo = s:dtd_cpo_save
176     unlet s:dtd_cpo_save
177 endif
179 let b:current_syntax = "dtd"
181 " vim: ts=8