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