| 214 | return w;} |
| 215 | function closetag(n){return'</'+n+'>';} |
| 216 | function xml(){var a,e,n,q,t,url,wmode;xmode='xml';stack=null;for(;;){switch(nexttoken.value){case'<':if(!stack){stack=[];} |
| 217 | advance('<');t=nexttoken;n=xmlword(true);t.name=n;if(!xtype){if(option.adsafe&&(!option.fragment||n!=='div')){error("ADsafe violation: Wrap the widget in a div.",token);} |
| 218 | if(xmltype[n]){xmltype[n].doBegin();n=xtype;e=false;}else{if(option.fragment){xmltype.html.doBegin();}else{error("Unrecognized tag '<{a}>'.",nexttoken,n);}}}else{if(stack.length===0){error("What the hell is this?");} |
| 219 | e=xmltype[xtype].doTagName(n,stack[stack.length-1].name);} |
| 220 | t.type=n;for(;;){if(nexttoken.id==='/'){advance('/');if(nexttoken.id!=='>'){warning("Expected '{a}' and instead saw '{b}'.",nexttoken,'>',nexttoken.value);} |
| 221 | e=true;break;} |
| 222 | if(nexttoken.id&&nexttoken.id.substr(0,1)==='>'){break;} |
| 223 | a=xmlword();switch(xmltype[xtype].doAttribute(n,a)){case'script':xmode='string';advance('=');q=nexttoken.id;if(q!=='"'&&q!=="'"){error("Missing quote.");} |
| 224 | xmode=q;wmode=option.white;option.white=false;advance(q);statements('on');option.white=wmode;if(nexttoken.id!==q){error("Missing close quote on script attribute.");} |
| 225 | xmode='xml';advance(q);break;case'value':advance('=');if(!nexttoken.identifier&&nexttoken.type!=='(string)'&&nexttoken.type!=='(number)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 226 | advance();break;case'id':advance('=');if(nexttoken.type!=='(string)'||!nexttoken.value){warning("Bad id '{a}'.",nexttoken,nexttoken.value);} |
| 227 | t.id=nexttoken.value.toLowerCase();if(ids[t.id]===true){warning("Duplicate id='{a}'.",nexttoken,nexttoken.value);}else if(option.adsafe){if((adsafe_id||stack.level>1)){warning("ADsafe violation: A widget can have only one id.",nexttoken);}else{adsafe_id=t.id;if(!/^[a-z][a-z0-9]*$/.test(adsafe_id)){warning("ADSAFE violation: bad id.",t);}}} |
| 228 | ids[t.id]=true;advance();break;case'name':advance('=');if(nexttoken.type!=='(string)'||!nexttoken.value||nexttoken.value===adsafe_id){warning("Bad name attribute.",nexttoken);} |
| 229 | advance();break;case'string':advance('=');if(nexttoken.type!=='(string)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 230 | advance();break;case'href':advance('=');if(nexttoken.type!=='(string)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 231 | if(option.adsafe&&ux.test(nexttoken.value)){error("ADsafe URL violation.");} |
| 232 | url=nexttoken.value;urls.push(url);advance();break;case'dangerous':advance('=');if(nexttoken.type!=='(string)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 233 | if(option.adsafe&&ux.test(nexttoken.value)){error("ADsafe URL violation.");} |
| 234 | advance();break;case'define':advance('=');if(nexttoken.type!=='(string)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 235 | addlabel(nexttoken.value,'var');advance();break;default:if(nexttoken.id==='='){advance('=');if(!nexttoken.identifier&&nexttoken.type!=='(string)'&&nexttoken.type!=='(number)'){error("Bad value '{a}'.",nexttoken,nexttoken.value);} |
| 236 | advance();}}} |
| 237 | switch(xmltype[xtype].doIt(n)){case'script':xmode='script';advance('>');indent=nexttoken.from;if(src){if(option.adsafe&&(!adsafe_may||!approved[url])){error("ADsafe script violation.",token);}}else{if(adsafe_went){error("ADsafe script violation.",token);} |
| 238 | statements('script');} |
| 239 | if(nexttoken.id!=='</'&&nexttoken.id!=='(end)'){warning("Expected '{a}' and instead saw '{b}'.",nexttoken,'<\/script>',nexttoken.value);} |
| 240 | xmode='xml';break;case'special':e=true;n=closetag(t.name);if(!lex.skip(n)){error("Missing '{a}'.",t,n);} |
| 241 | break;default:lex.skip('>');} |
| 242 | if(option.adsafe&&stack.length===0&&!adsafe_id){warning("ADSAFE violation: missing id.",t);} |
| 243 | if(!e){stack.push(t);} |
| 244 | break;case'</':advance('</');n=xmlword(true);t=stack.pop();if(!t){error("Unexpected '{a}'.",nexttoken,closetag(n));} |
| 245 | if(t.name!==n){error("Expected '{a}' and instead saw '{b}'.",nexttoken,closetag(t.name),closetag(n));} |
| 246 | if(nexttoken.id!=='>'){error("Missing '{a}'.",nexttoken,'>');} |
| 247 | if(stack.length>0){lex.skip('>');}else{advance('>');} |
| 248 | break;case'<!':if(option.adsafe){error("ADsafe HTML violation.");} |
| 249 | for(;;){advance();if(nexttoken.id==='>'){break;} |
| 250 | if(nexttoken.id==='<'||nexttoken.id==='(end)'){error("Missing '{a}'.",token,'>');}} |
| 251 | lex.skip('>');break;case'<!--':if(option.adsafe){error("ADsafe comment violation.");} |
| 252 | lex.skip('-->');break;case'<%':if(option.adsafe){error("ADsafe HTML violation.");} |
| 253 | lex.skip('%>');break;case'<?':if(option.adsafe){error("ADsafe HTML violation.");} |
| 254 | for(;;){advance();if(nexttoken.id==='?>'){break;} |
| 255 | if(nexttoken.id==='<?'||nexttoken.id==='<'||nexttoken.id==='>'||nexttoken.id==='(end)'){error("Missing '{a}'.",token,'?>');}} |
| 256 | lex.skip('?>');break;case'<=':case'<<':case'<<=':error("Missing '{a}'.",nexttoken,'<');break;case'(end)':return;} |
| 257 | if(stack&&stack.length===0){return;} |
| 258 | if(!lex.skip('')){if(!stack){error("Bad XML.");} |
| 259 | t=stack.pop();if(t.value){error("Missing '{a}'.",t,closetag(t.name));}else{return;}} |
| 260 | advance();}} |
| 261 | type('(number)',idValue);type('(string)',idValue);syntax['(identifier)']={type:'(identifier)',lbp:0,identifier:true,nud:function(){var v=this.value,s=scope[v];if(s&&(s===funct||s===funct['(global)'])){if(!funct['(global)']){switch(funct[v]){case'unused':funct[v]='var';break;case'label':warning("'{a}' is a statement label.",token,v);break;}}}else if(funct['(global)']){if(option.undef){warning("'{a}' is undefined.",token,v);} |
| 262 | note_implied(token);}else{switch(funct[v]){case'closure':case'function':case'var':case'unused':warning("'{a}' used out of scope.",token,v);break;case'label':warning("'{a}' is a statement label.",token,v);break;case'outer':case true:break;default:if(s===true){funct[v]=true;}else if(typeof s!=='object'){if(option.undef){warning("'{a}' is undefined.",token,v);}else{funct[v]=true;} |
| 263 | note_implied(token);}else{switch(s[v]){case'function':case'var':case'unused':s[v]='closure';funct[v]='outer';break;case'closure':case'parameter':funct[v]='outer';break;case'label':warning("'{a}' is a statement label.",token,v);}}}} |