home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim55rt.sit / runtime / syntax / cweb.vim < prev    next >
Encoding:
Text File  |  1999-09-25  |  2.7 KB  |  61 lines  |  [TEXT/VIM!]

  1. " Vim syntax file
  2. " Language   : CWEB
  3. " Maintainer : Andreas Scherer <andreas.scherer@pobox.com>
  4. " Last change: August 23, 1999
  5.  
  6. " Details of the CWEB language can be found in the article by Donald E. Knuth
  7. " and Silvio Levy, "The CWEB System of Structured Documentation", included as
  8. " file "cwebman.tex" in the standard CWEB distribution, available for
  9. " anonymous ftp at ftp://labrea.stanford.edu/pub/cweb/.
  10.  
  11. " TODO: Section names and C/C++ comments should be treated as TeX material.
  12. " TODO: The current version switches syntax highlighting off for section
  13. " TODO: names, and leaves C/C++ comments as such. (On the other hand,
  14. " TODO: switching to TeX mode in C/C++ comments might be colour overkill.)
  15.  
  16. " Remove any old syntax stuff hanging around
  17. syntax clear
  18.  
  19. " For starters, read the TeX syntax; TeX syntax items are allowed at the top
  20. " level in the CWEB syntax, e.g., in the preamble.  In general, a CWEB source
  21. " code can be seen as a normal TeX document with some C/C++ material
  22. " interspersed in certain defined regions.
  23. source <sfile>:p:h/tex.vim
  24.  
  25. " Read the C/C++ syntax too; C/C++ syntax items are treated as such in the
  26. " C/C++ section of a CWEB chunk or in inner C/C++ context in "|...|" groups.
  27. syntax include @webIncludedC <sfile>:p:h/cpp.vim
  28.  
  29. " Inner C/C++ context (ICC) should be quite simple as it's comprised of
  30. " material in "|...|"; however the naive definition for this region would
  31. " hickup at the innocious "\|" TeX macro.  Note: For the time being we expect
  32. " that an ICC begins either at the start of a line or after some white space.
  33. syntax region webInnerCcontext start="\(^\|[ \t\~`(]\)|" end="|" contains=@webIncludedC,webSectionName,webRestrictedTeX,webIgnoredStuff
  34.  
  35. " Genuine C/C++ material.  This syntactic region covers both the definition
  36. " part and the C/C++ part of a CWEB section; it is ended by the TeX part of
  37. " the next section.
  38. syntax region webCpart start="@[dfscp<(]" end="@[ \*]" contains=@webIncludedC,webSectionName,webRestrictedTeX,webIgnoredStuff
  39.  
  40. " Section names contain C/C++ material only in inner context.
  41. syntax region webSectionName start="@[<(]" end="@>" contains=webInnerCcontext contained
  42.  
  43. " The contents of "control texts" is not treated as TeX material, because in
  44. " non-trivial cases this completely clobbers the syntax recognition.  Instead,
  45. " we highlight these elements as "strings".
  46. syntax region webRestrictedTeX start="@[\^\.:t=q]" end="@>" oneline
  47.  
  48. " Double-@ means single-@, anywhere in the CWEB source.  (This allows e-mail
  49. " address <someone@@fsf.org> without going into C/C++ mode.)
  50. syntax match webIgnoredStuff "@@"
  51.  
  52. if !exists("did_cweb_syntax_inits")
  53.   let did_cweb_syntax_inits = 1
  54.   " The default method for highlighting. Can be overridden later.
  55.   hi link webRestrictedTeX String
  56. endif
  57.  
  58. let b:current_syntax = "cweb"
  59.  
  60. " vim: ts=8
  61.