JS代码格式化和语法着色V2

2019-06-03 18:16:39王旭

else if(str.match(/[=(][ t]*//))
{      intNextQuote=i;      while(intNextQuote!=-
1&&intNextQuote<glbStr.length){       intNextQuote=glbStr.indexOf
("/",intNextQuote+1);       if(intNextQuote==-1||glbStr.charAt
(intNextQuote-1)!="")
break;       intCount=0; intTemp=intNextQuote;     &
nbsp; while(glbStr.charAt(--intTemp)=="")intCount++;       if
(intCount%2==0)break;      }      if(intNextQuote==-1)
break;      str+="<span class="regexp">"+htmlEncode
(glbStr.substring(i+1,intNextQuote))
+"</span>/";      i=intNextQuote;      
lastState="";     }
    lastState="";    break;    case&n
bsp;"{":     outputLn
(str);     str=" ";     seq=document.createElement
("div");     seq.className="indent";     curRe.
appendChild
(seq);     curRe=seq;     lastState="rn"; &nbs
p;   if(i-glbP>200)
{      glbP=i+1;      glbTimer=setTimeout
(core_analysis);      return;     }
   break;    case "}
":     outputLn(str.substring(0,str.length-
1));     str="}
 ";     lastState="";     curRe=curRe.parentNod
e;    break;    default:     if(c.match(/w/)
&&glbStr.charAt(i-1).match(/W/)){intWordStart=i;}     if(c.match(/W/)
&&glbStr.charAt(i-1).match(/w/)){      str=str.substring(0,str.length-htmlEncode
(c).length);      str=str.replace(regKW,clKW).replace(regObj,clObj).replace(regMP,clMP)
+htmlEncode(c);     }
    lastState="";    break;   }
 }    if(i==glbStr.length){   if(str!="")