xref: /vim-8.2.3635/runtime/syntax/mel.vim (revision cb03397a)
1" Vim syntax file
2" Language:	MEL (Maya Extension Language)
3" Maintainer:	Robert Minsk <[email protected]>
4" Last Change:	May 27 1999
5" Based on:	Bram Moolenaar <[email protected]> C syntax file
6
7" For version 5.x: Clear all syntax items
8" For version 6.x: Quit when a syntax file was already loaded
9if version < 600
10  syntax clear
11elseif exists("b:current_syntax")
12  finish
13endif
14
15" when wanted, highlight trailing white space and spaces before tabs
16if exists("mel_space_errors")
17  sy match	melSpaceError	"\s\+$"
18  sy match	melSpaceError	" \+\t"me=e-1
19endif
20
21" A bunch of usefull MEL keyworks
22sy keyword	melBoolean	true false yes no on off
23
24sy keyword	melFunction	proc
25sy match	melIdentifier	"\$\(\a\|_\)\w*"
26
27sy keyword	melStatement	break continue return
28sy keyword	melConditional	if else switch
29sy keyword	melRepeat	while for do in
30sy keyword	melLabel	case default
31sy keyword	melOperator	size eval env exists whatIs
32sy keyword	melKeyword	alias
33sy keyword	melException	catch error warning
34
35sy keyword	melInclude	source
36
37sy keyword	melType		int float string vector matrix
38sy keyword	melStorageClass	global
39
40sy keyword	melDebug	trace
41
42sy keyword	melTodo		contained TODO FIXME XXX
43
44" MEL data types
45sy match	melCharSpecial	contained "\\[ntr\\"]"
46sy match	melCharError	contained "\\[^ntr\\"]"
47
48sy region	melString	start=+"+ skip=+\\"+ end=+"+ contains=melCharSpecial,melCharError
49
50sy case ignore
51sy match	melInteger	"\<\d\+\(e[-+]\=\d\+\)\=\>"
52sy match	melFloat	"\<\d\+\(e[-+]\=\d\+\)\=f\>"
53sy match	melFloat	"\<\d\+\.\d*\(e[-+]\=\d\+\)\=f\=\>"
54sy match	melFloat	"\.\d\+\(e[-+]\=\d\+\)\=f\=\>"
55sy case match
56
57sy match	melCommaSemi	contained "[,;]"
58sy region	melMatrixVector	start=/<</ end=/>>/ contains=melInteger,melFloat,melIdentifier,melCommaSemi
59
60sy cluster	melGroup	contains=melFunction,melStatement,melConditional,melLabel,melKeyword,melStorageClass,melTODO,melCharSpecial,melCharError,melCommaSemi
61
62" catch errors caused by wrong parenthesis
63sy region	melParen	transparent start='(' end=')' contains=ALLBUT,@melGroup,melParenError,melInParen
64sy match	melParenError	")"
65sy match	melInParen	contained "[{}]"
66
67" comments
68sy region	melComment	start="/\*" end="\*/" contains=melTodo,melSpaceError
69sy match	melComment	"//.*" contains=melTodo,melSpaceError
70sy match	melCommentError "\*/"
71
72sy region	melQuestionColon matchgroup=melConditional transparent start='?' end=':' contains=ALLBUT,@melGroup
73
74if !exists("mel_minlines")
75  let mel_minlines=15
76endif
77exec "sy sync ccomment melComment minlines=" . mel_minlines
78
79" Define the default highlighting.
80" For version 5.7 and earlier: only when not done already
81" For version 5.8 and later: only when an item doesn't have highlighting yet
82if version >= 508 || !exists("did_mel_syntax_inits")
83  if version < 508
84    let did_mel_syntax_inits = 1
85    command -nargs=+ HiLink hi link <args>
86  else
87    command -nargs=+ HiLink hi def link <args>
88  endif
89
90  HiLink melBoolean	Boolean
91  HiLink melFunction	Function
92  HiLink melIdentifier	Identifier
93  HiLink melStatement	Statement
94  HiLink melConditional Conditional
95  HiLink melRepeat	Repeat
96  HiLink melLabel	Label
97  HiLink melOperator	Operator
98  HiLink melKeyword	Keyword
99  HiLink melException	Exception
100  HiLink melInclude	Include
101  HiLink melType	Type
102  HiLink melStorageClass StorageClass
103  HiLink melDebug	Debug
104  HiLink melTodo	Todo
105  HiLink melCharSpecial SpecialChar
106  HiLink melString	String
107  HiLink melInteger	Number
108  HiLink melFloat	Float
109  HiLink melMatrixVector Float
110  HiLink melComment	Comment
111  HiLink melError	Error
112  HiLink melSpaceError	melError
113  HiLink melCharError	melError
114  HiLink melParenError	melError
115  HiLink melInParen	melError
116  HiLink melCommentError melError
117
118  delcommand HiLink
119endif
120
121let b:current_syntax = "mel"
122