Merge branch 'vim-with-runtime' into feat/quickfix-title
[vim_extended.git] / runtime / syntax / ampl.vim
blob7f4dfa99421506f4b6e7245edc3612b586294f46
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
6 if version < 600
7  syntax clear
8 elseif exists("b:current_syntax")
9  finish
10 endif
15 "--
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
25 "--
26 syn keyword amplType              integer    binary    set          param     var
27 syn keyword amplType              node       ordered   circular     reversed  symbolic
28 syn keyword amplType              arc
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
41 "--
42 syn keyword amplConditional       if         then      else         and       or
43 syn keyword amplConditional       exists     forall    in           not       within
47 "--
48 syn keyword amplRepeat            while      repeat    for
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
59 syn match   amplBasicOperators    "||\|<=\|==\|\^\|<\|=\|!\|-\|\.\.\|:="
60 syn match   amplBasicOperators    "&&\|>=\|!=\|\*\|>\|:\|/\|+\|\*\*"
65 "--
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"
76 "--
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       "<<\|>>"
106 "-- Todo.
107 syn keyword amplTodo contained   TODO FIXME XXX
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
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
143   delcommand HiLink
144 endif
146 let b:current_syntax = "ampl"
148 " vim: ts=8