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

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

hile(glbStr.charAt(--intTemp)=="")intCount++;      if(intCount%2==0)
break;     }     if(intNextQuote==-1)
break;     str+="<span class="quote">"+htmlEncode
(glbStr.substring(i+1,intNextQuote))
+"</span>"";     i=intNextQuote;     lastSta
te="";    break;    case "'":   
  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;      w
hile(glbStr.charAt(--intTemp)=="")intCount++;      if(intCount%2==0)
break;     }     if(intNextQuote==-1)
break;     str+="<span class="quote">"+htmlEncode
(glbStr.substring(i+1,intNextQuote))
+"</span>'";     i=intNextQuote;     lastState=&q
uot;";    break;    case "/":    
; if(glbStr.charAt(i+1)=="/")
{      intNextQuote=i;      intNextQuote=glbStr.indexOf
("rn",intNextQuote+1);      if(intNextQuote==-1)
intNextQuote=glbStr.length;      str=str.substring(0,str.length-
1);      str+="<span class="comments">/"+htmlEncode
(glbStr.substring(i+1,intNextQuote))
+"</span>";      i=intNextQuote;     }
else if(glbStr.charAt(i+1)=="*")
{      intNextQuote=i;      intNextQuote=glbStr.indexOf
("*/",intNextQuote+1);      if(intNextQuote==-1)
return;      str=str.substring(0,str.length-
1);      str+="<span class="comments">/"+htmlEncode
(glbStr.substring(i+1,intNextQuote))
+"*/</span>";      i=intNextQuote+1;     }