From 14f0f7ebda008bd25105e56ef49b1f4ae9470621 Mon Sep 17 00:00:00 2001 From: Forrest Oliphant Date: Sat, 25 Oct 2014 18:22:43 +0100 Subject: [PATCH] also mirobot --- index.html | 22 +++++++---- js/worker-javascript.js | 1 - turtle-mirobot.js | 37 ++++++++++++++++++ turtle-svg-worker.js => turtle-parse.js | 51 +++++++------------------ turtle-svg.js | 16 +++++++- 5 files changed, 80 insertions(+), 47 deletions(-) delete mode 100644 js/worker-javascript.js create mode 100644 turtle-mirobot.js rename turtle-svg-worker.js => turtle-parse.js (76%) diff --git a/index.html b/index.html index ed4c976..8620e11 100644 --- a/index.html +++ b/index.html @@ -110,19 +110,24 @@ - - - + + + + - + +
// Press CMD + ENTER to run. -for(var i=0; i<50000; i++) { - turnLeft(0.1-Math.random()*0.2); - moveForward(1); +var points = 5; +for (var i=0; i<points; i++) { + moveForward(50); + turnLeft(1/points); + moveForward(50); + turnRight(2*(1/points)); }
@@ -158,6 +163,9 @@
+
+ +
diff --git a/js/worker-javascript.js b/js/worker-javascript.js deleted file mode 100644 index 5f0639f..0000000 --- a/js/worker-javascript.js +++ /dev/null @@ -1 +0,0 @@ -function initBaseUrls(a){require.tlns=a}function initSender(){var a=require(null,"ace/lib/event_emitter").EventEmitter,b=require(null,"ace/lib/oop"),c=function(){};return function(){b.implement(this,a),this.callback=function(a,b){postMessage({type:"call",id:b,data:a})},this.emit=function(a,b){postMessage({type:"event",name:a,data:b})}}.call(c.prototype),new c}"no use strict";var console={log:function(a){postMessage({type:"log",data:a})}},window={console:console},normalizeModule=function(a,b){if(b.indexOf("!")!==-1){var c=b.split("!");return normalizeModule(a,c[0])+"!"+normalizeModule(a,c[1])}if(b.charAt(0)=="."){var d=a.split("/").slice(0,-1).join("/"),b=d+"/"+b;while(b.indexOf(".")!==-1&&e!=b)var e=b,b=b.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return b},require=function(a,b){var b=normalizeModule(a,b),c=require.modules[b];if(c)return c.initialized||(c.initialized=!0,c.exports=c.factory().exports),c.exports;var d=b.split("/");d[0]=require.tlns[d[0]]||d[0];var e=d.join("/")+".js";return require.id=b,importScripts(e),require(a,b)};require.modules={},require.tlns={};var define=function(a,b,c){arguments.length==2?(c=b,typeof a!="string"&&(b=a,a=require.id)):arguments.length==1&&(c=a,a=require.id);if(a.indexOf("text!")===0)return;var d=function(b,c){return require(a,b,c)};require.modules[a]={factory:function(){var a={exports:{}},b=c(d,a.exports,a);return b&&(a.exports=b),a}}},main,sender;onmessage=function(a){var b=a.data;if(b.command)main[b.command].apply(main,b.args);else if(b.init){initBaseUrls(b.tlns),require(null,"ace/lib/fixoldbrowsers"),sender=initSender();var c=require(null,b.module)[b.classname];main=new c(sender)}else b.event&&sender&&sender._emit(b.event,b.data)},define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(a,b,c){a("./regexp"),a("./es5-shim")}),define("ace/lib/regexp",["require","exports","module"],function(a,b,c){function g(a){return(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":"")}function h(a,b,c){if(Array.prototype.indexOf)return a.indexOf(b,c);for(var d=c||0;d1&&h(b,"")>-1&&(i=RegExp(this.source,d.replace.call(g(this),"g","")),d.replace.call(a.slice(b.index),i,function(){for(var a=1;ab.index&&this.lastIndex--}return b},f||(RegExp.prototype.test=function(a){var b=d.exec.call(this,a);return b&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--,!!b})}),define("ace/lib/es5-shim",["require","exports","module"],function(a,b,c){function p(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(b){}}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=g.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,h=c.apply(f,d.concat(g.call(arguments)));return h!==null&&Object(h)===h?h:f}return c.apply(b,d.concat(g.call(arguments)))};return e});var d=Function.prototype.call,e=Array.prototype,f=Object.prototype,g=e.slice,h=d.bind(f.toString),i=d.bind(f.hasOwnProperty),j,k,l,m,n;if(n=i(f,"__defineGetter__"))j=d.bind(f.__defineGetter__),k=d.bind(f.__defineSetter__),l=d.bind(f.__lookupGetter__),m=d.bind(f.__lookupSetter__);Array.isArray||(Array.isArray=function(b){return h(b)=="[object Array]"}),Array.prototype.forEach||(Array.prototype.forEach=function(b){var c=G(this),d=arguments[1],e=0,f=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;while(e>>0,e=Array(d),f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g>>0,e=[],f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e=0,f;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);for(;e>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e,f=d-1;if(arguments.length>=2)e=arguments[1];else do{if(f in c){e=c[f--];break}if(--f<0)throw new TypeError}while(!0);do f in this&&(e=b.call(void 0,e,c[f],f,c));while(f--);return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(b){var c=G(this),d=c.length>>>0;if(!d)return-1;var e=0;arguments.length>1&&(e=E(arguments[1])),e=e>=0?e:Math.max(0,d+e);for(;e>>0;if(!d)return-1;var e=d-1;arguments.length>1&&(e=Math.min(e,E(arguments[1]))),e=e>=0?e:d-Math.abs(e);for(;e>=0;e--)if(e in c&&b===c[e])return e;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(b){return b.__proto__||(b.constructor?b.constructor.prototype:f)});if(!Object.getOwnPropertyDescriptor){var o="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(b,c){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(o+b);if(!i(b,c))return;var d,e,g;d={enumerable:!0,configurable:!0};if(n){var h=b.__proto__;b.__proto__=f;var e=l(b,c),g=m(b,c);b.__proto__=h;if(e||g)return e&&(d.get=e),g&&(d.set=g),d}return d.value=b[c],d}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(b){return Object.keys(b)}),Object.create||(Object.create=function(b,c){var d;if(b===null)d={__proto__:null};else{if(typeof b!="object")throw new TypeError("typeof prototype["+typeof b+"] != 'object'");var e=function(){};e.prototype=b,d=new e,d.__proto__=b}return c!==void 0&&Object.defineProperties(d,c),d});if(Object.defineProperty){var q=p({}),r=typeof document=="undefined"||p(document.createElement("div"));if(!q||!r)var s=Object.defineProperty}if(!Object.defineProperty||s){var t="Property description must be an object: ",u="Object.defineProperty called on non-object: ",v="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(b,c,d){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(u+b);if(typeof d!="object"&&typeof d!="function"||d===null)throw new TypeError(t+d);if(s)try{return s.call(Object,b,c,d)}catch(e){}if(i(d,"value"))if(n&&(l(b,c)||m(b,c))){var g=b.__proto__;b.__proto__=f,delete b[c],b[c]=d.value,b.__proto__=g}else b[c]=d.value;else{if(!n)throw new TypeError(v);i(d,"get")&&j(b,c,d.get),i(d,"set")&&k(b,c,d.set)}return b}}Object.defineProperties||(Object.defineProperties=function(b,c){for(var d in c)i(c,d)&&Object.defineProperty(b,d,c[d]);return b}),Object.seal||(Object.seal=function(b){return b}),Object.freeze||(Object.freeze=function(b){return b});try{Object.freeze(function(){})}catch(w){Object.freeze=function(b){return function(c){return typeof c=="function"?c:b(c)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(b){return b}),Object.isSealed||(Object.isSealed=function(b){return!1}),Object.isFrozen||(Object.isFrozen=function(b){return!1}),Object.isExtensible||(Object.isExtensible=function(b){if(Object(b)===b)throw new TypeError;var c="";while(i(b,c))c+="?";b[c]=!0;var d=i(b,c);return delete b[c],d});if(!Object.keys){var x=!0,y=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],z=y.length;for(var A in{toString:null})x=!1;Object.keys=function H(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var H=[];for(var b in a)i(a,b)&&H.push(b);if(x)for(var c=0,d=z;c9999?"+":"")+("00000"+Math.abs(e)).slice(0<=e&&e<=9999?-4:-6),c=b.length;while(c--)d=b[c],d<10&&(b[c]="0"+d);return e+"-"+b.slice(0,2).join("-")+"T"+b.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toJSON||(Date.prototype.toJSON=function(b){if(typeof this.toISOString!="function")throw new TypeError;return this.toISOString()}),Date.parse("+275760-09-13T00:00:00.000Z")!==864e13&&(Date=function(a){var b=function e(b,c,d,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=j==1&&String(b)===b?new a(e.parse(b)):j>=7?new a(b,c,d,f,g,h,i):j>=6?new a(b,c,d,f,g,h):j>=5?new a(b,c,d,f,g):j>=4?new a(b,c,d,f):j>=3?new a(b,c,d):j>=2?new a(b,c):j>=1?new a(b):new a;return k.constructor=e,k}return a.apply(this,arguments)},c=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(?:Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$");for(var d in a)b[d]=a[d];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(d){var e=c.exec(d);if(e){e.shift();for(var f=1;f<7;f++)e[f]=+(e[f]||(f<3?1:0)),f==1&&e[f]--;var g=+e.pop(),h=+e.pop(),i=e.pop(),j=0;if(i){if(h>23||g>59)return NaN;j=(h*60+g)*6e4*(i=="+"?-1:1)}var k=+e[0];return 0<=k&&k<=99?(e[0]=k+400,a.UTC.apply(this,e)+j-126227808e5):a.UTC.apply(this,e)+j}return a.parse.apply(this,arguments)},b}(Date));var B=" \n \f\r   ᠎              \u2028\u2029";if(!String.prototype.trim||B.trim()){B="["+B+"]";var C=new RegExp("^"+B+B+"*"),D=new RegExp(B+B+"*$");String.prototype.trim=function(){return String(this).replace(C,"").replace(D,"")}}var E=function(a){return a=+a,a!==a?a=0:a!==0&&a!==1/0&&a!==-Infinity&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a},F="a"[0]!="a",G=function(a){if(a==null)throw new TypeError;return F&&typeof a=="string"&&a?a.split(""):Object(a)}}),define("ace/lib/event_emitter",["require","exports","module"],function(a,b,c){var d={};d._emit=d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{},this._defaultHandlers=this._defaultHandlers||{};var c=this._eventRegistry[a]||[],d=this._defaultHandlers[a];if(!c.length&&!d)return;b=b||{},b.type||(b.type=a),b.stopPropagation||(b.stopPropagation=function(){this.propagationStopped=!0}),b.preventDefault||(b.preventDefault=function(){this.defaultPrevented=!0});for(var e=0;e=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length),a},this.insert=function(a,b){if(!b||b.length===0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b),d=c.splice(0,1)[0],e=c.length==0?null:c.splice(c.length-1,1)[0];return a=this.insertInLine(a,d),e!==null&&(a=this.insertNewLine(a),a=this.insertLines(a.row,c),a=this.insertInLine(a,e||"")),a},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};if(b.length>65535){var c=this.insertLines(a,b.slice(65535));b=b.slice(0,65535)}var d=[a,0];d.push.apply(d,b),this.$lines.splice.apply(this.$lines,d);var e=new f(a,0,a+b.length,0),g={action:"insertLines",range:e,lines:b};return this._emit("change",{data:g}),c||e.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};return this._emit("change",{data:d}),c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};return this._emit("change",{data:e}),d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.getLine(b).length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b==c)return;var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};return this._emit("change",{data:i}),d.start},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};return this._emit("change",{data:e}),d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._emit("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(h.prototype),b.Document=h}),define("ace/range",["require","exports","module"],function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.isEqual=function(a){return this.start.row==a.start.row&&this.end.row==a.end.row&&this.start.column==a.start.column&&this.end.column==a.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compareRange=function(a){var b,c=a.end,d=a.start;return b=this.compare(c.row,c.column),b==1?(b=this.compare(d.row,d.column),b==1?2:b==0?1:0):b==-1?-2:(b=this.compare(d.row,d.column),b==-1?-1:b==1?42:0)},this.comparePoint=function(a){return this.compare(a.row,a.column)},this.containsRange=function(a){return this.comparePoint(a.start)==0&&this.comparePoint(a.end)==0},this.intersects=function(a){var b=this.compareRange(a);return b==-1||b==0||b==1},this.isEnd=function(a,b){return this.end.row==a&&this.end.column==b},this.isStart=function(a,b){return this.start.row==a&&this.start.column==b},this.setStart=function(a,b){typeof a=="object"?(this.start.column=a.column,this.start.row=a.row):(this.start.row=a,this.start.column=b)},this.setEnd=function(a,b){typeof a=="object"?(this.end.column=a.column,this.end.row=a.row):(this.end.row=a,this.end.column=b)},this.inside=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)||this.isStart(a,b)?!1:!0:!1},this.insideStart=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)?!1:!0:!1},this.insideEnd=function(a,b){return this.compare(a,b)==0?this.isStart(a,b)?!1:!0:!1},this.compare=function(a,b){return!this.isMultiLine()&&a===this.start.row?bthis.end.column?1:0:athis.end.row?1:this.start.row===a?b>=this.start.column?0:-1:this.end.row===a?b<=this.end.column?0:1:0},this.compareStart=function(a,b){return this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.compareEnd=function(a,b){return this.end.row==a&&this.end.column==b?1:this.compare(a,b)},this.compareInside=function(a,b){return this.end.row==a&&this.end.column==b?1:this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.rowthis.row)return;if(c.start.row==this.row&&c.start.column>this.column)return;var d=this.row,e=this.column;b.action==="insertText"?c.start.row===d&&c.start.column<=e?c.start.row===c.end.row?e+=c.end.column-c.start.column:(e-=c.start.column,d+=c.end.row-c.start.row):c.start.row!==c.end.row&&c.start.row=e?e=c.start.column:e=Math.max(0,e-(c.end.column-c.start.column)):c.start.row!==c.end.row&&c.start.row=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,b))),b<0&&(c.column=0),c}}).call(f.prototype)}),define("ace/lib/lang",["require","exports","module"],function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return(new Array(b+1)).join(a)};var d=/^\s\s*/,e=/\s\s*$/;b.stringTrimLeft=function(a){return a.replace(d,"")},b.stringTrimRight=function(a){return a.replace(e,"")},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.copyArray=function(a){var b=[];for(var c=0,d=a.length;c=B.maxerr&&gb("Too many errors.",i,h),j}function jb(a,b,c,d,e,f,g){return ib(a,{line:b,from:c},d,e,f,g)}function kb(a,b,c,d,e,f){var g=ib(a,b,c,d,e,f)}function lb(a,b,c,d,e,f,g){return kb(a,{line:b,from:c},d,e,f,g)}function nb(a,b){a==="hasOwnProperty"&&ib("'hasOwnProperty' is a really bad name."),cb(k,a)&&!k["(global)"]&&(k[a]===!0?B.latedef&&ib("'{a}' was used before it was defined.",y,a):!B.shadow&&b!=="exception"&&ib("'{a}' is already defined.",y,a)),k[a]=b,k["(global)"]?(n[a]=k,cb(o,a)&&(B.latedef&&ib("'{a}' was used before it was defined.",y,a),delete o[a])):H[a]=k}function ob(){var a,b,d,e=y.value,f,g;switch(e){case"*/":kb("Unbegun comment.");break;case"/*members":case"/*member":e="/*members",w||(w={}),b=w;break;case"/*jshint":case"/*jslint":b=B,d=c;break;case"/*global":b=C;break;default:kb("What?")}f=mb.token();a:for(;;){for(;;){if(f.type==="special"&&f.value==="*/")break a;if(f.id!=="(endline)"&&f.id!==",")break;f=mb.token()}f.type!=="(string)"&&f.type!=="(identifier)"&&e!=="/*members"&&kb("Bad option.",f),g=mb.token(),g.id===":"?(g=mb.token(),b===w&&kb("Expected '{a}' and instead saw '{b}'.",f,"*/",":"),e==="/*jshint"&&db(f.value,f),f.value!=="indent"||e!=="/*jshint"&&e!=="/*jslint"?f.value!=="maxerr"||e!=="/*jshint"&&e!=="/*jslint"?f.value!=="maxlen"||e!=="/*jshint"&&e!=="/*jslint"?f.value==="validthis"?k["(global)"]?kb("Option 'validthis' can't be used in a global scope."):g.value==="true"||g.value==="false"?b[f.value]=g.value==="true":kb("Bad option value.",g):g.value==="true"?b[f.value]=!0:g.value==="false"?b[f.value]=!1:kb("Bad option value.",g):(a=+g.value,(typeof a!="number"||!isFinite(a)||a<=0||Math.floor(a)!==a)&&kb("Expected a small integer and instead saw '{a}'.",g,g.value),b.maxlen=a):(a=+g.value,(typeof a!="number"||!isFinite(a)||a<=0||Math.floor(a)!==a)&&kb("Expected a small integer and instead saw '{a}'.",g,g.value),b.maxerr=a):(a=+g.value,(typeof a!="number"||!isFinite(a)||a<=0||Math.floor(a)!==a)&&kb("Expected a small integer and instead saw '{a}'.",g,g.value),b.white=!0,b.indent=a),f=mb.token()):((e==="/*jshint"||e==="/*jslint")&&kb("Missing option value.",f),b[f.value]=!1,f=g)}d&&fb()}function pb(a){var b=a||0,c=0,d;while(c<=b)d=u[c],d||(d=u[c]=mb.token()),c+=1;return d}function qb(b,c){switch(P.id){case"(number)":y.id==="."&&ib("A dot following a number can be confused with a decimal point.",P);break;case"-":(y.id==="-"||y.id==="--")&&ib("Confusing minusses.");break;case"+":(y.id==="+"||y.id==="++")&&ib("Confusing plusses.")}if(P.type==="(string)"||P.identifier)a=P.value;b&&y.id!==b&&(c?y.id==="(end)"?ib("Unmatched '{a}'.",c,c.id):ib("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",y,b,c.id,c.line,y.value):(y.type!=="(identifier)"||y.value!==b)&&ib("Expected '{a}' and instead saw '{b}'.",y,b,y.value)),E=P,P=y;for(;;){y=u.shift()||mb.token();if(y.id==="(end)"||y.id==="(error)")return;if(y.type==="special")ob();else if(y.id!=="(endline)")break}}function rb(b,c){var d,e=!1,f=!1;y.id==="(end)"&&kb("Unexpected early end of program.",P),qb(),c&&(a="anonymous",k["(verb)"]=P.value);if(c===!0&&P.fud)d=P.fud();else{if(P.nud)d=P.nud();else{if(y.type==="(number)"&&P.id===".")return ib("A leading decimal point can be confused with a dot: '.{a}'.",P,y.value),qb(),P;kb("Expected an identifier and instead saw '{a}'.",P,P.id)}while(b="a"&&b<="z"||b>="A"&&b<="Z")a.identifier=a.reserved=!0;return a}function Fb(a,b){var c=Ab(a,150);return Eb(c),c.nud=typeof b=="function"?b:function(){this.right=rb(150),this.arity="unary";if(this.id==="++"||this.id==="--")B.plusplus?ib("Unexpected use of '{a}'.",this,this.id):(!this.right.identifier||this.right.reserved)&&this.right.id!=="."&&this.right.id!=="["&&ib("Bad operand.",this);return this},c}function Gb(a,b){var c=Bb(a);return c.type=a,c.nud=b,c}function Hb(a,b){var c=Gb(a,b);return c.identifier=c.reserved=!0,c}function Ib(a,b){return Hb(a,function(){return typeof b=="function"&&b(this),this})}function Jb(a,b,c,d){var e=Ab(a,c);return Eb(e),e.led=function(e){return d||(wb(E,P),vb(P,y)),a==="in"&&e.id==="!"&&ib("Confusing use of '{a}'.",e,"!"),typeof b=="function"?b(e,this):(this.left=e,this.right=rb(c),this)},e}function Kb(a,b){var c=Ab(a,100);return c.led=function(a){wb(E,P),vb(P,y);var c=rb(100);return a&&a.id==="NaN"||c&&c.id==="NaN"?ib("Use the isNaN function to compare with NaN.",this):b&&b.apply(this,[a,c]),a.id==="!"&&ib("Confusing use of '{a}'.",a,"!"),c.id==="!"&&ib("Confusing use of '{a}'.",c,"!"),this.left=a,this.right=c,this},c}function Lb(a){return a&&(a.type==="(number)"&&+a.value===0||a.type==="(string)"&&a.value===""||a.type==="null"&&!B.eqnull||a.type==="true"||a.type==="false"||a.type==="undefined")}function Mb(a,b){return Ab(a,20).exps=!0,Jb(a,function(a,b){var c;b.left=a,C[a.value]===!1&&H[a.value]["(global)"]===!0?ib("Read only.",a):a["function"]&&ib("'{a}' is a function.",a,a.value);if(a){B.esnext&&k[a.value]==="const"&&ib("Attempting to override '{a}' which is a constant",a,a.value);if(a.id==="."||a.id==="[")return(!a.left||a.left.value==="arguments")&&ib("Bad assignment.",b),b.right=rb(19),b;if(a.identifier&&!a.reserved)return k[a.value]==="exception"&&ib("Do not assign to the exception parameter.",a),b.right=rb(19),b;a===N["function"]&&ib("Expected an identifier in an assignment and instead saw a function invocation.",P)}kb("Bad assignment.",b)},20)}function Nb(a,b,c){var d=Ab(a,c);return Eb(d),d.led=typeof b=="function"?b:function(a){return B.bitwise&&ib("Unexpected use of '{a}'.",this,this.id),this.left=a,this.right=rb(c),this},d}function Ob(a){return Ab(a,20).exps=!0,Jb(a,function(a,b){B.bitwise&&ib("Unexpected use of '{a}'.",b,b.id),vb(E,P),vb(P,y);if(a)return a.id==="."||a.id==="["||a.identifier&&!a.reserved?(rb(19),b):(a===N["function"]&&ib("Expected an identifier in an assignment, and instead saw a function invocation.",P),b);kb("Bad assignment.",b)},20)}function Pb(a,b){var c=Ab(a,150);return c.led=function(a){return B.plusplus?ib("Unexpected use of '{a}'.",this,this.id):(!a.identifier||a.reserved)&&a.id!=="."&&a.id!=="["&&ib("Bad operand.",this),this.left=a,this},c}function Qb(a){if(y.identifier)return qb(),P.reserved&&!B.es5&&(!a||P.value!=="undefined")&&ib("Expected an identifier and instead saw '{a}' (a reserved word).",P,P.id),P.value}function Rb(a){var b=Qb(a);if(b)return b;P.id==="function"&&y.id==="("?ib("Missing name in function declaration."):kb("Expected an identifier and instead saw '{a}'.",y,y.value)}function Sb(a){var b=0,c;if(y.id!==";"||A)return;for(;;){c=pb(b);if(c.reach)return;if(c.id!=="(endline)"){if(c.id==="function"){if(!B.latedef)break;ib("Inner functions should be listed at the top of the outer function.",c);break}ib("Unreachable '{a}' after '{b}'.",c,c.value,a);break}b+=1}}function Tb(a){var b=q,c,d=H,e=y;if(e.id===";"){qb(";");return}e.identifier&&!e.reserved&&pb().id===":"&&(qb(),qb(":"),H=Object.create(d),nb(e.value,"label"),y.labelled||ib("Label '{a}' on {b} statement.",y,e.value,y.value),_.test(e.value+":")&&ib("Label '{a}' looks like a javascript url.",e,e.value),y.label=e.value,e=y),a||xb(),c=rb(0,!0);if(!e.block){!B.expr&&(!c||!c.exps)?ib("Expected an assignment or function call and instead saw an expression.",P):B.nonew&&c.id==="("&&c.left.id==="new"&&ib("Do not use 'new' for side effects.");if(y.id===",")return zb();y.id!==";"?B.asi||(!B.lastsemic||y.id!=="}"||y.line!==P.line)&&jb("Missing semicolon.",P.line,P.character):(sb(P,y),qb(";"),vb(P,y))}return q=b,H=d,c}function Ub(a){var b=[],c,d;while(!y.reach&&y.id!=="(end)")y.id===";"?(d=pb(),(!d||d.id!=="(")&&ib("Unnecessary semicolon."),qb(";")):b.push(Tb(a===y.line));return b}function Vb(){var a,b,c;for(;;){if(y.id==="(string)"){b=pb(0);if(b.id==="(endline)"){a=1;do c=pb(a),a+=1;while(c.id==="(endline)");if(c.id!==";"){if(c.id!=="(string)"&&c.id!=="(number)"&&c.id!=="(regexp)"&&c.identifier!==!0&&c.id!=="}")break;ib("Missing semicolon.",y)}else b=c}else if(b.id==="}")ib("Missing semicolon.",b);else if(b.id!==";")break;xb(),qb(),M[P.value]&&ib('Unnecessary directive "{a}".',P,P.value),P.value==="use strict"&&(B.newcap=!0,B.undef=!0),M[P.value]=!0,b.id===";"&&qb(";");continue}break}}function Wb(a,b,c){var d,e=p,f=q,g,h=H,i,j,l;p=a;if(!a||!B.funcscope)H=Object.create(H);vb(P,y),i=y;if(y.id==="{"){qb("{"),j=P.line;if(y.id!=="}"){q+=B.indent;while(!a&&y.from>q)q+=B.indent;if(c){g={};for(l in M)cb(M,l)&&(g[l]=M[l]);Vb(),B.strict&&k["(context)"]["(global)"]&&!g["use strict"]&&!M["use strict"]&&ib('Missing "use strict" statement.')}d=Ub(j),c&&(M=g),q-=B.indent,j!==y.line&&xb()}else j!==y.line&&xb();qb("}",i),q=f}else a?((!b||B.curly)&&ib("Expected '{a}' and instead saw '{b}'.",y,"{",y.value),A=!0,q+=B.indent,d=[Tb(y.line===P.line)],q-=B.indent,A=!1):kb("Expected '{a}' and instead saw '{b}'.",y,"{",y.value);k["(verb)"]=null;if(!a||!B.funcscope)H=h;return p=e,a&&B.noempty&&(!d||d.length===0)&&ib("Empty block."),d}function Xb(a){w&&typeof w[a]!="boolean"&&ib("Unexpected /*member '{a}'.",P,a),typeof v[a]=="number"?v[a]+=1:v[a]=1}function Yb(a){var b=a.value,c=a.line,d=o[b];typeof d=="function"&&(d=!1),d?d[d.length-1]!==c&&d.push(c):(d=[c],o[b]=d)}function Zb(){var a=Qb(!0);return a||(y.id==="(string)"?(a=y.value,qb()):y.id==="(number)"&&(a=y.value.toString(),qb())),a}function $b(){var a,b=y,c=[];qb("("),ub();if(y.id===")"){qb(")");return}for(;;){a=Rb(!0),c.push(a),nb(a,"parameter");if(y.id!==",")return qb(")",b),ub(E,P),c;zb()}}function _b(b,c){var d,e=B,f=H;return B=Object.create(B),H=Object.create(H),k={"(name)":b||'"'+a+'"',"(line)":y.line,"(context)":k,"(breakage)":0,"(loopage)":0,"(scope)":H,"(statement)":c},d=k,P.funct=k,m.push(k),b&&nb(b,"function"),k["(params)"]=$b(),Wb(!1,!1,!0),H=f,B=e,k["(last)"]=P.line,k=k["(context)"],d}function bc(){function a(){var a={},b=y;qb("{");if(y.id!=="}")for(;;){if(y.id==="(end)")kb("Missing '}' to match '{' from line {a}.",y,b.line);else{if(y.id==="}"){ib("Unexpected comma.",P);break}y.id===","?kb("Unexpected comma.",y):y.id!=="(string)"&&ib("Expected a string and instead saw {a}.",y,y.value)}a[y.value]===!0?ib("Duplicate key '{a}'.",y,y.value):y.value==="__proto__"&&!B.proto||y.value==="__iterator__"&&!B.iterator?ib("The '{a}' key may produce unexpected results.",y,y.value):a[y.value]=!0,qb(),qb(":"),bc();if(y.id!==",")break;qb(",")}qb("}")}function b(){var a=y;qb("[");if(y.id!=="]")for(;;){if(y.id==="(end)")kb("Missing ']' to match '[' from line {a}.",y,a.line);else{if(y.id==="]"){ib("Unexpected comma.",P);break}y.id===","&&kb("Unexpected comma.",y)}bc();if(y.id!==",")break;qb(",")}qb("]")}switch(y.id){case"{":a();break;case"[":b();break;case"true":case"false":case"null":case"(number)":case"(string)":qb();break;case"-":qb("-"),P.character!==y.from&&ib("Unexpected space after '-'.",P),sb(P,y),qb("(number)");break;default:kb("Expected a JSON value.",y)}}var a,b={"<":!0,"<=":!0,"==":!0,"===":!0,"!==":!0,"!=":!0,">":!0,">=":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0},c={asi:!0,bitwise:!0,boss:!0,browser:!0,couch:!0,curly:!0,debug:!0,devel:!0,dojo:!0,eqeqeq:!0,eqnull:!0,es5:!0,esnext:!0,evil:!0,expr:!0,forin:!0,funcscope:!0,globalstrict:!0,immed:!0,iterator:!0,jquery:!0,lastsemic:!0,latedef:!0,laxbreak:!0,laxcomma:!0,loopfunc:!0,mootools:!0,multistr:!0,newcap:!0,noarg:!0,node:!0,noempty:!0,nonew:!0,nonstandard:!0,nomen:!0,onevar:!0,onecase:!0,passfail:!0,plusplus:!0,proto:!0,prototypejs:!0,regexdash:!0,regexp:!0,rhino:!0,undef:!0,scripturl:!0,shadow:!0,smarttabs:!0,strict:!0,sub:!0,supernew:!0,trailing:!0,validthis:!0,withstmt:!0,white:!0,wsh:!0},e={maxlen:!1,indent:!1,maxerr:!1,predef:!1},f={ArrayBuffer:!1,ArrayBufferView:!1,Audio:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,DataView:!1,DOMParser:!1,defaultStatus:!1,document:!1,event:!1,FileReader:!1,Float32Array:!1,Float64Array:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Image:!1,length:!1,localStorage:!1,location:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,moveBy:!1,moveTo:!1,name:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,top:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},g={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},h={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},i={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},j={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"/":"\\/","\\":"\\\\"},k,l=["closure","exception","global","label","outer","unused","var"],m,n,o,p,q,r,s={$:!1,jQuery:!1},t,u,v,w,x={$:!1,$$:!1,Assets:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,Iframe:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},y,z={__filename:!1,__dirname:!1,Buffer:!1,console:!1,exports:!1,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setTimeout:!1,clearTimeout:!1,setInterval:!1,clearInterval:!1},A,B,C,D,E,F={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},G={defineClass:!1,deserialize:!1,gc:!1,help:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},H,I,J={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},K={escape:!1,unescape:!1},L={E:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,MAX_VALUE:!0,MIN_VALUE:!0,NEGATIVE_INFINITY:!0,PI:!0,POSITIVE_INFINITY:!0,SQRT1_2:!0,SQRT2:!0},M,N={},O,P,Q,R,S,T={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},U,V,W,X,Y,Z,$,_,ab;(function(){U=/@cc|<\/?|script|\]\s*\]|<\s*!|</i,V=/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,W=/^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(jshint|jslint|members?|global)?|=|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/,X=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,Y=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Z=/\*\/|\/\*/,$=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,_=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,ab=/^\s*\/\*\s*falls\sthrough\s*\*\/\s*$/})(),typeof Array.isArray!="function"&&(Array.isArray=function(a){return Object.prototype.toString.apply(a)==="[object Array]"}),typeof Object.create!="function"&&(Object.create=function(a){return bb.prototype=a,new bb}),typeof Object.keys!="function"&&(Object.keys=function(a){var b=[],c;for(c in a)cb(a,c)&&b.push(c);return b}),typeof String.prototype.entityify!="function"&&(String.prototype.entityify=function(){return this.replace(/&/g,"&").replace(//g,">")}),typeof String.prototype.isAlpha!="function"&&(String.prototype.isAlpha=function(){return this>="a"&&this<="z￿"||this>="A"&&this<="Z￿"}),typeof String.prototype.isDigit!="function"&&(String.prototype.isDigit=function(){return this>="0"&&this<="9"}),typeof String.prototype.supplant!="function"&&(String.prototype.supplant=function(a){return this.replace(/\{([^{}]*)\}/g,function(b,c){var d=a[c];return typeof d=="string"||typeof d=="number"?d:b})}),typeof String.prototype.name!="function"&&(String.prototype.name=function(){return $.test(this)?this:X.test(this)?'"'+this.replace(Y,function(a){var b=j[a];return b?b:"\\u"+("0000"+a.charCodeAt().toString(16)).slice(-4)})+'"':'"'+this+'"'});var mb=function(){function f(){var a,c;return d>=t.length?!1:(b=1,e=t[d],d+=1,B.smarttabs?a=e.search(/ \t/):a=e.search(/ \t|\t /),a>=0&&jb("Mixed spaces and tabs.",d,a+1),e=e.replace(/\t/g,O),a=e.search(V),a>=0&&jb("Unsafe character.",d,a),B.maxlen&&B.maxlen=0||f==="return"||f==="case")),g}var b,c,d,e;return{init:function(a){typeof a=="string"?t=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n"):t=a,t[0]&&t[0].substr(0,2)==="#!"&&(t[0]=""),d=0,f(),c=1},range:function(a,f){var h,i="";c=b,e.charAt(0)!==a&&lb("Expected '{a}' and instead saw '{b}'.",d,b,a,e.charAt(0));for(;;){e=e.slice(1),b+=1,h=e.charAt(0);switch(h){case"":lb("Missing '{a}'.",d,b,h);break;case f:return e=e.slice(1),b+=1,g("(range)",i);case"\\":jb("Unexpected '{a}'.",d,b,h)}i+=h}},token:function(){function v(a){var d=a.exec(e),f;if(d)return n=d[0].length,f=d[1],h=f.charAt(0),e=e.substr(n),c=b+n-f.length,b+=n,f}function w(a){function l(a){var c=parseInt(e.substr(i+1,a),16);i+=a,c>=32&&c<=126&&c!==34&&c!==92&&c!==39&&jb("Unnecessary escapement.",d,b),b+=a,h=String.fromCharCode(c)}var h,i,j="",k=!1;r&&a!=='"'&&jb("Strings must use doublequote.",d,b),i=0;a:for(;;){while(i>=e.length){i=0;var m=d,n=c;if(!f()){lb("Unclosed string.",m,n);break a}k?k=!1:jb("Unclosed string.",m,n)}h=e.charAt(i);if(h===a)return b+=1,e=e.substr(i+1),g("(string)",j,a);if(h<" "){if(h==="\n"||h==="\r")break;jb("Control character in string: {a}.",d,b+i,e.slice(0,i))}else if(h==="\\"){i+=1,b+=1,h=e.charAt(i),u=e.charAt(i+1);switch(h){case"\\":case'"':case"/":break;case"'":r&&jb("Avoid \\'.",d,b);break;case"b":h="\b";break;case"f":h="\f";break;case"n":h="\n";break;case"r":h="\r";break;case"t":h=" ";break;case"0":h="\0",u>=0&&u<=7&&M["use strict"]&&jb("Octal literals are not allowed in strict mode.",d,b);break;case"u":l(4);break;case"v":r&&jb("Avoid \\v.",d,b),h=" ";break;case"x":r&&jb("Avoid \\x-.",d,b),l(2);break;case"":k=!0;if(B.multistr){r&&jb("Avoid EOL escapement.",d,b),h="",b-=1;break}jb("Bad escapement of EOL. Use option multistr if needed.",d,b);break;default:jb("Bad escapement.",d,b)}}j+=h,b+=1,i+=1}}var a,h,i,j,k,l,m,n,o,p,q,s,t,u;for(;;){if(!e)return g(f()?"(endline)":"(end)","");q=v(W);if(!q){q="",h="";while(e&&e<"!")e=e.substr(1);e&&(lb("Unexpected '{a}'.",d,b,e.substr(0,1)),e="")}else{if(h.isAlpha()||h==="_"||h==="$")return g("(identifier)",q);if(h.isDigit())return isFinite(Number(q))||jb("Bad number '{a}'.",d,b,q),e.substr(0,1).isAlpha()&&jb("Missing space after '{a}'.",d,b,q),h==="0"&&(j=q.substr(1,1),j.isDigit()?P.id!=="."&&jb("Don't use extra leading zeros '{a}'.",d,b,q):r&&(j==="x"||j==="X")&&jb("Avoid 0x-. '{a}'.",d,b,q)),q.substr(q.length-1)==="."&&jb("A trailing decimal point can be confused with a dot '{a}'.",d,b,q),g("(number)",q);switch(q){case'"':case"'":return w(q);case"//":e="",P.comment=!0;break;case"/*":for(;;){m=e.search(Z);if(m>=0)break;f()||lb("Unclosed comment.",d,b)}b+=m+2,e.substr(m,1)==="/"&&lb("Nested comment.",d,b),e=e.substr(m+2),P.comment=!0;break;case"/*members":case"/*member":case"/*jshint":case"/*jslint":case"/*global":case"*/":return{value:q,type:"special",line:d,character:b,from:c};case"":break;case"/":P.id==="/="&&lb("A regular expression literal can be confused with '/='.",d,c);if(D){k=0,i=0,n=0;for(;;){a=!0,h=e.charAt(n),n+=1;switch(h){case"":return lb("Unclosed regular expression.",d,c),gb("Stopping.",d,c);case"/":k>0&&jb("{a} unterminated regular expression group(s).",d,c+n,k),h=e.substr(0,n-1),p={g:!0,i:!0,m:!0};while(p[e.charAt(n)]===!0)p[e.charAt(n)]=!1,n+=1;return b+=n,e=e.substr(n),p=e.charAt(0),(p==="/"||p==="*")&&lb("Confusing regular expression.",d,c),g("(regexp)",h);case"\\":h=e.charAt(n),h<" "?jb("Unexpected control character in regular expression.",d,c+n):h==="<"&&jb("Unexpected escaped character '{a}' in regular expression.",d,c+n,h),n+=1;break;case"(":k+=1,a=!1;if(e.charAt(n)==="?"){n+=1;switch(e.charAt(n)){case":":case"=":case"!":n+=1;break;default:jb("Expected '{a}' and instead saw '{b}'.",d,c+n,":",e.charAt(n))}}else i+=1;break;case"|":a=!1;break;case")":k===0?jb("Unescaped '{a}'.",d,c+n,")"):k-=1;break;case" ":p=1;while(e.charAt(n)===" ")n+=1,p+=1;p>1&&jb("Spaces are hard to count. Use {{a}}.",d,c+n,p);break;case"[":h=e.charAt(n),h==="^"&&(n+=1,B.regexp?jb("Insecure '{a}'.",d,c+n,h):e.charAt(n)==="]"&&lb("Unescaped '{a}'.",d,c+n,"^")),h==="]"&&jb("Empty class.",d,c+n-1),s=!1,t=!1;a:do{h=e.charAt(n),n+=1;switch(h){case"[":case"^":jb("Unescaped '{a}'.",d,c+n,h),t?t=!1:s=!0;break;case"-":s&&!t?(s=!1,t=!0):t?t=!1:e.charAt(n)==="]"?t=!0:(B.regexdash!==(n===2||n===3&&e.charAt(1)==="^")&&jb("Unescaped '{a}'.",d,c+n-1,"-"),s=!0);break;case"]":t&&!B.regexdash&&jb("Unescaped '{a}'.",d,c+n-1,"-");break a;case"\\":h=e.charAt(n),h<" "?jb("Unexpected control character in regular expression.",d,c+n):h==="<"&&jb("Unexpected escaped character '{a}' in regular expression.",d,c+n,h),n+=1,/[wsd]/i.test(h)?(t&&(jb("Unescaped '{a}'.",d,c+n,"-"),t=!1),s=!1):t?t=!1:s=!0;break;case"/":jb("Unescaped '{a}'.",d,c+n-1,"/"),t?t=!1:s=!0;break;case"<":t?t=!1:s=!0;break;default:t?t=!1:s=!0}}while(h);break;case".":B.regexp&&jb("Insecure '{a}'.",d,c+n,h);break;case"]":case"?":case"{":case"}":case"+":case"*":jb("Unescaped '{a}'.",d,c+n,h)}if(a)switch(e.charAt(n)){case"?":case"+":case"*":n+=1,e.charAt(n)==="?"&&(n+=1);break;case"{":n+=1,h=e.charAt(n),(h<"0"||h>"9")&&jb("Expected a number and instead saw '{a}'.",d,c+n,h),n+=1,o=+h;for(;;){h=e.charAt(n);if(h<"0"||h>"9")break;n+=1,o=+h+o*10}l=o;if(h===","){n+=1,l=Infinity,h=e.charAt(n);if(h>="0"&&h<="9"){n+=1,l=+h;for(;;){h=e.charAt(n);if(h<"0"||h>"9")break;n+=1,l=+h+l*10}}}e.charAt(n)!=="}"?jb("Expected '{a}' and instead saw '{b}'.",d,c+n,"}",h):n+=1,e.charAt(n)==="?"&&(n+=1),o>l&&jb("'{a}' should not be greater than '{b}'.",d,c+n,o,l)}}return h=e.substr(0,n-1),b+=n,e=e.substr(n),g("(regexp)",h)}return g("(punctuator)",q);case"#":return g("(punctuator)",q);default:return g("(punctuator)",q)}}}}}}();Gb("(number)",function(){return this}),Gb("(string)",function(){return this}),N["(identifier)"]={type:"(identifier)",lbp:0,identifier:!0,nud:function(){var b=this.value,c=H[b],d;typeof c=="function"?c=undefined:typeof c=="boolean"&&(d=k,k=m[0],nb(b,"var"),c=k,k=d);if(k===c)switch(k[b]){case"unused":k[b]="var";break;case"unction":k[b]="function",this["function"]=!0;break;case"function":this["function"]=!0;break;case"label":ib("'{a}' is a statement label.",P,b)}else if(k["(global)"])B.undef&&typeof C[b]!="boolean"&&(a!=="typeof"&&a!=="delete"||y&&(y.value==="."||y.value==="["))&&hb(k,"'{a}' is not defined.",P,b),Yb(P);else switch(k[b]){case"closure":case"function":case"var":case"unused":ib("'{a}' used out of scope.",P,b);break;case"label":ib("'{a}' is a statement label.",P,b);break;case"outer":case"global":break;default:if(c===!0)k[b]=!0;else if(c===null)ib("'{a}' is not allowed.",P,b),Yb(P);else if(typeof c!="object")B.undef&&(a!=="typeof"&&a!=="delete"||y&&(y.value==="."||y.value==="["))&&hb(k,"'{a}' is not defined.",P,b),k[b]=!0,Yb(P);else switch(c[b]){case"function":case"unction":this["function"]=!0,c[b]="closure",k[b]=c["(global)"]?"global":"outer";break;case"var":case"unused":c[b]="closure",k[b]=c["(global)"]?"global":"outer";break;case"closure":case"parameter":k[b]=c["(global)"]?"global":"outer";break;case"label":ib("'{a}' is a statement label.",P,b)}}return this},led:function(){kb("Expected an operator and instead saw '{a}'.",y,y.value)}},Gb("(regexp)",function(){return this}),Bb("(endline)"),Bb("(begin)"),Bb("(end)").reach=!0,Bb(""),Bb("(error)").reach=!0,Bb("}").reach=!0,Bb(")"),Bb("]"),Bb('"').reach=!0,Bb("'").reach=!0,Bb(";"),Bb(":").reach=!0,Bb(","),Bb("#"),Bb("@"),Hb("else"),Hb("case").reach=!0,Hb("catch"),Hb("default").reach=!0,Hb("finally"),Ib("arguments",function(a){M["use strict"]&&k["(global)"]&&ib("Strict violation.",a)}),Ib("eval"),Ib("false"),Ib("Infinity"),Ib("NaN"),Ib("null"),Ib("this",function(a){M["use strict"]&&!B.validthis&&(k["(statement)"]&&k["(name)"].charAt(0)>"Z"||k["(global)"])&&ib("Possible strict violation.",a)}),Ib("true"),Ib("undefined"),Mb("=","assign",20),Mb("+=","assignadd",20),Mb("-=","assignsub",20),Mb("*=","assignmult",20),Mb("/=","assigndiv",20).nud=function(){kb("A regular expression literal can be confused with '/='.")},Mb("%=","assignmod",20),Ob("&=","assignbitand",20),Ob("|=","assignbitor",20),Ob("^=","assignbitxor",20),Ob("<<=","assignshiftleft",20),Ob(">>=","assignshiftright",20),Ob(">>>=","assignshiftrightunsigned",20),Jb("?",function(a,b){return b.left=a,b.right=rb(10),qb(":"),b["else"]=rb(10),b},30),Jb("||","or",40),Jb("&&","and",50),Nb("|","bitor",70),Nb("^","bitxor",80),Nb("&","bitand",90),Kb("==",function(a,b){var c=B.eqnull&&(a.value==="null"||b.value==="null");return!c&&B.eqeqeq?ib("Expected '{a}' and instead saw '{b}'.",this,"===","=="):Lb(a)?ib("Use '{a}' to compare with '{b}'.",this,"===",a.value):Lb(b)&&ib("Use '{a}' to compare with '{b}'.",this,"===",b.value),this}),Kb("==="),Kb("!=",function(a,b){var c=B.eqnull&&(a.value==="null"||b.value==="null");return!c&&B.eqeqeq?ib("Expected '{a}' and instead saw '{b}'.",this,"!==","!="):Lb(a)?ib("Use '{a}' to compare with '{b}'.",this,"!==",a.value):Lb(b)&&ib("Use '{a}' to compare with '{b}'.",this,"!==",b.value),this}),Kb("!=="),Kb("<"),Kb(">"),Kb("<="),Kb(">="),Nb("<<","shiftleft",120),Nb(">>","shiftright",120),Nb(">>>","shiftrightunsigned",120),Jb("in","in",120),Jb("instanceof","instanceof",120),Jb("+",function(a,b){var c=rb(130);return a&&c&&a.id==="(string)"&&c.id==="(string)"?(a.value+=c.value,a.character=c.character,!B.scripturl&&_.test(a.value)&&ib("JavaScript URL.",a),a):(b.left=a,b.right=c,b)},130),Fb("+","num"),Fb("+++",function(){return ib("Confusing pluses."),this.right=rb(150),this.arity="unary",this}),Jb("+++",function(a){return ib("Confusing pluses."),this.left=a,this.right=rb(130),this},130),Jb("-","sub",130),Fb("-","neg"),Fb("---",function(){return ib("Confusing minuses."),this.right=rb(150),this.arity="unary",this}),Jb("---",function(a){return ib("Confusing minuses."),this.left=a,this.right=rb(130),this},130),Jb("*","mult",140),Jb("/","div",140),Jb("%","mod",140),Pb("++","postinc"),Fb("++","preinc"),N["++"].exps=!0,Pb("--","postdec"),Fb("--","predec"),N["--"].exps=!0,Fb("delete",function(){var a=rb(0);return(!a||a.id!=="."&&a.id!=="[")&&ib("Variables should not be deleted."),this.first=a,this}).exps=!0,Fb("~",function(){return B.bitwise&&ib("Unexpected '{a}'.",this,"~"),rb(150),this}),Fb("!",function(){return this.right=rb(150),this.arity="unary",b[this.right.id]===!0&&ib("Confusing use of '{a}'.",this,"!"),this}),Fb("typeof","typeof"),Fb("new",function(){var a=rb(155),b;if(a&&a.id!=="function")if(a.identifier){a["new"]=!0;switch(a.value){case"Number":case"String":case"Boolean":case"Math":case"JSON":ib("Do not use {a} as a constructor.",P,a.value);break;case"Function":B.evil||ib("The Function constructor is eval.");break;case"Date":case"RegExp":break;default:a.id!=="function"&&(b=a.value.substr(0,1),B.newcap&&(b<"A"||b>"Z")&&ib("A constructor name should start with an uppercase letter.",P))}}else a.id!=="."&&a.id!=="["&&a.id!=="("&&ib("Bad constructor.",P);else B.supernew||ib("Weird construction. Delete 'new'.",this);return sb(P,y),y.id!=="("&&!B.supernew&&ib("Missing '()' invoking a constructor."),this.first=a,this}),N["new"].exps=!0,Fb("void").exps=!0,Jb(".",function(a,b){sb(E,P),tb();var c=Rb();return typeof c=="string"&&Xb(c),b.left=a,b.right=c,!a||a.value!=="arguments"||c!=="callee"&&c!=="caller"?!B.evil&&a&&a.value==="document"&&(c==="write"||c==="writeln")&&ib("document.write can be a form of eval.",a):B.noarg?ib("Avoid arguments.{a}.",a,c):M["use strict"]&&kb("Strict violation."),!B.evil&&(c==="eval"||c==="execScript")&&ib("eval is evil."),b},160,!0),Jb("(",function(a,b){E.id!=="}"&&E.id!==")"&&tb(E,P),ub(),B.immed&&!a.immed&&a.id==="function"&&ib("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.");var c=0,d=[];a&&a.type==="(identifier)"&&a.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&a.value!=="Number"&&a.value!=="String"&&a.value!=="Boolean"&&a.value!=="Date"&&(a.value==="Math"?ib("Math is not a function.",a):B.newcap&&ib("Missing 'new' prefix when invoking a constructor.",a));if(y.id!==")")for(;;){d[d.length]=rb(10),c+=1;if(y.id!==",")break;zb()}return qb(")"),ub(E,P),typeof a=="object"&&(a.value==="parseInt"&&c===1&&ib("Missing radix parameter.",a),B.evil||(a.value==="eval"||a.value==="Function"||a.value==="execScript"?ib("eval is evil.",a):d[0]&&d[0].id==="(string)"&&(a.value==="setTimeout"||a.value==="setInterval")&&ib("Implied eval is evil. Pass a function instead of a string.",a)),!a.identifier&&a.id!=="."&&a.id!=="["&&a.id!=="("&&a.id!=="&&"&&a.id!=="||"&&a.id!=="?"&&ib("Bad invocation.",a)),b.left=a,b},155,!0).exps=!0,Fb("(",function(){ub(),y.id==="function"&&(y.immed=!0);var a=rb(0);return qb(")",this),ub(E,P),B.immed&&a.id==="function"&&(y.id==="("||y.id==="."&&(pb().value==="call"||pb().value==="apply")?ib("Move the invocation into the parens that contain the function.",y):ib("Do not wrap function literals in parens unless they are to be immediately invoked.",this)),a}),Jb("[",function(a,b){tb(E,P),ub();var c=rb(0),d;return c&&c.type==="(string)"&&(!B.evil&&(c.value==="eval"||c.value==="execScript")&&ib("eval is evil.",b),Xb(c.value),!B.sub&&$.test(c.value)&&(d=N[c.value],(!d||!d.reserved)&&ib("['{a}'] is better written in dot notation.",c,c.value))),qb("]",b),ub(E,P),b.left=a,b.right=c,b},160,!0),Fb("[",function(){var a=P.line!==y.line;this.first=[],a&&(q+=B.indent,y.from===q+B.indent&&(q+=B.indent));while(y.id!=="(end)"){while(y.id===",")ib("Extra comma."),qb(",");if(y.id==="]")break;a&&P.line!==y.line&&xb(),this.first.push(rb(10));if(y.id!==",")break;zb();if(y.id==="]"&&!B.es5){ib("Extra comma.",P);break}}return a&&(q-=B.indent,xb()),qb("]",this),this},160),function(a){a.nud=function(){function h(a,b){g[a]&&cb(g,a)?ib("Duplicate member '{a}'.",y,c):g[a]={},g[a].basic=!0,g[a].basicToken=b}function i(a,b){g[a]&&cb(g,a)?(g[a].basic||g[a].setter)&&ib("Duplicate member '{a}'.",y,c):g[a]={},g[a].setter=!0,g[a].setterToken=b}function j(a){g[a]&&cb(g,a)?(g[a].basic||g[a].getter)&&ib("Duplicate member '{a}'.",y,c):g[a]={},g[a].getter=!0,g[a].getterToken=P}var a,b,c,d,e,f,g={};a=P.line!==y.line,a&&(q+=B.indent,y.from===q+B.indent&&(q+=B.indent));for(;;){if(y.id==="}")break;a&&xb();if(y.value==="get"&&pb().id!==":")qb("get"),B.es5||kb("get/set are ES5 features."),c=Zb(),c||kb("Missing property name."),j(c),f=y,sb(P,y),b=_b(),e=b["(params)"],e&&ib("Unexpected parameter '{a}' in get {b} function.",f,e[0],c),sb(P,y);else if(y.value==="set"&&pb().id!==":")qb("set"),B.es5||kb("get/set are ES5 features."),c=Zb(),c||kb("Missing property name."),i(c,y),f=y,sb(P,y),b=_b(),e=b["(params)"],(!e||e.length!==1)&&ib("Expected a single parameter in set {a} function.",f,c);else{c=Zb(),h(c,y);if(typeof c!="string")break;qb(":"),vb(P,y),rb(10)}Xb(c);if(y.id!==",")break;zb(),y.id===","?ib("Extra comma.",P):y.id==="}"&&!B.es5&&ib("Extra comma.",P)}a&&(q-=B.indent,xb()),qb("}",this);if(B.es5)for(var k in g)cb(g,k)&&g[k].setter&&!g[k].getter&&ib("Setter is defined without getter.",g[k].setterToken);return this},a.fud=function(){kb("Expected to see a statement and instead saw a block.",P)}}(Bb("{")),R=function(){var a=Cb("const",function(a){var b,c,d;this.first=[];for(;;){vb(P,y),b=Rb(),k[b]==="const"&&ib("const '"+b+"' has already been declared"),k["(global)"]&&C[b]===!1&&ib("Redefinition of '{a}'.",P,b),nb(b,"const");if(a)break;c=P,this.first.push(P),y.id!=="="&&ib("const '{a}' is initialized to 'undefined'.",P,b),y.id==="="&&(vb(P,y),qb("="),vb(P,y),y.id==="undefined"&&ib("It is not necessary to initialize '{a}' to 'undefined'.",P,b),pb(0).id==="="&&y.identifier&&kb("Constant {a} was not declared correctly.",y,y.value),d=rb(0),c.first=d);if(y.id!==",")break;zb()}return this});a.exps=!0};var ac=Cb("var",function(a){var b,c,d;k["(onevar)"]&&B.onevar?ib("Too many var statements."):k["(global)"]||(k["(onevar)"]=!0),this.first=[];for(;;){vb(P,y),b=Rb(),B.esnext&&k[b]==="const"&&ib("const '"+b+"' has already been declared"),k["(global)"]&&C[b]===!1&&ib("Redefinition of '{a}'.",P,b),nb(b,"unused");if(a)break;c=P,this.first.push(P),y.id==="="&&(vb(P,y),qb("="),vb(P,y),y.id==="undefined"&&ib("It is not necessary to initialize '{a}' to 'undefined'.",P,b),pb(0).id==="="&&y.identifier&&kb("Variable {a} was not declared correctly.",y,y.value),d=rb(0),c.first=d);if(y.id!==",")break;zb()}return this});ac.exps=!0,Db("function",function(){p&&ib("Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.",P);var a=Rb();return B.esnext&&k[a]==="const"&&ib("const '"+a+"' has already been declared"),sb(P,y),nb(a,"unction"),_b(a,!0),y.id==="("&&y.line===P.line&&kb("Function declarations are not invocable. Wrap the whole function invocation in parens."),this}),Fb("function",function(){var a=Qb();return a?sb(P,y):vb(P,y),_b(a),!B.loopfunc&&k["(loopage)"]&&ib("Don't make functions within a loop."),this}),Db("if",function(){var a=y;return qb("("),vb(this,a),ub(),rb(20),y.id==="="&&(B.boss||ib("Expected a conditional expression and instead saw an assignment."),qb("="),rb(20)),qb(")",a),ub(E,P),Wb(!0,!0),y.id==="else"&&(vb(P,y),qb("else"),y.id==="if"||y.id==="switch"?Tb(!0):Wb(!0,!0)),this}),Db("try",function(){var a,b,c;Wb(!1),y.id==="catch"&&(qb("catch"),vb(P,y),qb("("),c=H,H=Object.create(c),b=y.value,y.type!=="(identifier)"?ib("Expected an identifier and instead saw '{a}'.",y,b):nb(b,"exception"),qb(),qb(")"),Wb(!1),a=!0,H=c);if(y.id==="finally"){qb("finally"),Wb(!1);return}return a||kb("Expected '{a}' and instead saw '{b}'.",y,"catch",y.value),this}),Db("while",function(){var a=y;return k["(breakage)"]+=1,k["(loopage)"]+=1,qb("("),vb(this,a),ub(),rb(20),y.id==="="&&(B.boss||ib("Expected a conditional expression and instead saw an assignment."),qb("="),rb(20)),qb(")",a),ub(E,P),Wb(!0,!0),k["(breakage)"]-=1,k["(loopage)"]-=1,this}).labelled=!0,Db("with",function(){var a=y;return M["use strict"]?kb("'with' is not allowed in strict mode.",P):B.withstmt||ib("Don't use 'with'.",P),qb("("),vb(this,a),ub(),rb(0),qb(")",a),ub(E,P),Wb(!0,!0),this}),Db("switch",function(){var a=y,b=!1;k["(breakage)"]+=1,qb("("),vb(this,a),ub(),this.condition=rb(20),qb(")",a),ub(E,P),vb(P,y),a=y,qb("{"),vb(P,y),q+=B.indent,this.cases=[];for(;;)switch(y.id){case"case":switch(k["(verb)"]){case"break":case"case":case"continue":case"return":case"switch":case"throw":break;default:ab.test(t[y.line-2])||ib("Expected a 'break' statement before 'case'.",P)}xb(-B.indent),qb("case"),this.cases.push(rb(20)),b=!0,qb(":"),k["(verb)"]="case";break;case"default":switch(k["(verb)"]){case"break":case"continue":case"return":case"throw":break;default:ab.test(t[y.line-2])||ib("Expected a 'break' statement before 'default'.",P)}xb(-B.indent),qb("default"),b=!0,qb(":");break;case"}":q-=B.indent,xb(),qb("}",a);if(this.cases.length===1||this.condition.id==="true"||this.condition.id==="false")B.onecase||ib("This 'switch' should be an 'if'.",this);k["(breakage)"]-=1,k["(verb)"]=undefined;return;case"(end)":kb("Missing '{a}'.",y,"}");return;default:if(b)switch(P.id){case",":kb("Each value should have its own case label.");return;case":":b=!1,Ub();break;default:kb("Missing ':' on a case clause.",P);return}else{if(P.id!==":"){kb("Expected '{a}' and instead saw '{b}'.",y,"case",y.value);return}qb(":"),kb("Unexpected '{a}'.",P,":"),Ub()}}}).labelled=!0,Cb("debugger",function(){return B.debug||ib("All 'debugger' statements should be removed."),this}).exps=!0,function(){var a=Cb("do",function(){k["(breakage)"]+=1,k["(loopage)"]+=1,this.first=Wb(!0),qb("while");var a=y;return vb(P,a),qb("("),ub(),rb(20),y.id==="="&&(B.boss||ib("Expected a conditional expression and instead saw an assignment."),qb("="),rb(20)),qb(")",a),ub(E,P),k["(breakage)"]-=1,k["(loopage)"]-=1,this});a.labelled=!0,a.exps=!0}(),Db("for",function(){var a,b=y;k["(breakage)"]+=1,k["(loopage)"]+=1,qb("("),vb(this,b),ub();if(pb(y.id==="var"?1:0).id==="in"){if(y.id==="var")qb("var"),ac.fud.call(ac,!0);else{switch(k[y.value]){case"unused":k[y.value]="var";break;case"var":break;default:ib("Bad for in variable '{a}'.",y,y.value)}qb()}return qb("in"),rb(20),qb(")",b),a=Wb(!0,!0),B.forin&&a&&(a.length>1||typeof a[0]!="object"||a[0].value!=="if")&&ib("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.",this),k["(breakage)"]-=1,k["(loopage)"]-=1,this}if(y.id!==";")if(y.id==="var")qb("var"),ac.fud.call(ac);else for(;;){rb(0,"for");if(y.id!==",")break;zb()}yb(P),qb(";"),y.id!==";"&&(rb(20),y.id==="="&&(B.boss||ib("Expected a conditional expression and instead saw an assignment."),qb("="),rb(20))),yb(P),qb(";"),y.id===";"&&kb("Expected '{a}' and instead saw '{b}'.",y,")",";");if(y.id!==")")for(;;){rb(0,"for");if(y.id!==",")break;zb()}return qb(")",b),ub(E,P),Wb(!0,!0),k["(breakage)"]-=1,k["(loopage)"]-=1,this}).labelled=!0,Cb("break",function(){var a=y.value;return k["(breakage)"]===0&&ib("Unexpected '{a}'.",y,this.value),B.asi||yb(this),y.id!==";"&&P.line===y.line&&(k[a]!=="label"?ib("'{a}' is not a statement label.",y,a):H[a]!==k&&ib("'{a}' is out of scope.",y,a),this.first=y,qb()),Sb("break"),this}).exps=!0,Cb("continue",function(){var a=y.value;return k["(breakage)"]===0&&ib("Unexpected '{a}'.",y,this.value),B.asi||yb(this),y.id!==";"?P.line===y.line&&(k[a]!=="label"?ib("'{a}' is not a statement label.",y,a):H[a]!==k&&ib("'{a}' is out of scope.",y,a),this.first=y,qb()):k["(loopage)"]||ib("Unexpected '{a}'.",y,this.value),Sb("continue"),this}).exps=!0,Cb("return",function(){return this.line===y.line?(y.id==="(regexp)"&&ib("Wrap the /regexp/ literal in parens to disambiguate the slash operator."),y.id!==";"&&!y.reach&&(vb(P,y),pb().value==="="&&!B.boss&&jb("Did you mean to return a conditional instead of an assignment?",P.line,P.character+1),this.first=rb(0))):B.asi||yb(this),Sb("return"),this}).exps=!0,Cb("throw",function(){return yb(this),vb(P,y),this.first=rb(20),Sb("throw"),this}).exps=!0,Hb("class"),Hb("const"),Hb("enum"),Hb("export"),Hb("extends"),Hb("import"),Hb("super"),Hb("let"),Hb("yield"),Hb("implements"),Hb("interface"),Hb("package"),Hb("private"),Hb("protected"),Hb("public"),Hb("static");var cc=function(a,b,c){var e,f,g;d.errors=[],d.undefs=[],C=Object.create(J),eb(C,c||{});if(b){e=b.predef;if(e)if(Array.isArray(e))for(f=0;f0&&(a.implieds=d),Q.length>0&&(a.urls=Q),c=Object.keys(H),c.length>0&&(a.globals=c);for(f=1;f0&&(a.unused=j),h=[];for(i in v)if(typeof v[i]=="number"){a.member=v;break}return a},cc.report=function(a){function o(a,b){var c,d,e;if(b){m.push("
"+a+" "),b=b.sort();for(d=0;d")}}var b=cc.data(),c=[],d,e,f,g,h,i,j,k="",l,m=[],n;if(b.errors||b.implieds||b.unused){f=!0,m.push("
Error:");if(b.errors)for(h=0;hProblem"+(isFinite(d.line)?" at line "+d.line+" character "+d.character:"")+": "+d.reason.entityify()+"

"+(e&&(e.length>80?e.slice(0,77)+"...":e).entityify())+"

"));if(b.implieds){n=[];for(h=0;h"+b.implieds[h].name+" "+b.implieds[h].line+"";m.push("

Implied global: "+n.join(", ")+"

")}if(b.unused){n=[];for(h=0;h"+b.unused[h].name+" "+b.unused[h].line+" "+b.unused[h]["function"]+"";m.push("

Unused variable: "+n.join(", ")+"

")}b.json&&m.push("

JSON: bad.

"),m.push("
")}if(!a){m.push("
"),b.urls&&o("URLs
",b.urls,"
"),b.json&&!f?m.push("

JSON: good.

"):b.globals?m.push("
Global "+b.globals.sort().join(", ")+"
"):m.push("
No new global variables introduced.
");for(h=0;h
"+g.line+"-"+g.last+" "+(g.name||"")+"("+(g.param?g.param.join(", "):"")+")
"),o("Unused",g.unused),o("Closure",g.closure),o("Variable",g["var"]),o("Exception",g.exception),o("Outer",g.outer),o("Global",g.global),o("Label",g.label);if(b.member){c=Object.keys(b.member);if(c.length){c=c.sort(),k="
/*members ",j=10;for(h=0;h72&&(m.push(k+"
"),k=" ",j=1),j+=l.length+2,b.member[i]===1&&(l=""+l+""),h*/
")}m.push("
")}}return m.join("")},cc.jshint=cc,cc}();typeof b=="object"&&b&&(b.JSHINT=d)}),define("ace/narcissus/parser",["require","exports","module","ace/narcissus/lexer","ace/narcissus/definitions","ace/narcissus/options"],function(require,exports,module){function pushDestructuringVarDecls(a,b){for(var c in a){var d=a[c];d.type===IDENTIFIER?b.varDecls.push(d):pushDestructuringVarDecls(d,b)}}function Parser(a){a.parser=this,this.t=a,this.x=null,this.unexpectedEOF=!1,options.mozillaMode&&(this.mozillaMode=!0),options.parenFreeMode&&(this.parenFreeMode=!0)}function StaticContext(a,b,c,d,e){this.parentScript=a,this.parentBlock=b||a,this.inModule=c||!1,this.inFunction=d||!1,this.inForLoopInit=!1,this.topLevel=!0,this.allLabels=new Stack,this.currentLabels=new Stack,this.labeledTargets=new Stack,this.defaultLoopTarget=null,this.defaultTarget=null,this.strictMode=e}function Pragma(a){if(a.type===SEMICOLON){var b=a.expression;if(b.type===STRING&&b.value==="use strict")return a.pragma="strict",!0}return!1}function Node(a,b){var c=a.token;c?(this.type=c.type,this.value=c.value,this.lineno=c.lineno,this.start=c.start,this.end=c.end):this.lineno=a.lineno,this.filename=a.filename,this.children=[];for(var d in b)this[d]=b[d]}function SyntheticNode(a){this.children=[];for(var b in a)this[b]=a[b];this.synthetic=!0}function unevalableConst(a){var b=definitions.tokens[a],c=definitions.opTypeNames.hasOwnProperty(b)?definitions.opTypeNames[b]:b in definitions.keywords?b.toUpperCase():b;return{toSource:function(){return c}}}function tokenString(a){var b=definitions.tokens[a];return/^\W/.test(b)?definitions.opTypeNames[b]:b.toUpperCase()}function blockInit(){return{type:BLOCK,varDecls:[]}}function scriptInit(){return{type:SCRIPT,funDecls:[],varDecls:[],modDefns:new Dict,modAssns:new Dict,modDecls:new Dict,modLoads:new Dict,impDecls:[],expDecls:[],exports:new Dict,hasEmptyReturn:!1,hasReturnWithValue:!1,hasYield:!1}}function Export(a,b){this.node=a,this.isDefinition=b,this.resolved=null}function registerExport(a,b){function c(b,c){if(a.has(b))throw new SyntaxError("multiple exports of "+b);a.set(b,c)}switch(b.type){case MODULE:case FUNCTION:c(b.name,new Export(b,!0));break;case VAR:for(var d=0;d=0)b+=c;return b},!1,!1,!0),Pp.MaybeLeftParen=function(){return this.parenFreeMode?this.match(LEFT_PAREN)?LEFT_PAREN:END:this.mustMatch(LEFT_PAREN).type},Pp.MaybeRightParen=function(b){b===LEFT_PAREN&&this.mustMatch(RIGHT_PAREN)},Pp.Statements=function(b,c){var d=!!c;try{while(!this.done()&&this.peek(!0)!==RIGHT_CURLY){var e=this.Statement();b.push(e),d&&Pragma(e)?(this.x.strictMode=!0,b.strict=!0):d=!1}}catch(f){try{this.done()&&(this.unexpectedEOF=!0)}catch(f){}throw f}},Pp.Block=function(){this.mustMatch(LEFT_CURLY);var b=this.newNode(blockInit()),c=this.x.update({parentBlock:b}).pushTarget(b);return this.withContext(c,function(){this.Statements(b)}),this.mustMatch(RIGHT_CURLY),b};var DECLARED_FORM=0,EXPRESSED_FORM=1,STATEMENT_FORM=2;Pp.Statement=function(){var b,c,d,e,f,g,h,i=this.t.get(!0),j,k,l,m,n=this.t.blockComments;switch(i){case IMPORT:this.x.canImport()||this.fail("illegal context for import statement"),d=this.newNode(),d.pathList=this.ImportPathList(),this.x.parentScript.impDecls.push(d);break;case EXPORT:this.x.canExport()||this.fail("export statement not in module top level");switch(this.peek()){case MODULE:case FUNCTION:case LET:case VAR:case CONST:return d=this.Statement(),d.blockComments=n,d.exported=!0,this.x.parentScript.expDecls.push(d),registerExport(this.x.parentScript.exports,d),d}d=this.newNode(),d.pathList=this.ExportPathList(),this.x.parentScript.expDecls.push(d),registerExport(this.x.parentScript.exports,d);break;case FUNCTION:return this.FunctionDefinition(!0,this.x.topLevel?DECLARED_FORM:STATEMENT_FORM,n);case LEFT_CURLY:return d=this.newNode(blockInit()),l=this.x.update({parentBlock:d}).pushTarget(d).nest(),this.withContext(l,function(){this.Statements(d)}),this.mustMatch(RIGHT_CURLY),d;case IF:return d=this.newNode(),d.condition=this.HeadExpression(),l=this.x.pushTarget(d).nest(),this.withContext(l,function(){d.thenPart=this.Statement(),d.elsePart=this.match(ELSE,!0)?this.Statement():null}),d;case SWITCH:return d=this.newNode({cases:[],defaultIndex:-1}),d.discriminant=this.HeadExpression(),l=this.x.pushTarget(d).nest(),this.withContext(l,function(){this.mustMatch(LEFT_CURLY);while((i=this.t.get())!==RIGHT_CURLY){switch(i){case DEFAULT:d.defaultIndex>=0&&this.fail("More than one switch default");case CASE:e=this.newNode(),i===DEFAULT?d.defaultIndex=d.cases.length:e.caseLabel=this.Expression(COLON);break;default:this.fail("Invalid switch case")}this.mustMatch(COLON),e.statements=this.newNode(blockInit());while((i=this.peek(!0))!==CASE&&i!==DEFAULT&&i!==RIGHT_CURLY)e.statements.push(this.Statement());d.cases.push(e)}}),d;case FOR:return d=this.newNode(LOOP_INIT),d.blockComments=n,this.match(IDENTIFIER)&&(this.t.token.value==="each"?d.isEach=!0:this.t.unget()),this.parenFreeMode||this.mustMatch(LEFT_PAREN),l=this.x.pushTarget(d).nest(),m=this.x.update({inForLoopInit:!0}),e=null,(i=this.peek(!0))!==SEMICOLON&&this.withContext(m,function(){i===VAR||i===CONST?(this.t.get(),e=this.Variables()):i===LET?(this.t.get(),this.peek()===LEFT_PAREN?e=this.LetBlock(!1):(this.x.parentBlock=d,d.varDecls=[],e=this.Variables())):e=this.Expression()}),e&&this.match(IN)?(d.type=FOR_IN,this.withContext(m,function(){d.object=this.Expression();if(e.type===VAR||e.type===LET){g=e.children;if(g.length!==1&&e.destructurings.length!==1)throw new SyntaxError("Invalid for..in left-hand side",this.filename,e.lineno);e.destructurings.length>0?d.iterator=e.destructurings[0]:d.iterator=g[0],d.varDecl=e}else{if(e.type===ARRAY_INIT||e.type===OBJECT_INIT)e.destructuredNames=this.checkDestructuring(e);d.iterator=e}})):(m.inForLoopInit=!1,d.setup=e,this.mustMatch(SEMICOLON),d.isEach&&this.fail("Invalid for each..in loop"),this.withContext(m,function(){d.condition=this.peek(!0)===SEMICOLON?null:this.Expression(),this.mustMatch(SEMICOLON),j=this.peek(!0),d.update=(this.parenFreeMode?j===LEFT_CURLY||definitions.isStatementStartCode[j]:j===RIGHT_PAREN)?null:this.Expression()})),this.parenFreeMode||this.mustMatch(RIGHT_PAREN),this.withContext(l,function(){d.body=this.Statement()}),d;case WHILE:return d=this.newNode({isLoop:!0}),d.blockComments=n,d.condition=this.HeadExpression(),l=this.x.pushTarget(d).nest(),this.withContext(l,function(){d.body=this.Statement()}),d;case DO:return d=this.newNode({isLoop:!0}),d.blockComments=n,l=this.x.pushTarget(d).next(),this.withContext(l,function(){d.body=this.Statement()}),this.mustMatch(WHILE),d.condition=this.HeadExpression(),this.match(SEMICOLON),d;case BREAK:case CONTINUE:d=this.newNode(),d.blockComments=n,l=this.x.pushTarget(d),this.peekOnSameLine()===IDENTIFIER&&(this.t.get(),d.label=this.t.token.value),d.label?d.target=l.labeledTargets.find(function(a){return a.labels.has(d.label)}):i===CONTINUE?d.target=l.defaultLoopTarget:d.target=l.defaultTarget,d.target||this.fail("Invalid "+(i===BREAK?"break":"continue")),!d.target.isLoop&&i===CONTINUE&&this.fail("Invalid continue");break;case TRY:d=this.newNode({catchClauses:[]}),d.blockComments=n,d.tryBlock=this.Block();while(this.match(CATCH)){e=this.newNode(),f=this.MaybeLeftParen();switch(this.t.get()){case LEFT_BRACKET:case LEFT_CURLY:this.t.unget(),e.varName=this.DestructuringExpression(!0);break;case IDENTIFIER:e.varName=this.t.token.value;break;default:this.fail("missing identifier in catch")}this.match(IF)&&(this.mozillaMode||this.fail("Illegal catch guard"),d.catchClauses.length&&!d.catchClauses.top().guard&&this.fail("Guarded catch after unguarded"),e.guard=this.Expression()),this.MaybeRightParen(f),e.block=this.Block(),d.catchClauses.push(e)}return this.match(FINALLY)&&(d.finallyBlock=this.Block()),!d.catchClauses.length&&!d.finallyBlock&&this.fail("Invalid try statement"),d;case CATCH:case FINALLY:this.fail(definitions.tokens[i]+" without preceding try");case THROW:d=this.newNode(),d.exception=this.Expression();break;case RETURN:d=this.ReturnOrYield();break;case WITH:return this.x.banWith()&&this.fail("with statements not allowed in strict code or modules"),d=this.newNode(),d.blockComments=n,d.object=this.HeadExpression(),l=this.x.pushTarget(d).next(),this.withContext(l,function(){d.body=this.Statement()}),d;case VAR:case CONST:d=this.Variables();break;case LET:if(this.peek()===LEFT_PAREN)return d=this.LetBlock(!0),d;d=this.Variables();break;case DEBUGGER:d=this.newNode();break;case NEWLINE:case SEMICOLON:return d=this.newNode({type:SEMICOLON}),d.blockComments=n,d.expression=null,d;case IDENTIFIER:case USE:case MODULE:switch(this.t.token.value){case"use":if(!isPragmaToken(this.peekOnSameLine())){this.t.unget();break}return this.newNode({type:USE,params:this.Pragmas()});case"module":this.x.modulesAllowed()||this.fail("module declaration not at top level"),this.x.parentScript.hasModules=!0,i=this.peekOnSameLine();if(i!==IDENTIFIER&&i!==LEFT_CURLY){this.t.unget();break}d=this.newNode({type:MODULE}),d.blockComments=n,this.mustMatch(IDENTIFIER),c=this.t.token.value;if(this.match(LEFT_CURLY))return d.name=c,d.body=this.Script(!0,!1),d.module=new Module(d),this.mustMatch(RIGHT_CURLY),this.x.parentScript.modDefns.set(d.name,d),d;return this.t.unget(),this.ModuleVariables(d),d;default:i=this.peek();if(i===COLON)return c=this.t.token.value,this.x.allLabels.has(c)&&this.fail("Duplicate label: "+c),this.t.get(),d=this.newNode({type:LABEL,label:c}),d.blockComments=n,l=this.x.pushLabel(c).nest(),this.withContext(l,function(){d.statement=this.Statement()}),d.target=d.statement.type===LABEL?d.statement.target:d.statement,d};default:d=this.newNode({type:SEMICOLON}),this.t.unget(),d.blockComments=n,d.expression=this.Expression(),d.end=d.expression.end}return d.blockComments=n,this.MagicalSemicolon(),d},Pp.Pragmas=function(){var b=[];do b.push(this.Pragma());while(this.match(COMMA));return this.MagicalSemicolon(),b},Pp.Pragma=function(){var b=[],c;do c=this.t.get(!0),b.push(this.t.token);while(isPragmaToken(this.peek()));return b},Pp.MagicalSemicolon=function(){var b;this.t.lineno===this.t.token.lineno&&(b=this.peekOnSameLine(),b!==END&&b!==NEWLINE&&b!==SEMICOLON&&b!==RIGHT_CURLY&&this.fail("missing ; before statement")),this.match(SEMICOLON)},Pp.ReturnOrYield=function(){var b,c,d=this.t.token.type,e,f=this.x.parentScript;return d===RETURN?this.x.inFunction||this.fail("Return not in function"):(this.x.inFunction||this.fail("Yield not in function"),f.hasYield=!0),b=this.newNode({value:undefined}),e=d===RETURN?this.peekOnSameLine(!0):this.peek(!0),e!==END&&e!==NEWLINE&&e!==SEMICOLON&&e!==RIGHT_CURLY&&(d!==YIELD||e!==d&&e!==RIGHT_BRACKET&&e!==RIGHT_PAREN&&e!==COLON&&e!==COMMA)?d===RETURN?(b.value=this.Expression(),f.hasReturnWithValue=!0):b.value=this.AssignExpression():d===RETURN&&(f.hasEmptyReturn=!0),b},Pp.ModuleExpression=function(){return this.match(STRING)?this.newNode():this.QualifiedPath()},Pp.ImportPathList=function(){var b=[];do b.push(this.ImportPath());while(this.match(COMMA));return b},Pp.ImportPath=function(){var b=this.QualifiedPath();if(!this.match(DOT))return b.type===IDENTIFIER&&this.fail("cannot import local variable"),b;var c=this.newNode();return c.push(b),c.push(this.ImportSpecifierSet()),c},Pp.ExplicitSpecifierSet=function(b){var c,d,e,f;c=this.newNode({type:OBJECT_INIT}),this.mustMatch(LEFT_CURLY);if(!this.match(RIGHT_CURLY))do e=this.Identifier(),this.match(COLON)?(d=this.newNode({type:PROPERTY_INIT}),d.push(e),d.push(b()),c.push(d)):c.push(e);while(!this.match(RIGHT_CURLY)&&this.mustMatch(COMMA));return c},Pp.ImportSpecifierSet=function(){var b=this;return this.match(MUL)?this.newNode({type:IDENTIFIER,name:"*"}):ExplicitSpecifierSet(function(){return b.Identifier()})},Pp.Identifier=function(){return this.mustMatch(IDENTIFIER),this.newNode({type:IDENTIFIER})},Pp.IdentifierName=function(){return this.mustMatch(IDENTIFIER,!0),this.newNode({type:IDENTIFIER})},Pp.QualifiedPath=function(){var b,c;b=this.Identifier();while(this.match(DOT)){if(this.peek()!==IDENTIFIER){this.t.unget();break}c=this.newNode(),c.push(b),c.push(this.Identifier()),b=c}return b},Pp.ExportPath=function(){var b=this;return this.peek()===LEFT_CURLY?this.ExplicitSpecifierSet(function(){return b.QualifiedPath()}):this.QualifiedPath()},Pp.ExportPathList=function(){var b=[];do b.push(this.ExportPath());while(this.match(COMMA));return b},Pp.FunctionDefinition=function(b,c,d){var e,f=this.newNode({params:[],paramComments:[]});typeof d=="undefined"&&(d=null),f.blockComments=d,f.type!==FUNCTION&&(f.type=f.value==="get"?GETTER:SETTER),this.match(MUL)&&(f.isExplicitGenerator=!0),this.match(IDENTIFIER,!1,!0)?f.name=this.t.token.value:b&&this.fail("missing function identifier");var g=this.x.inModule;x2=new StaticContext(null,null,g,!0,this.x.strictMode),this.withContext(x2,function(){this.mustMatch(LEFT_PAREN);if(!this.match(RIGHT_PAREN)){do{e=this.t.get(),f.paramComments.push(this.t.lastBlockComment());switch(e){case LEFT_BRACKET:case LEFT_CURLY:this.t.unget(),f.params.push(this.DestructuringExpression());break;case IDENTIFIER:f.params.push(this.t.token.value);break;default:this.fail("missing formal parameter")}}while(this.match(COMMA));this.mustMatch(RIGHT_PAREN)}e=this.t.get(!0),e!==LEFT_CURLY&&this.t.unget(),e!==LEFT_CURLY?f.body=this.AssignExpression():f.body=this.Script(g,!0)}),e===LEFT_CURLY&&this.mustMatch(RIGHT_CURLY),f.end=this.t.token.end,f.functionForm=c,c===DECLARED_FORM&&this.x.parentScript.funDecls.push(f),this.x.inModule&&!f.isExplicitGenerator&&f.body.hasYield&&this.fail("yield in non-generator function");if(f.isExplicitGenerator||f.body.hasYield)f.body=this.newNode({type:GENERATOR,body:f.body});return f},Pp.ModuleVariables=function(b){var c,d;do c=this.Identifier(),this.match(ASSIGN)&&(d=this.ModuleExpression(),c.initializer=d,d.type===STRING?this.x.parentScript.modLoads.set(c.value,d.value):this.x.parentScript.modAssns.set(c.value,c)),b.push(c);while(this.match(COMMA))},Pp.Variables=function(b){var c,d,e,f,g,h;h=this.t.token.type;switch(h){case VAR:case CONST:g=this.x.parentScript;break;case LET:g=this.x.parentBlock;break;case LEFT_PAREN:h=LET,g=b}c=this.newNode({type:h,destructurings:[]});do{h=this.t.get();if(h===LEFT_BRACKET||h===LEFT_CURLY){this.t.unget();var i=this.DestructuringExpression(!0);d=this.newNode({type:IDENTIFIER,name:i,readOnly:c.type===CONST}),c.push(d),pushDestructuringVarDecls(d.name.destructuredNames,g),c.destructurings.push({exp:i,decl:d});if(this.x.inForLoopInit&&this.peek()===IN)continue;this.mustMatch(ASSIGN),this.t.token.assignOp&&this.fail("Invalid variable initialization"),d.blockComment=this.t.lastBlockComment(),d.initializer=this.AssignExpression();continue}h!==IDENTIFIER&&this.fail("missing variable name"),d=this.newNode({type:IDENTIFIER,name:this.t.token.value,readOnly:c.type===CONST}),c.push(d),g.varDecls.push(d);if(this.match(ASSIGN)){var j=this.t.lastBlockComment();this.t.token.assignOp&&this.fail("Invalid variable initialization"),d.initializer=this.AssignExpression()}else var j=this.t.lastBlockComment();d.blockComment=j}while(this.match(COMMA));return c},Pp.LetBlock=function(b){var c,d;return c=this.newNode({type:LET_BLOCK,varDecls:[]}),this.mustMatch(LEFT_PAREN),c.variables=this.Variables(c),this.mustMatch(RIGHT_PAREN),b&&this.peek()!==LEFT_CURLY&&(d=this.newNode({type:SEMICOLON,expression:c}),b=!1),b?c.block=this.Block():c.expression=this.AssignExpression(),c},Pp.checkDestructuring=function(b,c){b.type===ARRAY_COMP&&this.fail("Invalid array comprehension left-hand side");if(b.type!==ARRAY_INIT&&b.type!==OBJECT_INIT)return;var d={},e,f,g,h,i,j=b.children;for(var k=0,l=j.length;k1||this.peek(!0)===COMMA)&&this.fail("Generator expression must be parenthesized")),b.push(c);while(this.match(COMMA));return this.mustMatch(RIGHT_PAREN),b},Pp.PrimaryExpression=function(){var b,c,d=this.t.get(!0);switch(d){case FUNCTION:b=this.FunctionDefinition(!1,EXPRESSED_FORM);break;case LEFT_BRACKET:b=this.newNode({type:ARRAY_INIT});while((d=this.peek(!0))!==RIGHT_BRACKET){if(d===COMMA){this.t.get(),b.push(null);continue}b.push(this.AssignExpression());if(d!==COMMA&&!this.match(COMMA))break}b.children.length===1&&this.match(FOR)&&(c=this.newNode({type:ARRAY_COMP,expression:b.children[0],tail:this.ComprehensionTail()}),b=c),this.mustMatch(RIGHT_BRACKET);break;case LEFT_CURLY:var e,f;b=this.newNode({type:OBJECT_INIT});a:if(!this.match(RIGHT_CURLY)){do{d=this.t.get();if(this.t.token.value!=="get"&&this.t.token.value!=="set"||this.peek()!==IDENTIFIER){var g=this.t.blockComments;switch(d){case IDENTIFIER:case NUMBER:case STRING:e=this.newNode({type:IDENTIFIER});break;case RIGHT_CURLY:break a;default:if(this.t.token.value in definitions.keywords){e=this.newNode({type:IDENTIFIER});break}this.fail("Invalid property name")}this.match(COLON)?(c=this.newNode({type:PROPERTY_INIT}),c.push(e),c.push(this.AssignExpression()),c.blockComments=g,b.push(c)):(this.peek()!==COMMA&&this.peek()!==RIGHT_CURLY&&this.fail("missing : after property"),b.push(e))}else b.push(this.FunctionDefinition(!0,EXPRESSED_FORM))}while(this.match(COMMA));this.mustMatch(RIGHT_CURLY)}break;case LEFT_PAREN:b=this.ParenExpression(),this.mustMatch(RIGHT_PAREN),b.parenthesized=!0;break;case LET:b=this.LetBlock(!1);break;case NULL:case THIS:case TRUE:case FALSE:case IDENTIFIER:case NUMBER:case STRING:case REGEXP:b=this.newNode();break;default:this.fail("missing operand; found "+definitions.tokens[d])}return b},exports.parse=parse,exports.parseStdin=parseStdin,exports.parseFunction=parseFunction,exports.Node=Node,exports.DECLARED_FORM=DECLARED_FORM,exports.EXPRESSED_FORM=EXPRESSED_FORM,exports.STATEMENT_FORM=STATEMENT_FORM,exports.Tokenizer=Tokenizer,exports.Parser=Parser,exports.Module=Module,exports.Export=Export}),define("ace/narcissus/lexer",["require","exports","module","ace/narcissus/definitions"],function(require,exports,module){function isValidIdentifierChar(a,b){if(a<="")return a>="a"&&a<="z"||a>="A"&&a<="Z"||a==="$"||a==="_"||!b&&a>="0"&&a<="9"?!0:!1;var c={};c["x"+a]=!0,c[a]=!0;var d=!1;try{d=Function("x","return (x."+(b?"":"x")+a+");")(c)===!0}catch(e){}return d}function isIdentifier(a){if(typeof a!="string")return!1;if(a.length===0)return!1;if(!isValidIdentifierChar(a[0],!0))return!1;for(var b=1;b"9")throw this.newSyntaxError("Missing exponent");do ch=a[this.cursor++];while(ch>="0"&&ch<="9");return this.cursor--,!0}return!1},lexZeroNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER,a=c[this.cursor++];if(a==="."){do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.value=parseFloat(c.substring(b.start,this.cursor))}else if(a==="x"||a==="X"){do a=c[this.cursor++];while(a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}else if(a>="0"&&a<="7"){do a=c[this.cursor++];while(a>="0"&&a<="7");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}else this.cursor--,this.lexExponent(),b.value=0},lexNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER;var d=!1;do a=c[this.cursor++],a==="."&&!d&&(d=!0,a=c[this.cursor++]);while(a>="0"&&a<="9");this.cursor--;var e=this.lexExponent();d=d||e;var f=c.substring(b.start,this.cursor);b.value=d?parseFloat(f):parseInt(f)},lexDot:function(a){var b=this.token,c=this.source,d=c[this.cursor];if(d>="0"&&d<="9"){do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.type=NUMBER,b.value=parseFloat(c.substring(b.start,this.cursor))}else b.type=DOT,b.assignOp=null,b.value="."},lexString:function(ch){var token=this.token,input=this.source;token.type=STRING;var hasEscapes=!1,delim=ch;if(input.length<=this.cursor)throw this.newSyntaxError("Unterminated string literal");while((ch=input[this.cursor++])!==delim){if(ch=="\n"||ch=="\r")throw this.newSyntaxError("Unterminated string literal");if(this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal");if(ch==="\\"){hasEscapes=!0;if(++this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal")}}token.value=hasEscapes?eval(input.substring(token.start,this.cursor)):input.substring(token.start+1,this.cursor-1)},lexRegExp:function(ch){var token=this.token,input=this.source;token.type=REGEXP;do{ch=input[this.cursor++];if(ch==="\\")this.cursor++;else if(ch==="["){do{if(ch===undefined)throw this.newSyntaxError("Unterminated character class");ch==="\\"&&this.cursor++,ch=input[this.cursor++]}while(ch!=="]")}else if(ch===undefined)throw this.newSyntaxError("Unterminated regex")}while(ch!=="/");do ch=input[this.cursor++];while(ch>="a"&&ch<="z");this.cursor--,token.value=eval(input.substring(token.start,this.cursor))},lexOp:function(a){var b=this.token,c=this.source,d=opTokens[a],e=c[this.cursor];e in d&&(d=d[e],this.cursor++,e=c[this.cursor],e in d&&(d=d[e],this.cursor++,e=c[this.cursor]));var f=d.op;definitions.assignOps[f]&&c[this.cursor]==="="?(this.cursor++,b.type=ASSIGN,b.assignOp=definitions.tokenIds[definitions.opTypeNames[f]],f+="="):(b.type=definitions.tokenIds[definitions.opTypeNames[f]],b.assignOp=null),b.value=f},lexIdent:function(a,b){var c=this.token,d=a;while((a=this.getValidIdentifierChar(!1))!==null)d+=a;c.type=IDENTIFIER,c.value=d;if(b)return;var e;if(this.parser.mozillaMode){e=definitions.mozillaKeywords[d];if(e){c.type=e;return}}if(this.parser.x.strictMode){e=definitions.strictKeywords[d];if(e){c.type=e;return}}e=definitions.keywords[d],e&&(c.type=e)},get:function(a,b){var c;while(this.lookahead){--this.lookahead,this.tokenIndex=this.tokenIndex+1&3,c=this.tokens[this.tokenIndex];if(c.type!==NEWLINE||this.scanNewlines)return c.type}this.skip(),this.tokenIndex=this.tokenIndex+1&3,c=this.tokens[this.tokenIndex],c||(this.tokens[this.tokenIndex]=c={});var d=this.source;if(this.cursor>=d.length)return c.type=END;c.start=this.cursor,c.lineno=this.lineno;var e=this.getValidIdentifierChar(!0),f=e===null?d[this.cursor++]:null;if(e!==null)this.lexIdent(e,b);else if(a&&f==="/")this.lexRegExp(f);else if(f in opTokens)this.lexOp(f);else if(f===".")this.lexDot(f);else if(f>="1"&&f<="9")this.lexNumber(f);else if(f==="0")this.lexZeroNumber(f);else if(f==='"'||f==="'")this.lexString(f);else{if(!this.scanNewlines||f!=="\n"&&f!=="\r")throw this.newSyntaxError("Illegal token");f==="\r"&&d[this.cursor]==="\n"&&this.cursor++,c.type=NEWLINE,c.value="\n",this.lineno++}return c.end=this.cursor,c.type},unget:function(){if(++this.lookahead===4)throw"PANIC: too much lookahead!";this.tokenIndex=this.tokenIndex-1&3},newSyntaxError:function(a){a=(this.filename?this.filename+":":"")+this.lineno+": "+a;var b=new SyntaxError(a,this.filename,this.lineno);return b.source=this.source,b.cursor=this.lookahead?this.tokens[this.tokenIndex+this.lookahead&3].start:this.cursor,b},getValidIdentifierChar:function(a){var b=this.source;if(this.cursor>=b.length)return null;var c=b[this.cursor];if(c==="\\"&&b[this.cursor+1]==="u"){try{c=String.fromCharCode(parseInt(b.substring(this.cursor+2,this.cursor+6),16))}catch(d){return null}this.cursor+=5}var e=isValidIdentifierChar(c,a);return e&&this.cursor++,e?c:null}},exports.isIdentifier=isIdentifier,exports.Tokenizer=Tokenizer}),define("ace/narcissus/definitions",["require","exports","module"],function(require,exports,module){function defineGetter(a,b,c,d,e){Object.defineProperty(a,b,{get:c,configurable:!d,enumerable:!e})}function defineGetterSetter(a,b,c,d,e,f){Object.defineProperty(a,b,{get:c,set:d,configurable:!e,enumerable:!f})}function defineMemoGetter(a,b,c,d,e){Object.defineProperty(a,b,{get:function(){var f=c();return defineProperty(a,b,f,d,!0,e),f},configurable:!0,enumerable:!e})}function defineProperty(a,b,c,d,e,f){Object.defineProperty(a,b,{value:c,writable:!e,configurable:!d,enumerable:!f})}function isNativeCode(a){return typeof a=="function"&&a.toString().match(/\[native code\]/)}function apply(a,b,c){return Fpapply.call(a,[b].concat(c))}function getPropertyDescriptor(a,b){while(a){if({}.hasOwnProperty.call(a,b))return Object.getOwnPropertyDescriptor(a,b);a=Object.getPrototypeOf(a)}}function getPropertyNames(a){var b=Object.create(null,{});while(a){var c=Object.getOwnPropertyNames(a);for(var d=0,e=c.length;d=",">","<<",">>",">>>","+","-","*","/","%","!","~","UNARY_PLUS","UNARY_MINUS","++","--",".","[","]","{","}","(",")","SCRIPT","BLOCK","LABEL","FOR_IN","CALL","NEW_WITH_ARGS","INDEX","ARRAY_INIT","OBJECT_INIT","PROPERTY_INIT","GETTER","SETTER","GROUP","LIST","LET_BLOCK","ARRAY_COMP","GENERATOR","COMP_TAIL","IMPLEMENTS","INTERFACE","LET","MODULE","PACKAGE","PRIVATE","PROTECTED","PUBLIC","STATIC","USE","YIELD","IDENTIFIER","NUMBER","STRING","REGEXP","break","case","catch","const","continue","debugger","default","delete","do","else","export","false","finally","for","function","if","import","in","instanceof","new","null","return","switch","this","throw","true","try","typeof","var","void","while","with"],strictKeywords={__proto__:null,"implements":!0,"interface":!0,let:!0,"package":!0,"private":!0,"protected":!0,"public":!0,"static":!0,use:!0,yield:!0},statementStartTokens=["break","const","continue","debugger","do","for","if","let","return","switch","throw","try","var","yield","while","with"],whitespaceChars=[" "," ","\f"," "," ",""," ","᠎"," "," "," "," "," "," "," "," "," "," "," "," "," "," "],whitespace={};for(var i=0;i>>":"URSH",">>":"RSH",">=":"GE",">":"GT","++":"INCREMENT","--":"DECREMENT","+":"PLUS","-":"MINUS","*":"MUL","/":"DIV","%":"MOD","!":"NOT","~":"BITWISE_NOT",".":"DOT","[":"LEFT_BRACKET","]":"RIGHT_BRACKET","{":"LEFT_CURLY","}":"RIGHT_CURLY","(":"LEFT_PAREN",")":"RIGHT_PAREN"},keywords={__proto__:null},mozillaKeywords={__proto__:null},tokenIds={},hostSupportsEvalConst=function(){try{return eval("(function(s) { eval(s); return x })('const x = true;')")}catch(e){return!1}}(),consts=hostSupportsEvalConst?"const ":"var ";for(var i=0,j=tokens.length;i0&&(consts+=", ");var t=tokens[i],name;if(/^[a-z]/.test(t)){name=t.toUpperCase();if(name==="LET"||name==="YIELD")mozillaKeywords[name]=i;strictKeywords[name]&&(strictKeywords[name]=i),keywords[t]=i}else name=/^\W/.test(t)?opTypeNames[t]:t;consts+=name+" = "+i,tokenIds[name]=i,tokens[t]=i}consts+=";";var isStatementStartCode={__proto__:null};for(i=0,j=statementStartTokens.length;i>",">>>","+","-","*","/","%"];for(i=0,j=assignOps.length;i'+"\n"; - for (var i=0; i<_paths.length; i++) { - var path = _paths[i]; - svg += ' ' + "\n"; - } - svg += ''; - - self.postMessage({ - svg: svg, - code: e.data - }); - - // Terminate self - self.close(); - } catch (error) { - // err - self.postMessage(""); - } -}; diff --git a/turtle-svg.js b/turtle-svg.js index fe9f99d..5a2f42a 100644 --- a/turtle-svg.js +++ b/turtle-svg.js @@ -1,6 +1,6 @@ window.onload = function(){ - ace.config.set("workerPath", "js"); + ace.config.set("workerPath", "./js/ace"); var editor = ace.edit("editor"); editor.setTheme("ace/theme/monokai"); var session = editor.getSession(); @@ -21,6 +21,7 @@ window.onload = function(){ var svgContainer = document.getElementById("svg-container"); var svgImage = document.getElementById("svg-image"); var info = document.getElementById("info"); + var mirobot = document.getElementById("mirobot"); var testingCode; var testCodeStart; @@ -38,6 +39,8 @@ window.onload = function(){ var workerError = false; var loadingSVG = false; + var currentParsedData; + var labels = { run: "Run", cancel: "Abort", @@ -94,6 +97,7 @@ window.onload = function(){ applyButton.disabled = true; // calculate + show the amount of time that was required to complete SVG creation svgGenTime = Date.now() - testCodeStart; + currentParsedData = e.data; setSVG(e.data, showStats); } @@ -150,6 +154,16 @@ window.onload = function(){ } }; + mirobot.onclick = function(){ + if (!currentParsedData || !currentParsedData.paths) { + return; + } + mirobotConnection = new TurtleMirobot({ + address: 'ws://10.10.100.254:8899/websocket', + commands: currentParsedData.paths + }); + }; + var jshintOK = function() { var annotations = editor.getSession().getAnnotations(); for (var key in annotations) {