home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / dtd.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  2.0 KB  |  70 lines

  1. " Vim syntax file
  2. " Language:    DTD (Document Type Definition for XML)
  3. " Maintainer:    Daniel Amyot <damyot@csi.uottawa.ca>
  4. " Last change:    Thu Aug 20 1998
  5. " Filenames:    *.dtd
  6. " URL:          http://dtd.csi.uottawa.ca/~damyot/vim/dtd.vim
  7. " This file is an adaptation of pascal.vim by Mario Eusebio 
  8. " I'm not sure I understand all of the syntax highlight language,
  9. " but this file seems to do the job for simple DTD in XML.
  10. " This would have to be extended to cover the whole of SGML DTDs though.
  11. " Unfortunately, I don't know enough about the somewhat complex SGML
  12. " to do it myself. Volunteers are most welcomed!
  13.  
  14. syn clear
  15.  
  16. "I prefer having the case takes into consideration.
  17. "syn case ignore 
  18.  
  19. "Comments in DTD are between <!-- and -->
  20. syn region dtdComment    start="<!--"  end="-->" 
  21.  
  22. "Strings are between quotes
  23. syn region dtdString    start=+"+ skip=+\\\\\|\\"+  end=+"+ 
  24.  
  25. "Enumeration of elements or data between parenthesis
  26. syn region dtdEnum    start="("  end=")" 
  27. "Also, consider +, ?, * at the end.
  28. syn match  dtdCard      "+"
  29. syn match  dtdCard      "\*"
  30. syn match  dtdCard      "\?"
  31. "...and finally, special cases.
  32. syn match  dtdCard    "ANY"
  33. syn match  dtdCard    "EMPTY"
  34.  
  35. "Start tags (keywords)
  36. syn match  dtdTag       "<!DOCTYPE"
  37. syn match  dtdTag    "<!ELEMENT"
  38. syn match  dtdTag    "<!ATTLIST"
  39. syn match  dtdTag    "<!ENTITY"
  40. syn match  dtdTag    "<!NOTATION"
  41. "End tag
  42. syn match  dtdTag    ">"
  43.  
  44. "Attribute types
  45. syn keyword dtdAttrType    NMTOKEN  ENTITIES  NMTOKENS  ID  CDATA  
  46. syn keyword dtdAttrType    IDREF  IDREFS  ENTITY
  47.  
  48. "Attribute Definitions
  49. syn match  dtdAttrDef    "#REQUIRED"
  50. syn match  dtdAttrDef    "#IMPLIED"
  51. syn match  dtdAttrDef    "#FIXED"
  52.  
  53. syn sync lines=250
  54.  
  55. if !exists("did_dtd_syntax_inits")
  56.   let did_dtd_syntax_inits = 1
  57.   " The default methods for highlighting.  Can be overridden later
  58.   hi link dtdAttrType            Type
  59.   hi link dtdAttrDef            Operator
  60.   hi link dtdString            String
  61.   hi link dtdEnum            String
  62.   hi link dtdCard            String
  63.   hi link dtdComment            Comment
  64.   hi link dtdTag                    Tag
  65. endif
  66.  
  67. let b:current_syntax = "dtd"
  68.  
  69. " vim: ts=8
  70.