ampl.vim (4108B)
1 " Language: ampl (A Mathematical Programming Language) 2 " Maintainer: Krief David <david.krief@etu.enseeiht.fr> or <david_krief@hotmail.com> 3 " Last Change: 2003 May 11 4 5 6 " quit when a syntax file was already loaded 7 if exists("b:current_syntax") 8 finish 9 endif 10 11 12 13 14 "-- 15 syn match amplEntityKeyword "\(subject to\)\|\(subj to\)\|\(s\.t\.\)" 16 syn keyword amplEntityKeyword minimize maximize objective 17 18 syn keyword amplEntityKeyword coeff coef cover obj default 19 syn keyword amplEntityKeyword from to to_come net_in net_out 20 syn keyword amplEntityKeyword dimen dimension 21 22 23 24 "-- 25 syn keyword amplType integer binary set param var 26 syn keyword amplType node ordered circular reversed symbolic 27 syn keyword amplType arc 28 29 30 31 "-- 32 syn keyword amplStatement check close \display drop include 33 syn keyword amplStatement print printf quit reset restore 34 syn keyword amplStatement solve update write shell model 35 syn keyword amplStatement data option let solution fix 36 syn keyword amplStatement unfix end function pipe format 37 38 39 40 "-- 41 syn keyword amplConditional if then else and or 42 syn keyword amplConditional exists forall in not within 43 44 45 46 "-- 47 syn keyword amplRepeat while repeat for 48 49 50 51 "-- 52 syn keyword amplOperators union diff difference symdiff sum 53 syn keyword amplOperators inter intersect intersection cross setof 54 syn keyword amplOperators by less mod div product 55 "syn keyword amplOperators min max 56 "conflict between functions max, min and operators max, min 57 58 syn match amplBasicOperators "||\|<=\|==\|\^\|<\|=\|!\|-\|\.\.\|:=" 59 syn match amplBasicOperators "&&\|>=\|!=\|\*\|>\|:\|/\|+\|\*\*" 60 61 62 63 64 "-- 65 syn match amplComment "\#.*" 66 syn region amplComment start=+\/\*+ end=+\*\/+ 67 68 syn region amplStrings start=+\'+ skip=+\\'+ end=+\'+ 69 syn region amplStrings start=+\"+ skip=+\\"+ end=+\"+ 70 71 syn match amplNumerics "[+-]\=\<\d\+\(\.\d\+\)\=\([dDeE][-+]\=\d\+\)\=\>" 72 syn match amplNumerics "[+-]\=Infinity" 73 74 75 "-- 76 syn keyword amplSetFunction card next nextw prev prevw 77 syn keyword amplSetFunction first last member ord ord0 78 79 syn keyword amplBuiltInFunction abs acos acosh alias asin 80 syn keyword amplBuiltInFunction asinh atan atan2 atanh ceil 81 syn keyword amplBuiltInFunction cos exp floor log log10 82 syn keyword amplBuiltInFunction max min precision round sin 83 syn keyword amplBuiltInFunction sinh sqrt tan tanh trunc 84 85 syn keyword amplRandomGenerator Beta Cauchy Exponential Gamma Irand224 86 syn keyword amplRandomGenerator Normal Poisson Uniform Uniform01 87 88 89 90 "-- to highlight the 'dot-suffixes' 91 syn match amplDotSuffix "\h\w*\.\(lb\|ub\)"hs=e-2 92 syn match amplDotSuffix "\h\w*\.\(lb0\|lb1\|lb2\|lrc\|ub0\)"hs=e-3 93 syn match amplDotSuffix "\h\w*\.\(ub1\|ub2\|urc\|val\|lbs\|ubs\)"hs=e-3 94 syn match amplDotSuffix "\h\w*\.\(init\|body\|dinit\|dual\)"hs=e-4 95 syn match amplDotSuffix "\h\w*\.\(init0\|ldual\|slack\|udual\)"hs=e-5 96 syn match amplDotSuffix "\h\w*\.\(lslack\|uslack\|dinit0\)"hs=e-6 97 98 99 100 "-- 101 syn match amplPiecewise "<<\|>>" 102 103 104 105 "-- Todo. 106 syn keyword amplTodo contained TODO FIXME XXX 107 108 109 110 111 112 113 114 115 116 117 118 " The default methods for highlighting. Can be overridden later. 119 hi def link amplEntityKeyword Keyword 120 hi def link amplType Type 121 hi def link amplStatement Statement 122 hi def link amplOperators Operator 123 hi def link amplBasicOperators Operator 124 hi def link amplConditional Conditional 125 hi def link amplRepeat Repeat 126 hi def link amplStrings String 127 hi def link amplNumerics Number 128 hi def link amplSetFunction Function 129 hi def link amplBuiltInFunction Function 130 hi def link amplRandomGenerator Function 131 hi def link amplComment Comment 132 hi def link amplDotSuffix Special 133 hi def link amplPiecewise Special 134 135 136 let b:current_syntax = "ampl" 137 138 " vim: ts=8