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