Julien Marrec | 2e31065 | 2023-11-25 15:30:46 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: SWIG |
| 3 | " Maintainer: Julien Marrec <julien.marrec 'at' gmail com> |
| 4 | " Last Change: 2023 November 23 |
| 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | |
| 10 | " Read the C++ syntax to start with |
| 11 | runtime! syntax/cpp.vim |
| 12 | unlet b:current_syntax |
| 13 | |
| 14 | " SWIG extentions |
| 15 | syn keyword swigInclude %include %import %importfile %includefile %module |
| 16 | |
| 17 | syn keyword swigMostCommonDirective %alias %apply %beginfile %clear %constant %define %echo %enddef %endoffile |
| 18 | syn keyword swigMostCommonDirective %extend %feature %director %fragment %ignore %inline |
| 19 | syn keyword swigMostCommonDirective %keyword %name %namewarn %native %newobject %parms %pragma |
| 20 | syn keyword swigMostCommonDirective %rename %template %typedef %typemap %types %varargs |
| 21 | |
| 22 | " SWIG: Language specific macros |
| 23 | syn keyword swigOtherLanguageSpecific %luacode %go_import |
| 24 | |
| 25 | syn keyword swigCSharp %csattributes %csconst %csconstvalue %csmethodmodifiers %csnothrowexception |
| 26 | syn keyword swigCSharp %dconstvalue %dmanifestconst %dmethodmodifiers |
| 27 | |
| 28 | syn keyword swigJava %javaconstvalue %javaexception %javamethodmodifiers %javaconst %nojavaexception |
| 29 | |
| 30 | syn keyword swigGuile %multiple_values %values_as_list %values_as_vector |
| 31 | |
| 32 | syn keyword swigPHP %rinit %rshutdown %minit %mshutdown |
| 33 | |
| 34 | syn keyword swigPython %pybinoperator %pybuffer_binary %pybuffer_mutable_binary %pybuffer_mutable_string %pybuffer_string |
| 35 | syn keyword swigPython %pythonappend %pythonbegin %pythoncode %pythondynamic %pythonnondynamic %pythonprepend |
| 36 | |
| 37 | syn keyword swigRuby %markfunc %trackobjects %bang |
| 38 | syn keyword swigScilab %scilabconst |
| 39 | |
| 40 | " SWIG: Insertion |
| 41 | syn keyword swigInsertSection %insert %begin %runtime %header %wrapper %init |
| 42 | |
| 43 | " SWIG: Other directives |
| 44 | syn keyword swigCstring %cstring_bounded_mutable %cstring_bounded_output %cstring_chunk_output %cstring_input_binary %cstring_mutable |
| 45 | syn keyword swigCstring %cstring_output_allocate %cstring_output_allocate_size %cstring_output_maxsize %cstring_output_withsize |
| 46 | syn keyword swigCWstring %cwstring_bounded_mutable %cwstring_bounded_output %cwstring_chunk_output %cwstring_input_binary %cwstring_mutable |
| 47 | syn keyword swigCWstring %cwstring_output_allocate %cwstring_output_allocate_size %cwstring_output_maxsize %cwstring_output_withsize |
| 48 | syn keyword swigCMalloc %malloc %calloc %realloc %free %sizeof %allocators |
| 49 | |
| 50 | syn keyword swigExceptionHandling %catches %raise %allowexception %exceptionclass %warn %warnfilter %exception |
| 51 | syn keyword swigContract %contract %aggregate_check |
| 52 | |
| 53 | syn keyword swigDirective %addmethods %array_class %array_functions %attribute %attribute2 %attribute2ref |
| 54 | syn keyword swigDirective %attribute_ref %attributeref %attributestring %attributeval %auto_ptr %callback |
| 55 | syn keyword swigDirective %delete_array %delobject %extend_smart_pointer %factory %fastdispatch %freefunc %immutable |
| 56 | syn keyword swigDirective %implicit %implicitconv %interface %interface_custom %interface_impl %intrusive_ptr %intrusive_ptr_no_wrap |
| 57 | syn keyword swigDirective %mutable %naturalvar %nocallback %nocopyctor %nodefaultctor %nodefaultdtor %nonaturalvar %nonspace |
| 58 | syn keyword swigDirective %nspace %pointer_cast %pointer_class %pointer_functions %predicate %proxycode |
| 59 | syn keyword swigDirective %refobject %set_output %shared_ptr %std_comp_methods |
| 60 | syn keyword swigDirective %std_nodefconst_type %typecheck %typemaps_string %unique_ptr %unrefobject %valuewrapper |
| 61 | |
| 62 | syn match swigVerbatimStartEnd "%[{}]" |
| 63 | |
| 64 | syn match swigUserDef "%\w\+" |
| 65 | syn match swigVerbatimMacro "^\s*%#\w\+\%( .*\)\?$" |
| 66 | |
| 67 | " SWIG: typemap var and typemap macros (eg: $1, $*1_type, $&n_ltype, $self) |
| 68 | syn match swigTypeMapVars "\$[*&_a-zA-Z0-9]\+" |
| 69 | |
| 70 | " Default highlighting |
| 71 | hi def link swigInclude Include |
| 72 | hi def link swigMostCommonDirective Structure |
| 73 | hi def link swigDirective Macro |
| 74 | hi def link swigContract swigExceptionHandling |
| 75 | hi def link swigExceptionHandling Exception |
| 76 | hi def link swigUserDef Function |
| 77 | |
| 78 | hi def link swigCMalloc Statement |
| 79 | hi def link swigCstring Type |
| 80 | hi def link swigCWstring Type |
| 81 | |
| 82 | hi def link swigCSharp swigOtherLanguageSpecific |
| 83 | hi def link swigJava swigOtherLanguageSpecific |
| 84 | hi def link swigGuile swigOtherLanguageSpecific |
| 85 | hi def link swigPHP swigOtherLanguageSpecific |
| 86 | hi def link swigPython swigOtherLanguageSpecific |
| 87 | hi def link swigRuby swigOtherLanguageSpecific |
| 88 | hi def link swigScilab swigOtherLanguageSpecific |
| 89 | hi def link swigOtherLanguageSpecific Special |
| 90 | |
| 91 | hi def link swigInsertSection PreProc |
| 92 | |
| 93 | hi def link swigVerbatimStartEnd Statement |
| 94 | hi def link swigVerbatimMacro Macro |
| 95 | |
| 96 | hi def link swigTypeMapVars SpecialChar |
| 97 | |
| 98 | let b:current_syntax = "swig" |
| 99 | " vim: ts=8 |