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