xref: /vim-8.2.3635/runtime/syntax/ampl.vim (revision f37506f6)
1" Language:     ampl (A Mathematical Programming Language)
2" Maintainer:   Krief David <[email protected]> or <[email protected]>
3" Last Change:  2003 May 11
4
5
6" quit when a syntax file was already loaded
7if exists("b:current_syntax")
8 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
117
118" The default methods for highlighting. Can be overridden later.
119hi def link amplEntityKeyword	Keyword
120hi def link amplType		Type
121hi def link amplStatement		Statement
122hi def link amplOperators		Operator
123hi def link amplBasicOperators	Operator
124hi def link amplConditional	Conditional
125hi def link amplRepeat		Repeat
126hi def link amplStrings		String
127hi def link amplNumerics		Number
128hi def link amplSetFunction	Function
129hi def link amplBuiltInFunction	Function
130hi def link amplRandomGenerator	Function
131hi def link amplComment		Comment
132hi def link amplDotSuffix		Special
133hi def link amplPiecewise		Special
134
135
136let b:current_syntax = "ampl"
137
138" vim: ts=8
139
140
141