"no use strict";(function(e){if(typeof e.window!="undefined"&&e.document)return;e.console={log:function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},error:function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})}},e.window=e,e.ace=e,e.normalizeModule=function(e,t){if(t.indexOf("!")!==-1){var n=t.split("!");return normalizeModule(e,n[0])+"!"+normalizeModule(e,n[1])}if(t.charAt(0)=="."){var r=e.split("/").slice(0,-1).join("/");t=r+"/"+t;while(t.indexOf(".")!==-1&&i!=t){var i=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},e.require=function(e,t){if(!t.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");t=normalizeModule(e,t);var n=require.modules[t];if(n)return n.initialized||(n.initialized=!0,n.exports=n.factory().exports),n.exports;var r=t.split("/");r[0]=require.tlns[r[0]]||r[0];var i=r.join("/")+".js";return require.id=t,importScripts(i),require(e,t)},require.modules={},require.tlns={},e.define=function(e,t,n){arguments.length==2?(n=t,typeof e!="string"&&(t=e,e=require.id)):arguments.length==1&&(n=e,e=require.id);if(e.indexOf("text!")===0)return;var r=function(t,n){return require(e,t,n)};require.modules[e]={factory:function(){var e={exports:{}},t=n(r,e.exports,e);return t&&(e.exports=t),e}}},e.initBaseUrls=function(t){require.tlns=t},e.initSender=function(){var t=require(null,"ace/lib/event_emitter").EventEmitter,n=require(null,"ace/lib/oop"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(r.prototype),new r},e.main=null,e.sender=null,e.onmessage=function(e){var t=e.data;if(t.command){if(!main[t.command])throw new Error("Unknown command:"+t.command);main[t.command].apply(main,t.args)}else if(t.init){initBaseUrls(t.tlns),require(null,"ace/lib/fixoldbrowsers"),sender=initSender();var n=require(null,t.module)[t.classname];main=new n(sender)}else t.event&&sender&&sender._emit(t.event,t.data)}})(this),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e,t,n){e("./regexp"),e("./es5-shim")}),ace.define("ace/lib/regexp",["require","exports","module"],function(e,t,n){function r(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function i(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r1&&i(t,"")>-1&&(a=RegExp(this.source,s.replace.call(r(this),"g","")),s.replace.call(e.slice(t.index),a,function(){for(var e=1;et.index&&this.lastIndex--}return t},u||(RegExp.prototype.test=function(e){var t=s.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!="function")throw new TypeError("Function.prototype.bind called on incompatible "+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,"__defineGetter__"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+tu)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h>>0;if(h(e)!="[object Function]")throw new TypeError;while(++i>>0,i=Array(r),s=arguments[1];if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");for(var o=0;o>>0,i=[],s,o=arguments[1];if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");for(var u=0;u>>0,i=arguments[1];if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");for(var s=0;s>>0,i=arguments[1];if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");for(var s=0;s>>0;if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");if(!r&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;i>>0;if(h(e)!="[object Function]")throw new TypeError(e+" is not a function");if(!r&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)=="[object String]"?this.split(""):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!="object")throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document=="undefined"||i(document.createElement("div"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k="Property description must be an object: ",L="Object.defineProperty called on non-object: ",A="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(e,t,n){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(L+e);if(typeof n!="object"&&typeof n!="function"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,"value"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,"get")&&d(e,t,n.get),p(n,"set")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t=="function"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t="";while(p(e,t))t+="?";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this.insertLines(e.row,n),e=this.insertInLine(e,i||"")),e},this.insertLines=function(e,t){if(t.length==0)return{row:e,column:0};if(t.length>65535){var n=this.insertLines(e,t.slice(65535));t=t.slice(0,65535)}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:"insertLines",range:i,lines:t};return this._emit("change",{data:o}),n||i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||"";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:"insertText",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._emit("change",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||"";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:"insertText",range:s.fromPoints(e,r),text:t};return this._emit("change",{data:i}),r},this.remove=function(e){e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this.removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:"removeText",range:r,text:o};return this._emit("change",{data:a}),r.start},this.removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:"removeLines",range:n,nl:this.getNewLineCharacter(),lines:r};return this._emit("change",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:"removeText",range:r,text:this.getNewLineCharacter()};this._emit("change",{data:o})},this.replace=function(e,t){if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action=="insertLines"?this.removeLines(r.start.row,r.end.row-1):n.action=="insertText"?this.remove(r):n.action=="removeLines"?this.insertLines(r.start.row,n.lines):n.action=="removeText"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.rowthis.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;t.action==="insertText"?s.row===r&&s.column<=i?s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row):s.row!==o.row&&s.row=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),ace.define("ace/lib/lang",["require","exports","module"],function(e,t,n){t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n=ut)return{type:ft,value:"",line:Ct,lineStart:kt,range:[Et,Et]};var e=st.charCodeAt(Et),t=st.charCodeAt(Et+1);Nt=Et;if(C(e))return a();switch(e){case 39:case 34:return l();case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return h();case 46:if(T(t))return h();if(46===t)return 46===st.charCodeAt(Et+2)?f("..."):f("..");return f(".");case 61:if(61===t)return f("==");return f("=");case 62:if(61===t)return f(">=");return f(">");case 60:if(61===t)return f("<=");return f("<");case 126:if(61===t)return f("~=");return r({},gt.expected,"=","~");case 58:if(58===t)return f("::");return f(":");case 91:if(91===t||61===t)return c();return f("[");case 42:case 47:case 94:case 37:case 44:case 123:case 125:case 93:case 40:case 41:case 59:case 35:case 45:case 43:return f(st.charAt(Et))}return s(st.charAt(Et))}function u(){while(Et=ut||x(i))n+=st.slice(t,Et-1),r({},gt.unfinishedString,n+String.fromCharCode(i))}return n+=st.slice(t,Et-1),{type:lt,value:n,line:Ct,lineStart:kt,range:[Nt,Et]}}function c(){var e=g();return!1===e&&r(St,gt.expected,"[",St.value),{type:lt,value:e,line:Ct,lineStart:kt,range:[Nt,Et]}}function h(){var e=st.charAt(Et),t=st.charAt(Et+1),n="0"===e&&~"xX".indexOf(t||null)?p():d();return{type:pt,value:n,line:Ct,lineStart:kt,range:[Nt,Et]}}function p(){var e=0,t=1,n=1,i,s,o,u;u=Et+=2,N(st.charCodeAt(Et))||r({},gt.malformedNumber,st.slice(Nt,Et));while(N(st.charCodeAt(Et)))Et++;i=parseInt(st.slice(u,Et),16);if("."===st.charAt(Et)){s=++Et;while(N(st.charCodeAt(Et)))Et++;e=st.slice(s,Et),e=s===Et?0:parseInt(e,16)/Math.pow(16,Et-s)}if(~"pP".indexOf(st.charAt(Et)||null)){Et++,~"+-".indexOf(st.charAt(Et)||null)&&(n="+"===st.charAt(Et++)?1:-1),o=Et,T(st.charCodeAt(Et))||r({},gt.malformedNumber,st.slice(Nt,Et));while(T(st.charCodeAt(Et)))Et++;t=st.slice(o,Et),t=Math.pow(2,t*n)}return(i+e)*t}function d(){while(T(st.charCodeAt(Et)))Et++;if("."===st.charAt(Et)){Et++;while(T(st.charCodeAt(Et)))Et++}if(~"eE".indexOf(st.charAt(Et)||null)){Et++,~"+-".indexOf(st.charAt(Et)||null)&&Et++,T(st.charCodeAt(Et))||r({},gt.malformedNumber,st.slice(Nt,Et));while(T(st.charCodeAt(Et)))Et++}return parseFloat(st.slice(Nt,Et))}function v(){var e=Et;switch(st.charAt(Et)){case"n":return Et++,"\n";case"r":return Et++,"\r";case"t":return Et++," ";case"v":return Et++," ";case"b":return Et++,"\b";case"f":return Et++,"\f";case"z":return Et++,u(),"";case"x":if(N(st.charCodeAt(Et+1))&&N(st.charCodeAt(Et+2)))return Et+=3,"\\"+st.slice(e,Et);return"\\"+st.charAt(Et++);default:if(T(st.charCodeAt(Et))){while(T(st.charCodeAt(++Et)));return"\\"+st.slice(e,Et)}return st.charAt(Et++)}}function m(){Nt=Et,Et+=2;var e=st.charAt(Et),t="",n=!1,r=Et;"["===e&&(t=g(),!1===t?t=e:(n=!0,Et+=2));if(!n){while(Et",St)}function E(e){e===St.value?y():r(St,gt.expected,e,St.value)}function S(e){return 9===e||32===e||11===e||12===e}function x(e){return 10===e||13===e}function T(e){return e>=48&&e<=57}function N(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function C(e){return e>=65&&e<=90||e>=97&&e<=122||95===e}function k(e){return e>=65&&e<=90||e>=97&&e<=122||95===e||e>=48&&e<=57}function L(e){switch(e.length){case 2:return"do"===e||"if"===e||"in"===e||"or"===e;case 3:return"and"===e||"end"===e||"for"===e||"not"===e;case 4:return"else"===e||"goto"===e||"then"===e;case 5:return"break"===e||"local"===e||"until"===e||"while"===e;case 6:return"elseif"===e||"repeat"===e||"return"===e;case 8:return"function"===e}return!1}function A(e){return dt===e.type?~"#-".indexOf(e.value):ct===e.type?"not"===e.value:!1}function O(e){switch(e.type){case"CallExpression":case"TableCallExpression":case"StringCallExpression":return!0}return!1}function M(e){if(ft===e.type)return!0;if(ct!==e.type)return!1;switch(e.value){case"else":case"elseif":case"end":case"until":return!0;default:return!1}}function _(){y();var e=D();return ft!==St.type&&s(St),yt.chunk(e)}function D(e){var t=[],n;while(!M(St)){if("return"===St.value){t.push(P());break}n=P(),n&&t.push(n)}return t}function P(){if(ct===St.type)switch(St.value){case"local":return y(),W();case"if":return y(),U();case"return":return y(),R();case"function":y();var e=J();return $(e);case"while":return y(),I();case"for":return y(),z();case"repeat":return y(),q();case"break":return y(),B();case"do":return y(),F();case"goto":return y(),j()}if(dt===St.type&&b("::"))return H();if(b(";"))return;return X()}function H(){var e=V();return E("::"),yt.labelStatement(e)}function B(){return yt.breakStatement()}function j(){var e=V();return yt.gotoStatement(e)}function F(){var e=D();return E("end"),yt.doStatement(e)}function I(){var e=Q();E("do");var t=D();return E("end"),yt.whileStatement(e,t)}function q(){var e=D();E("until");var t=w(Q());return yt.repeatStatement(t,e)}function R(){var e=[];if("end"!==St.value){var t=Q();null!=t&&e.push(t);while(b(","))t=w(Q()),e.push(t);b(";")}return yt.returnStatement(e)}function U(){var e=[],t,n;do t=Q(),E("then"),n=D(),e.push(yt.elseifClause(t,n));while(b("elseif"));return b("else")&&(n=D(),e.push(yt.elseClause(n))),E("end"),yt.ifStatement(e)}function z(){var e=V(),t;if(b("=")){var n=w(Q());E(",");var r=w(Q()),i=b(",")?w(Q()):null;return E("do"),t=D(),E("end"),yt.forNumericStatement(e,n,r,i,t)}var s=[e];while(b(","))s.push(V());E("in");var o=[];do{var u=w(Q());o.push(u)}while(b(","));return E("do"),t=D(),E("end"),yt.forGenericStatement(s,o,t)}function W(){if(ht===St.type){var e=[],t=[];do e.push(V());while(b(","));if(b("="))do{var n=w(Q());t.push(n)}while(b(","));return yt.localStatement(e,t)}if(b("function")){var r=V();return $(r,!0)}i("",St)}function X(){var e=St,t=Z();if(null==t)return s(St);if(~",=".indexOf(St.value)){var n=[t],r=[],i;while(b(","))i=w(Z()),n.push(i);E("=");do i=w(Q()),r.push(i);while(b(","));return yt.assignmentStatement(n,r)}return O(t)?yt.callStatement(t):s(e)}function V(){var e=St.value;return ht!==St.type&&i("",St),y(),yt.identifier(e)}function $(e,t){var n=!1,r=[];E("(");if(b("..."))n=!0;else if(ht===St.type)do{if(b("...")){n=!0;break}r.push(V())}while(b(","));n?E(")"):b(")")||i(" or '...'",St);var s=D();return E("end"),t=t||!1,yt.functionStatement(e,r,n,t,s)}function J(){var e=V();while(b("."))e=yt.memberExpression(e,".",V());return b(":")&&(e=yt.memberExpression(e,":",V())),e}function K(){var e=[],t,n;for(;;){if(dt===St.type&&b("["))t=Q(),E("]"),E("="),n=w(Q()),e.push(yt.tableKey(t,n));else if(ht===St.type)t=Q(),b("=")?(n=Q(),e.push(yt.tableKeyString(t,n))):e.push(yt.tableValue(t));else{if(null==(n=Q()))break;e.push(yt.tableValue(n))}if(~",;".indexOf(St.value)){y();continue}if("}"===St.value)break}return E("}"),yt.tableConstructorExpression(e)}function Q(){var e=Y(0);return e}function G(e){var t=e.charCodeAt(0),n=e.length;if(1===n)switch(t){case 94:return 10;case 42:case 47:case 37:return 7;case 43:case 45:return 6;case 60:case 62:return 3}else if(2===n)switch(t){case 46:return 5;case 60:case 62:case 61:case 126:return 3;case 111:return 1}else if(97===t&&"and"===e)return 2;return 0}function Y(e){var t=St.value,n;if(A(St)){y();var r=w(Y(8));n=yt.unaryExpression(t,r)}null==n&&(n=tt(),null==n&&(n=Z()));if(null==n)return null;var i;for(;;){t=St.value,i=dt===St.type||ct===St.type?G(t):0;if(i===0||i<=e)break;("^"===t||".."===t)&&i--,y();var s=w(Y(i));n=yt.binaryExpression(t,n,s)}return n}function Z(){var e;if(ht===St.type)e=V();else{if(!b("("))return null;e=Q(),E(")")}var t,n;for(;;){w(e);if(dt===St.type)switch(St.value){case"[":y(),t=Q(),e=yt.indexExpression(e,t),E("]");break;case".":y(),n=V(),e=yt.memberExpression(e,".",n);break;case":":y(),n=V(),e=yt.memberExpression(e,":",n),e=et(e);break;case"(":case"{":e=et(e);break;default:return e}else{if(lt!==St.type)break;e=et(e)}}return e}function et(e){if(dt===St.type)switch(St.value){case"(":y();var t=[],n=Q();null!=n&&t.push(n);while(b(","))n=w(Q()),t.push(n);return E(")"),yt.callExpression(e,t);case"{":y();var r=K();return yt.tableCallExpression(e,r)}else if(lt===St.type){var s=St.value;return y(),yt.stringCallExpression(e,s)}i("function arguments",St)}function tt(){var e=lt|pt|vt|mt,t=St.value;if(St.type&e){var n=st.slice(St.range[0],St.range[1]);return y(),yt.literal(t,n)}if(ct===St.type&&"function"===St.value)return y(),$(null);if(dt===St.type){if(b("..."))return yt.varargLiteral(t);if(b("{"))return K()}}function nt(t,r){return"undefined"==typeof r&&"object"==typeof t&&(r=t,t=undefined),r||(r={}),st=t||"",ot=n(at,r),Et=0,Ct=1,kt=0,ut=st.length,ot.comments&&(Tt=[]),ot.wait?e:it()}function rt(t){return st+=String(t),ut=st.length,e}function it(e){"undefined"!=typeof e&&rt(e),ut=st.length,xt=o();var t=_();return ot.comments&&(t.comments=Tt),t}e.version="0.0.1";var st,ot,ut,at=e.defaultOptions={wait:!1,comments:!0},ft=1,lt=2,ct=4,ht=8,pt=16,dt=32,vt=64,mt=128,gt=e.errors={unexpected:"Unexpected %1 '%2' near '%3'",expected:"'%1' expected near '%2'",expectedToken:"%1 expected near '%2'",unfinishedString:"unfinished string near '%1'",malformedNumber:"malformed number near '%1'"},yt=e.ast={labelStatement:function(e){return{type:"LabelStatement",label:e}},breakStatement:function(){return{type:"BreakStatement"}},gotoStatement:function(e){return{type:"GotoStatement",label:e}},returnStatement:function(e){return{type:"ReturnStatement",arguments:e}},ifStatement:function(e){return{type:"IfStatement",clauses:e}},elseifClause:function(e,t){return{type:"ElseifClause",condition:e,body:t}},elseClause:function(e){return{type:"ElseClause",body:e}},whileStatement:function(e,t){return{type:"WhileStatement",condition:e,body:t}},doStatement:function(e){return{type:"DoStatement",body:e}},repeatStatement:function(e,t){return{type:"RepeatStatement",condition:e,body:t}},localStatement:function(e,t){return{type:"LocalStatement",variables:e,init:t}},assignmentStatement:function(e,t){return{type:"AssignmentStatement",variables:e,init:t}},callStatement:function(e){return{type:"CallStatement",expression:e}},functionStatement:function(e,t,n,r,i){return{type:"FunctionDeclaration",identifier:e,vararg:n,local:r,parameters:t,body:i}},forNumericStatement:function(e,t,n,r,i){return{type:"ForNumericStatement",variable:e,start:t,end:n,step:r,body:i}},forGenericStatement:function(e,t,n){return{type:"ForGenericStatement",variables:e,iterators:t,body:n}},chunk:function(e){return{type:"Chunk",body:e}},identifier:function(e){return{type:"Identifier",name:e}},literal:function(e,t){return{type:"Literal",value:e,raw:t}},varargLiteral:function(){return{type:"VarargLiteral"}},tableKey:function(e,t){return{type:"TableKey",key:e,value:t}},tableKeyString:function(e,t){return{type:"TableKeyString",key:e,value:t}},tableValue:function(e){return{type:"TableValue",value:e}},tableConstructorExpression:function(e){return{type:"TableConstructorExpression",fields:e}},binaryExpression:function(e,t,n){var r="and"===e||"or"===e?"LogicalExpression":"BinaryExpression";return{type:r,operator:e,left:t,right:n}},unaryExpression:function(e,t){return{type:"UnaryExpression",operator:e,argument:t}},memberExpression:function(e,t,n){return{type:"MemberExpression",indexer:t,identifier:n,base:e}},indexExpression:function(e,t){return{type:"IndexExpression",base:e,index:t}},callExpression:function(e,t){return{type:"CallExpression",base:e,arguments:t}},tableCallExpression:function(e,t){return{type:"TableCallExpression",base:e,arguments:t}},stringCallExpression:function(e,t){return{type:"StringCallExpression",base:e,argument:t}}},bt=Array.prototype.slice,wt=Object.prototype.toString,Et,St,xt,Tt,Nt,Ct,kt;e.parse=nt,e.write=rt,e.end=it,e.lex=o})})