{ -- alex scanner for use with uulib -- compile with alex -o Scanner.hs -g Scanner.x module Graphics.LambdaCube.Loader.Generated.MaterialScriptScanner(tokenize) where import UU.Scanner } $litChar = [^[\" \\]] $identChar = [a-zA-Z0-9_\.\-\/\~\[\]] tokens :- $white+ ; -- whitespace "//".* ; -- comment \" ($litChar | \\ \\ | \\ \" )* \" { valueToken TkString } -- string (\+ | \-)?[0-9]+ { valueToken TkInteger10 } -- int (\+ | \-)?[0-9]+\.[0-9]+ { valueToken TkFraction } -- float ( on | off | true | false | force | material | technique | pass | texture_unit | lod_distances | receive_shadows | transparency_casts_shadows | set_texture_alias | scheme | lod_index | lod_distances | shadow_caster_material | shadow_receiver_material | gpu_vendor_rule | gpu_device_rule | include | exclude | case_sensitive | ambient | vertexcolour | diffuse | specular | emissive | scene_blend | add | modulate | alpha_blend | colour_blend | one | zero | dest_colour | src_colour | one_minus_dest_colour | one_minus_src_colour | dest_alpha | src_alpha | one_minus_dest_alpha | one_minus_src_alpha | separate_scene_blend | depth_check | depth_write | depth_func | always_fail | always_pass | less | less_equal | equal | not_equal | greater_equal | greater | depth_bias | iteration_depth_bias | alpha_rejection | alpha_to_coverage | light_scissor | light_clip_planes | illumination_stage | per_light | decal | normalise_normals | transparent_sorting | cull_hardware | clockwise | anticlockwise | none | cull_software | back | front | lighting | shading | flat | gouraud | phong | polygon_mode | solid | wireframe | points | polygon_mode_overrideable | fog_override | exp | exp2 | colour_write | start_light | max_lights | iteration | once | once_per_light | directional | spot | point_size | point_sprites | point_size_attenuation | point_size_min | point_size_max | texture_alias | texture | unlimited | alpha | gamma | 1d | 2d | 3d | cubic | PF_L8 | PF_L16 | PF_A8 | PF_A4L4 | PF_BYTE_LA | PF_R5G6B5 | PF_B5G6R5 | PF_R3G3B2 | PF_A4R4G4B4 | PF_A1R5G5B5 | PF_R8G8B8 | PF_B8G8R8 | PF_A8R8G8B8 | PF_A8B8G8R8 | PF_B8G8R8A8 | PF_R8G8B8A8 | PF_X8R8G8B8 | PF_X8B8G8R8 | PF_A2R10G10B10 | PF_A2B10G10R10 | PF_FLOAT16_R | PF_FLOAT16_RGB | PF_FLOAT16_RGBA | PF_FLOAT32_R | PF_FLOAT32_RGB | PF_FLOAT32_RGBA | PF_SHORT_RGBA | anim_texture | cubic_texture | combinedUVW | separateUV | binding_type | vertex | fragment | content_type | named | shadow | tex_coord_set | tex_address_mode | wrap | clamp | mirror | border | tex_border_colour | filtering | bilinear | trilinear | anisotropic | linear | point | max_anisotropy | mipmap_bias | colour_op | replace | colour_op_ex | source1 | source2 | modulate_x2 | modulate_x4 | add_signed | add_smooth | subtract | blend_diffuse_alpha | blend_texture_alpha | blend_current_alpha | blend_manual | dotproduct | blend_diffuse_colour | src_current | src_texture | src_diffuse | src_specular | src_manual | colour_op_multipass_fallback | alpha_op_ex | env_map | spherical | planar | cubic_reflection | cubic_normal | scroll | scroll_anim | rotate | rotate_anim | scale | wave_xform | scroll_x | scroll_y | scale_x | scale_y | sine | triangle | square | sawtooth | inverse_sawtooth | transform | scene_blend_op | reverse_subtract | min | max | separate_scene_blend_op | keep | increment | decrement | increment_wrap | decrement_wrap | invert | vertex_program | fragment_program | source | syntax | attach | manual_named_constants | profiles | entry_point | target | preprocessor_defines | column_major_matrices | input_operation_type | output_operation_type | max_output_vertices | delegate | vertex_program_ref |fragment_program_ref | shadow_caster_vertex_program_ref | shadow_receiver_vertex_program_ref | shadow_receiver_fragment_program_ref | default_params | param_named_auto | param_named | param_indexed_auto | param_indexed | includes_skeletal_animation | includes_morph_animation | includes_pose_animation | uses_vertex_texture_fetch | uses_adjacency_information | world_matrix | inverse_world_matrix | transpose_world_matrix | inverse_transpose_world_matrix | world_matrix_array_3x4 | view_matrix | inverse_view_matrix | transpose_view_matrix | inverse_transpose_view_matrix | projection_matrix | inverse_projection_matrix | transpose_projection_matrix | inverse_transpose_projection_matrix | worldview_matrix | inverse_worldview_matrix | transpose_worldview_matrix | inverse_transpose_worldview_matrix | viewproj_matrix | inverse_viewproj_matrix | transpose_viewproj_matrix | inverse_transpose_viewproj_matrix | worldviewproj_matrix | inverse_worldviewproj_matrix | transpose_worldviewproj_matrix | inverse_transpose_worldviewproj_matrix | texture_matrix | render_target_flipping | light_diffuse_colour | light_specular_colour | light_attenuation | spotlight_params | light_position | light_direction | light_position_object_space | light_direction_object_space | light_distance_object_space | light_position_view_space | light_direction_view_space | light_power | light_diffuse_colour_power_scaled | light_specular_colour_power_scaled | light_number | light_diffuse_colour_array | light_specular_colour_array | light_diffuse_colour_power_scaled_array | light_specular_colour_power_scaled_array | light_attenuation_array | spotlight_params_array | light_position_array | light_direction_array | light_position_object_space_array | light_direction_object_space_array | light_distance_object_space_array | light_position_view_space_array | light_direction_view_space_array | light_power_array | light_count | light_casts_shadows | ambient_light_colour | surface_ambient_colour | surface_diffuse_colour | surface_specular_colour | surface_emissive_colour | surface_shininess | derived_ambient_light_colour | derived_scene_colour | derived_light_diffuse_colour | derived_light_specular_colour | derived_light_diffuse_colour_array | derived_light_specular_colour_array | fog_colour | fog_params | camera_position | camera_position_object_space | lod_camera_position | lod_camera_position_object_space | time | time_0_x | costime_0_x | sintime_0_x | tantime_0_x | time_0_x_packed | time_0_1 | costime_0_1 | sintime_0_1 | tantime_0_1 | time_0_1_packed | time_0_2pi | costime_0_2pi | sintime_0_2pi | tantime_0_2pi | time_0_2pi_packed | frame_time | fps | viewport_width | viewport_height | inverse_viewport_width | inverse_viewport_height | viewport_size | texel_offsets | view_direction | view_side_vector | view_up_vector | fov | near_clip_distance | far_clip_distance | texture_viewproj_matrix | texture_viewproj_matrix_array | texture_worldviewproj_matrix | texture_worldviewproj_matrix_array | spotlight_viewproj_matrix | spotlight_worldviewproj_matrix | scene_depth_range | shadow_scene_depth_range | shadow_colour | shadow_extrusion_distance | texture_size | inverse_texture_size | packed_texture_size | pass_number | pass_iteration_number | animation_parametric | custom ) { reserved } -- reserved keywords [\{\}] { reserved } -- reserved symbols $identChar+ { valueToken TkVarid } -- identifier { -- boilerplate code needed for Alex type AlexInput = (Pos, String) alexInputPrevChar :: AlexInput -> Char alexInputPrevChar = error "alexInputPrevChar: there is no need to go back in the input." alexGetChar :: AlexInput -> Maybe (Char, AlexInput) alexGetChar (_, []) = Nothing alexGetChar (p, (c:cs)) = let p' = adv p c in Just (c, (p', cs)) -- use the Alex scanner to generate a list of tokens for the uulib token parsers tokenize :: String -> String -> [Token] tokenize filename str = go (initpos, str) where initpos = Pos 1 1 filename go inp@(pos, cs) = case alexScan inp 0 of AlexEOF -> [] AlexError inp' -> valueToken TkError [head cs] pos : go inp' AlexSkip inp' _ -> go inp' AlexToken inp' len act -> act (take len cs) pos : go inp' }