code: function tokenChain(stream,state,chain,style,tail){	// NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
  		state.chain=null;                               //                                                          12   3tail
  		state.style=null;
  		state.tail=null;
  		state.tokenize=function(stream,state){
  			var e=false,c,i=0;
  			while(c=stream.next()){
  				if(c===chain[i]&&!e){
  					if(chain[++i]!==undefined){
  						state.chain=chain[i];
  						state.style=style;
  						state.tail=tail}
  					else if(tail)
  						stream.eatWhile(tail);
  					state.tokenize=tokenPerl;
  					return style}
  				e=!e&&c=="\\"}
  			return style};
  		return state.tokenize(stream,state)}
docs: NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type