Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " |
| 2 | " Vim syntax file |
| 3 | " Language : Scilab |
| 4 | " Maintainer : Benoit Hamelin |
| 5 | " File type : *.sci (see :help filetype) |
| 6 | " History |
| 7 | " 28jan2002 benoith 0.1 Creation. Adapted from matlab.vim. |
| 8 | " 04feb2002 benoith 0.5 Fixed bugs with constant highlighting. |
| 9 | " |
| 10 | |
| 11 | |
| 12 | " For version 5.x: Clear all syntax items |
| 13 | " For version 6.x: Quit when a syntax file was already loaded |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | |
| 20 | |
| 21 | " Reserved words. |
| 22 | syn keyword scilabStatement abort clear clearglobal end exit global mode predef quit resume |
| 23 | syn keyword scilabStatement return |
| 24 | syn keyword scilabFunction function endfunction funptr |
| 25 | syn keyword scilabPredicate null iserror isglobal |
| 26 | syn keyword scilabKeyword typename |
| 27 | syn keyword scilabDebug debug pause what where whereami whereis who whos |
| 28 | syn keyword scilabRepeat for while break |
| 29 | syn keyword scilabConditional if then else elseif |
| 30 | syn keyword scilabMultiplex select case |
| 31 | |
| 32 | " Reserved constants. |
| 33 | syn match scilabConstant "\(%\)[0-9A-Za-z?!#$]\+" |
| 34 | syn match scilabBoolean "\(%\)[FTft]\>" |
| 35 | |
| 36 | " Delimiters and operators. |
| 37 | syn match scilabDelimiter "[][;,()]" |
| 38 | syn match scilabComparison "[=~]=" |
| 39 | syn match scilabComparison "[<>]=\=" |
| 40 | syn match scilabComparison "<>" |
| 41 | syn match scilabLogical "[&|~]" |
| 42 | syn match scilabAssignment "=" |
| 43 | syn match scilabArithmetic "[+-]" |
| 44 | syn match scilabArithmetic "\.\=[*/\\]\.\=" |
| 45 | syn match scilabArithmetic "\.\=^" |
| 46 | syn match scilabRange ":" |
| 47 | syn match scilabMlistAccess "\." |
| 48 | |
| 49 | syn match scilabLineContinuation "\.\{2,}" |
| 50 | |
| 51 | syn match scilabTransposition "[])a-zA-Z0-9?!_#$.]'"lc=1 |
| 52 | |
| 53 | " Comments and tools. |
| 54 | syn keyword scilabTodo TODO todo FIXME fixme TBD tbd contained |
| 55 | syn match scilabComment "//.*$" contains=scilabTodo |
| 56 | |
| 57 | " Constants. |
| 58 | syn match scilabNumber "[0-9]\+\(\.[0-9]*\)\=\([DEde][+-]\=[0-9]\+\)\=" |
| 59 | syn match scilabNumber "\.[0-9]\+\([DEde][+-]\=[0-9]\+\)\=" |
| 60 | syn region scilabString start=+'+ skip=+''+ end=+'+ oneline |
| 61 | syn region scilabString start=+"+ end=+"+ oneline |
| 62 | |
| 63 | " Identifiers. |
| 64 | syn match scilabIdentifier "\<[A-Za-z?!_#$][A-Za-z0-9?!_#$]*\>" |
| 65 | syn match scilabOverload "%[A-Za-z0-9?!_#$]\+_[A-Za-z0-9?!_#$]\+" |
| 66 | |
| 67 | |
| 68 | " Define the default highlighting. |
| 69 | " For version 5.7 and earlier: only when not done already |
| 70 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 71 | if version >= 508 || !exists("did_scilab_syntax_inits") |
| 72 | if version < 508 |
| 73 | let did_scilab_syntax_inits = 1 |
| 74 | command -nargs=+ HiLink hi link <args> |
| 75 | else |
| 76 | command -nargs=+ HiLink hi def link <args> |
| 77 | endif |
| 78 | |
| 79 | HiLink scilabStatement Statement |
| 80 | HiLink scilabFunction Keyword |
| 81 | HiLink scilabPredicate Keyword |
| 82 | HiLink scilabKeyword Keyword |
| 83 | HiLink scilabDebug Debug |
| 84 | HiLink scilabRepeat Repeat |
| 85 | HiLink scilabConditional Conditional |
| 86 | HiLink scilabMultiplex Conditional |
| 87 | |
| 88 | HiLink scilabConstant Constant |
| 89 | HiLink scilabBoolean Boolean |
| 90 | |
| 91 | HiLink scilabDelimiter Delimiter |
| 92 | HiLink scilabMlistAccess Delimiter |
| 93 | HiLink scilabComparison Operator |
| 94 | HiLink scilabLogical Operator |
| 95 | HiLink scilabAssignment Operator |
| 96 | HiLink scilabArithmetic Operator |
| 97 | HiLink scilabRange Operator |
| 98 | HiLink scilabLineContinuation Underlined |
| 99 | HiLink scilabTransposition Operator |
| 100 | |
| 101 | HiLink scilabTodo Todo |
| 102 | HiLink scilabComment Comment |
| 103 | |
| 104 | HiLink scilabNumber Number |
| 105 | HiLink scilabString String |
| 106 | |
| 107 | HiLink scilabIdentifier Identifier |
| 108 | HiLink scilabOverload Special |
| 109 | |
| 110 | delcommand HiLink |
| 111 | endif |
| 112 | |
| 113 | let b:current_syntax = "scilab" |
| 114 | |
| 115 | "EOF vim: ts=4 noet tw=100 sw=4 sts=0 |