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
8 elseif exists("b:current_syntax")
16 syn match amplEntityKeyword "\(subject to\)\|\(subj to\)\|\(s\.t\.\)"
17 syn keyword amplEntityKeyword minimize maximize objective
19 syn keyword amplEntityKeyword coeff coef cover obj default
20 syn keyword amplEntityKeyword from to to_come net_in net_out
21 syn keyword amplEntityKeyword dimen dimension
26 syn keyword amplType integer binary set param var
27 syn keyword amplType node ordered circular reversed symbolic
28 syn keyword amplType arc
33 syn keyword amplStatement check close \display drop include
34 syn keyword amplStatement print printf quit reset restore
35 syn keyword amplStatement solve update write shell model
36 syn keyword amplStatement data option let solution fix
37 syn keyword amplStatement unfix end function pipe format
42 syn keyword amplConditional if then else and or
43 syn keyword amplConditional exists forall in not within
48 syn keyword amplRepeat while repeat for
53 syn keyword amplOperators union diff difference symdiff sum
54 syn keyword amplOperators inter intersect intersection cross setof
55 syn keyword amplOperators by less mod div product
56 "syn keyword amplOperators min max
57 "conflict between functions max, min and operators max, min
59 syn match amplBasicOperators "||\|<=\|==\|\^\|<\|=\|!\|-\|\.\.\|:="
60 syn match amplBasicOperators "&&\|>=\|!=\|\*\|>\|:\|/\|+\|\*\*"
66 syn match amplComment "\#.*"
67 syn region amplComment start=+\/\*+ end=+\*\/+
69 syn region amplStrings start=+\'+ skip=+\\'+ end=+\'+
70 syn region amplStrings start=+\"+ skip=+\\"+ end=+\"+
72 syn match amplNumerics "[+-]\=\<\d\+\(\.\d\+\)\=\([dDeE][-+]\=\d\+\)\=\>"
73 syn match amplNumerics "[+-]\=Infinity"
77 syn keyword amplSetFunction card next nextw prev prevw
78 syn keyword amplSetFunction first last member ord ord0
80 syn keyword amplBuiltInFunction abs acos acosh alias asin
81 syn keyword amplBuiltInFunction asinh atan atan2 atanh ceil
82 syn keyword amplBuiltInFunction cos exp floor log log10
83 syn keyword amplBuiltInFunction max min precision round sin
84 syn keyword amplBuiltInFunction sinh sqrt tan tanh trunc
86 syn keyword amplRandomGenerator Beta Cauchy Exponential Gamma Irand224
87 syn keyword amplRandomGenerator Normal Poisson Uniform Uniform01
91 "-- to highlight the 'dot-suffixes'
92 syn match amplDotSuffix "\h\w*\.\(lb\|ub\)"hs=e-2
93 syn match amplDotSuffix "\h\w*\.\(lb0\|lb1\|lb2\|lrc\|ub0\)"hs=e-3
94 syn match amplDotSuffix "\h\w*\.\(ub1\|ub2\|urc\|val\|lbs\|ubs\)"hs=e-3
95 syn match amplDotSuffix "\h\w*\.\(init\|body\|dinit\|dual\)"hs=e-4
96 syn match amplDotSuffix "\h\w*\.\(init0\|ldual\|slack\|udual\)"hs=e-5
97 syn match amplDotSuffix "\h\w*\.\(lslack\|uslack\|dinit0\)"hs=e-6
102 syn match amplPiecewise "<<\|>>"
107 syn keyword amplTodo contained TODO FIXME XXX
118 if version >= 508 || !exists("did_ampl_syntax_inits")
120 let did_ampl_syntax_inits = 1
121 command -nargs=+ HiLink hi link <args>
123 command -nargs=+ HiLink hi def link <args>
126 " The default methods for highlighting. Can be overridden later.
127 HiLink amplEntityKeyword Keyword
129 HiLink amplStatement Statement
130 HiLink amplOperators Operator
131 HiLink amplBasicOperators Operator
132 HiLink amplConditional Conditional
133 HiLink amplRepeat Repeat
134 HiLink amplStrings String
135 HiLink amplNumerics Number
136 HiLink amplSetFunction Function
137 HiLink amplBuiltInFunction Function
138 HiLink amplRandomGenerator Function
139 HiLink amplComment Comment
140 HiLink amplDotSuffix Special
141 HiLink amplPiecewise Special
146 let b:current_syntax = "ampl"