ccgjs
Version:
A combinatory categorial grammar (CCG) library for the web.
3 lines (2 loc) • 17.4 kB
JavaScript
;function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function a(t,e,o){return(a=n()?Reflect.construct:function(t,e,n){var a=[null];a.push.apply(a,e);var o=new(Function.bind.apply(t,a));return n&&r(o,n.prototype),o}).apply(null,arguments)}function o(t){var n="function"==typeof Map?new Map:void 0;return(o=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,o)}function o(){return a(t,arguments,e(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,t)})(t)}Object.defineProperty(exports,"__esModule",{value:!0});var i,c=function(t){var e,r;function n(e,r,a,o){var i;return(i=t.call(this)||this).message=e,i.expected=r,i.found=a,i.location=o,i.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i),n),i}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,n.buildMessage=function(t,e){function r(t){return t.charCodeAt(0).toString(16).toUpperCase()}function n(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+r(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+r(t)}))}function a(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+r(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+r(t)}))}function o(t){switch(t.type){case"literal":return'"'+n(t.text)+'"';case"class":var e=t.parts.map((function(t){return Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t)}));return"["+(t.inverted?"^":"")+e+"]";case"any":return"any character";case"end":return"end of input";case"other":return t.description}}return"Expected "+function(t){var e,r,n=t.map(o);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(t)+" but "+((i=e)?'"'+n(i)+'"':"end of input")+" found.";var i},n}(o(Error));!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(i||(i={}));var u=function(){function e(t){void 0===t&&(t=""),this.isSucceed=!1,this.original=t}return e.prototype.read=function(){var e;try{e=function(e,r){r=void 0!==r?r:{};var n,a,o,i,u,s,l,d,h={},f={Start:et},p=et,g=V("(",!1),v=V(")",!1),m=V("<",!1),A=V("T",!1),C=V(">",!1),x=V("0",!1),y=V("1",!1),P=function(){return t=Q(),parseInt(t,10);var t},b=V("2",!1),w=V("L",!1),T=V("/",!1),E=V("\\",!1),S=function(){return Q()},_=/^[A-Za-z]/,O=X([["A","Z"],["a","z"]],!1,!1),j=V("[",!1),N=/^[A-Za-z,]/,R=X([["A","Z"],["a","z"],","],!1,!1),U=V("]",!1),B=/^[A-Z]/,D=X([["A","Z"]],!1,!1),F=/^[A-Za-z0-9]/,L=X([["A","Z"],["a","z"],["0","9"]],!1,!1),M=Y("whitespace"),Z=/^[ \t\n\r]/,z=X([" ","\t","\n","\r"],!1,!1),I=Y("whitespaces"),k=0,G=0,W=[{line:1,column:1}],H=0,q=[],J=0,K={};if(void 0!==r.startRule){if(!(r.startRule in f))throw new Error("Can't start parsing from rule \""+r.startRule+'".');p=f[r.startRule]}function Q(){return e.substring(G,k)}function V(t,e){return{type:"literal",text:t,ignoreCase:e}}function X(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function Y(t){return{type:"other",description:t}}function $(t){var r,n=W[t];if(n)return n;for(r=t-1;!W[r];)r--;for(n={line:(n=W[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return W[t]=n,n}function tt(t){k<H||(k>H&&(H=k,q=[]),q.push(t))}function et(){var r,n=15*k+0,a=K[n];return a?(k=a.nextPos,a.result):(r=function r(){var n,a,o,i,c,u,s,l,d,f=15*k+1,p=K[f];return p?(k=p.nextPos,p.result):(n=k,ut()!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=rt())!==h&&(i=r())!==h&&(c=r())!==h?(41===e.charCodeAt(k)?(u=")",k++):(u=h,0===J&&tt(v)),u!==h&&(s=ut())!==h?(G=n,n={node:o,left:i,right:c}):(k=n,n=h)):(k=n,n=h)):(k=n,n=h),n===h&&(n=k,ut()!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=rt())!==h&&(i=r())!==h?(40===e.charCodeAt(k)?(c="(",k++):(c=h,0===J&&tt(g)),c!==h&&(u=nt())!==h?(41===e.charCodeAt(k)?(s=")",k++):(s=h,0===J&&tt(v)),s!==h&&(l=ut())!==h?(41===e.charCodeAt(k)?(d=")",k++):(d=h,0===J&&tt(v)),d!==h&&ut()!==h?(G=n,n=function(t,e,r){return{node:t,left:e,right:{node:r}}}(o,i,u)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h),n===h&&(n=k,ut()!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=rt())!==h?(40===e.charCodeAt(k)?(i="(",k++):(i=h,0===J&&tt(g)),i!==h&&(c=nt())!==h?(41===e.charCodeAt(k)?(u=")",k++):(u=h,0===J&&tt(v)),u!==h&&(s=r())!==h?(41===e.charCodeAt(k)?(l=")",k++):(l=h,0===J&&tt(v)),l!==h&&(d=ut())!==h?(G=n,n=function(t,e,r){return{node:t,left:{node:e},right:r}}(o,c,s)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h),n===h&&(n=k,ut()!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=rt())!==h&&(i=r())!==h?(41===e.charCodeAt(k)?(c=")",k++):(c=h,0===J&&tt(v)),c!==h&&(u=ut())!==h?(G=n,n=function(t,e){return{node:t,left:e}}(o,i)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h),n===h&&(n=k,ut()!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=rt())!==h&&(i=function(){var t,r,n,a,o,i,c,u=15*k+2,s=K[u];return s?(k=s.nextPos,s.result):(t=k,ut()!==h?(40===e.charCodeAt(k)?(r="(",k++):(r=h,0===J&&tt(g)),r!==h&&(n=nt())!==h?(41===e.charCodeAt(k)?(a=")",k++):(a=h,0===J&&tt(v)),a!==h&&ut()!==h?(40===e.charCodeAt(k)?(o="(",k++):(o=h,0===J&&tt(g)),o!==h&&(i=nt())!==h?(41===e.charCodeAt(k)?(c=")",k++):(c=h,0===J&&tt(v)),c!==h&&ut()!==h?(G=t,t={left:{node:n},right:{node:i}}):(k=t,t=h)):(k=t,t=h)):(k=t,t=h)):(k=t,t=h)):(k=t,t=h),t===h&&(t=k,ut()!==h?(40===e.charCodeAt(k)?(r="(",k++):(r=h,0===J&&tt(g)),r!==h&&(n=nt())!==h?(41===e.charCodeAt(k)?(a=")",k++):(a=h,0===J&&tt(v)),a!==h&&ut()!==h?(G=t,t={left:{node:n}}):(k=t,t=h)):(k=t,t=h)):(k=t,t=h)),K[u]={nextPos:k,result:t},t)}())!==h?(41===e.charCodeAt(k)?(c=")",k++):(c=h,0===J&&tt(v)),c!==h&&(u=ut())!==h?(G=n,n=function(e,r){return t({node:e},r)}(o,i)):(k=n,n=h)):(k=n,n=h)):(k=n,n=h))))),K[f]={nextPos:k,result:n},n)}(),K[n]={nextPos:k,result:r},r)}function rt(){var t,r,n,a,o,i,c,u=15*k+3,s=K[u];return s?(k=s.nextPos,s.result):(t=k,ut()!==h?(60===e.charCodeAt(k)?(r="<",k++):(r=h,0===J&&tt(m)),r!==h&&ut()!==h?(84===e.charCodeAt(k)?(n="T",k++):(n=h,0===J&&tt(A)),n!==h&&ct()!==h&&(a=at())!==h&&ct()!==h&&(o=function(){var t,r,n=15*k+4,a=K[n];return a?(k=a.nextPos,a.result):(t=k,48===e.charCodeAt(k)?(r="0",k++):(r=h,0===J&&tt(x)),r===h&&(49===e.charCodeAt(k)?(r="1",k++):(r=h,0===J&&tt(y))),r!==h&&(G=t,r=P()),K[n]={nextPos:k,result:t=r},t)}())!==h&&ct()!==h&&(i=function(){var t,r,n=15*k+5,a=K[n];return a?(k=a.nextPos,a.result):(t=k,48===e.charCodeAt(k)?(r="0",k++):(r=h,0===J&&tt(x)),r===h&&(49===e.charCodeAt(k)?(r="1",k++):(r=h,0===J&&tt(y)),r===h&&(50===e.charCodeAt(k)?(r="2",k++):(r=h,0===J&&tt(b)))),r!==h&&(G=t,r=P()),K[n]={nextPos:k,result:t=r},t)}())!==h&&ut()!==h?(62===e.charCodeAt(k)?(c=">",k++):(c=h,0===J&&tt(C)),c!==h&&ut()!==h?(G=t,t={type:"T",ccgCat:a,head:o,dtrs:i}):(k=t,t=h)):(k=t,t=h)):(k=t,t=h)):(k=t,t=h),K[u]={nextPos:k,result:t},t)}function nt(){var t,r,n,a,o,i,c,u,s,l=15*k+6,d=K[l];return d?(k=d.nextPos,d.result):(t=k,ut()!==h?(60===e.charCodeAt(k)?(r="<",k++):(r=h,0===J&&tt(m)),r!==h&&ut()!==h?(76===e.charCodeAt(k)?(n="L",k++):(n=h,0===J&&tt(w)),n!==h&&ct()!==h&&(a=at())!==h&&ct()!==h&&(o=it())!==h&&ct()!==h&&(i=it())!==h&&ct()!==h&&(c=function(){var t,r,n,a=15*k+12,o=K[a];if(o)return k=o.nextPos,o.result;if(t=k,r=[],F.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(L)),n!==h)for(;n!==h;)r.push(n),F.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(L));else r=h;return r!==h&&(G=t,r=S()),K[a]={nextPos:k,result:t=r},t}())!==h&&ct()!==h&&(u=at())!==h&&ut()!==h?(62===e.charCodeAt(k)?(s=">",k++):(s=h,0===J&&tt(C)),s!==h&&ut()!==h?(G=t,t={type:"L",ccgCat:a,modPOSTag:o,origPOSTag:i,word:c,predArgCat:u}):(k=t,t=h)):(k=t,t=h)):(k=t,t=h)):(k=t,t=h),K[l]={nextPos:k,result:t},t)}function at(){var t,r,n,a,o,i,c=15*k+7,u=K[c];return u?(k=u.nextPos,u.result):(t=k,r=k,40===e.charCodeAt(k)?(n="(",k++):(n=h,0===J&&tt(g)),n!==h&&(a=at())!==h?(41===e.charCodeAt(k)?(o=")",k++):(o=h,0===J&&tt(v)),o!==h&&(i=function(){var t,r,n,a=15*k+9,o=K[a];return o?(k=o.nextPos,o.result):(t=k,47===e.charCodeAt(k)?(r="/",k++):(r=h,0===J&&tt(T)),r!==h&&(n=ot())!==h?t=r=[r,n]:(k=t,t=h),t===h&&(t=k,92===e.charCodeAt(k)?(r="\\",k++):(r=h,0===J&&tt(E)),r!==h&&(n=ot())!==h?t=r=[r,n]:(k=t,t=h)),K[a]={nextPos:k,result:t},t)}())!==h?r=n=[n,a,o,i]:(k=r,r=h)):(k=r,r=h),r===h&&(r=k,(n=function(){var t,r,n,a=15*k+8,o=K[a];return o?(k=o.nextPos,o.result):(t=k,(r=ot())!==h?(47===e.charCodeAt(k)?(n="/",k++):(n=h,0===J&&tt(T)),n!==h?t=r=[r,n]:(k=t,t=h)):(k=t,t=h),t===h&&(t=k,(r=ot())!==h?(92===e.charCodeAt(k)?(n="\\",k++):(n=h,0===J&&tt(E)),n!==h?t=r=[r,n]:(k=t,t=h)):(k=t,t=h)),K[a]={nextPos:k,result:t},t)}())!==h?(40===e.charCodeAt(k)?(a="(",k++):(a=h,0===J&&tt(g)),a!==h&&(o=at())!==h?(41===e.charCodeAt(k)?(i=")",k++):(i=h,0===J&&tt(v)),i!==h?r=n=[n,a,o,i]:(k=r,r=h)):(k=r,r=h)):(k=r,r=h),r===h&&(r=k,40===e.charCodeAt(k)?(n="(",k++):(n=h,0===J&&tt(g)),n!==h&&(a=at())!==h?(41===e.charCodeAt(k)?(o=")",k++):(o=h,0===J&&tt(v)),o!==h?r=n=[n,a,o]:(k=r,r=h)):(k=r,r=h),r===h&&(r=k,(n=ot())!==h?(47===e.charCodeAt(k)?(a="/",k++):(a=h,0===J&&tt(T)),a!==h&&(o=ot())!==h?r=n=[n,a,o]:(k=r,r=h)):(k=r,r=h),r===h&&(r=k,(n=ot())!==h?(92===e.charCodeAt(k)?(a="\\",k++):(a=h,0===J&&tt(E)),a!==h&&(o=ot())!==h?r=n=[n,a,o]:(k=r,r=h)):(k=r,r=h),r===h&&(r=ot()))))),r!==h&&(G=t,r=S()),K[c]={nextPos:k,result:t=r},t)}function ot(){var t,r,n,a,o,i=15*k+10,c=K[i];if(c)return k=c.nextPos,c.result;if(t=k,r=[],_.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(O)),n!==h)for(;n!==h;)r.push(n),_.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(O));else r=h;if(r!==h)if(91===e.charCodeAt(k)?(n="[",k++):(n=h,0===J&&tt(j)),n!==h){if(a=[],N.test(e.charAt(k))?(o=e.charAt(k),k++):(o=h,0===J&&tt(R)),o!==h)for(;o!==h;)a.push(o),N.test(e.charAt(k))?(o=e.charAt(k),k++):(o=h,0===J&&tt(R));else a=h;a!==h?(93===e.charCodeAt(k)?(o="]",k++):(o=h,0===J&&tt(U)),o!==h?t=r=[r,n,a,o]:(k=t,t=h)):(k=t,t=h)}else k=t,t=h;else k=t,t=h;if(t===h)if(t=[],_.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(O)),r!==h)for(;r!==h;)t.push(r),_.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(O));else t=h;return K[i]={nextPos:k,result:t},t}function it(){var t,r,n,a=15*k+11,o=K[a];if(o)return k=o.nextPos,o.result;if(t=k,r=[],B.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(D)),n!==h)for(;n!==h;)r.push(n),B.test(e.charAt(k))?(n=e.charAt(k),k++):(n=h,0===J&&tt(D));else r=h;return r!==h&&(G=t,r=S()),K[a]={nextPos:k,result:t=r},t}function ct(){var t,r,n=15*k+13,a=K[n];if(a)return k=a.nextPos,a.result;if(J++,t=[],Z.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(z)),r!==h)for(;r!==h;)t.push(r),Z.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(z));else t=h;return J--,t===h&&(r=h,0===J&&tt(M)),K[n]={nextPos:k,result:t},t}function ut(){var t,r,n=15*k+14,a=K[n];if(a)return k=a.nextPos,a.result;for(J++,t=[],Z.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(z));r!==h;)t.push(r),Z.test(e.charAt(k))?(r=e.charAt(k),k++):(r=h,0===J&&tt(z));return J--,t===h&&(r=h,0===J&&tt(I)),K[n]={nextPos:k,result:t},t}if((n=p())!==h&&k===e.length)return n;throw n!==h&&k<e.length&&tt({type:"end"}),a=q,o=H<e.length?e.charAt(H):null,s=H<e.length?H+1:H,l=$(u=H),d=$(s),i={start:{offset:u,line:l.line,column:l.column},end:{offset:s,line:d.line,column:d.column}},new c(c.buildMessage(a,o),a,o,i)}(this.original)}catch(t){return!1}return this.result=e,this.isSucceed=!0,e},e}(),s={__proto__:null,get DependencyHead(){return i},default:u},l=function(){function t(t){void 0===t&&(t=""),t.length>0&&(this.metadata={isParsed:!1,sentence:"",words:[],ccgCats:[],height:0,nodes:[]},this.constructTree(t))}var e=t.prototype;return e.traverse=function(t){return t(this.root)},e.toString=function(t){return this.root?(this.stringBuilder="",this.toStringUtil(this.root,0,t),this.stringBuilder.substring(1)):""},e.buildDerivations=function(){if(!this.root)return[];this.metadata.derivations=[];for(var t=0;t<this.metadata.height;t++)this.metadata.derivations.push([]);return this.buildDerivUtil(this.root),this.metadata.derivations},e.constructTree=function(t){var e=new u(t);e.read()&&(this.buildTree(e.result),this.metadata.isParsed=!0)},e.buildTree=function(t){this.buildTreeUtil(t,1)},e.buildTreeUtil=function(t,e,r,n){var a,o,i,c={value:t.node};void 0===this.root&&(this.mappedIndexedWords={},this.root=c);var u=null==(a=this.metadata)?void 0:a.nodes.length;if(c.value.nIndex=u,null==(o=this.metadata)||o.nodes.push(c),this.isNodeL(c)){var s,l=c.value,d=this.metadata.words.length;l.wIndex=d,this.metadata.words.push(l.word),this.metadata.ccgCats.push(l.ccgCat),this.mappedIndexedWords[d]=c,""===(null==(s=this.metadata)?void 0:s.sentence)?this.metadata.sentence=l.word:this.metadata.sentence+=" "+l.word}this.metadata.height=Math.max(null==(i=this.metadata)?void 0:i.height,e),"left"===n&&(r.left=c),"right"===n&&(r.right=c),t.left&&this.buildTreeUtil(t.left,e+1,c,"left"),t.right&&this.buildTreeUtil(t.right,e+1,c,"right")},e.toStringUtil=function(t,e,r){if(this.stringBuilder+=(null==r?void 0:r.pretty)?"\n"+" ".repeat(2*e)+"(":" (",this.isNodeT(t)){var n=t.value;this.stringBuilder+=["<T",""+n.ccgCat,""+n.head,n.dtrs+">"].join(" ")}else if(this.isNodeL(t)){var a=t.value;this.stringBuilder+=["<L",""+a.ccgCat,""+a.modPOSTag,""+a.origPOSTag,""+a.word,a.predArgCat+">"].join(" ")}else this.stringBuilder+="<ill-formed CCG Node>";t.left&&this.toStringUtil(t.left,e+1,r),t.right&&this.toStringUtil(t.right,e+1,r),this.stringBuilder+=")"},e.isNodeT=function(t){return void 0!==t.value.head},e.isNodeL=function(t){return void 0!==t.value.word},e.buildDerivUtil=function(t,e){var r,n;if(this.isNodeL(t)){var a=t.value,o=a.wIndex;return this.metadata.derivations[0].push({from:o,to:o,ccgCat:a.ccgCat}),"left"===e?[o,-1,1]:[-1,o,1]}var i=this.buildDerivUtil(t.left,"left"),c=[null,null,null];t.right&&(c=this.buildDerivUtil(t.right,"right"));var u={from:i[0],to:null!=(r=c[1])?r:i[0],ccgCat:t.value.ccgCat,opr:0!==t.value.head?"<":">"},s=Math.max(i[2],null!=(n=c[2])?n:-1);return this.metadata.derivations[s].push(u),[u.from,u.to,s+1]},t}(),d={__proto__:null,default:l},h={DOM:function(){function t(t){var e;"string"==typeof t?t.length>0&&(this.tree=new l(t)):this.tree=t,null==(e=this.tree)||e.buildDerivations()}var e=t.prototype;return e.create=function(t){return t?t(this.tree):this.createTable()},e.createTable=function(){var t,e,r,n,a,o,i,c=this,u=document.createElement("table");u.className="ccgjs",this.domBuilder=u;var s=this.tree.metadata.words.length,l=document.createElement("tr");return null==(t=this.tree)||null==(e=t.metadata)||e.words.forEach((function(t){var e=document.createElement("td"),r=document.createTextNode(t);e.appendChild(r),l.appendChild(e);var n=document.createElement("td");n.className="ccgjs-operation",l.appendChild(n)})),l.className="ccgjs-words",this.domBuilder.appendChild(l),null==(r=this.tree)||null==(n=r.metadata)||null==(a=n.derivations)||a.forEach((function(t){var e,r,n=document.createElement("tr");if(n.className="ccgjs-derivation",o=0,(i=document.createElement("tr")).className="ccgjs-ruler",t.forEach((function(t){var e,r=t.from,a=t.to,c=r-o;if(c>1){var u=document.createElement("td");u.colSpan=2*c,n.appendChild(u);var s=document.createElement("td");s.colSpan=2*c,i.appendChild(s)}var l=document.createElement("td"),d=document.createTextNode(t.ccgCat);l.appendChild(d);var h=document.createElement("hr"),f=document.createElement("td");f.appendChild(h);var p=document.createElement("td");p.className="ccgjs-operation";var g=document.createTextNode(null!=(e=t.opr)?e:"");p.appendChild(g);var v=document.createElement("td");if(v.className="ccgjs-operation",a-r>0){var m=2*(a-r+1)-1;l.colSpan=m,f.colSpan=m}i.appendChild(f),i.appendChild(p),n.appendChild(l),n.appendChild(v),o=a})),o+1<s){var a=2*(s-(o+1)),u=document.createElement("td");u.colSpan=a,n.appendChild(u);var l=document.createElement("td");l.colSpan=a,i.appendChild(l)}null==(e=c.domBuilder)||e.appendChild(i),null==(r=c.domBuilder)||r.appendChild(n)})),this.domBuilder},t}(),Reader:u,ReaderTypes:s,Tree:l,TreeTypes:d};exports.CCG=h,exports.default=h;
//# sourceMappingURL=ccgjs.cjs.production.min.js.map