2 " Language: POV-Ray(tm) 3.1 Screen Description Language
3 " Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
4 " Last Change: 2001-04-26
5 " URI: http://physics.muni.cz/~yeti/download/pov.vim
7 " Notes: Old keywords like alpha, component, composite, tiles, etc. are
9 " The border between descriptors and modifiers is somewhat fuzzy.
10 " TODO: add `display' where appropriate
13 " React to possibly already-defined syntax.
14 " For version 5.x: Clear all syntax items unconditionally
15 " For version 6.x: Quit when a syntax file was already loaded
17 if exists("b:current_syntax")
27 syn keyword povCommands global_settings
28 syn keyword povObjects array atmosphere background bicubic_patch blob box camera cone cubic cylinder disc fog height_field julia_fractal lathe light_source mesh object plane poly polygon prism quadric quartic rainbow sky_sphere smooth_triangle sor sphere superellipsoid text torus triangle
29 syn keyword povCSG clipped_by difference intersection merge union
30 syn keyword povAppearance interior material media texture
31 syn keyword povGlobalSettings adc_bailout ambient_light assumed_gamma hf_gray_16 irid_wavelength max_intersections max_trace_level number_of_waves Number radiosity
32 syn keyword povTransform matrix rotate scale translate transform
35 syn keyword povDescriptors finish normal pigment
36 " FIXME: filter and transmit are both descriptors and modifiers (i chose modifier)
37 "syn keyword povDescriptors color colour rgb rgbt rgbf rgbft red green blue filter transmit
38 syn keyword povDescriptors color colour rgb rgbt rgbf rgbft red green blue
39 syn keyword povDescriptors bump_map color_map colour_map image_map material_map pigment_map quick_color quick_colour texture_map
40 syn keyword povDescriptors ambient brilliance crand diffuse irid metallic phong phong_size reflection reflection_exponent roughness specular
41 syn keyword povDescriptors cylinder fisheye omnimax orthographic panoramic perspective ultra_wide_angle
42 syn keyword povDescriptors agate average brick boxed bozo bumps checker crackle cylindrical density_file dents gradient granite hexagon leopard mandel marble onion planar quilted radial ripples spherical spiral1 spiral2 spotted waves wood wrinkles
43 " FIXME: cylinder is both object and descriptor (fortunately they're both linked to Type by default)
44 "syn keyword povDescriptors area_light cylinder shadowless spotlight
45 syn keyword povDescriptors area_light shadowless spotlight
46 syn keyword povDescriptors absorption confidence density emission intervals ratio samples scattering variance
47 syn keyword povDescriptors distance fog_alt fog_offset fog_type turb_depth
48 syn keyword povDescriptors brightness count distance_maximum error_bound gray_threshold low_error_factor minimum_reuse nearest_count recursion_limit
51 syn keyword povModifiers caustics fade_distance fade_power ior
52 syn keyword povModifiers bounded_by hierarchy hollow no_shadow open smooth sturm threshold water_level
53 syn keyword povModifiers hypercomplex max_iteration precision quaternion slice
54 syn keyword povModifiers bezier_spline conic_sweep cubic_spline linear_spline linear_sweep quadratic_spline
55 syn keyword povModifiers flatness type u_steps v_steps
56 syn keyword povModifiers adaptive falloff jitter looks_like media_attenuation media_interaction point_at radius tightness
57 syn keyword povModifiers angle aperture blur_samples confidence direction focal_point location look_at right sky up variance
58 syn keyword povModifiers all bump_size filter interpolate map_type normal_map once slope_map transmit use_color use_colour use_index
59 syn keyword povModifiers black_hole agate_turb brick_size control0 control1 cubic_wave density_map flip frequency interpolate inverse lambda mortar octaves offset omega phase poly_wave ramp_wave repeat scallop_wave sine_wave strength triangle_wave thickness turbulence type warp
60 syn keyword povModifiers eccentricity extinction
61 syn keyword povModifiers arc_angle falloff_angle width
63 " Words not marked `reserved' in documentation, but... {{{
64 syn keyword povHFType gif iff pgm png pot ppm sys tga contained
65 syn keyword povFontType ttf contained
66 syn keyword povDensityType df3 contained
68 " Math functions on floats, vectors and strings {{{
69 syn keyword povFunctions abs acos asc asin atan2 ceil cos defined degrees dimensions dimension_size div exp file_exists floor int log max min mod pow radians rand seed sin sqrt strcmp strlen tan val vdot vlength
70 syn keyword povFunctions vaxis_rotate vcross vnormalize vrotate
71 syn keyword povFunctions chr concat substr str strupr strlwr
72 " Functions available in julia_fractal only
73 syn keyword povJuliaFunctions acosh asinh atan cosh cube pwr reciprocal sinh sqr tanh
76 syn keyword povConsts clock clock_delta false no off on pi t true u v version x y yes z
77 syn match povDotItem "\.\(blue\|green\|filter\|red\|transmit\|t\|u\|v\|x\|y\|z\)\>"lc=1
81 syn region povComment start="/\*" end="\*/" contains=povTodo,povComment
82 syn match povComment "//.*" contains=povTodo
83 syn match povCommentError "\*/"
84 syn sync ccomment povComment
85 syn keyword povTodo TODO FIXME XXX contained
87 " Language directives {{{
88 " (highlight only the keyword)
89 syn match povConditionalDir "#\s*\(else\|end\|if\|ifdef\|ifndef\|switch\|while\)\>"
90 syn match povLabelDir "#\s*\(break\|case\|default\|range\)\>"
91 syn match povDeclareDir "#\s*\(declare\|default\|local\|macro\|undef\|version\)\>"
92 syn match povIncludeDir "#\s*include\>"
93 syn match povFileDir "#\s*\(fclose\|fopen\|read\|write\)\>"
94 syn match povMessageDir "#\s*\(debug\|error\|render\|statistics\|warning\)\>"
95 syn keyword povOpenType read write append contained
96 syn region povFileOpen start="#\s*fopen\>" skip=+"[^"]*"+ end="\<\(read\|write\|append\)\>" contains=ALLBUT,PovParenError,PovBraceError,PovTodo transparent keepend
99 " (must be one-liners)
100 syn match povSpecialChar "\\\d\d\d\|\\." contained
101 syn region povString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=povSpecialChar oneline
103 " Catch errors caused by wrong parenthesization {{{
105 syn region povParen start='(' end=')' contains=ALLBUT,povParenError,povSpecial,povTodo transparent
106 syn match povParenError ")"
107 " Idem for curly braces
108 syn region povBrace start='{' end='}' contains=ALLBUT,povBraceError,povSpecial,povTodo transparent
109 syn match povBraceError "}"
112 " (POV-Ray knows only floats)
113 syn match povNumber "\W[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="lc=1
114 " Does anyone start lines with a number?
115 syn match povNumber "^[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="
117 " Define the default highlighting {{{
118 " For version 5.7 and earlier: Only when not done already
119 " For version 5.8 and later: Only when an item doesn't have highlighting yet
120 if version >= 508 || !exists("did_pov_syntax_inits")
122 let did_pov_syntax_inits = 1
123 command -nargs=+ HiLink hi link <args>
125 command -nargs=+ HiLink hi def link <args>
129 HiLink povComment Comment
133 HiLink povNumber Number
134 HiLink povString String
135 HiLink povFileOpen Constant
136 HiLink povConsts Constant
137 HiLink povDotItem Constant
139 HiLink povHFType povSpecial
140 HiLink povDensityType povSpecial
141 HiLink povFontType povSpecial
142 HiLink povOpenType povSpecial
143 HiLink povSpecialChar povSpecial
144 HiLink povSpecial Special
146 HiLink povConditionalDir PreProc
147 HiLink povLabelDir PreProc
148 HiLink povDeclareDir Define
149 HiLink povIncludeDir Include
150 HiLink povFileDir PreProc
151 HiLink povMessageDir Debug
152 " objects and descriptors
153 HiLink povAppearance povDescriptors
154 HiLink povObjects povDescriptors
155 HiLink povGlobalSettings povDescriptors
156 HiLink povDescriptors Type
158 HiLink povJuliaFunctions PovFunctions
159 HiLink povModifiers povFunctions
160 HiLink povFunctions Function
162 HiLink povCommands Operator
163 HiLink povTransform Operator
164 HiLink povCSG Operator
166 HiLink povParenError povError
167 HiLink povBraceError povError
168 HiLink povCommentError povError
169 HiLink povError Error
174 let b:current_syntax = "pov"