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