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