sl.vim 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. " Vim syntax file
  2. " Language: Renderman shader language
  3. " Maintainer: Dan Piponi <dan@tanelorn.demon.co.uk>
  4. " Last Change: 2001 May 09
  5. " quit when a syntax file was already loaded
  6. if exists("b:current_syntax")
  7. finish
  8. endif
  9. " A bunch of useful Renderman keywords including special
  10. " RenderMan control structures
  11. syn keyword slStatement break return continue
  12. syn keyword slConditional if else
  13. syn keyword slRepeat while for
  14. syn keyword slRepeat illuminance illuminate solar
  15. syn keyword slTodo contained TODO FIXME XXX
  16. " String and Character constants
  17. " Highlight special characters (those which have a backslash) differently
  18. syn match slSpecial contained "\\[0-9][0-9][0-9]\|\\."
  19. syn region slString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=slSpecial
  20. syn match slCharacter "'[^\\]'"
  21. syn match slSpecialCharacter "'\\.'"
  22. syn match slSpecialCharacter "'\\[0-9][0-9]'"
  23. syn match slSpecialCharacter "'\\[0-9][0-9][0-9]'"
  24. "catch errors caused by wrong parenthesis
  25. syn region slParen transparent start='(' end=')' contains=ALLBUT,slParenError,slIncluded,slSpecial,slTodo,slUserLabel
  26. syn match slParenError ")"
  27. syn match slInParen contained "[{}]"
  28. "integer number, or floating point number without a dot and with "f".
  29. syn case ignore
  30. syn match slNumber "\<[0-9]\+\(u\=l\=\|lu\|f\)\>"
  31. "floating point number, with dot, optional exponent
  32. syn match slFloat "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
  33. "floating point number, starting with a dot, optional exponent
  34. syn match slFloat "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=[fl]\=\>"
  35. "floating point number, without dot, with exponent
  36. syn match slFloat "\<[0-9]\+e[-+]\=[0-9]\+[fl]\=\>"
  37. "hex number
  38. syn match slNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
  39. "syn match slIdentifier "\<[a-z_][a-z0-9_]*\>"
  40. syn case match
  41. if exists("sl_comment_strings")
  42. " A comment can contain slString, slCharacter and slNumber.
  43. " But a "*/" inside a slString in a slComment DOES end the comment! So we
  44. " need to use a special type of slString: slCommentString, which also ends on
  45. " "*/", and sees a "*" at the start of the line as comment again.
  46. " Unfortunately this doesn't very well work for // type of comments :-(
  47. syntax match slCommentSkip contained "^\s*\*\($\|\s\+\)"
  48. syntax region slCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=slSpecial,slCommentSkip
  49. syntax region slComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=slSpecial
  50. syntax region slComment start="/\*" end="\*/" contains=slTodo,slCommentString,slCharacter,slNumber
  51. else
  52. syn region slComment start="/\*" end="\*/" contains=slTodo
  53. endif
  54. syntax match slCommentError "\*/"
  55. syn keyword slOperator sizeof
  56. syn keyword slType float point color string vector normal matrix void
  57. syn keyword slStorageClass varying uniform extern
  58. syn keyword slStorageClass light surface volume displacement transformation imager
  59. syn keyword slVariable Cs Os P dPdu dPdv N Ng u v du dv s t
  60. syn keyword slVariable L Cl Ol E I ncomps time Ci Oi
  61. syn keyword slVariable Ps alpha
  62. syn keyword slVariable dtime dPdtime
  63. syn sync ccomment slComment minlines=10
  64. " Define the default highlighting.
  65. " Only when an item doesn't have highlighting yet
  66. hi def link slLabel Label
  67. hi def link slUserLabel Label
  68. hi def link slConditional Conditional
  69. hi def link slRepeat Repeat
  70. hi def link slCharacter Character
  71. hi def link slSpecialCharacter slSpecial
  72. hi def link slNumber Number
  73. hi def link slFloat Float
  74. hi def link slParenError slError
  75. hi def link slInParen slError
  76. hi def link slCommentError slError
  77. hi def link slOperator Operator
  78. hi def link slStorageClass StorageClass
  79. hi def link slError Error
  80. hi def link slStatement Statement
  81. hi def link slType Type
  82. hi def link slCommentError slError
  83. hi def link slCommentString slString
  84. hi def link slComment2String slString
  85. hi def link slCommentSkip slComment
  86. hi def link slString String
  87. hi def link slComment Comment
  88. hi def link slSpecial SpecialChar
  89. hi def link slTodo Todo
  90. hi def link slVariable Identifier
  91. "hi def link slIdentifier Identifier
  92. let b:current_syntax = "sl"
  93. " vim: ts=8