MCPcopy
hub / github.com/jquerytools/jquerytools / doOption

Function doOption

lib/jslint.js:87–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85if(funct.hasOwnProperty(t)){warning(funct[t]===true?"'{a}' was used before it was defined.":"'{a}' is already defined.",nexttoken,t);}
86funct[t]=type;if(type==='label'){scope[t]=funct;}else if(funct['(global)']){global[t]=funct;if(implied.hasOwnProperty(t)){warning("'{a}' was used before it was defined.",nexttoken,t);delete implied[t];}}else{funct['(scope)'][t]=funct;}}
87function doOption(){var b,obj,filter,o=nexttoken.value,t,v;switch(o){case'*/':error("Unbegun comment.");break;case'/*global':case'/*extern':if(option.adsafe){warning("ADsafe restriction.");}
88obj=predefined;break;case'/*members':case'/*member':o='/*members';if(!membersOnly){membersOnly={};}
89obj=membersOnly;break;case'/*jslint':if(option.adsafe){warning("ADsafe restriction.");}
90obj=option;filter=boolOptions;}
91for(;;){t=lex.token();if(t.id===','){t=lex.token();}
92while(t.id==='(endline)'){t=lex.token();}
93if(t.type==='special'&&t.value==='*/'){break;}
94if(t.type!=='(string)'&&t.type!=='(identifier)'&&o!=='/*members'){error("Bad option.",t);}
95if(filter){if(filter[t.value]!==true){error("Bad option.",t);}
96v=lex.token();if(v.id!==':'){error("Expected '{a}' and instead saw '{b}'.",t,':',t.value);}
97v=lex.token();if(v.value==='true'){b=true;}else if(v.value==='false'){b=false;}else{error("Expected '{a}' and instead saw '{b}'.",t,'true',t.value);}}else{b=true;}
98obj[t.value]=b;}
99if(filter){assume();}}
100function peek(p){var i=p||0,j=0,t;while(j<=i){t=lookahead[j];if(!t){t=lookahead[j]=lex.token();}
101j+=1;}
102return t;}

Callers 1

advanceFunction · 0.85

Calls 3

errorFunction · 0.85
warningFunction · 0.85
assumeFunction · 0.85

Tested by

no test coverage detected