File: dtd.vim

package info (click to toggle)
vim-rt 5.3-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,172 kB
  • ctags: 815
  • sloc: makefile: 857; awk: 778; ansic: 379; perl: 192; sh: 167
file content (69 lines) | stat: -rw-r--r-- 2,047 bytes parent folder | download
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
" Vim syntax file
" Language:	DTD (Document Type Definition for XML)
" Maintainer:	Daniel Amyot <damyot@csi.uottawa.ca>
" Last change:	Thu Aug 20 1998
" Filenames:    *.dtd
" URL:          http://dtd.csi.uottawa.ca/~damyot/vim/dtd.vim
" This file is an adaptation of pascal.vim by Mario Eusebio 
" I'm not sure I understand all of the syntax highlight language,
" but this file seems to do the job for simple DTD in XML.
" This would have to be extended to cover the whole of SGML DTDs though.
" Unfortunately, I don't know enough about the somewhat complex SGML
" to do it myself. Volunteers are most welcomed!

syn clear

"I prefer having the case takes into consideration.
"syn case ignore 

"Comments in DTD are between <!-- and -->
syn region dtdComment	start="<!--"  end="-->" 

"Strings are between quotes
syn region dtdString	start=+"+ skip=+\\\\\|\\"+  end=+"+ 

"Enumeration of elements or data between parenthesis
syn region dtdEnum	start="("  end=")" 
"Also, consider +, ?, * at the end.
syn match  dtdCard      "+"
syn match  dtdCard      "\*"
syn match  dtdCard      "\?"
"...and finally, special cases.
syn match  dtdCard	"ANY"
syn match  dtdCard	"EMPTY"

"Start tags (keywords)
syn match  dtdTag       "<!DOCTYPE"
syn match  dtdTag	"<!ELEMENT"
syn match  dtdTag	"<!ATTLIST"
syn match  dtdTag	"<!ENTITY"
syn match  dtdTag	"<!NOTATION"
"End tag
syn match  dtdTag	">"

"Attribute types
syn keyword dtdAttrType	NMTOKEN  ENTITIES  NMTOKENS  ID  CDATA  
syn keyword dtdAttrType	IDREF  IDREFS  ENTITY

"Attribute Definitions
syn match  dtdAttrDef	"#REQUIRED"
syn match  dtdAttrDef	"#IMPLIED"
syn match  dtdAttrDef	"#FIXED"

syn sync lines=250

if !exists("did_dtd_syntax_inits")
  let did_dtd_syntax_inits = 1
  " The default methods for highlighting.  Can be overridden later
  hi link dtdAttrType			Type
  hi link dtdAttrDef			Operator
  hi link dtdString			String
  hi link dtdEnum			String
  hi link dtdCard			String
  hi link dtdComment			Comment
  hi link dtdTag                	Tag
endif

let b:current_syntax = "dtd"

" vim: ts=8