\lstdefinelanguage{OCaml}{
  keywords={assert,asr,class,closed,constraint,external,false,%
    functor,include,inherit,land,lazy,lor,lsl,lsr,lxor,method,mod,%
    module,new,open,parser,private,sig,struct,true,val,virtual,when,%
    object,ref,% TH
    and,as,begin,do,done,downto,else,end,exception,for,%
    fun,function,if,in,let,match,mutable,not,of,or,prefix,rec,then,%
    to,try,type,value,where,while,with,\},\{,%
    int,string,unit,float,bool,%
    rule,parse,%Ocamllex
    \%token,\%start,\%type,\%left,\%right,\%nonassoc,\%\%,\%\{,\%\}%Ocamlyacc
  },%
  alsoletter={\%,\{,\}},%
  otherkeywords={!=,\#,\&,\&\&,+,+.,\,,-,-.,->,.,..,:,::,:=,:>,;,;;,<>,<,<-,=,>,>],>\},?,??,[,[<,[>,[|,],`,\{<,|,|],~,@,^,()},%
  sensitive,%
  morecomment=[n]{(*}{*)},%
  morecomment=[s]{/*}{*/},%
  morestring=[b]",%
  morestring=[b]',%
}[keywords,comments,strings]%


\lstdefinelanguage{OCamlII}{
  keywords={assert,asr,class,closed,constraint,external,false,%
    functor,include,inherit,land,lazy,lor,lsl,lsr,lxor,method,mod,%
    module,new,open,parser,private,sig,struct,true,val,virtual,when,%
    object,ref,% TH
    and,as,begin,do,done,downto,else,end,exception,for,%
    fun,function,if,in,let,match,mutable,not,of,or,prefix,rec,then,%
    to,try,type,value,where,while,with,\},\{,%
    int,string,unit,float,bool,%
    rule,parse,%Ocamllex
    \%token,\%start,\%type,\%left,\%right,\%nonassoc,\%\%,\%\{,\%\}%Ocamlyacc
  },%
  alsoletter={\%,\{,\},'},%
  otherkeywords={!=,\#,\&,\&\&,+,+.,\,,-,-.,->,.,..,:,::,:=,:>,;,;;,<>,<,<-,=,>,>],>\},?,??,[,[<,[>,[|,],`,\{<,|,|],~,@,^,()},%
  sensitive,%
  morecomment=[n]{(*}{*)},%
  morecomment=[s]{/*}{*/},%
  morestring=[b]",%
%%  morestring=[b]',%
}[keywords,comments,strings]%
