cft-source 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/cft/cft.js +3693 -2
  2. data/lib/cft/source.rb +1 -1
  3. metadata +3 -3
@@ -1,8 +1,3699 @@
1
1
  /**
2
- * CFT Compiler v0.0.4
2
+ * CFT Compiler v0.0.6
3
3
  * http://github.com/maccman/cft
4
4
  *
5
5
  * Copyright (c) 2013 Alex MacCaw
6
6
  * Released under the MIT License
7
7
  */
8
- this.cft=function(n){return function l(u){var t,e={id:u,exports:{}};if(t=n[u])return t(e,l,e.exports),e.exports;throw"Cannot find module '"+u+"'"}}({cft:function(n,l){!function(){var u,t,e,r,o;o=l("./compiler"),t=o.compile,e=o.precompile,r=l("./preprocessor").preprocess,n.exports=u=function(n){var l,e;return u.cache?null!=(e=(l=u.cache)[n])?e:l[n]=t(n):t(n)},u.cache={},u.preprocess=r,u.precompile=e,u.compile=t,u.render=function(n,l){return u(n)(l)}}.call(this)},"./compiler":function(n,l,u){!function(){var n,t,e,r;n=l("coffee-script"),r=l("./preprocessor").preprocess,t=l("./util").indent,u.precompile=e=function(l){var u;return u=n.compile(r(l),{bare:!0}),'function(__obj) {\n if (!__obj) __obj = {};\n\n var __escape = __obj.escape = function(value) {\n return ("" + value).replace(/&/g, "&amp;")\n .replace(/</g, "&lt;")\n .replace(/>/g, "&gt;")\n .replace(/"/g, "&quot;");\n }\n\n var __createFragment = __obj.createFragment = function(value, element) {\n if (value instanceof DocumentFragment) return value;\n element || (element = document.createElement(\'div\'));\n var range = document.createRange();\n range.setStart(element, 0);\n range.collapse(false);\n return range.createContextualFragment(value);\n };\n\n return (function() {\n '+t(u,4)+"\n }).call(__obj);\n}"},u.compile=function(n){return new Function("return "+e(n))()}}.call(this)},"./preprocessor":function(n,l){!function(){var u,t,e,r=[].indexOf||function(n){for(var l=0,u=this.length;u>l;l++)if(l in this&&this[l]===n)return l;return-1};t=l("./scanner"),e=l("./util"),n.exports=u=function(){function n(n){this.scanner=new t(n),this.output="",this.level=0,this.index=0,this.captures=[],this.record(""+this.elementVar()+" = document.createDocumentFragment()")}return n.preprocess=function(l){var u;return u=new n(l),u.preprocess()},n.prototype.preprocess=function(){var n,l,u,t,e;for(t=this.scanner.scan(),l=0,u=t.length;u>l;l++)n=t[l],null!=(e=this[n.type])&&e.call(this,n);return this.record("return "+this.elementVar()),this.output},n.prototype.record=function(n){return this.output+=e.repeat(" ",this.level),this.output+=n+"\n"},n.prototype.indent=function(){return this.level++},n.prototype.dedent=function(){return this.level--,this.level<0?this.fail("Unexpected dedent"):void 0},n.prototype.elementVar=function(n){return null==n&&(n=this.index),"__element"+n},n.prototype.traverseUp=function(){return this.index--,this.index<0?this.fail("Unexpected traverse"):void 0},n.prototype.traverseDown=function(){return this.index++},n.prototype.append=function(n){return this.record(""+this.elementVar()+".appendChild "+n)},n.prototype.appendParent=function(n){return this.record(""+this.elementVar(this.index-1)+".appendChild "+n)},n.prototype.capture=function(n,l){return n.dedent&&this.dedent(),l.call(this,n),(n.indent||n.directive)&&this.indent(),n.directive?(this.captures.unshift(this.level),this.traverseDown(),this.record(""+this.elementVar()+" = document.createDocumentFragment()")):void 0},n.prototype.fail=function(n){throw new Error(n)},n.prototype.eco=function(n){return this["eco_"+n.tag].call(this,n)},n.prototype.eco_end=function(){return this.captures[0]===this.level&&(this.captures.shift(),this.record(this.elementVar()),this.traverseUp()),this.dedent()},n.prototype.eco_leftLiteral=function(){return this.append("document.createTextNode('<%')")},n.prototype.eco_rightLiteral=function(){return this.append("document.createTextNode('%>')")},n.prototype.eco_expression=function(n){var l=this;return this.capture(n,function(){return l.record(n.content+n.directive)})},n.prototype.eco_escapedContent=function(n){var l=this;return n.directive&&this.fail("Directive provided for escaped content"),this.capture(n,function(){return l.append("document.createTextNode __escape "+n.content)})},n.prototype.eco_content=function(n){var l=this;return this.capture(n,function(){return l.append("__createFragment "+n.content+n.directive)})},n.prototype.cdata=function(){},n.prototype.comment=function(){},n.prototype.doctype=function(){},n.prototype.script=function(){},n.prototype.voidElements=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n.prototype.element=function(n){var l;return l=n.tag,r.call(this.voidElements,l)>=0?this.element_inline(n):this["element_"+n.variant].call(this,n)},n.prototype.element_open=function(n){var l,u,t,r,o;for(this.traverseDown(),u=this.elementVar(),this.record(""+u+" = document.createElement("+e.inspect(n.tag)+")"),o=n.attributes,t=0,r=o.length;r>t;t++)l=o[t],this.record(""+u+".setAttribute("+e.inspect(l.name)+", "+e.inspect(l.value||!0)+")");return this.appendParent(u)},n.prototype.element_close=function(){return this.traverseUp()},n.prototype.element_inline=function(n){var l,u,t,r;for(this.record("__curr = document.createElement("+e.inspect(n.tag)+")"),r=n.attributes,u=0,t=r.length;t>u;u++)l=r[u],this.record("__curr.setAttribute("+e.inspect(l.name)+", "+e.inspect(l.value||!0)+")");return this.append("__curr")},n.prototype.style=function(n){var l,u,t,r;for(this.record("__curr = document.createElement('style')"),r=n.attributes,u=0,t=r.length;t>u;u++)l=r[u],this.record("__curr.setAttribute("+e.inspect(l.name)+", "+e.inspect(l.value||!0)+")");return this.record("__curr.innerHTML = "+e.inspect(n.content)),this.append("__curr")},n.prototype.text=function(n){return this.append("document.createTextNode("+e.inspect(n.content)+")")},n}()}.call(this)},"./scanner":function(n,l){!function(){var u,t;t=l("./grammar"),n.exports=u=function(){function n(n){this.source=n}return n.scan=function(l){var u,t;return t=[],u=new n(l),u.scan()},n.dedentablePattern=/^(end|when|else|catch|finally)(?:\W|$)/,n.prototype.scan=function(){var n,l,u,e,r,o;for(e=t.parse(this.source),o=[],l=0,u=e.length;u>l;l++)n=e[l],o.push((null!=(r=this[n.type])?r.call(this,n):void 0)||n);return o},n.prototype.eco=function(n){return n.content&&this.isDedentable(n.content)&&(n.dedent=!0),n.directive&&(n.indent=!0),n},n.prototype.isDedentable=function(l){return l.match(n.dedentablePattern)},n}()}.call(this)},"./util":function(n,l,u){!function(){var n,l;u.repeat=n=function(n,l){return Array(l+1).join(n)},u.indent=function(l,u){var t,e,r;return r=n(" ",u),e=function(){var n,u,e,o;for(e=l.split("\n"),o=[],n=0,u=e.length;u>n;n++)t=e[n],o.push(r+t);return o}(),e.join("\n")},u.trim=function(n){return n.replace(/^\s+/,"").replace(/\s+$/,"")},l={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},u.inspectString=function(n){var u;return u=n.replace(/[\x00-\x1f\\]/g,function(n){var u;return n in l?l[n]:(u=n.charCodeAt(0).toString(16),1===u.length&&(u="0"+u),"\\u00"+u)}),"'"+u.replace(/'/g,"\\'")+"'"},u.inspect=function(n){return JSON.stringify(n)}}.call(this)},"./grammar":function(n){n.exports=function(){function n(n){return'"'+n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var l={parse:function(l,u){function t(n){al>il||(il>al&&(al=il,sl=[]),sl.push(n))}function e(){var n,l,u,t,e;for(n=[],t=il,e=il,l=r(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);null!==l;)n.push(l),t=il,e=il,l=r(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);return n}function r(){var n;return n=i(),null===n&&(n=T()),n}function o(){var n,l,u,t,e;for(n=[],t=il,e=il,l=i(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);null!==l;)n.push(l),t=il,e=il,l=i(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);return n}function i(){var n;return n=c(),null===n&&(n=f(),null===n&&(n=h(),null===n&&(n=d(),null===n&&(n=p())))),n}function c(){var n;return n=a(),null===n&&(n=s()),n}function a(){var n,u;return u=il,"<%%"===l.substr(il,3)?(n="<%%",il+=3):(n=null,0===cl&&t('"<%%"')),null!==n&&(n=function(){return{type:"eco",tag:"leftLiteral"}}(u)),null===n&&(il=u),n}function s(){var n,u;return u=il,"%%>"===l.substr(il,3)?(n="%%>",il+=3):(n=null,0===cl&&t('"%%>"')),null!==n&&(n=function(){return{type:"eco",tag:"rightLiteral"}}(u)),null===n&&(il=u),n}function f(){var n,u,e,r,o,i,c;return i=il,c=il,n=g(),null!==n?(u=nl(),null!==u?("end"===l.substr(il,3)?(e="end",il+=3):(e=null,0===cl&&t('"end"')),null!==e?(r=nl(),null!==r?(o=b(),null!==o?n=[n,u,e,r,o]:(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c),null!==n&&(n=function(){return{type:"eco",tag:"end"}}(i)),null===n&&(il=i),n}function p(){var n,l,u,t,e,r,o,i,c;return i=il,c=il,n=g(),null!==n?(l=nl(),null!==l?(u=m(),u=null!==u?u:"",null!==u?(t=C(),t=null!==t?t:"",null!==t?(e=y(),e=null!==e?e:"",null!==e?(r=nl(),null!==r?(o=b(),null!==o?n=[n,l,u,t,e,r,o]:(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c),null!==n&&(n=function(n,l,u,t){return{type:"eco",tag:"expression",content:l,indent:u,directive:t}}(i,n[2],n[3],n[4])),null===n&&(il=i),n}function h(){var n,u,e,r,o,i,c,a,s,f;return s=il,f=il,n=g(),null!==n?(61===l.charCodeAt(il)?(u="=",il++):(u=null,0===cl&&t('"="')),null!==u?(e=nl(),null!==e?(r=m(),null!==r?(o=C(),o=null!==o?o:"",null!==o?(i=y(),i=null!==i?i:"",null!==i?(c=nl(),null!==c?(a=b(),null!==a?n=[n,u,e,r,o,i,c,a]:(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f),null!==n&&(n=function(n,l,u,t){return{type:"eco",tag:"escapedContent",content:l,indent:u,directive:t}}(s,n[3],n[4],n[5])),null===n&&(il=s),n}function d(){var n,u,e,r,o,i,c,a,s,f;return s=il,f=il,n=g(),null!==n?(45===l.charCodeAt(il)?(u="-",il++):(u=null,0===cl&&t('"-"')),null!==u?(e=nl(),null!==e?(r=m(),null!==r?(o=C(),o=null!==o?o:"",null!==o?(i=y(),i=null!==i?i:"",null!==i?(c=nl(),null!==c?(a=b(),null!==a?n=[n,u,e,r,o,i,c,a]:(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f)):(n=null,il=f),null!==n&&(n=function(n,l,u,t){return{type:"eco",tag:"content",content:l,indent:u,directive:t}}(s,n[3],n[4],n[5])),null===n&&(il=s),n}function v(){var n,u,e,r,o,i,c,a,s;return i=il,c=il,a=il,cl++,s=il,58===l.charCodeAt(il)?(n=":",il++):(n=null,0===cl&&t('":"')),n=null!==n?n:"",null!==n?("->"===l.substr(il,2)?(u="->",il+=2):(u=null,0===cl&&t('"->"')),u=null!==u?u:"",null!==u?("=>"===l.substr(il,2)?(e="=>",il+=2):(e=null,0===cl&&t('"=>"')),e=null!==e?e:"",null!==e?(r=nl(),null!==r?("%>"===l.substr(il,2)?(o="%>",il+=2):(o=null,0===cl&&t('"%>"')),null!==o?n=[n,u,e,r,o]:(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s),cl--,null===n?n="":(n=null,il=a),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=c)):(n=null,il=c),null!==n&&(n=function(n,l){return l}(i,n[1])),null===n&&(il=i),n}function m(){var n,l,u;if(u=il,l=v(),null!==l)for(n=[];null!==l;)n.push(l),l=v();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function C(){var n,u;return u=il,58===l.charCodeAt(il)?(n=":",il++):(n=null,0===cl&&t('":"')),n=null!==n?n:"",null!==n&&(n=function(n,l){return!!l}(u,n)),null===n&&(il=u),n}function y(){var n;return"=>"===l.substr(il,2)?(n="=>",il+=2):(n=null,0===cl&&t('"=>"')),null===n&&("->"===l.substr(il,2)?(n="->",il+=2):(n=null,0===cl&&t('"->"'))),n}function g(){var n;return"<%"===l.substr(il,2)?(n="<%",il+=2):(n=null,0===cl&&t('"<%"')),n}function b(){var n;return"%>"===l.substr(il,2)?(n="%>",il+=2):(n=null,0===cl&&t('"%>"')),n}function A(){var n,l,u,t,e;for(n=[],t=il,e=il,l=T(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);null!==l;)n.push(l),t=il,e=il,l=T(),null!==l?(u=nl(),null!==u?l=[l,u]:(l=null,il=e)):(l=null,il=e),null!==l&&(l=function(n,l){return l}(t,l[0])),null===l&&(il=t);return n}function T(){var n;return n=D(),null===n&&(n=x(),null===n&&(n=M(),null===n&&(n=V(),null===n&&(n=P(),null===n&&(n=w(),null===n&&(n=U())))))),n}function _(){var n,u,e,r,o,c,a,s;return cl++,a=il,s=il,n=z(),null!==n?(u=nl(),null!==u?(61===l.charCodeAt(il)?(e="=",il++):(e=null,0===cl&&t('"="')),null!==e?(r=nl(),null!==r?(o=B(),null!==o?(c=nl(),null!==c?n=[n,u,e,r,o,c]:(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s),null!==n&&(n=function(n,l,u){return{name:l,value:u}}(a,n[0],n[4])),null===n&&(il=a),null===n&&(a=il,s=il,n=z(),null!==n?(u=J(),null===u&&(u=Y()),null!==u?n=[n,u]:(n=null,il=s)):(n=null,il=s),null!==n&&(n=function(n,l,u){return{name:l,value:u}}(a,n[0],n[1])),null===n&&(il=a),null===n&&(a=il,s=il,n=z(),null!==n?(u=nl(),null!==u?n=[n,u]:(n=null,il=s)):(n=null,il=s),null!==n&&(n=function(n,l){return{name:l}}(a,n[0])),null===n&&(il=a),null===n&&(n=i()))),cl--,0===cl&&null===n&&t("element attribute"),n}function x(){var n,u,e,r,o;return cl++,r=il,o=il,"<![CDATA["===l.substr(il,9)?(n="<![CDATA[",il+=9):(n=null,0===cl&&t('"<![CDATA["')),null!==n?(u=E(),null!==u?("]]>"===l.substr(il,3)?(e="]]>",il+=3):(e=null,0===cl&&t('"]]>"')),null!==e?n=[n,u,e]:(n=null,il=o)):(n=null,il=o)):(n=null,il=o),null!==n&&(n=function(n,l){return{type:"cdata",content:l}}(r,n[1])),null===n&&(il=r),cl--,0===cl&&null===n&&t("CDATA section"),n}function L(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,"]]>"===l.substr(il,3)?(n="]]>",il+=3):(n=null,0===cl&&t('"]]>"')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function E(){var n,l,u;if(u=il,l=L(),null!==l)for(n=[];null!==l;)n.push(l),l=L();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function M(){var n,u,e,r,o,i,c,a,s;if(cl++,a=il,s=il,n=j(),null!==n)if("!--"===l.substr(il,3)?(u="!--",il+=3):(u=null,0===cl&&t('"!--"')),null!==u)if(e=nl(),null!==e){for(r=[],o=H();null!==o;)r.push(o),o=H();null!==r?(o=nl(),null!==o?("--"===l.substr(il,2)?(i="--",il+=2):(i=null,0===cl&&t('"--"')),null!==i?(c=N(),null!==c?n=[n,u,e,r,o,i,c]:(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)}else n=null,il=s;else n=null,il=s;else n=null,il=s;return null!==n&&(n=function(n,l){return{type:"comment",content:l.join("")}}(a,n[3])),null===n&&(il=a),cl--,0===cl&&null===n&&t("comment"),n}function H(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,"-->"===l.substr(il,3)?(n="-->",il+=3):(n=null,0===cl&&t('"-->"')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function D(){var n,u,e,r,o,i,c,a,s;return cl++,a=il,s=il,n=j(),null!==n?(33===l.charCodeAt(il)?(u="!",il++):(u=null,0===cl&&t('"!"')),null!==u?("doctype"===l.substr(il,7).toLowerCase()?(e=l.substr(il,7),il+=7):(e=null,0===cl&&t('"DOCTYPE"')),null!==e?(r=nl(),null!==r?(o=$(),null!==o?(i=nl(),null!==i?(c=N(),null!==c?n=[n,u,e,r,o,i,c]:(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s),null!==n&&(n=function(n,l){return{type:"doctype",content:l}}(a,n[4])),null===n&&(il=a),cl--,0===cl&&null===n&&t("doctype"),n}function w(){var n;return n=O(),null===n&&(n=S(),null===n&&(n=F())),n}function O(){var n,u,e,r,o,i,c,a,s,f,p;if(cl++,f=il,p=il,n=j(),null!==n)if(u=nl(),null!==u)if(e=z(),null!==e)if(r=nl(),null!==r){for(o=[],i=_();null!==i;)o.push(i),i=_();null!==o?(i=nl(),null!==i?(47===l.charCodeAt(il)?(c="/",il++):(c=null,0===cl&&t('"/"')),null!==c?(a=nl(),null!==a?(s=N(),null!==s?n=[n,u,e,r,o,i,c,a,s]:(n=null,il=p)):(n=null,il=p)):(n=null,il=p)):(n=null,il=p)):(n=null,il=p)}else n=null,il=p;else n=null,il=p;else n=null,il=p;else n=null,il=p;return null!==n&&(n=function(n,l,u){return{type:"element",tag:l,variant:"inline",attributes:u}}(f,n[2],n[4])),null===n&&(il=f),cl--,0===cl&&null===n&&t("inline element"),n}function S(){var n,l,u,e,r,o,i,c,a;if(cl++,c=il,a=il,n=j(),null!==n)if(l=nl(),null!==l)if(u=z(),null!==u)if(e=nl(),null!==e){for(r=[],o=_();null!==o;)r.push(o),o=_();null!==r?(o=nl(),null!==o?(i=N(),null!==i?n=[n,l,u,e,r,o,i]:(n=null,il=a)):(n=null,il=a)):(n=null,il=a)}else n=null,il=a;else n=null,il=a;else n=null,il=a;else n=null,il=a;return null!==n&&(n=function(n,l,u){return{type:"element",tag:l,variant:"open",attributes:u}}(c,n[2],n[4])),null===n&&(il=c),cl--,0===cl&&null===n&&t("new element"),n}function j(){var n;return 60===l.charCodeAt(il)?(n="<",il++):(n=null,0===cl&&t('"<"')),n}function F(){var n,u,e,r,o,i,c,a,s;return cl++,a=il,s=il,n=j(),null!==n?(u=nl(),null!==u?(47===l.charCodeAt(il)?(e="/",il++):(e=null,0===cl&&t('"/"')),null!==e?(r=nl(),null!==r?(o=z(),null!==o?(i=nl(),null!==i?(c=N(),null!==c?n=[n,u,e,r,o,i,c]:(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s)):(n=null,il=s),null!==n&&(n=function(n,l){return{type:"element",tag:l,variant:"close"}}(a,n[4])),null===n&&(il=a),cl--,0===cl&&null===n&&t("end of element"),n}function N(){var n;return 62===l.charCodeAt(il)?(n=">",il++):(n=null,0===cl&&t('">"')),n}function V(){var n,u,e,r,o,i,c,a,s,f,p,h,d,v,m,C,y;if(cl++,C=il,y=il,n=j(),null!==n)if(u=nl(),null!==u)if("script"===l.substr(il,6).toLowerCase()?(e=l.substr(il,6),il+=6):(e=null,0===cl&&t('"script"')),null!==e)if(r=nl(),null!==r){for(o=[],i=_();null!==i;)o.push(i),i=_();null!==o?(i=nl(),null!==i?(c=N(),null!==c?(a=k(),null!==a?(s=j(),null!==s?(f=nl(),null!==f?(47===l.charCodeAt(il)?(p="/",il++):(p=null,0===cl&&t('"/"')),null!==p?(h=nl(),null!==h?("script"===l.substr(il,6).toLowerCase()?(d=l.substr(il,6),il+=6):(d=null,0===cl&&t('"script"')),null!==d?(v=nl(),null!==v?(m=N(),null!==m?n=[n,u,e,r,o,i,c,a,s,f,p,h,d,v,m]:(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)}else n=null,il=y;else n=null,il=y;else n=null,il=y;else n=null,il=y;return null!==n&&(n=function(n,l,u){return{type:"script",attributes:l,content:u}}(C,n[4],n[7])),null===n&&(il=C),cl--,0===cl&&null===n&&t("element <script>"),n}function Q(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,"</script>"===l.substr(il,9)?(n="</script>",il+=9):(n=null,0===cl&&t('"</script>"')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function k(){var n,l,u;if(u=il,l=Q(),null!==l)for(n=[];null!==l;)n.push(l),l=Q();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function P(){var n,u,e,r,o,i,c,a,s,f,p,h,d,v,m,C,y;if(cl++,C=il,y=il,n=j(),null!==n)if(u=nl(),null!==u)if("style"===l.substr(il,5).toLowerCase()?(e=l.substr(il,5),il+=5):(e=null,0===cl&&t('"style"')),null!==e)if(r=nl(),null!==r){for(o=[],i=_();null!==i;)o.push(i),i=_();null!==o?(i=nl(),null!==i?(c=N(),null!==c?(a=q(),null!==a?(s=j(),null!==s?(f=nl(),null!==f?(47===l.charCodeAt(il)?(p="/",il++):(p=null,0===cl&&t('"/"')),null!==p?(h=nl(),null!==h?("style"===l.substr(il,5).toLowerCase()?(d=l.substr(il,5),il+=5):(d=null,0===cl&&t('"style"')),null!==d?(v=nl(),null!==v?(m=N(),null!==m?n=[n,u,e,r,o,i,c,a,s,f,p,h,d,v,m]:(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)):(n=null,il=y)}else n=null,il=y;else n=null,il=y;else n=null,il=y;else n=null,il=y;return null!==n&&(n=function(n,l,u){return{type:"style",attributes:l,content:u}}(C,n[4],n[7])),null===n&&(il=C),cl--,0===cl&&null===n&&t("element <style>"),n}function U(){var n,l,u;if(u=il,l=I(),null!==l)for(n=[];null!==l;)n.push(l),l=I();else n=null;return null!==n&&(n=function(n,l){return{type:"text",content:l.join("")}}(u,n)),null===n&&(il=u),n}function I(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,"</"===l.substr(il,2)?(n="</",il+=2):(n=null,0===cl&&t('"</"')),null===n&&(60===l.charCodeAt(il)?(n="<",il++):(n=null,0===cl&&t('"<"'))),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function q(){var n,l,u;if(u=il,l=I(),null!==l)for(n=[];null!==l;)n.push(l),l=I();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function z(){var n,l,u;if(u=il,l=R(),null!==l)for(n=[];null!==l;)n.push(l),l=R();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function R(){var n;return/^[a-zA-Z0-9\-:_]/.test(l.charAt(il))?(n=l.charAt(il),il++):(n=null,0===cl&&t("[a-zA-Z0-9\\-:_]")),n}function Z(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,62===l.charCodeAt(il)?(n=">",il++):(n=null,0===cl&&t('">"')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function $(){var n,l,u;if(u=il,l=Z(),null!==l)for(n=[];null!==l;)n.push(l),l=Z();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function B(){var n;return n=J(),null===n&&(n=Y(),null===n&&(n=K())),n}function J(){var n,u,e,r,o,i;if(o=il,i=il,34===l.charCodeAt(il)?(n='"',il++):(n=null,0===cl&&t('"\\""')),null!==n?(u=nl(),null!==u?(34===l.charCodeAt(il)?(e='"',il++):(e=null,0===cl&&t('"\\""')),null!==e?n=[n,u,e]:(n=null,il=i)):(n=null,il=i)):(n=null,il=i),null!==n&&(n=function(){return""}(o)),null===n&&(il=o),null===n){if(o=il,i=il,34===l.charCodeAt(il)?(n='"',il++):(n=null,0===cl&&t('"\\""')),null!==n){if(e=W(),null!==e)for(u=[];null!==e;)u.push(e),e=W();else u=null;null!==u?(34===l.charCodeAt(il)?(e='"',il++):(e=null,0===cl&&t('"\\""')),null!==e?(44===l.charCodeAt(il)?(r=",",il++):(r=null,0===cl&&t('","')),r=null!==r?r:"",null!==r?n=[n,u,e,r]:(n=null,il=i)):(n=null,il=i)):(n=null,il=i)}else n=null,il=i;null!==n&&(n=function(n,l){return l.join("")}(o,n[1])),null===n&&(il=o)}return n}function W(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,34===l.charCodeAt(il)?(n='"',il++):(n=null,0===cl&&t('"\\""')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function Y(){var n,u,e,r,o,i;if(o=il,i=il,39===l.charCodeAt(il)?(n="'",il++):(n=null,0===cl&&t('"\'"')),null!==n?(u=nl(),null!==u?(39===l.charCodeAt(il)?(e="'",il++):(e=null,0===cl&&t('"\'"')),null!==e?n=[n,u,e]:(n=null,il=i)):(n=null,il=i)):(n=null,il=i),null!==n&&(n=function(){return""}(o)),null===n&&(il=o),null===n){if(o=il,i=il,39===l.charCodeAt(il)?(n="'",il++):(n=null,0===cl&&t('"\'"')),null!==n){if(e=G(),null!==e)for(u=[];null!==e;)u.push(e),e=G();else u=null;null!==u?(39===l.charCodeAt(il)?(e="'",il++):(e=null,0===cl&&t('"\'"')),null!==e?(44===l.charCodeAt(il)?(r=",",il++):(r=null,0===cl&&t('","')),r=null!==r?r:"",null!==r?n=[n,u,e,r]:(n=null,il=i)):(n=null,il=i)):(n=null,il=i)}else n=null,il=i;null!==n&&(n=function(n,l){return l.join("")}(o,n[1])),null===n&&(il=o)}return n}function G(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,39===l.charCodeAt(il)?(n="'",il++):(n=null,0===cl&&t('"\'"')),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function K(){var n,l,u;if(u=il,l=X(),null!==l)for(n=[];null!==l;)n.push(l),l=X();else n=null;return null!==n&&(n=function(n,l){return l.join("")}(u,n)),null===n&&(il=u),n}function X(){var n,u,e,r,o;return e=il,r=il,o=il,cl++,62===l.charCodeAt(il)?(n=">",il++):(n=null,0===cl&&t('">"')),null===n&&(n=ll()),cl--,null===n?n="":(n=null,il=o),null!==n?(u=tl(),null!==u?n=[n,u]:(n=null,il=r)):(n=null,il=r),null!==n&&(n=function(n,l){return l}(e,n[1])),null===n&&(il=e),n}function nl(){var n,l;for(cl++,n=[],l=ll();null!==l;)n.push(l),l=ll();return cl--,0===cl&&null===n&&t("whitespaces"),n}function ll(){var n;return/^[ \t\n\r]/.test(l.charAt(il))?(n=l.charAt(il),il++):(n=null,0===cl&&t("[ \\t\\n\\r]")),n}function ul(){var n;return/^[0-9a-fA-F]/.test(l.charAt(il))?(n=l.charAt(il),il++):(n=null,0===cl&&t("[0-9a-fA-F]")),n}function tl(){var n,u,e,r,o,i,c;return cl++,i=il,c=il,"\\u"===l.substr(il,2)?(n="\\u",il+=2):(n=null,0===cl&&t('"\\\\u"')),null!==n?(u=ul(),null!==u?(e=ul(),null!==e?(r=ul(),null!==r?(o=ul(),null!==o?n=[n,u,e,r,o]:(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c)):(n=null,il=c),null!==n&&(n=function(n,l,u,t,e){return String.fromCharCode(parseInt("0x"+l+u+t+e))}(i,n[1],n[2],n[3],n[4])),null===n&&(il=i),null===n&&(/^[!-~\x80-\xFF]/.test(l.charAt(il))?(n=l.charAt(il),il++):(n=null,0===cl&&t("[!-~\\x80-\\xFF]")),null===n&&(n=ll())),cl--,0===cl&&null===n&&t("character"),n}function el(n){n.sort();for(var l=null,u=[],t=0;t<n.length;t++)n[t]!==l&&(u.push(n[t]),l=n[t]);return u}function rl(){for(var n=1,u=1,t=!1,e=0;e<Math.max(il,al);e++){var r=l.charAt(e);"\n"===r?(t||n++,u=1,t=!1):"\r"===r||"\u2028"===r||"\u2029"===r?(n++,u=1,t=!0):(u++,t=!1)}return{line:n,column:u}}var ol={NODES:e,NODE:r,ECONodes:o,ECONode:i,ECOLiteral:c,ECOLiteralLeft:a,ECOLiteralRight:s,ECOEND:f,ECOExpression:p,ECOEscapedContent:h,ECOContent:d,ECOTagChar:v,ECOTagChars:m,ECOIndent:C,ECODirective:y,ECOOpen:g,ECOClose:b,HTMLNodes:A,HTMLNode:T,HTMLAttribute:_,HTMLCDATA:x,HTMLCDATAChar:L,HTMLCDATAChars:E,HTMLComment:M,HTMLCommentSTChar:H,HTMLDoctype:D,HTMLElement:w,HTMLElementInline:O,HTMLElementOpen:S,HTMLElementOpenDelim:j,HTMLElementClose:F,HTMLElementCloseDelim:N,HTMLScript:V,HTMLScriptContentChar:Q,HTMLScriptContentChars:k,HTMLStyle:P,HTMLText:U,HTMLContentChar:I,HTMLContentChars:q,HTMLTag:z,HTMLTagChars:R,HTMLNodeChar:Z,HTMLNodeChars:$,HTMLValue:B,HTMLValueDoubleQuoted:J,HTMLValueDoubleQuotedChar:W,HTMLValueQuoted:Y,HTMLValueQuotedChar:G,HTMLValueNoQuoted:K,HTMLValueNoQuotedChar:X,_:nl,whitespace:ll,hexDigit:ul,"char":tl};if(void 0!==u){if(void 0===ol[u])throw new Error("Invalid rule name: "+n(u)+".")}else u="NODES";var il=0,cl=0,al=0,sl=[],fl=ol[u]();if(null===fl||il!==l.length){var pl=Math.max(il,al),hl=pl<l.length?l.charAt(pl):null,dl=rl();throw new this.SyntaxError(el(sl),hl,pl,dl.line,dl.column)}return fl},toSource:function(){return this._source}};return l.SyntaxError=function(l,u,t,e,r){function o(l,u){var t,e;switch(l.length){case 0:t="end of input";break;case 1:t=l[0];break;default:t=l.slice(0,l.length-1).join(", ")+" or "+l[l.length-1]}return e=u?n(u):"end of input","Expected "+t+" but "+e+" found."}this.name="SyntaxError",this.expected=l,this.found=u,this.message=o(l,u),this.offset=t,this.line=e,this.column=r},l.SyntaxError.prototype=Error.prototype,l}()},"coffee-script":function(n){if("undefined"==typeof CoffeeScript||null==CoffeeScript)throw"Cannot require '"+n.id+"': CoffeeScript not found";n.exports=CoffeeScript}})("cft");
8
+ this.cft = (function(modules) {
9
+ var dirname = function(path) {
10
+ return path.split('/').slice(0, -1).join('/');
11
+ };
12
+
13
+ var expand = function(root, name) {
14
+ var results = [], parts, part;
15
+ // If path is relative
16
+ if (/^\.\.?(\/|$)/.test(name)) {
17
+ parts = [root, name].join('/').split('/');
18
+ } else {
19
+ parts = name.split('/');
20
+ }
21
+ for (var i = 0, length = parts.length; i < length; i++) {
22
+ part = parts[i];
23
+ if (part == '..') {
24
+ results.pop();
25
+ } else if (part != '.' && part != '') {
26
+ results.push(part);
27
+ }
28
+ }
29
+ return results.join('/');
30
+ };
31
+
32
+ return function require(name, root) {
33
+ var path = expand(root || '', name);
34
+ var fn, module = {id: path, exports: {}};
35
+ if (fn = modules[path]) {
36
+ fn(module, function(name) {
37
+ return require(name, dirname(path));
38
+ }, module.exports);
39
+ return module.exports;
40
+ } else {
41
+ throw 'Cannot find module \'' + name + '\'';
42
+ }
43
+ };
44
+ })({
45
+ 'cft': function(module, require, exports) {
46
+ // Generated by CoffeeScript 1.6.2
47
+ (function() {
48
+ var StringCompiler, StringPreprocessor, cft, compile, precompile, preprocess, _ref;
49
+
50
+ _ref = require("./compilers/node"), compile = _ref.compile, precompile = _ref.precompile;
51
+
52
+ preprocess = require("./preprocessors/node").preprocess;
53
+
54
+ StringCompiler = require("./compilers/string");
55
+
56
+ StringPreprocessor = require("./preprocessors/string");
57
+
58
+ module.exports = cft = function(source) {
59
+ var _base, _ref1;
60
+
61
+ if (cft.cache) {
62
+ return (_ref1 = (_base = cft.cache)[source]) != null ? _ref1 : _base[source] = compile(source);
63
+ } else {
64
+ return compile(source);
65
+ }
66
+ };
67
+
68
+ cft.cache = {};
69
+
70
+ cft.preprocess = preprocess;
71
+
72
+ cft.precompile = precompile;
73
+
74
+ cft.compile = compile;
75
+
76
+ cft.render = function(source, data) {
77
+ return (cft(source))(data);
78
+ };
79
+
80
+ cft.preprocessString = StringPreprocessor.preprocess;
81
+
82
+ cft.precompileString = StringCompiler.precompile;
83
+
84
+ cft.compileString = StringCompiler.compile;
85
+
86
+ }).call(this);
87
+
88
+ },
89
+ 'compiler': function(module, require, exports) {
90
+ // Generated by CoffeeScript 1.6.2
91
+ (function() {
92
+ var CoffeeScript, indent, precompile, preprocess, preprocessString, _ref;
93
+
94
+ CoffeeScript = require("coffee-script");
95
+
96
+ _ref = require("./preprocessor"), preprocess = _ref.preprocess, preprocessString = _ref.preprocessString;
97
+
98
+ indent = require("./util").indent;
99
+
100
+ exports.precompileString = function(source) {
101
+ var script;
102
+
103
+ script = CoffeeScript.compile(preprocessString(source), {
104
+ bare: true
105
+ });
106
+ return "function(__obj) {\n if (!__obj) __obj = {};\n\n var __escape = __obj.escape = function(value) {\n return (\"\" + value).replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\x22/g, \"&quot;\");\n };\n\n var __capture = function(out, callback) {\n var out = __out, result;\n __out = [];\n callback.call(this);\n result = __out.join('');\n __out = out;\n return result;\n };\n\n return (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n}";
107
+ };
108
+
109
+ exports.precompileNodes = exports.precompile = precompile = function(source) {
110
+ var script;
111
+
112
+ script = CoffeeScript.compile(preprocess(source), {
113
+ bare: true
114
+ });
115
+ return "function(__obj) {\n if (!__obj) __obj = {};\n\n var __escape = __obj.escape = function(value) {\n return (\"\" + value).replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\x22/g, \"&quot;\");\n };\n\n var __capture = function(callback) {\n var out = __out, result;\n __out = [];\n callback.call(this);\n result = __out.join('');\n __out = out;\n return result;\n };\n\n var __createFragment = __obj.createFragment = function(value, element) {\n if (value instanceof DocumentFragment) return value;\n element || (element = document.createElement('div'));\n var range = document.createRange();\n range.setStart(element, 0);\n range.collapse(false);\n return range.createContextualFragment(value);\n };\n\n return (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n}";
116
+ };
117
+
118
+ exports.compile = function(source) {
119
+ return new Function("return " + (precompile(source)))();
120
+ };
121
+
122
+ }).call(this);
123
+
124
+ },
125
+ 'compilers/node': function(module, require, exports) {
126
+ // Generated by CoffeeScript 1.6.2
127
+ (function() {
128
+ var CoffeeScript, indent, precompile, preprocess;
129
+
130
+ CoffeeScript = require("coffee-script");
131
+
132
+ preprocess = require("../preprocessors/node").preprocess;
133
+
134
+ indent = require("../util").indent;
135
+
136
+ exports.precompile = precompile = function(source) {
137
+ var script;
138
+
139
+ script = CoffeeScript.compile(preprocess(source), {
140
+ bare: true
141
+ });
142
+ return "function(__obj) {\n if (!__obj) __obj = {};\n\n var __escape = __obj.escape = function(value) {\n return (\"\" + value).replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\x22/g, \"&quot;\");\n };\n\n var __createFragment = __obj.createFragment = function(value, element) {\n if (value instanceof DocumentFragment) return value;\n element || (element = document.createElement('div'));\n var range = document.createRange();\n range.setStart(element, 0);\n range.collapse(false);\n return range.createContextualFragment(value);\n };\n\n return (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n}";
143
+ };
144
+
145
+ exports.compile = function(source) {
146
+ return new Function("return " + (precompile(source)))();
147
+ };
148
+
149
+ }).call(this);
150
+
151
+ },
152
+ 'compilers/string': function(module, require, exports) {
153
+ // Generated by CoffeeScript 1.6.2
154
+ (function() {
155
+ var CoffeeScript, indent, precompile, preprocess;
156
+
157
+ CoffeeScript = require("coffee-script");
158
+
159
+ preprocess = require("../preprocessors/string").preprocess;
160
+
161
+ indent = require("../util").indent;
162
+
163
+ exports.precompile = precompile = function(source) {
164
+ var script;
165
+
166
+ script = CoffeeScript.compile(preprocess(source), {
167
+ bare: true
168
+ });
169
+ return "function(__obj) {\n if (!__obj) __obj = {};\n\n var __escape = __obj.escape = function(value) {\n return (\"\" + value).replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\x22/g, \"&quot;\");\n };\n\n return (function() {\n " + (indent(script, 4)) + "\n }).call(__obj);\n}";
170
+ };
171
+
172
+ exports.compile = function(source) {
173
+ return new Function("return " + (precompile(source)))();
174
+ };
175
+
176
+ }).call(this);
177
+
178
+ },
179
+ 'preprocessor': function(module, require, exports) {
180
+ // Generated by CoffeeScript 1.6.2
181
+ (function() {
182
+ var NodePreprocessor, StringPreprocessor;
183
+
184
+ NodePreprocessor = require('./preprocessors/node');
185
+
186
+ StringPreprocessor = require('./preprocessors/string');
187
+
188
+ exports.preprocess = exports.preprocessNodes = function(source) {
189
+ return NodePreprocessor.preprocess(source);
190
+ };
191
+
192
+ exports.preprocessString = function(source) {
193
+ return StringPreprocessor.preprocess(source);
194
+ };
195
+
196
+ }).call(this);
197
+
198
+ },
199
+ 'preprocessors/node': function(module, require, exports) {
200
+ // Generated by CoffeeScript 1.6.2
201
+ (function() {
202
+ var Preprocessor, Scanner, String, util,
203
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
204
+
205
+ Scanner = require("../scanner");
206
+
207
+ util = require("../util");
208
+
209
+ String = require("./string");
210
+
211
+ module.exports = Preprocessor = (function() {
212
+ Preprocessor.preprocess = function(source) {
213
+ var preprocessor;
214
+
215
+ preprocessor = new Preprocessor(source);
216
+ return preprocessor.preprocess();
217
+ };
218
+
219
+ function Preprocessor(source) {
220
+ this.source = source;
221
+ this.output = "";
222
+ this.level = 0;
223
+ this.index = 0;
224
+ this.captures = [];
225
+ this.record("" + (this.elementVar()) + " = document.createDocumentFragment()");
226
+ }
227
+
228
+ Preprocessor.prototype.preprocess = function() {
229
+ var token, _i, _len, _ref, _ref1;
230
+
231
+ _ref = Scanner.scanNodes(this.source);
232
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
233
+ token = _ref[_i];
234
+ if ((_ref1 = this[token.type]) != null) {
235
+ _ref1.call(this, token);
236
+ }
237
+ }
238
+ this.record("return " + (this.elementVar()));
239
+ return this.output;
240
+ };
241
+
242
+ Preprocessor.prototype.record = function(lines) {
243
+ var line, _i, _len, _ref, _results;
244
+
245
+ _ref = lines.split("\n");
246
+ _results = [];
247
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
248
+ line = _ref[_i];
249
+ if (!(line)) {
250
+ continue;
251
+ }
252
+ this.output += util.repeat(" ", this.level);
253
+ _results.push(this.output += line + "\n");
254
+ }
255
+ return _results;
256
+ };
257
+
258
+ Preprocessor.prototype.indent = function() {
259
+ return this.level++;
260
+ };
261
+
262
+ Preprocessor.prototype.dedent = function() {
263
+ this.level--;
264
+ if (this.level < 0) {
265
+ return this.fail('Unexpected dedent');
266
+ }
267
+ };
268
+
269
+ Preprocessor.prototype.elementVar = function(index) {
270
+ if (index == null) {
271
+ index = this.index;
272
+ }
273
+ return "__element" + index;
274
+ };
275
+
276
+ Preprocessor.prototype.traverseUp = function() {
277
+ this.index--;
278
+ if (this.index < 0) {
279
+ return this.fail('Unexpected traverse');
280
+ }
281
+ };
282
+
283
+ Preprocessor.prototype.traverseDown = function() {
284
+ return this.index++;
285
+ };
286
+
287
+ Preprocessor.prototype.append = function(code) {
288
+ return this.record("" + (this.elementVar()) + ".appendChild " + code);
289
+ };
290
+
291
+ Preprocessor.prototype.appendParent = function(code) {
292
+ return this.record("" + (this.elementVar(this.index - 1)) + ".appendChild " + code);
293
+ };
294
+
295
+ Preprocessor.prototype.fail = function(msg) {
296
+ throw new Error(msg);
297
+ };
298
+
299
+ Preprocessor.prototype.eco = function(token) {
300
+ if (token.dedent) {
301
+ this.dedent();
302
+ }
303
+ this["eco_" + token.tag].call(this, token);
304
+ if (token.indent || token.directive) {
305
+ this.indent();
306
+ }
307
+ if (token.directive) {
308
+ this.captures.unshift(this.level);
309
+ this.traverseDown();
310
+ return this.record("" + (this.elementVar()) + " = document.createDocumentFragment()");
311
+ }
312
+ };
313
+
314
+ Preprocessor.prototype.eco_end = function(token) {
315
+ if (this.captures[0] === this.level) {
316
+ this.captures.shift();
317
+ this.record(this.elementVar());
318
+ this.traverseUp();
319
+ }
320
+ return this.dedent();
321
+ };
322
+
323
+ Preprocessor.prototype.eco_leftLiteral = function(token) {
324
+ return this.append("document.createTextNode('<%')");
325
+ };
326
+
327
+ Preprocessor.prototype.eco_rightLiteral = function(token) {
328
+ return this.append("document.createTextNode('%>')");
329
+ };
330
+
331
+ Preprocessor.prototype.eco_expression = function(token) {
332
+ return this.record(token.content + token.directive);
333
+ };
334
+
335
+ Preprocessor.prototype.eco_escapedContent = function(token) {
336
+ if (token.directive) {
337
+ return this.fail('Directive provided for escaped content');
338
+ } else {
339
+ return this.append("document.createTextNode __escape " + token.content);
340
+ }
341
+ };
342
+
343
+ Preprocessor.prototype.eco_content = function(token) {
344
+ return this.append("__createFragment " + (token.content + token.directive));
345
+ };
346
+
347
+ Preprocessor.prototype.cdata = function(token) {};
348
+
349
+ Preprocessor.prototype.comment = function(token) {};
350
+
351
+ Preprocessor.prototype.doctype = function(token) {};
352
+
353
+ Preprocessor.prototype.script = function(token) {};
354
+
355
+ Preprocessor.prototype.voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
356
+
357
+ Preprocessor.prototype.element = function(token) {
358
+ var _ref;
359
+
360
+ if (_ref = token.tag, __indexOf.call(this.voidElements, _ref) >= 0) {
361
+ return this.element_inline(token);
362
+ } else {
363
+ return this["element_" + token.variant].call(this, token);
364
+ }
365
+ };
366
+
367
+ Preprocessor.prototype.element_open = function(token) {
368
+ var element;
369
+
370
+ this.traverseDown();
371
+ element = this.elementVar();
372
+ this.record("" + element + " = document.createElement(" + (util.inspect(token.tag)) + ")");
373
+ this.recordElementAttributes(element, token.attributes);
374
+ return this.appendParent(element);
375
+ };
376
+
377
+ Preprocessor.prototype.element_close = function(token) {
378
+ return this.traverseUp();
379
+ };
380
+
381
+ Preprocessor.prototype.element_inline = function(token) {
382
+ this.record("__curr = document.createElement(" + (util.inspect(token.tag)) + ")");
383
+ this.recordElementAttributes("__curr", token.attributes);
384
+ return this.append("__curr");
385
+ };
386
+
387
+ Preprocessor.prototype.style = function(token) {
388
+ this.record("__curr = document.createElement('style')");
389
+ this.recordElementAttributes("__curr", token.attributes);
390
+ this.record("__curr.innerHTML = " + (util.inspect(token.content)));
391
+ return this.append("__curr");
392
+ };
393
+
394
+ Preprocessor.prototype.text = function(token) {
395
+ return this.append("document.createTextNode(" + (util.inspect(token.content)) + ")");
396
+ };
397
+
398
+ Preprocessor.prototype.recordElementAttributes = function(element, attributes) {
399
+ var attr, _i, _len, _results;
400
+
401
+ _results = [];
402
+ for (_i = 0, _len = attributes.length; _i < _len; _i++) {
403
+ attr = attributes[_i];
404
+ _results.push(this.recordElementAttribute(element, attr.name, attr.value));
405
+ }
406
+ return _results;
407
+ };
408
+
409
+ Preprocessor.prototype.recordElementAttribute = function(element, name, value) {
410
+ if (value == null) {
411
+ value = '';
412
+ }
413
+ if (value.match(/<%/)) {
414
+ this.record("__value = do ->");
415
+ this.indent();
416
+ this.record(String.preprocess(value));
417
+ this.dedent();
418
+ return this.record("" + element + ".setAttribute(" + (util.inspect(name)) + ", __value)");
419
+ } else {
420
+ return this.record("" + element + ".setAttribute(" + (util.inspect(name)) + ", " + (util.inspect(value)) + ")");
421
+ }
422
+ };
423
+
424
+ return Preprocessor;
425
+
426
+ })();
427
+
428
+ }).call(this);
429
+
430
+ },
431
+ 'preprocessors/string': function(module, require, exports) {
432
+ // Generated by CoffeeScript 1.6.2
433
+ (function() {
434
+ var Preprocessor, Scanner, util;
435
+
436
+ Scanner = require("../scanner");
437
+
438
+ util = require("../util");
439
+
440
+ module.exports = Preprocessor = (function() {
441
+ Preprocessor.preprocess = function(source) {
442
+ var preprocessor;
443
+
444
+ preprocessor = new Preprocessor(source);
445
+ return preprocessor.preprocess();
446
+ };
447
+
448
+ function Preprocessor(source) {
449
+ this.source = source;
450
+ this.output = "";
451
+ this.level = 0;
452
+ this.index = 0;
453
+ this.captures = [];
454
+ this.record("" + (this.outVar()) + " = []");
455
+ }
456
+
457
+ Preprocessor.prototype.preprocess = function() {
458
+ var token, _i, _len, _ref, _ref1;
459
+
460
+ _ref = Scanner.scanString(this.source);
461
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
462
+ token = _ref[_i];
463
+ if ((_ref1 = this[token.type]) != null) {
464
+ _ref1.call(this, token);
465
+ }
466
+ }
467
+ this.record("return " + (this.outVar()) + ".join('')");
468
+ return this.output;
469
+ };
470
+
471
+ Preprocessor.prototype.outVar = function(index) {
472
+ if (index == null) {
473
+ index = this.index;
474
+ }
475
+ return "__out" + index;
476
+ };
477
+
478
+ Preprocessor.prototype.record = function(line) {
479
+ this.output += util.repeat(" ", this.level);
480
+ return this.output += line + "\n";
481
+ };
482
+
483
+ Preprocessor.prototype.append = function(string) {
484
+ return this.record("" + (this.outVar()) + ".push " + string);
485
+ };
486
+
487
+ Preprocessor.prototype.indent = function() {
488
+ return this.level++;
489
+ };
490
+
491
+ Preprocessor.prototype.dedent = function() {
492
+ this.level--;
493
+ if (this.level < 0) {
494
+ return this.fail('Unexpected dedent');
495
+ }
496
+ };
497
+
498
+ Preprocessor.prototype.traverseUp = function() {
499
+ this.index--;
500
+ if (this.index < 0) {
501
+ return this.fail('Unexpected traverse');
502
+ }
503
+ };
504
+
505
+ Preprocessor.prototype.traverseDown = function() {
506
+ return this.index++;
507
+ };
508
+
509
+ Preprocessor.prototype.fail = function(msg) {
510
+ throw new Error(msg);
511
+ };
512
+
513
+ Preprocessor.prototype.eco = function(token) {
514
+ if (token.dedent) {
515
+ this.dedent();
516
+ }
517
+ this["eco_" + token.tag].call(this, token);
518
+ if (token.indent || token.directive) {
519
+ this.indent();
520
+ }
521
+ if (token.directive) {
522
+ this.captures.unshift(this.level);
523
+ this.traverseDown();
524
+ return this.record("" + (this.outVar()) + " = []");
525
+ }
526
+ };
527
+
528
+ Preprocessor.prototype.eco_string = function(token) {
529
+ var string;
530
+
531
+ string = token.content;
532
+ return this.append(util.inspectString(string));
533
+ };
534
+
535
+ Preprocessor.prototype.eco_end = function(token) {
536
+ if (this.captures[0] === this.level) {
537
+ this.captures.shift();
538
+ this.record("" + (this.outVar()) + ".join('')");
539
+ this.traverseUp();
540
+ }
541
+ return this.dedent();
542
+ };
543
+
544
+ Preprocessor.prototype.eco_leftLiteral = function(token) {
545
+ return this.append(util.inspectString('<%'));
546
+ };
547
+
548
+ Preprocessor.prototype.eco_rightLiteral = function(token) {
549
+ return this.append(util.inspectString('%>'));
550
+ };
551
+
552
+ Preprocessor.prototype.eco_expression = function(token) {
553
+ return this.record(token.content + token.directive);
554
+ };
555
+
556
+ Preprocessor.prototype.eco_escapedContent = function(token) {
557
+ if (token.directive) {
558
+ return this.append("" + token.content + " __escape " + token.directive);
559
+ } else {
560
+ return this.append("__escape " + token.content);
561
+ }
562
+ };
563
+
564
+ Preprocessor.prototype.eco_content = function(token) {
565
+ return this.append(token.content + token.directive);
566
+ };
567
+
568
+ return Preprocessor;
569
+
570
+ })();
571
+
572
+ }).call(this);
573
+
574
+ },
575
+ 'scanner': function(module, require, exports) {
576
+ // Generated by CoffeeScript 1.6.2
577
+ (function() {
578
+ var Scanner, grammar;
579
+
580
+ grammar = require('./grammar');
581
+
582
+ module.exports = Scanner = (function() {
583
+ Scanner.scan = function(source) {
584
+ return this.scanNodes(source);
585
+ };
586
+
587
+ Scanner.scanNodes = function(source) {
588
+ var scanner, tokens;
589
+
590
+ tokens = [];
591
+ scanner = new Scanner(source);
592
+ return scanner.scan('NODES');
593
+ };
594
+
595
+ Scanner.scanString = function(source) {
596
+ var scanner, tokens;
597
+
598
+ tokens = [];
599
+ scanner = new Scanner(source);
600
+ return scanner.scan('STRING');
601
+ };
602
+
603
+ Scanner.dedentablePattern = /^(end|when|else|catch|finally)(?:\W|$)/;
604
+
605
+ function Scanner(source) {
606
+ this.source = source;
607
+ }
608
+
609
+ Scanner.prototype.scan = function(type) {
610
+ var token, _i, _len, _ref, _ref1, _results;
611
+
612
+ _ref = grammar.parse(this.source, type);
613
+ _results = [];
614
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
615
+ token = _ref[_i];
616
+ _results.push(((_ref1 = this[token.type]) != null ? _ref1.call(this, token) : void 0) || token);
617
+ }
618
+ return _results;
619
+ };
620
+
621
+ Scanner.prototype.eco = function(token) {
622
+ if (token.content && this.isDedentable(token.content)) {
623
+ token.dedent = true;
624
+ token.indent = true;
625
+ }
626
+ if (token.directive) {
627
+ token.indent = true;
628
+ }
629
+ return token;
630
+ };
631
+
632
+ Scanner.prototype.isDedentable = function(code) {
633
+ return code.match(Scanner.dedentablePattern);
634
+ };
635
+
636
+ return Scanner;
637
+
638
+ })();
639
+
640
+ }).call(this);
641
+
642
+ },
643
+ 'util': function(module, require, exports) {
644
+ // Generated by CoffeeScript 1.6.2
645
+ (function() {
646
+ var repeat, specialCharacters;
647
+
648
+ exports.repeat = repeat = function(string, count) {
649
+ return Array(count + 1).join(string);
650
+ };
651
+
652
+ exports.indent = function(string, width) {
653
+ var line, lines, space;
654
+
655
+ space = repeat(" ", width);
656
+ lines = (function() {
657
+ var _i, _len, _ref, _results;
658
+
659
+ _ref = string.split("\n");
660
+ _results = [];
661
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
662
+ line = _ref[_i];
663
+ _results.push(space + line);
664
+ }
665
+ return _results;
666
+ })();
667
+ return lines.join("\n");
668
+ };
669
+
670
+ exports.trim = function(string) {
671
+ return string.replace(/^\s+/, "").replace(/\s+$/, "");
672
+ };
673
+
674
+ specialCharacters = {
675
+ '\\': '\\\\',
676
+ '\b': '\\b',
677
+ '\f': '\\f',
678
+ '\n': '\\n',
679
+ '\r': '\\r',
680
+ '\t': '\\t'
681
+ };
682
+
683
+ exports.inspectString = function(string) {
684
+ var contents;
685
+
686
+ contents = string.replace(/[\x00-\x1f\\]/g, function(character) {
687
+ var code;
688
+
689
+ if (character in specialCharacters) {
690
+ return specialCharacters[character];
691
+ } else {
692
+ code = character.charCodeAt(0).toString(16);
693
+ if (code.length === 1) {
694
+ code = "0" + code;
695
+ }
696
+ return "\\u00" + code;
697
+ }
698
+ });
699
+ return "'" + contents.replace(/'/g, '\\\'') + "'";
700
+ };
701
+
702
+ exports.inspect = function(value) {
703
+ return JSON.stringify(value);
704
+ };
705
+
706
+ }).call(this);
707
+
708
+ },
709
+ 'grammar': function(module, require, exports) {
710
+ module.exports = (function(){
711
+ /*
712
+ * Generated by PEG.js 0.7.0.
713
+ *
714
+ * http://pegjs.majda.cz/
715
+ */
716
+
717
+ function quote(s) {
718
+ /*
719
+ * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
720
+ * string literal except for the closing quote character, backslash,
721
+ * carriage return, line separator, paragraph separator, and line feed.
722
+ * Any character may appear in the form of an escape sequence.
723
+ *
724
+ * For portability, we also escape escape all control and non-ASCII
725
+ * characters. Note that "\0" and "\v" escape sequences are not used
726
+ * because JSHint does not like the first and IE the second.
727
+ */
728
+ return '"' + s
729
+ .replace(/\\/g, '\\\\') // backslash
730
+ .replace(/"/g, '\\"') // closing quote character
731
+ .replace(/\x08/g, '\\b') // backspace
732
+ .replace(/\t/g, '\\t') // horizontal tab
733
+ .replace(/\n/g, '\\n') // line feed
734
+ .replace(/\f/g, '\\f') // form feed
735
+ .replace(/\r/g, '\\r') // carriage return
736
+ .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
737
+ + '"';
738
+ }
739
+
740
+ var result = {
741
+ /*
742
+ * Parses the input with a generated parser. If the parsing is successfull,
743
+ * returns a value explicitly or implicitly specified by the grammar from
744
+ * which the parser was generated (see |PEG.buildParser|). If the parsing is
745
+ * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
746
+ */
747
+ parse: function(input, startRule) {
748
+ var parseFunctions = {
749
+ "NODES": parse_NODES,
750
+ "NODE": parse_NODE,
751
+ "STRING": parse_STRING,
752
+ "STRING_NODE": parse_STRING_NODE,
753
+ "ECONodes": parse_ECONodes,
754
+ "ECONode": parse_ECONode,
755
+ "ECOLiteral": parse_ECOLiteral,
756
+ "ECOLiteralLeft": parse_ECOLiteralLeft,
757
+ "ECOLiteralRight": parse_ECOLiteralRight,
758
+ "ECOEND": parse_ECOEND,
759
+ "ECOExpression": parse_ECOExpression,
760
+ "ECOEscapedContent": parse_ECOEscapedContent,
761
+ "ECOContent": parse_ECOContent,
762
+ "ECOString": parse_ECOString,
763
+ "ECOTagChar": parse_ECOTagChar,
764
+ "ECOTagChars": parse_ECOTagChars,
765
+ "ECOStringChar": parse_ECOStringChar,
766
+ "ECOIndent": parse_ECOIndent,
767
+ "ECODirective": parse_ECODirective,
768
+ "ECOOpen": parse_ECOOpen,
769
+ "ECOClose": parse_ECOClose,
770
+ "HTMLNodes": parse_HTMLNodes,
771
+ "HTMLNode": parse_HTMLNode,
772
+ "HTMLAttribute": parse_HTMLAttribute,
773
+ "HTMLCDATA": parse_HTMLCDATA,
774
+ "HTMLCDATAChar": parse_HTMLCDATAChar,
775
+ "HTMLCDATAChars": parse_HTMLCDATAChars,
776
+ "HTMLComment": parse_HTMLComment,
777
+ "HTMLCommentSTChar": parse_HTMLCommentSTChar,
778
+ "HTMLDoctype": parse_HTMLDoctype,
779
+ "HTMLElement": parse_HTMLElement,
780
+ "HTMLElementInline": parse_HTMLElementInline,
781
+ "HTMLElementOpen": parse_HTMLElementOpen,
782
+ "HTMLElementOpenDelim": parse_HTMLElementOpenDelim,
783
+ "HTMLElementClose": parse_HTMLElementClose,
784
+ "HTMLElementCloseDelim": parse_HTMLElementCloseDelim,
785
+ "HTMLScript": parse_HTMLScript,
786
+ "HTMLScriptContentChar": parse_HTMLScriptContentChar,
787
+ "HTMLScriptContentChars": parse_HTMLScriptContentChars,
788
+ "HTMLStyle": parse_HTMLStyle,
789
+ "HTMLText": parse_HTMLText,
790
+ "HTMLContentChar": parse_HTMLContentChar,
791
+ "HTMLContentChars": parse_HTMLContentChars,
792
+ "HTMLTag": parse_HTMLTag,
793
+ "HTMLTagChars": parse_HTMLTagChars,
794
+ "HTMLNodeChar": parse_HTMLNodeChar,
795
+ "HTMLNodeChars": parse_HTMLNodeChars,
796
+ "HTMLValue": parse_HTMLValue,
797
+ "HTMLValueDoubleQuoted": parse_HTMLValueDoubleQuoted,
798
+ "HTMLValueDoubleQuotedChar": parse_HTMLValueDoubleQuotedChar,
799
+ "HTMLValueQuoted": parse_HTMLValueQuoted,
800
+ "HTMLValueQuotedChar": parse_HTMLValueQuotedChar,
801
+ "HTMLValueNoQuoted": parse_HTMLValueNoQuoted,
802
+ "HTMLValueNoQuotedChar": parse_HTMLValueNoQuotedChar,
803
+ "_": parse__,
804
+ "whitespace": parse_whitespace,
805
+ "hexDigit": parse_hexDigit,
806
+ "char": parse_char
807
+ };
808
+
809
+ if (startRule !== undefined) {
810
+ if (parseFunctions[startRule] === undefined) {
811
+ throw new Error("Invalid rule name: " + quote(startRule) + ".");
812
+ }
813
+ } else {
814
+ startRule = "NODES";
815
+ }
816
+
817
+ var pos = 0;
818
+ var reportFailures = 0;
819
+ var rightmostFailuresPos = 0;
820
+ var rightmostFailuresExpected = [];
821
+
822
+ function padLeft(input, padding, length) {
823
+ var result = input;
824
+
825
+ var padLength = length - input.length;
826
+ for (var i = 0; i < padLength; i++) {
827
+ result = padding + result;
828
+ }
829
+
830
+ return result;
831
+ }
832
+
833
+ function escape(ch) {
834
+ var charCode = ch.charCodeAt(0);
835
+ var escapeChar;
836
+ var length;
837
+
838
+ if (charCode <= 0xFF) {
839
+ escapeChar = 'x';
840
+ length = 2;
841
+ } else {
842
+ escapeChar = 'u';
843
+ length = 4;
844
+ }
845
+
846
+ return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
847
+ }
848
+
849
+ function matchFailed(failure) {
850
+ if (pos < rightmostFailuresPos) {
851
+ return;
852
+ }
853
+
854
+ if (pos > rightmostFailuresPos) {
855
+ rightmostFailuresPos = pos;
856
+ rightmostFailuresExpected = [];
857
+ }
858
+
859
+ rightmostFailuresExpected.push(failure);
860
+ }
861
+
862
+ function parse_NODES() {
863
+ var result0, result1, result2;
864
+ var pos0, pos1;
865
+
866
+ result0 = [];
867
+ pos0 = pos;
868
+ pos1 = pos;
869
+ result1 = parse_NODE();
870
+ if (result1 !== null) {
871
+ result2 = parse__();
872
+ if (result2 !== null) {
873
+ result1 = [result1, result2];
874
+ } else {
875
+ result1 = null;
876
+ pos = pos1;
877
+ }
878
+ } else {
879
+ result1 = null;
880
+ pos = pos1;
881
+ }
882
+ if (result1 !== null) {
883
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
884
+ }
885
+ if (result1 === null) {
886
+ pos = pos0;
887
+ }
888
+ while (result1 !== null) {
889
+ result0.push(result1);
890
+ pos0 = pos;
891
+ pos1 = pos;
892
+ result1 = parse_NODE();
893
+ if (result1 !== null) {
894
+ result2 = parse__();
895
+ if (result2 !== null) {
896
+ result1 = [result1, result2];
897
+ } else {
898
+ result1 = null;
899
+ pos = pos1;
900
+ }
901
+ } else {
902
+ result1 = null;
903
+ pos = pos1;
904
+ }
905
+ if (result1 !== null) {
906
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
907
+ }
908
+ if (result1 === null) {
909
+ pos = pos0;
910
+ }
911
+ }
912
+ return result0;
913
+ }
914
+
915
+ function parse_NODE() {
916
+ var result0;
917
+
918
+ result0 = parse_ECONode();
919
+ if (result0 === null) {
920
+ result0 = parse_HTMLNode();
921
+ }
922
+ return result0;
923
+ }
924
+
925
+ function parse_STRING() {
926
+ var result0, result1, result2;
927
+ var pos0, pos1;
928
+
929
+ result0 = [];
930
+ pos0 = pos;
931
+ pos1 = pos;
932
+ result1 = parse_STRING_NODE();
933
+ if (result1 !== null) {
934
+ result2 = parse__();
935
+ if (result2 !== null) {
936
+ result1 = [result1, result2];
937
+ } else {
938
+ result1 = null;
939
+ pos = pos1;
940
+ }
941
+ } else {
942
+ result1 = null;
943
+ pos = pos1;
944
+ }
945
+ if (result1 !== null) {
946
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
947
+ }
948
+ if (result1 === null) {
949
+ pos = pos0;
950
+ }
951
+ while (result1 !== null) {
952
+ result0.push(result1);
953
+ pos0 = pos;
954
+ pos1 = pos;
955
+ result1 = parse_STRING_NODE();
956
+ if (result1 !== null) {
957
+ result2 = parse__();
958
+ if (result2 !== null) {
959
+ result1 = [result1, result2];
960
+ } else {
961
+ result1 = null;
962
+ pos = pos1;
963
+ }
964
+ } else {
965
+ result1 = null;
966
+ pos = pos1;
967
+ }
968
+ if (result1 !== null) {
969
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
970
+ }
971
+ if (result1 === null) {
972
+ pos = pos0;
973
+ }
974
+ }
975
+ return result0;
976
+ }
977
+
978
+ function parse_STRING_NODE() {
979
+ var result0;
980
+
981
+ result0 = parse_ECONode();
982
+ if (result0 === null) {
983
+ result0 = parse_ECOString();
984
+ }
985
+ return result0;
986
+ }
987
+
988
+ function parse_ECONodes() {
989
+ var result0, result1, result2;
990
+ var pos0, pos1;
991
+
992
+ result0 = [];
993
+ pos0 = pos;
994
+ pos1 = pos;
995
+ result1 = parse_ECONode();
996
+ if (result1 !== null) {
997
+ result2 = parse__();
998
+ if (result2 !== null) {
999
+ result1 = [result1, result2];
1000
+ } else {
1001
+ result1 = null;
1002
+ pos = pos1;
1003
+ }
1004
+ } else {
1005
+ result1 = null;
1006
+ pos = pos1;
1007
+ }
1008
+ if (result1 !== null) {
1009
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
1010
+ }
1011
+ if (result1 === null) {
1012
+ pos = pos0;
1013
+ }
1014
+ while (result1 !== null) {
1015
+ result0.push(result1);
1016
+ pos0 = pos;
1017
+ pos1 = pos;
1018
+ result1 = parse_ECONode();
1019
+ if (result1 !== null) {
1020
+ result2 = parse__();
1021
+ if (result2 !== null) {
1022
+ result1 = [result1, result2];
1023
+ } else {
1024
+ result1 = null;
1025
+ pos = pos1;
1026
+ }
1027
+ } else {
1028
+ result1 = null;
1029
+ pos = pos1;
1030
+ }
1031
+ if (result1 !== null) {
1032
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
1033
+ }
1034
+ if (result1 === null) {
1035
+ pos = pos0;
1036
+ }
1037
+ }
1038
+ return result0;
1039
+ }
1040
+
1041
+ function parse_ECONode() {
1042
+ var result0;
1043
+
1044
+ result0 = parse_ECOLiteral();
1045
+ if (result0 === null) {
1046
+ result0 = parse_ECOEND();
1047
+ if (result0 === null) {
1048
+ result0 = parse_ECOEscapedContent();
1049
+ if (result0 === null) {
1050
+ result0 = parse_ECOContent();
1051
+ if (result0 === null) {
1052
+ result0 = parse_ECOExpression();
1053
+ }
1054
+ }
1055
+ }
1056
+ }
1057
+ return result0;
1058
+ }
1059
+
1060
+ function parse_ECOLiteral() {
1061
+ var result0;
1062
+
1063
+ result0 = parse_ECOLiteralLeft();
1064
+ if (result0 === null) {
1065
+ result0 = parse_ECOLiteralRight();
1066
+ }
1067
+ return result0;
1068
+ }
1069
+
1070
+ function parse_ECOLiteralLeft() {
1071
+ var result0;
1072
+ var pos0;
1073
+
1074
+ pos0 = pos;
1075
+ if (input.substr(pos, 3) === "<%%") {
1076
+ result0 = "<%%";
1077
+ pos += 3;
1078
+ } else {
1079
+ result0 = null;
1080
+ if (reportFailures === 0) {
1081
+ matchFailed("\"<%%\"");
1082
+ }
1083
+ }
1084
+ if (result0 !== null) {
1085
+ result0 = (function(offset) { return { type: 'eco', tag: 'leftLiteral' } })(pos0);
1086
+ }
1087
+ if (result0 === null) {
1088
+ pos = pos0;
1089
+ }
1090
+ return result0;
1091
+ }
1092
+
1093
+ function parse_ECOLiteralRight() {
1094
+ var result0;
1095
+ var pos0;
1096
+
1097
+ pos0 = pos;
1098
+ if (input.substr(pos, 3) === "%%>") {
1099
+ result0 = "%%>";
1100
+ pos += 3;
1101
+ } else {
1102
+ result0 = null;
1103
+ if (reportFailures === 0) {
1104
+ matchFailed("\"%%>\"");
1105
+ }
1106
+ }
1107
+ if (result0 !== null) {
1108
+ result0 = (function(offset) { return { type: 'eco', tag: 'rightLiteral' } })(pos0);
1109
+ }
1110
+ if (result0 === null) {
1111
+ pos = pos0;
1112
+ }
1113
+ return result0;
1114
+ }
1115
+
1116
+ function parse_ECOEND() {
1117
+ var result0, result1, result2, result3, result4;
1118
+ var pos0, pos1;
1119
+
1120
+ pos0 = pos;
1121
+ pos1 = pos;
1122
+ result0 = parse_ECOOpen();
1123
+ if (result0 !== null) {
1124
+ result1 = parse__();
1125
+ if (result1 !== null) {
1126
+ if (input.substr(pos, 3) === "end") {
1127
+ result2 = "end";
1128
+ pos += 3;
1129
+ } else {
1130
+ result2 = null;
1131
+ if (reportFailures === 0) {
1132
+ matchFailed("\"end\"");
1133
+ }
1134
+ }
1135
+ if (result2 !== null) {
1136
+ result3 = parse__();
1137
+ if (result3 !== null) {
1138
+ result4 = parse_ECOClose();
1139
+ if (result4 !== null) {
1140
+ result0 = [result0, result1, result2, result3, result4];
1141
+ } else {
1142
+ result0 = null;
1143
+ pos = pos1;
1144
+ }
1145
+ } else {
1146
+ result0 = null;
1147
+ pos = pos1;
1148
+ }
1149
+ } else {
1150
+ result0 = null;
1151
+ pos = pos1;
1152
+ }
1153
+ } else {
1154
+ result0 = null;
1155
+ pos = pos1;
1156
+ }
1157
+ } else {
1158
+ result0 = null;
1159
+ pos = pos1;
1160
+ }
1161
+ if (result0 !== null) {
1162
+ result0 = (function(offset) { return { type: 'eco', tag: 'end' } })(pos0);
1163
+ }
1164
+ if (result0 === null) {
1165
+ pos = pos0;
1166
+ }
1167
+ return result0;
1168
+ }
1169
+
1170
+ function parse_ECOExpression() {
1171
+ var result0, result1, result2, result3, result4, result5, result6;
1172
+ var pos0, pos1;
1173
+
1174
+ pos0 = pos;
1175
+ pos1 = pos;
1176
+ result0 = parse_ECOOpen();
1177
+ if (result0 !== null) {
1178
+ result1 = parse__();
1179
+ if (result1 !== null) {
1180
+ result2 = parse_ECOTagChars();
1181
+ result2 = result2 !== null ? result2 : "";
1182
+ if (result2 !== null) {
1183
+ result3 = parse_ECOIndent();
1184
+ result3 = result3 !== null ? result3 : "";
1185
+ if (result3 !== null) {
1186
+ result4 = parse_ECODirective();
1187
+ result4 = result4 !== null ? result4 : "";
1188
+ if (result4 !== null) {
1189
+ result5 = parse__();
1190
+ if (result5 !== null) {
1191
+ result6 = parse_ECOClose();
1192
+ if (result6 !== null) {
1193
+ result0 = [result0, result1, result2, result3, result4, result5, result6];
1194
+ } else {
1195
+ result0 = null;
1196
+ pos = pos1;
1197
+ }
1198
+ } else {
1199
+ result0 = null;
1200
+ pos = pos1;
1201
+ }
1202
+ } else {
1203
+ result0 = null;
1204
+ pos = pos1;
1205
+ }
1206
+ } else {
1207
+ result0 = null;
1208
+ pos = pos1;
1209
+ }
1210
+ } else {
1211
+ result0 = null;
1212
+ pos = pos1;
1213
+ }
1214
+ } else {
1215
+ result0 = null;
1216
+ pos = pos1;
1217
+ }
1218
+ } else {
1219
+ result0 = null;
1220
+ pos = pos1;
1221
+ }
1222
+ if (result0 !== null) {
1223
+ result0 = (function(offset, cont, indent, directive) { return { type: 'eco', tag: 'expression', content: cont, indent: indent, directive: directive }})(pos0, result0[2], result0[3], result0[4]);
1224
+ }
1225
+ if (result0 === null) {
1226
+ pos = pos0;
1227
+ }
1228
+ return result0;
1229
+ }
1230
+
1231
+ function parse_ECOEscapedContent() {
1232
+ var result0, result1, result2, result3, result4, result5, result6, result7;
1233
+ var pos0, pos1;
1234
+
1235
+ pos0 = pos;
1236
+ pos1 = pos;
1237
+ result0 = parse_ECOOpen();
1238
+ if (result0 !== null) {
1239
+ if (input.charCodeAt(pos) === 61) {
1240
+ result1 = "=";
1241
+ pos++;
1242
+ } else {
1243
+ result1 = null;
1244
+ if (reportFailures === 0) {
1245
+ matchFailed("\"=\"");
1246
+ }
1247
+ }
1248
+ if (result1 !== null) {
1249
+ result2 = parse__();
1250
+ if (result2 !== null) {
1251
+ result3 = parse_ECOTagChars();
1252
+ if (result3 !== null) {
1253
+ result4 = parse_ECOIndent();
1254
+ result4 = result4 !== null ? result4 : "";
1255
+ if (result4 !== null) {
1256
+ result5 = parse_ECODirective();
1257
+ result5 = result5 !== null ? result5 : "";
1258
+ if (result5 !== null) {
1259
+ result6 = parse__();
1260
+ if (result6 !== null) {
1261
+ result7 = parse_ECOClose();
1262
+ if (result7 !== null) {
1263
+ result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
1264
+ } else {
1265
+ result0 = null;
1266
+ pos = pos1;
1267
+ }
1268
+ } else {
1269
+ result0 = null;
1270
+ pos = pos1;
1271
+ }
1272
+ } else {
1273
+ result0 = null;
1274
+ pos = pos1;
1275
+ }
1276
+ } else {
1277
+ result0 = null;
1278
+ pos = pos1;
1279
+ }
1280
+ } else {
1281
+ result0 = null;
1282
+ pos = pos1;
1283
+ }
1284
+ } else {
1285
+ result0 = null;
1286
+ pos = pos1;
1287
+ }
1288
+ } else {
1289
+ result0 = null;
1290
+ pos = pos1;
1291
+ }
1292
+ } else {
1293
+ result0 = null;
1294
+ pos = pos1;
1295
+ }
1296
+ if (result0 !== null) {
1297
+ result0 = (function(offset, cont, indent, directive) { return { type: 'eco', tag: 'escapedContent', content: cont, indent: indent, directive: directive }})(pos0, result0[3], result0[4], result0[5]);
1298
+ }
1299
+ if (result0 === null) {
1300
+ pos = pos0;
1301
+ }
1302
+ return result0;
1303
+ }
1304
+
1305
+ function parse_ECOContent() {
1306
+ var result0, result1, result2, result3, result4, result5, result6, result7;
1307
+ var pos0, pos1;
1308
+
1309
+ pos0 = pos;
1310
+ pos1 = pos;
1311
+ result0 = parse_ECOOpen();
1312
+ if (result0 !== null) {
1313
+ if (input.charCodeAt(pos) === 45) {
1314
+ result1 = "-";
1315
+ pos++;
1316
+ } else {
1317
+ result1 = null;
1318
+ if (reportFailures === 0) {
1319
+ matchFailed("\"-\"");
1320
+ }
1321
+ }
1322
+ if (result1 !== null) {
1323
+ result2 = parse__();
1324
+ if (result2 !== null) {
1325
+ result3 = parse_ECOTagChars();
1326
+ if (result3 !== null) {
1327
+ result4 = parse_ECOIndent();
1328
+ result4 = result4 !== null ? result4 : "";
1329
+ if (result4 !== null) {
1330
+ result5 = parse_ECODirective();
1331
+ result5 = result5 !== null ? result5 : "";
1332
+ if (result5 !== null) {
1333
+ result6 = parse__();
1334
+ if (result6 !== null) {
1335
+ result7 = parse_ECOClose();
1336
+ if (result7 !== null) {
1337
+ result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
1338
+ } else {
1339
+ result0 = null;
1340
+ pos = pos1;
1341
+ }
1342
+ } else {
1343
+ result0 = null;
1344
+ pos = pos1;
1345
+ }
1346
+ } else {
1347
+ result0 = null;
1348
+ pos = pos1;
1349
+ }
1350
+ } else {
1351
+ result0 = null;
1352
+ pos = pos1;
1353
+ }
1354
+ } else {
1355
+ result0 = null;
1356
+ pos = pos1;
1357
+ }
1358
+ } else {
1359
+ result0 = null;
1360
+ pos = pos1;
1361
+ }
1362
+ } else {
1363
+ result0 = null;
1364
+ pos = pos1;
1365
+ }
1366
+ } else {
1367
+ result0 = null;
1368
+ pos = pos1;
1369
+ }
1370
+ if (result0 !== null) {
1371
+ result0 = (function(offset, cont, indent, directive) { return { type: 'eco', tag: 'content', content: cont, indent: indent, directive: directive }})(pos0, result0[3], result0[4], result0[5]);
1372
+ }
1373
+ if (result0 === null) {
1374
+ pos = pos0;
1375
+ }
1376
+ return result0;
1377
+ }
1378
+
1379
+ function parse_ECOString() {
1380
+ var result0, result1;
1381
+ var pos0;
1382
+
1383
+ pos0 = pos;
1384
+ result1 = parse_ECOStringChar();
1385
+ if (result1 !== null) {
1386
+ result0 = [];
1387
+ while (result1 !== null) {
1388
+ result0.push(result1);
1389
+ result1 = parse_ECOStringChar();
1390
+ }
1391
+ } else {
1392
+ result0 = null;
1393
+ }
1394
+ if (result0 !== null) {
1395
+ result0 = (function(offset, cont) { return { type: 'eco', tag: 'string', content: cont.join('') }})(pos0, result0);
1396
+ }
1397
+ if (result0 === null) {
1398
+ pos = pos0;
1399
+ }
1400
+ return result0;
1401
+ }
1402
+
1403
+ function parse_ECOTagChar() {
1404
+ var result0, result1, result2, result3, result4;
1405
+ var pos0, pos1, pos2, pos3;
1406
+
1407
+ pos0 = pos;
1408
+ pos1 = pos;
1409
+ pos2 = pos;
1410
+ reportFailures++;
1411
+ pos3 = pos;
1412
+ if (input.charCodeAt(pos) === 58) {
1413
+ result0 = ":";
1414
+ pos++;
1415
+ } else {
1416
+ result0 = null;
1417
+ if (reportFailures === 0) {
1418
+ matchFailed("\":\"");
1419
+ }
1420
+ }
1421
+ result0 = result0 !== null ? result0 : "";
1422
+ if (result0 !== null) {
1423
+ if (input.substr(pos, 2) === "->") {
1424
+ result1 = "->";
1425
+ pos += 2;
1426
+ } else {
1427
+ result1 = null;
1428
+ if (reportFailures === 0) {
1429
+ matchFailed("\"->\"");
1430
+ }
1431
+ }
1432
+ result1 = result1 !== null ? result1 : "";
1433
+ if (result1 !== null) {
1434
+ if (input.substr(pos, 2) === "=>") {
1435
+ result2 = "=>";
1436
+ pos += 2;
1437
+ } else {
1438
+ result2 = null;
1439
+ if (reportFailures === 0) {
1440
+ matchFailed("\"=>\"");
1441
+ }
1442
+ }
1443
+ result2 = result2 !== null ? result2 : "";
1444
+ if (result2 !== null) {
1445
+ result3 = parse__();
1446
+ if (result3 !== null) {
1447
+ if (input.substr(pos, 2) === "%>") {
1448
+ result4 = "%>";
1449
+ pos += 2;
1450
+ } else {
1451
+ result4 = null;
1452
+ if (reportFailures === 0) {
1453
+ matchFailed("\"%>\"");
1454
+ }
1455
+ }
1456
+ if (result4 !== null) {
1457
+ result0 = [result0, result1, result2, result3, result4];
1458
+ } else {
1459
+ result0 = null;
1460
+ pos = pos3;
1461
+ }
1462
+ } else {
1463
+ result0 = null;
1464
+ pos = pos3;
1465
+ }
1466
+ } else {
1467
+ result0 = null;
1468
+ pos = pos3;
1469
+ }
1470
+ } else {
1471
+ result0 = null;
1472
+ pos = pos3;
1473
+ }
1474
+ } else {
1475
+ result0 = null;
1476
+ pos = pos3;
1477
+ }
1478
+ reportFailures--;
1479
+ if (result0 === null) {
1480
+ result0 = "";
1481
+ } else {
1482
+ result0 = null;
1483
+ pos = pos2;
1484
+ }
1485
+ if (result0 !== null) {
1486
+ result1 = parse_char();
1487
+ if (result1 !== null) {
1488
+ result0 = [result0, result1];
1489
+ } else {
1490
+ result0 = null;
1491
+ pos = pos1;
1492
+ }
1493
+ } else {
1494
+ result0 = null;
1495
+ pos = pos1;
1496
+ }
1497
+ if (result0 !== null) {
1498
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
1499
+ }
1500
+ if (result0 === null) {
1501
+ pos = pos0;
1502
+ }
1503
+ return result0;
1504
+ }
1505
+
1506
+ function parse_ECOTagChars() {
1507
+ var result0, result1;
1508
+ var pos0;
1509
+
1510
+ pos0 = pos;
1511
+ result1 = parse_ECOTagChar();
1512
+ if (result1 !== null) {
1513
+ result0 = [];
1514
+ while (result1 !== null) {
1515
+ result0.push(result1);
1516
+ result1 = parse_ECOTagChar();
1517
+ }
1518
+ } else {
1519
+ result0 = null;
1520
+ }
1521
+ if (result0 !== null) {
1522
+ result0 = (function(offset, c) { return c.join(''); })(pos0, result0);
1523
+ }
1524
+ if (result0 === null) {
1525
+ pos = pos0;
1526
+ }
1527
+ return result0;
1528
+ }
1529
+
1530
+ function parse_ECOStringChar() {
1531
+ var result0, result1;
1532
+ var pos0, pos1, pos2;
1533
+
1534
+ pos0 = pos;
1535
+ pos1 = pos;
1536
+ pos2 = pos;
1537
+ reportFailures++;
1538
+ if (input.substr(pos, 2) === "</") {
1539
+ result0 = "</";
1540
+ pos += 2;
1541
+ } else {
1542
+ result0 = null;
1543
+ if (reportFailures === 0) {
1544
+ matchFailed("\"</\"");
1545
+ }
1546
+ }
1547
+ if (result0 === null) {
1548
+ if (input.charCodeAt(pos) === 60) {
1549
+ result0 = "<";
1550
+ pos++;
1551
+ } else {
1552
+ result0 = null;
1553
+ if (reportFailures === 0) {
1554
+ matchFailed("\"<\"");
1555
+ }
1556
+ }
1557
+ }
1558
+ reportFailures--;
1559
+ if (result0 === null) {
1560
+ result0 = "";
1561
+ } else {
1562
+ result0 = null;
1563
+ pos = pos2;
1564
+ }
1565
+ if (result0 !== null) {
1566
+ result1 = parse_char();
1567
+ if (result1 !== null) {
1568
+ result0 = [result0, result1];
1569
+ } else {
1570
+ result0 = null;
1571
+ pos = pos1;
1572
+ }
1573
+ } else {
1574
+ result0 = null;
1575
+ pos = pos1;
1576
+ }
1577
+ if (result0 !== null) {
1578
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
1579
+ }
1580
+ if (result0 === null) {
1581
+ pos = pos0;
1582
+ }
1583
+ return result0;
1584
+ }
1585
+
1586
+ function parse_ECOIndent() {
1587
+ var result0;
1588
+ var pos0;
1589
+
1590
+ pos0 = pos;
1591
+ if (input.charCodeAt(pos) === 58) {
1592
+ result0 = ":";
1593
+ pos++;
1594
+ } else {
1595
+ result0 = null;
1596
+ if (reportFailures === 0) {
1597
+ matchFailed("\":\"");
1598
+ }
1599
+ }
1600
+ result0 = result0 !== null ? result0 : "";
1601
+ if (result0 !== null) {
1602
+ result0 = (function(offset, indent) { return !!indent })(pos0, result0);
1603
+ }
1604
+ if (result0 === null) {
1605
+ pos = pos0;
1606
+ }
1607
+ return result0;
1608
+ }
1609
+
1610
+ function parse_ECODirective() {
1611
+ var result0;
1612
+
1613
+ if (input.substr(pos, 2) === "=>") {
1614
+ result0 = "=>";
1615
+ pos += 2;
1616
+ } else {
1617
+ result0 = null;
1618
+ if (reportFailures === 0) {
1619
+ matchFailed("\"=>\"");
1620
+ }
1621
+ }
1622
+ if (result0 === null) {
1623
+ if (input.substr(pos, 2) === "->") {
1624
+ result0 = "->";
1625
+ pos += 2;
1626
+ } else {
1627
+ result0 = null;
1628
+ if (reportFailures === 0) {
1629
+ matchFailed("\"->\"");
1630
+ }
1631
+ }
1632
+ }
1633
+ return result0;
1634
+ }
1635
+
1636
+ function parse_ECOOpen() {
1637
+ var result0;
1638
+
1639
+ if (input.substr(pos, 2) === "<%") {
1640
+ result0 = "<%";
1641
+ pos += 2;
1642
+ } else {
1643
+ result0 = null;
1644
+ if (reportFailures === 0) {
1645
+ matchFailed("\"<%\"");
1646
+ }
1647
+ }
1648
+ return result0;
1649
+ }
1650
+
1651
+ function parse_ECOClose() {
1652
+ var result0;
1653
+
1654
+ if (input.substr(pos, 2) === "%>") {
1655
+ result0 = "%>";
1656
+ pos += 2;
1657
+ } else {
1658
+ result0 = null;
1659
+ if (reportFailures === 0) {
1660
+ matchFailed("\"%>\"");
1661
+ }
1662
+ }
1663
+ return result0;
1664
+ }
1665
+
1666
+ function parse_HTMLNodes() {
1667
+ var result0, result1, result2;
1668
+ var pos0, pos1;
1669
+
1670
+ result0 = [];
1671
+ pos0 = pos;
1672
+ pos1 = pos;
1673
+ result1 = parse_HTMLNode();
1674
+ if (result1 !== null) {
1675
+ result2 = parse__();
1676
+ if (result2 !== null) {
1677
+ result1 = [result1, result2];
1678
+ } else {
1679
+ result1 = null;
1680
+ pos = pos1;
1681
+ }
1682
+ } else {
1683
+ result1 = null;
1684
+ pos = pos1;
1685
+ }
1686
+ if (result1 !== null) {
1687
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
1688
+ }
1689
+ if (result1 === null) {
1690
+ pos = pos0;
1691
+ }
1692
+ while (result1 !== null) {
1693
+ result0.push(result1);
1694
+ pos0 = pos;
1695
+ pos1 = pos;
1696
+ result1 = parse_HTMLNode();
1697
+ if (result1 !== null) {
1698
+ result2 = parse__();
1699
+ if (result2 !== null) {
1700
+ result1 = [result1, result2];
1701
+ } else {
1702
+ result1 = null;
1703
+ pos = pos1;
1704
+ }
1705
+ } else {
1706
+ result1 = null;
1707
+ pos = pos1;
1708
+ }
1709
+ if (result1 !== null) {
1710
+ result1 = (function(offset, c) { return c; })(pos0, result1[0]);
1711
+ }
1712
+ if (result1 === null) {
1713
+ pos = pos0;
1714
+ }
1715
+ }
1716
+ return result0;
1717
+ }
1718
+
1719
+ function parse_HTMLNode() {
1720
+ var result0;
1721
+
1722
+ result0 = parse_HTMLDoctype();
1723
+ if (result0 === null) {
1724
+ result0 = parse_HTMLCDATA();
1725
+ if (result0 === null) {
1726
+ result0 = parse_HTMLComment();
1727
+ if (result0 === null) {
1728
+ result0 = parse_HTMLScript();
1729
+ if (result0 === null) {
1730
+ result0 = parse_HTMLStyle();
1731
+ if (result0 === null) {
1732
+ result0 = parse_HTMLElement();
1733
+ if (result0 === null) {
1734
+ result0 = parse_HTMLText();
1735
+ }
1736
+ }
1737
+ }
1738
+ }
1739
+ }
1740
+ }
1741
+ return result0;
1742
+ }
1743
+
1744
+ function parse_HTMLAttribute() {
1745
+ var result0, result1, result2, result3, result4, result5;
1746
+ var pos0, pos1;
1747
+
1748
+ reportFailures++;
1749
+ pos0 = pos;
1750
+ pos1 = pos;
1751
+ result0 = parse_HTMLTag();
1752
+ if (result0 !== null) {
1753
+ result1 = parse__();
1754
+ if (result1 !== null) {
1755
+ if (input.charCodeAt(pos) === 61) {
1756
+ result2 = "=";
1757
+ pos++;
1758
+ } else {
1759
+ result2 = null;
1760
+ if (reportFailures === 0) {
1761
+ matchFailed("\"=\"");
1762
+ }
1763
+ }
1764
+ if (result2 !== null) {
1765
+ result3 = parse__();
1766
+ if (result3 !== null) {
1767
+ result4 = parse_HTMLValue();
1768
+ if (result4 !== null) {
1769
+ result5 = parse__();
1770
+ if (result5 !== null) {
1771
+ result0 = [result0, result1, result2, result3, result4, result5];
1772
+ } else {
1773
+ result0 = null;
1774
+ pos = pos1;
1775
+ }
1776
+ } else {
1777
+ result0 = null;
1778
+ pos = pos1;
1779
+ }
1780
+ } else {
1781
+ result0 = null;
1782
+ pos = pos1;
1783
+ }
1784
+ } else {
1785
+ result0 = null;
1786
+ pos = pos1;
1787
+ }
1788
+ } else {
1789
+ result0 = null;
1790
+ pos = pos1;
1791
+ }
1792
+ } else {
1793
+ result0 = null;
1794
+ pos = pos1;
1795
+ }
1796
+ if (result0 !== null) {
1797
+ result0 = (function(offset, t, v) { return { name: t, value: v } })(pos0, result0[0], result0[4]);
1798
+ }
1799
+ if (result0 === null) {
1800
+ pos = pos0;
1801
+ }
1802
+ if (result0 === null) {
1803
+ pos0 = pos;
1804
+ pos1 = pos;
1805
+ result0 = parse_HTMLTag();
1806
+ if (result0 !== null) {
1807
+ result1 = parse_HTMLValueDoubleQuoted();
1808
+ if (result1 === null) {
1809
+ result1 = parse_HTMLValueQuoted();
1810
+ }
1811
+ if (result1 !== null) {
1812
+ result0 = [result0, result1];
1813
+ } else {
1814
+ result0 = null;
1815
+ pos = pos1;
1816
+ }
1817
+ } else {
1818
+ result0 = null;
1819
+ pos = pos1;
1820
+ }
1821
+ if (result0 !== null) {
1822
+ result0 = (function(offset, t, v) { return { name: t, value: v } })(pos0, result0[0], result0[1]);
1823
+ }
1824
+ if (result0 === null) {
1825
+ pos = pos0;
1826
+ }
1827
+ if (result0 === null) {
1828
+ pos0 = pos;
1829
+ pos1 = pos;
1830
+ result0 = parse_HTMLTag();
1831
+ if (result0 !== null) {
1832
+ result1 = parse__();
1833
+ if (result1 !== null) {
1834
+ result0 = [result0, result1];
1835
+ } else {
1836
+ result0 = null;
1837
+ pos = pos1;
1838
+ }
1839
+ } else {
1840
+ result0 = null;
1841
+ pos = pos1;
1842
+ }
1843
+ if (result0 !== null) {
1844
+ result0 = (function(offset, t) { return { name: t }})(pos0, result0[0]);
1845
+ }
1846
+ if (result0 === null) {
1847
+ pos = pos0;
1848
+ }
1849
+ if (result0 === null) {
1850
+ result0 = parse_ECONode();
1851
+ }
1852
+ }
1853
+ }
1854
+ reportFailures--;
1855
+ if (reportFailures === 0 && result0 === null) {
1856
+ matchFailed("element attribute");
1857
+ }
1858
+ return result0;
1859
+ }
1860
+
1861
+ function parse_HTMLCDATA() {
1862
+ var result0, result1, result2;
1863
+ var pos0, pos1;
1864
+
1865
+ reportFailures++;
1866
+ pos0 = pos;
1867
+ pos1 = pos;
1868
+ if (input.substr(pos, 9) === "<![CDATA[") {
1869
+ result0 = "<![CDATA[";
1870
+ pos += 9;
1871
+ } else {
1872
+ result0 = null;
1873
+ if (reportFailures === 0) {
1874
+ matchFailed("\"<![CDATA[\"");
1875
+ }
1876
+ }
1877
+ if (result0 !== null) {
1878
+ result1 = parse_HTMLCDATAChars();
1879
+ if (result1 !== null) {
1880
+ if (input.substr(pos, 3) === "]]>") {
1881
+ result2 = "]]>";
1882
+ pos += 3;
1883
+ } else {
1884
+ result2 = null;
1885
+ if (reportFailures === 0) {
1886
+ matchFailed("\"]]>\"");
1887
+ }
1888
+ }
1889
+ if (result2 !== null) {
1890
+ result0 = [result0, result1, result2];
1891
+ } else {
1892
+ result0 = null;
1893
+ pos = pos1;
1894
+ }
1895
+ } else {
1896
+ result0 = null;
1897
+ pos = pos1;
1898
+ }
1899
+ } else {
1900
+ result0 = null;
1901
+ pos = pos1;
1902
+ }
1903
+ if (result0 !== null) {
1904
+ result0 = (function(offset, cont) { return { type: 'cdata', 'content': cont } })(pos0, result0[1]);
1905
+ }
1906
+ if (result0 === null) {
1907
+ pos = pos0;
1908
+ }
1909
+ reportFailures--;
1910
+ if (reportFailures === 0 && result0 === null) {
1911
+ matchFailed("CDATA section");
1912
+ }
1913
+ return result0;
1914
+ }
1915
+
1916
+ function parse_HTMLCDATAChar() {
1917
+ var result0, result1;
1918
+ var pos0, pos1, pos2;
1919
+
1920
+ pos0 = pos;
1921
+ pos1 = pos;
1922
+ pos2 = pos;
1923
+ reportFailures++;
1924
+ if (input.substr(pos, 3) === "]]>") {
1925
+ result0 = "]]>";
1926
+ pos += 3;
1927
+ } else {
1928
+ result0 = null;
1929
+ if (reportFailures === 0) {
1930
+ matchFailed("\"]]>\"");
1931
+ }
1932
+ }
1933
+ reportFailures--;
1934
+ if (result0 === null) {
1935
+ result0 = "";
1936
+ } else {
1937
+ result0 = null;
1938
+ pos = pos2;
1939
+ }
1940
+ if (result0 !== null) {
1941
+ result1 = parse_char();
1942
+ if (result1 !== null) {
1943
+ result0 = [result0, result1];
1944
+ } else {
1945
+ result0 = null;
1946
+ pos = pos1;
1947
+ }
1948
+ } else {
1949
+ result0 = null;
1950
+ pos = pos1;
1951
+ }
1952
+ if (result0 !== null) {
1953
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
1954
+ }
1955
+ if (result0 === null) {
1956
+ pos = pos0;
1957
+ }
1958
+ return result0;
1959
+ }
1960
+
1961
+ function parse_HTMLCDATAChars() {
1962
+ var result0, result1;
1963
+ var pos0;
1964
+
1965
+ pos0 = pos;
1966
+ result1 = parse_HTMLCDATAChar();
1967
+ if (result1 !== null) {
1968
+ result0 = [];
1969
+ while (result1 !== null) {
1970
+ result0.push(result1);
1971
+ result1 = parse_HTMLCDATAChar();
1972
+ }
1973
+ } else {
1974
+ result0 = null;
1975
+ }
1976
+ if (result0 !== null) {
1977
+ result0 = (function(offset, c) { return c.join(''); })(pos0, result0);
1978
+ }
1979
+ if (result0 === null) {
1980
+ pos = pos0;
1981
+ }
1982
+ return result0;
1983
+ }
1984
+
1985
+ function parse_HTMLComment() {
1986
+ var result0, result1, result2, result3, result4, result5, result6;
1987
+ var pos0, pos1;
1988
+
1989
+ reportFailures++;
1990
+ pos0 = pos;
1991
+ pos1 = pos;
1992
+ result0 = parse_HTMLElementOpenDelim();
1993
+ if (result0 !== null) {
1994
+ if (input.substr(pos, 3) === "!--") {
1995
+ result1 = "!--";
1996
+ pos += 3;
1997
+ } else {
1998
+ result1 = null;
1999
+ if (reportFailures === 0) {
2000
+ matchFailed("\"!--\"");
2001
+ }
2002
+ }
2003
+ if (result1 !== null) {
2004
+ result2 = parse__();
2005
+ if (result2 !== null) {
2006
+ result3 = [];
2007
+ result4 = parse_HTMLCommentSTChar();
2008
+ while (result4 !== null) {
2009
+ result3.push(result4);
2010
+ result4 = parse_HTMLCommentSTChar();
2011
+ }
2012
+ if (result3 !== null) {
2013
+ result4 = parse__();
2014
+ if (result4 !== null) {
2015
+ if (input.substr(pos, 2) === "--") {
2016
+ result5 = "--";
2017
+ pos += 2;
2018
+ } else {
2019
+ result5 = null;
2020
+ if (reportFailures === 0) {
2021
+ matchFailed("\"--\"");
2022
+ }
2023
+ }
2024
+ if (result5 !== null) {
2025
+ result6 = parse_HTMLElementCloseDelim();
2026
+ if (result6 !== null) {
2027
+ result0 = [result0, result1, result2, result3, result4, result5, result6];
2028
+ } else {
2029
+ result0 = null;
2030
+ pos = pos1;
2031
+ }
2032
+ } else {
2033
+ result0 = null;
2034
+ pos = pos1;
2035
+ }
2036
+ } else {
2037
+ result0 = null;
2038
+ pos = pos1;
2039
+ }
2040
+ } else {
2041
+ result0 = null;
2042
+ pos = pos1;
2043
+ }
2044
+ } else {
2045
+ result0 = null;
2046
+ pos = pos1;
2047
+ }
2048
+ } else {
2049
+ result0 = null;
2050
+ pos = pos1;
2051
+ }
2052
+ } else {
2053
+ result0 = null;
2054
+ pos = pos1;
2055
+ }
2056
+ if (result0 !== null) {
2057
+ result0 = (function(offset, chars) { return { type: 'comment', content: chars.join('') } })(pos0, result0[3]);
2058
+ }
2059
+ if (result0 === null) {
2060
+ pos = pos0;
2061
+ }
2062
+ reportFailures--;
2063
+ if (reportFailures === 0 && result0 === null) {
2064
+ matchFailed("comment");
2065
+ }
2066
+ return result0;
2067
+ }
2068
+
2069
+ function parse_HTMLCommentSTChar() {
2070
+ var result0, result1;
2071
+ var pos0, pos1, pos2;
2072
+
2073
+ pos0 = pos;
2074
+ pos1 = pos;
2075
+ pos2 = pos;
2076
+ reportFailures++;
2077
+ if (input.substr(pos, 3) === "-->") {
2078
+ result0 = "-->";
2079
+ pos += 3;
2080
+ } else {
2081
+ result0 = null;
2082
+ if (reportFailures === 0) {
2083
+ matchFailed("\"-->\"");
2084
+ }
2085
+ }
2086
+ reportFailures--;
2087
+ if (result0 === null) {
2088
+ result0 = "";
2089
+ } else {
2090
+ result0 = null;
2091
+ pos = pos2;
2092
+ }
2093
+ if (result0 !== null) {
2094
+ result1 = parse_char();
2095
+ if (result1 !== null) {
2096
+ result0 = [result0, result1];
2097
+ } else {
2098
+ result0 = null;
2099
+ pos = pos1;
2100
+ }
2101
+ } else {
2102
+ result0 = null;
2103
+ pos = pos1;
2104
+ }
2105
+ if (result0 !== null) {
2106
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
2107
+ }
2108
+ if (result0 === null) {
2109
+ pos = pos0;
2110
+ }
2111
+ return result0;
2112
+ }
2113
+
2114
+ function parse_HTMLDoctype() {
2115
+ var result0, result1, result2, result3, result4, result5, result6;
2116
+ var pos0, pos1;
2117
+
2118
+ reportFailures++;
2119
+ pos0 = pos;
2120
+ pos1 = pos;
2121
+ result0 = parse_HTMLElementOpenDelim();
2122
+ if (result0 !== null) {
2123
+ if (input.charCodeAt(pos) === 33) {
2124
+ result1 = "!";
2125
+ pos++;
2126
+ } else {
2127
+ result1 = null;
2128
+ if (reportFailures === 0) {
2129
+ matchFailed("\"!\"");
2130
+ }
2131
+ }
2132
+ if (result1 !== null) {
2133
+ if (input.substr(pos, 7).toLowerCase() === "doctype") {
2134
+ result2 = input.substr(pos, 7);
2135
+ pos += 7;
2136
+ } else {
2137
+ result2 = null;
2138
+ if (reportFailures === 0) {
2139
+ matchFailed("\"DOCTYPE\"");
2140
+ }
2141
+ }
2142
+ if (result2 !== null) {
2143
+ result3 = parse__();
2144
+ if (result3 !== null) {
2145
+ result4 = parse_HTMLNodeChars();
2146
+ if (result4 !== null) {
2147
+ result5 = parse__();
2148
+ if (result5 !== null) {
2149
+ result6 = parse_HTMLElementCloseDelim();
2150
+ if (result6 !== null) {
2151
+ result0 = [result0, result1, result2, result3, result4, result5, result6];
2152
+ } else {
2153
+ result0 = null;
2154
+ pos = pos1;
2155
+ }
2156
+ } else {
2157
+ result0 = null;
2158
+ pos = pos1;
2159
+ }
2160
+ } else {
2161
+ result0 = null;
2162
+ pos = pos1;
2163
+ }
2164
+ } else {
2165
+ result0 = null;
2166
+ pos = pos1;
2167
+ }
2168
+ } else {
2169
+ result0 = null;
2170
+ pos = pos1;
2171
+ }
2172
+ } else {
2173
+ result0 = null;
2174
+ pos = pos1;
2175
+ }
2176
+ } else {
2177
+ result0 = null;
2178
+ pos = pos1;
2179
+ }
2180
+ if (result0 !== null) {
2181
+ result0 = (function(offset, cont) { return { type: 'doctype', content: cont } })(pos0, result0[4]);
2182
+ }
2183
+ if (result0 === null) {
2184
+ pos = pos0;
2185
+ }
2186
+ reportFailures--;
2187
+ if (reportFailures === 0 && result0 === null) {
2188
+ matchFailed("doctype");
2189
+ }
2190
+ return result0;
2191
+ }
2192
+
2193
+ function parse_HTMLElement() {
2194
+ var result0;
2195
+
2196
+ result0 = parse_HTMLElementInline();
2197
+ if (result0 === null) {
2198
+ result0 = parse_HTMLElementOpen();
2199
+ if (result0 === null) {
2200
+ result0 = parse_HTMLElementClose();
2201
+ }
2202
+ }
2203
+ return result0;
2204
+ }
2205
+
2206
+ function parse_HTMLElementInline() {
2207
+ var result0, result1, result2, result3, result4, result5, result6, result7, result8;
2208
+ var pos0, pos1;
2209
+
2210
+ reportFailures++;
2211
+ pos0 = pos;
2212
+ pos1 = pos;
2213
+ result0 = parse_HTMLElementOpenDelim();
2214
+ if (result0 !== null) {
2215
+ result1 = parse__();
2216
+ if (result1 !== null) {
2217
+ result2 = parse_HTMLTag();
2218
+ if (result2 !== null) {
2219
+ result3 = parse__();
2220
+ if (result3 !== null) {
2221
+ result4 = [];
2222
+ result5 = parse_HTMLAttribute();
2223
+ while (result5 !== null) {
2224
+ result4.push(result5);
2225
+ result5 = parse_HTMLAttribute();
2226
+ }
2227
+ if (result4 !== null) {
2228
+ result5 = parse__();
2229
+ if (result5 !== null) {
2230
+ if (input.charCodeAt(pos) === 47) {
2231
+ result6 = "/";
2232
+ pos++;
2233
+ } else {
2234
+ result6 = null;
2235
+ if (reportFailures === 0) {
2236
+ matchFailed("\"/\"");
2237
+ }
2238
+ }
2239
+ if (result6 !== null) {
2240
+ result7 = parse__();
2241
+ if (result7 !== null) {
2242
+ result8 = parse_HTMLElementCloseDelim();
2243
+ if (result8 !== null) {
2244
+ result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
2245
+ } else {
2246
+ result0 = null;
2247
+ pos = pos1;
2248
+ }
2249
+ } else {
2250
+ result0 = null;
2251
+ pos = pos1;
2252
+ }
2253
+ } else {
2254
+ result0 = null;
2255
+ pos = pos1;
2256
+ }
2257
+ } else {
2258
+ result0 = null;
2259
+ pos = pos1;
2260
+ }
2261
+ } else {
2262
+ result0 = null;
2263
+ pos = pos1;
2264
+ }
2265
+ } else {
2266
+ result0 = null;
2267
+ pos = pos1;
2268
+ }
2269
+ } else {
2270
+ result0 = null;
2271
+ pos = pos1;
2272
+ }
2273
+ } else {
2274
+ result0 = null;
2275
+ pos = pos1;
2276
+ }
2277
+ } else {
2278
+ result0 = null;
2279
+ pos = pos1;
2280
+ }
2281
+ if (result0 !== null) {
2282
+ result0 = (function(offset, t, attrs) { return { type: 'element', tag : t, variant: 'inline', attributes: attrs } })(pos0, result0[2], result0[4]);
2283
+ }
2284
+ if (result0 === null) {
2285
+ pos = pos0;
2286
+ }
2287
+ reportFailures--;
2288
+ if (reportFailures === 0 && result0 === null) {
2289
+ matchFailed("inline element");
2290
+ }
2291
+ return result0;
2292
+ }
2293
+
2294
+ function parse_HTMLElementOpen() {
2295
+ var result0, result1, result2, result3, result4, result5, result6;
2296
+ var pos0, pos1;
2297
+
2298
+ reportFailures++;
2299
+ pos0 = pos;
2300
+ pos1 = pos;
2301
+ result0 = parse_HTMLElementOpenDelim();
2302
+ if (result0 !== null) {
2303
+ result1 = parse__();
2304
+ if (result1 !== null) {
2305
+ result2 = parse_HTMLTag();
2306
+ if (result2 !== null) {
2307
+ result3 = parse__();
2308
+ if (result3 !== null) {
2309
+ result4 = [];
2310
+ result5 = parse_HTMLAttribute();
2311
+ while (result5 !== null) {
2312
+ result4.push(result5);
2313
+ result5 = parse_HTMLAttribute();
2314
+ }
2315
+ if (result4 !== null) {
2316
+ result5 = parse__();
2317
+ if (result5 !== null) {
2318
+ result6 = parse_HTMLElementCloseDelim();
2319
+ if (result6 !== null) {
2320
+ result0 = [result0, result1, result2, result3, result4, result5, result6];
2321
+ } else {
2322
+ result0 = null;
2323
+ pos = pos1;
2324
+ }
2325
+ } else {
2326
+ result0 = null;
2327
+ pos = pos1;
2328
+ }
2329
+ } else {
2330
+ result0 = null;
2331
+ pos = pos1;
2332
+ }
2333
+ } else {
2334
+ result0 = null;
2335
+ pos = pos1;
2336
+ }
2337
+ } else {
2338
+ result0 = null;
2339
+ pos = pos1;
2340
+ }
2341
+ } else {
2342
+ result0 = null;
2343
+ pos = pos1;
2344
+ }
2345
+ } else {
2346
+ result0 = null;
2347
+ pos = pos1;
2348
+ }
2349
+ if (result0 !== null) {
2350
+ result0 = (function(offset, t, attrs) { return { type: 'element', tag : t, variant: 'open', attributes: attrs } })(pos0, result0[2], result0[4]);
2351
+ }
2352
+ if (result0 === null) {
2353
+ pos = pos0;
2354
+ }
2355
+ reportFailures--;
2356
+ if (reportFailures === 0 && result0 === null) {
2357
+ matchFailed("new element");
2358
+ }
2359
+ return result0;
2360
+ }
2361
+
2362
+ function parse_HTMLElementOpenDelim() {
2363
+ var result0;
2364
+
2365
+ if (input.charCodeAt(pos) === 60) {
2366
+ result0 = "<";
2367
+ pos++;
2368
+ } else {
2369
+ result0 = null;
2370
+ if (reportFailures === 0) {
2371
+ matchFailed("\"<\"");
2372
+ }
2373
+ }
2374
+ return result0;
2375
+ }
2376
+
2377
+ function parse_HTMLElementClose() {
2378
+ var result0, result1, result2, result3, result4, result5, result6;
2379
+ var pos0, pos1;
2380
+
2381
+ reportFailures++;
2382
+ pos0 = pos;
2383
+ pos1 = pos;
2384
+ result0 = parse_HTMLElementOpenDelim();
2385
+ if (result0 !== null) {
2386
+ result1 = parse__();
2387
+ if (result1 !== null) {
2388
+ if (input.charCodeAt(pos) === 47) {
2389
+ result2 = "/";
2390
+ pos++;
2391
+ } else {
2392
+ result2 = null;
2393
+ if (reportFailures === 0) {
2394
+ matchFailed("\"/\"");
2395
+ }
2396
+ }
2397
+ if (result2 !== null) {
2398
+ result3 = parse__();
2399
+ if (result3 !== null) {
2400
+ result4 = parse_HTMLTag();
2401
+ if (result4 !== null) {
2402
+ result5 = parse__();
2403
+ if (result5 !== null) {
2404
+ result6 = parse_HTMLElementCloseDelim();
2405
+ if (result6 !== null) {
2406
+ result0 = [result0, result1, result2, result3, result4, result5, result6];
2407
+ } else {
2408
+ result0 = null;
2409
+ pos = pos1;
2410
+ }
2411
+ } else {
2412
+ result0 = null;
2413
+ pos = pos1;
2414
+ }
2415
+ } else {
2416
+ result0 = null;
2417
+ pos = pos1;
2418
+ }
2419
+ } else {
2420
+ result0 = null;
2421
+ pos = pos1;
2422
+ }
2423
+ } else {
2424
+ result0 = null;
2425
+ pos = pos1;
2426
+ }
2427
+ } else {
2428
+ result0 = null;
2429
+ pos = pos1;
2430
+ }
2431
+ } else {
2432
+ result0 = null;
2433
+ pos = pos1;
2434
+ }
2435
+ if (result0 !== null) {
2436
+ result0 = (function(offset, t) { return { type: 'element', tag : t, variant: 'close' } })(pos0, result0[4]);
2437
+ }
2438
+ if (result0 === null) {
2439
+ pos = pos0;
2440
+ }
2441
+ reportFailures--;
2442
+ if (reportFailures === 0 && result0 === null) {
2443
+ matchFailed("end of element");
2444
+ }
2445
+ return result0;
2446
+ }
2447
+
2448
+ function parse_HTMLElementCloseDelim() {
2449
+ var result0;
2450
+
2451
+ if (input.charCodeAt(pos) === 62) {
2452
+ result0 = ">";
2453
+ pos++;
2454
+ } else {
2455
+ result0 = null;
2456
+ if (reportFailures === 0) {
2457
+ matchFailed("\">\"");
2458
+ }
2459
+ }
2460
+ return result0;
2461
+ }
2462
+
2463
+ function parse_HTMLScript() {
2464
+ var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14;
2465
+ var pos0, pos1;
2466
+
2467
+ reportFailures++;
2468
+ pos0 = pos;
2469
+ pos1 = pos;
2470
+ result0 = parse_HTMLElementOpenDelim();
2471
+ if (result0 !== null) {
2472
+ result1 = parse__();
2473
+ if (result1 !== null) {
2474
+ if (input.substr(pos, 6).toLowerCase() === "script") {
2475
+ result2 = input.substr(pos, 6);
2476
+ pos += 6;
2477
+ } else {
2478
+ result2 = null;
2479
+ if (reportFailures === 0) {
2480
+ matchFailed("\"script\"");
2481
+ }
2482
+ }
2483
+ if (result2 !== null) {
2484
+ result3 = parse__();
2485
+ if (result3 !== null) {
2486
+ result4 = [];
2487
+ result5 = parse_HTMLAttribute();
2488
+ while (result5 !== null) {
2489
+ result4.push(result5);
2490
+ result5 = parse_HTMLAttribute();
2491
+ }
2492
+ if (result4 !== null) {
2493
+ result5 = parse__();
2494
+ if (result5 !== null) {
2495
+ result6 = parse_HTMLElementCloseDelim();
2496
+ if (result6 !== null) {
2497
+ result7 = parse_HTMLScriptContentChars();
2498
+ if (result7 !== null) {
2499
+ result8 = parse_HTMLElementOpenDelim();
2500
+ if (result8 !== null) {
2501
+ result9 = parse__();
2502
+ if (result9 !== null) {
2503
+ if (input.charCodeAt(pos) === 47) {
2504
+ result10 = "/";
2505
+ pos++;
2506
+ } else {
2507
+ result10 = null;
2508
+ if (reportFailures === 0) {
2509
+ matchFailed("\"/\"");
2510
+ }
2511
+ }
2512
+ if (result10 !== null) {
2513
+ result11 = parse__();
2514
+ if (result11 !== null) {
2515
+ if (input.substr(pos, 6).toLowerCase() === "script") {
2516
+ result12 = input.substr(pos, 6);
2517
+ pos += 6;
2518
+ } else {
2519
+ result12 = null;
2520
+ if (reportFailures === 0) {
2521
+ matchFailed("\"script\"");
2522
+ }
2523
+ }
2524
+ if (result12 !== null) {
2525
+ result13 = parse__();
2526
+ if (result13 !== null) {
2527
+ result14 = parse_HTMLElementCloseDelim();
2528
+ if (result14 !== null) {
2529
+ result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14];
2530
+ } else {
2531
+ result0 = null;
2532
+ pos = pos1;
2533
+ }
2534
+ } else {
2535
+ result0 = null;
2536
+ pos = pos1;
2537
+ }
2538
+ } else {
2539
+ result0 = null;
2540
+ pos = pos1;
2541
+ }
2542
+ } else {
2543
+ result0 = null;
2544
+ pos = pos1;
2545
+ }
2546
+ } else {
2547
+ result0 = null;
2548
+ pos = pos1;
2549
+ }
2550
+ } else {
2551
+ result0 = null;
2552
+ pos = pos1;
2553
+ }
2554
+ } else {
2555
+ result0 = null;
2556
+ pos = pos1;
2557
+ }
2558
+ } else {
2559
+ result0 = null;
2560
+ pos = pos1;
2561
+ }
2562
+ } else {
2563
+ result0 = null;
2564
+ pos = pos1;
2565
+ }
2566
+ } else {
2567
+ result0 = null;
2568
+ pos = pos1;
2569
+ }
2570
+ } else {
2571
+ result0 = null;
2572
+ pos = pos1;
2573
+ }
2574
+ } else {
2575
+ result0 = null;
2576
+ pos = pos1;
2577
+ }
2578
+ } else {
2579
+ result0 = null;
2580
+ pos = pos1;
2581
+ }
2582
+ } else {
2583
+ result0 = null;
2584
+ pos = pos1;
2585
+ }
2586
+ } else {
2587
+ result0 = null;
2588
+ pos = pos1;
2589
+ }
2590
+ if (result0 !== null) {
2591
+ result0 = (function(offset, attrs, cont) { return { type : 'script', attributes: attrs, content: cont} })(pos0, result0[4], result0[7]);
2592
+ }
2593
+ if (result0 === null) {
2594
+ pos = pos0;
2595
+ }
2596
+ reportFailures--;
2597
+ if (reportFailures === 0 && result0 === null) {
2598
+ matchFailed("element <script>");
2599
+ }
2600
+ return result0;
2601
+ }
2602
+
2603
+ function parse_HTMLScriptContentChar() {
2604
+ var result0, result1;
2605
+ var pos0, pos1, pos2;
2606
+
2607
+ pos0 = pos;
2608
+ pos1 = pos;
2609
+ pos2 = pos;
2610
+ reportFailures++;
2611
+ if (input.substr(pos, 9) === "</script>") {
2612
+ result0 = "</script>";
2613
+ pos += 9;
2614
+ } else {
2615
+ result0 = null;
2616
+ if (reportFailures === 0) {
2617
+ matchFailed("\"</script>\"");
2618
+ }
2619
+ }
2620
+ reportFailures--;
2621
+ if (result0 === null) {
2622
+ result0 = "";
2623
+ } else {
2624
+ result0 = null;
2625
+ pos = pos2;
2626
+ }
2627
+ if (result0 !== null) {
2628
+ result1 = parse_char();
2629
+ if (result1 !== null) {
2630
+ result0 = [result0, result1];
2631
+ } else {
2632
+ result0 = null;
2633
+ pos = pos1;
2634
+ }
2635
+ } else {
2636
+ result0 = null;
2637
+ pos = pos1;
2638
+ }
2639
+ if (result0 !== null) {
2640
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
2641
+ }
2642
+ if (result0 === null) {
2643
+ pos = pos0;
2644
+ }
2645
+ return result0;
2646
+ }
2647
+
2648
+ function parse_HTMLScriptContentChars() {
2649
+ var result0, result1;
2650
+ var pos0;
2651
+
2652
+ pos0 = pos;
2653
+ result1 = parse_HTMLScriptContentChar();
2654
+ if (result1 !== null) {
2655
+ result0 = [];
2656
+ while (result1 !== null) {
2657
+ result0.push(result1);
2658
+ result1 = parse_HTMLScriptContentChar();
2659
+ }
2660
+ } else {
2661
+ result0 = null;
2662
+ }
2663
+ if (result0 !== null) {
2664
+ result0 = (function(offset, c) { return c.join(''); })(pos0, result0);
2665
+ }
2666
+ if (result0 === null) {
2667
+ pos = pos0;
2668
+ }
2669
+ return result0;
2670
+ }
2671
+
2672
+ function parse_HTMLStyle() {
2673
+ var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14;
2674
+ var pos0, pos1;
2675
+
2676
+ reportFailures++;
2677
+ pos0 = pos;
2678
+ pos1 = pos;
2679
+ result0 = parse_HTMLElementOpenDelim();
2680
+ if (result0 !== null) {
2681
+ result1 = parse__();
2682
+ if (result1 !== null) {
2683
+ if (input.substr(pos, 5).toLowerCase() === "style") {
2684
+ result2 = input.substr(pos, 5);
2685
+ pos += 5;
2686
+ } else {
2687
+ result2 = null;
2688
+ if (reportFailures === 0) {
2689
+ matchFailed("\"style\"");
2690
+ }
2691
+ }
2692
+ if (result2 !== null) {
2693
+ result3 = parse__();
2694
+ if (result3 !== null) {
2695
+ result4 = [];
2696
+ result5 = parse_HTMLAttribute();
2697
+ while (result5 !== null) {
2698
+ result4.push(result5);
2699
+ result5 = parse_HTMLAttribute();
2700
+ }
2701
+ if (result4 !== null) {
2702
+ result5 = parse__();
2703
+ if (result5 !== null) {
2704
+ result6 = parse_HTMLElementCloseDelim();
2705
+ if (result6 !== null) {
2706
+ result7 = parse_HTMLContentChars();
2707
+ if (result7 !== null) {
2708
+ result8 = parse_HTMLElementOpenDelim();
2709
+ if (result8 !== null) {
2710
+ result9 = parse__();
2711
+ if (result9 !== null) {
2712
+ if (input.charCodeAt(pos) === 47) {
2713
+ result10 = "/";
2714
+ pos++;
2715
+ } else {
2716
+ result10 = null;
2717
+ if (reportFailures === 0) {
2718
+ matchFailed("\"/\"");
2719
+ }
2720
+ }
2721
+ if (result10 !== null) {
2722
+ result11 = parse__();
2723
+ if (result11 !== null) {
2724
+ if (input.substr(pos, 5).toLowerCase() === "style") {
2725
+ result12 = input.substr(pos, 5);
2726
+ pos += 5;
2727
+ } else {
2728
+ result12 = null;
2729
+ if (reportFailures === 0) {
2730
+ matchFailed("\"style\"");
2731
+ }
2732
+ }
2733
+ if (result12 !== null) {
2734
+ result13 = parse__();
2735
+ if (result13 !== null) {
2736
+ result14 = parse_HTMLElementCloseDelim();
2737
+ if (result14 !== null) {
2738
+ result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14];
2739
+ } else {
2740
+ result0 = null;
2741
+ pos = pos1;
2742
+ }
2743
+ } else {
2744
+ result0 = null;
2745
+ pos = pos1;
2746
+ }
2747
+ } else {
2748
+ result0 = null;
2749
+ pos = pos1;
2750
+ }
2751
+ } else {
2752
+ result0 = null;
2753
+ pos = pos1;
2754
+ }
2755
+ } else {
2756
+ result0 = null;
2757
+ pos = pos1;
2758
+ }
2759
+ } else {
2760
+ result0 = null;
2761
+ pos = pos1;
2762
+ }
2763
+ } else {
2764
+ result0 = null;
2765
+ pos = pos1;
2766
+ }
2767
+ } else {
2768
+ result0 = null;
2769
+ pos = pos1;
2770
+ }
2771
+ } else {
2772
+ result0 = null;
2773
+ pos = pos1;
2774
+ }
2775
+ } else {
2776
+ result0 = null;
2777
+ pos = pos1;
2778
+ }
2779
+ } else {
2780
+ result0 = null;
2781
+ pos = pos1;
2782
+ }
2783
+ } else {
2784
+ result0 = null;
2785
+ pos = pos1;
2786
+ }
2787
+ } else {
2788
+ result0 = null;
2789
+ pos = pos1;
2790
+ }
2791
+ } else {
2792
+ result0 = null;
2793
+ pos = pos1;
2794
+ }
2795
+ } else {
2796
+ result0 = null;
2797
+ pos = pos1;
2798
+ }
2799
+ if (result0 !== null) {
2800
+ result0 = (function(offset, attrs, cont) { return { type : 'style', attributes: attrs, content: cont} })(pos0, result0[4], result0[7]);
2801
+ }
2802
+ if (result0 === null) {
2803
+ pos = pos0;
2804
+ }
2805
+ reportFailures--;
2806
+ if (reportFailures === 0 && result0 === null) {
2807
+ matchFailed("element <style>");
2808
+ }
2809
+ return result0;
2810
+ }
2811
+
2812
+ function parse_HTMLText() {
2813
+ var result0, result1;
2814
+ var pos0;
2815
+
2816
+ pos0 = pos;
2817
+ result1 = parse_HTMLContentChar();
2818
+ if (result1 !== null) {
2819
+ result0 = [];
2820
+ while (result1 !== null) {
2821
+ result0.push(result1);
2822
+ result1 = parse_HTMLContentChar();
2823
+ }
2824
+ } else {
2825
+ result0 = null;
2826
+ }
2827
+ if (result0 !== null) {
2828
+ result0 = (function(offset, cont) { return { type: 'text', content: cont.join('') }})(pos0, result0);
2829
+ }
2830
+ if (result0 === null) {
2831
+ pos = pos0;
2832
+ }
2833
+ return result0;
2834
+ }
2835
+
2836
+ function parse_HTMLContentChar() {
2837
+ var result0, result1;
2838
+ var pos0, pos1, pos2;
2839
+
2840
+ pos0 = pos;
2841
+ pos1 = pos;
2842
+ pos2 = pos;
2843
+ reportFailures++;
2844
+ if (input.substr(pos, 2) === "</") {
2845
+ result0 = "</";
2846
+ pos += 2;
2847
+ } else {
2848
+ result0 = null;
2849
+ if (reportFailures === 0) {
2850
+ matchFailed("\"</\"");
2851
+ }
2852
+ }
2853
+ if (result0 === null) {
2854
+ if (input.charCodeAt(pos) === 60) {
2855
+ result0 = "<";
2856
+ pos++;
2857
+ } else {
2858
+ result0 = null;
2859
+ if (reportFailures === 0) {
2860
+ matchFailed("\"<\"");
2861
+ }
2862
+ }
2863
+ }
2864
+ reportFailures--;
2865
+ if (result0 === null) {
2866
+ result0 = "";
2867
+ } else {
2868
+ result0 = null;
2869
+ pos = pos2;
2870
+ }
2871
+ if (result0 !== null) {
2872
+ result1 = parse_char();
2873
+ if (result1 !== null) {
2874
+ result0 = [result0, result1];
2875
+ } else {
2876
+ result0 = null;
2877
+ pos = pos1;
2878
+ }
2879
+ } else {
2880
+ result0 = null;
2881
+ pos = pos1;
2882
+ }
2883
+ if (result0 !== null) {
2884
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
2885
+ }
2886
+ if (result0 === null) {
2887
+ pos = pos0;
2888
+ }
2889
+ return result0;
2890
+ }
2891
+
2892
+ function parse_HTMLContentChars() {
2893
+ var result0, result1;
2894
+ var pos0;
2895
+
2896
+ pos0 = pos;
2897
+ result1 = parse_HTMLContentChar();
2898
+ if (result1 !== null) {
2899
+ result0 = [];
2900
+ while (result1 !== null) {
2901
+ result0.push(result1);
2902
+ result1 = parse_HTMLContentChar();
2903
+ }
2904
+ } else {
2905
+ result0 = null;
2906
+ }
2907
+ if (result0 !== null) {
2908
+ result0 = (function(offset, c) { return c.join(''); })(pos0, result0);
2909
+ }
2910
+ if (result0 === null) {
2911
+ pos = pos0;
2912
+ }
2913
+ return result0;
2914
+ }
2915
+
2916
+ function parse_HTMLTag() {
2917
+ var result0, result1;
2918
+ var pos0;
2919
+
2920
+ pos0 = pos;
2921
+ result1 = parse_HTMLTagChars();
2922
+ if (result1 !== null) {
2923
+ result0 = [];
2924
+ while (result1 !== null) {
2925
+ result0.push(result1);
2926
+ result1 = parse_HTMLTagChars();
2927
+ }
2928
+ } else {
2929
+ result0 = null;
2930
+ }
2931
+ if (result0 !== null) {
2932
+ result0 = (function(offset, chars) { return chars.join(''); })(pos0, result0);
2933
+ }
2934
+ if (result0 === null) {
2935
+ pos = pos0;
2936
+ }
2937
+ return result0;
2938
+ }
2939
+
2940
+ function parse_HTMLTagChars() {
2941
+ var result0;
2942
+
2943
+ if (/^[a-zA-Z0-9\-:_]/.test(input.charAt(pos))) {
2944
+ result0 = input.charAt(pos);
2945
+ pos++;
2946
+ } else {
2947
+ result0 = null;
2948
+ if (reportFailures === 0) {
2949
+ matchFailed("[a-zA-Z0-9\\-:_]");
2950
+ }
2951
+ }
2952
+ return result0;
2953
+ }
2954
+
2955
+ function parse_HTMLNodeChar() {
2956
+ var result0, result1;
2957
+ var pos0, pos1, pos2;
2958
+
2959
+ pos0 = pos;
2960
+ pos1 = pos;
2961
+ pos2 = pos;
2962
+ reportFailures++;
2963
+ if (input.charCodeAt(pos) === 62) {
2964
+ result0 = ">";
2965
+ pos++;
2966
+ } else {
2967
+ result0 = null;
2968
+ if (reportFailures === 0) {
2969
+ matchFailed("\">\"");
2970
+ }
2971
+ }
2972
+ reportFailures--;
2973
+ if (result0 === null) {
2974
+ result0 = "";
2975
+ } else {
2976
+ result0 = null;
2977
+ pos = pos2;
2978
+ }
2979
+ if (result0 !== null) {
2980
+ result1 = parse_char();
2981
+ if (result1 !== null) {
2982
+ result0 = [result0, result1];
2983
+ } else {
2984
+ result0 = null;
2985
+ pos = pos1;
2986
+ }
2987
+ } else {
2988
+ result0 = null;
2989
+ pos = pos1;
2990
+ }
2991
+ if (result0 !== null) {
2992
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
2993
+ }
2994
+ if (result0 === null) {
2995
+ pos = pos0;
2996
+ }
2997
+ return result0;
2998
+ }
2999
+
3000
+ function parse_HTMLNodeChars() {
3001
+ var result0, result1;
3002
+ var pos0;
3003
+
3004
+ pos0 = pos;
3005
+ result1 = parse_HTMLNodeChar();
3006
+ if (result1 !== null) {
3007
+ result0 = [];
3008
+ while (result1 !== null) {
3009
+ result0.push(result1);
3010
+ result1 = parse_HTMLNodeChar();
3011
+ }
3012
+ } else {
3013
+ result0 = null;
3014
+ }
3015
+ if (result0 !== null) {
3016
+ result0 = (function(offset, c) { return c.join(''); })(pos0, result0);
3017
+ }
3018
+ if (result0 === null) {
3019
+ pos = pos0;
3020
+ }
3021
+ return result0;
3022
+ }
3023
+
3024
+ function parse_HTMLValue() {
3025
+ var result0;
3026
+
3027
+ result0 = parse_HTMLValueDoubleQuoted();
3028
+ if (result0 === null) {
3029
+ result0 = parse_HTMLValueQuoted();
3030
+ if (result0 === null) {
3031
+ result0 = parse_HTMLValueNoQuoted();
3032
+ }
3033
+ }
3034
+ return result0;
3035
+ }
3036
+
3037
+ function parse_HTMLValueDoubleQuoted() {
3038
+ var result0, result1, result2, result3;
3039
+ var pos0, pos1;
3040
+
3041
+ pos0 = pos;
3042
+ pos1 = pos;
3043
+ if (input.charCodeAt(pos) === 34) {
3044
+ result0 = "\"";
3045
+ pos++;
3046
+ } else {
3047
+ result0 = null;
3048
+ if (reportFailures === 0) {
3049
+ matchFailed("\"\\\"\"");
3050
+ }
3051
+ }
3052
+ if (result0 !== null) {
3053
+ result1 = parse__();
3054
+ if (result1 !== null) {
3055
+ if (input.charCodeAt(pos) === 34) {
3056
+ result2 = "\"";
3057
+ pos++;
3058
+ } else {
3059
+ result2 = null;
3060
+ if (reportFailures === 0) {
3061
+ matchFailed("\"\\\"\"");
3062
+ }
3063
+ }
3064
+ if (result2 !== null) {
3065
+ result0 = [result0, result1, result2];
3066
+ } else {
3067
+ result0 = null;
3068
+ pos = pos1;
3069
+ }
3070
+ } else {
3071
+ result0 = null;
3072
+ pos = pos1;
3073
+ }
3074
+ } else {
3075
+ result0 = null;
3076
+ pos = pos1;
3077
+ }
3078
+ if (result0 !== null) {
3079
+ result0 = (function(offset) { return ''; })(pos0);
3080
+ }
3081
+ if (result0 === null) {
3082
+ pos = pos0;
3083
+ }
3084
+ if (result0 === null) {
3085
+ pos0 = pos;
3086
+ pos1 = pos;
3087
+ if (input.charCodeAt(pos) === 34) {
3088
+ result0 = "\"";
3089
+ pos++;
3090
+ } else {
3091
+ result0 = null;
3092
+ if (reportFailures === 0) {
3093
+ matchFailed("\"\\\"\"");
3094
+ }
3095
+ }
3096
+ if (result0 !== null) {
3097
+ result2 = parse_HTMLValueDoubleQuotedChar();
3098
+ if (result2 !== null) {
3099
+ result1 = [];
3100
+ while (result2 !== null) {
3101
+ result1.push(result2);
3102
+ result2 = parse_HTMLValueDoubleQuotedChar();
3103
+ }
3104
+ } else {
3105
+ result1 = null;
3106
+ }
3107
+ if (result1 !== null) {
3108
+ if (input.charCodeAt(pos) === 34) {
3109
+ result2 = "\"";
3110
+ pos++;
3111
+ } else {
3112
+ result2 = null;
3113
+ if (reportFailures === 0) {
3114
+ matchFailed("\"\\\"\"");
3115
+ }
3116
+ }
3117
+ if (result2 !== null) {
3118
+ if (input.charCodeAt(pos) === 44) {
3119
+ result3 = ",";
3120
+ pos++;
3121
+ } else {
3122
+ result3 = null;
3123
+ if (reportFailures === 0) {
3124
+ matchFailed("\",\"");
3125
+ }
3126
+ }
3127
+ result3 = result3 !== null ? result3 : "";
3128
+ if (result3 !== null) {
3129
+ result0 = [result0, result1, result2, result3];
3130
+ } else {
3131
+ result0 = null;
3132
+ pos = pos1;
3133
+ }
3134
+ } else {
3135
+ result0 = null;
3136
+ pos = pos1;
3137
+ }
3138
+ } else {
3139
+ result0 = null;
3140
+ pos = pos1;
3141
+ }
3142
+ } else {
3143
+ result0 = null;
3144
+ pos = pos1;
3145
+ }
3146
+ if (result0 !== null) {
3147
+ result0 = (function(offset, chars) { return chars.join(''); })(pos0, result0[1]);
3148
+ }
3149
+ if (result0 === null) {
3150
+ pos = pos0;
3151
+ }
3152
+ }
3153
+ return result0;
3154
+ }
3155
+
3156
+ function parse_HTMLValueDoubleQuotedChar() {
3157
+ var result0, result1;
3158
+ var pos0, pos1, pos2;
3159
+
3160
+ pos0 = pos;
3161
+ pos1 = pos;
3162
+ pos2 = pos;
3163
+ reportFailures++;
3164
+ if (input.charCodeAt(pos) === 34) {
3165
+ result0 = "\"";
3166
+ pos++;
3167
+ } else {
3168
+ result0 = null;
3169
+ if (reportFailures === 0) {
3170
+ matchFailed("\"\\\"\"");
3171
+ }
3172
+ }
3173
+ reportFailures--;
3174
+ if (result0 === null) {
3175
+ result0 = "";
3176
+ } else {
3177
+ result0 = null;
3178
+ pos = pos2;
3179
+ }
3180
+ if (result0 !== null) {
3181
+ result1 = parse_char();
3182
+ if (result1 !== null) {
3183
+ result0 = [result0, result1];
3184
+ } else {
3185
+ result0 = null;
3186
+ pos = pos1;
3187
+ }
3188
+ } else {
3189
+ result0 = null;
3190
+ pos = pos1;
3191
+ }
3192
+ if (result0 !== null) {
3193
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
3194
+ }
3195
+ if (result0 === null) {
3196
+ pos = pos0;
3197
+ }
3198
+ return result0;
3199
+ }
3200
+
3201
+ function parse_HTMLValueQuoted() {
3202
+ var result0, result1, result2, result3;
3203
+ var pos0, pos1;
3204
+
3205
+ pos0 = pos;
3206
+ pos1 = pos;
3207
+ if (input.charCodeAt(pos) === 39) {
3208
+ result0 = "'";
3209
+ pos++;
3210
+ } else {
3211
+ result0 = null;
3212
+ if (reportFailures === 0) {
3213
+ matchFailed("\"'\"");
3214
+ }
3215
+ }
3216
+ if (result0 !== null) {
3217
+ result1 = parse__();
3218
+ if (result1 !== null) {
3219
+ if (input.charCodeAt(pos) === 39) {
3220
+ result2 = "'";
3221
+ pos++;
3222
+ } else {
3223
+ result2 = null;
3224
+ if (reportFailures === 0) {
3225
+ matchFailed("\"'\"");
3226
+ }
3227
+ }
3228
+ if (result2 !== null) {
3229
+ result0 = [result0, result1, result2];
3230
+ } else {
3231
+ result0 = null;
3232
+ pos = pos1;
3233
+ }
3234
+ } else {
3235
+ result0 = null;
3236
+ pos = pos1;
3237
+ }
3238
+ } else {
3239
+ result0 = null;
3240
+ pos = pos1;
3241
+ }
3242
+ if (result0 !== null) {
3243
+ result0 = (function(offset) { return ''; })(pos0);
3244
+ }
3245
+ if (result0 === null) {
3246
+ pos = pos0;
3247
+ }
3248
+ if (result0 === null) {
3249
+ pos0 = pos;
3250
+ pos1 = pos;
3251
+ if (input.charCodeAt(pos) === 39) {
3252
+ result0 = "'";
3253
+ pos++;
3254
+ } else {
3255
+ result0 = null;
3256
+ if (reportFailures === 0) {
3257
+ matchFailed("\"'\"");
3258
+ }
3259
+ }
3260
+ if (result0 !== null) {
3261
+ result2 = parse_HTMLValueQuotedChar();
3262
+ if (result2 !== null) {
3263
+ result1 = [];
3264
+ while (result2 !== null) {
3265
+ result1.push(result2);
3266
+ result2 = parse_HTMLValueQuotedChar();
3267
+ }
3268
+ } else {
3269
+ result1 = null;
3270
+ }
3271
+ if (result1 !== null) {
3272
+ if (input.charCodeAt(pos) === 39) {
3273
+ result2 = "'";
3274
+ pos++;
3275
+ } else {
3276
+ result2 = null;
3277
+ if (reportFailures === 0) {
3278
+ matchFailed("\"'\"");
3279
+ }
3280
+ }
3281
+ if (result2 !== null) {
3282
+ if (input.charCodeAt(pos) === 44) {
3283
+ result3 = ",";
3284
+ pos++;
3285
+ } else {
3286
+ result3 = null;
3287
+ if (reportFailures === 0) {
3288
+ matchFailed("\",\"");
3289
+ }
3290
+ }
3291
+ result3 = result3 !== null ? result3 : "";
3292
+ if (result3 !== null) {
3293
+ result0 = [result0, result1, result2, result3];
3294
+ } else {
3295
+ result0 = null;
3296
+ pos = pos1;
3297
+ }
3298
+ } else {
3299
+ result0 = null;
3300
+ pos = pos1;
3301
+ }
3302
+ } else {
3303
+ result0 = null;
3304
+ pos = pos1;
3305
+ }
3306
+ } else {
3307
+ result0 = null;
3308
+ pos = pos1;
3309
+ }
3310
+ if (result0 !== null) {
3311
+ result0 = (function(offset, chars) { return chars.join(''); })(pos0, result0[1]);
3312
+ }
3313
+ if (result0 === null) {
3314
+ pos = pos0;
3315
+ }
3316
+ }
3317
+ return result0;
3318
+ }
3319
+
3320
+ function parse_HTMLValueQuotedChar() {
3321
+ var result0, result1;
3322
+ var pos0, pos1, pos2;
3323
+
3324
+ pos0 = pos;
3325
+ pos1 = pos;
3326
+ pos2 = pos;
3327
+ reportFailures++;
3328
+ if (input.charCodeAt(pos) === 39) {
3329
+ result0 = "'";
3330
+ pos++;
3331
+ } else {
3332
+ result0 = null;
3333
+ if (reportFailures === 0) {
3334
+ matchFailed("\"'\"");
3335
+ }
3336
+ }
3337
+ reportFailures--;
3338
+ if (result0 === null) {
3339
+ result0 = "";
3340
+ } else {
3341
+ result0 = null;
3342
+ pos = pos2;
3343
+ }
3344
+ if (result0 !== null) {
3345
+ result1 = parse_char();
3346
+ if (result1 !== null) {
3347
+ result0 = [result0, result1];
3348
+ } else {
3349
+ result0 = null;
3350
+ pos = pos1;
3351
+ }
3352
+ } else {
3353
+ result0 = null;
3354
+ pos = pos1;
3355
+ }
3356
+ if (result0 !== null) {
3357
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
3358
+ }
3359
+ if (result0 === null) {
3360
+ pos = pos0;
3361
+ }
3362
+ return result0;
3363
+ }
3364
+
3365
+ function parse_HTMLValueNoQuoted() {
3366
+ var result0, result1;
3367
+ var pos0;
3368
+
3369
+ pos0 = pos;
3370
+ result1 = parse_HTMLValueNoQuotedChar();
3371
+ if (result1 !== null) {
3372
+ result0 = [];
3373
+ while (result1 !== null) {
3374
+ result0.push(result1);
3375
+ result1 = parse_HTMLValueNoQuotedChar();
3376
+ }
3377
+ } else {
3378
+ result0 = null;
3379
+ }
3380
+ if (result0 !== null) {
3381
+ result0 = (function(offset, chars) { return chars.join(''); })(pos0, result0);
3382
+ }
3383
+ if (result0 === null) {
3384
+ pos = pos0;
3385
+ }
3386
+ return result0;
3387
+ }
3388
+
3389
+ function parse_HTMLValueNoQuotedChar() {
3390
+ var result0, result1;
3391
+ var pos0, pos1, pos2;
3392
+
3393
+ pos0 = pos;
3394
+ pos1 = pos;
3395
+ pos2 = pos;
3396
+ reportFailures++;
3397
+ if (input.charCodeAt(pos) === 62) {
3398
+ result0 = ">";
3399
+ pos++;
3400
+ } else {
3401
+ result0 = null;
3402
+ if (reportFailures === 0) {
3403
+ matchFailed("\">\"");
3404
+ }
3405
+ }
3406
+ if (result0 === null) {
3407
+ result0 = parse_whitespace();
3408
+ }
3409
+ reportFailures--;
3410
+ if (result0 === null) {
3411
+ result0 = "";
3412
+ } else {
3413
+ result0 = null;
3414
+ pos = pos2;
3415
+ }
3416
+ if (result0 !== null) {
3417
+ result1 = parse_char();
3418
+ if (result1 !== null) {
3419
+ result0 = [result0, result1];
3420
+ } else {
3421
+ result0 = null;
3422
+ pos = pos1;
3423
+ }
3424
+ } else {
3425
+ result0 = null;
3426
+ pos = pos1;
3427
+ }
3428
+ if (result0 !== null) {
3429
+ result0 = (function(offset, c) { return c; })(pos0, result0[1]);
3430
+ }
3431
+ if (result0 === null) {
3432
+ pos = pos0;
3433
+ }
3434
+ return result0;
3435
+ }
3436
+
3437
+ function parse__() {
3438
+ var result0, result1;
3439
+
3440
+ reportFailures++;
3441
+ result0 = [];
3442
+ result1 = parse_whitespace();
3443
+ while (result1 !== null) {
3444
+ result0.push(result1);
3445
+ result1 = parse_whitespace();
3446
+ }
3447
+ reportFailures--;
3448
+ if (reportFailures === 0 && result0 === null) {
3449
+ matchFailed("whitespaces");
3450
+ }
3451
+ return result0;
3452
+ }
3453
+
3454
+ function parse_whitespace() {
3455
+ var result0;
3456
+
3457
+ if (/^[ \t\n\r]/.test(input.charAt(pos))) {
3458
+ result0 = input.charAt(pos);
3459
+ pos++;
3460
+ } else {
3461
+ result0 = null;
3462
+ if (reportFailures === 0) {
3463
+ matchFailed("[ \\t\\n\\r]");
3464
+ }
3465
+ }
3466
+ return result0;
3467
+ }
3468
+
3469
+ function parse_hexDigit() {
3470
+ var result0;
3471
+
3472
+ if (/^[0-9a-fA-F]/.test(input.charAt(pos))) {
3473
+ result0 = input.charAt(pos);
3474
+ pos++;
3475
+ } else {
3476
+ result0 = null;
3477
+ if (reportFailures === 0) {
3478
+ matchFailed("[0-9a-fA-F]");
3479
+ }
3480
+ }
3481
+ return result0;
3482
+ }
3483
+
3484
+ function parse_char() {
3485
+ var result0, result1, result2, result3, result4;
3486
+ var pos0, pos1;
3487
+
3488
+ reportFailures++;
3489
+ pos0 = pos;
3490
+ pos1 = pos;
3491
+ if (input.substr(pos, 2) === "\\u") {
3492
+ result0 = "\\u";
3493
+ pos += 2;
3494
+ } else {
3495
+ result0 = null;
3496
+ if (reportFailures === 0) {
3497
+ matchFailed("\"\\\\u\"");
3498
+ }
3499
+ }
3500
+ if (result0 !== null) {
3501
+ result1 = parse_hexDigit();
3502
+ if (result1 !== null) {
3503
+ result2 = parse_hexDigit();
3504
+ if (result2 !== null) {
3505
+ result3 = parse_hexDigit();
3506
+ if (result3 !== null) {
3507
+ result4 = parse_hexDigit();
3508
+ if (result4 !== null) {
3509
+ result0 = [result0, result1, result2, result3, result4];
3510
+ } else {
3511
+ result0 = null;
3512
+ pos = pos1;
3513
+ }
3514
+ } else {
3515
+ result0 = null;
3516
+ pos = pos1;
3517
+ }
3518
+ } else {
3519
+ result0 = null;
3520
+ pos = pos1;
3521
+ }
3522
+ } else {
3523
+ result0 = null;
3524
+ pos = pos1;
3525
+ }
3526
+ } else {
3527
+ result0 = null;
3528
+ pos = pos1;
3529
+ }
3530
+ if (result0 !== null) {
3531
+ result0 = (function(offset, h1, h2, h3, h4) {
3532
+ return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4));
3533
+ })(pos0, result0[1], result0[2], result0[3], result0[4]);
3534
+ }
3535
+ if (result0 === null) {
3536
+ pos = pos0;
3537
+ }
3538
+ if (result0 === null) {
3539
+ if (/^[!-~\x80-\xFF]/.test(input.charAt(pos))) {
3540
+ result0 = input.charAt(pos);
3541
+ pos++;
3542
+ } else {
3543
+ result0 = null;
3544
+ if (reportFailures === 0) {
3545
+ matchFailed("[!-~\\x80-\\xFF]");
3546
+ }
3547
+ }
3548
+ if (result0 === null) {
3549
+ result0 = parse_whitespace();
3550
+ }
3551
+ }
3552
+ reportFailures--;
3553
+ if (reportFailures === 0 && result0 === null) {
3554
+ matchFailed("character");
3555
+ }
3556
+ return result0;
3557
+ }
3558
+
3559
+
3560
+ function cleanupExpected(expected) {
3561
+ expected.sort();
3562
+
3563
+ var lastExpected = null;
3564
+ var cleanExpected = [];
3565
+ for (var i = 0; i < expected.length; i++) {
3566
+ if (expected[i] !== lastExpected) {
3567
+ cleanExpected.push(expected[i]);
3568
+ lastExpected = expected[i];
3569
+ }
3570
+ }
3571
+ return cleanExpected;
3572
+ }
3573
+
3574
+ function computeErrorPosition() {
3575
+ /*
3576
+ * The first idea was to use |String.split| to break the input up to the
3577
+ * error position along newlines and derive the line and column from
3578
+ * there. However IE's |split| implementation is so broken that it was
3579
+ * enough to prevent it.
3580
+ */
3581
+
3582
+ var line = 1;
3583
+ var column = 1;
3584
+ var seenCR = false;
3585
+
3586
+ for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) {
3587
+ var ch = input.charAt(i);
3588
+ if (ch === "\n") {
3589
+ if (!seenCR) { line++; }
3590
+ column = 1;
3591
+ seenCR = false;
3592
+ } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
3593
+ line++;
3594
+ column = 1;
3595
+ seenCR = true;
3596
+ } else {
3597
+ column++;
3598
+ seenCR = false;
3599
+ }
3600
+ }
3601
+
3602
+ return { line: line, column: column };
3603
+ }
3604
+
3605
+
3606
+ var result = parseFunctions[startRule]();
3607
+
3608
+ /*
3609
+ * The parser is now in one of the following three states:
3610
+ *
3611
+ * 1. The parser successfully parsed the whole input.
3612
+ *
3613
+ * - |result !== null|
3614
+ * - |pos === input.length|
3615
+ * - |rightmostFailuresExpected| may or may not contain something
3616
+ *
3617
+ * 2. The parser successfully parsed only a part of the input.
3618
+ *
3619
+ * - |result !== null|
3620
+ * - |pos < input.length|
3621
+ * - |rightmostFailuresExpected| may or may not contain something
3622
+ *
3623
+ * 3. The parser did not successfully parse any part of the input.
3624
+ *
3625
+ * - |result === null|
3626
+ * - |pos === 0|
3627
+ * - |rightmostFailuresExpected| contains at least one failure
3628
+ *
3629
+ * All code following this comment (including called functions) must
3630
+ * handle these states.
3631
+ */
3632
+ if (result === null || pos !== input.length) {
3633
+ var offset = Math.max(pos, rightmostFailuresPos);
3634
+ var found = offset < input.length ? input.charAt(offset) : null;
3635
+ var errorPosition = computeErrorPosition();
3636
+
3637
+ throw new this.SyntaxError(
3638
+ cleanupExpected(rightmostFailuresExpected),
3639
+ found,
3640
+ offset,
3641
+ errorPosition.line,
3642
+ errorPosition.column
3643
+ );
3644
+ }
3645
+
3646
+ return result;
3647
+ },
3648
+
3649
+ /* Returns the parser source code. */
3650
+ toSource: function() { return this._source; }
3651
+ };
3652
+
3653
+ /* Thrown when a parser encounters a syntax error. */
3654
+
3655
+ result.SyntaxError = function(expected, found, offset, line, column) {
3656
+ function buildMessage(expected, found) {
3657
+ var expectedHumanized, foundHumanized;
3658
+
3659
+ switch (expected.length) {
3660
+ case 0:
3661
+ expectedHumanized = "end of input";
3662
+ break;
3663
+ case 1:
3664
+ expectedHumanized = expected[0];
3665
+ break;
3666
+ default:
3667
+ expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
3668
+ + " or "
3669
+ + expected[expected.length - 1];
3670
+ }
3671
+
3672
+ foundHumanized = found ? quote(found) : "end of input";
3673
+
3674
+ return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
3675
+ }
3676
+
3677
+ this.name = "SyntaxError";
3678
+ this.expected = expected;
3679
+ this.found = found;
3680
+ this.message = buildMessage(expected, found);
3681
+ this.offset = offset;
3682
+ this.line = line;
3683
+ this.column = column;
3684
+ };
3685
+
3686
+ result.SyntaxError.prototype = Error.prototype;
3687
+
3688
+ return result;
3689
+ })();
3690
+
3691
+ },
3692
+ 'coffee-script': function(module, require, exports) {
3693
+ if (typeof CoffeeScript !== 'undefined' && CoffeeScript != null) {
3694
+ module.exports = CoffeeScript;
3695
+ } else {
3696
+ throw 'Cannot require \'' + module.id + '\': CoffeeScript not found';
3697
+ }
3698
+ }
3699
+ })('cft');