vrml.vim 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. " Vim syntax file
  2. " Language: VRML97
  3. " Modified from: VRML 1.0C by David Brown <dbrown@cgs.c4.gmeds.com>
  4. " Maintainer: vacancy!
  5. " Former Maintainer: Gregory Seidman <gsslist+vim@anthropohedron.net>
  6. " Last change: 2006 May 03
  7. " quit when a syntax file was already loaded
  8. if exists("b:current_syntax")
  9. finish
  10. endif
  11. " keyword definitions
  12. syn keyword VRMLFields ambientIntensity appearance attenuation
  13. syn keyword VRMLFields autoOffset avatarSize axisOfRotation backUrl
  14. syn keyword VRMLFields bboxCenter bboxSize beamWidth beginCap
  15. syn keyword VRMLFields bottom bottomRadius bottomUrl ccw center
  16. syn keyword VRMLFields children choice collide color colorIndex
  17. syn keyword VRMLFields colorPerVertex convex coord coordIndex
  18. syn keyword VRMLFields creaseAngle crossSection cutOffAngle
  19. syn keyword VRMLFields cycleInterval description diffuseColor
  20. syn keyword VRMLFields directOutput direction diskAngle
  21. syn keyword VRMLFields emissiveColor enabled endCap family
  22. syn keyword VRMLFields fieldOfView fogType fontStyle frontUrl
  23. syn keyword VRMLFields geometry groundAngle groundColor headlight
  24. syn keyword VRMLFields height horizontal info intensity jump
  25. syn keyword VRMLFields justify key keyValue language leftToRight
  26. syn keyword VRMLFields leftUrl length level location loop material
  27. syn keyword VRMLFields maxAngle maxBack maxExtent maxFront
  28. syn keyword VRMLFields maxPosition minAngle minBack minFront
  29. syn keyword VRMLFields minPosition mustEvaluate normal normalIndex
  30. syn keyword VRMLFields normalPerVertex offset on orientation
  31. syn keyword VRMLFields parameter pitch point position priority
  32. syn keyword VRMLFields proxy radius range repeatS repeatT rightUrl
  33. syn keyword VRMLFields rotation scale scaleOrientation shininess
  34. syn keyword VRMLFields side size skyAngle skyColor solid source
  35. syn keyword VRMLFields spacing spatialize specularColor speed spine
  36. syn keyword VRMLFields startTime stopTime string style texCoord
  37. syn keyword VRMLFields texCoordIndex texture textureTransform title
  38. syn keyword VRMLFields top topToBottom topUrl translation
  39. syn keyword VRMLFields transparency type url vector visibilityLimit
  40. syn keyword VRMLFields visibilityRange whichChoice xDimension
  41. syn keyword VRMLFields xSpacing zDimension zSpacing
  42. syn match VRMLFields "\<[A-Za-z_][A-Za-z0-9_]*\>" contains=VRMLComment,VRMLProtos,VRMLfTypes
  43. " syn match VRMLFields "\<[A-Za-z_][A-Za-z0-9_]*\>\(,\|\s\)*\(#.*$\)*\<IS\>\(#.*$\)*\(,\|\s\)*\<[A-Za-z_][A-Za-z0-9_]*\>\(,\|\s\)*\(#.*$\)*" contains=VRMLComment,VRMLProtos
  44. " syn region VRMLFields start="\<[A-Za-z_][A-Za-z0-9_]*\>" end=+\(,\|#\|\s\)+me=e-1 contains=VRMLComment,VRMLProtos
  45. syn keyword VRMLEvents addChildren ambientIntensity_changed
  46. syn keyword VRMLEvents appearance_changed attenuation_changed
  47. syn keyword VRMLEvents autoOffset_changed avatarSize_changed
  48. syn keyword VRMLEvents axisOfRotation_changed backUrl_changed
  49. syn keyword VRMLEvents beamWidth_changed bindTime bottomUrl_changed
  50. syn keyword VRMLEvents center_changed children_changed
  51. syn keyword VRMLEvents choice_changed collideTime collide_changed
  52. syn keyword VRMLEvents color_changed coord_changed
  53. syn keyword VRMLEvents cutOffAngle_changed cycleInterval_changed
  54. syn keyword VRMLEvents cycleTime description_changed
  55. syn keyword VRMLEvents diffuseColor_changed direction_changed
  56. syn keyword VRMLEvents diskAngle_changed duration_changed
  57. syn keyword VRMLEvents emissiveColor_changed enabled_changed
  58. syn keyword VRMLEvents enterTime exitTime fogType_changed
  59. syn keyword VRMLEvents fontStyle_changed fraction_changed
  60. syn keyword VRMLEvents frontUrl_changed geometry_changed
  61. syn keyword VRMLEvents groundAngle_changed headlight_changed
  62. syn keyword VRMLEvents hitNormal_changed hitPoint_changed
  63. syn keyword VRMLEvents hitTexCoord_changed intensity_changed
  64. syn keyword VRMLEvents isActive isBound isOver jump_changed
  65. syn keyword VRMLEvents keyValue_changed key_changed leftUrl_changed
  66. syn keyword VRMLEvents length_changed level_changed
  67. syn keyword VRMLEvents location_changed loop_changed
  68. syn keyword VRMLEvents material_changed maxAngle_changed
  69. syn keyword VRMLEvents maxBack_changed maxExtent_changed
  70. syn keyword VRMLEvents maxFront_changed maxPosition_changed
  71. syn keyword VRMLEvents minAngle_changed minBack_changed
  72. syn keyword VRMLEvents minFront_changed minPosition_changed
  73. syn keyword VRMLEvents normal_changed offset_changed on_changed
  74. syn keyword VRMLEvents orientation_changed parameter_changed
  75. syn keyword VRMLEvents pitch_changed point_changed position_changed
  76. syn keyword VRMLEvents priority_changed radius_changed
  77. syn keyword VRMLEvents removeChildren rightUrl_changed
  78. syn keyword VRMLEvents rotation_changed scaleOrientation_changed
  79. syn keyword VRMLEvents scale_changed set_ambientIntensity
  80. syn keyword VRMLEvents set_appearance set_attenuation
  81. syn keyword VRMLEvents set_autoOffset set_avatarSize
  82. syn keyword VRMLEvents set_axisOfRotation set_backUrl set_beamWidth
  83. syn keyword VRMLEvents set_bind set_bottomUrl set_center
  84. syn keyword VRMLEvents set_children set_choice set_collide
  85. syn keyword VRMLEvents set_color set_colorIndex set_coord
  86. syn keyword VRMLEvents set_coordIndex set_crossSection
  87. syn keyword VRMLEvents set_cutOffAngle set_cycleInterval
  88. syn keyword VRMLEvents set_description set_diffuseColor
  89. syn keyword VRMLEvents set_direction set_diskAngle
  90. syn keyword VRMLEvents set_emissiveColor set_enabled set_fogType
  91. syn keyword VRMLEvents set_fontStyle set_fraction set_frontUrl
  92. syn keyword VRMLEvents set_geometry set_groundAngle set_headlight
  93. syn keyword VRMLEvents set_height set_intensity set_jump set_key
  94. syn keyword VRMLEvents set_keyValue set_leftUrl set_length
  95. syn keyword VRMLEvents set_level set_location set_loop set_material
  96. syn keyword VRMLEvents set_maxAngle set_maxBack set_maxExtent
  97. syn keyword VRMLEvents set_maxFront set_maxPosition set_minAngle
  98. syn keyword VRMLEvents set_minBack set_minFront set_minPosition
  99. syn keyword VRMLEvents set_normal set_normalIndex set_offset set_on
  100. syn keyword VRMLEvents set_orientation set_parameter set_pitch
  101. syn keyword VRMLEvents set_point set_position set_priority
  102. syn keyword VRMLEvents set_radius set_rightUrl set_rotation
  103. syn keyword VRMLEvents set_scale set_scaleOrientation set_shininess
  104. syn keyword VRMLEvents set_size set_skyAngle set_skyColor
  105. syn keyword VRMLEvents set_source set_specularColor set_speed
  106. syn keyword VRMLEvents set_spine set_startTime set_stopTime
  107. syn keyword VRMLEvents set_string set_texCoord set_texCoordIndex
  108. syn keyword VRMLEvents set_texture set_textureTransform set_topUrl
  109. syn keyword VRMLEvents set_translation set_transparency set_type
  110. syn keyword VRMLEvents set_url set_vector set_visibilityLimit
  111. syn keyword VRMLEvents set_visibilityRange set_whichChoice
  112. syn keyword VRMLEvents shininess_changed size_changed
  113. syn keyword VRMLEvents skyAngle_changed skyColor_changed
  114. syn keyword VRMLEvents source_changed specularColor_changed
  115. syn keyword VRMLEvents speed_changed startTime_changed
  116. syn keyword VRMLEvents stopTime_changed string_changed
  117. syn keyword VRMLEvents texCoord_changed textureTransform_changed
  118. syn keyword VRMLEvents texture_changed time topUrl_changed
  119. syn keyword VRMLEvents touchTime trackPoint_changed
  120. syn keyword VRMLEvents translation_changed transparency_changed
  121. syn keyword VRMLEvents type_changed url_changed value_changed
  122. syn keyword VRMLEvents vector_changed visibilityLimit_changed
  123. syn keyword VRMLEvents visibilityRange_changed whichChoice_changed
  124. syn region VRMLEvents start="\S+[^0-9]+\.[A-Za-z_]+"ms=s+1 end="\(,\|$\|\s\)"me=e-1
  125. syn keyword VRMLNodes Anchor Appearance AudioClip Background
  126. syn keyword VRMLNodes Billboard Box Collision Color
  127. syn keyword VRMLNodes ColorInterpolator Cone Coordinate
  128. syn keyword VRMLNodes CoordinateInterpolator Cylinder
  129. syn keyword VRMLNodes CylinderSensor DirectionalLight
  130. syn keyword VRMLNodes ElevationGrid Extrusion Fog FontStyle
  131. syn keyword VRMLNodes Group ImageTexture IndexedFaceSet
  132. syn keyword VRMLNodes IndexedLineSet Inline LOD Material
  133. syn keyword VRMLNodes MovieTexture NavigationInfo Normal
  134. syn keyword VRMLNodes NormalInterpolator OrientationInterpolator
  135. syn keyword VRMLNodes PixelTexture PlaneSensor PointLight
  136. syn keyword VRMLNodes PointSet PositionInterpolator
  137. syn keyword VRMLNodes ProximitySensor ScalarInterpolator
  138. syn keyword VRMLNodes Script Shape Sound Sphere SphereSensor
  139. syn keyword VRMLNodes SpotLight Switch Text TextureCoordinate
  140. syn keyword VRMLNodes TextureTransform TimeSensor TouchSensor
  141. syn keyword VRMLNodes Transform Viewpoint VisibilitySensor
  142. syn keyword VRMLNodes WorldInfo
  143. " the following line doesn't catch <node><newline><openbrace> since \n
  144. " doesn't match as an atom yet :-(
  145. syn match VRMLNodes "[A-Za-z_][A-Za-z0-9_]*\(,\|\s\)*{"me=e-1
  146. syn region VRMLNodes start="\<EXTERNPROTO\>\(,\|\s\)*[A-Za-z_]"ms=e start="\<EXTERNPROTO\>\(,\|\s\)*" end="[\s]*\["me=e-1 contains=VRMLProtos,VRMLComment
  147. syn region VRMLNodes start="PROTO\>\(,\|\s\)*[A-Za-z_]"ms=e start="PROTO\>\(,\|\s\)*" end="[\s]*\["me=e-1 contains=VRMLProtos,VRMLComment
  148. syn keyword VRMLTypes SFBool SFColor MFColor SFFloat MFFloat
  149. syn keyword VRMLTypes SFImage SFInt32 MFInt32 SFNode MFNode
  150. syn keyword VRMLTypes SFRotation MFRotation SFString MFString
  151. syn keyword VRMLTypes SFTime MFTime SFVec2f MFVec2f SFVec3f MFVec3f
  152. syn keyword VRMLfTypes field exposedField eventIn eventOut
  153. syn keyword VRMLValues TRUE FALSE NULL
  154. syn keyword VRMLProtos contained EXTERNPROTO PROTO IS
  155. syn keyword VRMLRoutes contained ROUTE TO
  156. "containment!
  157. syn include @jscript $VIMRUNTIME/syntax/javascript.vim
  158. syn region VRMLjScriptString contained start=+"\(\(javascript\)\|\(vrmlscript\)\|\(ecmascript\)\):+ms=e+1 skip=+\\\\\|\\"+ end=+"+me=e-1 contains=@jscript
  159. " match definitions.
  160. syn match VRMLSpecial contained "\\[0-9][0-9][0-9]\|\\."
  161. syn region VRMLString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=VRMLSpecial,VRMLjScriptString
  162. syn match VRMLCharacter "'[^\\]'"
  163. syn match VRMLSpecialCharacter "'\\.'"
  164. syn match VRMLNumber "[-+]\=\<[0-9]\+\(\.[0-9]\+\)\=\([eE]\{1}[-+]\=[0-9]\+\)\=\>\|0[xX][0-9a-fA-F]\+\>"
  165. syn match VRMLNumber "0[xX][0-9a-fA-F]\+\>"
  166. syn match VRMLComment "#.*$"
  167. " newlines should count as whitespace, but they can't be matched yet :-(
  168. syn region VRMLRouteNode start="[^O]TO\(,\|\s\)*" end="\."me=e-1 contains=VRMLRoutes,VRMLComment
  169. syn region VRMLRouteNode start="ROUTE\(,\|\s\)*" end="\."me=e-1 contains=VRMLRoutes,VRMLComment
  170. syn region VRMLInstName start="DEF\>"hs=e+1 skip="DEF\(,\|\s\)*" end="[A-Za-z0-9_]\(\s\|$\|,\)"me=e contains=VRMLInstances,VRMLComment
  171. syn region VRMLInstName start="USE\>"hs=e+1 skip="USE\(,\|\s\)*" end="[A-Za-z0-9_]\(\s\|$\|,\)"me=e contains=VRMLInstances,VRMLComment
  172. syn keyword VRMLInstances contained DEF USE
  173. syn sync minlines=1
  174. "FOLDS!
  175. syn sync fromstart
  176. "setlocal foldmethod=syntax
  177. syn region braceFold start="{" end="}" transparent fold contains=TOP
  178. syn region bracketFold start="\[" end="]" transparent fold contains=TOP
  179. syn region VRMLString start=+"+ skip=+\\\\\|\\"+ end=+"+ fold contains=VRMLSpecial,VRMLjScriptString
  180. " Define the default highlighting.
  181. " Only when an item doesn't have highlighting yet
  182. hi def link VRMLCharacter VRMLString
  183. hi def link VRMLSpecialCharacter VRMLSpecial
  184. hi def link VRMLNumber VRMLString
  185. hi def link VRMLValues VRMLString
  186. hi def link VRMLString String
  187. hi def link VRMLSpecial Special
  188. hi def link VRMLComment Comment
  189. hi def link VRMLNodes Statement
  190. hi def link VRMLFields Type
  191. hi def link VRMLEvents Type
  192. hi def link VRMLfTypes LineNr
  193. " hi VRMLfTypes ctermfg=6 guifg=Brown
  194. hi def link VRMLInstances PreCondit
  195. hi def link VRMLRoutes PreCondit
  196. hi def link VRMLProtos PreProc
  197. hi def link VRMLRouteNode Identifier
  198. hi def link VRMLInstName Identifier
  199. hi def link VRMLTypes Identifier
  200. let b:current_syntax = "vrml"
  201. " vim: ts=8