comparison runtime/syntax/ampl.vim @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children 43efa4f5a8ea
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
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 if version < 600
7 syntax clear
8 elseif exists("b:current_syntax")
9 finish
10 endif
11
12
13
14
15 "--
16 syn match amplEntityKeyword "\(subject to\)\|\(subj to\)\|\(s\.t\.\)"
17 syn keyword amplEntityKeyword minimize maximize objective
18
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
22
23
24
25 "--
26 syn keyword amplType integer binary set param var
27 syn keyword amplType node ordered circular reversed symbolic
28 syn keyword amplType arc
29
30
31
32 "--
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
38
39
40
41 "--
42 syn keyword amplConditional if then else and or
43 syn keyword amplConditional exists forall in not within
44
45
46
47 "--
48 syn keyword amplRepeat while repeat for
49
50
51
52 "--
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
58
59 syn match amplBasicOperators "||\|<=\|==\|\^\|<\|=\|!\|-\|\.\.\|:="
60 syn match amplBasicOperators "&&\|>=\|!=\|\*\|>\|:\|/\|+\|\*\*"
61
62
63
64
65 "--
66 syn match amplComment "\#.*"
67 syn region amplComment start=+\/\*+ end=+\*\/+
68
69 syn region amplStrings start=+\'+ skip=+\\'+ end=+\'+
70 syn region amplStrings start=+\"+ skip=+\\"+ end=+\"+
71
72 syn match amplNumerics "[+-]\=\<\d\+\(\.\d\+\)\=\([dDeE][-+]\=\d\+\)\=\>"
73 syn match amplNumerics "[+-]\=Infinity"
74
75
76 "--
77 syn keyword amplSetFunction card next nextw prev prevw
78 syn keyword amplSetFunction first last member ord ord0
79
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
85
86 syn keyword amplRandomGenerator Beta Cauchy Exponential Gamma Irand224
87 syn keyword amplRandomGenerator Normal Poisson Uniform Uniform01
88
89
90
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
98
99
100
101 "--
102 syn match amplPiecewise "<<\|>>"
103
104
105
106 "-- Todo.
107 syn keyword amplTodo contained TODO FIXME XXX
108
109
110
111
112
113
114
115
116
117
118 if version >= 508 || !exists("did_ampl_syntax_inits")
119 if version < 508
120 let did_ampl_syntax_inits = 1
121 command -nargs=+ HiLink hi link <args>
122 else
123 command -nargs=+ HiLink hi def link <args>
124 endif
125
126 " The default methods for highlighting. Can be overridden later.
127 HiLink amplEntityKeyword Keyword
128 HiLink amplType Type
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
142
143 delcommand HiLink
144 endif
145
146 let b:current_syntax = "ampl"
147
148 " vim: ts=8
149
150