comparison runtime/syntax/matlab.vim @ 0:76efa0be13f1

Initial revision
author atsuki
date Sat, 10 Nov 2007 15:07:22 +0900
parents
children c16898406ff2
comparison
equal deleted inserted replaced
-1:000000000000 0:76efa0be13f1
1 " Vim syntax file
2 " Language: Matlab
3 " Maintainer: Preben 'Peppe' Guldberg <peppe-vim@wielders.org>
4 " Original author: Mario Eusebio
5 " Last Change: 30 May 2003
6
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
9 if version < 600
10 syntax clear
11 elseif exists("b:current_syntax")
12 finish
13 endif
14
15 syn keyword matlabStatement return
16 syn keyword matlabLabel case switch
17 syn keyword matlabConditional else elseif end if otherwise
18 syn keyword matlabRepeat do for while
19
20 syn keyword matlabTodo contained TODO
21
22 " If you do not want these operators lit, uncommment them and the "hi link" below
23 syn match matlabArithmeticOperator "[-+]"
24 syn match matlabArithmeticOperator "\.\=[*/\\^]"
25 syn match matlabRelationalOperator "[=~]="
26 syn match matlabRelationalOperator "[<>]=\="
27 syn match matlabLogicalOperator "[&|~]"
28
29 syn match matlabLineContinuation "\.\{3}"
30
31 "syn match matlabIdentifier "\<\a\w*\>"
32
33 " String
34 syn region matlabString start=+'+ end=+'+ oneline
35
36 " If you don't like tabs
37 syn match matlabTab "\t"
38
39 " Standard numbers
40 syn match matlabNumber "\<\d\+[ij]\=\>"
41 " floating point number, with dot, optional exponent
42 syn match matlabFloat "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>"
43 " floating point number, starting with a dot, optional exponent
44 syn match matlabFloat "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>"
45
46 " Transpose character and delimiters: Either use just [...] or (...) aswell
47 syn match matlabDelimiter "[][]"
48 "syn match matlabDelimiter "[][()]"
49 syn match matlabTransposeOperator "[])a-zA-Z0-9.]'"lc=1
50
51 syn match matlabSemicolon ";"
52
53 syn match matlabComment "%.*$" contains=matlabTodo,matlabTab
54
55 syn keyword matlabOperator break zeros default margin round ones rand
56 syn keyword matlabOperator ceil floor size clear zeros eye mean std cov
57
58 syn keyword matlabFunction error eval function
59
60 syn keyword matlabImplicit abs acos atan asin cos cosh exp log prod sum
61 syn keyword matlabImplicit log10 max min sign sin sqrt tan reshape
62
63 syn match matlabError "-\=\<\d\+\.\d\+\.[^*/\\^]"
64 syn match matlabError "-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)"
65
66 " Define the default highlighting.
67 " For version 5.7 and earlier: only when not done already
68 " For version 5.8 and later: only when an item doesn't have highlighting yet
69 if version >= 508 || !exists("did_matlab_syntax_inits")
70 if version < 508
71 let did_matlab_syntax_inits = 1
72 command -nargs=+ HiLink hi link <args>
73 else
74 command -nargs=+ HiLink hi def link <args>
75 endif
76
77 HiLink matlabTransposeOperator matlabOperator
78 HiLink matlabOperator Operator
79 HiLink matlabLineContinuation Special
80 HiLink matlabLabel Label
81 HiLink matlabConditional Conditional
82 HiLink matlabRepeat Repeat
83 HiLink matlabTodo Todo
84 HiLink matlabString String
85 HiLink matlabDelimiter Identifier
86 HiLink matlabTransposeOther Identifier
87 HiLink matlabNumber Number
88 HiLink matlabFloat Float
89 HiLink matlabFunction Function
90 HiLink matlabError Error
91 HiLink matlabImplicit matlabStatement
92 HiLink matlabStatement Statement
93 HiLink matlabSemicolon SpecialChar
94 HiLink matlabComment Comment
95
96 HiLink matlabArithmeticOperator matlabOperator
97 HiLink matlabRelationalOperator matlabOperator
98 HiLink matlabLogicalOperator matlabOperator
99
100 "optional highlighting
101 "HiLink matlabIdentifier Identifier
102 "HiLink matlabTab Error
103
104 delcommand HiLink
105 endif
106
107 let b:current_syntax = "matlab"
108
109 "EOF vim: ts=8 noet tw=100 sw=8 sts=0