bullring 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +38 -0
- data/lib/bullring.rb +135 -0
- data/lib/bullring/js/bullring.js +64 -0
- data/lib/bullring/js/jslint.js +6393 -0
- data/lib/bullring/js/jslint.min.js +171 -0
- data/lib/bullring/util/drubied_process.rb +66 -0
- data/lib/bullring/util/exceptions.rb +17 -0
- data/lib/bullring/util/network.rb +29 -0
- data/lib/bullring/version.rb +3 -0
- data/lib/bullring/worker.rb +36 -0
- data/lib/bullring/workers/rhino_server.rb +172 -0
- data/lib/bullring/workers/rhino_server.sh +46 -0
- data/lib/bullring/workers/rhino_server_worker.rb +79 -0
- data/lib/bullring/workers/rhino_simple_worker.rb +0 -0
- data/lib/scripts/server_console.sh +22 -0
- data/lib/tasks/bullring_tasks.rake +10 -0
- data/test/bullring_test.rb +301 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/home.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/home.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/home_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/home_helper.rb +2 -0
- data/test/dummy/app/views/home/index.html.erb +4 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/quiet_assets.rb +11 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +60 -0
- data/test/dummy/log/development.log +27 -0
- data/test/dummy/log/test.log +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/test_helper.rb +4 -0
- metadata +213 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
// jslint.js
|
2
|
+
// 2012-03-15
|
3
|
+
|
4
|
+
// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
|
5
|
+
|
6
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
// of this software and associated documentation files (the "Software"), to deal
|
8
|
+
// in the Software without restriction, including without limitation the rights
|
9
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
// copies of the Software, and to permit persons to whom the Software is
|
11
|
+
// furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
// The above copyright notice and this permission notice shall be included in
|
14
|
+
// all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
// The Software shall be used for Good, not Evil.
|
17
|
+
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
+
// SOFTWARE.
|
25
|
+
|
26
|
+
// WARNING: JSLint will hurt your feelings.
|
27
|
+
|
28
|
+
var JSLINT=function(){function V(a,f){var b,c=a.length,e={};for(b=0;b<c;b+=1)e[a[b]]=f;return e}function vb(){}function wb(a){return Lb[a]||"\\u"+("0000"+a.charCodeAt().toString(16)).slice(-4)}function ca(a){Object.keys(a).forEach(function(f){M[f]=a[f]})}function xb(){if(!g.safe&&(g.rhino&&(ca(Mb),g.rhino=!1),g.devel&&(ca(Nb),g.devel=!1),g.browser&&(ca(Ob),g.browser=!1),g.windows&&(ca(Pb),g.windows=!1),g.node&&(ca(Qb),g.node=!1,Na=!0),g.widget))ca(Rb),g.widget=!1}function v(a){a||(a=b);return a.number||
|
29
|
+
a.string}function cb(a,f,b){throw{name:"JSLintError",line:f,character:b,message:E.scanned_a_b.supplant({a:a,b:Math.floor(100*(f/za.length))})};}function c(a,f,d,c,e,m){var i,h,f=f||b;h=f.line||0;i=f.from||0;a={id:"(error)",raw:E[a]||a,evidence:za[h-1]||"",line:h,character:i,a:d||("(number)"===f.id?""+f.number:f.string),b:c,c:e,d:m};a.reason=a.raw.supplant(a);JSLINT.errors.push(a);g.passfail&&cb(E.stopping,h,i);Oa+=1;Oa>=g.maxerr&&cb(E.too_many,h,i);return a}function q(a,f,b,e,g,m,i){return c(a,{line:f,
|
30
|
+
from:b},e,g,m,i)}function l(a,f,b,e,g,m){a=c(a,f,b,e,g,m);cb(E.stopping,a.line,a.character)}function J(a,f,b,c,e,g,i){return l(a,{line:f,from:b},c,e,g,i)}function pa(a){!g.white&&b.from!==a&&c("expected_a_at_b_c",b,"",a,b.from)}function W(a,f,b){return a[f]!==b?(c("expected_a_b",a,b,a[f]),!0):!1}function ta(a,f,b){b=b||a.string;h===X?(g.safe&&c("adsafe_a",a,b),"string"!==typeof X[b]&&(a.writeable="boolean"===typeof M[b]?M[b]:!0,a.funct=h,Aa[b]=a),"becoming"===f&&(f="var")):"string"===typeof h[b]?
|
31
|
+
"undef"===h[b]?(g.undef||c("used_before_a",a,b),f="var"):c("already_defined",a,b):(a.funct=h,a.writeable=!0,z[b]=a);h[b]=f}function R(a){for(var b,d=0,a=a||0;d<=a;)(b=Ba[d])||(b=Ba[d]=Ca.token()),d+=1;return b}function e(a,f){if(p){if(da&&b.line!==i.line){if((da!==p||!b.edge)&&b.from===p.at-(b.edge?g.indent:0)){for(var d=p;;){d.at-=g.indent;if(d===da)break;d=d.was}d.open=!1}da=null}"?"===b.id&&":"===p.mode&&i.line!==b.line&&(p.at-=g.indent);p.open?b.edge?"label"===b.edge?pa(1):"case"===b.edge||"statement"===
|
32
|
+
p.mode?pa(p.at-g.indent):("array"!==p.mode||b.line!==i.line)&&pa(p.at):b.line!==i.line&&(b.from<p.at+("expression"===p.mode?0:g.indent)&&pa(p.at+g.indent),p.wrap=!0):b.line!==i.line&&(b.edge?pa(p.at):(p.wrap=!0,"statement"===p.mode||"var"===p.mode?pa(p.at+g.indent):b.from<p.at+("expression"===p.mode?0:g.indent)&&pa(p.at+g.indent)))}switch(i.id){case "(number)":"."===b.id&&c("trailing_decimal_a");break;case "-":("-"===b.id||"--"===b.id)&&c("confusing_a");break;case "+":("+"===b.id||"++"===b.id)&&c("confusing_a")}if("(string)"===
|
33
|
+
i.id||i.identifier)db=i.string;a&&b.id!==a&&(f?c("expected_a_b_from_c_d",b,a,f.id,f.line,v()):(!b.identifier||b.string!==a)&&c("expected_a_b",b,a,v()));S=i;i=b;b=Ba.shift()||Ca.token()}function T(a){b.identifier&&b.string===a?e():c("expected_a_b",b,a,v())}function C(a){b.edge=p?p.open&&(a||"edge"):""}function G(a){var f;"number"===typeof a?p={at:+a,open:!0,was:p}:p?"statement"===a?p={at:p.at,open:!0,was:p}:(f="var"===a||b.line!==i.line,p={at:(f||"control"===a?p.at+g.indent:p.at)+(p.wrap?g.indent:
|
34
|
+
0),mode:a,open:f,was:p},"var"===a&&f&&(da=p)):p={at:1,mode:"statement",open:!0}}function D(a,b){a&&(p&&p.open&&(p.at-=g.indent,C()),e(a,b));p&&(p=p.was)}function u(a,f){f=f||b;"(end)"!==f.id&&!g.white&&(i.line!==f.line||i.thru+1!==f.from)&&c("expected_space_a_b",f,v(i),v(f))}function ua(a,f){a=a||i;f=f||b;"(end)"!==f.id&&(a.line!==f.line||!g.white&&a.thru+1!==f.from)&&c("expected_space_a_b",f,v(a),v(f))}function s(a,f){a=a||i;f=f||b;(!g.white||"styleproperty"===r||"style"===r)&&a.thru!==f.from&&a.line===
|
35
|
+
f.line&&c("unexpected_space_a_b",f,v(a),v(f))}function A(a,f){a=a||i;f=f||b;"(end)"!==f.id&&(a.line!==f.line||!g.white&&a.thru!==f.from)&&c("unexpected_space_a_b",f,v(a),v(f))}function F(a,f){g.white||(a=a||i,f=f||b,a.thru===f.from&&a.line===f.line&&c("missing_space_a_b",f,v(a),v(f)))}function K(){","!==b.id?q("expected_a_b",i.line,i.thru,",",v()):(g.white||A(),e(","),F())}function O(){";"!==b.id?q("expected_a_b",i.line,i.thru,";",v()):(g.white||A(),e(";"),!0!==Sb[b.id]&&F())}function Pa(){return"use strict"===
|
36
|
+
b.string?(qa&&c("unnecessary_use"),C(),e(),O(),qa=!0,g.newcap=!1,g.undef=!1,!0):!1}function P(a,b){if(a===b)return!0;if(Array.isArray(a)){if(Array.isArray(b)&&a.length===b.length){var d;for(d=0;d<a.length;d+=1)if(!P(a[d],b[d]))return!1;return!0}return!1}if(Array.isArray(b))return!1;if("(number)"===a.id&&"(number)"===b.id)return a.number===b.number;if(a.arity===b.arity&&a.string===b.string)switch(a.arity){case "prefix":case "suffix":case void 0:return a.id===b.id&&P(a.first,b.first);case "infix":return P(a.first,
|
37
|
+
b.first)&&P(a.second,b.second);case "ternary":return P(a.first,b.first)&&P(a.second,b.second)&&P(a.third,b.third);case "function":case "regexp":break;default:return!0}else{if("."===a.id&&"["===b.id&&"infix"===b.arity)return a.second.string===b.second.string&&"(string)"===b.second.id;if("["===a.id&&"infix"===a.arity&&"."===b.id)return a.second.string===b.second.string&&"(string)"===a.second.id}return!1}function k(a,f){var d;"(end)"===b.id&&l("unexpected_a",i,b.id);e();g.safe&&z[i.string]&&z[i.string]===
|
38
|
+
Aa[i.string]&&"("!==b.id&&"."!==b.id&&c("adsafe_a",i);f&&(db="anonymous",h["(verb)"]=i.string);if(!0===f&&i.fud)d=i.fud();else{if(i.nud)d=i.nud();else{if("(number)"===b.id&&"."===i.id)return c("leading_decimal_a",i,v()),e(),i;l("expected_identifier_a",i,i.id)}for(;a<b.lbp;)e(),i.led?d=i.led(d):l("expected_operator_a",i,i.id)}return d}function B(a,b){var d=$[a];if(!d||"object"!==typeof d)$[a]=d={id:a,lbp:b||0,string:a};return d}function ra(a){a.postscript=!0;return a}function eb(a){var b=B(a,0);b.from=
|
39
|
+
1;b.thru=1;b.line=0;b.edge="edge";a.string=a;return ra(b)}function N(a,b){var d=B(a);d.identifier=d.reserved=!0;d.fud=b;return d}function Qa(a,b){N(a,b).labeled=!0}function Ra(a,b){N(a,b).disrupt=!0}function yb(a){var b=a.id.charAt(0);if("a"<=b&&"z">=b||"A"<=b&&"Z">=b)a.identifier=a.reserved=!0;return a}function L(a,b){var d=B(a,150);yb(d);d.nud="function"===typeof b?b:function(){"typeof"===a?u():A();this.first=k(150);this.arity="prefix";if("++"===this.id||"--"===this.id)g.plusplus?(!this.first.identifier||
|
40
|
+
this.first.reserved)&&"."!==this.first.id&&"["!==this.first.id&&c("bad_operand",this):c("unexpected_a",this);return this};return d}function ea(a,b,d){a=B(a);a.arity=b;d&&(a.nud=d);return a}function w(a,b){var d=B(a);d.identifier=d.reserved=!0;"function"===typeof b&&(d.nud=b);return d}function va(a){var b=w(a);b.string=a;b.nud=Da;return b}function fb(a,b){return w(a,function(){"function"===typeof b&&b(this);return this})}function I(a,b,d,e){a=B(a,b);yb(a);a.led=function(a){this.arity="infix";e||(F(S,
|
41
|
+
i),F());!g.bitwise&&this.bitwise&&c("unexpected_a",this);if("function"===typeof d)return d(a,this);this.first=a;this.second=k(b);return this};return a}function aa(a,b){a.assign&&c(b||E.conditional_assignment,a);return a}function fa(a,b){switch(a.id){case "[":case "-":"infix"!==a.arity&&c(b||E.weird_condition,a);break;case "false":case "function":case "Infinity":case "NaN":case "null":case "true":case "undefined":case "void":case "(number)":case "(regexp)":case "(string)":case "{":c(b||E.weird_condition,
|
42
|
+
a);break;case "(":"."===a.first.id&&!0===Tb[a.first.second.string]&&c(b||E.weird_condition,a)}return a}function zb(a){switch(a.arity){case "prefix":switch(a.id){case "{":case "[":c("unexpected_a",a);break;case "!":c("confusing_a",a)}break;case "function":case "regexp":c("unexpected_a",a);break;default:"NaN"===a.id&&c("isNaN",a)}return a}function ia(a,b){return I(a,100,function(a,e){zb(a);b&&!g.eqeq&&c("expected_a_b",e,b,e.id);var i=k(100);(P(a,i)||("(string)"===a.id||"(number)"===a.id)&&("(string)"===
|
43
|
+
i.id||"(number)"===i.id))&&c("weird_relation",e);e.first=a;e.second=zb(i);return e})}function Y(a,b){var d=I(a,20,function(a,b){var f;b.first=a;if(a.identifier)z[a.string]?!1===z[a.string].writeable&&c("read_only",a):l("read_only"),h["(params)"]&&h["(params)"].forEach(function(b){b.string===a.string&&(b.assign=!0)});else if(g.safe){f=a;do"boolean"===typeof M[f.string]&&c("adsafe_a",f),f=f.first;while(f)}a===$["function"]&&c("identifier_function",i);"."===a.id||"["===a.id?(!a.first||"arguments"===
|
44
|
+
a.first.string)&&c("bad_assignment",b):a.identifier?!a.reserved&&"exception"===h[a.string]&&c("assign_exception",a):c("bad_assignment",b);b.second=k(19);"="===b.id&&P(b.first,b.second)&&c("weird_assignment",b);return b});d.assign=!0;b&&$[b].bitwise&&(d.bitwise=!0);return d}function wa(a,b){var d=I(a,b,"number");d.bitwise=!0;return d}function Ab(a){a=B(a,150);a.led=function(a){A(S,i);g.plusplus?(!a.identifier||a.reserved)&&"."!==a.id&&"["!==a.id&&c("bad_operand",this):c("unexpected_a",this);this.first=
|
45
|
+
a;this.arity="suffix";return this};return a}function gb(){if(b.identifier)return e(),g.safe&&Sa[i.string]?c("adsafe_a",i):i.reserved&&!g.es5&&c("expected_identifier_a_reserved",i),i.string}function Ea(){var a=gb();a||l("function"===i.id&&"("===b.id?"name_function":"expected_identifier_a");return a}function hb(){var a,f=z;if(";"===b.id)c("unexpected_a"),O();else{b.identifier&&!b.reserved&&":"===R().id&&(C("label"),a=b,e(),e(":"),z=Object.create(f),ta(a,"label"),!0!==b.labeled||h===X?l("unexpected_label_a",
|
46
|
+
a):ib.test(a.string+":")&&c("url",a),b.label=a);"else"!==i.id&&C();G("statement");if(a=k(0,!0))"statement"===a.arity?"switch"===a.id||a.block&&"do"!==a.id?F():O():("("===a.id?"new"===a.first.id&&c("bad_new"):!a.assign&&"delete"!==a.id&&"++"!==a.id&&"--"!==a.id&&c("assignment_function_expression",i),O());D();z=f;return a}}function sa(){for(var a=[],f,d;!0!==b.postscript;)if(";"===b.id)c("unexpected_a",b),O();else if("use strict"===b.string&&((!Na&&"script"!==r||h!==X||0<a.length)&&c("function_strict"),
|
47
|
+
Pa()),f&&(c("unreachable_a_b",b,b.string,f.string),f=null),d=hb())a.push(d),d.disrupt&&(f=d,a.disrupt=!0);return a}function Z(a){var f,d=b,j=ja,i=z,m=qa;ja=a;z=Object.create(z);F();"{"===b.id?(e("{"),G(),!a&&!Pa()&&!m&&!g.sloppy&&h["(context)"]===X&&c("missing_use_strict"),f=sa(),qa=m,D("}",d)):a?(c("expected_a_b",b,"{",v()),f=[hb()],f.disrupt=f[0].disrupt):l("expected_a_b",b,"{",v());h["(verb)"]=null;z=i;ja=j;a&&0===f.length&&c("empty_block");return f}function Ta(a){g.properties&&"number"!==typeof ga[a]&&
|
48
|
+
c("unexpected_property_a",i,a);ga[a]="number"===typeof ga[a]?ga[a]+1:1}function jb(){var a=gb(!0);a||("(string)"===b.id?(a=b.string,g.safe&&(Sa[a]?c("adsafe_a"):("_"===a.charAt(0)||"_"===a.charAt(a.length-1))&&c("dangling_a")),e()):"(number)"===b.id&&(a=b.number.toString(),e()));return a}function Ub(){var a=b,f=[];e("(");G();s();if(")"===b.id)return s(),D(")",a),f;for(;;)if(C(),Ea(),f.push(i),ta(i,g.unparam?"parameter":"unparam"),","===b.id)K();else return s(),D(")",a),f}function Ua(a,f){var d=h,
|
49
|
+
e=g,i=z;h={"(name)":f||"'"+(db||"").replace(Bb,wb)+"'","(line)":b.line,"(context)":d,"(breakage)":0,"(loopage)":0,"(scope)":z,"(token)":a};g=Object.create(e);z=Object.create(i);Va.push(h);(a.name=f)&&ta(a,"function",f);a.writeable=!1;a.first=h["(params)"]=Ub();u();a.block=Z(!1);h["(arguments)"]&&a.first.forEach(function(a){a.assign&&c("parameter_arguments_a",a,a.string)});h=d;g=e;z=i}function kb(){function a(){var a=b,f={};e("{");if("}"!==b.id)for(;"(end)"!==b.id;){for(;","===b.id;)c("unexpected_a",
|
50
|
+
b),e(",");"(string)"!==b.id&&c("expected_string_a");!0===f[b.string]?c("duplicate_a"):"__proto__"===b.string?c("dangling_a"):f[b.string]=!0;e();e(":");kb();if(","!==b.id)break;e(",");if("}"===b.id){c("unexpected_a",i);break}}e("}",a)}function f(){var a=b;e("[");if("]"!==b.id)for(;"(end)"!==b.id;){for(;","===b.id;)c("unexpected_a",b),e(",");kb();if(","!==b.id)break;e(",");if("]"===b.id){c("unexpected_a",i);break}}e("]",a)}switch(b.id){case "{":a();break;case "[":f();break;case "true":case "false":case "null":case "(number)":case "(string)":e();
|
51
|
+
break;case "-":e("-");A();e("(number)");break;default:l("unexpected_a")}}function Fa(){if(b.identifier)return e(),!0}function Wa(){"-"===b.id&&(e("-"),A());if("(number)"===b.id)return e("(number)"),!0}function Ga(){if("(string)"===b.id)return e(),!0}function ha(){var a,f,d,g;if(b.identifier){g=b.string;if("rgb"===g||"rgba"===g){e();d=b;e("(");for(a=0;3>a;a+=1)a&&K(),f=b.number,"(number)"!==b.id||0>f?(c("expected_positive_a",b),e()):(e(),"%"===b.id?(e("%"),100<f&&c("expected_percent_a",i,f)):255<f&&
|
52
|
+
c("expected_small_a",i,f));"rgba"===g&&(K(),f=b.number,("(number)"!==b.id||0>f||1<f)&&c("expected_fraction_a",b),e(),"%"===b.id&&(c("unexpected_a"),e("%")));e(")",d);return!0}if(!0===Vb[b.string])return e(),!0}else if("(color)"===b.id)return e(),!0;return!1}function x(){"-"===b.id&&(e("-"),A());return"(number)"===b.id?(e(),"(string)"!==b.id&&!0===Cb[b.string]?(A(),e()):0!==+i.number&&c("expected_linear_a"),!0):!1}function xa(){if(b.identifier)switch(b.string){case "thin":case "medium":case "thick":return e(),
|
53
|
+
!0}else return x()}function Ha(){if(b.identifier){if("auto"===b.string)return e(),!0}else return x()}function Xa(){return x()&&("(number)"!==b.id||x())}function ka(){var a,f;if(b.identifier&&"url"===b.string){b=Ca.range("(",")");f=b.string;a=f.charAt(0);if('"'===a||"'"===a)f.slice(-1)!==a?c("bad_url_a"):(f=f.slice(1,-1),0<=f.indexOf(a)&&c("bad_url_a"));f||c("missing_url");lb.test(f)&&l("bad_url_a");Ia.push(f);e();return!0}return!1}function mb(a){var f=0,d,c,g,m=0;switch(typeof a){case "function":return a();
|
54
|
+
case "string":return b.identifier&&b.string===a?(e(),!0):!1}for(;;){if(f>=a.length)return!1;g=a[f];f+=1;if("boolean"===typeof g)break;else"number"===typeof g?(d=g,g=a[f],f+=1):d=1;for(c=!1;0<d;)if(mb(g))c=!0,d-=1;else break;if(c)return!0}m=f;for(d=[];;){g=!1;for(f=m;f<a.length;f+=1)if(!d[f]&&mb(Ya[a[f]])){g=c=!0;d[f]=!0;break}if(!g)return c}}function Db(){for(var a;!("}"===b.id||"(end)"===b.id||Q&&b.id===Q);){for(a=void 0;"*"===b.id||"#"===b.id||"_"===b.string;)g.css||c("unexpected_a"),e();"-"===
|
55
|
+
b.id?(g.css||c("unexpected_a"),e("-"),b.identifier||c("expected_nonstandard_style_attribute"),e(),a=nb):(b.identifier?Object.prototype.hasOwnProperty.call(Ya,b.string)?a=Ya[b.string]:(a=nb,g.css||c("unrecognized_style_attribute_a")):c("expected_style_attribute"),e());e(":");b.identifier&&"inherit"===b.string?e():mb(a)||(c("unexpected_a"),e());"!"===b.id&&(e("!"),A(),b.identifier&&"important"===b.string?e():c("expected_a_b",b,"important",v()));"}"===b.id||b.id===Q?c("expected_a_b",b,";",v()):O()}}
|
56
|
+
function ob(){if(b.identifier)Object.prototype.hasOwnProperty.call(pb,g.cap?b.string.toLowerCase():b.string)||c("expected_tagname_a"),e();else switch(b.id){case ">":case "+":e();ob();break;case ":":e(":");switch(b.string){case "active":case "after":case "before":case "checked":case "disabled":case "empty":case "enabled":case "first-child":case "first-letter":case "first-line":case "first-of-type":case "focus":case "hover":case "last-child":case "last-of-type":case "link":case "only-of-type":case "root":case "target":case "visited":T(b.string);
|
57
|
+
break;case "lang":T("lang");e("(");b.identifier||c("expected_lang_a");e(")");break;case "nth-child":case "nth-last-child":case "nth-last-of-type":case "nth-of-type":T(b.string);e("(");"(number)"===b.id?(e(),"n"===b.string&&b.identifier&&(A(),e(),"+"===b.id&&(A(),e("+"),A(),e("(number)")))):b.identifier&&("odd"===b.string||"even"===b.string)?e():c("unexpected_a");e(")");break;case "not":T("not");e("(");":"===b.id&&"not"===R(0).string&&c("not");ob();e(")");break;default:c("expected_pseudo_a")}break;
|
58
|
+
case "#":e("#");b.identifier||c("expected_id_a");e();break;case "*":e("*");break;case ".":e(".");b.identifier||c("expected_class_a");e();break;case "[":e("[");b.identifier||c("expected_attribute_a");e();if("="===b.id||"~="===b.string||"$="===b.string||"|="===b.string||"*="===b.id||"^="===b.id)e(),"(string)"!==b.id&&c("expected_string_a"),e();e("]");break;default:l("expected_selector_a")}}function Eb(){for(;"}"!==b.id&&"</"!==b.id&&"(end)"!==b.id;){a:for("{"===b.id&&c("expected_style_pattern");;){ob();
|
59
|
+
if("</"===b.id||"{"===b.id||"}"===b.id||"(end)"===b.id)break a;","===b.id&&K()}r="styleproperty";";"===b.id?O():(e("{"),Db(),r="style",e("}"))}}function Fb(){for(;"@"===b.id;)switch(R(),e("@"),b.string){case "import":T("import");ka()||(c("expected_a_b",b,"url",v()),e());O();break;case "media":for(T("media");;){(!b.identifier||!0!==Gb[b.string])&&l("expected_media_a");e();if(","!==b.id)break;K()}e("{");Eb();e("}");break;case "font-face":T("font-face");e("{");T("font-family");e(":");!Fa()&&!Ga()&&l("expected_name_a");
|
60
|
+
O();T("src");for(e(":");;){"local"===b.string?(T("local"),e("("),lb.test(b.string)&&l("bad_url_a"),!Fa()&&!Ga()&&l("expected_name_a"),e(")")):ka()||l("expected_a_b",b,"url",v());if(","!==b.id)break;K()}O();e("}");break;default:l("expected_at_a")}Eb()}var U,Ja,Ka,la,qb={anon:!0,bitwise:!0,browser:!0,cap:!0,"continue":!0,css:!0,debug:!0,devel:!0,eqeq:!0,es5:!0,evil:!0,forin:!0,fragment:!0,indent:10,maxerr:1E3,maxlen:256,newcap:!0,node:!0,nomen:!0,on:!0,passfail:!0,plusplus:!0,properties:!0,regexp:!0,
|
61
|
+
rhino:!0,undef:!0,unparam:!0,sloppy:!0,sub:!0,vars:!0,white:!0,widget:!0,windows:!0},db,Za,Wb={"<":!0,"<=":!0,"==":!0,"===":!0,"!==":!0,"!=":!0,">":!0,">=":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0},Sa=V("arguments,callee,caller,constructor,eval,prototype,stack,unwatch,valueOf,watch".split(","),!0),rb,Ob=V("clearInterval,clearTimeout,document,event,FormData,frames,history,Image,localStorage,location,name,navigator,Option,parent,screen,sessionStorage,setInterval,setTimeout,Storage,window,XMLHttpRequest".split(","),
|
62
|
+
!1),E={a_label:"'{a}' is a statement label.",a_not_allowed:"'{a}' is not allowed.",a_not_defined:"'{a}' is not defined.",a_scope:"'{a}' used out of scope.",adsafe_a:"ADsafe violation: '{a}'.",adsafe_autocomplete:"ADsafe autocomplete violation.",adsafe_bad_id:"ADSAFE violation: bad id.",adsafe_div:"ADsafe violation: Wrap the widget in a div.",adsafe_fragment:"ADSAFE: Use the fragment option.",adsafe_go:"ADsafe violation: Misformed ADSAFE.go.",adsafe_html:"Currently, ADsafe does not operate on whole HTML documents. It operates on <div> fragments and .js files.",
|
63
|
+
adsafe_id:"ADsafe violation: id does not match.",adsafe_id_go:"ADsafe violation: Missing ADSAFE.id or ADSAFE.go.",adsafe_lib:"ADsafe lib violation.",adsafe_lib_second:"ADsafe: The second argument to lib must be a function.",adsafe_missing_id:"ADSAFE violation: missing ID_.",adsafe_name_a:"ADsafe name violation: '{a}'.",adsafe_placement:"ADsafe script placement violation.",adsafe_prefix_a:"ADsafe violation: An id must have a '{a}' prefix",adsafe_script:"ADsafe script violation.",adsafe_source:"ADsafe unapproved script source.",
|
64
|
+
adsafe_subscript_a:"ADsafe subscript '{a}'.",adsafe_tag:"ADsafe violation: Disallowed tag '{a}'.",already_defined:"'{a}' is already defined.",and:"The '&&' subexpression should be wrapped in parens.",assign_exception:"Do not assign to the exception parameter.",assignment_function_expression:"Expected an assignment or function call and instead saw an expression.",attribute_case_a:"Attribute '{a}' not all lower case.",avoid_a:"Avoid '{a}'.",bad_assignment:"Bad assignment.",bad_color_a:"Bad hex color '{a}'.",
|
65
|
+
bad_constructor:"Bad constructor.",bad_entity:"Bad entity.",bad_html:"Bad HTML string",bad_id_a:"Bad id: '{a}'.",bad_in_a:"Bad for in variable '{a}'.",bad_invocation:"Bad invocation.",bad_name_a:"Bad name: '{a}'.",bad_new:"Do not use 'new' for side effects.",bad_number:"Bad number '{a}'.",bad_operand:"Bad operand.",bad_style:"Bad style.",bad_type:"Bad type.",bad_url_a:"Bad url '{a}'.",bad_wrap:"Do not wrap function literals in parens unless they are to be immediately invoked.",combine_var:"Combine this with the previous 'var' statement.",
|
66
|
+
conditional_assignment:"Expected a conditional expression and instead saw an assignment.",confusing_a:"Confusing use of '{a}'.",confusing_regexp:"Confusing regular expression.",constructor_name_a:"A constructor name '{a}' should start with an uppercase letter.",control_a:"Unexpected control character '{a}'.",css:"A css file should begin with @charset 'UTF-8';",dangling_a:"Unexpected dangling '_' in '{a}'.",dangerous_comment:"Dangerous comment.",deleted:"Only properties should be deleted.",duplicate_a:"Duplicate '{a}'.",
|
67
|
+
empty_block:"Empty block.",empty_case:"Empty case.",empty_class:"Empty class.",es5:"This is an ES5 feature.",evil:"eval is evil.",expected_a:"Expected '{a}'.",expected_a_b:"Expected '{a}' and instead saw '{b}'.",expected_a_b_from_c_d:"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",expected_at_a:"Expected an at-rule, and instead saw @{a}.",expected_a_at_b_c:"Expected '{a}' at column {b}, not column {c}.",expected_attribute_a:"Expected an attribute, and instead saw [{a}].",expected_attribute_value_a:"Expected an attribute value and instead saw '{a}'.",
|
68
|
+
expected_class_a:"Expected a class, and instead saw .{a}.",expected_fraction_a:"Expected a number between 0 and 1 and instead saw '{a}'",expected_id_a:"Expected an id, and instead saw #{a}.",expected_identifier_a:"Expected an identifier and instead saw '{a}'.",expected_identifier_a_reserved:"Expected an identifier and instead saw '{a}' (a reserved word).",expected_linear_a:"Expected a linear unit and instead saw '{a}'.",expected_lang_a:"Expected a lang code, and instead saw :{a}.",expected_media_a:"Expected a CSS media type, and instead saw '{a}'.",
|
69
|
+
expected_name_a:"Expected a name and instead saw '{a}'.",expected_nonstandard_style_attribute:"Expected a non-standard style attribute and instead saw '{a}'.",expected_number_a:"Expected a number and instead saw '{a}'.",expected_operator_a:"Expected an operator and instead saw '{a}'.",expected_percent_a:"Expected a percentage and instead saw '{a}'",expected_positive_a:"Expected a positive number and instead saw '{a}'",expected_pseudo_a:"Expected a pseudo, and instead saw :{a}.",expected_selector_a:"Expected a CSS selector, and instead saw {a}.",
|
70
|
+
expected_small_a:"Expected a small positive integer and instead saw '{a}'",expected_space_a_b:"Expected exactly one space between '{a}' and '{b}'.",expected_string_a:"Expected a string and instead saw {a}.",expected_style_attribute:"Excepted a style attribute, and instead saw '{a}'.",expected_style_pattern:"Expected a style pattern, and instead saw '{a}'.",expected_tagname_a:"Expected a tagName, and instead saw {a}.",expected_type_a:"Expected a type, and instead saw {a}.",for_if:"The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.",
|
71
|
+
function_block:"Function statements should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.",function_eval:"The Function constructor is eval.",function_loop:"Don't make functions within a loop.",function_statement:"Function statements are not invocable. Wrap the whole function invocation in parens.",function_strict:"Use the function form of 'use strict'.",html_confusion_a:"HTML confusion in regular expression '<{a}'.",html_handlers:"Avoid HTML event handlers.",
|
72
|
+
identifier_function:"Expected an identifier in an assignment and instead saw a function invocation.",implied_evil:"Implied eval is evil. Pass a function instead of a string.",infix_in:"Unexpected 'in'. Compare with undefined, or use the hasOwnProperty method instead.",insecure_a:"Insecure '{a}'.",isNaN:"Use the isNaN function to compare with NaN.",lang:"lang is deprecated.",leading_decimal_a:"A leading decimal point can be confused with a dot: '.{a}'.",missing_a:"Missing '{a}'.",missing_a_after_b:"Missing '{a}' after '{b}'.",
|
73
|
+
missing_option:"Missing option value.",missing_property:"Missing property name.",missing_space_a_b:"Missing space between '{a}' and '{b}'.",missing_url:"Missing url.",missing_use_strict:"Missing 'use strict' statement.",mixed:"Mixed spaces and tabs.",move_invocation:"Move the invocation into the parens that contain the function.",move_var:"Move 'var' declarations to the top of the function.",name_function:"Missing name in function statement.",nested_comment:"Nested comment.",not:"Nested not.",not_a_constructor:"Do not use {a} as a constructor.",
|
74
|
+
not_a_defined:"'{a}' has not been fully defined yet.",not_a_function:"'{a}' is not a function.",not_a_label:"'{a}' is not a label.",not_a_scope:"'{a}' is out of scope.",not_greater:"'{a}' should not be greater than '{b}'.",octal_a:"Don't use octal: '{a}'. Use '\\u....' instead.",parameter_arguments_a:"Do not mutate parameter '{a}' when using 'arguments'.",parameter_a_get_b:"Unexpected parameter '{a}' in get {b} function.",parameter_set_a:"Expected parameter (value) in set {a} function.",radix:"Missing radix parameter.",
|
75
|
+
read_only:"Read only.",redefinition_a:"Redefinition of '{a}'.",reserved_a:"Reserved name '{a}'.",scanned_a_b:"{a} ({b}% scanned).",slash_equal:"A regular expression literal can be confused with '/='.",statement_block:"Expected to see a statement and instead saw a block.",stopping:"Stopping. ",strange_loop:"Strange loop.",strict:"Strict violation.",subscript:"['{a}'] is better written in dot notation.",tag_a_in_b:"A '<{a}>' must be within '<{b}>'.",too_long:"Line too long.",too_many:"Too many errors.",
|
76
|
+
trailing_decimal_a:"A trailing decimal point can be confused with a dot: '.{a}'.",type:"type is unnecessary.",unclosed:"Unclosed string.",unclosed_comment:"Unclosed comment.",unclosed_regexp:"Unclosed regular expression.",unescaped_a:"Unescaped '{a}'.",unexpected_a:"Unexpected '{a}'.",unexpected_char_a_b:"Unexpected character '{a}' in {b}.",unexpected_comment:"Unexpected comment.",unexpected_else:"Unexpected 'else' after 'return'.",unexpected_label_a:"Unexpected label '{a}'.",unexpected_property_a:"Unexpected /*property*/ '{a}'.",
|
77
|
+
unexpected_space_a_b:"Unexpected space between '{a}' and '{b}'.",unnecessary_initialize:"It is not necessary to initialize '{a}' to 'undefined'.",unnecessary_use:"Unnecessary 'use strict'.",unreachable_a_b:"Unreachable '{a}' after '{b}'.",unrecognized_style_attribute_a:"Unrecognized style attribute '{a}'.",unrecognized_tag_a:"Unrecognized tag '<{a}>'.",unsafe:"Unsafe character.",url:"JavaScript URL.",use_array:"Use the array literal notation [].",use_braces:"Spaces are hard to count. Use {{a}}.",
|
78
|
+
use_charAt:"Use the charAt method.",use_object:"Use the object literal notation {}.",use_or:"Use the || operator.",use_param:"Use a named parameter.",used_before_a:"'{a}' was used before it was defined.",var_a_not:"Variable {a} was not declared correctly.",weird_assignment:"Weird assignment.",weird_condition:"Weird condition.",weird_new:"Weird construction. Delete 'new'.",weird_program:"Weird program.",weird_relation:"Weird relation.",weird_ternary:"Weird ternary.",wrap_immediate:"Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the result of a function, and not the function itself.",
|
79
|
+
wrap_regexp:"Wrap the /regexp/ literal in parens to disambiguate the slash operator.",write_is_wrong:"document.write can be a form of eval."},La,Ya,nb,Vb=V("aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgreen,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow,yellowgreen,activeborder,activecaption,appworkspace,background,buttonface,buttonhighlight,buttonshadow,buttontext,captiontext,graytext,highlight,highlighttext,inactiveborder,inactivecaption,inactivecaptiontext,infobackground,infotext,menu,menutext,scrollbar,threeddarkshadow,threedface,threedhighlight,threedlightshadow,threedshadow,window,windowframe,windowtext".split(","),
|
80
|
+
!0),ya,sb,Cb={"%":!0,cm:!0,em:!0,ex:!0,"in":!0,mm:!0,pc:!0,pt:!0,px:!0},Gb,$a,Hb={b:"\u0008",t:"\t",n:"\n",f:"\u000c",r:"\r",'"':'"',"/":"/","\\":"\\"},Nb=V("alert,confirm,console,Debug,opera,prompt,WSH".split(","),!1),ma,Lb={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","'":"\\'",'"':'\\"',"/":"\\/","\\":"\\\\"},h,Ma="closure,exception,global,label,outer,undef,unused,var".split(","),Va,X,Aa,pb={a:{},abbr:{},acronym:{},address:{},applet:{},area:{empty:!0,parent:" map "},article:{},
|
81
|
+
aside:{},audio:{},b:{},base:{empty:!0,parent:" head "},bdo:{},big:{},blockquote:{},body:{parent:" html noframes "},br:{empty:!0},button:{},canvas:{parent:" body p div th td "},caption:{parent:" table "},center:{},cite:{},code:{},col:{empty:!0,parent:" table colgroup "},colgroup:{parent:" table "},command:{parent:" menu "},datalist:{},dd:{parent:" dl "},del:{},details:{},dialog:{},dfn:{},dir:{},div:{},dl:{},dt:{parent:" dl "},em:{},embed:{},fieldset:{},figure:{},font:{},footer:{},form:{},frame:{empty:!0,
|
82
|
+
parent:" frameset "},frameset:{parent:" html frameset "},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{parent:" html "},header:{},hgroup:{},hr:{empty:!0},"hta:application":{empty:!0,parent:" head "},html:{parent:"*"},i:{},iframe:{},img:{empty:!0},input:{empty:!0},ins:{},kbd:{},keygen:{},label:{},legend:{parent:" details fieldset figure "},li:{parent:" dir menu ol ul "},link:{empty:!0,parent:" head "},map:{},mark:{},menu:{},meta:{empty:!0,parent:" head noframes noscript "},meter:{},nav:{},noframes:{parent:" html body "},
|
83
|
+
noscript:{parent:" body head noframes "},object:{},ol:{},optgroup:{parent:" select "},option:{parent:" optgroup select "},output:{},p:{},param:{empty:!0,parent:" applet object "},pre:{},progress:{},q:{},rp:{},rt:{},ruby:{},samp:{},script:{empty:!0,parent:" body div frame head iframe p pre span "},section:{},select:{},small:{},span:{},source:{},strong:{},style:{parent:" head ",empty:!0},sub:{},sup:{},table:{},tbody:{parent:" table "},td:{parent:" tr "},textarea:{},tfoot:{parent:" table "},th:{parent:" tr "},
|
84
|
+
thead:{parent:" table "},time:{},title:{parent:" head "},tr:{parent:" table tbody thead tfoot "},tt:{},u:{},ul:{},"var":{},video:{}},ab,ja,p,ba,na,Ca,za,Ba,Qb=V("Buffer,clearInterval,clearTimeout,console,exports,global,module,process,querystring,require,setInterval,setTimeout,__dirname,__filename".split(","),!1),Na,Tb=V(["indexOf","lastIndexOf","search"],!0),b,g,M,tb,S,ga,Xb=V(["g","i","m"],!0),Da=function(){return this},Mb=V("defineClass,deserialize,gc,help,load,loadClass,print,quit,readFile,readUrl,runCommand,seal,serialize,spawn,sync,toint32,version".split(","),
|
85
|
+
!1),z,Sb=V([";",'"',"'",")"],!0),ub,H,Ib=V("Array,Boolean,Date,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Error,eval,EvalError,Function,isFinite,isNaN,JSON,Math,Number,Object,parseInt,parseFloat,RangeError,ReferenceError,RegExp,String,SyntaxError,TypeError,URIError".split(","),!1),qa,$={},bb,i,Ia,da,Oa,Rb=V("alert,animator,appleScript,beep,bytesToUIString,Canvas,chooseColor,chooseFile,chooseFolder,closeWidget,COM,convertPathToHFS,convertPathToPlatform,CustomAnimation,escape,FadeAnimation,filesystem,Flash,focusWidget,form,FormField,Frame,HotKey,Image,include,isApplicationRunning,iTunes,konfabulatorVersion,log,md5,MenuItem,MoveAnimation,openURL,play,Point,popupMenu,preferenceGroups,preferences,print,prompt,random,Rectangle,reloadWidget,ResizeAnimation,resolvePath,resumeUpdates,RotateAnimation,runCommand,runCommandInBg,saveAs,savePreferences,screen,ScrollBar,showWidgetPreferences,sleep,speak,Style,suppressUpdates,system,tellWidget,Text,TextArea,Timer,unescape,updateNow,URL,Web,widget,Window,XMLDOM,XMLHttpRequest,yahooCheckLogin,yahooLogin,yahooLogout".split(","),
|
86
|
+
!0),Pb=V("ActiveXObject,CScript,Debug,Enumerator,System,VBArray,WScript,WSH".split(","),!1),r,Q,Yb=/@cc|<\/?|script|\]\s*\]|<\s*!|</i,Zb=/\r\n?|\n/,$b=/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,ac=/[\[\]\/\\"'*<>.&:(){}+=#]/,Jb=/^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-:]*|[0-9]+|--)/,Kb=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,ib=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,bc=/\*\/|\/\*/,
|
87
|
+
Bb=/[\u0000-\u001f'\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,cc=/[>&]|<[\/!]?|--/,dc=/[^a-zA-Z0-9+\-_\/. ]/,ec=/^\s*([(){}\[\]\?.,:;'"~#@`]|={1,3}|\/(\*(jslint|properties|property|members?|globals?)?|=|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|[\^%]=?|&[&=]?|\|[|=]?|>{1,3}=?|<(?:[\/=!]|\!(\[|--)?|<=?)?|\!={0,2}|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+(?:[xX][0-9a-fA-F]+|\.[0-9]*)?(?:[eE][+\-]?[0-9]+)?)/,lb=/&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto|script/i,
|
88
|
+
fc={outer:Jb,html:Jb,style:/^\s*([{}:#%.=,>+\[\]@()"';]|[*$\^~]=|[a-zA-Z_][a-zA-Z0-9_\-]*|[0-9]+|<\/|\/\*)/,styleproperty:/^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/};"function"!==typeof Array.prototype.filter&&(Array.prototype.filter=function(a){var b,d=this.length,c=[],e;for(b=0;b<d;b+=1)try{e=this[b],a(e)&&c.push(e)}catch(g){}return c});"function"!==typeof Array.prototype.forEach&&(Array.prototype.forEach=function(a){var b,d=this.length;for(b=0;b<d;b=b+1)try{a(this[b])}catch(c){}});
|
89
|
+
"function"!==typeof Array.isArray&&(Array.isArray=function(a){return Object.prototype.toString.apply(a)==="[object Array]"});Object.prototype.hasOwnProperty.call(Object,"create")||(Object.create=function(a){vb.prototype=a;return new vb});"function"!==typeof Object.keys&&(Object.keys=function(a){var b=[],d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&b.push(d);return b});"function"!==typeof String.prototype.entityify&&(String.prototype.entityify=function(){return this.replace(/&/g,"&").replace(/</g,
|
90
|
+
"<").replace(/>/g,">")});"function"!==typeof String.prototype.isAlpha&&(String.prototype.isAlpha=function(){return this>="a"&&this<="z\uffff"||this>="A"&&this<="Z\uffff"});"function"!==typeof String.prototype.isDigit&&(String.prototype.isDigit=function(){return this>="0"&&this<="9"});"function"!==typeof String.prototype.supplant&&(String.prototype.supplant=function(a){return this.replace(/\{([^{}]*)\}/g,function(b,d){var c=a[d];return typeof c==="string"||typeof c==="number"?c:b})});Ca=function(){function a(){var a;
|
91
|
+
if(o>=za.length)return false;m=1;n=za[o];o=o+1;a=n.search(/ \t/);a>=0&&q("mixed",o,a+1);n=n.replace(/\t/g,bb);a=n.search($b);a>=0&&q("unsafe",o,a);g.maxlen&&g.maxlen<n.length&&q("too_long",o,n.length);return true}function b(a,f){var d,c;(a==="(string)"||a==="(range)")&&ib.test(f)&&q("url",o,l);c=Object.create($[a==="(punctuator)"||a==="(identifier)"&&Object.prototype.hasOwnProperty.call($,f)?f:a]||$["(error)"]);if(a==="(identifier)"){c.identifier=true;f==="__iterator__"||f==="__proto__"?J("reserved_a",
|
92
|
+
o,l,f):!g.nomen&&(f.charAt(0)==="_"||f.charAt(f.length-1)==="_")&&q("dangling_a",o,l,f)}if(a==="(number)")c.number=+f;else if(f!==void 0)c.string=""+f;c.line=o;c.from=l;c.thru=m;tb=(d=c.id)&&("(,=:[!&|?{};".indexOf(d.charAt(d.length-1))>=0||d==="return"||d==="case");return c}function d(d){function c(a){var b=parseInt(n.substr(h+1,a),16);h=h+a;b>=32&&b<=126&&b!==34&&b!==92&&b!==39&&q("unexpected_a",o,m,"\\");m=m+a;e=String.fromCharCode(b)}var e,h=0,i="";na&&d!=='"'&&q("expected_a",o,m,'"');if(Q===
|
93
|
+
d||r==="scriptstring"&&!Q)return b("(punctuator)",d);for(;;){for(;h>=n.length;){h=0;(r!=="html"||!a())&&J("unclosed",o,l)}e=n.charAt(h);if(e===d){m=m+1;n=n.slice(h+1);i=b("(string)",i);i.quote=d;return i}if(e<" "){if(e==="\n"||e==="\r")break;q("control_a",o,m+h,n.slice(0,h))}else if(e===Q)q("bad_html",o,m+h);else if(e==="<")g.safe&&r==="html"?q("adsafe_a",o,m+h,e):n.charAt(h+1)==="/"&&(r||g.safe)?q("expected_a_b",o,m,"<\\/","</"):n.charAt(h+1)==="!"&&(r||g.safe)&&q("unexpected_a",o,m,"<!");else if(e===
|
94
|
+
"\\")if(r==="html")g.safe&&q("adsafe_a",o,m+h,e);else if(r==="styleproperty"){h=h+1;m=m+1;e=n.charAt(h);e!==d&&q("unexpected_a",o,m,"\\")}else{h=h+1;m=m+1;e=n.charAt(h);switch(e){case "":g.es5||q("es5",o,m);a();h=-1;break;case Q:q("bad_html",o,m+h);break;case "'":na&&q("unexpected_a",o,m,"\\'");break;case "u":c(4);break;case "v":na&&q("unexpected_a",o,m,"\\v");e="\v";break;case "x":na&&q("unexpected_a",o,m,"\\x");c(2);break;default:typeof Hb[e]!=="string"?q(e>="0"&&e<="7"?"octal_a":"unexpected_a",
|
95
|
+
o,m,"\\"+e):e=Hb[e]}}i=i+e;m=m+1;h=h+1}}function c(a){La||ub||r&&r!=="script"&&r!=="style"&&r!=="styleproperty"?q("unexpected_comment",o,m):r==="script"&&/<\//i.test(n)?q("unexpected_a",o,m,"</"):g.safe&&Yb.test(a)&&q("dangerous_comment",o,m)}function e(){for(var a,d,c=0,i="",j=0;;){a=true;h=n.charAt(j);j=j+1;switch(h){case "":J("unclosed_regexp",o,l);return;case "/":c>0&&q("unescaped_a",o,l+j,"/");h=n.slice(0,j-1);for(a=Object.create(Xb);;){c=n.charAt(j);if(a[c]!==true)break;a[c]=false;j=j+1;i=i+
|
96
|
+
c}n.charAt(j).isAlpha()&&J("unexpected_a",o,l,n.charAt(j));m=m+j;n=n.slice(j);j=n.charAt(0);(j==="/"||j==="*")&&J("confusing_regexp",o,l);j=b("(regexp)",h);j.flag=i;return j;case "\\":h=n.charAt(j);h<" "?q("control_a",o,l+j,""+h):h==="<"&&q(E.unexpected_a,o,l+j,"\\");j=j+1;break;case "(":c=c+1;a=false;if(n.charAt(j)==="?"){j=j+1;switch(n.charAt(j)){case ":":case "=":case "!":j=j+1;break;default:q(E.expected_a_b,o,l+j,":",n.charAt(j))}}break;case "|":a=false;break;case ")":c===0?q("unescaped_a",o,
|
97
|
+
l+j,")"):c=c-1;break;case " ":for(k=1;n.charAt(j)===" ";){j=j+1;k=k+1}k>1&&q("use_braces",o,l+j,k);break;case "[":h=n.charAt(j);if(h==="^"){j=j+1;g.regexp?n.charAt(j)==="]"&&J("unescaped_a",o,l+j,"^"):q("insecure_a",o,l+j,h)}d=false;if(h==="]"){q("empty_class",o,l+j-1);d=true}a:do{h=n.charAt(j);j=j+1;switch(h){case "[":case "^":q("unescaped_a",o,l+j,h);d=true;break;case "-":if(d)d=false;else{q("unescaped_a",o,l+j,"-");d=true}break;case "]":d||q("unescaped_a",o,l+j-1,"-");break a;case "\\":h=n.charAt(j);
|
98
|
+
h<" "?q(E.control_a,o,l+j,""+h):h==="<"&&q(E.unexpected_a,o,l+j,"\\");j=j+1;d=true;break;case "/":q("unescaped_a",o,l+j-1,"/");d=true;break;case "<":if(r==="script"){h=n.charAt(j);(h==="!"||h==="/")&&q(E.html_confusion_a,o,l+j,h)}d=true;break;default:d=true}}while(h);break;case ".":g.regexp||q("insecure_a",o,l+j,h);break;case "]":case "?":case "{":case "}":case "+":case "*":q("unescaped_a",o,l+j,h);break;case "<":if(r==="script"){h=n.charAt(j);(h==="!"||h==="/")&&q(E.html_confusion_a,o,l+j,h)}}if(a)switch(n.charAt(j)){case "?":case "+":case "*":j=
|
99
|
+
j+1;n.charAt(j)==="?"&&(j=j+1);break;case "{":j=j+1;h=n.charAt(j);(h<"0"||h>"9")&&q(E.expected_number_a,o,l+j,h);j=j+1;for(d=+h;;){h=n.charAt(j);if(h<"0"||h>"9")break;j=j+1;d=+h+d*10}a=d;if(h===","){j=j+1;a=Infinity;h=n.charAt(j);if(h>="0"&&h<="9"){j=j+1;for(a=+h;;){h=n.charAt(j);if(h<"0"||h>"9")break;j=j+1;a=+h+a*10}}}n.charAt(j)!=="}"?q(E.expected_a_b,o,l+j,"}",h):j=j+1;n.charAt(j)==="?"&&(j=j+1);d>a&&q(E.not_greater,o,l+j,d,a)}}h=n.slice(0,j-1);m=m+j;n=n.slice(j);return b("(regexp)",h)}var m,h,
|
100
|
+
l,p,o,k,n;return{init:function(b){za=typeof b==="string"?b.split(Zb):b;o=0;a();l=1},range:function(a,d){var c,e="";l=m;for(n.charAt(0)!==a&&J("expected_a_b",o,m,a,n.charAt(0));;){n=n.slice(1);m=m+1;c=n.charAt(0);switch(c){case "":J("missing_a",o,m,c);break;case d:n=n.slice(1);m=m+1;return b("(range)",e);case Q:case "\\":q("unexpected_a",o,m,c)}e=e+c}},token:function(){for(var k,y,t;;){for(;!n;)if(!a())return b("(end)");for(;r==="outer";){y=n.search(cc);if(y===0)break;else if(y>0){m=m+1;n=n.slice(y);
|
101
|
+
break}else if(!a())return b("(end)","")}k=(fc[r]||ec).exec(n);t=void 0;if(k){p=k[0].length;t=k[1];h=t.charAt(0);n=n.slice(p);l=m+p-t.length;m=m+p}else t=void 0;if(t){k=t.charAt(0);if(k.isAlpha()||k==="_"||k==="$")return b("(identifier)",t);if(k.isDigit()){y=t;k=void 0;r!=="style"&&r!=="styleproperty"&&n.charAt(0).isAlpha()&&q("expected_space_a_b",o,m,h,n.charAt(0));if(h==="0"){k=y.charAt(1);k.isDigit()?i.id!=="."&&r!=="styleproperty"&&q("unexpected_a",o,m,y):na&&(k==="x"||k==="X")&&q("unexpected_a",
|
102
|
+
o,m,"0x")}y.slice(y.length-1)==="."&&q("trailing_decimal_a",o,m,y);if(r!=="style"){k=+y;isFinite(k)||q("bad_number",o,m,y);y=k}return b("(number)",y)}switch(t){case '"':case "'":return d(t);case "//":c(n);n="";break;case "/*":for(;;){y=n.search(bc);if(y>=0)break;c(n);a()||J("unclosed_comment",o,m)}c(n.slice(0,y));m=m+(y+2);n.charAt(y)==="/"&&J("nested_comment",o,m);n=n.slice(y+2);break;case "":break;case "/":i.id==="/="&&J(E.slash_equal,o,l);return tb?e():b("(punctuator)",t);case "<\!--":for(p=o;;){y=
|
103
|
+
n.indexOf("--");if(y>=0)break;y=n.indexOf("<!");y>=0&&J("nested_comment",o,m+y);a()||J("unclosed_comment",p,k)}p=n.indexOf("<!");p>=0&&p<y&&J("nested_comment",o,m+p);m=m+y;n.charAt(y+2)!==">"&&J("expected_a",o,m,"--\>");m=m+3;n=n.slice(y+3);break;case "#":if(r==="html"||r==="styleproperty"){for(;;){k=n.charAt(0);if((k<"0"||k>"9")&&(k<"a"||k>"f")&&(k<"A"||k>"F"))break;m=m+1;n=n.slice(1);t=t+k}t.length!==4&&t.length!==7&&q("bad_color_a",o,l+p,t);return b("(color)",t)}return b("(punctuator)",t);default:if(r===
|
104
|
+
"outer"&&k==="&"){m=m+1;for(n=n.slice(1);;){k=n.charAt(0);m=m+1;n=n.slice(1);if(k===";")break;k>="0"&&k<="9"||k>="a"&&k<="z"||k==="#"||J("bad_entity",o,l+p,m)}break}return b("(punctuator)",t)}}else if(n)if(n.charAt(0)===" "){g.white||q("unexpected_a",o,m,"(space)");m=m+1;n=""}else J("unexpected_a",o,m,n.charAt(0))}}}}();ma=function(){var a=this.id,f=La,d=p;La=true;p=null;b.line===i.line&&b.from===i.thru&&c("missing_space_a_b",b,v(i),v());Ba.length>0&&c("unexpected_a",this);switch(a){case "/*properties":case "/*property":case "/*members":case "/*member":a:for(g.properties=
|
105
|
+
true;;){if(b.id!=="(string)"&&!b.identifier)break a;a=b.string;e();if(b.id===":")for(;;){e();if(b.id!=="(string)"&&!b.identifier)break}ga[a]=0;if(b.id!==",")break a;e(",")}break;case "/*jslint":g.safe&&c("adsafe_a",this);for(var j;b.id==="(string)"||b.identifier;){a=b.string;qb[a]||l("unexpected_a");e();b.id!==":"&&l("expected_a_b",b,":",v());e(":");if(typeof qb[a]==="number"){j=b.number;(j>qb[a]||j<=0||Math.floor(j)!==j)&&l("expected_small_a");g[a]=j}else b.id==="true"?g[a]=true:b.id==="false"?g[a]=
|
106
|
+
false:l("unexpected_a");e();b.id===","&&e(",")}xb();break;case "/*globals":case "/*global":g.safe&&c("adsafe_a",this);a:for(;;){if(b.id!=="(string)"&&!b.identifier)break a;a=b.string;e();j=false;if(b.id===":"){e(":");switch(b.id){case "true":j=M[a]!==false;e("true");break;case "false":e("false");break;default:l("unexpected_a")}}M[a]=j;if(b.id!==",")break a;e(",")}break;default:l("unexpected_a",this)}La=f;e("*/");p=d};$["(identifier)"]={id:"(identifier)",lbp:0,identifier:!0,nud:function(){var a=this.string,
|
107
|
+
b=z[a];if(typeof b!=="object"){b=M[a];if(typeof b==="boolean"){Aa[a]=b={string:a,writeable:b,funct:X};X[a]="var"}else{g.undef||c("used_before_a",i);z[a]=b={string:a,writeable:true,funct:h};h[a]="undef"}}b=b.funct;if(h===b)switch(h[a]){case "becoming":c("unexpected_a",i);h[a]="var";break;case "unused":h[a]="var";break;case "unparam":h[a]="parameter";break;case "unction":h[a]="function";break;case "label":c("a_label",i,a)}else switch(h[a]){case "closure":case "function":case "var":case "unused":c("a_scope",
|
108
|
+
i,a);break;case "label":c("a_label",i,a);break;case "outer":case "global":break;default:switch(b[a]){case "becoming":case "closure":case "function":case "parameter":case "unction":case "unused":case "var":b[a]="closure";h[a]=b===X?"global":"outer";break;case "unparam":b[a]="parameter";h[a]="outer";break;case "undef":h[a]="undef";break;case "label":c("a_label",i,a)}}return this},led:function(){l("expected_operator_a")}};ea("(array)","array");ea("(color)","color");ea("(function)","function");ea("(number)",
|
109
|
+
"number",Da);ea("(object)","object");ea("(string)","string",Da);ea("(boolean)","boolean",Da);ea("(range)","range");ea("(regexp)","regexp",Da);eb("(begin)");eb("(end)");eb("(error)");ra(B("</"));B("<!");B("<\!--");B("--\>");ra(B("}"));B(")");B("]");ra(B('"'));ra(B("'"));B(";");B(":");B(",");B("#");B("@");B("*/");ra(w("case"));w("catch");ra(w("default"));w("else");w("finally");fb("arguments",function(a){qa&&h===X?c("strict",a):g.safe&&c("adsafe_a",a);h["(arguments)"]=true});fb("eval",function(a){g.safe&&
|
110
|
+
c("adsafe_a",a)});va("false","boolean");va("Infinity","number");va("NaN","number");va("null","");fb("this",function(a){g.safe?c("adsafe_a",a):qa&&h["(token)"].arity==="statement"&&h["(name)"].charAt(0)>"Z"&&c("strict",a)});va("true","boolean");va("undefined","");I("?",30,function(a,f){G("?");f.first=fa(aa(a));f.second=k(0);F();D();var d=b;e(":");G(":");F();f.third=k(10);f.arity="ternary";P(f.second,f.third)?c("weird_ternary",d):P(f.first,f.second)&&c("use_or",f);D();return f});I("||",40,function(a,
|
111
|
+
b){function d(a){a.id==="&&"&&!a.paren&&c("and",a);return a}b.first=d(fa(aa(a)));b.second=d(aa(k(40)));P(b.first,b.second)&&c("weird_condition",b);return b});I("&&",50,function(a,b){b.first=fa(aa(a));b.second=aa(k(50));P(b.first,b.second)&&c("weird_condition",b);return b});L("void",function(){this.first=k(0);this.arity="prefix";g.es5?c("expected_a_b",this,"undefined","void"):this.first.number!==0&&c("expected_a_b",this.first,"0",v(this.first));return this});wa("|",70);wa("^",80);wa("&",90);ia("==",
|
112
|
+
"===");ia("===");ia("!=","!==");ia("!==");ia("<");ia(">");ia("<=");ia(">=");wa("<<",120);wa(">>",120);wa(">>>",120);I("in",120,function(a,b){c("infix_in",b);b.left=a;b.right=k(130);return b});I("instanceof",120);I("+",130,function(a,b){a.id==="(number)"?a.number===0&&c("unexpected_a",a,"0"):a.id==="(string)"&&a.string===""&&c("expected_a_b",a,"String","''");var d=k(130);d.id==="(number)"?d.number===0&&c("unexpected_a",d,"0"):d.id==="(string)"&&d.string===""&&c("expected_a_b",d,"String","''");if(a.id===
|
113
|
+
d.id&&(a.id==="(string)"||a.id==="(number)")){if(a.id==="(string)"){a.string=a.string+d.string;ib.test(a.string)&&c("url",a)}else a.number=a.number+d.number;a.thru=d.thru;return a}b.first=a;b.second=d;return b});L("+","num");L("+++",function(){c("confusing_a",i);this.first=k(150);this.arity="prefix";return this});I("+++",130,function(a){c("confusing_a",i);this.first=a;this.second=k(130);return this});I("-",130,function(a,b){(a.id==="(number)"&&a.number===0||a.id==="(string)")&&c("unexpected_a",a);
|
114
|
+
var d=k(130);(d.id==="(number)"&&d.number===0||d.id==="(string)")&&c("unexpected_a",d);if(a.id===d.id&&a.id==="(number)"){a.number=a.number-d.number;a.thru=d.thru;return a}b.first=a;b.second=d;return b});L("-");L("---",function(){c("confusing_a",i);this.first=k(150);this.arity="prefix";return this});I("---",130,function(a){c("confusing_a",i);this.first=a;this.second=k(130);return this});I("*",140,function(a,b){(a.id==="(number)"&&(a.number===0||a.number===1)||a.id==="(string)")&&c("unexpected_a",
|
115
|
+
a);var d=k(140);(d.id==="(number)"&&(d.number===0||d.number===1)||d.id==="(string)")&&c("unexpected_a",d);if(a.id===d.id&&a.id==="(number)"){a.number=a.number*d.number;a.thru=d.thru;return a}b.first=a;b.second=d;return b});I("/",140,function(a,b){(a.id==="(number)"&&a.number===0||a.id==="(string)")&&c("unexpected_a",a);var d=k(140);(d.id==="(number)"&&(d.number===0||d.number===1)||d.id==="(string)")&&c("unexpected_a",d);if(a.id===d.id&&a.id==="(number)"){a.number=a.number/d.number;a.thru=d.thru;return a}b.first=
|
116
|
+
a;b.second=d;return b});I("%",140,function(a,b){(a.id==="(number)"&&(a.number===0||a.number===1)||a.id==="(string)")&&c("unexpected_a",a);var d=k(140);(d.id==="(number)"&&d.number===0||d.id==="(string)")&&c("unexpected_a",d);if(a.id===d.id&&a.id==="(number)"){a.number=a.number%d.number;a.thru=d.thru;return a}b.first=a;b.second=d;return b});Ab("++");L("++");Ab("--");L("--");L("delete",function(){u();var a=k(0);(!a||a.id!=="."&&a.id!=="[")&&c("deleted");this.first=a;return this});L("~",function(){A();
|
117
|
+
g.bitwise||c("unexpected_a",this);k(150);return this});L("!",function(){A();this.first=fa(k(150));this.arity="prefix";(Wb[this.first.id]===true||this.first.assign)&&c("confusing_a",this);return this});L("typeof",null);L("new",function(){u();var a=k(160),f;this.first=a;if(a.id!=="function")if(a.identifier)switch(a.string){case "Object":c("use_object",i);break;case "Array":if(b.id==="("){f=b;f.first=this;e("(");if(b.id!==")"){a=k(0);f.second=[a];for((a.id!=="(number)"||b.id===",")&&c("use_array",f);b.id===
|
118
|
+
",";){e(",");f.second.push(k(0))}}else c("use_array",i);e(")",f);return f}c("use_array",i);break;case "Number":case "String":case "Boolean":case "Math":case "JSON":c("not_a_constructor",a);break;case "Function":g.evil||c("function_eval");break;case "Date":case "RegExp":case "this":break;default:if(a.id!=="function"){a=a.string.charAt(0);!g.newcap&&(a<"A"||a>"Z")&&c("constructor_name_a",i)}}else a.id!=="."&&a.id!=="["&&a.id!=="("&&c("bad_constructor",i);else c("weird_new",this);b.id!=="("&&c("missing_a",
|
119
|
+
b,"()");return this});I("(",160,function(a,f){var d;p&&p.mode==="expression"?s(S,i):A(S,i);!a.immed&&a.id==="function"&&c("wrap_immediate");d=[];a.identifier?a.string.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&a.string!=="Number"&&a.string!=="String"&&a.string!=="Boolean"&&a.string!=="Date"&&(a.string==="Math"||a.string==="JSON"?c("not_a_function",a):a.string==="Object"?c("use_object",i):(a.string==="Array"||!g.newcap)&&c("missing_a",a,"new")):a.id==="."&&(g.safe&&a.first.string==="Math"&&
|
120
|
+
a.second==="random"?c("adsafe_a",a):a.second.string==="split"&&a.first.id==="(string)"&&c("use_array",a.second));G();if(b.id!==")")for(s();;){C();d.push(k(10));if(b.id!==",")break;K()}s();D(")",f);if(typeof a==="object"){a.string==="parseInt"&&d.length===1&&c("radix",a);g.evil||(a.string==="eval"||a.string==="Function"||a.string==="execScript"?c("evil",a):d[0]&&d[0].id==="(string)"&&(a.string==="setTimeout"||a.string==="setInterval")&&c("implied_evil",a));!a.identifier&&a.id!=="."&&a.id!=="["&&a.id!==
|
121
|
+
"("&&a.id!=="&&"&&a.id!=="||"&&a.id!=="?"&&c("bad_invocation",a)}f.first=a;f.second=d;return f},!0);L("(",function(){G("expression");s();C();if(b.id==="function")b.immed=true;var a=k(0);a.paren=true;s();D(")",this);if(a.id==="function")switch(b.id){case "(":c("move_invocation");break;case ".":case "[":c("unexpected_a");break;default:c("bad_wrap",this)}return a});I(".",170,function(a,f){s(S,i);s();var d=Ea();typeof d==="string"&&Ta(d);f.first=a;f.second=i;if(a&&a.string==="arguments"&&(d==="callee"||
|
122
|
+
d==="caller"))c("avoid_a",a,"arguments."+d);else if(!g.evil&&a&&a.string==="document"&&(d==="write"||d==="writeln"))c("write_is_wrong",a);else if(g.adsafe){if(!Ka&&a.string==="ADSAFE")if(d==="id"||d==="lib")c("adsafe_a",f);else if(d==="go"){r!=="script"?c("adsafe_a",f):(la||b.id!=="("||R(0).id!=="(string)"||R(0).string!==U||R(1).id!==",")&&l("adsafe_a",f,"go");la=true;Ja=false}Ka=false}if(!g.evil&&(d==="eval"||d==="execScript"))c("evil");else if(g.safe)for(;;){Sa[d]===true&&c("adsafe_a",i,d);if(typeof M[a.string]!==
|
123
|
+
"boolean"||b.id==="(")break;if(b.id!=="."){c("adsafe_a",f);break}e(".");i.first=f;i.second=d;f=i;d=Ea();typeof d==="string"&&Ta(d)}return f},!0);I("[",170,function(a,b){var d,e;A(S,i);s();G();C();d=k(0);switch(d.id){case "(number)":d.id==="(number)"&&a.id==="arguments"&&c("use_param",a);break;case "(string)":if(g.safe&&(Sa[d.string]||d.string.charAt(0)==="_"||d.string.slice(-1)==="_"))c("adsafe_subscript_a",d);else if(!g.evil&&(d.string==="eval"||d.string==="execScript"))c("evil",d);else if(!g.sub&&
|
124
|
+
Kb.test(d.string)){e=$[d.string];(!e||!e.reserved)&&c("subscript",d)}Ta(d.string);break;default:g.safe&&c("adsafe_subscript_a",d)}D("]",b);s(S,i);b.first=a;b.second=d;return b},!0);L("[",function(){this.arity="prefix";this.first=[];for(G("array");b.id!=="(end)";){for(;b.id===",";){c("unexpected_a",b);e(",")}if(b.id==="]")break;p.wrap=false;C();this.first.push(k(10));if(b.id===","){K();if(b.id==="]"&&!g.es5){c("unexpected_a",i);break}}else break}D("]",this);return this},170);Y("=");Y("+=","+");Y("-=",
|
125
|
+
"-");Y("*=","*");Y("/=","/").nud=function(){l("slash_equal")};Y("%=","%");Y("&=","&");Y("|=","|");Y("^=","^");Y("<<=","<<");Y(">>=",">>");Y(">>>=",">>>");L("{",function(){var a,f,d,j,oa,m={};this.arity="prefix";this.first=[];for(G();b.id!=="}";){p.wrap=false;C();if(b.string==="get"&&R().id!==":"){g.es5||c("es5");a=b;e("get");ua();j=b;(f=jb())||l("missing_property");a.string="";Ua(a);h["(loopage)"]&&c("function_loop",a);(d=a.first)&&d.length&&c("parameter_a_get_b",d[0],d[0].string,f);K();oa=b;F();
|
126
|
+
C();e("set");oa.string="";ua();d=jb();f!==d&&l("expected_a_b",i,f,d||b.string);Ua(oa);oa.block.length===0&&c("missing_a",i,"throw");d=oa.first;!d||d.length!==1?l("parameter_set_a",oa,"value"):d[0].string!=="value"&&l("expected_a_b",d[0],"value",d[0].string);j.first=[a,oa]}else{j=b;f=jb();typeof f!=="string"&&l("missing_property");e(":");F();j.first=k(10)}this.first.push(j);m[f]===true&&c("duplicate_a",b,f);m[f]=true;Ta(f);if(b.id!==",")break;for(;;){K();if(b.id!==",")break;c("unexpected_a",b)}b.id===
|
127
|
+
"}"&&!g.es5&&c("unexpected_a",i)}D("}",this);return this});N("{",function(){c("statement_block");this.arity="statement";this.block=sa();this.disrupt=this.block.disrupt;e("}",this);return this});N("/*global",ma);N("/*globals",ma);N("/*jslint",ma);N("/*member",ma);N("/*members",ma);N("/*property",ma);N("/*properties",ma);N("var",function(){var a,f,d;h["(vars)"]&&!g.vars?c("combine_var"):h!==X&&(h["(vars)"]=true);this.arity="statement";this.first=[];for(G("var");;){d=b;f=Ea();ta(d,"becoming");if(b.id===
|
128
|
+
"="){a=b;a.first=d;F();e("=");F();b.id==="undefined"&&c("unnecessary_initialize",i,f);R(0).id==="="&&b.identifier&&l("var_a_not");a.second=k(0);a.arity="infix";this.first.push(a)}else this.first.push(d);h[f]==="becoming"&&(h[f]="unused");if(b.id!==",")break;K();p.wrap=false;if(da&&b.line===i.line&&this.first.length===1){da=null;p.open=false;p.at=p.at-g.indent}F();C()}da=null;D();return this});N("function",function(){u();ja&&c("function_block",i);var a=b,f=Ea();ta(a,"unction");s();this.arity="statement";
|
129
|
+
Ua(this,f);b.id==="("&&b.line===i.line&&l("function_statement");return this});L("function",function(){g.anon||u();var a=gb();a?s():a="";Ua(this,a);h["(loopage)"]&&c("function_loop");switch(b.id){case ";":case "(":case ")":case ",":case "]":case "}":case ":":break;case ".":(R().string!=="bind"||R(1).id!=="(")&&c("unexpected_a");break;default:l("unexpected_a")}this.arity="function";return this});N("if",function(){var a=b;u();e("(");G("control");s();C();this.arity="statement";this.first=fa(aa(k(0)));
|
130
|
+
s();D(")",a);u();this.block=Z(true);if(b.id==="else"){u();e("else");u();this["else"]=b.id==="if"||b.id==="switch"?hb(true):Z(true);if(this["else"].disrupt&&this.block.disrupt)this.disrupt=true}return this});N("try",function(){var a,f,d;g.adsafe&&c("adsafe_a",this);u();this.arity="statement";this.block=Z(false);if(b.id==="catch"){u();e("catch");u();d=b;e("(");G("control");s();C();f=z;z=Object.create(f);this.first=a=b.string;b.identifier?ta(b,"exception"):c("expected_identifier_a",b);e();s();D(")",
|
131
|
+
d);u();this.second=Z(false);z=f}if(b.id==="finally"){u();e("finally");u();this.third=Z(false)}else this.second||l("expected_a_b",b,"catch",v());return this});Qa("while",function(){u();var a=b;h["(breakage)"]=h["(breakage)"]+1;h["(loopage)"]=h["(loopage)"]+1;e("(");G("control");s();C();this.arity="statement";this.first=aa(k(0));this.first.id!=="true"&&fa(this.first,E.unexpected_a);s();D(")",a);u();this.block=Z(true);this.block.disrupt&&c("strange_loop",S);h["(breakage)"]=h["(breakage)"]-1;h["(loopage)"]=
|
132
|
+
h["(loopage)"]-1;return this});w("with");Qa("switch",function(){function a(a){P(j,a)&&c("duplicate_a",a)}var f=[],d=ja,j,g=b,i=true;h["(breakage)"]=h["(breakage)"]+1;u();e("(");s();G();this.arity="statement";this.first=fa(aa(k(0)));s();D(")",g);u();e("{");G();ja=true;for(this.second=[];b.id==="case";){g=b;f.forEach(a);g.first=[];g.arity="case";F();C("case");for(e("case");;){u();j=k(0);f.forEach(a);f.push(j);g.first.push(j);j.id==="NaN"&&c("unexpected_a",j);A();e(":");if(b.id!=="case")break;F();C("case");
|
133
|
+
e("case")}F();g.second=sa();if(g.second&&g.second.length>0){j=g.second[g.second.length-1];j.disrupt?j.id==="break"&&(i=false):c("missing_a_after_b",b,"break","case")}else c("empty_case");this.second.push(g)}this.second.length===0&&c("missing_a",b,"case");if(b.id==="default"){F();g=b;g.arity="case";C("case");e("default");A();e(":");F();g.second=sa();if(g.second&&g.second.length>0){j=g.second[g.second.length-1];if(i&&j.disrupt&&j.id!=="break")this.disrupt=true}this.second.push(g)}h["(breakage)"]=h["(breakage)"]-
|
134
|
+
1;F();D("}",this);ja=d;return this});N("debugger",function(){g.debug||c("unexpected_a",this);this.arity="statement";return this});Qa("do",function(){h["(breakage)"]=h["(breakage)"]+1;h["(loopage)"]=h["(loopage)"]+1;u();this.arity="statement";this.block=Z(true);this.block.disrupt&&c("strange_loop",S);u();e("while");var a=b;u();e("(");G();s();C();this.first=fa(aa(k(0)),E.unexpected_a);s();D(")",a);h["(breakage)"]=h["(breakage)"]-1;h["(loopage)"]=h["(loopage)"]-1;return this});Qa("for",function(){var a,
|
135
|
+
f,d=false;a=b;this.arity="statement";h["(breakage)"]=h["(breakage)"]+1;h["(loopage)"]=h["(loopage)"]+1;e("(");if(b.id===";"){s();e(";");s();e(";");s();e(")");a=Z(true)}else{G("control");F(this,a);s();b.id==="var"&&l("move_var");C();if(R(0).id==="in"){this.forin=true;f=b;switch(h[f.string]){case "unused":h[f.string]="var";break;case "closure":case "var":break;default:c("bad_in_a",f)}e();e("in");this.first=f;this.second=k(20);D(")",a);a=Z(true);if(!g.forin){if(a.length===1&&typeof a[0]==="object"&&
|
136
|
+
a[0].string==="if"&&!a[0]["else"]){for(f=a[0].first;f.id==="&&";)f=f.first;switch(f.id){case "===":case "!==":d=f.first.id==="["?f.first.first.string===this.second.string&&f.first.second.string===this.first.string:f.first.id==="typeof"&&f.first.first.id==="["&&f.first.first.first.string===this.second.string&&f.first.first.second.string===this.first.string;break;case "(":d=f.first.id==="."&&(f.first.first.string===this.second.string&&f.first.second.string==="hasOwnProperty"&&f.second[0].string===this.first.string||
|
137
|
+
f.first.first.string==="ADSAFE"&&f.first.second.string==="has"&&f.second[0].string===this.second.string&&f.second[1].string===this.first.string||f.first.first.id==="."&&f.first.first.first.id==="."&&f.first.first.first.first.string==="Object"&&f.first.first.first.second.string==="prototype"&&f.first.first.second.string==="hasOwnProperty"&&f.first.second.string==="call"&&f.second[0].string===this.second.string&&f.second[1].string===this.first.string)}}d||c("for_if",this)}}else{C();for(this.first=[];;){this.first.push(k(0,
|
138
|
+
"for"));if(b.id!==",")break;K()}O();C();this.second=aa(k(0));this.second.id!=="true"&&fa(this.second,E.unexpected_a);O(i);b.id===";"&&l("expected_a_b",b,")",";");this.third=[];for(C();;){this.third.push(k(0,"for"));if(b.id!==",")break;K()}s();D(")",a);u();a=Z(true)}}a.disrupt&&c("strange_loop",S);this.block=a;h["(breakage)"]=h["(breakage)"]-1;h["(loopage)"]=h["(loopage)"]-1;return this});Ra("break",function(){var a=b.string;this.arity="statement";h["(breakage)"]===0&&c("unexpected_a",this);if(b.identifier&&
|
139
|
+
i.line===b.line){ua();h[a]!=="label"?c("not_a_label",b):z[a].funct!==h&&c("not_a_scope",b);this.first=b;e()}return this});Ra("continue",function(){g["continue"]||c("unexpected_a",this);var a=b.string;this.arity="statement";h["(breakage)"]===0&&c("unexpected_a",this);if(b.identifier&&i.line===b.line){ua();h[a]!=="label"?c("not_a_label",b):z[a].funct!==h&&c("not_a_scope",b);this.first=b;e()}return this});Ra("return",function(){h===X&&r!=="scriptstring"&&c("unexpected_a",this);this.arity="statement";
|
140
|
+
if(b.id!==";"&&b.line===i.line){ua();(b.id==="/"||b.id==="(regexp)")&&c("wrap_regexp");this.first=k(20)}R(0).id==="}"&&R(1).id==="else"&&c("unexpected_else",this);return this});Ra("throw",function(){this.arity="statement";ua();this.first=k(20);return this});w("class");w("const");w("enum");w("export");w("extends");w("import");w("super");w("implements");w("interface");w("let");w("package");w("private");w("protected");w("public");w("static");w("yield");nb=[ka,function(){for(;;)if(b.identifier)switch(b.string.toLowerCase()){case "url":ka();
|
141
|
+
break;case "expression":c("unexpected_a");e();break;default:e()}else{if(b.id===";"||b.id==="!"||b.id==="(end)"||b.id==="}")return true;e()}}];ya="none,dashed,dotted,double,groove,hidden,inset,outset,ridge,solid".split(",");sb=["auto","always","avoid","left","right"];Gb={all:!0,braille:!0,embossed:!0,handheld:!0,print:!0,projection:!0,screen:!0,speech:!0,tty:!0,tv:!0};$a=["auto","hidden","scroll","visible"];Ya={background:[!0,"background-attachment","background-color","background-image","background-position",
|
142
|
+
"background-repeat"],"background-attachment":["scroll","fixed"],"background-color":["transparent",ha],"background-image":["none",ka],"background-position":[2,[x,"top","bottom","left","right","center"]],"background-repeat":["repeat","repeat-x","repeat-y","no-repeat"],border:[!0,"border-color","border-style","border-width"],"border-bottom":[!0,"border-bottom-color","border-bottom-style","border-bottom-width"],"border-bottom-color":ha,"border-bottom-left-radius":Xa,"border-bottom-right-radius":Xa,"border-bottom-style":ya,
|
143
|
+
"border-bottom-width":xa,"border-collapse":["collapse","separate"],"border-color":["transparent",4,ha],"border-left":[!0,"border-left-color","border-left-style","border-left-width"],"border-left-color":ha,"border-left-style":ya,"border-left-width":xa,"border-radius":function(){function a(a){var d=1;a&&e(a);if(!x())return false;for(;b.id==="(number)";){if(!x())return false;d=d+1}d>4&&c("bad_style");return true}return a()&&(b.id!=="/"||a("/"))},"border-right":[!0,"border-right-color","border-right-style",
|
144
|
+
"border-right-width"],"border-right-color":ha,"border-right-style":ya,"border-right-width":xa,"border-spacing":[2,x],"border-style":[4,ya],"border-top":[!0,"border-top-color","border-top-style","border-top-width"],"border-top-color":ha,"border-top-left-radius":Xa,"border-top-right-radius":Xa,"border-top-style":ya,"border-top-width":xa,"border-width":[4,xa],bottom:[x,"auto"],"caption-side":["bottom","left","right","top"],clear:["both","left","none","right"],clip:[function(){var a;if(b.identifier&&
|
145
|
+
b.string==="rect"){e();e("(");for(a=0;a<4;a=a+1)if(!x()){c("expected_number_a");break}e(")");return true}return false},"auto"],color:ha,content:["open-quote","close-quote","no-open-quote","no-close-quote",Ga,ka,function(){if(b.identifier&&b.string==="counter"){e();e("(");e();if(b.id===","){K();b.id!=="(string)"&&c("expected_string_a");e()}e(")");return true}if(b.identifier&&b.string==="counters"){e();e("(");b.identifier||c("expected_name_a");e();if(b.id===","){K();b.id!=="(string)"&&c("expected_string_a");
|
146
|
+
e()}if(b.id===","){K();b.id!=="(string)"&&c("expected_string_a");e()}e(")");return true}return false},function(){if(b.identifier&&b.string==="attr"){e();e("(");b.identifier||c("expected_name_a");e();e(")");return true}return false}],"counter-increment":[Fa,"none"],"counter-reset":[Fa,"none"],cursor:[ka,"auto","crosshair","default","e-resize","help","move","n-resize","ne-resize","nw-resize","pointer","s-resize","se-resize","sw-resize","w-resize","text","wait"],direction:["ltr","rtl"],display:"block,compact,inline,inline-block,inline-table,list-item,marker,none,run-in,table,table-caption,table-cell,table-column,table-column-group,table-footer-group,table-header-group,table-row,table-row-group".split(","),
|
147
|
+
"empty-cells":["show","hide"],"float":["left","none","right"],font:["caption","icon","menu","message-box","small-caption","status-bar",!0,"font-size","font-style","font-weight","font-family"],"font-family":function(){for(;b.id!==";";){!Fa()&&!Ga()&&c("expected_name_a");if(b.id!==",")return true;K()}},"font-size":["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller",x],"font-size-adjust":["none",Wa],"font-stretch":"normal,wider,narrower,ultra-condensed,extra-condensed,condensed,semi-condensed,semi-expanded,expanded,extra-expanded".split(","),
|
148
|
+
"font-style":["normal","italic","oblique"],"font-variant":["normal","small-caps"],"font-weight":["normal","bold","bolder","lighter",Wa],height:[x,"auto"],left:[x,"auto"],"letter-spacing":["normal",x],"line-height":["normal",function(){if(b.id==="-"){e("-");A()}if(b.id==="(number)"){e();if(b.id!=="(string)"&&Cb[b.string]===true){A();e()}return true}return false}],"list-style":[!0,"list-style-image","list-style-position","list-style-type"],"list-style-image":["none",ka],"list-style-position":["inside",
|
149
|
+
"outside"],"list-style-type":"circle,disc,square,decimal,decimal-leading-zero,lower-roman,upper-roman,lower-greek,lower-alpha,lower-latin,upper-alpha,upper-latin,hebrew,katakana,hiragana-iroha,katakana-oroha,none".split(","),margin:[4,Ha],"margin-bottom":Ha,"margin-left":Ha,"margin-right":Ha,"margin-top":Ha,"marker-offset":[x,"auto"],"max-height":[x,"none"],"max-width":[x,"none"],"min-height":x,"min-width":x,opacity:Wa,outline:[!0,"outline-color","outline-style","outline-width"],"outline-color":["invert",
|
150
|
+
ha],"outline-style":"dashed,dotted,double,groove,inset,none,outset,ridge,solid".split(","),"outline-width":xa,overflow:$a,"overflow-x":$a,"overflow-y":$a,padding:[4,x],"padding-bottom":x,"padding-left":x,"padding-right":x,"padding-top":x,"page-break-after":sb,"page-break-before":sb,position:["absolute","fixed","relative","static"],quotes:[8,Ga],right:[x,"auto"],"table-layout":["auto","fixed"],"text-align":["center","justify","left","right"],"text-decoration":["none","underline","overline","line-through",
|
151
|
+
"blink"],"text-indent":x,"text-shadow":["none",4,[ha,x]],"text-transform":["capitalize","uppercase","lowercase","none"],top:[x,"auto"],"unicode-bidi":["normal","embed","bidi-override"],"vertical-align":["baseline","bottom","sub","super","top","text-top","middle","text-bottom",x],visibility:["visible","hidden","collapse"],"white-space":"normal,nowrap,pre,pre-line,pre-wrap,inherit".split(","),width:[x,"auto"],"word-spacing":["normal",x],"word-wrap":["break-word","normal"],"z-index":["auto",Wa]};ba=
|
152
|
+
function(a,f){var d,j,k;JSLINT.errors=[];JSLINT.tree="";rb=S=i=b=Object.create($["(begin)"]);M={};ca(Ib);ga={};if(f){g=Object.create(f);if(j=g.predef)if(Array.isArray(j))for(d=0;d<j.length;d=d+1)M[j[d]]=true;else typeof j==="object"&&ca(j);if(g.adsafe)g.safe=true;if(g.safe){g.browser=g["continue"]=g.css=g.debug=g.devel=g.evil=g.forin=g.newcap=g.nomen=g.on=g.rhino=g.sloppy=g.sub=g.undef=g.widget=g.windows=false;delete M.Array;delete M.Date;delete M.Function;delete M.Object;delete M.eval;ca({ADSAFE:false,
|
153
|
+
lib:false})}}else g={};g.indent=+g.indent||4;g.maxerr=+g.maxerr||50;U="";Ja=Ka=la=false;Za={};if(g.approved)for(d=0;d<g.approved.length;d=d+1)Za[g.approved[d]]=g.approved[d];else Za.test="test";bb="";for(d=0;d<g.indent;d=d+1)bb=bb+" ";Aa=z={};X=h={"(scope)":z,"(breakage)":0,"(loopage)":0};Va=[h];La=false;ab={};ja=false;p=null;na=false;Ba=[];Na=false;tb=true;ub=false;H=null;qa=false;Ia=[];da=null;Oa=0;r="";Ca.init(a);xb();try{e();if(b.id==="(number)")l("unexpected_a");else if(b.string.charAt(0)===
|
154
|
+
"<"){a:{var m,q,x,s,o=g.white,u,n,w,y;r="html";Q="";for(H=null;;){switch(b.string){case "<":r="html";e("<");q={};n=b;s=n.string;T(s);g.cap&&(s=s.toLowerCase());n.name=s;if(!H){H=[];d=s;d!=="html"&&!g.fragment&&(d==="div"&&g.adsafe?l("adsafe_fragment"):l("expected_a_b",i,"html",d));if(g.adsafe){d==="html"&&l("adsafe_html",i);g.fragment?d!=="div"&&l("adsafe_div",i):l("adsafe_fragment",i)}g.browser=true}w=pb[s];typeof w!=="object"&&l("unrecognized_tag_a",n,s);x=w.empty;for(n.type=s;;){if(b.id==="/"){e("/");
|
155
|
+
b.id!==">"&&c("expected_a_b",b,">",v());break}if(b.id&&b.id.charAt(0)===">")break;if(!b.identifier){(b.id==="(end)"||b.id==="(error)")&&c("expected_a_b",b,">",v());c("bad_name_a")}g.white=false;F();m=b.string;g.white=o;e();!g.cap&&m!==m.toLowerCase()&&c("attribute_case_a",i);m=m.toLowerCase();Q="";Object.prototype.hasOwnProperty.call(q,m)&&c("duplicate_a",i,m);if(m.slice(0,2)==="on"){g.on||c("html_handlers");r="scriptstring";e("=");u=b.id;u!=='"'&&u!=="'"&&l("expected_a_b",b,'"',v());Q=u;y=g.white;
|
156
|
+
g.white=true;e(u);Pa();sa();g.white=y;b.id!==u&&l("expected_a_b",b,u,v());r="html";Q="";e(u);w=false}else if(m==="style"){r="scriptstring";e("=");u=b.id;u!=='"'&&u!=="'"&&l("expected_a_b",b,'"',v());r="styleproperty";Q=u;e(u);Db();r="html";Q="";e(u);w=false}else if(b.id==="="){e("=");w=b.string;!b.identifier&&b.id!=='"'&&b.id!=="'"&&b.id!=="(string)"&&b.id!=="(string)"&&b.id!=="(color)"&&c("expected_attribute_value_a",i,m);e()}else w=true;q[m]=w;d=m;j=w;var t=k=void 0;if(d==="id"){k=typeof j==="string"?
|
157
|
+
j.toUpperCase():"";ab[k]===true&&c("duplicate_a",b,j);if(/^[A-Za-z][A-Za-z0-9._:\-]*$/.test(j)){if(g.adsafe)if(U)j.slice(0,U.length)!==U?c("adsafe_prefix_a",b,U):/^[A-Z]+_[A-Z]+$/.test(j)||c("adsafe_bad_id");else{U=j;/^[A-Z]+_$/.test(j)||c("adsafe_bad_id")}}else c("bad_id_a",b,j);t=j.search(ac);t>=0&&c("unexpected_char_a_b",i,j.charAt(t),d);ab[k]=true}else if(d==="class"||d==="type"||d==="name"){t=j.search(dc);t>=0&&c("unexpected_char_a_b",i,j.charAt(t),d);ab[k]=true}else if(d==="href"||d==="background"||
|
158
|
+
d==="content"||d==="data"||d.indexOf("src")>=0||d.indexOf("url")>=0){g.safe&&lb.test(j)&&l("bad_url_a",b,j);Ia.push(j)}else d==="for"?g.adsafe&&(U?j.slice(0,U.length)!==U?c("adsafe_prefix_a",b,U):/^[A-Z]+_[A-Z]+$/.test(j)||c("adsafe_bad_id"):c("adsafe_bad_id")):d==="name"&&g.adsafe&&j.indexOf("_")>=0&&c("adsafe_name_a",b,j)}d=s;j=q;k=void 0;var B=pb[d],D=t=void 0;ub=false;B||l(E.unrecognized_tag_a,b,d===d.toLowerCase()?d:d+" (capitalization error)");if(H.length>0){d==="html"&&l("unexpected_a",i,d);
|
159
|
+
if(D=B.parent)D.indexOf(" "+H[H.length-1].name+" ")<0&&l("tag_a_in_b",i,d,D);else if(!g.adsafe&&!g.fragment){k=H.length;do{k<=0&&l("tag_a_in_b",i,d,"body");k=k-1}while(H[k].name!=="body")}}switch(d){case "div":g.adsafe&&H.length===1&&!U&&c("adsafe_missing_id");break;case "script":r="script";e(">");j.lang&&c("lang",i);g.adsafe&&H.length!==1&&c("adsafe_placement",i);if(j.src)g.adsafe&&(!Ja||!Za[j.src])&&c("adsafe_source",i);else{G(b.from);C();Pa();Ka=true;t=sa();if(g.adsafe){la&&l("adsafe_script",i);
|
160
|
+
(t.length!==1||W(t[0],"id","(")||W(t[0].first,"id",".")||W(t[0].first.first,"string","ADSAFE")||W(t[0].second[0],"string",U))&&l("adsafe_id_go");switch(t[0].first.second.string){case "id":(Ja||la||t[0].second.length!==1)&&l("adsafe_id",b);Ja=true;break;case "go":la&&l("adsafe_go");(t[0].second.length!==2||W(t[0].second[1],"id","function")||!t[0].second[1].first||W(t[0].second[1].first[0],"string","dom")||t[0].second[1].first.length>2||t[0].second[1].first.length===2&&W(t[0].second[1].first[1],"string",
|
161
|
+
"lib"))&&l("adsafe_go",b);la=true;break;default:l("adsafe_id_go")}}p=null}r="html";e("</");T("script");r="outer";break;case "style":r="style";e(">");Fb();r="html";e("</");T("style");break;case "input":switch(j.type){case "button":case "checkbox":case "radio":case "reset":case "submit":break;case "file":case "hidden":case "image":case "password":case "text":g.adsafe&&j.autocomplete!=="off"&&c("adsafe_autocomplete");break;default:c("bad_type")}break;case "applet":case "body":case "embed":case "frame":case "frameset":case "head":case "iframe":case "noembed":case "noframes":case "object":case "param":g.adsafe&&
|
162
|
+
c("adsafe_tag",b,d)}x||H.push(n);r="outer";e(">");break;case "</":r="html";e("</");b.identifier||c("bad_name_a");s=b.string;g.cap&&(s=s.toLowerCase());e();H||l("unexpected_a",b,"</"+s+">");(n=H.pop())||l("unexpected_a",b,"</"+s+">");n.name!==s&&l("expected_a_b",b,"</"+n.name+">","</"+s+">");b.id!==">"&&l("expected_a_b",b,">",v());r="outer";e(">");break;case "<!":g.safe&&c("adsafe_a");for(r="html";;){e();if(b.id===">"||b.id==="(end)")break;b.string.indexOf("--")>=0&&l("unexpected_a",b,"--");b.string.indexOf("<")>=
|
163
|
+
0&&l("unexpected_a",b,"<");b.string.indexOf(">")>=0&&l("unexpected_a",b,">")}r="outer";e(">");break;case "(end)":H.length!==0&&c("missing_a",b,"</"+H.pop().string+">");break a;default:b.id==="(end)"?l("missing_a",b,"</"+H[H.length-1].string+">"):e()}if(H&&H.length===0&&(g.adsafe||!g.fragment||b.id==="(end)"))break}b.id!=="(end)"&&l("unexpected_a")}g.adsafe&&!la&&c("adsafe_go",this)}else switch(b.id){case "{":case "[":na=true;kb();break;case "@":case "*":case "#":case ".":case ":":r="style";e();(i.id!==
|
164
|
+
"@"||!b.identifier||b.string!=="charset"||i.line!==1||i.from!==1)&&l("css");e();b.id!=="(string)"&&b.string!=="UTF-8"&&l("css");e();O();Fb();break;default:g.adsafe&&g.fragment&&l("expected_a_b",b,"<div>",v());G(1);b.id===";"&&!Na&&O();Ka=true;k=sa();rb.first=k;JSLINT.tree=rb;g.adsafe&&(k.length!==1||W(k[0],"id","(")||W(k[0].first,"id",".")||W(k[0].first.first,"string","ADSAFE")||W(k[0].first.second,"string","lib")||k[0].second.length!==2||k[0].second[0].id!=="(string)"||W(k[0].second[1],"id","function"))&&
|
165
|
+
l("adsafe_lib");k.disrupt&&c("weird_program",S)}p=null;e("(end)")}catch(A){A&&JSLINT.errors.push({reason:A.message,line:A.line||b.line,character:A.character||b.from},null)}return JSLINT.errors.length===0};ba.data=function(){var a={functions:[]},b,d,c,e,g,h=[],i=[];if(ba.errors.length)a.errors=ba.errors;if(na)a.json=true;if(Ia.length>0)a.urls=Ia;b=Object.keys(Aa).filter(function(a){return a.charAt(0)!=="("&&typeof Ib[a]!=="boolean"});if(b.length>0)a.globals=b;for(d=1;d<Va.length;d=d+1){g=Va[d];b={};
|
166
|
+
for(c=0;c<Ma.length;c=c+1)b[Ma[c]]=[];for(e in g)if(Object.prototype.hasOwnProperty.call(g,e)&&e.charAt(0)!=="("){c=g[e];if(c==="unction"||c==="unparam")c="unused";if(Array.isArray(b[c])){b[c].push(e);c==="unused"?i.push({name:e,line:g["(line)"],"function":g["(name)"]}):c==="undef"&&h.push({name:e,line:g["(line)"],"function":g["(name)"]})}}for(c=0;c<Ma.length;c=c+1)b[Ma[c]].length===0&&delete b[Ma[c]];b.name=g["(name)"];b.params=g["(params)"];b.line=g["(line)"];a.functions.push(b)}if(i.length>0)a.unused=
|
167
|
+
i;h.length>0&&(a.undefined=h);for(e in ga)if(typeof ga[e]==="number"){a.member=ga;break}return a};ba.report=function(a){function b(a,c){var d,e;if(Array.isArray(c)){k.push("<div><i>"+a+"</i> ");c.sort().forEach(function(a){if(a!==e){e=a;k.push((d?", ":"")+e);d=true}});k.push("</div>")}else c&&k.push("<div><i>"+a+"</i> "+c+"</div>")}var d=ba.data(),c,e,g,h,i;e="";var l,k=[];if(d.errors||d.unused||d.undefined){c=true;k.push("<div id=errors><i>Error:</i>");if(d.errors)for(g=0;g<d.errors.length;g=g+1)if(h=
|
168
|
+
d.errors[g]){e=h.evidence||"";k.push("<p>Problem"+(isFinite(h.line)?" at line "+h.line+" character "+(""+h.character):"")+": "+h.reason.entityify()+"</p><p class=evidence>"+(e&&(e.length>80?e.slice(0,77)+"...":e).entityify())+"</p>")}if(d.undefined){e=[];for(g=0;g<d.undefined.length;g=g+1)e[g]="<code><u>"+d.undefined[g].name+"</u></code> <i>"+(""+d.undefined[g].line)+" </i> <small>"+d.undefined[g]["function"]+"</small>";k.push("<p><i>Undefined variable:</i> "+e.join(", ")+"</p>")}if(d.unused){e=
|
169
|
+
[];for(g=0;g<d.unused.length;g=g+1)e[g]="<code><u>"+d.unused[g].name+"</u></code> <i>"+(""+d.unused[g].line)+" </i> <small>"+d.unused[g]["function"]+"</small>";k.push("<p><i>Unused variable:</i> "+e.join(", ")+"</p>")}d.json&&k.push("<p>JSON: bad.</p>");k.push("</div>")}if(!a){k.push("<br><div id=functions>");d.urls&&b("URLs<br>",d.urls,"<br>");r==="style"?k.push("<p>CSS.</p>"):d.json&&!c?k.push("<p>JSON: good.</p>"):d.globals?k.push("<div><i>Global</i> "+d.globals.sort().join(", ")+"</div>"):
|
170
|
+
k.push("<div><i>No new global variables introduced.</i></div>");for(g=0;g<d.functions.length;g=g+1){c=d.functions[g];e=[];if(c.params)for(a=0;a<c.params.length;a=a+1)e[a]=c.params[a].string;k.push("<br><div class=function><i>"+c.line+"</i> "+c.name.entityify()+"("+e.join(", ")+")</div>");b("<big><b>Undefined</b></big>",c.undefined);b("<big><b>Unused</b></big>",c.unused);b("Closure",c.closure);b("Variable",c["var"]);b("Exception",c.exception);b("Outer",c.outer);b("Global",c.global);b("Label",c.label)}if(d.member){i=
|
171
|
+
Object.keys(d.member);if(i.length){i=i.sort();k.push("<br><pre id=properties>/*properties<br>");e=" ";a=c=0;l=false;for(g=0;g<i.length;g=g+1){h=i[g];if(d.member[h]>0){l&&(e=e+", ");l=Kb.test(h)?h:"'"+h.entityify().replace(Bb,wb)+"'";if(d.member[h]===1){l="<i>"+l+"</i>";c=c+1;a=1}if(e.length+l.length-c*7>80){k.push(e+"<br>");e=" ";c=a}e=e+l;a=0;l=true}}k.push(e+"<br>*/</pre>")}k.push("</div>")}}return k.join("")};ba.jslint=ba;ba.edition="2012-03-15";return ba}();
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'drb'
|
2
|
+
require 'bullring/util/network'
|
3
|
+
|
4
|
+
# Acts like a druby connection to a separate process (which this class will
|
5
|
+
# run if it isn't already running or if it dies). The separate process must
|
6
|
+
# start a druby server and expose an front object.
|
7
|
+
#
|
8
|
+
module Bullring
|
9
|
+
class DrubiedProcess
|
10
|
+
|
11
|
+
# options looks like:
|
12
|
+
#
|
13
|
+
# {
|
14
|
+
# :process => {
|
15
|
+
# :host => [the hostname / IP address that the process listens on],
|
16
|
+
# :port => [the port that the process listens on],
|
17
|
+
# :command => [the command to run the process],
|
18
|
+
# :args => [the arguments to the process command]
|
19
|
+
# }
|
20
|
+
# }
|
21
|
+
#
|
22
|
+
def initialize(options)
|
23
|
+
@options = options
|
24
|
+
connect_to_process!
|
25
|
+
end
|
26
|
+
|
27
|
+
def alive?
|
28
|
+
begin
|
29
|
+
@process.nil? || @process.alive?
|
30
|
+
rescue DRb::DRbConnError
|
31
|
+
return false
|
32
|
+
rescue # things like name errors, in case server doesn't have an alive? method
|
33
|
+
true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def restart_if_needed!
|
38
|
+
alive? || connect_to_process!
|
39
|
+
end
|
40
|
+
|
41
|
+
def method_missing(m, *args, &block)
|
42
|
+
restart_if_needed!
|
43
|
+
# @process.method_missing(m, args, block)
|
44
|
+
@process.send(m, *args, &block)
|
45
|
+
end
|
46
|
+
|
47
|
+
def process_port_active?
|
48
|
+
Network::is_port_in_use?(@options[:process][:host],@options[:process][:port])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates a druby connection to the process, starting it up if necessary
|
52
|
+
def connect_to_process!
|
53
|
+
if !process_port_active?
|
54
|
+
Process.spawn([@options[:process][:command], @options[:process][:args]].flatten.join(" "))
|
55
|
+
|
56
|
+
while (!process_port_active?)
|
57
|
+
sleep(0.2)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
DRb.start_service "druby://localhost:0"
|
62
|
+
@process = DRbObject.new nil, "druby://#{@options[:process][:host]}:#{@options[:process][:port]}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module Bullring
|
3
|
+
|
4
|
+
class SecurityTransgression < StandardError; end
|
5
|
+
class AbstractMethodCalled < StandardError; end
|
6
|
+
class NotYetImplemented < StandardError; end
|
7
|
+
class IllegalArgument < StandardError; end
|
8
|
+
class IllegalState < StandardError; end
|
9
|
+
class PidDirUnavailable < StandardError; end
|
10
|
+
|
11
|
+
class JSError < StandardError
|
12
|
+
attr_accessor :cause
|
13
|
+
attr_accessor :backtrace
|
14
|
+
attr_accessor :message
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'timeout'
|
3
|
+
|
4
|
+
module Bullring
|
5
|
+
class Network
|
6
|
+
|
7
|
+
def self.is_port_in_use?(ip,port)
|
8
|
+
!is_port_open?(ip,port)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.is_port_open?(ip, port)
|
12
|
+
begin
|
13
|
+
Timeout::timeout(1) do
|
14
|
+
begin
|
15
|
+
s = TCPSocket.new(ip, port)
|
16
|
+
s.close
|
17
|
+
return false
|
18
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
19
|
+
return true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
rescue Timeout::Error
|
23
|
+
end
|
24
|
+
|
25
|
+
return true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'bullring/util/exceptions'
|
2
|
+
|
3
|
+
# TODO this class may have the common uglifier code, maybe some common
|
4
|
+
# caching code
|
5
|
+
|
6
|
+
module Bullring
|
7
|
+
class Worker
|
8
|
+
|
9
|
+
def add_library(script)
|
10
|
+
raise AbstractMethodCalled
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_library_file(filename)
|
14
|
+
raise AbstractMethodCalled
|
15
|
+
end
|
16
|
+
|
17
|
+
def check(script, options)
|
18
|
+
raise AbstractMethodCalled
|
19
|
+
end
|
20
|
+
|
21
|
+
def run(script, options)
|
22
|
+
raise AbstractMethodCalled
|
23
|
+
end
|
24
|
+
|
25
|
+
def alive?
|
26
|
+
raise AbstractMethodCalled
|
27
|
+
end
|
28
|
+
|
29
|
+
def discard
|
30
|
+
raise AbstractMethodCalled
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'bullring/workers/rhino_server_worker'
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'rhino'
|
2
|
+
require 'drb'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
module Bullring
|
6
|
+
|
7
|
+
class RhinoServer
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@library_scripts = []
|
11
|
+
configure
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(options={})
|
15
|
+
@options ||= { :run_is_sealed => false,
|
16
|
+
:run_is_restrictable => true,
|
17
|
+
:run_timeout_secs => 0.5 }
|
18
|
+
|
19
|
+
# Don't do a merge b/c jruby and ruby don't play nicely for some reason
|
20
|
+
options.each{|k,v| @options[k] = v}
|
21
|
+
|
22
|
+
@logger = options[:logger] || DummyLogger.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_library(script)
|
26
|
+
@library_scripts.push(script)
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_library_file(filename)
|
30
|
+
raise NotYetImplemented
|
31
|
+
script = read file into string
|
32
|
+
@library_scripts.push(script)
|
33
|
+
end
|
34
|
+
|
35
|
+
def check(script, options)
|
36
|
+
Rhino::Context.open do |context|
|
37
|
+
context_wrapper {context.load(File.expand_path("../../js/jslint.min.js", __FILE__))}
|
38
|
+
|
39
|
+
jslintCall = <<-RHINO_CALL
|
40
|
+
JSLINT("#{prepare_source(script)}", {devel: false,
|
41
|
+
bitwise: true,
|
42
|
+
undef: true,
|
43
|
+
continue: true,
|
44
|
+
unparam: true,
|
45
|
+
debug: true,
|
46
|
+
sloppy: true,
|
47
|
+
eqeq: true,
|
48
|
+
sub: true,
|
49
|
+
es5: true,
|
50
|
+
vars: true,
|
51
|
+
evil: true,
|
52
|
+
white: true,
|
53
|
+
forin: true,
|
54
|
+
passfail: false,
|
55
|
+
newcap: true,
|
56
|
+
nomen: true,
|
57
|
+
plusplus: true,
|
58
|
+
regexp: true,
|
59
|
+
maxerr: 50,
|
60
|
+
indent: 4});
|
61
|
+
RHINO_CALL
|
62
|
+
|
63
|
+
duration, result = context_wrapper {context.eval(jslintCall + "JSLINT.errors")}
|
64
|
+
result
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def run(script, options)
|
69
|
+
Rhino::Context.open(:sealed => @options[:run_is_sealed], :restrictable => @options[:run_is_restrictable]) do |context|
|
70
|
+
@library_scripts.each do |library|
|
71
|
+
context_wrapper {context.eval(library)}
|
72
|
+
end
|
73
|
+
|
74
|
+
context.timeout_limit = @options[:run_timeout_secs]
|
75
|
+
|
76
|
+
duration, result = context_wrapper {context.eval(script)}
|
77
|
+
result
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def alive?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
def kill
|
86
|
+
DRb.stop_service
|
87
|
+
exit
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.start(myPort, clientPort)
|
91
|
+
DRb.start_service "druby://localhost:#{myPort}", Bullring::RhinoServer.new
|
92
|
+
DRb.thread.join
|
93
|
+
end
|
94
|
+
|
95
|
+
protected
|
96
|
+
|
97
|
+
def context_wrapper
|
98
|
+
begin
|
99
|
+
start_time = Time.now
|
100
|
+
result = yield
|
101
|
+
duration = Time.now - start_time
|
102
|
+
|
103
|
+
@logger.debug("Ran script (#{duration} secs); result: " + result.inspect)
|
104
|
+
|
105
|
+
return duration, result
|
106
|
+
rescue Rhino::JSError => e
|
107
|
+
@logger.debug("JSError! Cause: " + e.cause + "; Message: " + e.message)
|
108
|
+
jsError = JSError.new
|
109
|
+
jsError.cause = e.cause.to_s
|
110
|
+
jsError.message = e.message.to_s
|
111
|
+
jsError.backtrace = []
|
112
|
+
raise jsError
|
113
|
+
rescue Rhino::RunawayScriptError => e
|
114
|
+
@logger.debug("Runaway Script: " + e.inspect)
|
115
|
+
jsError = JSError.new
|
116
|
+
jsError.cause = "Script took too long to run"
|
117
|
+
raise jsError
|
118
|
+
rescue NameError => e
|
119
|
+
@logger.debug("Name error: " + e.inspect)
|
120
|
+
rescue Exception => e
|
121
|
+
@logger.debug("Exception: " + e.inspect)
|
122
|
+
raise e
|
123
|
+
rescue Error => e
|
124
|
+
@logger.debug("Error: " + e.inspect)
|
125
|
+
raise e
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
ESCAPE_MAP = {
|
130
|
+
'\\' => '\\\\',
|
131
|
+
"\r\n" => '\n',
|
132
|
+
"\n" => '\n',
|
133
|
+
"\r" => '\n',
|
134
|
+
'"' => '\"',
|
135
|
+
"'" => '\''
|
136
|
+
}
|
137
|
+
|
138
|
+
def prepare_source(source)
|
139
|
+
# escape javascript characters (similar to Rails escape_javascript)
|
140
|
+
source.gsub!(/(\\|\r\n|[\n\r"'])/u) {|match| ESCAPE_MAP[match] }
|
141
|
+
source
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
class JSError < StandardError
|
147
|
+
attr_accessor :cause
|
148
|
+
attr_accessor :backtrace
|
149
|
+
attr_accessor :message
|
150
|
+
end
|
151
|
+
|
152
|
+
class DummyLogger
|
153
|
+
def method_missing(m, *args, &block)
|
154
|
+
# ignore
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# Handle command line arguments
|
162
|
+
#
|
163
|
+
|
164
|
+
command = ARGV[0]
|
165
|
+
myPort = ARGV[1]
|
166
|
+
clientPort = ARGV[2]
|
167
|
+
|
168
|
+
case command
|
169
|
+
when "start"
|
170
|
+
Bullring::RhinoServer.start(myPort, clientPort)
|
171
|
+
end
|
172
|
+
|