blob: 4c1fd9624a8d6bdfefa4e7b773fa84a8991596ce [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +02002" Language: PoV-Ray(tm) 3.7 Scene Description Language
3" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
4" Last Change: 2011-04-23
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" Required Vim Version: 6.0
6
7" Setup
8if version >= 600
9 " Quit when a syntax file was already loaded
10 if exists("b:current_syntax")
11 finish
12 endif
13else
14 " Croak when an old Vim is sourcing us.
15 echo "Sorry, but this syntax file relies on Vim 6 features. Either upgrade Vim or use a version of " . expand("<sfile>:t:r") . " syntax file appropriate for Vim " . version/100 . "." . version %100 . "."
16 finish
17endif
18
19syn case match
20
21" Top level stuff
22syn keyword povCommands global_settings
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020023syn keyword povObjects array atmosphere background bicubic_patch blob box camera component cone cubic cylinder disc fog height_field isosurface julia_fractal lathe light_group light_source mesh mesh2 object ovus parametric pattern photons plane poly polygon polynomial prism quadric quartic rainbow sky_sphere smooth_triangle sor sphere sphere_sweep spline superellipsoid text torus triangle
Bram Moolenaar071d4272004-06-13 20:20:40 +000024syn keyword povCSG clipped_by composite contained_by difference intersection merge union
25syn keyword povAppearance interior material media texture interior_texture texture_list
26syn keyword povGlobalSettings ambient_light assumed_gamma charset hf_gray_16 irid_wavelength max_intersections max_trace_level number_of_waves radiosity noise_generator
27syn keyword povTransform inverse matrix rotate scale translate transform
28
29" Descriptors
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020030syn keyword povDescriptors finish inside_vector normal pigment uv_mapping uv_vectors vertex_vectors
31syn keyword povDescriptors adc_bailout always_sample brightness count error_bound distance_maximum gray_threshold load_file low_error_factor maximum_reuse max_sample media minimum_reuse mm_per_unit nearest_count normal pretrace_end pretrace_start recursion_limit save_file
32syn keyword povDescriptors color colour rgb rgbt rgbf rgbft srgb srgbf srgbt srgbft
33syn match povDescriptors "\<\(red\|green\|blue\|gray\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000034syn keyword povDescriptors bump_map color_map colour_map image_map material_map pigment_map quick_color quick_colour normal_map texture_map image_pattern pigment_pattern
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020035syn keyword povDescriptors ambient brilliance conserve_energy crand diffuse fresnel irid metallic phong phong_size refraction reflection reflection_exponent roughness specular subsurface
36syn keyword povDescriptors cylinder fisheye mesh_camera omnimax orthographic panoramic perspective spherical ultra_wide_angle
37syn keyword povDescriptors agate aoi average brick boxed bozo bumps cells checker crackle cylindrical dents facets function gradient granite hexagon julia leopard magnet mandel marble onion pavement planar quilted radial ripples slope spherical spiral1 spiral2 spotted square tiles tile2 tiling toroidal triangular waves wood wrinkles
Bram Moolenaar071d4272004-06-13 20:20:40 +000038syn keyword povDescriptors density_file
39syn keyword povDescriptors area_light shadowless spotlight parallel
40syn keyword povDescriptors absorption confidence density emission intervals ratio samples scattering variance
41syn keyword povDescriptors distance fog_alt fog_offset fog_type turb_depth
42syn keyword povDescriptors b_spline bezier_spline cubic_spline evaluate face_indices form linear_spline max_gradient natural_spline normal_indices normal_vectors quadratic_spline uv_indices
43syn keyword povDescriptors target
44
45" Modifiers
46syn keyword povModifiers caustics dispersion dispersion_samples fade_color fade_colour fade_distance fade_power ior
47syn keyword povModifiers bounded_by double_illuminate hierarchy hollow no_shadow open smooth sturm threshold water_level
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020048syn keyword povModifiers importance no_radiosity
Bram Moolenaar071d4272004-06-13 20:20:40 +000049syn keyword povModifiers hypercomplex max_iteration precision quaternion slice
50syn keyword povModifiers conic_sweep linear_sweep
51syn keyword povModifiers flatness type u_steps v_steps
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020052syn keyword povModifiers aa_level aa_threshold adaptive area_illumination falloff jitter looks_like media_attenuation media_interaction method point_at radius tightness
53syn keyword povModifiers angle aperture bokeh blur_samples confidence direction focal_point h_angle location look_at right sky up v_angle variance
54syn keyword povModifiers all bump_size gamma interpolate map_type once premultiplied slope_map use_alpha use_color use_colour use_index
55syn match povModifiers "\<\(filter\|transmit\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000056syn keyword povModifiers black_hole agate_turb brick_size control0 control1 cubic_wave density_map flip frequency interpolate inverse lambda metric mortar octaves offset omega phase poly_wave ramp_wave repeat scallop_wave sine_wave size strength triangle_wave thickness turbulence turb_depth type warp
57syn keyword povModifiers eccentricity extinction
58syn keyword povModifiers arc_angle falloff_angle width
59syn keyword povModifiers accuracy all_intersections altitude autostop circular collect coords cutaway_textures dist_exp expand_thresholds exponent exterior gather global_lights major_radius max_trace no_bump_scale no_image no_reflection orient orientation pass_through precompute projected_through range_divider solid spacing split_union tolerance
60
61" Words not marked `reserved' in documentation, but...
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020062syn keyword povBMPType alpha exr gif hdr iff jpeg pgm png pot ppm sys tga tiff
Bram Moolenaar071d4272004-06-13 20:20:40 +000063syn keyword povFontType ttf contained
64syn keyword povDensityType df3 contained
65syn keyword povCharset ascii utf8 contained
66
67" Math functions on floats, vectors and strings
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020068syn keyword povFunctions abs acos acosh asc asin asinh atan atan2 atanh bitwise_and bitwise_or bitwise_xor ceil cos cosh defined degrees dimensions dimension_size div exp file_exists floor inside int internal ln log max min mod pow prod radians rand seed select sin sinh sqrt strcmp strlen sum tan tanh val vdot vlength vstr vturbulence
Bram Moolenaar071d4272004-06-13 20:20:40 +000069syn keyword povFunctions min_extent max_extent trace vcross vrotate vaxis_rotate vnormalize vturbulence
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020070syn keyword povFunctions chr concat datetime now substr str strupr strlwr
Bram Moolenaar071d4272004-06-13 20:20:40 +000071syn keyword povJuliaFunctions acosh asinh atan cosh cube pwr reciprocal sinh sqr tanh
72
73" Specialities
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020074syn keyword povConsts clock clock_delta clock_on final_clock final_frame frame_number initial_clock initial_frame input_file_name image_width image_height false no off on pi true version yes
75syn match povConsts "\<[tuvxyz]\>"
76syn match povDotItem "\.\@<=\(blue\|green\|gray\|filter\|red\|transmit\|hf\|t\|u\|v\|x\|y\|z\)\>" display
Bram Moolenaar071d4272004-06-13 20:20:40 +000077
78" Comments
79syn region povComment start="/\*" end="\*/" contains=povTodo,povComment
80syn match povComment "//.*" contains=povTodo
81syn match povCommentError "\*/"
82syn sync ccomment povComment
83syn sync minlines=50
84syn keyword povTodo TODO FIXME XXX NOT contained
85syn cluster povPRIVATE add=povTodo
86
87" Language directives
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020088syn match povConditionalDir "#\s*\(else\|end\|for\|if\|ifdef\|ifndef\|switch\|while\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000089syn match povLabelDir "#\s*\(break\|case\|default\|range\)\>"
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020090syn match povDeclareDir "#\s*\(declare\|default\|local\|macro\|undef\|version\)\>" nextgroup=povDeclareOption skipwhite
91syn keyword povDeclareOption deprecated once contained nextgroup=povDeclareOption skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000092syn match povIncludeDir "#\s*include\>"
93syn match povFileDir "#\s*\(fclose\|fopen\|read\|write\)\>"
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020094syn keyword povFileDataType uint8 sint8 unit16be uint16le sint16be sint16le sint32le sint32be
Bram Moolenaar071d4272004-06-13 20:20:40 +000095syn match povMessageDir "#\s*\(debug\|error\|render\|statistics\|warning\)\>"
96syn region povFileOpen start="#\s*fopen\>" skip=+"[^"]*"+ matchgroup=povOpenType end="\<\(read\|write\|append\)\>" contains=ALLBUT,PovParenError,PovBraceError,@PovPRIVATE transparent keepend
97
98" Literal strings
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020099syn match povSpecialChar "\\u\x\{4}\|\\\d\d\d\|\\." contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100syn region povString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=povSpecialChar oneline
101syn cluster povPRIVATE add=povSpecialChar
102
103" Catch errors caused by wrong parenthesization
104syn region povParen start='(' end=')' contains=ALLBUT,povParenError,@povPRIVATE transparent
105syn match povParenError ")"
106syn region povBrace start='{' end='}' contains=ALLBUT,povBraceError,@povPRIVATE transparent
107syn match povBraceError "}"
108
109" Numbers
110syn match povNumber "\(^\|\W\)\@<=[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="
111
112" Define the default highlighting
113hi def link povComment Comment
114hi def link povTodo Todo
115hi def link povNumber Number
116hi def link povString String
117hi def link povFileOpen Constant
118hi def link povConsts Constant
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +0200119hi def link povDotItem povSpecial
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120hi def link povBMPType povSpecial
121hi def link povCharset povSpecial
122hi def link povDensityType povSpecial
123hi def link povFontType povSpecial
124hi def link povOpenType povSpecial
125hi def link povSpecialChar povSpecial
126hi def link povSpecial Special
127hi def link povConditionalDir PreProc
128hi def link povLabelDir PreProc
129hi def link povDeclareDir Define
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +0200130hi def link povDeclareOption Define
Bram Moolenaar071d4272004-06-13 20:20:40 +0000131hi def link povIncludeDir Include
132hi def link povFileDir PreProc
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +0200133hi def link povFileDataType Special
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134hi def link povMessageDir Debug
135hi def link povAppearance povDescriptors
136hi def link povObjects povDescriptors
137hi def link povGlobalSettings povDescriptors
138hi def link povDescriptors Type
139hi def link povJuliaFunctions PovFunctions
140hi def link povModifiers povFunctions
141hi def link povFunctions Function
142hi def link povCommands Operator
143hi def link povTransform Operator
144hi def link povCSG Operator
145hi def link povParenError povError
146hi def link povBraceError povError
147hi def link povCommentError povError
148hi def link povError Error
149
150let b:current_syntax = "pov"