Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: MEL (Maya Extension Language) |
| 3 | " Maintainer: Robert Minsk <egbert@centropolisfx.com> |
| 4 | " Last Change: May 27 1999 |
| 5 | " Based on: Bram Moolenaar <Bram@vim.org> 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 |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | " when wanted, highlight trailing white space and spaces before tabs |
| 16 | if exists("mel_space_errors") |
| 17 | sy match melSpaceError "\s\+$" |
| 18 | sy match melSpaceError " \+\t"me=e-1 |
| 19 | endif |
| 20 | |
| 21 | " A bunch of usefull MEL keyworks |
| 22 | sy keyword melBoolean true false yes no on off |
| 23 | |
| 24 | sy keyword melFunction proc |
| 25 | sy match melIdentifier "\$\(\a\|_\)\w*" |
| 26 | |
| 27 | sy keyword melStatement break continue return |
| 28 | sy keyword melConditional if else switch |
| 29 | sy keyword melRepeat while for do in |
| 30 | sy keyword melLabel case default |
| 31 | sy keyword melOperator size eval env exists whatIs |
| 32 | sy keyword melKeyword alias |
| 33 | sy keyword melException catch error warning |
| 34 | |
| 35 | sy keyword melInclude source |
| 36 | |
| 37 | sy keyword melType int float string vector matrix |
| 38 | sy keyword melStorageClass global |
| 39 | |
| 40 | sy keyword melDebug trace |
| 41 | |
| 42 | sy keyword melTodo contained TODO FIXME XXX |
| 43 | |
| 44 | " MEL data types |
| 45 | sy match melCharSpecial contained "\\[ntr\\"]" |
| 46 | sy match melCharError contained "\\[^ntr\\"]" |
| 47 | |
| 48 | sy region melString start=+"+ skip=+\\"+ end=+"+ contains=melCharSpecial,melCharError |
| 49 | |
| 50 | sy case ignore |
| 51 | sy match melInteger "\<\d\+\(e[-+]\=\d\+\)\=\>" |
| 52 | sy match melFloat "\<\d\+\(e[-+]\=\d\+\)\=f\>" |
| 53 | sy match melFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=f\=\>" |
| 54 | sy match melFloat "\.\d\+\(e[-+]\=\d\+\)\=f\=\>" |
| 55 | sy case match |
| 56 | |
| 57 | sy match melCommaSemi contained "[,;]" |
| 58 | sy region melMatrixVector start=/<</ end=/>>/ contains=melInteger,melFloat,melIdentifier,melCommaSemi |
| 59 | |
| 60 | sy cluster melGroup contains=melFunction,melStatement,melConditional,melLabel,melKeyword,melStorageClass,melTODO,melCharSpecial,melCharError,melCommaSemi |
| 61 | |
| 62 | " catch errors caused by wrong parenthesis |
| 63 | sy region melParen transparent start='(' end=')' contains=ALLBUT,@melGroup,melParenError,melInParen |
| 64 | sy match melParenError ")" |
| 65 | sy match melInParen contained "[{}]" |
| 66 | |
| 67 | " comments |
| 68 | sy region melComment start="/\*" end="\*/" contains=melTodo,melSpaceError |
| 69 | sy match melComment "//.*" contains=melTodo,melSpaceError |
| 70 | sy match melCommentError "\*/" |
| 71 | |
| 72 | sy region melQuestionColon matchgroup=melConditional transparent start='?' end=':' contains=ALLBUT,@melGroup |
| 73 | |
| 74 | if !exists("mel_minlines") |
| 75 | let mel_minlines=15 |
| 76 | endif |
| 77 | exec "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 |
| 82 | if 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 |
| 119 | endif |
| 120 | |
| 121 | let b:current_syntax = "mel" |