"Vim syntax file "Language: SDL (Presentation's Scenario Description Language) "Maintainer: Andreas Romeyke "Latest Revision: 2008-09-17 $Id: presentation_sdl.vim 270 2009-03-18 14:23:40Z art1 $ "Copyright: GPLv3 or higher, License available at http://gplv3.fsf.org/ "For version 5.x: Clear all syntax items "For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists('b:current_syntax') finish endif let b:current_syntax = 1 setlocal indentexpr=GetSDLIndent(v:lnum) setlocal indentkeys& setlocal indentkeys+==scenario,==pcl_file,==begin,==TEMPLATE if exists('*GetSDLIndent') finish endif function! s:GetPrevNonCommentLineNum( line_num ) " Skip lines starting with a comment let SKIP_LINES = '^\s*\(#.*\|\(\/\*.*\\*\/\)\)$' let nline = a:line_num while nline > 0 let nline = prevnonblank(nline-1) if getline(nline) !~? SKIP_LINES break endif endwhile return nline endfunction "syntax include @presentation_sdl syntax/presentation_sdl.vim function! GetSDLIndent( line_num ) " Line 0 always goes at column 0 if a:line_num == 0 return 0 endif " get lines let this_codeline = substitute(getline( a:line_num ), '\(#.*\)\|\(\/\*.*\*\/\)','', 'g') let prev_codeline_num = s:GetPrevNonCommentLineNum( a:line_num ) let prev_codeline = substitute(getline( prev_codeline_num ), '\(#.*\)\|\(\/\*.*\*\/\)','', 'g') let indnt = indent( prev_codeline_num ) if this_codeline =~ "^$" return indnt end if this_codeline =~ '^\s*scenario\s' return 0 end if this_codeline =~ '^\s*pcl_file' return 0 end if this_codeline =~ '^\s*TEMPLATE' return 0 end " handle brackets if prev_codeline =~ '\({\|(\)\s*$' let indnt = indnt+&shiftwidth end if this_codeline =~ '^\s*\(}\|)\)' let indnt = indnt-&shiftwidth end return indnt endfunction syn keyword psdlBoolean true false syn keyword psdlClasses bitmap box nothing picture sound stimulus_event text trial wavefile syn keyword psdlControl ENDLOOP LOOP IF ENDIF begin pcl_file scenario array syn keyword psdlPreprocessing TEMPLATE syn keyword psdlDefaultProperties default logfile directory default picture default picture stimulus default stimuli directory default stimulus directory default_all_responses default_attenuation default_background_color default_cue_event_port default_cue_events default_default_2d_on_top default_delta_time default_deltat default_draw_mode default_font default_font_size default_invert_caption default_max_responses default_monitor_sounds default_output_port default_pan default_path default_picture_duration default_stimulus_time_in default_stimulus_time_out default_text_align default_text_color default_trial_duration default_trial_start_delay default_trial_type default_volume syn keyword psdlProperties active_buttons button_codes caption code color description duration filename height no_logfile port_code preload response_matching start_delay start_time target_button transparent_color trial_duration trial_type width x y syn keyword psdlSpecialValues first_response forever legacy_matching never next_picture simple_matching stimuli_length target_response syn match psdlComment "#.*$" syn match psdlEscape '\\\(r\|n\|t\|f\|b\|"\|u\x\{4}\)' contained display syn match psdlNumber '[-+.eE0-9]+' syn match psdlToken '[\[\]{};]' syn match psdlVariable "$[a-zA-Z][A-za-z0-9]*" syn region psdlMultilineComment start="/\*" end="\*/" syn region psdlString start=+"+ end=+"+ contains=psdlEscape hi def link psdlBoolean Boolean hi def link psdlClasses Type hi def link psdlComment Comment hi def link psdlControl Keyword hi def link psdlEscape Special hi def link psdlLiteral Constant hi def link psdlMultilineComment Comment hi def link psdlNumber Number hi def link psdlNumber Number hi def link psdlPreprocessing Preproc hi def link psdlProperties Identifier hi def link psdlDefaultProperties Identifier hi def link psdlSpecialValues Constant hi def link psdlString Identifier hi def link psdlToken Operator hi def link psdlVariable Identifier imap ( () imap { {} imap [ [] imap /* /* */ let b:current_syntax = 'presentation_sdl' setlocal omnifunc=syntaxcomplete#Complete "let g:omni_syntax_group_include_sdl = 'psdlClasses,psdlDefaultProperties,psdlProperties,psdlSpecialValues,psdlPreprocessing'