Last active
February 11, 2020 15:19
-
-
Save Zardoz89/1f51d3cac2e561e74889ef9e36cbc058 to your computer and use it in GitHub Desktop.
DIV2 syntax for VIM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim syntax file | |
" Language: DIV2 language | |
" Maintainer: Luis Panadero Guardeño | |
" Latest Revision: 10-2-2020 | |
if exists("b:current_syntax") | |
finish | |
endif | |
syn region divString matchgroup=divString start=+"+ end=+"+ oneline | |
syn keyword divBoolean true false | |
syn match divNumber "\<\d\+\>" | |
"syn match divIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" | |
syn match divMathOperator "-\|=\|[:<>+\*^/\\]" | |
syn match divLogicOperator "&&\|||\|or\|xor\|and\|neg" | |
syn region divComment start="/\*" end="\*/" contains=divTodo | |
syn region divCommentL start="//" skip="\\$" end="$" keepend contains=divTodo | |
syn keyword divConditional if else switch case | |
syn keyword divRepeat do for do repeat while to until loop step | |
syn keyword divHeaderStatement COMPILER_OPTIONS program import setup_program | |
syn keyword divBlockDeclaration const global local private | |
"contained | |
syn keyword divStartBlockStatement begin contained | |
syn keyword divEndBlockStatement end contained | |
syn keyword divStatement process function | |
syn keyword divStatement break return continue | |
syn keyword divStatement offset pointer | |
syn keyword divStruct struct | |
syn keyword divType byte int word string | |
syn keyword divTodo contained TODO FIXME NOTE contained | |
" Funtions | |
syn keyword divFunction signal key load_pal load_fpg start_scroll stop_scroll out_region | |
syn keyword divFunction graphic_info collision get_id get_distx get_disty get_angle get_dist fade | |
syn keyword divFunction load_fnt write write_int delete_text move_text unload_fpg rand define_region | |
syn keyword divFunction xput put put_screen map_xput map_put put_pixel get_pixel map_put_pixel | |
syn keyword divFunction map_get_pixel get_point clear_screen save load set_mode load_pcm unload_pcm | |
syn keyword divFunction sound stop_sound change_sound set_fps start_fli frame_fli end_fli reset_fli | |
syn keyword divFunction system refresh_scroll fget_dist fget_angle play_cd stop_cd is_playing_cd | |
syn keyword divFunction start_mode7 stop_mode7 advance abs fade_on fade_off rand_seed sqrt pow | |
syn keyword divFunction map_block_copy move_scroll near_angle let_me_alone exit roll_palette | |
syn keyword divFunction get_real_point get_joy_button get_joy_position convert_palette load_map | |
syn keyword divFunction reset_sound unload_map unload_fnt set_volume unload_wav load_wav load_pcx | |
syn keyword divFunction unload_pcx set_color net_join_game net_get_games stop_mode8 xadvance char | |
syn keyword divFunction path_find path_line path_free new_map load_wld start_mode8 go_to_flag | |
syn keyword divFunction set_sector_height get_sector_height set_point_m8 get_point_m8 set_fog | |
syn keyword divFunction set_sector_texture get_sector_texture set_wall_texture get_wall_texture | |
syn keyword divFunction set_env_color strcpy strcat strlen strcmp strchr strstr strset upper lower | |
syn keyword divFunction strdel screen_copy qsort load_song unload_song song stop_song set_song_pos | |
syn keyword divFunction get_song_pos get_song_line is_playing_sound is_playing_song fopen fclose | |
syn keyword divFunction fread fwrite fseek ftell filelength flush get_dirinfo get_fileinfo getdrive | |
syn keyword divFunction setdrive chdir mkdir remove disk_free memory_free ignore_error save_pcx | |
syn keyword divFunction sin cos tan asin acos atan atan2 draw delete_draw move_draw save_map | |
syn keyword divFunction write_in_map calculate itoa change_channel malloc free encode encode_file | |
syn keyword divFunction decode_file compress_file uncompress_file find_color load_screen force_pal | |
" Constants | |
syn keyword divConstants m320x200 m320x240 m320x400 m360x240 m360x360 m376x282 m640x400 m640x480 m800x600 m1024x768 | |
syn keyword divConstants min_int max_int pi | |
syn keyword divConstants s_kill s_wakeup s_sleep s_freeze s_kill_tree s_wakeup_tree s_sleep_tree s_freeze_tree | |
syn keyword divConstants all_text all_drawing all_sound | |
syn keyword divConstants g_wide g_height g_x_center g_y_center c_screen c_scroll c_m7 c_m8 | |
syn keyword divConstants partial_dump complete_dump no_restore partial_restore complete_restore | |
syn keyword divConstants c_0 c_1 c_2 c_3 c_4 c_5 c_6 c_7 c_8 c_9 | |
syn keyword divConstants _max_process _extended_conditions _simple_conditions _case_sensitive _ignore_errors _free_sintax _no_check _no_strfix _no_optimization _no_range_check _no_id_check _no_null_check | |
syn keyword divConstants seek_set seek_cur seek_end _normal _hidden _system _volid _subdir | |
syn keyword divConstants fast_mixer quality_mixer sound_bits_8 sound_bits_16 _wave | |
syn keyword divConstants _esc _f1 _f2 _f3 _f4 _f5 _f6 _f7 _f8 _f9 _f10 _f11 _f12 _prn_scr _scroll_lock | |
syn keyword divConstants _1 _2 _3 _4 _5 _6 _7 _8 _9 _0 _minus _plus _backspace _tab | |
syn keyword divConstants _q _w _e _r _t _y _u _i _o _p _l_brachet _r_brachet _enter _caps_lock | |
syn keyword divConstants _a _s _d _f _g _h _j _k _l _semicolon _apostrophe _backslash _l_shift | |
syn keyword divConstants _z _x _c _v _b _n _m _comma _point _slash _r_shift _control _alt _space | |
syn keyword divConstants _ins _home _pgup _del _end _pgdn _up _down _left _right _num_lock | |
syn keyword divConstants _c_backslash _c_asterisk _c_minus _c_home _c_up _c_pgup | |
syn keyword divConstants _c_left _c_center _c_right _c_end _c_down _c_pgdn _c_ins _c_del _c_plus _c_enter | |
"syn region divConstBlock start=+const+ end=+global\|local\|begin+ transparent contains=divType,divIdentifier,divBoolean,divNumber,divString,divStruct,divComment,divCommentL,divBlockDeclaration,divStartBlockStatement | |
"syn region divGlobalBlock start=+global+ end=+const\|local\|begin+ transparent contains=divType,divIdentifier,divBoolean,divNumber,divString,divStruct,divComment,divCommentL,divBlockDeclaration,divStartBlockStatement | |
"syn region divLocalBlock start=+local+ end=+const\|local\|begin+ transparent keepend contains=divType,divIdentifier,divBoolean,divNumber,divString,divStruct,divComment,divCommentL,divBlockDeclaration,divStartBlockStatement | |
syn region divBlock start=+begin+ end=+end+ transparent contains=ALLBUT,divBlockDeclaration,divHeaderStatement | |
"divIdentifier,divNumber,divString,divComment,divCommentL,divStartBlockStatement,divEndBlockStatement,divStatement,divFunction | |
"hi def link divIdentifier Identifier | |
hi def link divBoolean Boolean | |
hi def link divComment Comment | |
hi def link divCommentL Comment | |
hi def link divString String | |
hi def link divConditional Conditional | |
hi def link divNumber Number | |
hi def link divRepeat Repeat | |
hi def link divHeaderStatement Statement | |
hi def link divStatement Statement | |
hi def link divStruct Statement | |
hi def link divMathOperator Operator | |
hi def link divLogicOperator Operator | |
hi def link divTodo Todo | |
hi def link divType Type | |
"hi def link divUnclassified divStatement | |
"hi def link divDirective divStatement | |
hi def link divFunction Function | |
hi def link divConstants Constants | |
"hi def link divError Error | |
hi def link divBlockDeclaration Statement | |
hi def link divStartBlockStatement Statement | |
hi def link divEndBlockStatement Statement | |
let b:current_syntax = "div" | |
" vim: set ts=2 sw=2 tw=78 et : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
au BufRead,BufNewFile *.prg set filetype=div2 | |
au BufRead,BufNewFile *.PRG set filetype=div2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment