UNPKG

jscc-parser

Version:

A LALR(1) Parser Generator for JavaScript written in JavaScript.

91 lines 71.3 kB
/* almond 0.3.2 Copyright jQuery Foundation and other contributors. Released under MIT license, http://github.com/requirejs/almond/LICENSE */ var k=this.jscc={};k.enums={};k.classes={};k.Wa=k.enums;k.classes=k.classes;var n={NONE:0,Aa:1,Pa:2,Ca:3},z={za:0,EPSILON:1,da:2},K={Xb:0,Zb:1},L={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,FATAL:5};k.Wa.LOG_LEVEL=L;var M={Yb:0,Oa:1,kb:2},N={NONE:0,ya:1,Qa:2,ERROR:3},O={I:0,A:1};(function(a){"function"!==typeof a.setTimeout&&(a.setTimeout=function(a){"function"===typeof a&&a();return 0})})(this);var P,Q,R; (function(a){function c(b,a){var p,e,d,h,c,m,f,t,g=a&&a.split("/"),G=r.map,l=G&&G["*"]||{};if(b){a=b.split("/");b=a.length-1;r.wc&&A.test(a[b])&&(a[b]=a[b].replace(A,""));"."===a[0].charAt(0)&&g&&(b=g.slice(0,g.length-1),a=b.concat(a));for(f=0;f<a.length;f++)b=a[f],"."===b?(a.splice(f,1),--f):".."===b&&(1!==f||".."!==a[2])&&".."!==a[f-1]&&0<f&&(a.splice(f-1,2),f-=2);b=a.join("/")}if((g||l)&&G){a=b.split("/");for(f=a.length;0<f;--f){p=a.slice(0,f).join("/");if(g)for(t=g.length;0<t;--t)if(e=G[g.slice(0, t).join("/")])if(e=e[p]){d=e;h=f;break}if(d)break;!c&&l&&l[p]&&(c=l[p],m=f)}!d&&c&&(d=c,h=m);d&&(a.splice(0,h,d),b=a.join("/"))}return b}function b(b,p){return function(){var e=B.call(arguments,0);"string"!==typeof e[0]&&1===e.length&&e.push(null);return g.apply(a,e.concat([b,p]))}}function d(b){return function(a){return c(a,b)}}function h(b){return function(a){p[b]=a}}function f(b){if(y.call(t,b)){var e=t[b];delete t[b];u[b]=!0;m.apply(a,e)}if(!y.call(p,b)&&!y.call(u,b))throw Error("No "+b);return p[b]} function l(b){var a,e=b?b.indexOf("!"):-1;-1<e&&(a=b.substring(0,e),b=b.substring(e+1,b.length));return[a,b]}function e(b){return function(){return r&&r.oa&&r.oa[b]||{}}}var m,g,w,q,p={},t={},r={},u={},y=Object.prototype.hasOwnProperty,B=[].slice,A=/\.js$/;w=function(b,a){var e;b=l(b);var p=b[0];b=b[1];p&&(p=c(p,a),e=f(p));p?b=e&&e.normalize?e.normalize(b,d(a)):c(b,a):(b=c(b,a),b=l(b),p=b[0],b=b[1],p&&(e=f(p)));return{Ya:p?p+"!"+b:b,n:b,zc:p,p:e}};q={Nb:function(a){return b(a)},exports:function(b){var a= p[b];return"undefined"!==typeof a?a:p[b]={}},module:function(b){return{id:b,uri:"",exports:p[b],oa:e(b)}}};m=function(e,d,c,m){var g,r,l,D,B=[];r=typeof c;var Z;m=m||e;if("undefined"===r||"function"===r){d=!d.length&&c.length?["require","exports","module"]:d;for(D=0;D<d.length;D+=1)if(l=w(d[D],m),r=l.Ya,"require"===r)B[D]=q.Nb(e);else if("exports"===r)B[D]=q.exports(e),Z=!0;else if("module"===r)g=B[D]=q.module(e);else if(y.call(p,r)||y.call(t,r)||y.call(u,r))B[D]=f(r);else if(l.p)l.p.load(l.n,b(m, !0),h(r),{}),B[D]=p[r];else throw Error(e+" missing "+r);d=c?c.apply(p[e],B):void 0;e&&(g&&g.exports!==a&&g.exports!==p[e]?p[e]=g.exports:d===a&&Z||(p[e]=d))}else e&&(p[e]=c)};P=Q=g=function(b,e,p,d,c){if("string"===typeof b)return q[b]?q[b](e):f(w(b,e).Ya);if(!b.splice){r=b;r.pb&&g(r.pb,r.Sa);if(!e)return;e.splice?(b=e,e=p,p=null):b=a}e=e||function(){};"function"===typeof p&&(p=d,d=c);d?m(a,b,e,p):setTimeout(function(){m(a,b,e,p)},4);return g};g.oa=function(b){return g(b)};P.$b=p;R=function(b,a, e){if("string"!==typeof b)throw Error("See almond README: incorrect module build, no module name");a.splice||(e=a,a=[]);y.call(p,b)||y.call(t,b)||(t[b]=[b,a,e])};R.m={dc:!0}})(void 0);R("bin/almond",function(){});R("text",{load:function(a){throw Error("Dynamic load not allowed: "+a);}});R("text!lib/jscc/template/parser-driver-js.txt",[],function(){return'/*\r\n\tThis is the general, platform-independent part of every parser driver;\r\n\tInput-/Output and Feature-Functions are done by the particular drivers\r\n\tcreated for the particular platform.\r\n*/\r\n##HEADER##\r\nvar __parse\x3d(function(/** number */ eof, /** number */ whitespace, /** number */ error_token){\r\n\t\r\n/// there was "continue" in code, we must to replace it\r\nvar Continue \x3d function(){throw Continue;};\r\n\r\n\t/**\r\n\t * @template T\r\n\t * @param {T} value\r\n\t * @constructor\r\n\t * @extends {Error}\r\n */\r\n\tvar ReturnValue \x3d function(value) {\r\n\t\tError.call(this);\r\n\t\tthis._value \x3d value;\r\n\t};\r\n\tReturnValue.prototype \x3d Object.create(Error.prototype);\r\n\tReturnValue.prototype.constructor \x3d ReturnValue;\r\n\t/**\r\n\t * @type {T}\r\n\t * @private\r\n */\r\n\tReturnValue.prototype._value \x3d null;\r\n\t/**\r\n\t * @returns {T}\r\n */\r\n\tReturnValue.prototype.valueOf \x3d function() {\r\n\t\treturn this._value;\r\n\t};\r\n\r\n\t///can return value from any place of callback\r\n\tfunction Return(value){\r\n\t\tthrow new ReturnValue(value);\r\n\t}\r\n\r\n\tvar TERMINAL_ACTIONS \x3d (function(){\r\n\t\tfunction emptyFn(PCB){return PCB.att;}\r\n\t\tvar actions \x3d ##TERMINAL_ACTIONS##\r\n\t\treturn function(/** @type {!PcbClass} */ PCB, match){\r\n\t\t\ttry{\r\n\t\t\t\treturn (actions[match] || emptyFn)(PCB);\r\n\t\t\t}catch(e){\r\n\t\t\t\tif(e instanceof ReturnValue)return e.valueOf();\r\n\t\t\t\tif(e \x3d\x3d Continue)return Continue;\r\n\t\t\t\tthrow e;\r\n\t\t\t}\r\n\t\t}\r\n\t})();\r\n\t/**\r\n\t * @constructor\r\n */\r\n\tvar DfaLex \x3d function() {\r\n\t\tthis._dfaData \x3d ##DFA##;\r\n\t};\r\n\t/**\r\n\t * @type {!Array\x3c!{line: !Array, accept: !number}\x3e}\r\n\t * @private\r\n */\r\n\tDfaLex.prototype._dfaData \x3d [];\r\n\t/**\r\n\t * @type {number}\r\n */\r\n\tDfaLex.prototype.match_pos \x3d 0;\r\n\t/**\r\n\t * @type {?number}\r\n */\r\n\tDfaLex.prototype.state \x3d 0;\r\n\t/**\r\n\t * @type {?number}\r\n */\r\n\tDfaLex.prototype.match \x3d null;\r\n\t/**\r\n\t * @param {number} chr\r\n\t * @param {number} pos\r\n */\r\n\tDfaLex.prototype.exec \x3d function(chr, pos) {\r\n\t\tif (this.state !\x3d\x3d null) {\r\n\t\t if ((typeof this.state !\x3d\x3d "number") || this.state \x3e\x3d this._dfaData.length) {\r\n\t\t this.state \x3d null;\r\n\t\t throw new Error("Invalid value for DfaLex.state at chr " + chr + " and pos " + pos);\r\n\t\t }\r\n\t\t\tvar line \x3d this._dfaData[this.state].line;\r\n\t\t\tif (typeof line \x3d\x3d\x3d "undefined" || line \x3d\x3d\x3d null) {\r\n\t\t\t var badState \x3d this.state;\r\n\t\t\t this.state \x3d null;\r\n\t\t\t throw new Error("At chr " + chr + " and pos " + pos +\r\n\t\t\t ", DfaLex._dfaData[" + badState +\r\n\t\t\t "] appears to exist, but its line property is " +\r\n\t\t\t (typeof line \x3d\x3d\x3d "undefined" ? "undefined." : "null."));\r\n\t\t\t}\r\n\t\t\tvar p, st;\r\n\t\t\tfor (p \x3d 1 \x3c\x3c 8, st \x3d line; p; p \x3e\x3e\x3d 1) {\r\n\t\t\t\tif ((chr \x26 p) !\x3d\x3d 0) {\r\n\t\t\t\t\tst \x3d st[1];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tst \x3d st[0];\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof st \x3d\x3d\x3d "undefined") {\r\n\t\t\t\t st \x3d null;\r\n\t\t\t\t}\r\n\t\t\t\tif (st \x3d\x3d\x3d null)break;\r\n\t\t\t\tif (Array.isArray(st))continue;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tvar ac \x3d this._dfaData[this.state].accept;\r\n\t\t\tthis.state \x3d /** @type {?number} */ (st);\r\n\t\t\tif (ac !\x3d\x3d -1) {\r\n\t\t\t\tthis.match \x3d /** @type{number} */ (ac);\r\n\t\t\t\tthis.match_pos \x3d pos;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n##TABLES##\r\n##LABELS##\r\n\tvar ACTIONS \x3d (function(){\r\n\t\tvar PCB \x3d {};\r\n\t\tvar actions \x3d ##ACTIONS##;\r\n\t\treturn function (/** number */ act, /** Array\x3c*\x3e */ vstack, /** !PcbClass */ pcb){\r\n\t\t\ttry{\r\n\t\t\t\tPCB \x3d pcb;\r\n\t\t\t\treturn actions[act].apply(null,vstack);\r\n\t\t\t}catch(e){\r\n\t\t\t\tif(e instanceof ReturnValue)return e.valueOf();\r\n\t\t\t\tthrow e;\r\n\t\t\t}\r\n\t\t}\r\n\t})();\r\n\r\n\t/**\r\n\t * @param {number} top\r\n\t * @param {?number} la\r\n\t * @returns {?number}\r\n */\r\n\tfunction get_act(top, la){\t\r\n\t\tfor(var i \x3d 0; i \x3c act_tab[top].length; i+\x3d2)\r\n\t\t\tif(act_tab[top][i] \x3d\x3d\x3d la)\r\n\t\t\t\treturn act_tab[top][i+1];\r\n\t\treturn null;\r\n\t}\r\n\tfunction get_goto(top, pop){\t\r\n\t\tfor(var i \x3d 0; i \x3c goto_tab[top].length; i+\x3d2)\r\n\t\t\tif(goto_tab[top][i] \x3d\x3d\x3d pop)\r\n\t\t\t\treturn goto_tab[top][i+1];\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/**\r\n\t * @param {!string} src\r\n\t * @constructor\r\n */\r\n\tvar PcbClass \x3d function(src) {\r\n\t\tthis.src \x3d src;\r\n\t};\r\n\t/**\r\n\t * @type {number}\r\n */\r\n\tPcbClass.prototype.line \x3d 1;\r\n\t/**\r\n\t * @type {number}\r\n */\r\n\tPcbClass.prototype.column \x3d 1;\r\n\t/**\r\n\t * @type {number}\r\n */\r\n\tPcbClass.prototype.offset \x3d 0;\r\n\t/**\r\n\t * @type {number}\r\n */\r\n\tPcbClass.prototype.error_step \x3d 0;\r\n\t/**\r\n\t * @type {string}\r\n */\r\n\tPcbClass.prototype.src \x3d "";\r\n\t/**\r\n\t * @type {string}\r\n */\r\n\tPcbClass.prototype.att \x3d "";\r\n\t/**\r\n\t * @type {?number}\r\n */\r\n\tPcbClass.prototype.la \x3d null;\r\n\t/**\r\n\t * @type {?number}\r\n */\r\n\tPcbClass.prototype.act \x3d null;\r\n\t/**\r\n\t * @returns {?number}\r\n */\r\n\tPcbClass.prototype.lex \x3d function() {\r\n var /** number */ start, /** number */ pos, /** number */ chr, actionResult;\r\n\t\tvar dfa \x3d new DfaLex();\r\n\t\tvar loop \x3d true;\r\n\t\twhile(loop){\r\n\t\t\tdfa.match_pos \x3d 0;\r\n\t\t\tpos \x3d this.offset + 1;\r\n\t\t\tdo{\r\n\t\t\t\tpos--;\r\n\t\t\t\tdfa.state \x3d 0;\r\n\t\t\t\tdfa.match \x3d null;\r\n\t\t\t\tstart \x3d pos;\r\n\t\t\t\tif(this.src.length \x3c\x3d start) {\r\n\t\t\t\t\tthis.la \x3d eof;\r\n\t\t\t\t\treturn eof;\r\n\t\t\t\t}\r\n\t\t\t\tdo{\r\n\t\t\t\t\tchr \x3d this.src.charCodeAt(pos);\r\n\t\t\t\t\tdfa.exec(chr,pos);\r\n\t\t\t\t\tif(dfa.state !\x3d\x3d null)\r\n\t\t\t\t\t\tthis.accountChar(chr);\r\n\t\t\t\t\tpos++;\r\n\t\t\t\t}while(dfa.state !\x3d\x3d null);\r\n\t\t\t}while(whitespace \x3e -1 \x26\x26 dfa.match \x3d\x3d\x3d whitespace);\r\n\t\t\tif(dfa.match !\x3d\x3d null){\r\n\t\t\t\tthis.att \x3d this.src.slice(start, dfa.match_pos);\r\n\t\t\t\tthis.offset \x3d dfa.match_pos;\r\n\t\t\t\tactionResult \x3d TERMINAL_ACTIONS(this,dfa.match);\r\n\t\t\t\tif(dfa.state !\x3d\x3d null)\r\n\t\t\t\t\tthis.accountChar(chr);\r\n\t\t\t\tif(actionResult \x3d\x3d\x3d Continue)\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tthis.att \x3d actionResult;\r\n\t\t\t}else {\r\n\t\t\t\tthis.att \x3d "";\r\n\t\t\t}\r\n\t\t\tloop \x3d false;\r\n\t\t}\r\n\t\tthis.la \x3d dfa.match;\r\n\t\treturn this.la;\r\n\t};\r\n\t/**\r\n\t * @param {number} chr\r\n */\r\n PcbClass.prototype.accountChar \x3d function(chr) {\r\n\t\tif( chr \x3d\x3d\x3d 10 ){\r\n\t\t\tthis.line++;\r\n\t\t\tthis.column \x3d 0;\r\n\t\t}\r\n\t\tthis.column++;\r\n\t};\r\n\tfunction parse(/** string */ src, err_off, err_la){\r\n\t\t/**\r\n\t\t * @type {!Array\x3cnumber\x3e}\r\n */\r\n\t\tvar\t\tsstack\t\t\t\x3d [0];\r\n\t\t/**\r\n\t\t * @type {!Array\x3c*\x3e}\r\n */\r\n\t\tvar\t\tvstack\t\t\t\x3d [0];\r\n\t\t/**\r\n\t\t * @type {number}\r\n */\r\n\t\tvar \terr_cnt\t\t\t\x3d 0;\r\n\t\t/**\r\n\t\t * @type {*}\r\n\t\t */\r\n\t\tvar\t\trval;\r\n\t\t/**\r\n\t\t * @type {?number}\r\n\t\t */\r\n\t\tvar\t\tact;\r\n\t\t/**\r\n\t\t * @type {number}\r\n\t\t */\r\n\t\tvar i \x3d 0;\r\n\r\n\t\tvar PCB\t\x3d new PcbClass(src);\r\n\t\terr_off\t\x3d err_off || [];\r\n\t\terr_la \x3d err_la || [];\r\n\t\tPCB.lex();\r\n\t\twhile(true){\r\n\t\t\tPCB.act \x3d get_act(sstack[0],PCB.la);\r\n\t\t\tif(PCB.act \x3d\x3d\x3d null \x26\x26 defact_tab[sstack[0]] \x3e\x3d 0)\r\n\t\t\t\tPCB.act \x3d -defact_tab[sstack[0]];\r\n\t\t\tif(PCB.act \x3d\x3d\x3d null){//Parse error? Try to recover!\r\n\t\t\t\t//Report errors only when error_step is 0, and this is not a\r\n\t\t\t\t//subsequent error from a previous parse\r\n\t\t\t\tif(PCB.error_step \x3d\x3d\x3d 0){\r\n\t\t\t\t\terr_cnt++;\r\n\t\t\t\t\terr_off.unshift(PCB.offset - PCB.att.length);\r\n\t\t\t\t\terr_la.unshift([]);\r\n\t\t\t\t\tfor(i \x3d 0; i \x3c act_tab[sstack[0]].length; i+\x3d2)\r\n\t\t\t\t\t\terr_la[0].push(labels[act_tab[sstack[0]][i]]);\r\n\t\t\t\t}\r\n\t\t\t\t//Perform error recovery\t\t\t\r\n\t\t\t\twhile(sstack.length \x3e 1 \x26\x26 PCB.act \x3d\x3d\x3d null){\r\n\t\t\t\t\tsstack.shift();\r\n\t\t\t\t\tvstack.shift();\r\n\t\t\t\t\t//Try to shift on error token\r\n\t\t\t\t\tPCB.act \x3d get_act(sstack[0],PCB.la);\r\n\t\t\t\t\tif(PCB.act \x3d\x3d\x3d error_token){\r\n\t\t\t\t\t\tsstack.unshift(PCB.act);\r\n\t\t\t\t\t\tvstack.unshift("");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//Is it better to leave the parser now?\r\n\t\t\t\tif(sstack.length \x3e 1 \x26\x26 PCB.act !\x3d\x3d null){\r\n\t\t\t\t\t//Ok, now try to shift on the next tokens\r\n\t\t\t\t\twhile(PCB.la !\x3d\x3d eof){\r\n\t\t\t\t\t\tPCB.act \x3d act_tab[sstack[0]][i+1];\r\n\t\t\t\t\t\tif(PCB.act !\x3d null)break;\r\n\t\t\t\t\t\twhile(PCB.lex() !\x3d null)PCB.offset++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(PCB.act \x3d\x3d\x3d null || PCB.la \x3d\x3d\x3d eof){\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t//Try to parse the next three tokens successfully...\r\n\t\t\t\tPCB.error_step \x3d 3;\r\n\t\t\t}\r\n\t\t\tif(PCB.act \x3e 0){//Shift\r\n\t\t\t\t//Parse tree generation\r\n\t\t\t\tsstack.unshift(PCB.act);\r\n\t\t\t\tvstack.unshift(PCB.att);\r\n\t\t\t\tPCB.lex();\r\n\t\t\t\t//Successfull shift and right beyond error recovery?\r\n\t\t\t\tif(PCB.error_step \x3e 0)\r\n\t\t\t\t\tPCB.error_step--;\r\n\t\t\t}else{\t//Reduce\t\r\n\t\t\t\tact \x3d -PCB.act;\r\n\t\t\t\t//vstack.unshift(vstack);\r\n\t\t\t\trval \x3d ACTIONS(act,vstack,PCB);\r\n\t\t\t\t//vstack.shift();\r\n\t\t\t\tsstack.splice(0,pop_tab[act][1]);\r\n\t\t\t\tvstack.splice(0,pop_tab[act][1]);\r\n\t\t\t\t\r\n\t\t\t\tPCB.act \x3d get_goto(sstack[0],pop_tab[act][0]);\r\n\t\t\t\t//Do some parse tree construction if desired\r\n\t\t\t\t//Goal symbol match?\r\n\t\t\t\tif(act \x3d\x3d\x3d 0) break; //Don\'t use PCB.act here!\r\n\t\t\t\r\n\t\t\t\t//...and push it!\r\n\t\t\t\tsstack.unshift(PCB.act);\r\n\t\t\t\tvstack.unshift(rval);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn err_cnt;\r\n\t}\r\n\treturn parse;\r\n})(##EOF##,##WHITESPACE##,##ERROR_TOKEN##);\r\n\r\n##FOOTER##\r\n'}); function S(){var a;a=java.util.BitSet;k.la=function(){this.ta=new a};k.la.prototype.ta=null;k.la.prototype.set=function(a,b){b=b&&!0||!1;this.ta.set(a,b);return b};k.la.prototype.get=function(a){return this.ta.get(a)};k.la.prototype.count=function(){return this.ta.cardinality()};return k.la}"function"===typeof R&&R.m?R("lib/jscc/bitset/BitSetJava",S):"object"===typeof module&&module.exports?module.exports=S():S();function ba(){return z} "function"===typeof R&&R.m?R("lib/jscc/enums/EDGE",ba):"object"===typeof module&&module.exports&&(module.exports=z); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/classes/Nfa",["require","../enums/EDGE","../bitset"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.fc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b=a("../enums/EDGE");c=a("../bitset");k.classes.aa=function(a){a=a||{};if(a.J===b.da||a.J===b.za)this.J=a.J;"object"===typeof a.C&&a.C.hasOwnProperty("get")&&a.C.hasOwnProperty("set")&&a.C.hasOwnProperty("count")?this.C=a.C:this.C=new c;"number"=== typeof a.s&&(this.s=a.s);"number"===typeof a.D&&(this.D=a.D);"number"===typeof a.accept&&(this.accept=a.accept);"number"===typeof a.weight&&(this.weight=a.weight)};k.classes.aa.prototype.J=b.EPSILON;k.classes.aa.prototype.C=new c;k.classes.aa.prototype.s=-1;k.classes.aa.prototype.D=-1;k.classes.aa.prototype.accept=-1;k.classes.aa.prototype.weight=-1;return k.classes.aa}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/nfaStates",["require","./bitset","./enums/EDGE","./classes/Nfa"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.qc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b=a("./enums/EDGE"),d=a("./classes/Nfa");c=a("./bitset");k.Ba=function(){};k.Ba.prototype.value=[];k.Ba.prototype.create=function(){var a,f;for(f=0;f<this.value.length&&this.value[f].J!==b.za;f++);f==this.value.length?(a=new d,this.value.push(a)): a=this.value[f];a.J=b.EPSILON;a.C=new c;a.accept=-1;a.s=-1;a.D=-1;a.weight=-1;return f};return k.Ba});function ca(){return O}"function"===typeof R&&R.m?R("lib/jscc/enums/SYM",ca):"object"===typeof module&&module.exports&&(module.exports=O);function da(){return n}"function"===typeof R&&R.m?R("lib/jscc/enums/ASSOC",da):"object"===typeof module&&module.exports&&(module.exports=n);function ea(){return N} "function"===typeof R&&R.m?R("lib/jscc/enums/SPECIAL",ea):"object"===typeof module&&module.exports&&(module.exports=N); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/classes/Symbol",["require","../enums/SYM","../enums/ASSOC","../enums/SPECIAL"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.gc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c=a("../enums/SYM"),b=a("../enums/ASSOC"),d=a("../enums/SPECIAL");k.classes.Symbol=function(a){a=a||{};"number"===typeof a.id&&(this.id=a.id);a.kind===c.A&&(this.kind=a.kind);"string"===typeof a.label&&(this.label=a.label);Array.isArray(a.w)&& (this.w=a.w);Array.isArray(a.first)&&(this.first=a.first);if(a.X===b.Aa||a.X===b.Pa||a.X===b.Ca)this.X=a.X;"number"===typeof a.level&&(this.level=a.level);"string"===typeof a.code&&(this.code=a.code);if(a.M===d.ya||a.M===d.ERROR||a.M===d.Qa)this.M=a.M;"boolean"===typeof a.ca&&(this.ca=a.ca);"boolean"===typeof a.Y&&(this.Y=a.Y)};k.classes.Symbol.prototype.id=-1;k.classes.Symbol.prototype.kind=c.I;k.classes.Symbol.prototype.label="";k.classes.Symbol.prototype.w=[];k.classes.Symbol.prototype.first=[]; k.classes.Symbol.prototype.X=b.NONE;k.classes.Symbol.prototype.level=0;k.classes.Symbol.prototype.code="";k.classes.Symbol.prototype.M=d.NONE;k.classes.Symbol.prototype.ca=!1;k.classes.Symbol.prototype.Y=!1;return k.classes.Symbol}); function T(){k.classes.ga=function(a){a=a||{};"number"===typeof a.id&&(this.id=a.id);"number"===typeof a.U&&(this.U=a.U);"undefined"!==typeof a.h&&Array.isArray(a.h)&&(this.h=a.h);"number"===typeof a.level&&(this.level=a.level);"string"===typeof a.code&&(this.code=a.code)};k.classes.ga.prototype.id=-1;k.classes.ga.prototype.U=-1;k.classes.ga.prototype.h=[];k.classes.ga.prototype.level=0;k.classes.ga.prototype.code="";return k.classes.ga} "function"===typeof R&&R.m?R("lib/jscc/classes/Production",T):"object"===typeof module&&module.exports?module.exports=T():T();function fa(){return K}"function"===typeof R&&R.m?R("lib/jscc/enums/EXEC",fa):"object"===typeof module&&module.exports&&(module.exports=K); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/global","require text!./template/parser-driver-js.txt ./nfaStates ./classes/Symbol ./classes/Production ./enums/SYM ./enums/SPECIAL ./enums/EXEC".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.jc=c(function(b){b=b.split("/");b=b[b.length-1];return/js\.txt$/.test(b)?a.ec:a["jscc"+b]})})(this,function(a){var c,b=a("./nfaStates"),d=a("./classes/Symbol"),h=a("./classes/Production"),f=a("./enums/SYM"),l=a("./enums/SPECIAL"); a("./enums/EXEC");c=a("text!./template/parser-driver-js.txt");k.global=function(){this.f=new b;var a=new d;a.kind=f.I;a.M=l.NONE;a.label="";a.id=0;a.Y=!0;var m=new d;m.kind=f.A;m.M=l.ERROR;m.label="ERROR_RESYNC";m.id=1;m.Y=!0;this.a=[a,m];a=new h;a.U=0;a.h=[];a.code="%% \x3d %1;";this.a[0].w.push(0);this.g=[a];this.ra=-1;this.file="";this.fb=this.Ka=this.La=this.Ma=this.xa=this.L=0;this.ua=this.va="";this.Na=c;this.ib="%% \x3d %1;";this.fa=0;this.$=255};k.global.prototype.a=[];k.global.prototype.g= [];k.global.prototype.c=[];k.global.prototype.f=null;k.global.prototype.pa=[];k.global.prototype.ra=-1;k.global.prototype.va="";k.global.prototype.ua="";k.global.prototype.file="";k.global.prototype.L=0;k.global.prototype.xa=0;k.global.prototype.Ma=0;k.global.prototype.La=0;k.global.prototype.Ka=0;k.global.prototype.ia=1;k.global.prototype.fb=0;k.global.prototype.Wb=null;k.global.prototype.cb=null;k.global.prototype.eb=null;return new k.global});function ga(){return L} "function"===typeof R&&R.m?R("lib/jscc/enums/LOG_LEVEL",ga):"object"===typeof module&&module.exports&&(module.exports=L); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/log/logJava",["require","../global","../enums/LOG_LEVEL"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.oc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){function c(){b=b||a("../global")}var b=a("../global"),d=a("../enums/LOG_LEVEL"),h,f,l,e,m,g;f=java.util.logging.Level.SEVERE;l=java.util.logging.Level.WARNING;e=java.util.logging.Level.INFO;m=java.util.logging.Level.FINE;g=java.util.logging.Level.FINER; h=java.util.logging.ConsoleHandler;k.P=function(){this.S=java.util.logging.Logger.getLogger("jscc");var b=new h;b.setLevel(g);this.S.addHandler(b)};k.P.prototype.S=null;k.P.prototype.ha=function(b,a){this.S.log(b,a)};k.P.prototype.fatal=function(a){c();this.ha(f,a);b.L++};k.P.prototype.error=function(a){c();this.ha(f,a);b.L++};k.P.prototype.warn=function(a){c();this.ha(l,a);b.xa++};k.P.prototype.info=function(b){this.ha(e,b)};k.P.prototype.debug=function(b){this.ha(m,b)};k.P.prototype.trace=function(b){this.ha(g, b)};k.P.prototype.setLevel=function(b){switch(b){case d.jb:case d.ERROR:this.S.setLevel(f);break;case d.Fa:this.S.setLevel(l);break;case d.INFO:this.S.setLevel(e);break;case d.hb:this.S.setLevel(m);break;case d.lb:this.S.setLevel(g);break;default:this.S.setLevel(l)}};return new k.P}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/io/ioRhino",["require","../global","../log/log"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.lc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c=a("../global"),b=a("../log/log");k.Z=function(){};k.Z.prototype.qa=function(a){var c="";(new java.io.File(a)).exists()?c=readFile(a):(b.error("unable to open file '"+a+"'"),quit(1));return c};k.Z.prototype.Vb=function(b,a){b=new java.io.PrintWriter(b); b.write(a);b.close()};k.Z.prototype.Kb=function(b){if("string"===typeof b)return this.qa(b);if("object"===typeof b&&"string"===typeof b.filename)if("function"===typeof b.Ha)b.Ha(this.qa(b.filename)),"function"===typeof b.Ia&&b.Ia();else return this.qa(b.filename)};k.Z.prototype.Lb=function(b){var a=c.Na;"string"===typeof b?a=b:"object"===typeof b&&(a=b.filename||a);if("object"===typeof b&&"function"===typeof b.Ha)b.Ha(this.qa(a)),"function"===typeof b.Ia&&b.Ia();else return this.qa(a)};k.Z.prototype.gb= function(b){function a(){}var c="",l="";"string"===typeof b?c=b:"object"===typeof b&&("string"===typeof b.text&&(c=b.text),"string"===typeof b.destination&&(l=b.destination),"function"===typeof b.Sa&&(a=b.Sa));""===l?java.lang.System.out.print(c):this.Vb(l,c);a()};k.Z.prototype.Ub=function(b){java.lang.System.out.print(b)};k.Z.prototype.exit=function(b){"number"!==typeof b&&(b=0);java.lang.System.exit(b)};return new k.Z}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/util",["require","./enums/LOG_LEVEL"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.vc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c=a("./enums/LOG_LEVEL");k.util=function(){};k.util.prototype={wa:function(b,a){var c,f;for(c=0;c<a.length;c++){for(f=0;f<b.length&&a[c]!=b[f];f++);f==b.length&&b.push(a[c])}return b},Bb:function(b){switch((b||"").trim().toUpperCase()){case "FATAL":return c.jb;case "ERROR":return c.ERROR; case "WARN":return c.Fa;case "INFO":return c.INFO;case "DEBUG":return c.hb;case "TRACE":return c.lb;default:return c.Fa}}};return new k.util}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/first",["require","./global","./util","./enums/SYM"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.ic=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c=a("./global"),b=a("./util"),d=a("./enums/SYM");k.first=function(){};k.first.prototype.first=function(){var a=0,f,l;do{f=a;for(var e=a=0;e<c.a.length;e++)if(c.a[e].kind==d.I)for(var m=0;m<c.a[e].w.length;m++){l=!1;for(var g=0;g<c.g[c.a[e].w[m]].h.length&& (c.a[e].first=b.wa(c.a[e].first,c.a[c.g[c.a[e].w[m]].h[g]].first),l=c.a[c.g[c.a[e].w[m]].h[g]].ca,l);g++);a+=c.a[e].first.length;g==c.g[c.a[e].w[m]].h.length&&(l=!0);l&&(c.a[e].ca=!0)}}while(a!=f)};k.first.prototype.Ob=function(a,f,l){for(;l<f.h.length;l++)if(a.l=b.wa(a.l,c.a[f.h[l]].first),!c.a[f.h[l]].ca)return!1;return!0};return new k.first}); function U(){k.classes.W=function(a){a=a||{};Array.isArray(a.v)&&(this.v=a.v);Array.isArray(a.N)&&(this.N=a.N);"number"===typeof a.K&&(this.K=a.K);"boolean"===typeof a.done&&(this.done=a.done);"boolean"===typeof a.closed&&(this.closed=a.closed);Array.isArray(a.u)&&(this.u=a.u);Array.isArray(a.O)&&(this.O=a.O)};k.classes.W.prototype.v=[];k.classes.W.prototype.N=[];k.classes.W.prototype.K=0;k.classes.W.prototype.done=!1;k.classes.W.prototype.closed=!1;k.classes.W.prototype.u=[];k.classes.W.prototype.O= [];return k.classes.W}"function"===typeof R&&R.m?R("lib/jscc/classes/State",U):"object"===typeof module&&module.exports?module.exports=U():U();function V(){k.classes.sa=function(a){a=a||{};"number"===typeof a.i&&(this.i=a.i);"number"===typeof a.o&&(this.o=a.o);"undefined"!==typeof a.l&&Array.isArray(a.l)&&(this.l=a.l)};k.classes.sa.prototype.i=-1;k.classes.sa.prototype.o=0;k.classes.sa.prototype.l=[];return k.classes.sa} "function"===typeof R&&R.m?R("lib/jscc/classes/Item",V):"object"===typeof module&&module.exports?module.exports=V():V();function W(){k.classes.Ea=function(a,c){this.symbol=a;this.action=c};k.classes.Ea.prototype.symbol=-1;k.classes.Ea.prototype.action=-1;return k.classes.Ea}"function"===typeof R&&R.m?R("lib/jscc/classes/TableEntry",W):"object"===typeof module&&module.exports?module.exports=W():W();function ha(){return M} "function"===typeof R&&R.m?R("lib/jscc/enums/MODE_GEN",ha):"object"===typeof module&&module.exports&&(module.exports=M); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/debug","require ./global ./io/io ./enums/MODE_GEN ./enums/SYM ./enums/ASSOC".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.hc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){a("./global");a("./enums/MODE_GEN");a("./enums/SYM");a("./enums/ASSOC");a("./io/io");k.debug=function(){};k.debug.prototype={};return new k.debug}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/tabgen","require ./global ./first ./util ./log/log ./classes/State ./classes/Item ./classes/TableEntry ./classes/Symbol ./enums/SPECIAL ./enums/ASSOC ./enums/SYM ./enums/MODE_GEN ./enums/EXEC ./debug".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.uc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b=a("./global"),d=a("./first"),h=a("./util");c=a("./log/log");var f=a("./classes/State"), l=a("./classes/Item"),e=a("./classes/TableEntry"),m=a("./classes/Symbol"),g=a("./enums/SPECIAL"),w=a("./enums/ASSOC"),q=a("./enums/SYM");a("./enums/EXEC");a("./enums/MODE_GEN");a("./debug");k.F=function(){};k.F.prototype.Va=function(){var a=new f({v:[],N:[],u:[],O:[],done:!1,closed:!1,K:0});b.c.push(a);return a};k.F.prototype.Ua=function(b){return new l({i:b,o:0,l:[]})};k.F.prototype.Ga=function(b,a,c){for(var m=0;m<b.length;m++)if(b[m].symbol==a)return b;b.push(new e(a,c));return b};k.F.prototype.Tb= function(b,a,e){var c;for(c=0;c<b.length;c++)if(b[c].symbol==a){b[c].action=e;break}};k.F.prototype.Mb=function(b,a){for(var e=0;e<b.length;e++)if(b[e].symbol==a){b.splice(e,1);break}};k.F.prototype.Ja=function(b,a){for(var e=0;e<b.length;e++)if(b[e].symbol==a)return b[e].action};k.F.prototype.vb=function(){for(var a=0;a<b.c.length;a++)if(0==b.c[a].done)return a;return-1};k.F.prototype.Qb=function(b,a){return b.i-a.i};k.F.prototype.ka=function(a,e,c){c||(c=g.NONE);for(var m=0;m<b.a.length;m++)if(b.a[m].label.toString()== a.toString()&&b.a[m].kind==e&&b.a[m].M==c)return m;return-1};k.F.prototype.ja=function(a,e,c){var f;if(-1<(f=this.ka(a,e,c)))return b.a[f].id;a=new m({label:a,kind:e,w:[],ca:!1,id:b.a.length,code:"",X:w.NONE,level:0,M:c,Y:!1,first:[]});e==q.A&&a.first.push(a.id);b.a.push(a);return a.id};k.F.prototype.xb=function(b,a){var e,c,m=0;if(b.length!=a.length)return!1;for(e=0;e<b.length;e++)for(c=0;c<a.length;c++)if(b[e].i==a[c].i&&b[e].o==a[c].o){m++;break}return m==b.length};k.F.prototype.nb=function(a, e){var c,m,f,g=0,l;for(c=0;c<a.length;c++)if(a[c].o<b.g[a[c].i].h.length&&b.a[b.g[a[c].i].h[a[c].o]].kind==q.I)for(m=0;m<b.a[b.g[a[c].i].h[a[c].o]].w.length;m++){for(f=0;f<e.length&&e[f].i!=b.a[b.g[a[c].i].h[a[c].o]].w[m];f++);f==e.length&&(l=this.Ua(b.a[b.g[a[c].i].h[a[c].o]].w[m]),e.push(l),g++);l=e[f].l.length;d.Ob(e[f],b.g[a[c].i],a[c].o+1)&&(e[f].l=h.wa(e[f].l,a[c].l));g+=e[f].l.length-l}return g};k.F.prototype.zb=function(a){var e=[],c,m,f,g,d;f=0;do c=f,f=this.nb(0==c?b.c[a].v:e,e);while(f!= c);for(g=0;g<b.c[a].v.length;g++)if(b.c[a].v[g].o<b.g[b.c[a].v[g].i].h.length)for(e.unshift(new l({i:b.c[a].v[g].i,o:b.c[a].v[g].o,l:[]})),d=0;d<b.c[a].v[g].l.length;d++)e[0].l[d]=b.c[a].v[g].l[d];for(g=0;g<e.length;g++)if(0==b.g[e[g].i].h.length){for(d=0;d<b.c[a].N.length&&(b.c[a].N[d].i!=e[g].i||b.c[a].N[d].o!=e[g].o);d++);d==b.c[a].N.length&&b.c[a].N.push(e[g]);e.splice(g,1)}for(;0<e.length;){m=[];c=[];f=-1;for(g=0;g<e.length;g++)0==m.length&&(f=b.g[e[g].i].h[e[g].o]),e[g].o<b.g[e[g].i].h.length&& (b.g[e[g].i].h[e[g].o]==f?(e[g].o++,m.push(e[g])):c.push(e[g]));if(0<m.length){m.sort(this.Qb);for(g=0;g<b.c.length&&!this.xb(b.c[g].v,m);g++);g==b.c.length&&(e=this.Va(),e.v=m);for(d=f=e=0;d<m.length;d++)e+=b.c[g].v[d].l.length,b.c[g].v[d].l=h.wa(b.c[g].v[d].l,m[d].l),f+=b.c[g].v[d].l.length;e!=f&&(b.c[g].done=!1);if(!b.c[a].closed)for(d=0;d<m.length;d++)m[d].o-1<b.g[m[d].i].h.length&&(b.a[b.g[m[d].i].h[m[d].o-1]].kind==q.A?(b.c[a].u=this.Ga(b.c[a].u,b.g[m[d].i].h[m[d].o-1],g),b.Ma++):(b.c[a].O= this.Ga(b.c[a].O,b.g[m[d].i].h[m[d].o-1],g),b.Ka++))}e=c}b.c[a].closed=!0};k.F.prototype.qb=function(a){var e,m,g,f,d,l,h,q=[],F=0;for(e=0;2>e;e++)for(h=e?b.c[a].N:b.c[a].v,m=0;m<h.length;m++)if(h[m].o==b.g[h[m].i].h.length)for(g=0;g<h[m].l.length;g++)if(l=!0,f=this.Ja(b.c[a].u,h[m].l[g]),void 0==f)d=-1*h[m].i,b.c[a].u=this.Ga(b.c[a].u,h[m].l[g],d),b.La++;else{d=f;var v;if(0<f){if(0<b.a[h[m].l[g]].level||0<b.g[h[m].i].level)b.a[h[m].l[g]].level==b.g[h[m].i].level?b.a[h[m].l[g]].X==w.Aa?d=-1*h[m].i: b.a[h[m].l[g]].X==w.Ca&&(this.Mb(b.c[a].u,h[m].l[g]),c.warn("Removing nonassociative symbol '"+b.a[h[m].l[g]].label+"' in state "+a),l=!1):b.a[h[m].l[g]].level<b.g[h[m].i].level&&(d=-1*h[m].i);v="Shift"}else d=-1*d<h[m].i?d:-1*h[m].i,v="Reduce";v+="-reduce conflict on symbol '"+b.a[h[m].l[g]].label+"' in state "+a;v+="\n Conflict resolved by "+(0>=d?"reducing with production":"shifting to state")+" "+(0>=d?-1*d:d);l&&c.warn(v);d!=f&&this.Tb(b.c[a].u,h[m].l[g],d)}b.c[a].K=-1;for(m=0;m<q.length;m++){for(e= g=0;g<q.length;g++)q[g]==q[m]&&e++;F<e&&(F=e,b.c[a].K=q[m])}if(0<=b.c[a].K){do for(e=b.c[a].u.length,m=0;m<b.c[a].u.length;m++)b.c[a].u[m][1]==-1*b.c[a].K&&b.c[a].u.splice(m,1);while(e!=b.c[a].u.length)}};k.F.prototype.Ab=function(){var a,e;a=this.Ua(0);e=this.ja("$",q.A,g.ya);a.l.push(e);e=this.Va();for(e.v.push(a);0<=(a=this.vb());)b.c[a].done=!0,this.zb(a);for(a=0;a<b.c.length;a++)this.qb(a)};return new k.F}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/printtab","require ./global ./tabgen ./log/log ./enums/MODE_GEN ./enums/SYM ./enums/SPECIAL".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.sc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b=a("./global"),d=a("./tabgen"),h=a("./enums/MODE_GEN"),f=a("./enums/SYM"),l=a("./enums/SPECIAL");c=a("./log/log");k.bb=function(){};k.bb.prototype={Hb:function(a){var c="",g,l=0,q;switch(a){case h.kb:case "html":c+= '\x3ctable class\x3d"print" cellpadding\x3d"0" cellspacing\x3d"0"\x3e\x3ctr\x3e\x3ctd class\x3d"tabtitle" colspan\x3d"2"\x3ePop-Table\x3c/td\x3e\x3c/tr\x3e\x3ctd class\x3d"coltitle" width\x3d"1%" style\x3d"border-right: 1px solid lightgray;"\x3eLeft-hand side\x3c/td\x3e\x3ctd class\x3d"coltitle"\x3eNumber of symbols to pop\x3c/td\x3e\x3c/tr\x3e';for(a=0;a<b.g.length;a++)c+="\x3ctr\x3e",c+='\x3ctd style\x3d"border-right: 1px solid lightgray;"\x3e'+b.g[a].U+"\x3c/td\x3e",c+="\x3ctd\x3e"+b.g[a].h.length+ "\x3c/td\x3e",c+="\x3c/tr\x3e";for(a=0;a<b.a.length;a++)b.a[a].kind==f.A&&l++;c=c+'\x3c/table\x3e\x3ctable class\x3d"print" cellpadding\x3d"0" cellspacing\x3d"0"\x3e\x3ctr\x3e'+('\x3ctd class\x3d"tabtitle" colspan\x3d"'+(l+1)+'"\x3eAction-Table\x3c/td\x3e')+'\x3c/tr\x3e\x3ctd class\x3d"coltitle" width\x3d"1%" style\x3d"border-right: 1px solid lightgray;"\x3eState\x3c/td\x3e';for(a=0;a<b.a.length;a++)b.a[a].kind==f.A&&(c+="\x3ctd\x3e\x3cb\x3e"+b.a[a].label+"\x3c/b\x3e\x3c/td\x3e");c+="\x3c/tr\x3e"; for(a=0;a<b.c.length;a++){c+="\x3ctr\x3e";c+='\x3ctd class\x3d"coltitle" style\x3d"border-right: 1px solid lightgray;"\x3e'+a+"\x3c/td\x3e";for(g=0;g<b.a.length;g++)b.a[g].kind==f.A&&(c+="\x3ctd\x3e",void 0!=(q=d.Ja(b.c[a].u,g))&&(c=0>=q?c+("r"+-1*q):c+("s"+q)),c+="\x3c/td\x3e");c+="\x3c/tr\x3e"}c+="\x3c/table\x3e";for(a=0;a<b.a.length;a++)b.a[a].kind==f.I&&l++;c+='\x3ctable class\x3d"print" cellpadding\x3d"0" cellspacing\x3d"0"\x3e';c+="\x3ctr\x3e";c=c+('\x3ctd class\x3d"tabtitle" colspan\x3d"'+ (l+1)+'"\x3eGoto-Table\x3c/td\x3e')+'\x3c/tr\x3e\x3ctd class\x3d"coltitle" width\x3d"1%" style\x3d"border-right: 1px solid lightgray;"\x3eState\x3c/td\x3e';for(a=0;a<b.a.length;a++)b.a[a].kind==f.I&&(c+="\x3ctd\x3e"+b.a[a].label+"\x3c/td\x3e");c+="\x3c/tr\x3e";for(a=0;a<b.c.length;a++){c+="\x3ctr\x3e";c+='\x3ctd class\x3d"coltitle" style\x3d"border-right: 1px solid lightgray;"\x3e'+a+"\x3c/td\x3e";for(g=0;g<b.a.length;g++)b.a[g].kind==f.I&&(c+="\x3ctd\x3e",void 0!=(q=d.Ja(b.c[a].O,g))&&(c+=q),c+= "\x3c/td\x3e");c+="\x3c/tr\x3e"}c+="\x3c/table\x3e";c+='\x3ctable class\x3d"print" cellpadding\x3d"0" cellspacing\x3d"0"\x3e';c+="\x3ctr\x3e";c+='\x3ctd class\x3d"tabtitle" colspan\x3d"2"\x3eDefault Actions Table\x3c/td\x3e';c+="\x3c/tr\x3e";c+='\x3ctd class\x3d"coltitle" width\x3d"1%" style\x3d"border-right: 1px solid lightgray;"\x3eLeft-hand side\x3c/td\x3e';c+='\x3ctd class\x3d"coltitle"\x3eNumber of symbols to pop\x3c/td\x3e';c+="\x3c/tr\x3e";for(a=0;a<b.c.length;a++)c+="\x3ctr\x3e",c+='\x3ctd style\x3d"border-right: 1px solid lightgray;"\x3eState '+ a+"\x3c/td\x3e",c+="\x3ctd\x3e"+(0>b.c[a].K?"(none)":b.c[a].K)+"\x3c/td\x3e",c+="\x3c/tr\x3e";c+="\x3c/table\x3e";break;case h.Oa:case "js":g=[];for(a=0;a<b.g.length;a++)g.push([b.g[a].U,b.g[a].h.length]);c+="\nvar pop_tab \x3d "+JSON.stringify(g)+";\n";l=[];for(a=0;a<b.c.length;a++){q=[];for(g=0;g<b.c[a].u.length;g++)q.push(b.c[a].u[g].symbol,b.c[a].u[g].action);l.push(q)}c+="\n/** @type {!Array\x3c!Array\x3cnumber\x3e\x3e} */\nvar act_tab \x3d"+JSON.stringify(l)+";\n";l=[];for(a=0;a<b.c.length;a++){q= [];for(g=0;g<b.c[a].O.length;g++)q.push(b.c[a].O[g].symbol,b.c[a].O[g].action);l.push(q)}c+="\nvar goto_tab \x3d"+JSON.stringify(l)+";\n";g=[];for(a=0;a<b.c.length;a++)g.push(b.c[a].K);c+="\nvar defect_tab \x3d"+JSON.stringify(g)+";\n"}return c},Db:function(a){function b(a){for(var c=[];a.length;){var e=a.shift(),g=a.shift();e==g?c.push(e):c.push([e,g])}return c}for(var c=[],f=0;f<a.length;f++)(function(f){for(var d=[],l=0;l<a[f].b.length;l++)-1!=a[f].b[l]&&(d[l]=a[f].b[l]);d=b(b(b(b(b(b(b(b(d)))))))); c.push({b:d,accept:a[f].accept})})(f);return c},Gb:function(a){for(var b=[],c=0;c<a.length;c++){for(var f=c,d={},l=0;l<a[f].b.length;l++)-1!=a[f].b[l]&&(d[l]=a[f].b[l]);b.push({b:d,accept:a[f].accept})}return JSON.stringify(this.Db(a)).replace(/"([A-Za-z_][A-Za-z0-9_]*)"\s*:/g,"$1:").replace(/,/g,",\n\t")},Ib:function(){for(var a=0,c=[];a<b.a.length;a++)c.push(b.a[a].label);return"var labels \x3d "+JSON.stringify(b.a)+";\n\n"},Jb:function(){var a="({\n",c=/%match|%offset|%source/,g,d,l,h,t;for(g= 0;g<b.a.length;g++)if(b.a[g].kind==f.A&&""!=b.a[g].code){a+=' "'+g+'":';a+=" /** @suppress {uselessCode} */ function(PCB){";h="";for(l=d=0;d<b.a[g].code.length;d++,l++)(t=c.exec(b.a[g].code.substr(d,b.a[g].code.length)))&&0==t.index?("%match"==t[0]?h+="PCB.att":"%offset"==t[0]?h+="( PCB.offset - PCB.att.length )":"%source"==t[0]&&(h+="PCB.src"),d+=t[0].length-1,l=h.length):h+=b.a[g].code.charAt(d);a+=" "+h+"\n";a+=" return PCB.att;},\n"}return a+"\n})"},Eb:function(){var a,f=/%[0-9]+|%%/, g,d,l,h,t,r;a="[";for(l=0;l<b.g.length;l++){r=b.g[l].code;g="function(){\n";g+="var rval;";for(t=h=0;h<r.length;h++,t++)(d=f.exec(r.substr(h,r.length)))&&0==d.index?("%%"==d[0]?g+="rval":(t=parseInt(d[0].substr(1,d[0].length),10),t=b.g[l].h.length-t,0>t?(t=b.a[b.g[l].U],0==b.g[l].h.length?c.error("Default code was used for an empty right-hand side of a production, or a wildcard "+d[0]+" was used explicitly. The faulty left-hand side symbol label is '"+t.label+"'."):c.error("The wildcard "+d[0]+" was used, but there are only "+ b.g[l].h.length+" symbols on the right-hand side of the production. The faulty left-hand side symbol label is '"+t.label+"'."),g+=' "" '):g+=" arguments["+t+"] "),h+=d[0].length-1,t=g.length):g+=r.charAt(h);a+=" "+g+"\nreturn rval;},\n"}return a+"]"},sb:function(){for(var a=-1,f=0;f<b.a.length;f++)if(b.a[f].M==l.ya){a=f;break}-1==a&&c.error("No EOF-symbol defined - This might not be possible (bug!)");return a},tb:function(){for(var a=-1,f=0;f<b.a.length;f++)if(b.a[f].M==l.ERROR){a=f;break}-1== a&&c.error("No ERROR-symbol defined - This might not be possible (bug!)");return a},wb:function(){return b.ra}};return new k.bb}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/integrity",["require","./global","./log/log","./enums/SYM"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.kc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b=a("./global"),d=a("./enums/SYM");c=a("./log/log");k.Za=function(){};k.Za.prototype={Rb:function(){for(var a=0;a<b.a.length;a++)b.a[a].kind==d.I&&0==b.a[a].Y&&c.error('Call to undefined non-terminal "'+b.a[a].label+'"')},Sb:function(){var a= [],f=[],l,e,m,g;for(l=0;l<b.a.length&&b.a[l].kind!=d.I;l++);if(l!=b.a.length){a.push(l);for(f.push(l);0<a.length;)for(l=a.pop(),e=0;e<b.a[l].w.length;e++)for(m=0;m<b.g[b.a[l].w[e]].h.length;m++)if(b.a[b.g[b.a[l].w[e]].h[m]].kind==d.I){for(g=0;g<f.length&&f[g]!=b.g[b.a[l].w[e]].h[m];g++);g==f.length&&(a.push(b.g[b.a[l].w[e]].h[m]),f.push(b.g[b.a[l].w[e]].h[m]))}for(l=0;l<b.a.length;l++)if(b.a[l].kind==d.I){for(e=0;e<f.length&&f[e]!=l;e++);e==f.length&&c.warn('Unreachable non-terminal "'+b.a[l].label+ '"')}}},mb:function(){for(var a=0;a<b.c.length;a++)0==b.c[a].u.length&&-1==b.c[a].K&&c.error("No lookaheads in state "+a+", watch for endless list definitions")}};return new k.Za}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/lexdbg",["require","./global","./io/io","./enums/EDGE"],c):"object"===typeof module&&module.exports?module.exports=c(Q):a.mc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c;a("./global");a("./enums/EDGE");c=a("./io/io");k.$a=function(){};k.$a.prototype={Fb:function(a){for(var d,h,f=0;f<a.length;f++){d=f+" \x3d\x3e (";for(var l=h=0;l<a[f].b.length;l++)-1<a[f].b[l]&&(d+=" \x3e"+String.fromCharCode(l)+"\x3c,"+a[f].b[l]+ " ",h++,0==h%5&&(d+="\n "));d+=") "+a[f].accept;c.Ub(d)}}};return new k.$a});function X(){k.classes.Da=function(a,c){"number"===typeof a&&(this.start=a);"number"===typeof c&&(this.end=c)};k.classes.Da.prototype.start=-1;k.classes.Da.prototype.end=-1;return k.classes.Da}"function"===typeof R&&R.m?R("lib/jscc/classes/Param",X):"object"===typeof module&&module.exports?module.exports=X():X(); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/regex","require ./global ./log/log ./classes/Param ./classes/Nfa ./enums/EDGE".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.tc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){var c,b,d,h=a("./global"),f=a("./classes/Param"),l=a("./classes/Nfa"),e=a("./enums/EDGE");d=a("./log/log");var m=function(a,d,m){function p(a){this.src=a}function t(){this.R=[{b:[[[[1,[[1,[[[2,3],[4,5]],[1,[6,1]]]],[1, [1,[1,[1,7]]]]]],[[1,[1,[[1,[1,8]],[[13,9],1]]]],[1,[1,[1,[[10,1],1]]]]]],[1,[1,[1,[1,[1,[1,[1,null]]]]]]]]],accept:-1},{b:[],accept:13},{b:[],accept:6},{b:[],accept:7},{b:[],accept:3},{b:[],accept:4},{b:[],accept:10},{b:[],accept:5},{b:[],accept:8},{b:[],accept:9},{b:[],accept:2},{b:[],accept:12},{b:[[[[null,[null,[12,[[12,null],null]]]],null],null]],accept:11},{b:[[[[11,[11,[12,[[12,11],11]]]],11],[11,[11,[11,[11,[11,[11,[11,null]]]]]]]]],accept:13}]}function r(a){this.ma=a}function u(){throw u; }function y(a,b){for(var c=0;c<C[a].length;c+=2)if(C[a][c]===b)return C[a][c+1];return null}r.prototype=Object.create(Error.prototype);r.prototype.constructor=r;r.prototype.ma=null;r.prototype.valueOf=function(){return this.ma};var B=function(){function a(b){return b.G}var b={};return function(c,f){try{return(b[f]||a)(c)}catch(e){if(e instanceof r)return e.valueOf();if(e==u)return u;throw e;}}}();t.prototype.R=[];t.prototype.V=0;t.prototype.state=0;t.prototype.match=null;t.prototype.exec=function(a, b){if(null!==this.state){if("number"!==typeof this.state||this.state>=this.R.length)throw this.state=null,Error("Invalid value for DfaLex.state at chr "+a+" and pos "+b);var c=this.R[this.state].b;if("undefined"===typeof c||null===c){var e=this.state;this.state=null;throw Error("At chr "+a+" and pos "+b+", DfaLex._dfaData["+e+"] appears to exist, but its line property is "+("undefined"===typeof c?"undefined.":"null."));}for(e=256;e;e>>=1){c=0!==(a&e)?c[1]:c[0];"undefined"===typeof c&&(c=null);if(null=== c)break;if(!Array.isArray(c))break}a=this.R[this.state].accept;this.state=c;-1!==a&&(this.match=a,this.V=b)}};var A=[[0,1],[15,1],[14,3],[14,1],[16,2],[16,1],[17,2],[17,2],[17,2],[17,1],[18,1],[18,1],[18,3],[20,3],[20,1],[21,2],[21,0],[19,1],[19,1],[19,1]],C=[[6,8,11,9,12,10,13,11,8,12,10,13],[],[2,14],[6,8,11,9,12,10,13,11,8,12,10,13],[],[5,16,4,17,3,18],[],[],[6,8,11,9,12,10,13,11,8,12,10,13],[],[],[],[],[],[6,8,11,9,12,10,13,11,8,12,10,13],[],[],[],[],[7,22,2,14],[9,24,11,9,12,10,13,11],[6,8,11, 9,12,10,13,11,8,12,10,13],[],[],[]],H=[[15,1,14,2,16,3,17,4,18,5,19,6,20,7],[],[],[17,15,18,5,19,6,20,7],[],[],[],[],[14,19,16,3,17,4,18,5,19,6,20,7],[],[],[],[21,20],[],[16,21,17,4,18,5,19,6,20,7],[],[],[],[],[],[19,23],[17,15,18,5,19,6,20,7],[],[],[]],F=[-1,0,1,3,5,9,10,11,-1,17,18,19,16,14,-1,4,8,7,6,-1,-1,2,12,15,13],v=[{label:"RegEx'",kind:{},prods:[0],nullable:0,id:0,code:"",level:0,special:{},defined:!0,first:[6,11,12,13,8,10]},{label:"ERROR_RESYNC",kind:{},prods:[],nullable:!1,id:1,code:"", level:0,special:{},defined:!0,first:[1]},{label:"|",kind:{},prods:[],nullable:!1,id:2,code:"",level:0,special:{},defined:!1,first:[2]},{label:"*",kind:{},prods:[],nullable:!1,id:3,code:"",level:0,special:{},defined:!1,first:[3]},{label:"+",kind:{},prods:[],nullable:!1,id:4,code:"",level:0,special:{},defined:!1,first:[4]},{label:"?",kind:{},prods:[],nullable:!1,id:5,code:"",level:0,special:{},defined:!1,first:[5]},{label:"(",kind:{},prods:[],nullable:!1,id:6,code:"",level:0,special:{},defined:!1,first:[6]}, {label:")",kind:{},prods:[],nullable:!1,id:7,code:"",level:0,special:{},defined:!1,first:[7]},{label:"[",kind:{},prods:[],nullable:!1,id:8,code:"",level:0,special:{},defined:!1,first:[8]},{label:"]",kind:{},prods:[],nullable:!1,id:9,code:"",level:0,special:{},defined:!1,first:[9]},{label:"ANY_CHAR",kind:{},prods:[],nullable:!1,id:10,code:"",level:0,special:{},defined:!1,first:[10]},{label:"ASCII_CODE",kind:{},prods:[],nullable:!1,id:11,code:"",level:0,special:{},defined:!1,first:[11]},{label:"ESCAPED_CHAR", kind:{},prods:[],nullable:!1,id:12,code:"",level:0,special:{},defined:!1,first:[12]},{label:"ANY",kind:{},prods:[],nullable:!1,id:13,code:"",level:0,special:{},defined:!1,first:[13]},{label:"Expression",kind:{},prods:[2,3],nullable:0,id:14,code:"",level:0,special:{},defined:!0,first:[6,11,12,13,8,10]},{label:"RegEx",kind:{},prods:[1],nullable:0,id:15,code:"",level:0,special:{},defined:!0,first:[6,11,12,13,8,10]},{label:"Catenation",kind:{},prods:[4,5],nullable:0,id:16,code:"",level:0,special:{},defined:!0, first:[6,11,12,13,8,10]},{label:"Factor",kind:{},prods:[6,7,8,9],nullable:0,id:17,code:"",level:0,special:{},defined:!0,first:[6,11,12,13,8,10]},{label:"Term",kind:{},prods:[10,11,12],nullable:0,id:18,code:"",level:0,special:{},defined:!0,first:[6,11,12,13,8,10]},{label:"Character",kind:{},prods:[17,18,19],nullable:0,id:19,code:"",level:0,special:{},defined:!0,first:[11,12,13]},{label:"CharacterSet",kind:{},prods:[13,14],nullable:0,id:20,code:"",level:0,special:{},defined:!0,first:[8,10]},{label:"CharClass", kind:{},prods:[15,16],nullable:1,id:21,code:"",level:0,special:{},defined:!0,first:[11,12,13]},{label:"$",kind:{},prods:[],nullable:!1,id:22,code:"",level:0,special:{},defined:!1,first:[22]}],E=function(){var a=[function(a){return a},function(a){var e;e=new f;h.f.value[c].s=a.start;b=a.end;return e},function(a,b,c){b=new f(h.f.create(),h.f.create());h.f.value[b.start].s=c.start;h.f.value[b.start].D=a.start;h.f.value[c.end].s=b.end;h.f.value[a.end].s=b.end;return b},function(a){return a},function(a, b){var c=h.f.value[b.end].weight;h.f.value[b.end]=new l(h.f.value[a.start]);h.f.value[b.end].weight=c;h.f.value[a.start].J=e.za;b.end=a.end;return b},function(a){return a},function(a,b){a=new f(h.f.create(),h.f.create());h.f.value[a.start].s=b.start;h.f.value[b.end].s=a.end;h.f.value[a.start].D=a.end;h.f.value[b.end].D=b.start;return a},function(a,b){a=new f(h.f.create(),h.f.create());h.f.value[a.start].s=b.start;h.f.value[b.end].s=a.end;h.f.value[b.end].D=b.start;return a},function(a,b){a=new f(h.f.create(), h.f.create());h.f.value[a.start].s=b.start;h.f.value[a.start].D=a.end;h.f.value[b.end].s=a.end;return a},function(a){return a},function(a){var b;b=new f;b.start=h.f.create();b.end=h.f.value[b.start].s=h.f.create();h.f.value[b.start].J=e.da;h.f.value[b.start].C.set(a.charCodeAt(0),!0);return b},function(a){return a},function(a,b){return b},function(a,b){var c=!1,g=0,d;a=new f;a.start=h.f.create();a.end=h.f.value[a.start].s=h.f.create();h.f.value[a.start].J=e.da;if("^"==b.charAt(g)){c=!0;for(d=h.fa;d< h.$;d++)h.f.value[a.start].C.set(d,!0);g++}for(;g<b.length;g++)if("-"==b.charAt(g+1)&&g+2<b.length)for(g++,d=b.charCodeAt(g-1);d<b.charCodeAt(g+1);d++)h.f.value[a.start].C.set(d,!c);else h.f.value[a.start].C.set(b.charCodeAt(g),!c);return a},function(){var a;a=new f;a.start=h.f.create();a.end=h.f.value[a.start].s=h.f.create();h.f.value[a.start].J=e.da;for(var b=h.fa;b<h.$;b++)h.f.value[a.start].C.set(b,!0);return a},function(a,b){return b+a},function(){return""},function(a){return String.fromCharCode(a.substr(1))}, function(a){return{n:"\n",r:"\r",t:"\t",ac:"a"}[a.substr(1)]||a.substr(1)},function(a){return a}];return function(b,c){try{return a[b].apply(null,c)}catch(e){if(e instanceof r)return e.valueOf();throw e;}}}();p.prototype.b=1;p.prototype.offset=0;p.prototype.T=0;p.prototype.src="";p.prototype.G="";p.prototype.H=null;p.prototype.j=null;p.prototype.ba=function(){for(var b,c,e,f=new t,l=!0;l;){f.V=0;c=this.offset+1;do{c--;f.state=0;f.match=null;b=c;if(this.src.length<=b)return this.H=a;do e=this.src.charCodeAt(c), f.exec(e,c),null!==f.state&&this.na(e),c++;while(null!==f.state)}while(-1<d&&f.match===d);if(null!==f.match){this.G=this.src.slice(b,f.V);this.offset=f.V;b=B(this,f.match);null!==f.state&&this.na(e);if(b===u)continue;this.G=b}else this.G="";l=!1}return this.H=f.match};p.prototype.na=function(a){10===a&&this.b++};return function(b,c,e){var f=[0],d=[0],l=0,G,h=0,x=new p(b);c=c||[];e=e||[];for(x.ba();;){x.j=y(f[0],x.H);null===x.j&&0<=F[f[0]]&&(x.j=-F[f[0]]);if(null===x.j){if(0===x.T)for(l++,c.unshift(x.offset- x.G.length),e.unshift([]),h=0;h<C[f[0]].length;h+=2)e[0].push(v[C[f[0]][h]]);for(;1<f.length&&null===x.j;)f.shift(),d.shift(),x.j=y(f[0],x.H),x.j===m&&(f.unshift(x.j),d.unshift(""));if(1<f.length&&null!==x.j)for(;x.H!==a;){x.j=C[f[0]][h+1];if(null!=x.j)break;for(;null!=x.ba();)x.offset++}if(null===x.j||x.H===a)break;x.T=3}if(0<x.j)f.unshift(x.j),d.unshift(x.G),x.ba(),0<x.T&&x.T--;else{G=-x.j;b=E(G,d,x);f.splice(0,A[G][1]);d.splice(0,A[G][1]);var r;a:{r=f[0];for(var t=0;t<H[r].length;t+=2)if(H[r][t]=== A[G][0]){r=H[r][t+1];break a}r=null}x.j=r;if(0===G)break;f.unshift(x.j);d.unshift(b)}}return l}}(22,-1,1);return function(a,f,l,p){var t,r=[],u=[],y;if(""!=a)if(p=p||0,c=h.f.create(),0==(y=m(a,r,u))){if(l)for(l=0;l<h.f.value.length;l++)if(h.f.value[l].J==e.da)for(t=h.fa;t<h.$;t++)h.f.value[l].C.get(t)&&(h.f.value[l].C.set(String.fromCharCode(t).toUpperCase().charCodeAt(0),!0),h.f.value[l].C.set(String.fromCharCode(t).toLowerCase().charCodeAt(0),!0));h.f.value[b].accept=f;h.f.value[b].weight=h.fb++; if(0<c){for(l=0;-1!=h.f.value[l].D;)l=h.f.value[l].D;h.f.value[l].D=c}}else for(l=0;l<y;l++){f="";for(t=0;t<r[l];t++)f+=" ";d.error("Regular expression:\n\t"+a+"\n\t"+f+"^ expecting "+u[l].join()+" on line "+p)}}}); (function(a,c){"function"===typeof R&&R.m?R("lib/jscc/parse","require ./global ./regex ./tabgen ./log/log ./classes/Production ./enums/ASSOC ./enums/SYM ./enums/SPECIAL".split(" "),c):"object"===typeof module&&module.exports?module.exports=c(Q):a.rc=c(function(b){return a["jscc"+b.split("/").pop()]})})(this,function(a){function c(a,c){b.error("line "+a+": "+c)}var b,d=a("./global"),h=a("./regex"),f=a("./tabgen"),l=a("./classes/Production"),e=a("./enums/ASSOC"),m=a("./enums/SYM"),g=a("./enums/SPECIAL"); b=a("./log/log");var w,q,p=function(a,b,p){function y(a){this.src=a}function B(){this.R=[{b:[[[[[[null,[[[null,1],[2,null]],[[null,1],null]]],null],[[[[[1,3],[19,22]],[null,[4,23]]],[null,[[null,5],[null,24]]]],[5,[[5,[6,7]],[[8,25],[9,null]]]]]],[[[[[[null,5],5],5],5],[5,[[5,[5,26]],[null,[10,5]]]]],[[[[[null,5],5],5],5],[5,[[5,[5,null]],[[11,null],[12,null]]]]]]],null]],accept:-1},{b:[[[[[[null,[[[null,1],null],[[null,1],null]]],null],[[[[[1,null],null],null],null],null