From 25056d788f6f947b25a4cbad7534a818c168a3df Mon Sep 17 00:00:00 2001 From: wes Date: Thu, 8 Jun 2017 19:58:47 -0400 Subject: [PATCH] temp fix --- server/assets/bundle.js | 2 +- server/desugar.js | 11 ++-- server/parse.js | 9 +++ server/prelude.js | 118 +++++++++++++++++++++++++++++++++++++++- server/tags/test.tag | 2 + server/vm.js | 1 + 6 files changed, 135 insertions(+), 8 deletions(-) diff --git a/server/assets/bundle.js b/server/assets/bundle.js index c02fdf8..1495820 100644 --- a/server/assets/bundle.js +++ b/server/assets/bundle.js @@ -1 +1 @@ -!function(){"use strict";function e(e){return Rn.test(e)}function t(e){return typeof e===Nn}function n(e){return e&&typeof e===Sn}function r(e){return typeof e===kn}function i(e){return typeof e===En}function o(e){return r(e)||null===e||""===e}function a(e){return Array.isArray(e)||e instanceof Array}function u(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return r(e[t])||n&&n.writable}function s(e){return Cn.test(e)}function c(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function f(e,t){return(t||document).querySelector(e)}function p(){return document.createDocumentFragment()}function l(){return document.createTextNode("")}function h(e){return!!e.ownerSVGElement}function d(e){return"svg"===e?document.createElementNS(An,e):document.createElement(e)}function m(e,t){if(r(e.innerHTML)){var n=(new DOMParser).parseFromString(t,"application/xml"),i=e.ownerDocument.importNode(n.documentElement,!0);e.appendChild(i)}else e.innerHTML=t}function y(e,t){e.style.display=t?"":"none",e.hidden=!t}function v(e,t){e.removeAttribute(t)}function g(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function x(e,t){return e.getAttribute(t)}function b(e,t,n){var r=jn.exec(t);r&&r[1]?e.setAttributeNS(On,r[1],n):e.setAttribute(t,n)}function w(e,t,n){e.insertBefore(t,n.parentNode&&n)}function _(e,t){if(e)for(var n;n=Dn.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function T(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,T(e,t,i),e=r}}function E(e,t){for(var n=e?e.length:0,r=0;rr;)n--,R.apply(t[n],[t,n])}function R(e,t){e.splice(t,1),this.unmount(),he(this.parent,this,this.__.tagName,!0)}function U(e){var t=this;E(Object.keys(this.tags),function(n){ae.apply(t.tags[n],[n,e])})}function B(e,t,n){n?ve.apply(this,[e,t]):w(e,this.root,t.root)}function P(e,t,n){n?ye.apply(this,[e,t]):w(e,this.root,t.root)}function z(e,t){t?ye.call(this,e):e.appendChild(this.root)}function $(e,t,n){v(e,xn);var r,o=typeof x(e,bn)!==En||v(e,bn),u=fe(e),s=hn[u],c=e.parentNode,f=l(),h=ie(e),d=x(e,gn),m=[],y=[],g=!hn[u],b="VIRTUAL"===e.tagName;return n=Wn.loopKeys(n),n.isLoop=!0,d&&v(e,gn),c.insertBefore(f,e),c.removeChild(e),n.update=function(){n.value=Wn(n.val,t);var c=p(),l=n.value,v=!a(l)&&!i(l),x=f.parentNode;x&&(v?l=(r=l||!1)?Object.keys(l).map(function(e){return D(n,l[e],e)}):[]:r=!1,d&&(l=l.filter(function(e,r){return n.key&&!v?!!Wn(d,D(n,e,r,t)):!!Wn(d,A(Object.create(t),e))})),E(l,function(i,a){var f=o&&typeof i===Sn&&!r,p=y.indexOf(i),d=-1===p,v=!d&&f?p:a,w=m[v],_=a>=y.length,T=f&&d||!f&&!w;i=!r&&n.key?D(n,i,a):i,T?((w=new re(s,{parent:t,isLoop:!0,isAnonymous:g,tagName:u,root:e.cloneNode(g),item:i,index:a},e.innerHTML)).mount(),_?z.apply(w,[c||x,b]):P.apply(w,[x,m[a],b]),_||y.splice(a,0,i),m.splice(a,0,w),h&&le(t.tags,u,w,!0)):v!==a&&f&&(S(l,y[v])&&(B.apply(w,[x,m[a],b]),m.splice(a,0,m.splice(v,1)[0]),y.splice(a,0,y.splice(v,1)[0])),n.pos&&(w[n.pos]=a),!h&&w.tags&&U.call(w,a)),w.__.item=i,w.__.index=a,w.__.parent=t,T||w.update(i)}),M(l,m),y=l.slice(),x.insertBefore(c,f))},n.unmount=function(){E(m,function(e){e.unmount()})},n}function q(e,t,n){var r=this;T(e,function(t,i){var o,a,u,s=t.nodeType,c=i.parent;if(!n&&t===e)return{parent:c};if(3===s&&"STYLE"!==t.parentNode.tagName&&Wn.hasExpr(t.nodeValue)&&c.children.push({dom:t,expr:t.nodeValue}),1!==s)return i;var f="VIRTUAL"===t.tagName;if(o=x(t,xn))return f&&b(t,"loopVirtual",!0),c.children.push($(t,r,o)),!1;if(o=x(t,gn))return c.children.push(Object.create(Xn).init(t,r,o)),!1;if((a=x(t,vn))&&Wn.hasExpr(a))return c.children.push({isRtag:!0,expr:a,dom:t,attrs:[].slice.call(t.attributes)}),!1;if(u=ie(t),f&&(x(t,"virtualized")&&t.parentElement.removeChild(t),u||x(t,"virtualized")||x(t,"loopVirtual")||(u={tmpl:t.outerHTML})),u&&(t!==e||n)){if(!f||x(t,vn)){var p={root:t,parent:r,hasImpl:!0};return c.children.push(ue(u,p,t.innerHTML,r)),!1}b(t,"virtualized",!0);var l=new re({tmpl:t.outerHTML},{root:t,parent:r},t.innerHTML);c.children.push(l)}return V.apply(r,[t,t.attributes,function(e,t){t&&c.children.push(t)}]),{parent:c}},{parent:{children:t}})}function V(t,n,r){var i=this;E(n,function(n){if(!n)return!1;var o,a=n.name,u=e(a);S(yn,a)?o=Object.create(Yn).init(t,i,a,n.value):Wn.hasExpr(n.value)&&(o={dom:t,expr:n.value,attr:a,bool:u}),r(n,o)})}function H(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"t?-1:0}function Qe(e){return xr.groupBy(e.sort(),xr.isEqual)}function Xe(e){var t={};return e.map(function(e){t[e[0]]=e[1]}),t}function Ye(e,t){var n=xr.clone(e);return n.push.apply(n,t),n}function et(e){(e=xr.filter(e,function(e){return e.length>0})).sort(Ze);var t=e.reduce(function(e,t){return!t||t.length<1?"":e+"("+RegExp.escape(t)+")|"},""),n=new RegExp(t);return function(e){var t=n.exec(e);return!(xr.isNull(t)||!t[0])&&t[0]}}function tt(e){console.log("%j\n",e)}function nt(e){if(!e)return!1;var t=e.charCodeAt();return!isNaN(t)&&(4732}function ot(e){var t=e.charCodeAt();return!isNaN(t)&&t>=65&&t<=90}function at(e,t,n){var r=[],i=e[0].charCodeAt(),o=!1,a=0;for(43===i||45===i?(r.push(e[0]),e=e.substr(1),a++):46===i&&(e=e.substr(1),a++,t++,r.push("0"),r.push("."),o=!0);nt(e[0])&&0!==e.length;)r.push(e[0]),e=e.substr(1),t++,a++;if("."===e[0]&&nt(e[1])){for(r.push("."),r.push(e[1]),e=e.substr(2),t++,t++,a++,a++;nt(e[0])&&0!==e.length;)r.push(e[0]),e=e.substr(1),a++,t++;return[a,["float",parseFloat(r.join(""),10),t,n]]}return o?[a,["float",parseFloat(r.join(""),10),t,n]]:[a,["integer",parseInt(r.join(""),10),t,n]]}function ut(e,t,n,r){for(var i=[],o=0;!rt(e[0])&&it(e[0])&&!t(e);)i.push(e[0]),e=e.substr(1),o++,n++;return i=i.join(""),[[o,["identifier",i,n,r]]]}function st(e,t,n,r){var i=ut(e,t,n,r);return i[0][1][0]="constructor",i}function ct(e,t,n){var r=[],i=1,o=t;for(e=e.substr(1);34!==e[0].charCodeAt();)if(r.push(e[0]),e=e.substr(1),i++,o++,e.length<1)throw vr.JSyntaxError(n,t,"Error: missing quotation mark");return i++,[i,["stringlit",r.join(""),o,n]]}function ft(e,t,n){if(e.length<4)return!1;var r=e.substr(0,4);return"then"===r?["thenexp","then"]:"true"===r&&["truelit","true"]}function pt(e,t,n,r,i){var o=n.length;return!(e.length1&&At(r)&&n(At(r)))for(;n(jt(r))&&n(At(r))&&(u.push(e(r)),t(At(u).exprType));){if(!At(r))throw vr.JSyntaxError(o,i,"Unexpected end of source");if(At(r)[0],r.length<=1)break}if(!At(r))throw vr.JSyntaxError(At(r)[3],At(r)[2],"unexpected end of source");return n(At(r))&&u.push(e(r)),u}function Dt(e,t,n,r,i){var o,a,u=Xt(n);if(!e(u))throw vr.JSyntaxError(At(n)[2],At(n)[3],"Unexpected token: ``"+At(n)[0]+"''");if(o=[u],n.length>1&&At(n)[0]===t){for(;At(n)[0]===t;){if(n.pop(),a=Xt(n),!At(n))throw vr.JSyntaxError(At(n)[3],At(n)[2],"Missing terminator: "+t);o.push(a)}return o}return o}function Mt(e,t,n){var r;if("right_square"===At(e)[0]?r=[]:"comma"===At(e)[0]?(e.pop(),r=[]):r=Dt(function(e){return!0},"comma",e,At(e)[3],At(e)[2]),!At(e)||"right_square"!==At(e)[0])throw vr.JSyntaxError(At(e)[3],At(e)[2],"list must be terminated by ]");return e.pop(),Ot(new _r.ListT(r),e,t,n)}function Rt(e,t,n){var r,i,o=Xt(e);if("Name"!==o.exprType)throw vr.JSyntaxError(t,n,"Expected an identifier in function definition");if(r="right_paren"===At(e)[0]?[]:Ct(Xt,Jr,Wt,e,n,t),!e||"right_paren"!==At(e)[0])throw vr.JSyntaxError(t,n,"Formal parameters must be followed by )");return e.pop(),i=Xt(e),Ot(new _r.DefFunc(o,r,i),e,i.linenum,i.charnum)}function Ut(e,t,n){var r,i;if(At(e)||vr.JSyntaxError(t,n,"Unexpected end of source"),r=Ct(zt,jr,Ir,e,n,t),At(e)&&"right_brace"!==At(e)[0])throw vr.JSyntaxError(At(e)[2],At(e)[3],"let/def form must have a closing }");if(!At(e))throw vr.JSyntaxError(xr.last(r).linenum,xr.last(r).charnum,"Unexpected end of source");if(e.pop(),e.length<=0)throw vr.JSyntaxError(xr.last(r).linenum,xr.last(r).charnum,"let/def form must have a body");if("Definition"===(i=Xt(e)).exprType||"FunctionDefinition"===i.exprType)throw vr.JSyntaxError(i.linenum,i.charnum,"Body of a let/def expression cannot be a definition");return Ot(new _r.LetExp(r,i),e,i.linenum,i.charnum)}function Bt(e,t,n){var r,i,o=Xt(e);if("Name"!=o.exprType)throw vr.JSyntaxError(At(e)[3],At(e)[2],"Expected an identifier in function definition");if(r="right_paren"===At(e)[0]?[]:Ct(Xt,Jr,Wt,e,n,t),"right_paren"!==At(e)[0])throw vr.JSyntaxError(t,n,"Formal parameters must be followed by )");if(e.pop(),"->"!==At(e)[1])throw vr.JSyntaxError(At(e)[3],At(e)[2],"Function parameters in let/def form must be followed by ->");return e.pop(),i=Xt(e),Ot(new _r.DefFunc(o,r,i),e,i.linenum,i.charnum)}function Pt(e,t,n){var r,i=Xt(e);if("Name"!=i.exprType)throw vr.JSyntaxError(i.linenum,i.charnum,"Expected an identifier in let/def binding");if(!At(e)||"="!==At(e)[1])throw vr.JSyntaxError(i.linenum,i.charnum,"An identifier in a let/def binding must be followed by ``=''");if(e.pop(),!It(e,["comma","arrow","right_brace","right_square"],i.linenum,i.charnum))throw vr.JSyntaxError(i.linenum,i.charnum,"The binding of "+identifier.val+" must not be followed by "+At(e)[0]);if("Definition"===(r=Xt(e)).exprType||"FunctionDefinition"===r.exprType)throw vr.JSyntaxError(r.linenum,r.charnum,"A definition cannot be the value of a binding");return Ot(new _r.Def(i,r),e,r.linenum,r.charnum)}function zt(e){var t=At(e)[3],n=At(e)[2];return At(e)&&"left_paren"===At(e)[0]?(e.pop(),Bt(e,t,n)):Pt(e,t,n)}function $t(e,t,n){var r,i=Xt(e,t,n);if("TypeOperator"!==i.exprType)throw vr.JSyntaxError(i.linenum,i.charnum,"Expected a type operator in data type definition");if("right_paren"!==At(e)[0])o=Ct(Xt,Jr,Wt,e,n,t);else var o=[];if(!e||"right_paren"!==At(e)[0])throw vr.JSyntaxError(xr.last(o).linenum,xr.last(o).charnum,"Data type parameters must be followed by )");return e.pop(),r=Xt(e),Ot(new _r.DataType(i,o,r),e,r.linenum,r.charnum)}function qt(e,t,n){var r,i;if(e.length<2)throw vr.JSyntaxError(t,n,"Unexpected end of source");if("left_paren"===At(e)[0])return e.pop(),$t(e,t,n);if(It(e,["constructor"],t,n))throw vr.JSyntaxError(t,n,"deftype must be followed by a single constructor if it is not a data type definition with type variables");if(i=Xt(e,t,n),!e)throw vr.JSyntaxError(i.linenum,i.charnum,"Unexpected end of source");if("TypeOperator"!==i.exprType)throw vr.JSyntaxError(i.linenum,i.charnum,"left-hand side of type alias was not a type operator");if("Application"!==(r=Xt(e,t,n)).exprType&&"TypeOperator"!==r.exprType)throw vr.JSyntaxError(r.linenum,r.charnum,"was expecting an application or type operator on the right-hand side of a type alias");return Ot(new _r.DefType(i,r),e,r.linenum,r.charnum)}function Vt(e,t,n){var r,i;if(e.length<2)throw vr.JSyntaxError(t,n,"Unexpected end of source");if("left_paren"===At(e)[0])return e.pop(),Rt(e,t,n);if("left_brace"===At(e)[0])return e.pop(),Ut(e,At(e)[3],At(e)[2]);if(It(e,["identifier"],t,n))throw vr.JSyntaxError(t,n,"def must be followed by identifier, not "+At(e)[0]);if(r=Xt(e),!At(e))throw vr.JSyntaxError(r.linenum,r.charnum,"Unexpected end of source");if(!It(e,["comma","arrow","right_brace","right_square"],r.linenum,r.charnum))throw vr.JSyntaxError(r.linenum,r.charnum,"def "+r.val+" must not be followed by "+At(e)[0]);if("Definition"===(i=Xt(e)).exprType||"FunctionDefinition"===i.exprType)throw vr.JSyntaxError(i.linenum,i.charnum,"A definition cannot be the value of a binding");return Ot(new _r.Def(r,i),e,i.linenum,i.charnum)}function Ht(e,t,n){var r,i;if("integer"!==At(e)[0]||At(e)[1]<1)throw vr.JSyntaxError(t,n,"defop must be followed by integer precedence >= 1");if(e.pop(),"Left"!==At(e)[1]&&"Right"!==At(e)[1])throw vr.JSyntaxError(t,n,"defop must be followed by precedence and then either Left or Right");if(e.pop(),"left_paren"!==At(e)[0])throw vr.JSyntaxError(t,n,"defop arguments must start with (");if(e.pop(),!e.slice(e.length-3,e.length).every(function(e){return"identifier"===e[0]}))throw vr.JSyntaxError(t,n,"defop must be surrounded by exactly 3 identifiers");if(i=e.slice(e.length-3,e.length),e.pop(),e.pop(),e.pop(),"right_paren"!==At(e)[0])throw vr.JSyntaxError(t,n,"defop pattern must be terminated with )");return e.pop(),(r=[new _r.Name(i[1][1]),new _r.Name(i[0][1]),new _r.Name(i[2][1])]).map(function(e){return e.linenum=t,e.charnum=n,e}),Ot(new _r.DefFunc(r[0],r.slice(1,3),Xt(e)),e,xr.last(r).linenum,xr.last(r).charnum)}function Kt(e,t,n){var r,i,o;if(It(e,["def","comma","lambda"],t,n)){if(r=Xt(e),At(e)&&"thenexp"===At(e)[0]){if(e.pop(),i=Xt(e),At(e)&&"elsexp"===At(e)[0]){if(e.pop(),xr.size(e)<1)throw vr.JSyntaxError(i.linenum,i.charnum,"Unexpected end of source");return o=Xt(e),Ot(new _r.If(r,i,o),e,o.linenum,o.charnum)}throw vr.JSyntaxError(i.linenum,i.charnum,"If expression must include an else variant")}throw vr.JSyntaxError(r.linenum,r.charnum,"if ``exp'' must be folowed by ``then'' exp, not "+jt(e)[0])}throw vr.JSyntaxError(t,n,"``if'' cannot be followed by "+At(e)[0])}function Wt(e){return"identifier"===e[0]&&"->"!==e[1]}function Gt(e,t,n){var r=Ct(Xt,Jr,Wt,e,n,t);if("->"!==At(e)[1])throw vr.JSyntaxError(xr.last(r).linenum,xr.last(r).charnum,"arrow must follow parameters in lambda, not "+At(e)[0]);e.pop();var i=Xt(e);return Ot(new _r.FuncT(r,i),e,i.linenum,i.charnum)}function Zt(e,t,n){var r,i,o,a=Xt(e);if(!At(e))throw vr.JSyntaxError(a.linenum,a.charnum,"Unexpected end of source");if(r=At(e),_r.OPInfo[r[1]]){if(i=Qt(e,1,a,a.linenum,a.charnum),At(e)&&"right_paren"===At(e)[0])return e.pop(),i;throw vr.JSyntaxError(a.linenum,a.charnum,"Mismatched parentheses or missing parenthesis on right-hand side")}if(o="right_paren"!==At(e)[0]?Ct(Xt,Cr,Lr,e,At(e)[2],At(e)[3]):[],At(e)&&"right_paren"===At(e)[0])return e.pop(),Ot(_r.makeApp(a,o),e,n,t);throw vr.JSyntaxError(At(e)[3],At(e)[2],"Mismatched parentheses or missing parenthesis on right-hand side")}function Qt(e,t,n,r,i){for(n||(n=Xt(e));;){var o=At(e);if(!o)throw vr.JSyntaxError(r,i,"Unexpected end of source");var a=_r.OPInfo[o[1]];if(!a||a[0]0;)t=Ar.annotate_fvs(Or.desugar(Xt(e),r)),n.push(t);return{ast:n,types:r}}catch(e){void 0!==e.stxerror?(e.stxerror(),console.error("Tokenization error")):console.log(e.errormessage)}}function en(e,t){var n={};n.name=e,n.bindings={};for(var r=0;r=0&&/\s/.test(e[t]););return t}function t(t,u){var s=/.*/g,c=s.lastIndex=u++,f=s.exec(t)[0].match(o);if(f){var p=c+f[0].length,l=t[c=e(t,c)];if(c<0||~n.indexOf(l))return p;if("."===l)"."===t[c-1]&&(u=p);else if("+"===l||"-"===l)(t[--c]!==l||(c=e(t,c))<0||!a.test(t[c]))&&(u=p);else if(~i.indexOf(l)){for(var h=c+1;--c>=0&&a.test(t[c]););~r.indexOf(t.slice(c+1,h))&&(u=p)}}return u}var n="[{(,;:?=|&!^~>%*/",r=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],i=r.reduce(function(e,t){return e+t.slice(-1)},""),o=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,a=/[$\w]/;return t}(),Kn=function(e){function t(e){return e}function n(e,t){return t||(t=b),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function r(e){if(e===v)return g;var t=e.split(" ");if(2!==t.length||h.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(d,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:g[4],t),t[5]=n(e.length>3?/\\({|})/g:g[5],t),t[6]=n(g[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+m,c),t[8]=e,t}function i(e){return e instanceof RegExp?u(e):b[e]}function o(e){(e||(e=v))!==b[8]&&(b=r(e),u=e===v?t:n,b[9]=u(g[9])),x=e}function a(e){var t;t=(e=e||{}).brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return x},enumerable:!0}),s=e,o(t)}var u,s,c="g",f=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,p=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,l=p.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,h=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),d=/(?=[[\]()*+?.^$|])/g,m=p.source+"|"+/(\/)(?![*\/])/.source,y={"(":RegExp("([()])|"+m,c),"[":RegExp("([[\\]])|"+m,c),"{":RegExp("([{}])|"+m,c)},v="{ }",g=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+m,c),v,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],x=void 0,b=[];return i.split=function(e,t,n){function r(e){d&&(e=d+e,d=""),t||a?p.push(e&&e.replace(n[5],"$1")):p.push(e)}function i(n,r,i){return i&&(r=Hn(e,n)),t&&r>n+2&&(c="⁗"+h.length+"~",h.push(e.slice(n,r)),d+=e.slice(u,n)+c,u=r),r}n||(n=b);var o,a,u,s,c,f,p=[],l=n[6],h=[],d="";for(a=u=l.lastIndex=0;o=l.exec(e);){if(f=l.lastIndex,s=o.index,a){if(o[2]){var m=o[2],v=y[m],g=1;for(v.lastIndex=f;o=v.exec(e);)if(o[1]){if(o[1]===m)++g;else if(!--g)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);l.lastIndex=g?e.length:v.lastIndex;continue}if(!o[3]){l.lastIndex=i(s,f,o[4]);continue}}o[1]||(r(e.slice(u,s)),u=l.lastIndex,(l=n[6+(a^=1)]).lastIndex=u)}return e&&u %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=Kn.split(e.replace(u,'"'),1),r=n.qblocks;if(n.length>2||n[0]){var o,a,c=[];for(o=a=0;o1?"["+i.join(",")+'].join(" ").trim()':i[0]:o(e,t)}return e}function o(e,t,n){var r;return e=e.replace(l,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+p+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!h.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var a={};e.hasExpr=Kn.hasExpr,e.loopKeys=Kn.loopKeys,e.clearCache=function(){a={}},e.errorHandler=null;var u=/\u2057/g,s=/\u2057(\d+)~/g,c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},p='"in this?this:'+("object"!=typeof window?"global":"window")+").",l=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=Kn.version="v3.0.8",e}(),Gn=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,u=arguments,s=arguments.length-1,c=new Array(s);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,nr=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,rr=/|>([\S\s]*?)<\/yield\s*>)/gi,ir={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},or=Un&&Un<10?Jn:Fn,ar="div",ur="svg",sr={},cr=sr[dn]={},fr=0,pr=Object.freeze({Tag:G,tag:Z,tag2:Q,mount:X,mixin:Y,update:ee,unregister:te,version:"WIP"}),lr=0,hr=Object.freeze({getTag:ie,inheritFrom:oe,moveChildTag:ae,initChildTag:ue,getImmediateCustomParentTag:se,unmountAll:ce,getTagName:fe,cleanUpData:pe,arrayishAdd:le,arrayishRemove:he,mountTo:de,makeReplaceVirtual:me,makeVirtual:ye,moveVirtual:ve,selectTags:ge}),dr=Qn,mr={tmpl:Wn,brackets:Kn,styleManager:Vn,vdom:ln,styleNode:Vn.styleNode,dom:Pn,check:Bn,misc:Zn,tags:hr},yr=A({},pr,{observable:Gn,settings:dr,util:mr}),vr={JSyntaxError:xe,JTypeError:be,JInternalError:we},gr="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},xr=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){(function(){function n(e){function t(t,n,r,i,o,a){for(;o>=0&&o0?0:u-1;return arguments.length<3&&(i=n[a?a[s]:s],s+=e),t(n,r,i,a,s,u)}}function r(e){return function(t,n,r){n=_(n,r);for(var i=N(t),o=e>0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+u,a):u=o>=0?Math.min(o+1,u):o+u+1;else if(n&&o&&u)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(l.call(r,a,u),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:u-1;o>=0&&o=0&&t<=k};b.each=b.forEach=function(e,t,n){t=w(t,n);var r,i;if(O(e))for(r=0,i=e.length;r=0},b.invoke=function(e,t){var n=l.call(arguments,2),r=b.isFunction(t);return b.map(e,function(e){var i=r?t:e[t];return null==i?i:i.apply(e,n)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,n){var r,i,o=-1/0,a=-1/0;if(null==t&&null!=e)for(var u=0,s=(e=O(e)?e:b.values(e)).length;uo&&(o=r);else t=_(t,n),b.each(e,function(e,n,r){((i=t(e,n,r))>a||i===-1/0&&o===-1/0)&&(o=e,a=i)});return o},b.min=function(e,t,n){var r,i,o=1/0,a=1/0;if(null==t&&null!=e)for(var u=0,s=(e=O(e)?e:b.values(e)).length;ur||void 0===n)return 1;if(nt?(a&&(clearTimeout(a),a=null),u=c,o=e.apply(r,i),a||(r=i=null)):a||!1===n.trailing||(a=setTimeout(s,f)),o}},b.debounce=function(e,t,n){var r,i,o,a,u,s=function(){var c=b.now()-a;c=0?r=setTimeout(s,t-c):(r=null,n||(u=e.apply(o,i),r||(o=i=null)))};return function(){o=this,i=arguments,a=b.now();var c=n&&!r;return r||(r=setTimeout(s,t)),c&&(u=e.apply(o,i),o=i=null),u}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=this,r=t,i=e[t].apply(this,arguments);r--;)i=e[r].call(n,i);return i}},b.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},b.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},b.once=b.partial(b.before,2);var J=!{toString:null}.propertyIsEnumerable("toString"),F=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(y)return y(e);var t=[];for(var n in e)b.has(e,n)&&t.push(n);return J&&o(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var n in e)t.push(n);return J&&o(e,t),t},b.values=function(e){for(var t=b.keys(e),n=t.length,r=Array(n),i=0;i":">",'"':""","'":"'","`":"`"},D=b.invert(C),M=function(e){var t=function(t){return e[t]},n="(?:"+b.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};b.escape=M(C),b.unescape=M(D),b.result=function(e,t,n){var r=null==e?void 0:e[t];return void 0===r&&(r=n),b.isFunction(r)?r.call(e):r};var R=0;b.uniqueId=function(e){var t=++R+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var U=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},P=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+B[e]};b.template=function(e,t,n){!t&&n&&(t=n),t=b.defaults({},t,b.templateSettings);var r=RegExp([(t.escape||U).source,(t.interpolate||U).source,(t.evaluate||U).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,a,u){return o+=e.slice(i,u).replace(P,z),i=u+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var u=function(e){return a.call(this,e,b)},s=t.variable||"obj";return u.source="function("+s+"){\n"+o+"}",u},b.chain=function(e){var t=b(e);return t._chain=!0,t};var $=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var n=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return p.apply(e,arguments),$(this,n.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=s[e];b.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],$(this,n)}}),b.each(["concat","join","slice"],function(e){var t=s[e];b.prototype[e]=function(){return $(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped}}).call(gr)}),br={display:function(){return this.exprType+" "+this.val},type:function(){return this.exprType},linenum:0,charnum:0},wr={unify:function(e){if(this.expr===e.expr)return e.expr;console.log("Could not unify "+this.expr+" with "+e.expr)},isTypeExpr:!0,linenum:0,charnum:0};Se.prototype=br,ke.prototype=br,Ne.prototype=br,Oe.prototype=br,Ae.prototype=br,je.prototype=br,Ie.prototype=br,Je.prototype=br,Fe.prototype=br,Le.prototype=br,Ce.prototype=br,De.prototype=br,Me.prototype=br,Re.prototype=br,Ue.prototype=br,Be.prototype=wr,Pe.prototype=wr,$e.prototype=wr,qe.prototype=br;var _r={IntT:Ne,FloatT:Oe,StrT:Ae,BoolT:je,ListT:Ie,FuncT:Fe,App:Ce,Name:De,Def:Me,OpT:Le,OPInfo:{"::":[2,"Left"],",":[1,"Left"],"->":[1,"Right"]},makeApp:Ke,If:Ue,DefFunc:Re,UnaryOp:ke,Nil:Je,LetExp:Se,gensym:function(){var e=0;return function(){var t="G"+e;return e+=1,t}}(),TypeVar:Be,TypeOp:Pe,TypeDecl:$e,Closure:Ee,isTypeExpr:Te,DefType:qe,DataType:He};RegExp.escape=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")};var Tr={not:Ge,groupOps:Qe,opMatch:et,dict:Xe,extend:Ye,empty:We,debugPrint:tt},Er={src:"\n;; This file declares the various types used by intrinsic/prelude definitions\n;; It is sort of special in that it doesn't care whether there are any associated definitions\n;; just that there are type definitions for that particular binding's name\n"},Sr=Object.keys(_r.OPInfo),kr=["defop","integer","constructor","left_paren","identifier","identifier","identifier","right_paren"],Nr={tokenize:mt,isIdentifier:it},Or={desugar:Tt},Ar=(xr.compose(Tr.not,xr.partial(xr.equal,[])),{annotate_fvs:kt}),jr=Jt(["Definition","FunctionDefinition"].map(Lt)),Ir=xr.compose(Tr.not,Jt(["right_brace"].map(Ft))),Jr=Jt(["Name"].map(Lt)),Fr=["def","comma","right_paren","right_square","right_brace","left_brace","right_brace"].map(Ft),Lr=xr.compose(Tr.not,Jt(Fr)),Cr=xr.compose(Tr.not,Jt(["Definition"].map(Lt))),Dr={parse:function(e){return Yt(Nr.tokenize(e))},tokenize:Nr.tokenize,parseFull:Yt},Mr={lookup:tn,makeEnv:en}.makeEnv("toplevel",[["len",function(e){return e.length}],["+",function(e){return function(t){return e+t}}],["*",function(e){return function(t){return e*t}}],["-",function(e){return function(t){return e-t}}],["/",function(e){return function(t){return e/t}}],[":",nn],["a",2],["b",3]]),Rr={evaluateString:on};yr.tag2("test",'

{output}

',"","",function(e){var t=this;t.output="",this.evaluate=function(){var e=this.refs.input;t.update({output:JSON.stringify(Rr.evaluateString(e.value))})}.bind(this)}),yr.mount("test")}(); +!function(){"use strict";function e(e){return Mn.test(e)}function t(e){return typeof e===Sn}function n(e){return e&&typeof e===Tn}function r(e){return typeof e===En}function i(e){return typeof e===_n}function o(e){return r(e)||null===e||""===e}function a(e){return Array.isArray(e)||e instanceof Array}function u(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return r(e[t])||n&&n.writable}function s(e){return Jn.test(e)}function c(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function f(e,t){return(t||document).querySelector(e)}function p(){return document.createDocumentFragment()}function l(){return document.createTextNode("")}function h(e){return!!e.ownerSVGElement}function d(e){return"svg"===e?document.createElementNS(Nn,e):document.createElement(e)}function m(e,t){if(r(e.innerHTML)){var n=(new DOMParser).parseFromString(t,"application/xml"),i=e.ownerDocument.importNode(n.documentElement,!0);e.appendChild(i)}else e.innerHTML=t}function y(e,t){e.style.display=t?"":"none",e.hidden=!t}function g(e,t){e.removeAttribute(t)}function v(e){return Object.keys(e).reduce(function(t,n){return t+" "+n+": "+e[n]+";"},"")}function x(e,t){return e.getAttribute(t)}function b(e,t,n){var r=On.exec(t);r&&r[1]?e.setAttributeNS(kn,r[1],n):e.setAttribute(t,n)}function w(e,t,n){e.insertBefore(t,n.parentNode&&n)}function _(e,t){if(e)for(var n;n=Fn.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function T(e,t,n){if(e){var r,i=t(e,n);if(!1===i)return;for(e=e.firstChild;e;)r=e.nextSibling,T(e,t,i),e=r}}function E(e,t){for(var n=e?e.length:0,r=0;rr;)n--,R.apply(t[n],[t,n])}function R(e,t){e.splice(t,1),this.unmount(),he(this.parent,this,this.__.tagName,!0)}function U(e){var t=this;E(Object.keys(this.tags),function(n){ae.apply(t.tags[n],[n,e])})}function B(e,t,n){n?ge.apply(this,[e,t]):w(e,this.root,t.root)}function P(e,t,n){n?ye.apply(this,[e,t]):w(e,this.root,t.root)}function z(e,t){t?ye.call(this,e):e.appendChild(this.root)}function $(e,t,n){g(e,gn);var r,o=typeof x(e,vn)!==_n||g(e,vn),u=fe(e),s=pn[u],c=e.parentNode,f=l(),h=ie(e),d=x(e,yn),m=[],y=[],v=!pn[u],b="VIRTUAL"===e.tagName;return n=Hn.loopKeys(n),n.isLoop=!0,d&&g(e,yn),c.insertBefore(f,e),c.removeChild(e),n.update=function(){n.value=Hn(n.val,t);var c=p(),l=n.value,g=!a(l)&&!i(l),x=f.parentNode;x&&(g?l=(r=l||!1)?Object.keys(l).map(function(e){return M(n,l[e],e)}):[]:r=!1,d&&(l=l.filter(function(e,r){return n.key&&!g?!!Hn(d,M(n,e,r,t)):!!Hn(d,A(Object.create(t),e))})),E(l,function(i,a){var f=o&&typeof i===Tn&&!r,p=y.indexOf(i),d=-1===p,g=!d&&f?p:a,w=m[g],_=a>=y.length,T=f&&d||!f&&!w;i=!r&&n.key?M(n,i,a):i,T?((w=new re(s,{parent:t,isLoop:!0,isAnonymous:v,tagName:u,root:e.cloneNode(v),item:i,index:a},e.innerHTML)).mount(),_?z.apply(w,[c||x,b]):P.apply(w,[x,m[a],b]),_||y.splice(a,0,i),m.splice(a,0,w),h&&le(t.tags,u,w,!0)):g!==a&&f&&(S(l,y[g])&&(B.apply(w,[x,m[a],b]),m.splice(a,0,m.splice(g,1)[0]),y.splice(a,0,y.splice(g,1)[0])),n.pos&&(w[n.pos]=a),!h&&w.tags&&U.call(w,a)),w.__.item=i,w.__.index=a,w.__.parent=t,T||w.update(i)}),D(l,m),y=l.slice(),x.insertBefore(c,f))},n.unmount=function(){E(m,function(e){e.unmount()})},n}function q(e,t,n){var r=this;T(e,function(t,i){var o,a,u,s=t.nodeType,c=i.parent;if(!n&&t===e)return{parent:c};if(3===s&&"STYLE"!==t.parentNode.tagName&&Hn.hasExpr(t.nodeValue)&&c.children.push({dom:t,expr:t.nodeValue}),1!==s)return i;var f="VIRTUAL"===t.tagName;if(o=x(t,gn))return f&&b(t,"loopVirtual",!0),c.children.push($(t,r,o)),!1;if(o=x(t,yn))return c.children.push(Object.create(Zn).init(t,r,o)),!1;if((a=x(t,mn))&&Hn.hasExpr(a))return c.children.push({isRtag:!0,expr:a,dom:t,attrs:[].slice.call(t.attributes)}),!1;if(u=ie(t),f&&(x(t,"virtualized")&&t.parentElement.removeChild(t),u||x(t,"virtualized")||x(t,"loopVirtual")||(u={tmpl:t.outerHTML})),u&&(t!==e||n)){if(!f||x(t,mn)){var p={root:t,parent:r,hasImpl:!0};return c.children.push(ue(u,p,t.innerHTML,r)),!1}b(t,"virtualized",!0);var l=new re({tmpl:t.outerHTML},{root:t,parent:r},t.innerHTML);c.children.push(l)}return V.apply(r,[t,t.attributes,function(e,t){t&&c.children.push(t)}]),{parent:c}},{parent:{children:t}})}function V(t,n,r){var i=this;E(n,function(n){if(!n)return!1;var o,a=n.name,u=e(a);S(dn,a)?o=Object.create(Qn).init(t,i,a,n.value):Hn.hasExpr(n.value)&&(o={dom:t,expr:n.value,attr:a,bool:u}),r(n,o)})}function H(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"t?-1:0}function Qe(e){return gr.groupBy(e.sort(),gr.isEqual)}function Xe(e){var t={};return e.map(function(e){t[e[0]]=e[1]}),t}function Ye(e,t){var n=gr.clone(e);return n.push.apply(n,t),n}function et(e){(e=gr.filter(e,function(e){return e.length>0})).sort(Ze);var t=e.reduce(function(e,t){return!t||t.length<1?"":e+"("+RegExp.escape(t)+")|"},""),n=new RegExp(t);return function(e){var t=n.exec(e);return!(gr.isNull(t)||!t[0])&&t[0]}}function tt(e){console.log("%j\n",e)}function nt(e){if(!e)return!1;var t=e.charCodeAt();return!isNaN(t)&&(4732}function ot(e){var t=e.charCodeAt();return!isNaN(t)&&t>=65&&t<=90}function at(e,t,n){var r=[],i=e[0].charCodeAt(),o=!1,a=0;for(43===i||45===i?(r.push(e[0]),e=e.substr(1),a++):46===i&&(e=e.substr(1),a++,t++,r.push("0"),r.push("."),o=!0);nt(e[0])&&0!==e.length;)r.push(e[0]),e=e.substr(1),t++,a++;if("."===e[0]&&nt(e[1])){for(r.push("."),r.push(e[1]),e=e.substr(2),t++,t++,a++,a++;nt(e[0])&&0!==e.length;)r.push(e[0]),e=e.substr(1),a++,t++;return[a,["float",parseFloat(r.join(""),10),t,n]]}return o?[a,["float",parseFloat(r.join(""),10),t,n]]:[a,["integer",parseInt(r.join(""),10),t,n]]}function ut(e,t,n,r){for(var i=[],o=0;!rt(e[0])&&it(e[0])&&!t(e);)i.push(e[0]),e=e.substr(1),o++,n++;return i=i.join(""),[[o,["identifier",i,n,r]]]}function st(e,t,n,r){var i=ut(e,t,n,r);return i[0][1][0]="constructor",i}function ct(e,t,n){var r=[],i=1,o=t;for(e=e.substr(1);34!==e[0].charCodeAt();)if(r.push(e[0]),e=e.substr(1),i++,o++,e.length<1)throw mr.JSyntaxError(n,t,"Error: missing quotation mark");return i++,[i,["stringlit",r.join(""),o,n]]}function ft(e,t,n){if(e.length<4)return!1;var r=e.substr(0,4);return"then"===r?["thenexp","then"]:"true"===r&&["truelit","true"]}function pt(e,t,n,r,i){var o=n.length;return!(e.length1&&Nt(r)&&n(Nt(r)))for(;n(Ot(r))&&n(Nt(r))&&(u.push(e(r)),t(Nt(u).exprType));){if(!Nt(r))throw mr.JSyntaxError(o,i,"Unexpected end of source");if(Nt(r)[0],r.length<=1)break}if(!Nt(r))throw mr.JSyntaxError(Nt(r)[3],Nt(r)[2],"unexpected end of source");return n(Nt(r))&&u.push(e(r)),u}function Ft(e,t,n,r,i){var o,a,u=Zt(n);if(!e(u))throw mr.JSyntaxError(Nt(n)[2],Nt(n)[3],"Unexpected token: ``"+Nt(n)[0]+"''");if(o=[u],n.length>1&&Nt(n)[0]===t){for(;Nt(n)[0]===t;){if(n.pop(),a=Zt(n),!Nt(n))throw mr.JSyntaxError(Nt(n)[3],Nt(n)[2],"Missing terminator: "+t);o.push(a)}return o}return o}function Ct(e,t,n){var r;if("right_square"===Nt(e)[0]?r=[]:"comma"===Nt(e)[0]?(e.pop(),r=[]):r=Ft(function(e){return!0},"comma",e,Nt(e)[3],Nt(e)[2]),!Nt(e)||"right_square"!==Nt(e)[0])throw mr.JSyntaxError(Nt(e)[3],Nt(e)[2],"list must be terminated by ]");return e.pop(),kt(new br.ListT(r),e,t,n)}function Mt(e,t,n){var r,i,o=Zt(e);if("Name"!==o.exprType)throw mr.JSyntaxError(t,n,"Expected an identifier in function definition");if(r="right_paren"===Nt(e)[0]?[]:Jt(Zt,jr,Ht,e,n,t),!e||"right_paren"!==Nt(e)[0])throw mr.JSyntaxError(t,n,"Formal parameters must be followed by )");return e.pop(),i=Zt(e),kt(new br.DefFunc(o,r,i),e,i.linenum,i.charnum)}function Dt(e,t,n){var r,i;if(Nt(e)||mr.JSyntaxError(t,n,"Unexpected end of source"),r=Jt(Bt,Or,Ar,e,n,t),Nt(e)&&"right_brace"!==Nt(e)[0])throw mr.JSyntaxError(Nt(e)[2],Nt(e)[3],"let/def form must have a closing }");if(!Nt(e))throw mr.JSyntaxError(gr.last(r).linenum,gr.last(r).charnum,"Unexpected end of source");if(e.pop(),e.length<=0)throw mr.JSyntaxError(gr.last(r).linenum,gr.last(r).charnum,"let/def form must have a body");if("Definition"===(i=Zt(e)).exprType||"FunctionDefinition"===i.exprType)throw mr.JSyntaxError(i.linenum,i.charnum,"Body of a let/def expression cannot be a definition");return kt(new br.LetExp(r,i),e,i.linenum,i.charnum)}function Rt(e,t,n){var r,i,o=Zt(e);if("Name"!=o.exprType)throw mr.JSyntaxError(Nt(e)[3],Nt(e)[2],"Expected an identifier in function definition");if(r="right_paren"===Nt(e)[0]?[]:Jt(Zt,jr,Ht,e,n,t),"right_paren"!==Nt(e)[0])throw mr.JSyntaxError(t,n,"Formal parameters must be followed by )");if(e.pop(),"->"!==Nt(e)[1])throw mr.JSyntaxError(Nt(e)[3],Nt(e)[2],"Function parameters in let/def form must be followed by ->");return e.pop(),i=Zt(e),kt(new br.DefFunc(o,r,i),e,i.linenum,i.charnum)}function Ut(e,t,n){var r,i=Zt(e);if("Name"!=i.exprType)throw mr.JSyntaxError(i.linenum,i.charnum,"Expected an identifier in let/def binding");if(!Nt(e)||"="!==Nt(e)[1])throw mr.JSyntaxError(i.linenum,i.charnum,"An identifier in a let/def binding must be followed by ``=''");if(e.pop(),!At(e,["comma","arrow","right_brace","right_square"],i.linenum,i.charnum))throw mr.JSyntaxError(i.linenum,i.charnum,"The binding of "+identifier.val+" must not be followed by "+Nt(e)[0]);if("Definition"===(r=Zt(e)).exprType||"FunctionDefinition"===r.exprType)throw mr.JSyntaxError(r.linenum,r.charnum,"A definition cannot be the value of a binding");return kt(new br.Def(i,r),e,r.linenum,r.charnum)}function Bt(e){var t=Nt(e)[3],n=Nt(e)[2];return Nt(e)&&"left_paren"===Nt(e)[0]?(e.pop(),Rt(e,t,n)):Ut(e,t,n)}function Pt(e,t,n){var r,i=Zt(e,t,n);if("TypeOperator"!==i.exprType)throw mr.JSyntaxError(i.linenum,i.charnum,"Expected a type operator in data type definition");if("right_paren"!==Nt(e)[0])o=Jt(Zt,jr,Ht,e,n,t);else var o=[];if(!e||"right_paren"!==Nt(e)[0])throw mr.JSyntaxError(gr.last(o).linenum,gr.last(o).charnum,"Data type parameters must be followed by )");return e.pop(),r=Zt(e),kt(new br.DataType(i,o,r),e,r.linenum,r.charnum)}function zt(e,t,n){var r,i;if(e.length<2)throw mr.JSyntaxError(t,n,"Unexpected end of source");if("left_paren"===Nt(e)[0])return e.pop(),Pt(e,t,n);if(At(e,["constructor"],t,n))throw mr.JSyntaxError(t,n,"deftype must be followed by a single constructor if it is not a data type definition with type variables");if(i=Zt(e,t,n),!e)throw mr.JSyntaxError(i.linenum,i.charnum,"Unexpected end of source");if("TypeOperator"!==i.exprType)throw mr.JSyntaxError(i.linenum,i.charnum,"left-hand side of type alias was not a type operator");if("Application"!==(r=Zt(e,t,n)).exprType&&"TypeOperator"!==r.exprType)throw mr.JSyntaxError(r.linenum,r.charnum,"was expecting an application or type operator on the right-hand side of a type alias");return kt(new br.DefType(i,r),e,r.linenum,r.charnum)}function $t(e,t,n){var r,i;if(e.length<2)throw mr.JSyntaxError(t,n,"Unexpected end of source");if("left_paren"===Nt(e)[0])return e.pop(),Mt(e,t,n);if("left_brace"===Nt(e)[0])return e.pop(),Dt(e,Nt(e)[3],Nt(e)[2]);if(At(e,["identifier"],t,n))throw mr.JSyntaxError(t,n,"def must be followed by identifier, not "+Nt(e)[0]);if(r=Zt(e),!Nt(e))throw mr.JSyntaxError(r.linenum,r.charnum,"Unexpected end of source");if(!At(e,["comma","arrow","right_brace","right_square"],r.linenum,r.charnum))throw mr.JSyntaxError(r.linenum,r.charnum,"def "+r.val+" must not be followed by "+Nt(e)[0]);if("Definition"===(i=Zt(e)).exprType||"FunctionDefinition"===i.exprType)throw mr.JSyntaxError(i.linenum,i.charnum,"A definition cannot be the value of a binding");return kt(new br.Def(r,i),e,i.linenum,i.charnum)}function qt(e,t,n){var r,i;if("integer"!==Nt(e)[0]||Nt(e)[1]<1)throw mr.JSyntaxError(t,n,"defop must be followed by integer precedence >= 1");if(e.pop(),"Left"!==Nt(e)[1]&&"Right"!==Nt(e)[1])throw mr.JSyntaxError(t,n,"defop must be followed by precedence and then either Left or Right");if(e.pop(),"left_paren"!==Nt(e)[0])throw mr.JSyntaxError(t,n,"defop arguments must start with (");if(e.pop(),!e.slice(e.length-3,e.length).every(function(e){return"identifier"===e[0]}))throw mr.JSyntaxError(t,n,"defop must be surrounded by exactly 3 identifiers");if(i=e.slice(e.length-3,e.length),e.pop(),e.pop(),e.pop(),"right_paren"!==Nt(e)[0])throw mr.JSyntaxError(t,n,"defop pattern must be terminated with )");return e.pop(),(r=[new br.Name(i[1][1]),new br.Name(i[0][1]),new br.Name(i[2][1])]).map(function(e){return e.linenum=t,e.charnum=n,e}),kt(new br.DefFunc(r[0],r.slice(1,3),Zt(e)),e,gr.last(r).linenum,gr.last(r).charnum)}function Vt(e,t,n){var r,i,o;if(At(e,["def","comma","lambda"],t,n)){if(r=Zt(e),Nt(e)&&"thenexp"===Nt(e)[0]){if(e.pop(),i=Zt(e),Nt(e)&&"elsexp"===Nt(e)[0]){if(e.pop(),gr.size(e)<1)throw mr.JSyntaxError(i.linenum,i.charnum,"Unexpected end of source");return o=Zt(e),kt(new br.If(r,i,o),e,o.linenum,o.charnum)}throw mr.JSyntaxError(i.linenum,i.charnum,"If expression must include an else variant")}throw mr.JSyntaxError(r.linenum,r.charnum,"if ``exp'' must be folowed by ``then'' exp, not "+Ot(e)[0])}throw mr.JSyntaxError(t,n,"``if'' cannot be followed by "+Nt(e)[0])}function Ht(e){return"identifier"===e[0]&&"->"!==e[1]}function Kt(e,t,n){var r=Jt(Zt,jr,Ht,e,n,t);if("->"!==Nt(e)[1])throw mr.JSyntaxError(gr.last(r).linenum,gr.last(r).charnum,"arrow must follow parameters in lambda, not "+Nt(e)[0]);e.pop();var i=Zt(e);return kt(new br.FuncT(r,i),e,i.linenum,i.charnum)}function Wt(e,t,n){var r,i,o,a=Zt(e);if(console.log("computing app"),console.log(e),!Nt(e))throw mr.JSyntaxError(a.linenum,a.charnum,"Unexpected end of source");if(r=Nt(e),br.OPInfo[r[1]]){if(console.log("matched infix"),i=Gt(e,1,a,a.linenum,a.charnum),Nt(e)&&"right_paren"===Nt(e)[0])return e.pop(),i;throw mr.JSyntaxError(a.linenum,a.charnum,"Mismatched parentheses or missing parenthesis on right-hand side")}if(o="right_paren"!==Nt(e)[0]?Jt(Zt,Jr,Ir,e,Nt(e)[2],Nt(e)[3]):[],Nt(e)&&"right_paren"===Nt(e)[0])return e.pop(),kt(br.makeApp(a,o),e,n,t);throw mr.JSyntaxError(Nt(e)[3],Nt(e)[2],"Mismatched parentheses or missing parenthesis on right-hand side")}function Gt(e,t,n,r,i){for(n||(n=Zt(e));;){var o=Nt(e);if(!o)throw mr.JSyntaxError(r,i,"Unexpected end of source");var a=br.OPInfo[o[1]];if(!a||a[0]0;)t=Nr.annotate_fvs(kr.desugar(Zt(e),r)),n.push(t);return{ast:n,types:r}}catch(e){void 0!==e.stxerror?(e.stxerror(),console.error("Tokenization error")):console.log(e.errormessage)}}function Xt(e,t){var n={};n.name=e,n.bindings={};for(var r=0;r=0&&/\s/.test(e[t]););return t}function t(t,u){var s=/.*/g,c=s.lastIndex=u++,f=s.exec(t)[0].match(o);if(f){var p=c+f[0].length,l=t[c=e(t,c)];if(c<0||~n.indexOf(l))return p;if("."===l)"."===t[c-1]&&(u=p);else if("+"===l||"-"===l)(t[--c]!==l||(c=e(t,c))<0||!a.test(t[c]))&&(u=p);else if(~i.indexOf(l)){for(var h=c+1;--c>=0&&a.test(t[c]););~r.indexOf(t.slice(c+1,h))&&(u=p)}}return u}var n="[{(,;:?=|&!^~>%*/",r=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],i=r.reduce(function(e,t){return e+t.slice(-1)},""),o=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,a=/[$\w]/;return t}(),Vn=function(e){function t(e){return e}function n(e,t){return t||(t=b),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function r(e){if(e===g)return v;var t=e.split(" ");if(2!==t.length||h.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(d,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:v[4],t),t[5]=n(e.length>3?/\\({|})/g:v[5],t),t[6]=n(v[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+m,c),t[8]=e,t}function i(e){return e instanceof RegExp?u(e):b[e]}function o(e){(e||(e=g))!==b[8]&&(b=r(e),u=e===g?t:n,b[9]=u(v[9])),x=e}function a(e){var t;t=(e=e||{}).brackets,Object.defineProperty(e,"brackets",{set:o,get:function(){return x},enumerable:!0}),s=e,o(t)}var u,s,c="g",f=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,p=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,l=p.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,h=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),d=/(?=[[\]()*+?.^$|])/g,m=p.source+"|"+/(\/)(?![*\/])/.source,y={"(":RegExp("([()])|"+m,c),"[":RegExp("([[\\]])|"+m,c),"{":RegExp("([{}])|"+m,c)},g="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+m,c),g,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],x=void 0,b=[];return i.split=function(e,t,n){function r(e){d&&(e=d+e,d=""),t||a?p.push(e&&e.replace(n[5],"$1")):p.push(e)}function i(n,r,i){return i&&(r=qn(e,n)),t&&r>n+2&&(c="⁗"+h.length+"~",h.push(e.slice(n,r)),d+=e.slice(u,n)+c,u=r),r}n||(n=b);var o,a,u,s,c,f,p=[],l=n[6],h=[],d="";for(a=u=l.lastIndex=0;o=l.exec(e);){if(f=l.lastIndex,s=o.index,a){if(o[2]){var m=o[2],g=y[m],v=1;for(g.lastIndex=f;o=g.exec(e);)if(o[1]){if(o[1]===m)++v;else if(!--v)break}else g.lastIndex=i(o.index,g.lastIndex,o[2]);l.lastIndex=v?e.length:g.lastIndex;continue}if(!o[3]){l.lastIndex=i(s,f,o[4]);continue}}o[1]||(r(e.slice(u,s)),u=l.lastIndex,(l=n[6+(a^=1)]).lastIndex=u)}return e&&u %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=Vn.split(e.replace(u,'"'),1),r=n.qblocks;if(n.length>2||n[0]){var o,a,c=[];for(o=a=0;o1?"["+i.join(",")+'].join(" ").trim()':i[0]:o(e,t)}return e}function o(e,t,n){var r;return e=e.replace(l,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+p+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!h.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var a={};e.hasExpr=Vn.hasExpr,e.loopKeys=Vn.loopKeys,e.clearCache=function(){a={}},e.errorHandler=null;var u=/\u2057/g,s=/\u2057(\d+)~/g,c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},p='"in this?this:'+("object"!=typeof window?"global":"window")+").",l=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=Vn.version="v3.0.8",e}(),Kn=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,u=arguments,s=arguments.length-1,c=new Array(s);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,er=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,tr=/|>([\S\s]*?)<\/yield\s*>)/gi,nr={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},rr=Dn&&Dn<10?jn:Ln,ir="div",or="svg",ar={},ur=ar[ln]={},sr=0,cr=Object.freeze({Tag:G,tag:Z,tag2:Q,mount:X,mixin:Y,update:ee,unregister:te,version:"WIP"}),fr=0,pr=Object.freeze({getTag:ie,inheritFrom:oe,moveChildTag:ae,initChildTag:ue,getImmediateCustomParentTag:se,unmountAll:ce,getTagName:fe,cleanUpData:pe,arrayishAdd:le,arrayishRemove:he,mountTo:de,makeReplaceVirtual:me,makeVirtual:ye,moveVirtual:ge,selectTags:ve}),lr=Gn,hr={tmpl:Hn,brackets:Vn,styleManager:$n,vdom:fn,styleNode:$n.styleNode,dom:Un,check:Rn,misc:Wn,tags:pr},dr=A({},cr,{observable:Kn,settings:lr,util:hr}),mr={JSyntaxError:xe,JTypeError:be,JInternalError:we},yr="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},gr=function(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e,t){(function(){function n(e){function t(t,n,r,i,o,a){for(;o>=0&&o0?0:u-1;return arguments.length<3&&(i=n[a?a[s]:s],s+=e),t(n,r,i,a,s,u)}}function r(e){return function(t,n,r){n=_(n,r);for(var i=N(t),o=e>0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+u,a):u=o>=0?Math.min(o+1,u):o+u+1;else if(n&&o&&u)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(l.call(r,a,u),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:u-1;o>=0&&o=0&&t<=k};b.each=b.forEach=function(e,t,n){t=w(t,n);var r,i;if(O(e))for(r=0,i=e.length;r=0},b.invoke=function(e,t){var n=l.call(arguments,2),r=b.isFunction(t);return b.map(e,function(e){var i=r?t:e[t];return null==i?i:i.apply(e,n)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,n){var r,i,o=-1/0,a=-1/0;if(null==t&&null!=e)for(var u=0,s=(e=O(e)?e:b.values(e)).length;uo&&(o=r);else t=_(t,n),b.each(e,function(e,n,r){((i=t(e,n,r))>a||i===-1/0&&o===-1/0)&&(o=e,a=i)});return o},b.min=function(e,t,n){var r,i,o=1/0,a=1/0;if(null==t&&null!=e)for(var u=0,s=(e=O(e)?e:b.values(e)).length;ur||void 0===n)return 1;if(nt?(a&&(clearTimeout(a),a=null),u=c,o=e.apply(r,i),a||(r=i=null)):a||!1===n.trailing||(a=setTimeout(s,f)),o}},b.debounce=function(e,t,n){var r,i,o,a,u,s=function(){var c=b.now()-a;c=0?r=setTimeout(s,t-c):(r=null,n||(u=e.apply(o,i),r||(o=i=null)))};return function(){o=this,i=arguments,a=b.now();var c=n&&!r;return r||(r=setTimeout(s,t)),c&&(u=e.apply(o,i),o=i=null),u}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=this,r=t,i=e[t].apply(this,arguments);r--;)i=e[r].call(n,i);return i}},b.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},b.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},b.once=b.partial(b.before,2);var I=!{toString:null}.propertyIsEnumerable("toString"),J=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(y)return y(e);var t=[];for(var n in e)b.has(e,n)&&t.push(n);return I&&o(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var n in e)t.push(n);return I&&o(e,t),t},b.values=function(e){for(var t=b.keys(e),n=t.length,r=Array(n),i=0;i":">",'"':""","'":"'","`":"`"},M=b.invert(C),D=function(e){var t=function(t){return e[t]},n="(?:"+b.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};b.escape=D(C),b.unescape=D(M),b.result=function(e,t,n){var r=null==e?void 0:e[t];return void 0===r&&(r=n),b.isFunction(r)?r.call(e):r};var R=0;b.uniqueId=function(e){var t=++R+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var U=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},P=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+B[e]};b.template=function(e,t,n){!t&&n&&(t=n),t=b.defaults({},t,b.templateSettings);var r=RegExp([(t.escape||U).source,(t.interpolate||U).source,(t.evaluate||U).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,a,u){return o+=e.slice(i,u).replace(P,z),i=u+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var u=function(e){return a.call(this,e,b)},s=t.variable||"obj";return u.source="function("+s+"){\n"+o+"}",u},b.chain=function(e){var t=b(e);return t._chain=!0,t};var $=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var n=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return p.apply(e,arguments),$(this,n.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=s[e];b.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],$(this,n)}}),b.each(["concat","join","slice"],function(e){var t=s[e];b.prototype[e]=function(){return $(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped}}).call(yr)}),vr={display:function(){return this.exprType+" "+this.val},type:function(){return this.exprType},linenum:0,charnum:0},xr={unify:function(e){if(this.expr===e.expr)return e.expr;console.log("Could not unify "+this.expr+" with "+e.expr)},isTypeExpr:!0,linenum:0,charnum:0};Se.prototype=vr,ke.prototype=vr,Ne.prototype=vr,Oe.prototype=vr,Ae.prototype=vr,je.prototype=vr,Le.prototype=vr,Ie.prototype=vr,Je.prototype=vr,Fe.prototype=vr,Ce.prototype=vr,Me.prototype=vr,De.prototype=vr,Re.prototype=vr,Ue.prototype=vr,Be.prototype=xr,Pe.prototype=xr,$e.prototype=xr,qe.prototype=vr;var br={IntT:Ne,FloatT:Oe,StrT:Ae,BoolT:je,ListT:Le,FuncT:Je,App:Ce,Name:Me,Def:De,OpT:Fe,OPInfo:{"::":[2,"Left"],",":[1,"Left"],"->":[1,"Right"]},makeApp:Ke,If:Ue,DefFunc:Re,UnaryOp:ke,Nil:Ie,LetExp:Se,gensym:function(){var e=0;return function(){var t="G"+e;return e+=1,t}}(),TypeVar:Be,TypeOp:Pe,TypeDecl:$e,Closure:Ee,isTypeExpr:Te,DefType:qe,DataType:He};RegExp.escape=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")};var wr={not:Ge,groupOps:Qe,opMatch:et,dict:Xe,extend:Ye,empty:We,debugPrint:tt},_r={src:"\n;; This file declares the various types used by intrinsic/prelude definitions\n;; It is sort of special in that it doesn't care whether there are any associated definitions\n;; just that there are type definitions for that particular binding's name\n\n;; Operator definitions\n\ndefop 1 Left (a + b)\n (add a b)\n\ndefop 1 Left (a - b)\n (minus a b)\n\ndefop 2 Left (a * b)\n (mul a b)\n\ndefop 2 Left (a / b)\n (div a b)\n\ndefop 2 Right (a ^ b)\n (pow a b)\n\ndefop 3 Left (a ++ b)\n (listConcat a b)\n\ndefop 3 Left (a == b)\n (eq a b)\n\ndefop 3 Left (a > b)\n (gt a b)\n\ndefop 3 Left (a >= b)\n (gte a b)\n\ndefop 3 Left (a < b)\n (lt a b)\n\ndefop 3 Left (a <= b)\n (lte a b)\n\ndefop 3 Left (a && b)\n (and a b)\n\ndefop 3 Left (a || b)\n (or a b)\n\ndefop 4 Left (x : xs)\n (cons x xs)\n\ndefop 5 Left (f $ x)\n (fapply f x)\n\ndefop 5 Left (f . g)\n (compose f g)\n\ndefop 3 Left (a | b)\n (bitwiseOr a b)\n\ndefop 3 Left (a & b)\n (bitwiseAnd a b)"},Tr=Object.keys(br.OPInfo),Er=["defop","integer","constructor","left_paren","identifier","identifier","identifier","right_paren"],Sr={tokenize:mt,isIdentifier:it},kr={desugar:wt},Nr=(gr.compose(wr.not,gr.partial(gr.equal,[])),{annotate_fvs:Et}),Or=jt(["Definition","FunctionDefinition"].map(It)),Ar=gr.compose(wr.not,jt(["right_brace"].map(Lt))),jr=jt(["Name"].map(It)),Lr=["def","comma","right_paren","right_square","right_brace","left_brace","right_brace"].map(Lt),Ir=gr.compose(wr.not,jt(Lr)),Jr=gr.compose(wr.not,jt(["Definition"].map(It))),Fr={parse:function(e){return Qt(Sr.tokenize(e))},tokenize:Sr.tokenize,parseFull:Qt},Cr={lookup:Yt,makeEnv:Xt}.makeEnv("toplevel",[["len",function(e){return e.length}],["+",function(e){return function(t){return e+t}}],["*",function(e){return function(t){return e*t}}],["-",function(e){return function(t){return e-t}}],["/",function(e){return function(t){return e/t}}],[":",en],["a",2],["b",3]]),Mr={evaluateString:nn};dr.tag2("test",'

{output}

',"","",function(e){var t=this;t.output="",this.evaluate=function(){var e=this.refs.input;t.update({output:JSON.stringify(Mr.evaluateString(e.value))})}.bind(this)}),dr.mount("test")}(); diff --git a/server/desugar.js b/server/desugar.js index 9ee46a9..77749e9 100644 --- a/server/desugar.js +++ b/server/desugar.js @@ -82,10 +82,11 @@ function desugar(stx, typeEnv) { return new typ.If(desugar(stx.condition, typeEnv), desugar(stx.thenexp, typeEnv), desugar(stx.elseexp, typeEnv)); } return new typ.If(desugar(stx.condition, typeEnv), desugar(stx.thenexp, typeEnv)); - case "FunctionDefinition": - return desugarDefFunc(stx); - case "Definition": - return new typ.Def(stx.ident, desugar(stx.val, typeEnv)); + /* FIXME closures not yet working */ + //case "FunctionDefinition": + //return desugarDefFunc(stx); + //case "Definition": + //return new typ.Def(stx.ident, desugar(stx.val, typeEnv)); case "TypeDefinition": return desugarDefType(stx, typeEnv); case "Name": @@ -108,7 +109,7 @@ function desugar(stx, typeEnv) { return sugarTypeDecl(stx); } - if ((stx.func.ident === "-" || stx.func.ident == "+") && + if (false && stx.p && isAtomicNumber(stx.p)) { console.log("Matched unary"); console.log(stx); diff --git a/server/parse.js b/server/parse.js index d2c23d7..ad537bb 100755 --- a/server/parse.js +++ b/server/parse.js @@ -651,6 +651,8 @@ function computeApp(tokens, charnum, linenum) { var next; var result; var parameters; + console.log("computing app"); + console.log(tokens); if (fst(tokens)) { next = fst(tokens); @@ -660,7 +662,9 @@ function computeApp(tokens, charnum, linenum) { lhs.charnum, "Unexpected end of source"); } + if (typ.OPInfo[next[1]]) { + console.log("matched infix"); /* it's an infix expression */ result = parseInfix(tokens, 1, lhs, lhs.linenum, lhs.charnum); if (!fst(tokens) || fst(tokens)[0] !== "right_paren") { @@ -726,6 +730,11 @@ function parseInfix(tokens, minPrec, lhs, linenum, charnum) { tokens.pop(); /*remove the operator token*/ var rhs = parseInfix(tokens, nextMinPrec); + console.log("~~~~~~~~~~"); + console.log(op); + console.log(lhs); + console.log(rhs); + console.log("~~~~~~~~~~"); lhs = addSrcPos(typ.makeApp(op, [lhs, rhs]), tokens, rhs.linenum, rhs.charnum); } return lhs; diff --git a/server/prelude.js b/server/prelude.js index ec53b84..402211a 100644 --- a/server/prelude.js +++ b/server/prelude.js @@ -2,8 +2,122 @@ var src = ` ;; This file declares the various types used by intrinsic/prelude definitions ;; It is sort of special in that it doesn't care whether there are any associated definitions ;; just that there are type definitions for that particular binding's name -`; -export default { + +;; Type definitions +deftype String (Vector Char) + +deftype (Int) Intrinsic + +deftype (Float) Intrinsic + +deftype (Char) Intrinsic + +deftype (Byte) Intrinsic + +deftype (Void) Intrinsic + +deftype (IO a) Intrinsic + +deftype (Vector a) Intrinsic + +deftype (List a) + (Empty | + (Cons a (List a))) + +deftype (Bottom) + Undefined + +deftype (Maybe a) + (Nothing | + (Just a)) + +deftype (Either a b) + ((Left a) | + (Right b)) + +;; List functions + +(: :: (a -> (List a) -> (List a))) + +(map :: ((a -> b) -> (List a) -> (List b))) + +(head :: ((List a) -> a)) + +(tail :: ((List a) -> (List a))) + +(!! :: (Int -> (List a) -> a)) + +(take :: (Int -> (List a) -> (Maybe (List a)))) + +(drop :: (Int -> (List a) -> (Maybe (List a)))) + +;; Optional functions + +(maybe :: (b -> (a -> b) -> (Maybe a) -> b)) + +(either :: ((b -> c) -> (b -> c) -> (Either a b) -> c)) + +;; I/O functions + +(print :: (String -> (IO Void))) + +;; Operator definitions + +defop 1 Left (a + b) + (add a b) + +defop 1 Left (a - b) + (minus a b) + +defop 2 Left (a * b) + (mul a b) + +defop 2 Left (a / b) + (div a b) + +defop 2 Right (a ^ b) + (pow a b) + +defop 3 Left (a ++ b) + (listConcat a b) + +defop 3 Left (a == b) + (eq a b) + +defop 3 Left (a > b) + (gt a b) + +defop 3 Left (a >= b) + (gte a b) + +defop 3 Left (a < b) + (lt a b) + +defop 3 Left (a <= b) + (lte a b) + +defop 3 Left (a && b) + (and a b) + +defop 3 Left (a || b) + (or a b) + +defop 4 Left (x : xs) + (cons x xs) + +defop 5 Left (f $ x) + (fapply f x) + +defop 5 Left (f . g) + (compose f g) + +defop 3 Left (a | b) + (bitwiseOr a b) + +defop 3 Left (a & b) + (bitwiseAnd a b)`; + +module.exports = { "src" : src }; diff --git a/server/tags/test.tag b/server/tags/test.tag index 271e156..67c29bd 100644 --- a/server/tags/test.tag +++ b/server/tags/test.tag @@ -1,5 +1,7 @@ diff --git a/server/vm.js b/server/vm.js index a36451f..07aee09 100755 --- a/server/vm.js +++ b/server/vm.js @@ -28,6 +28,7 @@ var testenv = env.makeEnv("toplevel", function lookup(ident, env) { console.log(`trying to look up ${ident}`); var value = env.bindings[ident]; + console.log(env); console.log(value); if (value.exprType !== undefined) { console.log("evaluting further");