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

  1. " Vim syntax file
  2. " Language:    Perl POD format
  3. " Maintainer:    Scott Bigham <dsb@cs.duke.edu>
  4. " Last change:    1997 Nov 13
  5.  
  6. " Clever Hack(TM):  This file can be sourced from other syntax files to
  7. " handle embedded POD documentation.  Set the variable b:embedded_pod
  8. " when doing so.
  9.  
  10. " Remove any old syntax stuff hanging around -- unless we were called from
  11. " another syntax file.
  12. if !exists("b:embedded_pod")
  13.   syn clear
  14. endif
  15.  
  16. " POD commands
  17. " For embedded POD, all of these must be marked "contained" so as to only
  18. " appear within a region such as perlEmbeddedPod.
  19. if exists("b:embedded_pod")
  20.   syn match podCommand    "^=head[12]"    contained nextgroup=podCmdText
  21.   syn match podCommand    "^=item"    contained nextgroup=podCmdText
  22.   syn match podCommand    "^=over"    contained nextgroup=podOverIndent skipwhite
  23.   syn match podCommand    "^=back"    contained
  24.   " Subtle:  If this is declared here, it won't match as the end of an
  25.   " embeddedPod region.  If you want it highlighted, use a matchgroup; see
  26.   " perl.vim for an example.
  27.   "syn match podCommand    "^=cut"        contained
  28.   syn match podCommand    "^=pod"        contained
  29.   syn match podCommand    "^=for"        contained nextgroup=podForKeywd skipwhite
  30.   syn match podCommand    "^=begin"    contained nextgroup=podForKeywd skipwhite
  31.   syn match podCommand    "^=end"        contained nextgroup=podForKeywd skipwhite
  32. else
  33.   syn match podCommand    "^=head[12]"    nextgroup=podCmdText
  34.   syn match podCommand    "^=item"    nextgroup=podCmdText
  35.   syn match podCommand    "^=over"    nextgroup=podOverIndent skipwhite
  36.   syn match podCommand    "^=back"
  37.   syn match podCommand    "^=cut"
  38.   syn match podCommand    "^=pod"
  39.   syn match podCommand    "^=for"        nextgroup=podForKeywd skipwhite
  40.   syn match podCommand    "^=begin"    nextgroup=podForKeywd skipwhite
  41.   syn match podCommand    "^=end"        nextgroup=podForKeywd skipwhite
  42. endif
  43.  
  44. " Text of a =head1, =head2 or =item command
  45. syn match podCmdText    ".*$" contained
  46.  
  47. " Indent amount of =over command
  48. syn match podOverIndent    "\d\+" contained
  49.  
  50. " Formatter identifier keyword for =for, =begin and =end commands
  51. syn match podForKeywd    "[^ ]\+" contained
  52.  
  53. " An indented line, to be displayed verbatim
  54. if exists("b:embedded_pod")
  55.   syn match podVerbatimLine    "^[ \t].*$" contained
  56. else
  57.   syn match podVerbatimLine    "^[ \t].*$"
  58. endif
  59.  
  60. " Inline textual items handled specially by POD
  61. "syn match podSpecial    "\<[A-Z_]\+\>"
  62. if exists("b:embedded_pod")
  63.   syn match podSpecial    "\<[A-Za-z_][A-Za-z0-9_]*([^)]*)" contained
  64.   syn match podSpecial    "[$@%][A-Za-z_][A-Za-z0-9_]*\>" contained
  65. else
  66.   syn match podSpecial    "\<[A-Za-z_][A-Za-z0-9_]*([^)]*)"
  67.   syn match podSpecial    "[$@%][A-Za-z_][A-Za-z0-9_]*\>"
  68. endif
  69.  
  70. " Special formatting sequences
  71. if exists("b:embedded_pod")
  72.   syn region podFormat    start="[IBSCLFXEZ]<" end=">" oneline contained contains=podFormat
  73. else
  74.   syn region podFormat    start="[IBSCLFXEZ]<" end=">" oneline contains=podFormat
  75. endif
  76.  
  77. if !exists("did_pod_syntax_inits")
  78.   let did_pod_syntax_inits = 1
  79.   " The default methods for highlighting.  Can be overridden later.
  80.   hi link podCommand        Statement
  81.   hi link podCmdText        String
  82.   hi link podOverIndent        Number
  83.   hi link podForKeywd        Identifier
  84.   hi link podFormat        Identifier
  85.   hi link podVerbatimLine    PreProc
  86.   hi link podSpecial        Identifier
  87. endif
  88.  
  89. let b:current_syntax = "pod"
  90.  
  91. " vim: ts=8
  92.