hash.pname = code.substring(i21,i22+1); try{ hash.pname = eval(hash.pname); }catch(e){ return null; } xui.arr.each(hash.pname,function(o){ if(o=='xui.Module') hash.isModule=true; else{ var t=xui.SC(o); hash.isModule=t && t['xui.Module']; } }); }else{ hash.pname = code.substring(i2+1,i3); hash.pname = /[\'\"]/.test(hash.pname) ? hash.pname.replace(/[\'\" ]*/g,''): null; if(!/^[\w\$][\w\.]*$/.test(hash.name) || !/^[\w\$]?[\w\.]*$/.test(hash.pname)){ return null; } if(hash.pname=='xui.Module') hash.isModule=true; else{ if(hash.pname){ var t=xui.SC(hash.pname); hash.isModule=t && t['xui.Module']; } } } hash.arr = []; // find sub object/functions do{ c=code[pos++]; //ignore boolean?{}:{} pattern; if(c=="?"){ if(layer<=2){ qMark=true; } }else if(c==":"){ if(layer<=2){ if(qMark){ qMark=false; continue; }else if(prevColonPos!=-1){ continue; }else{ prevColonPos=pos; } } }else if(c=="("){ // has prev : if(prevColonPos!=-1){ var nn=code.indexOf(")", pos); if(nn!=-1){ pos=nn+1; continue; } } } else if(c==','){ // has prev : [same1] if(prevColonPos!=-1){ // only collection top 2 layers if(layer<=3){ type='other'; subcode=ocode.substring(codefrom=prevColonPos,codeto=pos-1); } // get key tmpstr2=code.substring(lastOKPos+1, prevColonPos-1); tmpResult=keyPattern.exec(tmpstr2); if(tmpResult!=null){ key=tmpResult[0].replace(/[\'\"\s]/g,''); } // use once only prevColonPos=-1; lastOKPos=pos; } } // if the second { else if(c=='{'){ layer++; // has prev : if(prevColonPos!=-1){ // only collection top 2 layers if(layer<=3){ //get type tmpstr=code.substring(prevColonPos, pos).replace(/\s*/,''); // function if(tmpstr[0]=='f'){ args=tmpstr.substring(tmpstr.indexOf('(')+1,tmpstr.indexOf(')')).split(','); if(args[0]==="")args=null; type='function'; }else if(tmpstr[0]=='{'){ type='object'; } // get key tmpstr2=code.substring(lastOKPos+1, prevColonPos-1); tmpResult=keyPattern.exec(tmpstr2); if(tmpResult!=null){ key=tmpResult[0].replace(/[\'\"\s]/g,''); if(layer==2 && (type=='object' || type=='function')){ layer1Key=key; codefrom=pos-1; } } } // use once only prevColonPos=-1; lastOKPos=pos; } }else if(c=='}'){ // has prev : [same1] if(prevColonPos!=-1){ // only collection top 2 layers if(layer<=3){ type='other'; subcode=ocode.substring(codefrom=prevColonPos,codeto=pos-1); } // get key tmpstr2=code.substring(lastOKPos+1, prevColonPos-1); tmpResult=keyPattern.exec(tmpstr2); if(tmpResult!=null){ key=tmpResult[0].replace(/[\'\"\s]/g,''); } // use once only prevColonPos=-1; lastOKPos=pos; } layer--; if(layer===0){ subcode=ocode.substring(codefrom=clsCodeStart-1,codeto=pos); hash.code=subcode; hash.from=codefrom; hash.to=codeto; }else if(layer===1){ if(layer1Key){ xui.set(hash.sub,[layer1Key,"to"],pos); hash.arr.push(layer1Key); layer1Key=null; } }else if(layer===2){ subcode=ocode.substring(codefrom=codeStart-1,codeto=pos); xui.set(hash.sub,[layer1Key,"sub",key,'code'],subcode); xui.set(hash.sub,[layer1Key,"sub",key,'from'],codefrom); xui.set(hash.sub,[layer1Key,"sub",key,'to'],codeto); } // prevColonPos=-1; lastOKPos=pos; } if(type){