Tue Apr 5 05:10:40 2011, original submission:
Mirko Maischberger writes, on Wed, 7 Nov 2007 16:33:21 +0100:
Hi,
first of all thank you, (and all other authors) for lstlisting package.
I'm writing some slides about AMPL language, one of the most widely
used languages for matematical programming, so I wrote the following
language definition for my personal use, but feel like it could be useful
to (a few) others.
One drawback is that the "subject to" declaration will not be colored, but
luckily there are two synonyms: subjto and s.t. to use in place of the
extended (and spaced) form.
I'll be pleased to see it included in the release, feel free to apply the
license you with.
Mirko maischberger
%%
%% AMPL definition (c) 2007 Mirko Maischberger
%%
\lstdefinelanguage{AMPL}{
alsoletter={.},%
morekeywords={Current,IN,INOUT,Infinity,Initial,LOCAL,OUT,all,binary,%
by,check,complements,contains,default,dimen,div,else,environ,exists,%
forall,if,in,integer,less,logical,max,min,option,setof,shell_exitcode,%
slve_exitcode,solve_message,solve_result,solve_result_num,suffix,sum,%
symbolic,table,then,union,until,while,within,from,to,obj,%
cross,diff,symdiff,inter,%
and,not,or,prod,product},%keywords
morekeywords=[2]{abs,acos,acosh,alias,asin,asinh,atan,atan2,atanh,ceil,%
ctime,cos,exp,floor,log,log10,max,min,precision,round,sin,sinh,sqrt,tan,%
tanh,time,trunc,%
Beta,Cauchy,Exponential,Gamma,Irand224,Normal,Normal101,Poisson,%
Uniform,Uniform01,%
num,num0,ichar,char,length,substr,sprintf,match,sub,gsub,%
card,next,nextw,prev,prevw,first,last,member,ord,ord0,arity,indexarity,%
interval,integer,ordered,circular,coeff,cover},%functions
morekeywords=[3]{set,param,var,arc,minimize,maximize,subject to,%
node,subjto,s.t.},%declarations
morekeywords=[4]{call,cd,check,close,commands,data,delete,display,drop,end,%
environ,exit,expand,fix,include,let,load,model,objective,option,print,%
printf,problem,purge,quit,read,read table,redeclare,reload,remove,reset,%
restore,shell,show,solexpand,solution,solve,update,unfix,unload,write,%
write table,xref},%commands
sensitive=true,%
morecomment=[s]{/}{/},%
morecomment=[l]\#,%
morestring=[d]",%
morestring=[d]'%
}[keywords,comments,strings]%
|