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