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

  1. " Vim syntax file
  2. " Language:    povray screen description language
  3. " Maintainer:    T. Scott Urban <urban@blarg.net>
  4. " Last change:    1998 Mar 29
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " A bunch of useful Pov keywords
  10. syn keyword povCommands        background camera global_settings light_source
  11. syn keyword povObjects        atmosphere bicubic_patch blob box cone cylinder difference height_field intersection lathe merge mesh object plane polygon prism sor sphere superellipsoid text torus triangle union
  12. syn keyword povTypes        x y z hf_gray_16
  13. syn keyword povModifiers    rotate scale translate
  14. syn keyword povDescriptors    adaptive ambient ambient_settings angle aperture area_light assumed_gamma blue blur_samples brick checker color color_map conic_sweep cubic_spline diffuse fade_distance fade_power falloff finish focal_point frequency green hexagon linear_spline linear_sweep location look_at looks_like max_trace_level metallic no_shadow normal open orthographic phong pigment quadratic_spline radius red reflection rgb roughness shadowless specular spotlight texture tga threshold tightness ttf turbulence u_step v_step wrinkles
  15.  
  16. syn keyword povConditional    if ifdef else switch
  17.  
  18. syn keyword povTodo contained    TODO FIXME XXX
  19.  
  20. " comments
  21. syn region povComment    start="/\*" end="\*/" contains=povTodo
  22. syn match  povComment    "//.*" contains=povTodo
  23. syn match  povCommentError    "\*/"
  24. syn sync ccomment povComment
  25.  
  26. " include statements
  27. syn region povIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
  28. syn match povIncluded contained "<[^>]*>"
  29. syn match povInclude    "^#[     ]*include\>[     ]*["<]" contains=povIncluded
  30.  
  31. syn keyword povLabel        case default
  32. syn keyword povRepeat        while for do
  33.  
  34. " String and Character constants
  35. " Highlight special characters (those which have a backslash) differently
  36. syn match   povSpecial contained "\\\d\d\d\|\\."
  37. syn region  povString          start=+"+  skip=+\\\\\|\\"+  end=+"+  contains=povSpecial
  38. syn match   povCharacter      "'[^\\]'"
  39. syn match   povSpecialCharacter  "'\\.'"
  40.  
  41. "catch errors caused by wrong parenthesis
  42. syn region    povParen        transparent start='(' end=')' contains=ALLBUT,povParenError,povIncluded,povSpecial,povTodo,povUserLabel
  43. syn match    povParenError    ")"
  44. syn match    povInParen    contained "[{}]"
  45. hi link povParenError povError
  46. hi link povInParen povError
  47.  
  48. "integer number, or floating point number without a dot and with "f".
  49. syn case ignore
  50. syn match  povNumber        "\<\d\+\(u\=l\=\|lu\|f\)\>"
  51. "floating point number, with dot, optional exponent
  52. syn match  povFloat        "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
  53. "floating point number, starting with a dot, optional exponent
  54. syn match  povFloat        "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
  55. "floating point number, without dot, with exponent
  56. syn match  povFloat        "\<\d\+e[-+]\=\d\+[fl]\=\>"
  57. "hex number
  58. syn match  povNumber        "0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
  59. "syn match  cIdentifier    "\<[a-z_][a-z0-9_]*\>"
  60. syn case match
  61.  
  62. syn keyword povType        int long short char void size_t
  63. syn keyword povType        signed unsigned float double
  64. syn keyword povStructure    struct union enum typedef
  65. syn keyword povStorageClass    static register auto volatile extern const
  66.  
  67. syn region povPreCondit    start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)"  skip="\\$"  end="$" contains=povComment,povString,povCharacter,povNumber,povCommentError
  68. "syn match  cLineSkip    "\\$"
  69. syn region povDefine        start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,povPreCondit,povIncluded,povInclude,povDefine,povInParen
  70. syn region povPreProc        start="^[ \t]*#[ \t]*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,povPreCondit,povIncluded,povInclude,povDefine,povInParen
  71.  
  72. " Highlight User Labels
  73. syn region    povMulti        transparent start='?' end=':' contains=ALLBUT,povIncluded,povSpecial,povTodo,povUserLabel
  74. " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
  75. syn match    povUserLabel    "^[ \t]*[a-zA-Z0-9_]\+[ \t]*:$"
  76. syn match    povUserLabel    ";[ \t]*[a-zA-Z0-9_]\+[ \t]*:$"
  77. syn match    povUserLabel    "^[ \t]*[a-zA-Z0-9_]\+[ \t]*:[^:]"me=e-1
  78. syn match    povUserLabel    ";[ \t]*[a-zA-Z0-9_]\+[ \t]*:[^:]"me=e-1
  79.  
  80. syn sync ccomment povComment minlines=10
  81.  
  82. if !exists("did_pov_syntax_inits")
  83.   let did_pov_syntax_inits = 1
  84.   " The default methods for highlighting.  Can be overridden later
  85.  
  86.   " comment
  87.   hi link povComment        Comment
  88.   " constants
  89.   hi link povFloat        Float
  90.   hi link povNumber        Number
  91.   hi link povString        String
  92.   hi link povCharacter        Character
  93.   hi link povSpecialCharacter    povSpecial
  94.   " identifier
  95.   hi link povCommands        Function
  96.   " statements
  97.   hi link povStatement        Statement
  98.   hi link povConditional    Conditional
  99.   hi link povRepeat        Repeat
  100.   hi link povLabel        Label
  101.   hi link povUserLabel        Label
  102.   hi link povOperator        Operator
  103.   " preproc
  104.   hi link povPreProc        PreProc
  105.   hi link povInclude        Include
  106.   hi link povIncluded        povString
  107.   hi link povDefine        Define
  108.   hi link povPreCondit        PreCondit
  109.   " type
  110.   hi link povType        Type
  111.   hi link povStorageClass    StorageClass
  112.   hi link povStructure        Structure
  113.   hi link povDescriptors    Type
  114.   " special
  115.   hi link povSpecial        Special
  116.   " error
  117.   hi link povError        Error
  118.   hi link povCommentError    povError
  119.   " todo
  120.   hi link povTodo        Todo
  121.  
  122.   hi link povObjects        Function
  123.   hi link povModifiers        Operator
  124.   hi link povTypes        Type
  125. endif
  126.  
  127. let b:current_syntax = "pov"
  128.  
  129. " vim: ts=8
  130.