3 " Maintainer: Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com
4 " Credits: Preben 'Peppe' Guldberg <peppe-vim@wielders.org>
5 " Original author: Mario Eusebio
6 " Last Change: Wed Jan 13 11:12:34 CET 2010
7 " - 'global' and 'persistent' keyword are now recognized
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
17 syn keyword matlabStatement return
18 syn keyword matlabLabel case switch
19 syn keyword matlabConditional else elseif end if otherwise
20 syn keyword matlabRepeat do for while
21 " MT_ADDON - added exception-specific keywords
22 syn keyword matlabExceptions try catch
23 syn keyword matlabOO classdef properties events methods
25 syn keyword matlabTodo contained TODO
26 syn keyword matlabScope global persistent
28 " If you do not want these operators lit, uncommment them and the "hi link" below
29 syn match matlabArithmeticOperator "[-+]"
30 syn match matlabArithmeticOperator "\.\=[*/\\^]"
31 syn match matlabRelationalOperator "[=~]="
32 syn match matlabRelationalOperator "[<>]=\="
33 syn match matlabLogicalOperator "[&|~]"
35 syn match matlabLineContinuation "\.\{3}"
37 "syn match matlabIdentifier "\<\a\w*\>"
40 " MT_ADDON - added 'skip' in order to deal with 'tic' escaping sequence
41 syn region matlabString start=+'+ end=+'+ oneline skip=+''+
43 " If you don't like tabs
44 syn match matlabTab "\t"
47 syn match matlabNumber "\<\d\+[ij]\=\>"
48 " floating point number, with dot, optional exponent
49 syn match matlabFloat "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>"
50 " floating point number, starting with a dot, optional exponent
51 syn match matlabFloat "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>"
53 " Transpose character and delimiters: Either use just [...] or (...) aswell
54 syn match matlabDelimiter "[][]"
55 "syn match matlabDelimiter "[][()]"
56 syn match matlabTransposeOperator "[])a-zA-Z0-9.]'"lc=1
58 syn match matlabSemicolon ";"
60 syn match matlabComment "%.*$" contains=matlabTodo,matlabTab
61 " MT_ADDON - correctly highlights words after '...' as comments
62 syn match matlabComment "\.\.\..*$" contains=matlabTodo,matlabTab
63 syn region matlabMultilineComment start=+%{+ end=+%}+ contains=matlabTodo,matlabTab
65 syn keyword matlabOperator break zeros default margin round ones rand
66 syn keyword matlabOperator ceil floor size clear zeros eye mean std cov
68 syn keyword matlabFunction error eval function
70 syn keyword matlabImplicit abs acos atan asin cos cosh exp log prod sum
71 syn keyword matlabImplicit log10 max min sign sin sqrt tan reshape
73 syn match matlabError "-\=\<\d\+\.\d\+\.[^*/\\^]"
74 syn match matlabError "-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)"
76 " Define the default highlighting.
77 " For version 5.7 and earlier: only when not done already
78 " For version 5.8 and later: only when an item doesn't have highlighting yet
79 if version >= 508 || !exists("did_matlab_syntax_inits")
81 let did_matlab_syntax_inits = 1
82 command -nargs=+ HiLink hi link <args>
84 command -nargs=+ HiLink hi def link <args>
87 HiLink matlabTransposeOperator matlabOperator
88 HiLink matlabOperator Operator
89 HiLink matlabLineContinuation Special
90 HiLink matlabLabel Label
91 HiLink matlabConditional Conditional
92 HiLink matlabExceptions Conditional
93 HiLink matlabRepeat Repeat
94 HiLink matlabTodo Todo
95 HiLink matlabString String
96 HiLink matlabDelimiter Identifier
97 HiLink matlabTransposeOther Identifier
98 HiLink matlabNumber Number
99 HiLink matlabFloat Float
100 HiLink matlabFunction Function
101 HiLink matlabError Error
102 HiLink matlabImplicit matlabStatement
103 HiLink matlabStatement Statement
104 HiLink matlabOO Statement
105 HiLink matlabSemicolon SpecialChar
106 HiLink matlabComment Comment
107 HiLink matlabMultilineComment Comment
108 HiLink matlabScope Type
110 HiLink matlabArithmeticOperator matlabOperator
111 HiLink matlabRelationalOperator matlabOperator
112 HiLink matlabLogicalOperator matlabOperator
114 "optional highlighting
115 "HiLink matlabIdentifier Identifier
116 "HiLink matlabTab Error
121 let b:current_syntax = "matlab"
123 "EOF vim: ts=8 noet tw=100 sw=8 sts=0