!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=32)}([function(t,e){function n(t){return"["+t.join(", ")+"]"}function r(t,e){return t.equals(e)}function i(t){return t.hashCode()}function o(t,e){return this.data={},this.hashFunction=t||i,this.equalsFunction=e||r,this}function s(){return this.data=[],this}function a(t,e){return this.data={},this.hashFunction=t||i,this.equalsFunction=e||r,this}function l(){return this.data={},this}function u(){return this}function c(){return this.count=0,this.hash=0,this}String.prototype.seed=String.prototype.seed||Math.round(Math.random()*Math.pow(2,32)),String.prototype.hashCode=function(){var t,e,n,r,i,o,s,a,l=this.toString();for(t=3&l.length,e=l.length-t,n=String.prototype.seed,i=3432918353,o=461845907,a=0;a>>16)*i&65535)<<16)&4294967295)<<15|s>>>17))*o+(((s>>>16)*o&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(s=0,t){case 3:s^=(255&l.charCodeAt(a+2))<<16;case 2:s^=(255&l.charCodeAt(a+1))<<8;case 1:n^=s=(65535&(s=(s=(65535&(s^=255&l.charCodeAt(a)))*i+(((s>>>16)*i&65535)<<16)&4294967295)<<15|s>>>17))*o+(((s>>>16)*o&65535)<<16)&4294967295}return n^=l.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0},Object.defineProperty(o.prototype,"length",{get:function(){var t=0;for(var e in this.data)0===e.indexOf("hash_")&&(t+=this.data[e].length);return t}}),o.prototype.add=function(t){var e="hash_"+this.hashFunction(t);if(e in this.data){for(var n=this.data[e],r=0;r>>17,n*=461845907,this.count=this.count+1;var r=this.hash^n;r=5*(r=r<<13|r>>>19)+3864292196,this.hash=r}}},c.prototype.finish=function(){var t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16},u.prototype.get=function(t,e){var n=this[t]||null;return null===n?null:n[e]||null},u.prototype.set=function(t,e,n){var r=this[t]||null;null===r&&(r={},this[t]=r),r[e]=n},e.Hash=c,e.Set=o,e.Map=a,e.BitSet=s,e.AltDict=l,e.DoubleDict=u,e.hashStuff=function(){var t=new c;return t.update.apply(arguments),t.finish()},e.escapeWhitespace=function(t,e){return t=(t=(t=t.replace("\t","\\t")).replace("\n","\\n")).replace("\r","\\r"),e&&(t=t.replace(" ","·")),t},e.arrayToString=n,e.titleCase=function(t){return t.replace(/\w\S*/g,function(t){return t.charAt(0).toUpperCase()+t.substr(1)})},e.equalArrays=function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n"},set:function(t){this._text=t}}),r.prototype.toString=function(){var t=this.text;return t=null!==t?t.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+t+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"},e.Token=n,e.CommonToken=r},function(t,e,n){var r=n(1).Token;function i(t,e){return this.start=t,this.stop=e,this}function o(){this.intervals=null,this.readOnly=!1}i.prototype.contains=function(t){return t>=this.start&&t=n.stop?(this.intervals.pop(t+1),this.reduce(t)):e.stop>=n.start&&(this.intervals[t]=new i(e.start,n.stop),this.intervals.pop(t+1))}},o.prototype.complement=function(t,e){var n=new o;n.addInterval(new i(t,e+1));for(var r=0;rr.start&&t.stop=r.stop?(this.intervals.splice(e,1),e-=1):t.start"):t.push("'"+String.fromCharCode(n.start)+"'"):t.push("'"+String.fromCharCode(n.start)+"'..'"+String.fromCharCode(n.stop-1)+"'")}return t.length>1?"{"+t.join(", ")+"}":t[0]},o.prototype.toIndexString=function(){for(var t=[],e=0;e"):t.push(n.start.toString()):t.push(n.start.toString()+".."+(n.stop-1).toString())}return t.length>1?"{"+t.join(", ")+"}":t[0]},o.prototype.toTokenString=function(t,e){for(var n=[],r=0;r1?"{"+n.join(", ")+"}":n[0]},o.prototype.elementName=function(t,e,n){return n===r.EOF?"":n===r.EPSILON?"":t[n]||e[n]},e.Interval=i,e.IntervalSet=o},function(t,e){function n(){return this.atn=null,this.stateNumber=n.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null,this}function r(){return n.call(this),this.stateType=n.BASIC,this}function i(){return n.call(this),this.decision=-1,this.nonGreedy=!1,this}function o(){return i.call(this),this.endState=null,this}function s(){return o.call(this),this.stateType=n.BLOCK_START,this}function a(){return n.call(this),this.stateType=n.BLOCK_END,this.startState=null,this}function l(){return n.call(this),this.stateType=n.RULE_STOP,this}function u(){return n.call(this),this.stateType=n.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}function c(){return i.call(this),this.stateType=n.PLUS_LOOP_BACK,this}function h(){return o.call(this),this.stateType=n.PLUS_BLOCK_START,this.loopBackState=null,this}function p(){return o.call(this),this.stateType=n.STAR_BLOCK_START,this}function f(){return n.call(this),this.stateType=n.STAR_LOOP_BACK,this}function d(){return i.call(this),this.stateType=n.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}function y(){return n.call(this),this.stateType=n.LOOP_END,this.loopBackState=null,this}function g(){return i.call(this),this.stateType=n.TOKEN_START,this}n.INVALID_TYPE=0,n.BASIC=1,n.RULE_START=2,n.BLOCK_START=3,n.PLUS_BLOCK_START=4,n.STAR_BLOCK_START=5,n.TOKEN_START=6,n.RULE_STOP=7,n.BLOCK_END=8,n.STAR_LOOP_BACK=9,n.STAR_LOOP_ENTRY=10,n.PLUS_LOOP_BACK=11,n.LOOP_END=12,n.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],n.INVALID_STATE_NUMBER=-1,n.prototype.toString=function(){return this.stateNumber},n.prototype.equals=function(t){return t instanceof n&&this.stateNumber===t.stateNumber},n.prototype.isNonGreedyExitState=function(){return!1},n.prototype.addTransition=function(t,e){void 0===e&&(e=-1),0===this.transitions.length?this.epsilonOnlyTransitions=t.isEpsilon:this.epsilonOnlyTransitions!==t.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===e?this.transitions.push(t):this.transitions.splice(e,1,t)},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,i.prototype=Object.create(n.prototype),i.prototype.constructor=i,o.prototype=Object.create(i.prototype),o.prototype.constructor=o,s.prototype=Object.create(o.prototype),s.prototype.constructor=s,a.prototype=Object.create(n.prototype),a.prototype.constructor=a,l.prototype=Object.create(n.prototype),l.prototype.constructor=l,u.prototype=Object.create(n.prototype),u.prototype.constructor=u,c.prototype=Object.create(i.prototype),c.prototype.constructor=c,h.prototype=Object.create(o.prototype),h.prototype.constructor=h,p.prototype=Object.create(o.prototype),p.prototype.constructor=p,f.prototype=Object.create(n.prototype),f.prototype.constructor=f,d.prototype=Object.create(i.prototype),d.prototype.constructor=d,y.prototype=Object.create(n.prototype),y.prototype.constructor=y,g.prototype=Object.create(i.prototype),g.prototype.constructor=g,e.ATNState=n,e.BasicState=r,e.DecisionState=i,e.BlockStartState=o,e.BlockEndState=a,e.LoopEndState=y,e.RuleStartState=u,e.RuleStopState=l,e.TokensStartState=g,e.PlusLoopbackState=c,e.StarLoopbackState=f,e.StarLoopEntryState=d,e.PlusBlockStartState=h,e.StarBlockStartState=p,e.BasicBlockStartState=s},function(t,e,n){var r=n(1).Token,i=n(2).Interval,o=new i(-1,-2);n(0);function s(){return this}function a(){return s.call(this),this}function l(){return a.call(this),this}function u(){return l.call(this),this}function c(){return l.call(this),this}function h(){return c.call(this),this}function p(){return this}function f(){return this}function d(t){return c.call(this),this.parentCtx=null,this.symbol=t,this}function y(t){return d.call(this,t),this}function g(){return this}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,l.prototype=Object.create(a.prototype),l.prototype.constructor=l,u.prototype=Object.create(l.prototype),u.prototype.constructor=u,c.prototype=Object.create(l.prototype),c.prototype.constructor=c,h.prototype=Object.create(c.prototype),h.prototype.constructor=h,p.prototype.visit=function(t){return Array.isArray(t)?t.map(function(t){return t.accept(this)},this):t.accept(this)},p.prototype.visitChildren=function(t){return this.visit(t.children)},p.prototype.visitTerminal=function(t){},p.prototype.visitErrorNode=function(t){},f.prototype.visitTerminal=function(t){},f.prototype.visitErrorNode=function(t){},f.prototype.enterEveryRule=function(t){},f.prototype.exitEveryRule=function(t){},d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.getChild=function(t){return null},d.prototype.getSymbol=function(){return this.symbol},d.prototype.getParent=function(){return this.parentCtx},d.prototype.getPayload=function(){return this.symbol},d.prototype.getSourceInterval=function(){if(null===this.symbol)return o;var t=this.symbol.tokenIndex;return new i(t,t)},d.prototype.getChildCount=function(){return 0},d.prototype.accept=function(t){return t.visitTerminal(this)},d.prototype.getText=function(){return this.symbol.text},d.prototype.toString=function(){return this.symbol.type===r.EOF?"":this.symbol.text},y.prototype=Object.create(d.prototype),y.prototype.constructor=y,y.prototype.isErrorNode=function(){return!0},y.prototype.accept=function(t){return t.visitErrorNode(this)},g.prototype.walk=function(t,e){if(e instanceof h||void 0!==e.isErrorNode&&e.isErrorNode())t.visitErrorNode(e);else if(e instanceof c)t.visitTerminal(e);else{this.enterRule(t,e);for(var n=0;n=0&&this.startIndexe.returnState&&(f[0]=e.returnState,f[1]=t.returnState);var d=[p,p],y=new u(d,f);return null!==r&&r.set(t,e,y),y}var f=[t.returnState,e.returnState],d=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(f[0]=e.returnState,f[1]=t.returnState,d=[e.parentCtx,t.parentCtx]);var g=new u(d,f);return null!==r&&r.set(t,e,g),g}(t,e,n,r);if(n){if(t instanceof l)return t;if(e instanceof l)return e}return t instanceof a&&(t=new u([t.getParent()],[t.returnState])),e instanceof a&&(e=new u([e.getParent()],[e.returnState])),function(t,e,n,r){if(null!==r){var i=r.get(t,e);if(null!==i)return i;if(null!==(i=r.get(e,t)))return i}var s=0,l=0,h=0,p=[],f=[];for(;s0&&(t+=", "),this.returnStates[e]!==o.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"},e.merge=c,e.PredictionContext=o,e.PredictionContextCache=s,e.SingletonPredictionContext=a,e.predictionContextFromRuleContext=function t(e,n){if(void 0!==n&&null!==n||(n=r.EMPTY),null===n.parentCtx||n===r.EMPTY)return o.EMPTY;var i=t(e,n.parentCtx),s=e.states[n.invokingState].transitions[0];return a.create(i,s.followState.stateNumber)},e.getCachedPredictionContext=function t(e,n,r){if(e.isEmpty())return e;var i=r[e]||null;if(null!==i)return i;if(null!==(i=n.get(e)))return r[e]=i,i;for(var s=!1,l=[],c=0;c=this.states.length)throw"Invalid state number.";var n=this.states[t],r=this.nextTokens(n);if(!r.contains(s.EPSILON))return r;var o=new i;for(o.addSet(r),o.removeOne(s.EPSILON);null!==e&&e.invokingState>=0&&r.contains(s.EPSILON);){var a=this.states[e.invokingState].transitions[0];r=this.nextTokens(a.followState),o.addSet(r),o.removeOne(s.EPSILON),e=e.parentCtx}return r.contains(s.EPSILON)&&o.addOne(s.EOF),o},o.INVALID_ALT_NUMBER=0,e.ATN=o},function(t,e,n){var r=n(1).Token,i=(n(2).Interval,n(2).IntervalSet),o=n(10).Predicate,s=n(10).PrecedencePredicate;function a(t){if(void 0===t||null===t)throw"target cannot be null.";return this.target=t,this.isEpsilon=!1,this.label=null,this}function l(t,e){return a.call(this,t),this.label_=e,this.label=this.makeLabel(),this.serializationType=a.ATOM,this}function u(t,e,n,r){return a.call(this,t),this.ruleIndex=e,this.precedence=n,this.followState=r,this.serializationType=a.RULE,this.isEpsilon=!0,this}function c(t,e){return a.call(this,t),this.serializationType=a.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e,this}function h(t,e,n){return a.call(this,t),this.serializationType=a.RANGE,this.start=e,this.stop=n,this.label=this.makeLabel(),this}function p(t){return a.call(this,t),this}function f(t,e,n,r){return p.call(this,t),this.serializationType=a.PREDICATE,this.ruleIndex=e,this.predIndex=n,this.isCtxDependent=r,this.isEpsilon=!0,this}function d(t,e,n,r){return a.call(this,t),this.serializationType=a.ACTION,this.ruleIndex=e,this.actionIndex=void 0===n?-1:n,this.isCtxDependent=void 0!==r&&r,this.isEpsilon=!0,this}function y(t,e){return a.call(this,t),this.serializationType=a.SET,void 0!==e&&null!==e?this.label=e:(this.label=new i,this.label.addOne(r.INVALID_TYPE)),this}function g(t,e){return y.call(this,t,e),this.serializationType=a.NOT_SET,this}function x(t){return a.call(this,t),this.serializationType=a.WILDCARD,this}function v(t,e){return p.call(this,t),this.serializationType=a.PRECEDENCE,this.precedence=e,this.isEpsilon=!0,this}a.EPSILON=1,a.RANGE=2,a.RULE=3,a.PREDICATE=4,a.ATOM=5,a.ACTION=6,a.SET=7,a.NOT_SET=8,a.WILDCARD=9,a.PRECEDENCE=10,a.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],a.serializationTypes={EpsilonTransition:a.EPSILON,RangeTransition:a.RANGE,RuleTransition:a.RULE,PredicateTransition:a.PREDICATE,AtomTransition:a.ATOM,ActionTransition:a.ACTION,SetTransition:a.SET,NotSetTransition:a.NOT_SET,WildcardTransition:a.WILDCARD,PrecedencePredicateTransition:a.PRECEDENCE},l.prototype=Object.create(a.prototype),l.prototype.constructor=l,l.prototype.makeLabel=function(){var t=new i;return t.addOne(this.label_),t},l.prototype.matches=function(t,e,n){return this.label_===t},l.prototype.toString=function(){return this.label_},u.prototype=Object.create(a.prototype),u.prototype.constructor=u,u.prototype.matches=function(t,e,n){return!1},c.prototype=Object.create(a.prototype),c.prototype.constructor=c,c.prototype.matches=function(t,e,n){return!1},c.prototype.toString=function(){return"epsilon"},h.prototype=Object.create(a.prototype),h.prototype.constructor=h,h.prototype.makeLabel=function(){var t=new i;return t.addRange(this.start,this.stop),t},h.prototype.matches=function(t,e,n){return t>=this.start&&t<=this.stop},h.prototype.toString=function(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"},p.prototype=Object.create(a.prototype),p.prototype.constructor=p,f.prototype=Object.create(p.prototype),f.prototype.constructor=f,f.prototype.matches=function(t,e,n){return!1},f.prototype.getPredicate=function(){return new o(this.ruleIndex,this.predIndex,this.isCtxDependent)},f.prototype.toString=function(){return"pred_"+this.ruleIndex+":"+this.predIndex},d.prototype=Object.create(a.prototype),d.prototype.constructor=d,d.prototype.matches=function(t,e,n){return!1},d.prototype.toString=function(){return"action_"+this.ruleIndex+":"+this.actionIndex},y.prototype=Object.create(a.prototype),y.prototype.constructor=y,y.prototype.matches=function(t,e,n){return this.label.contains(t)},y.prototype.toString=function(){return this.label.toString()},g.prototype=Object.create(y.prototype),g.prototype.constructor=g,g.prototype.matches=function(t,e,n){return t>=e&&t<=n&&!y.prototype.matches.call(this,t,e,n)},g.prototype.toString=function(){return"~"+y.prototype.toString.call(this)},x.prototype=Object.create(a.prototype),x.prototype.constructor=x,x.prototype.matches=function(t,e,n){return t>=e&&t<=n},x.prototype.toString=function(){return"."},v.prototype=Object.create(p.prototype),v.prototype.constructor=v,v.prototype.matches=function(t,e,n){return!1},v.prototype.getPredicate=function(){return new s(this.precedence)},v.prototype.toString=function(){return this.precedence+" >= _p"},e.Transition=a,e.AtomTransition=l,e.SetTransition=y,e.NotSetTransition=g,e.RuleTransition=u,e.ActionTransition=d,e.EpsilonTransition=c,e.RangeTransition=h,e.WildcardTransition=x,e.PredicateTransition=f,e.PrecedencePredicateTransition=v,e.AbstractPredicateTransition=p},function(t,e,n){var r=n(7).ATN,i=n(0),o=i.Hash,s=i.Set,a=n(10).SemanticContext,l=n(6).merge;function u(t){return t.hashCodeForConfigSet()}function c(t,e){return t===e||null!==t&&null!==e&&t.equalsForConfigSet(e)}function h(t){return this.configLookup=new s(u,c),this.fullCtx=void 0===t||t,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1,this}function p(){return h.call(this),this.configLookup=new s,this}h.prototype.add=function(t,e){if(void 0===e&&(e=null),this.readOnly)throw"This set is readonly";t.semanticContext!==a.NONE&&(this.hasSemanticContext=!0),t.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);var n=this.configLookup.add(t);if(n===t)return this.cachedHashCode=-1,this.configs.push(t),!0;var r=!this.fullCtx,i=l(n.context,t.context,r,e);return n.reachesIntoOuterContext=Math.max(n.reachesIntoOuterContext,t.reachesIntoOuterContext),t.precedenceFilterSuppressed&&(n.precedenceFilterSuppressed=!0),n.context=i,!0},h.prototype.getStates=function(){for(var t=new s,e=0;e0){var s=null;i.map(function(t){(null===s||t.precedence0){var s=i.sort(function(t,e){return t.compareTo(e)}),l=s[s.length-1];n.add(l)}return this.opnds=n.values(),this}o.prototype.hashCode=function(){var t=new i;return this.updateHashCode(t),t.finish()},o.prototype.evaluate=function(t,e){},o.prototype.evalPrecedence=function(t,e){return this},o.andContext=function(t,e){if(null===t||t===o.NONE)return e;if(null===e||e===o.NONE)return t;var n=new l(t,e);return 1===n.opnds.length?n.opnds[0]:n},o.orContext=function(t,e){if(null===t)return e;if(null===e)return t;if(t===o.NONE||e===o.NONE)return o.NONE;var n=new u(t,e);return 1===n.opnds.length?n.opnds[0]:n},s.prototype=Object.create(o.prototype),s.prototype.constructor=s,o.NONE=new s,s.prototype.evaluate=function(t,e){var n=this.isCtxDependent?e:null;return t.sempred(n,this.ruleIndex,this.predIndex)},s.prototype.updateHashCode=function(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)},s.prototype.equals=function(t){return this===t||t instanceof s&&(this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent)},s.prototype.toString=function(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"},a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype.evaluate=function(t,e){return t.precpred(e,this.precedence)},a.prototype.evalPrecedence=function(t,e){return t.precpred(e,this.precedence)?o.NONE:null},a.prototype.compareTo=function(t){return this.precedence-t.precedence},a.prototype.updateHashCode=function(t){t.update(31)},a.prototype.equals=function(t){return this===t||t instanceof a&&this.precedence===t.precedence},a.prototype.toString=function(){return"{"+this.precedence+">=prec}?"},a.filterPrecedencePredicates=function(t){var e=[];return t.values().map(function(t){t instanceof a&&e.push(t)}),e},l.prototype=Object.create(o.prototype),l.prototype.constructor=l,l.prototype.equals=function(t){return this===t||t instanceof l&&this.opnds===t.opnds},l.prototype.updateHashCode=function(t){t.update(this.opnds,"AND")},l.prototype.evaluate=function(t,e){for(var n=0;n3?t.slice(3):t},u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.prototype.constructor=function(t){return this===t||t instanceof u&&this.opnds===t.opnds},u.prototype.updateHashCode=function(t){t.update(this.opnds,"OR")},u.prototype.evaluate=function(t,e){for(var n=0;n3?t.slice(3):t},e.SemanticContext=o,e.PrecedencePredicate=a,e.Predicate=s},function(t,e,n){var r=n(9).ATNConfigSet,i=n(0),o=i.Hash,s=i.Set;function a(t,e){return this.alt=e,this.pred=t,this}function l(t,e){return null===t&&(t=-1),null===e&&(e=new r),this.stateNumber=t,this.configs=e,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}a.prototype.toString=function(){return"("+this.pred+", "+this.alt+")"},l.prototype.getAltSet=function(){var t=new s;if(null!==this.configs)for(var e=0;e0?",up="+this.reachesIntoOuterContext:"")+")"},l.prototype=Object.create(a.prototype),l.prototype.constructor=l,l.prototype.updateHashCode=function(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)},l.prototype.equals=function(t){return this===t||t instanceof l&&this.passedThroughNonGreedyDecision==t.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(t.lexerActionExecutor):!t.lexerActionExecutor)&&a.prototype.equals.call(this,t)},l.prototype.hashCodeForConfigSet=l.prototype.hashCode,l.prototype.equalsForConfigSet=l.prototype.equals,l.prototype.checkNonGreedyDecision=function(t,e){return t.passedThroughNonGreedyDecision||e instanceof r&&e.nonGreedy},e.ATNConfig=a,e.LexerATNConfig=l},function(t,e,n){var r=n(4).RuleNode,i=n(4).INVALID_INTERVAL,o=n(7).INVALID_ALT_NUMBER;function s(t,e){return r.call(this),this.parentCtx=t||null,this.invokingState=e||-1,this}s.prototype=Object.create(r.prototype),s.prototype.constructor=s,s.prototype.depth=function(){for(var t=0,e=this;null!==e;)e=e.parentCtx,t+=1;return t},s.prototype.isEmpty=function(){return-1===this.invokingState},s.prototype.getSourceInterval=function(){return i},s.prototype.getRuleContext=function(){return this},s.prototype.getPayload=function(){return this},s.prototype.getText=function(){return 0===this.getChildCount()?"":this.children.map(function(t){return t.getText()}).join("")},s.prototype.getAltNumber=function(){return o},s.prototype.setAltNumber=function(t){},s.prototype.getChild=function(t){return null},s.prototype.getChildCount=function(){return 0},s.prototype.accept=function(t){return t.visitChildren(this)},e.RuleContext=s;var a=n(21).Trees;s.prototype.toStringTree=function(t,e){return a.toStringTree(this,t,e)},s.prototype.toString=function(t,e){t=t||null,e=e||null;for(var n=this,r="[";null!==n&&n!==e;){if(null===t)n.isEmpty()||(r+=n.invokingState);else{var i=n.ruleIndex;r+=i>=0&&i":"\n"===t?"\\n":"\t"===t?"\\t":"\r"===t?"\\r":t},l.prototype.getCharErrorDisplay=function(t){return"'"+this.getErrorDisplayForChar(t)+"'"},l.prototype.recover=function(t){this._input.LA(1)!==r.EOF&&(t instanceof a?this._interp.consume(this._input):this._input.consume())},e.Lexer=l},function(t,e){function n(){return this}function r(){return n.call(this),this}function i(t){if(n.call(this),null===t)throw"delegates";return this.delegates=t,this}n.prototype.syntaxError=function(t,e,n,r,i,o){},n.prototype.reportAmbiguity=function(t,e,n,r,i,o,s){},n.prototype.reportAttemptingFullContext=function(t,e,n,r,i,o){},n.prototype.reportContextSensitivity=function(t,e,n,r,i,o){},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.INSTANCE=new r,r.prototype.syntaxError=function(t,e,n,r,i,o){console.error("line "+n+":"+r+" "+i)},i.prototype=Object.create(n.prototype),i.prototype.constructor=i,i.prototype.syntaxError=function(t,e,n,r,i,o){this.delegates.map(function(s){s.syntaxError(t,e,n,r,i,o)})},i.prototype.reportAmbiguity=function(t,e,n,r,i,o,s){this.delegates.map(function(a){a.reportAmbiguity(t,e,n,r,i,o,s)})},i.prototype.reportAttemptingFullContext=function(t,e,n,r,i,o){this.delegates.map(function(s){s.reportAttemptingFullContext(t,e,n,r,i,o)})},i.prototype.reportContextSensitivity=function(t,e,n,r,i,o){this.delegates.map(function(s){s.reportContextSensitivity(t,e,n,r,i,o)})},e.ErrorListener=n,e.ConsoleErrorListener=r,e.ProxyErrorListener=i},function(t,e){function n(t,e,n){return this.dfa=t,this.literalNames=e||[],this.symbolicNames=n||[],this}function r(t){return n.call(this,t,null),this}n.prototype.toString=function(){if(null===this.dfa.s0)return null;for(var t="",e=this.dfa.sortedStates(),n=0;n")).concat(this.getStateString(s))).concat("\n"))}}return 0===t.length?null:t},n.prototype.getEdgeLabel=function(t){return 0===t?"EOF":null!==this.literalNames||null!==this.symbolicNames?this.literalNames[t-1]||this.symbolicNames[t-1]:String.fromCharCode(t-1)},n.prototype.getStateString=function(t){var e=(t.isAcceptState?":":"")+"s"+t.stateNumber+(t.requiresFullContext?"^":"");return t.isAcceptState?null!==t.predicates?e+"=>"+t.predicates.toString():e+"=>"+t.prediction.toString():e},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.prototype.getEdgeLabel=function(t){return"'"+String.fromCharCode(t)+"'"},e.DFASerializer=n,e.LexerDFASerializer=r},function(t,e,n){var r=n(14).RuleContext,i=n(4),o=i.INVALID_INTERVAL,s=i.TerminalNode,a=i.TerminalNodeImpl,l=i.ErrorNodeImpl,u=n(2).Interval;function c(t,e){t=t||null,e=e||null,r.call(this,t,e),this.ruleIndex=-1,this.children=null,this.start=null,this.stop=null,this.exception=null}function h(t,e,n){return c.call(t,e),this.ruleIndex=n,this}c.prototype=Object.create(r.prototype),c.prototype.constructor=c,c.prototype.copyFrom=function(t){this.parentCtx=t.parentCtx,this.invokingState=t.invokingState,this.children=null,this.start=t.start,this.stop=t.stop,t.children&&(this.children=[],t.children.map(function(t){t instanceof l&&(this.children.push(t),t.parentCtx=this)},this))},c.prototype.enterRule=function(t){},c.prototype.exitRule=function(t){},c.prototype.addChild=function(t){return null===this.children&&(this.children=[]),this.children.push(t),t},c.prototype.removeLastChild=function(){null!==this.children&&this.children.pop()},c.prototype.addTokenNode=function(t){var e=new a(t);return this.addChild(e),e.parentCtx=this,e},c.prototype.addErrorNode=function(t){var e=new l(t);return this.addChild(e),e.parentCtx=this,e},c.prototype.getChild=function(t,e){if(e=e||null,null===this.children||t<0||t>=this.children.length)return null;if(null===e)return this.children[t];for(var n=0;n=this.children.length)return null;for(var n=0;n=this._size)throw"cannot consume EOF";this._index+=1},i.prototype.LA=function(t){if(0===t)return 0;t<0&&(t+=1);var e=this._index+t-1;return e<0||e>=this._size?r.EOF:this.data[e]},i.prototype.LT=function(t){return this.LA(t)},i.prototype.mark=function(){return-1},i.prototype.release=function(t){},i.prototype.seek=function(t){t<=this._index?this._index=t:this._index=Math.min(t,this._size)},i.prototype.getText=function(t,e){if(e>=this._size&&(e=this._size-1),t>=this._size)return"";if(this.decodeToUnicodeCodePoints){for(var n="",r=t;r<=e;r++)n+=String.fromCodePoint(this.data[r]);return n}return this.strdata.slice(t,e+1)},i.prototype.toString=function(){return this.strdata},e.InputStream=i},function(t,e,n){var r=n(12);function i(){return r.tree.ParseTreeVisitor.call(this),this}i.prototype=Object.create(r.tree.ParseTreeVisitor.prototype),i.prototype.constructor=i,i.prototype.visitGrammarFile=function(t){return this.visitChildren(t)},i.prototype.visitGrammerDecl=function(t){return this.visitChildren(t)},i.prototype.visitStatExprSplit=function(t){return this.visitChildren(t)},i.prototype.visitStatList=function(t){return this.visitChildren(t)},i.prototype.visitStatValue=function(t){return this.visitChildren(t)},i.prototype.visitExprExpression=function(t){return this.visitChildren(t)},i.prototype.visitExprValue=function(t){return this.visitChildren(t)},i.prototype.visitArithmeticRuleCollection=function(t){return this.visitChildren(t)},i.prototype.visitParserAtomExpr=function(t){return this.visitChildren(t)},i.prototype.visitParserAtomParserId=function(t){return this.visitChildren(t)},i.prototype.visitParserAtomLexerId=function(t){return this.visitChildren(t)},i.prototype.visitParserAtomStr=function(t){return this.visitChildren(t)},i.prototype.visitLexerRuleCollection=function(t){return this.visitChildren(t)},i.prototype.visitMeaningfulSplit=function(t){return this.visitChildren(t)},i.prototype.visitLexerRuleStrings=function(t){return this.visitChildren(t)},i.prototype.visitLexerRuleList=function(t){return this.visitChildren(t)},i.prototype.visitLexerRuleComplex=function(t){return this.visitChildren(t)},i.prototype.visitStrings=function(t){return this.visitChildren(t)},i.prototype.visitLexerRuleExpr=function(t){return this.visitChildren(t)},e.BlocklyGrammerVisitor=i},function(t,e,n){var r=n(0),i=n(1).Token,o=(n(4).RuleNode,n(4).ErrorNode),s=n(4).TerminalNode,a=n(18).ParserRuleContext,l=n(14).RuleContext,u=n(7).INVALID_ALT_NUMBER;function c(){}c.toStringTree=function(t,e,n){e=e||null,null!==(n=n||null)&&(e=n.ruleNames);var i=c.getNodeText(t,e);i=r.escapeWhitespace(i,!1);var o=t.getChildCount();if(0===o)return i;var s="("+i+" ";o>0&&(i=c.toStringTree(t.getChild(0),e),s=s.concat(i));for(var a=1;a=n},W.prototype.deserialize=function(t){this.reset(t),this.checkVersion(),this.checkUUID();var e=this.readATN();this.readStates(e),this.readRules(e),this.readModes(e);var n=[];return this.readSets(e,n,this.readInt.bind(this)),this.isFeatureSupported(Y,this.uuid)&&this.readSets(e,n,this.readInt32.bind(this)),this.readEdges(e,n),this.readDecisions(e),this.readLexerActions(e),this.markPrecedenceDecisions(e),this.verifyATN(e),this.deserializationOptions.generateRuleBypassTransitions&&e.grammarType===o.PARSER&&(this.generateRuleBypassTransitions(e),this.verifyATN(e)),e},W.prototype.reset=function(t){var e=t.split("").map(function(t){var e=t.charCodeAt(0);return e>1?e-2:-1});e[0]=t.charCodeAt(0),this.data=e,this.pos=0},W.prototype.checkVersion=function(){var t=this.readInt();if(3!==t)throw"Could not deserialize ATN with version "+t+" (expected 3)."},W.prototype.checkUUID=function(){var t=this.readUUID();if(K.indexOf(t)<0)throw"59627784-3BE5-417A-B9EB-8131A7286089";this.uuid=t},W.prototype.readATN=function(){var t=this.readInt(),e=this.readInt();return new i(t,e)},W.prototype.readStates=function(t){for(var e,n,r,i=[],o=[],s=this.readInt(),l=0;l0;)i.addTransition(p.transitions[f-1]),p.transitions=p.transitions.slice(-1);t.ruleToStartState[e].addTransition(new N(i)),o.addTransition(new N(a));var d=new l;t.addState(d),d.addTransition(new C(o,t.ruleToTokenType[e])),i.addTransition(new N(d))},W.prototype.stateIsEndStateFor=function(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof v))return null;var n=t.transitions[t.transitions.length-1].target;return n instanceof p&&n.epsilonOnlyTransitions&&n.transitions[0].target instanceof d?t:null},W.prototype.markPrecedenceDecisions=function(t){for(var e=0;e=0):this.checkCondition(n.transitions.length<=1||n instanceof d)}},W.prototype.checkCondition=function(t,e){if(!t)throw void 0!==e&&null!==e||(e="IllegalState"),e},W.prototype.readInt=function(){return this.data[this.pos++]},W.prototype.readInt32=function(){return this.readInt()|this.readInt()<<16},W.prototype.readLong=function(){return 4294967295&this.readInt32()|this.readInt32()<<32};var X=function(){for(var t=[],e=0;e<256;e++)t[e]=(e+256).toString(16).substr(1).toUpperCase();return t}();W.prototype.readUUID=function(){for(var t=[],e=7;e>=0;e--){var n=this.readInt();t[2*e+1]=255&n,t[2*e]=n>>8&255}return X[t[0]]+X[t[1]]+X[t[2]]+X[t[3]]+"-"+X[t[4]]+X[t[5]]+"-"+X[t[6]]+X[t[7]]+"-"+X[t[8]]+X[t[9]]+"-"+X[t[10]]+X[t[11]]+X[t[12]]+X[t[13]]+X[t[14]]+X[t[15]]},W.prototype.edgeFactory=function(t,e,n,i,o,s,a,l){var u=t.states[i];switch(e){case E.EPSILON:return new N(u);case E.RANGE:return new R(u,0!==a?r.EOF:o,s);case E.RULE:return new b(t.states[o],s,a,u);case E.PREDICATE:return new O(u,o,s,0!==a);case E.PRECEDENCE:return new P(u,o);case E.ATOM:return new C(u,0!==a?r.EOF:o);case E.ACTION:return new L(u,o,s,0!==a);case E.SET:return new A(u,l[o]);case E.NOT_SET:return new k(u,l[o]);case E.WILDCARD:return new I(u);default:throw"The specified transition type: "+e+" is not valid."}},W.prototype.stateFactory=function(t,e){if(null===this.stateFactories){var n=[];n[a.INVALID_TYPE]=null,n[a.BASIC]=function(){return new l},n[a.RULE_START]=function(){return new f},n[a.BLOCK_START]=function(){return new T},n[a.PLUS_BLOCK_START]=function(){return new m},n[a.STAR_BLOCK_START]=function(){return new _},n[a.TOKEN_START]=function(){return new y},n[a.RULE_STOP]=function(){return new d},n[a.BLOCK_END]=function(){return new h},n[a.STAR_LOOP_BACK]=function(){return new x},n[a.STAR_LOOP_ENTRY]=function(){return new v},n[a.PLUS_LOOP_BACK]=function(){return new g},n[a.LOOP_END]=function(){return new p},this.stateFactories=n}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";var r=this.stateFactories[t]();if(null!==r)return r.ruleIndex=e,r},W.prototype.lexerActionFactory=function(t,e,n){if(null===this.actionFactories){var r=[];r[j.CHANNEL]=function(t,e){return new B(t)},r[j.CUSTOM]=function(t,e){return new U(t,e)},r[j.MODE]=function(t,e){return new G(t)},r[j.MORE]=function(t,e){return V.INSTANCE},r[j.POP_MODE]=function(t,e){return q.INSTANCE},r[j.PUSH_MODE]=function(t,e){return new z(t)},r[j.SKIP]=function(t,e){return M.INSTANCE},r[j.TYPE]=function(t,e){return new H(t)},this.actionFactories=r}if(t>this.actionFactories.length||null===this.actionFactories[t])throw"The specified lexer action type "+t+" is not valid.";return this.actionFactories[t](e,n)},e.ATNDeserializer=W},function(t,e){function n(t){return void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions,this}n.defaultOptions=new n,n.defaultOptions.readOnly=!0,e.ATNDeserializationOptions=n},function(t,e){function n(){}function r(t){return this.actionType=t,this.isPositionDependent=!1,this}function i(){return r.call(this,n.SKIP),this}function o(t){return r.call(this,n.TYPE),this.type=t,this}function s(t){return r.call(this,n.PUSH_MODE),this.mode=t,this}function a(){return r.call(this,n.POP_MODE),this}function l(){return r.call(this,n.MORE),this}function u(t){return r.call(this,n.MODE),this.mode=t,this}function c(t,e){return r.call(this,n.CUSTOM),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0,this}function h(t){return r.call(this,n.CHANNEL),this.channel=t,this}function p(t,e){return r.call(this,e.actionType),this.offset=t,this.action=e,this.isPositionDependent=!0,this}n.CHANNEL=0,n.CUSTOM=1,n.MODE=2,n.MORE=3,n.POP_MODE=4,n.PUSH_MODE=5,n.SKIP=6,n.TYPE=7,r.prototype.hashCode=function(){var t=new Hash;return this.updateHashCode(t),t.finish()},r.prototype.updateHashCode=function(t){t.update(this.actionType)},r.prototype.equals=function(t){return this===t},i.prototype=Object.create(r.prototype),i.prototype.constructor=i,i.INSTANCE=new i,i.prototype.execute=function(t){t.skip()},i.prototype.toString=function(){return"skip"},o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.execute=function(t){t.type=this.type},o.prototype.updateHashCode=function(t){t.update(this.actionType,this.type)},o.prototype.equals=function(t){return this===t||t instanceof o&&this.type===t.type},o.prototype.toString=function(){return"type("+this.type+")"},s.prototype=Object.create(r.prototype),s.prototype.constructor=s,s.prototype.execute=function(t){t.pushMode(this.mode)},s.prototype.updateHashCode=function(t){t.update(this.actionType,this.mode)},s.prototype.equals=function(t){return this===t||t instanceof s&&this.mode===t.mode},s.prototype.toString=function(){return"pushMode("+this.mode+")"},a.prototype=Object.create(r.prototype),a.prototype.constructor=a,a.INSTANCE=new a,a.prototype.execute=function(t){t.popMode()},a.prototype.toString=function(){return"popMode"},l.prototype=Object.create(r.prototype),l.prototype.constructor=l,l.INSTANCE=new l,l.prototype.execute=function(t){t.more()},l.prototype.toString=function(){return"more"},u.prototype=Object.create(r.prototype),u.prototype.constructor=u,u.prototype.execute=function(t){t.mode(this.mode)},u.prototype.updateHashCode=function(t){t.update(this.actionType,this.mode)},u.prototype.equals=function(t){return this===t||t instanceof u&&this.mode===t.mode},u.prototype.toString=function(){return"mode("+this.mode+")"},c.prototype=Object.create(r.prototype),c.prototype.constructor=c,c.prototype.execute=function(t){t.action(null,this.ruleIndex,this.actionIndex)},c.prototype.updateHashCode=function(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)},c.prototype.equals=function(t){return this===t||t instanceof c&&(this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex)},h.prototype=Object.create(r.prototype),h.prototype.constructor=h,h.prototype.execute=function(t){t._channel=this.channel},h.prototype.updateHashCode=function(t){t.update(this.actionType,this.channel)},h.prototype.equals=function(t){return this===t||t instanceof h&&this.channel===t.channel},h.prototype.toString=function(){return"channel("+this.channel+")"},p.prototype=Object.create(r.prototype),p.prototype.constructor=p,p.prototype.execute=function(t){this.action.execute(t)},p.prototype.updateHashCode=function(t){t.update(this.actionType,this.offset,this.action)},p.prototype.equals=function(t){return this===t||t instanceof p&&(this.offset===t.offset&&this.action===t.action)},e.LexerActionType=n,e.LexerSkipAction=i,e.LexerChannelAction=h,e.LexerCustomAction=c,e.LexerIndexedCustomAction=p,e.LexerMoreAction=l,e.LexerTypeAction=o,e.LexerPushModeAction=s,e.LexerPopModeAction=a,e.LexerModeAction=u},function(t,e,n){var r=n(1).Token,i=n(16).ConsoleErrorListener,o=n(16).ProxyErrorListener;function s(){return this._listeners=[i.INSTANCE],this._interp=null,this._stateNumber=-1,this}s.tokenTypeMapCache={},s.ruleIndexMapCache={},s.prototype.checkVersion=function(t){"4.7"!==t&&console.log("ANTLR runtime and generated code versions disagree: 4.7!="+t)},s.prototype.addErrorListener=function(t){this._listeners.push(t)},s.prototype.removeErrorListeners=function(){this._listeners=[]},s.prototype.getTokenTypeMap=function(){var t=this.getTokenNames();if(null===t)throw"The current recognizer does not provide a list of token names.";var e=this.tokenTypeMapCache[t];return void 0===e&&((e=t.reduce(function(t,e,n){t[e]=n})).EOF=r.EOF,this.tokenTypeMapCache[t]=e),e},s.prototype.getRuleIndexMap=function(){var t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";var e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce(function(t,e,n){t[e]=n}),this.ruleIndexMapCache[t]=e),e},s.prototype.getTokenType=function(t){var e=this.getTokenTypeMap()[t];return void 0!==e?e:r.INVALID_TYPE},s.prototype.getErrorHeader=function(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column},s.prototype.getTokenErrorDisplay=function(t){if(null===t)return"";var e=t.text;return null===e&&(e=t.type===r.EOF?"":"<"+t.type+">"),"'"+(e=e.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"))+"'"},s.prototype.getErrorListenerDispatch=function(){return new o(this._listeners)},s.prototype.sempred=function(t,e,n){return!0},s.prototype.precpred=function(t,e){return!0},Object.defineProperty(s.prototype,"state",{get:function(){return this._stateNumber},set:function(t){this._stateNumber=t}}),e.Recognizer=s},function(t,e,n){var r=n(11).DFAState,i=n(9).ATNConfigSet,o=n(6).getCachedPredictionContext;function s(t,e){return this.atn=t,this.sharedContextCache=e,this}s.ERROR=new r(2147483647,new i),s.prototype.getCachedContext=function(t){if(null===this.sharedContextCache)return t;return o(t,this.sharedContextCache,{})},e.ATNSimulator=s},function(t,e,n){n(0).Set;var r=n(0).Map,i=n(0).BitSet,o=n(0).AltDict,s=n(7).ATN,a=n(3).RuleStopState,l=n(9).ATNConfigSet,u=n(13).ATNConfig,c=n(10).SemanticContext,h=(n(0).Hash,n(0).hashStuff);n(0).equalArrays;function p(){return this}p.SLL=0,p.LL=1,p.LL_EXACT_AMBIG_DETECTION=2,p.hasSLLConflictTerminatingPrediction=function(t,e){if(p.allConfigsInRuleStopStates(e))return!0;if(t===p.SLL&&e.hasSemanticContext){for(var n=new l,r=0;r1)return!0}return!1},p.allSubsetsEqual=function(t){for(var e=null,n=0;n=n)){var i,o=e.charCodeAt(r);return o>=55296&&o<=56319&&n>r+1&&(i=e.charCodeAt(r+1))>=56320&&i<=57343?1024*(o-55296)+i-56320+65536:o}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}()},function(t,e){var n,r,i,o;String.fromCodePoint||(n=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),r=String.fromCharCode,i=Math.floor,o=function(t){var e,n,o=[],s=-1,a=arguments.length;if(!a)return"";for(var l="";++s1114111||i(u)!=u)throw RangeError("Invalid code point: "+u);u<=65535?o.push(u):(e=55296+((u-=65536)>>10),n=u%1024+56320,o.push(e,n)),(s+1==a||o.length>16384)&&(l+=r.apply(null,o),o.length=0)}return l},n?n(String,"fromCodePoint",{value:o,configurable:!0,writable:!0}):String.fromCodePoint=o)},function(t,e,n){var r=n(1).Token,i=n(5),o=i.NoViableAltException,s=i.InputMismatchException,a=i.FailedPredicateException,l=i.ParseCancellationException,u=n(3).ATNState,c=n(2).Interval,h=n(2).IntervalSet;function p(){}function f(){return p.call(this),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this}function d(){return f.call(this),this}p.prototype.reset=function(t){},p.prototype.recoverInline=function(t){},p.prototype.recover=function(t,e){},p.prototype.sync=function(t){},p.prototype.inErrorRecoveryMode=function(t){},p.prototype.reportError=function(t){},f.prototype=Object.create(p.prototype),f.prototype.constructor=f,f.prototype.reset=function(t){this.endErrorCondition(t)},f.prototype.beginErrorCondition=function(t){this.errorRecoveryMode=!0},f.prototype.inErrorRecoveryMode=function(t){return this.errorRecoveryMode},f.prototype.endErrorCondition=function(t){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1},f.prototype.reportMatch=function(t){this.endErrorCondition(t)},f.prototype.reportError=function(t,e){this.inErrorRecoveryMode(t)||(this.beginErrorCondition(t),e instanceof o?this.reportNoViableAlternative(t,e):e instanceof s?this.reportInputMismatch(t,e):e instanceof a?this.reportFailedPredicate(t,e):(console.log("unknown recognition error type: "+e.constructor.name),console.log(e.stack),t.notifyErrorListeners(e.getOffendingToken(),e.getMessage(),e)))},f.prototype.recover=function(t,e){this.lastErrorIndex===t.getInputStream().index&&null!==this.lastErrorStates&&this.lastErrorStates.indexOf(t.state)>=0&&t.consume(),this.lastErrorIndex=t._input.index,null===this.lastErrorStates&&(this.lastErrorStates=[]),this.lastErrorStates.push(t.state);var n=this.getErrorRecoverySet(t);this.consumeUntil(t,n)},f.prototype.sync=function(t){if(!this.inErrorRecoveryMode(t)){var e=t._interp.atn.states[t.state],n=t.getTokenStream().LA(1),i=t.atn.nextTokens(e);if(!i.contains(r.EPSILON)&&!i.contains(n))switch(e.stateType){case u.BLOCK_START:case u.STAR_BLOCK_START:case u.PLUS_BLOCK_START:case u.STAR_LOOP_ENTRY:if(null!==this.singleTokenDeletion(t))return;throw new s(t);case u.PLUS_LOOP_BACK:case u.STAR_LOOP_BACK:this.reportUnwantedToken(t);var o=new h;o.addSet(t.getExpectedTokens());var a=o.addSet(this.getErrorRecoverySet(t));this.consumeUntil(t,a)}}},f.prototype.reportNoViableAlternative=function(t,e){var n,i=t.getTokenStream();n=null!==i?e.startToken.type===r.EOF?"":i.getText(new c(e.startToken,e.offendingToken)):"";var o="no viable alternative at input "+this.escapeWSAndQuote(n);t.notifyErrorListeners(o,e.offendingToken,e)},f.prototype.reportInputMismatch=function(t,e){var n="mismatched input "+this.getTokenErrorDisplay(e.offendingToken)+" expecting "+e.getExpectedTokens().toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e.offendingToken,e)},f.prototype.reportFailedPredicate=function(t,e){var n="rule "+t.ruleNames[t._ctx.ruleIndex]+" "+e.message;t.notifyErrorListeners(n,e.offendingToken,e)},f.prototype.reportUnwantedToken=function(t){if(!this.inErrorRecoveryMode(t)){this.beginErrorCondition(t);var e=t.getCurrentToken(),n="extraneous input "+this.getTokenErrorDisplay(e)+" expecting "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e,null)}},f.prototype.reportMissingToken=function(t){if(!this.inErrorRecoveryMode(t)){this.beginErrorCondition(t);var e=t.getCurrentToken(),n="missing "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames)+" at "+this.getTokenErrorDisplay(e);t.notifyErrorListeners(n,e,null)}},f.prototype.recoverInline=function(t){var e=this.singleTokenDeletion(t);if(null!==e)return t.consume(),e;if(this.singleTokenInsertion(t))return this.getMissingSymbol(t);throw new s(t)},f.prototype.singleTokenInsertion=function(t){var e=t.getTokenStream().LA(1),n=t._interp.atn,r=n.states[t.state].transitions[0].target;return!!n.nextTokens(r,t._ctx).contains(e)&&(this.reportMissingToken(t),!0)},f.prototype.singleTokenDeletion=function(t){var e=t.getTokenStream().LA(2);if(this.getExpectedTokens(t).contains(e)){this.reportUnwantedToken(t),t.consume();var n=t.getCurrentToken();return this.reportMatch(t),n}return null},f.prototype.getMissingSymbol=function(t){var e,n=t.getCurrentToken(),i=this.getExpectedTokens(t).first();e=i===r.EOF?"":"";var o=n,s=t.getTokenStream().LT(-1);return o.type===r.EOF&&null!==s&&(o=s),t.getTokenFactory().create(o.source,i,e,r.DEFAULT_CHANNEL,-1,-1,o.line,o.column)},f.prototype.getExpectedTokens=function(t){return t.getExpectedTokens()},f.prototype.getTokenErrorDisplay=function(t){if(null===t)return"";var e=t.text;return null===e&&(e=t.type===r.EOF?"":"<"+t.type+">"),this.escapeWSAndQuote(e)},f.prototype.escapeWSAndQuote=function(t){return"'"+(t=(t=(t=t.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"},f.prototype.getErrorRecoverySet=function(t){for(var e=t._interp.atn,n=t._ctx,i=new h;null!==n&&n.invokingState>=0;){var o=e.states[n.invokingState].transitions[0],s=e.nextTokens(o.followState);i.addSet(s),n=n.parentCtx}return i.removeOne(r.EPSILON),i},f.prototype.consumeUntil=function(t,e){for(var n=t.getTokenStream().LA(1);n!==r.EOF&&!e.contains(n);)t.consume(),n=t.getTokenStream().LA(1)},d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.recover=function(t,e){for(var n=t._ctx;null!==n;)n.exception=e,n=n.parentCtx;throw new l(e)},d.prototype.recoverInline=function(t){this.recover(t,new s(t))},d.prototype.sync=function(t){},e.BailErrorStrategy=d,e.DefaultErrorStrategy=f},function(t,e){},function(t,e,n){Converter=n(33).Converter},function(module,exports,__webpack_require__){antlr4=__webpack_require__(12);var BlocklyGrammerVisitor=__webpack_require__(20).BlocklyGrammerVisitor,BlocklyGrammerLexer=__webpack_require__(51).BlocklyGrammerLexer,BlocklyGrammerParser=__webpack_require__(52).BlocklyGrammerParser,Visitors=__webpack_require__(53),SymbolVisitor=Visitors.SymbolVisitor,EvalVisitor=Visitors.EvalVisitor,tpl=__webpack_require__(54);function Converter(){return this}Converter.prototype.constructor=Converter,Converter.prototype.init=function(){return this.toolboxGap=5,this.toolboxId="toolbox",this.blocklyDivId="blocklyDiv",this.workSpaceName="workspace",this.codeAreaId="codeArea",this},Converter.prototype.main=function(t,e,n){return this.init(),this.generBlocks(t,e),this.renderGrammerName(),this.generToolbox(),this.generMainFile(e),this.writeMainFile(n),this},Converter.prototype.generBlocks=function(grammerFile,functions){functions||(functions={});var temp_consoleError=console.error;console.error=function(t){throw new Error(t)};var chars=new antlr4.InputStream(grammerFile),lexer=new BlocklyGrammerLexer(chars),tokens=new antlr4.CommonTokenStream(lexer),parser=new BlocklyGrammerParser(tokens);parser.buildParseTrees=!0;var tree=parser.grammarFile();console.error=temp_consoleError;var svisitor=(new SymbolVisitor).init();this.svisitor=svisitor,svisitor.visit(tree),svisitor.checkSymbol();var evisitor=(new EvalVisitor).init(svisitor,grammerFile);return this.evisitor=evisitor,eval(this.evisitor.matchInject("Function_0")),functions.Function_0&&functions.Function_0.call(this),evisitor.visit(tree),eval(this.evisitor.matchInject("Function_1")),functions.Function_1&&functions.Function_1.call(this),evisitor.generBlocks(),this.blocks=evisitor.blocks,eval(this.evisitor.matchInject("Function_2")),functions.Function_2&&functions.Function_2.call(this),this},Converter.prototype.renderGrammerName=function(){this.grammerName=this.svisitor.grammerName,this.generLanguage=this.evisitor.generLanguage;var t=this.grammerName,e=this.generLanguage;return this.OmitedError=tpl.OmitedError(),this.Functions_pre=tpl.Functions_pre(t),this.Functions_fieldDefault=tpl.Functions_fieldDefault(t),this.Functions_defaultCode=tpl.Functions_defaultCode(t),this.Functions_xmlText=tpl.Functions_xmlText(t),this.Functions_blocksIniter=tpl.Functions_blocksIniter(t,e),this.mainFileTPL=tpl.mainFileTPL,this},Converter.prototype.generToolbox=function(){var t=[];for(var e in t.push("{"),t.push(" // 每个键值对作为一页"),t.push(' "statement" : ['),t.push(" // 所有语句块"),this.evisitor.statementRules)this.evisitor.statementRules[e].type&&t.push(" "+this.grammerName+'Blocks["'+e+'"].xmlText(),');for(var e in t.push(" ],"),t.push(' "value" : ['),t.push(" // 所有值块"),this.evisitor.expressionRules)this.evisitor.expressionRules[e].type&&t.push(" "+this.grammerName+'Blocks["'+e+'"].xmlText(),');t.push(" ]"),t.push(" }");var n=t.join("\n");return this.toolbox=tpl.ToolboxObj(this.toolboxId,n,this.toolboxGap),this},Converter.prototype.generMainFile=function(t){t||(t={});var e=[],n=this.grammerName;e.push(this.blocks),e.push("\n\n"),e.push(this.OmitedError),e.push("\n\n"),e.push(n+"Functions={}\n\n"),e.push(this.evisitor.matchInject("Functions")),t.Functions&&e.push(t.Functions),e.push("\n\n"),e.push(this.Functions_pre),e.push("\n\n"),e.push(this.Functions_fieldDefault),e.push("\n\n"),e.push(this.Functions_defaultCode),e.push("\n\n"),e.push(this.Functions_xmlText),e.push("\n\n"),e.push(this.Functions_blocksIniter),e.push("\n\n"),e.push(n+"Functions.blocksIniter();\n\n"),this.mainFile=this.mainFileTPL(n,this.generLanguage,this.blocklyDivId,this.codeAreaId,this.toolbox,this.workSpaceName,this.toolboxId,e.join(""))},Converter.prototype.writeMainFile=function(t){t||(t=this.grammerName+"index.html"),this.createAndDownloadFile(this.mainFile.join(""),t,"html")},Converter.prototype.block=function(t){var e=this.evisitor.expressionRules[t];return e||(e=this.evisitor.statementRules[t]),e&&1!==e.checklength?e.blockjs:null},Converter.prototype.createAndDownloadFile=function(t,e,n){var r=new Blob([t],{type:"text/"+n}),i=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1}),o=document.createElement("a");o.href=window.URL.createObjectURL(r),o.download=e,o.textContent="Download file!",o.dispatchEvent(i)},exports.Converter=Converter},function(t,e,n){e.ATN=n(7).ATN,e.ATNDeserializer=n(22).ATNDeserializer,e.LexerATNSimulator=n(37).LexerATNSimulator,e.ParserATNSimulator=n(40).ParserATNSimulator,e.PredictionMode=n(27).PredictionMode},function(t,e,n){var r=n(0).Set,i=n(0).BitSet,o=n(1).Token,s=n(13).ATNConfig,a=(n(2).Interval,n(2).IntervalSet),l=n(3).RuleStopState,u=n(8).RuleTransition,c=n(8).NotSetTransition,h=n(8).WildcardTransition,p=n(8).AbstractPredicateTransition,f=n(6),d=f.predictionContextFromRuleContext,y=f.PredictionContext,g=f.SingletonPredictionContext;function x(t){this.atn=t}x.HIT_PRED=o.INVALID_TYPE,x.prototype.getDecisionLookahead=function(t){if(null===t)return null;for(var e=t.transitions.length,n=[],o=0;ov.MAX_DFA_EDGE)return null;var n=t.edges[e-v.MIN_DFA_EDGE];return void 0===n&&(n=null),v.debug&&null!==n&&console.log("reuse state "+t.stateNumber+" edge to "+n.stateNumber),n},v.prototype.computeTargetState=function(t,e,n){var r=new l;return this.getReachableConfigSet(t,e.configs,r,n),0===r.items.length?(r.hasSemanticContext||this.addDFAEdge(e,n,s.ERROR),s.ERROR):this.addDFAEdge(e,n,null,r)},v.prototype.failOrAccept=function(t,e,n,i){if(null!==this.prevAccept.dfaState){var o=t.dfaState.lexerActionExecutor;return this.accept(e,o,this.startIndex,t.index,t.line,t.column),t.dfaState.prediction}if(i===r.EOF&&e.index===this.startIndex)return r.EOF;throw new y(this.recog,e,this.startIndex,n)},v.prototype.getReachableConfigSet=function(t,e,n,i){for(var s=o.INVALID_ALT_NUMBER,a=0;av.MAX_DFA_EDGE?n:(v.debug&&console.log("EDGE "+t+" -> "+n+" upon "+e),null===t.edges&&(t.edges=[]),t.edges[e-v.MIN_DFA_EDGE]=n,n)},v.prototype.addDFAState=function(t){for(var e=new a(null,t),n=null,r=0;r0&&(o=this.getAltThatFinishedDecisionEntryRule(i))!==a.INVALID_ALT_NUMBER?o:a.INVALID_ALT_NUMBER},N.prototype.getAltThatFinishedDecisionEntryRule=function(t){for(var e=[],n=0;n0||r.state instanceof v&&r.context.hasEmptyPath())&&e.indexOf(r.alt)<0&&e.push(r.alt)}return 0===e.length?a.INVALID_ALT_NUMBER:Math.min.apply(null,e)},N.prototype.splitAccordingToSemanticValidity=function(t,e){for(var n=new c(t.fullCtx),r=new c(t.fullCtx),i=0;i50))throw"problem";if(t.state instanceof v){if(!t.context.isEmpty()){for(var a=0;a=0&&(p+=1);this.closureCheckingStopState(h,e,n,c,i,p,s)}}},N.prototype.canDropLoopEntryEdgeInLeftRecursiveRule=function(t){var e=t.state;if(e.stateType!=l.STAR_LOOP_ENTRY)return!1;if(e.stateType!=l.STAR_LOOP_ENTRY||!e.isPrecedenceDecision||t.context.isEmpty()||t.context.hasEmptyPath())return!1;for(var n=t.context.length,r=0;r=0?this.parser.ruleNames[t]:""},N.prototype.getEpsilonTarget=function(t,e,n,r,i,o){switch(e.serializationType){case S.RULE:return this.ruleTransition(t,e);case S.PRECEDENCE:return this.precedenceTransition(t,e,n,r,i);case S.PREDICATE:return this.predTransition(t,e,n,r,i);case S.ACTION:return this.actionTransition(t,e);case S.EPSILON:return new u({state:e.target},t);case S.ATOM:case S.RANGE:case S.SET:return o&&e.matches(h.EOF,0,1)?new u({state:e.target},t):null;default:return null}},N.prototype.actionTransition=function(t,e){if(this.debug){var n=-1==e.actionIndex?65535:e.actionIndex;console.log("ACTION edge "+e.ruleIndex+":"+n)}return new u({state:e.target},t)},N.prototype.precedenceTransition=function(t,e,n,i,o){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.precedence+">=_p, ctx dependent=true"),null!==this.parser&&console.log("context surrounding pred is "+r.arrayToString(this.parser.getRuleInvocationStack())));var s=null;if(n&&i)if(o){var a=this._input.index;this._input.seek(this._startIndex);var l=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(a),l&&(s=new u({state:e.target},t))}else{var c=x.andContext(t.semanticContext,e.getPredicate());s=new u({state:e.target,semanticContext:c},t)}else s=new u({state:e.target},t);return this.debug&&console.log("config from pred transition="+s),s},N.prototype.predTransition=function(t,e,n,i,o){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.ruleIndex+":"+e.predIndex+", ctx dependent="+e.isCtxDependent),null!==this.parser&&console.log("context surrounding pred is "+r.arrayToString(this.parser.getRuleInvocationStack())));var s=null;if(n&&(e.isCtxDependent&&i||!e.isCtxDependent))if(o){var a=this._input.index;this._input.seek(this._startIndex);var l=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(a),l&&(s=new u({state:e.target},t))}else{var c=x.andContext(t.semanticContext,e.getPredicate());s=new u({state:e.target,semanticContext:c},t)}else s=new u({state:e.target},t);return this.debug&&console.log("config from pred transition="+s),s},N.prototype.ruleTransition=function(t,e){this.debug&&console.log("CALL rule "+this.getRuleName(e.target.ruleIndex)+", ctx="+t.context);var n=e.followState,r=R.create(t.context,n.stateNumber);return new u({state:e.target,context:r},t)},N.prototype.getConflictingAlts=function(t){var e=y.getConflictingAltSubsets(t);return y.getAlts(e)},N.prototype.getConflictingAltsOrUniqueAlt=function(t){var e=null;return t.uniqueAlt!==a.INVALID_ALT_NUMBER?(e=new o).add(t.uniqueAlt):e=t.conflictingAlts,e},N.prototype.getTokenName=function(t){if(t===h.EOF)return"EOF";if(null!==this.parser&&null!==this.parser.literalNames){if(!(t>=this.parser.literalNames.length&&t>=this.parser.symbolicNames.length))return(this.parser.literalNames[t]||this.parser.symbolicNames[t])+"<"+t+">";console.log(t+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+t},N.prototype.getLookaheadName=function(t){return this.getTokenName(t.LA(1))},N.prototype.dumpDeadEndConfigs=function(t){console.log("dead end configs: ");for(var e=t.getDeadEndConfigs(),n=0;n0){var o=r.state.transitions[0];if(o instanceof AtomTransition)i="Atom "+this.getTokenName(o.label);else if(o instanceof E){i=(o instanceof C?"~":"")+"Set "+o.set}}console.error(r.toString(this.parser,!0)+":"+i)}},N.prototype.noViableAlt=function(t,e,n,r){return new b(this.parser,t,t.get(r),t.LT(1),n,e)},N.prototype.getUniqueAlt=function(t){for(var e=a.INVALID_ALT_NUMBER,n=0;n "+r+" upon "+this.getTokenName(n)),null===r)return null;if(r=this.addDFAState(t,r),null===e||n<-1||n>this.atn.maxTokenType)return r;if(null===e.edges&&(e.edges=[]),e.edges[n+1]=r,this.debug){var i=null===this.parser?null:this.parser.literalNames,o=null===this.parser?null:this.parser.symbolicNames;console.log("DFA=\n"+t.toString(i,o))}return r},N.prototype.addDFAState=function(t,e){if(e==d.ERROR)return e;var n=t.states.get(e);return null!==n?n:(e.stateNumber=t.states.length,e.configs.readOnly||(e.configs.optimizeConfigs(this),e.configs.setReadonly(!0)),t.states.add(e),this.debug&&console.log("adding new DFA state: "+e),e)},N.prototype.reportAttemptingFullContext=function(t,e,n,r,i){if(this.debug||this.retry_debug){var o=new _(r,i+1);console.log("reportAttemptingFullContext decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(o))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser,t,r,i,e,n)},N.prototype.reportContextSensitivity=function(t,e,n,r,i){if(this.debug||this.retry_debug){var o=new _(r,i+1);console.log("reportContextSensitivity decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(o))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser,t,r,i,e,n)},N.prototype.reportAmbiguity=function(t,e,n,r,i,o,s){if(this.debug||this.retry_debug){var a=new _(n,r+1);console.log("reportAmbiguity "+o+":"+s+", input="+this.parser.getTokenStream().getText(a))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser,t,n,r,i,o,s)},e.ParserATNSimulator=N},function(t,e,n){e.DFA=n(42).DFA,e.DFASerializer=n(17).DFASerializer,e.LexerDFASerializer=n(17).LexerDFASerializer,e.PredPrediction=n(11).PredPrediction},function(t,e,n){var r=n(0).Set,i=n(11).DFAState,o=n(3).StarLoopEntryState,s=n(9).ATNConfigSet,a=n(17).DFASerializer,l=n(17).LexerDFASerializer;function u(t,e){if(void 0===e&&(e=0),this.atnStartState=t,this.decision=e,this._states=new r,this.s0=null,this.precedenceDfa=!1,t instanceof o&&t.isPrecedenceDecision){this.precedenceDfa=!0;var n=new i(null,new s);n.edges=[],n.isAcceptState=!1,n.requiresFullContext=!1,this.s0=n}return this}u.prototype.getPrecedenceStartState=function(t){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return t<0||t>=this.s0.edges.length?null:this.s0.edges[t]||null},u.prototype.setPrecedenceStartState=function(t,e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";t<0||(this.s0.edges[t]=e)},u.prototype.setPrecedenceDfa=function(t){if(this.precedenceDfa!==t){if(this._states=new DFAStatesSet,t){var e=new i(null,new s);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}else this.s0=null;this.precedenceDfa=t}},Object.defineProperty(u.prototype,"states",{get:function(){return this._states}}),u.prototype.sortedStates=function(){return this._states.values().sort(function(t,e){return t.stateNumber-e.stateNumber})},u.prototype.toString=function(t,e){return t=t||null,e=e||null,null===this.s0?"":new a(this,t,e).toString()},u.prototype.toLexerString=function(){return null===this.s0?"":new l(this).toString()},e.DFA=u},function(t,e,n){var r=n(4);e.Trees=n(21).Trees,e.RuleNode=r.RuleNode,e.ParseTreeListener=r.ParseTreeListener,e.ParseTreeVisitor=r.ParseTreeVisitor,e.ParseTreeWalker=r.ParseTreeWalker},function(t,e,n){e.RecognitionException=n(5).RecognitionException,e.NoViableAltException=n(5).NoViableAltException,e.LexerNoViableAltException=n(5).LexerNoViableAltException,e.InputMismatchException=n(5).InputMismatchException,e.FailedPredicateException=n(5).FailedPredicateException,e.DiagnosticErrorListener=n(45).DiagnosticErrorListener,e.BailErrorStrategy=n(30).BailErrorStrategy,e.ErrorListener=n(16).ErrorListener},function(t,e,n){var r=n(0).BitSet,i=n(16).ErrorListener,o=n(2).Interval;function s(t){return i.call(this),t=t||!0,this.exactOnly=t,this}s.prototype=Object.create(i.prototype),s.prototype.constructor=s,s.prototype.reportAmbiguity=function(t,e,n,r,i,s,a){if(!this.exactOnly||i){var l="reportAmbiguity d="+this.getDecisionDescription(t,e)+": ambigAlts="+this.getConflictingAlts(s,a)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(l)}},s.prototype.reportAttemptingFullContext=function(t,e,n,r,i,s){var a="reportAttemptingFullContext d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(a)},s.prototype.reportContextSensitivity=function(t,e,n,r,i,s){var a="reportContextSensitivity d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(a)},s.prototype.getDecisionDescription=function(t,e){var n=e.decision,r=e.atnStartState.ruleIndex,i=t.ruleNames;if(r<0||r>=i.length)return""+n;var o=i[r]||null;return null===o||0===o.length?""+n:n+" ("+o+")"},s.prototype.getConflictingAlts=function(t,e){if(null!==t)return t;for(var n=new r,i=0;i=0&&(this.fetchedEOF?this.index0)||this.fetch(e)>=e},a.prototype.fetch=function(t){if(this.fetchedEOF)return 0;for(var e=0;e=this.tokens.length&&(e=this.tokens.length-1);for(var o=t;o=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[e]},a.prototype.adjustSeekIndex=function(t){return t},a.prototype.lazyInit=function(){-1===this.index&&this.setup()},a.prototype.setup=function(){this.sync(0),this.index=this.adjustSeekIndex(0)},a.prototype.setTokenSource=function(t){this.tokenSource=t,this.tokens=[],this.index=-1,this.fetchedEOF=!1},a.prototype.nextTokenOnChannel=function(t,e){if(this.sync(t),t>=this.tokens.length)return-1;for(var n=this.tokens[t];n.channel!==this.channel;){if(n.type===r.EOF)return-1;t+=1,this.sync(t),n=this.tokens[t]}return t},a.prototype.previousTokenOnChannel=function(t,e){for(;t>=0&&this.tokens[t].channel!==e;)t-=1;return t},a.prototype.getHiddenTokensToRight=function(t,e){if(void 0===e&&(e=-1),this.lazyInit(),t<0||t>=this.tokens.length)throw t+" not in 0.."+this.tokens.length-1;var n=this.nextTokenOnChannel(t+1,i.DEFAULT_TOKEN_CHANNEL),r=t+1,o=-1===n?this.tokens.length-1:n;return this.filterForChannel(r,o,e)},a.prototype.getHiddenTokensToLeft=function(t,e){if(void 0===e&&(e=-1),this.lazyInit(),t<0||t>=this.tokens.length)throw t+" not in 0.."+this.tokens.length-1;var n=this.previousTokenOnChannel(t-1,i.DEFAULT_TOKEN_CHANNEL);if(n===t-1)return null;var r=n+1,o=t-1;return this.filterForChannel(r,o,e)},a.prototype.filterForChannel=function(t,e,n){for(var r=[],o=t;o=this.tokens.length&&(n=this.tokens.length-1);for(var i="",s=e;s=0&&this._parseListeners.splice(e,1),0===this._parseListeners.length&&(this._parseListeners=null)}},p.prototype.removeParseListeners=function(){this._parseListeners=null},p.prototype.triggerEnterRuleEvent=function(){if(null!==this._parseListeners){var t=this._ctx;this._parseListeners.map(function(e){e.enterEveryRule(t),t.enterRule(e)})}},p.prototype.triggerExitRuleEvent=function(){if(null!==this._parseListeners){var t=this._ctx;this._parseListeners.slice(0).reverse().map(function(e){t.exitRule(e),e.exitEveryRule(t)})}},p.prototype.getTokenFactory=function(){return this._input.tokenSource._factory},p.prototype.setTokenFactory=function(t){this._input.tokenSource._factory=t},p.prototype.getATNWithBypassAlts=function(){var t=this.getSerializedATN();if(null===t)throw"The current parser does not support an ATN with bypass alternatives.";var e=this.bypassAltsAtnCache[t];if(null===e){var n=new l;n.generateRuleBypassTransitions=!0,e=new a(n).deserialize(t),this.bypassAltsAtnCache[t]=e}return e};var f=n(15).Lexer;p.prototype.compileParseTreePattern=function(t,e,n){if(null===(n=n||null)&&null!==this.getTokenStream()){var r=this.getTokenStream().tokenSource;r instanceof f&&(n=r)}if(null===n)throw"Parser can't discover a lexer to use";return new ParseTreePatternMatcher(n,this).compile(t,e)},p.prototype.getInputStream=function(){return this.getTokenStream()},p.prototype.setInputStream=function(t){this.setTokenStream(t)},p.prototype.getTokenStream=function(){return this._input},p.prototype.setTokenStream=function(t){this._input=null,this.reset(),this._input=t},p.prototype.getCurrentToken=function(){return this._input.LT(1)},p.prototype.notifyErrorListeners=function(t,e,n){e=e||null,n=n||null,null===e&&(e=this.getCurrentToken()),this._syntaxErrors+=1;var r=e.line,i=e.column;this.getErrorListenerDispatch().syntaxError(this,e,r,i,t,n)},p.prototype.consume=function(){var t=this.getCurrentToken();t.type!==r.EOF&&this.getInputStream().consume();var e,n=null!==this._parseListeners&&this._parseListeners.length>0;(this.buildParseTrees||n)&&((e=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(t):this._ctx.addTokenNode(t)).invokingState=this.state,n&&this._parseListeners.map(function(t){e instanceof c||void 0!==e.isErrorNode&&e.isErrorNode()?t.visitErrorNode(e):e instanceof u&&t.visitTerminal(e)}));return t},p.prototype.addContextToParseTree=function(){null!==this._ctx.parentCtx&&this._ctx.parentCtx.addChild(this._ctx)},p.prototype.enterRule=function(t,e,n){this.state=e,this._ctx=t,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),null!==this._parseListeners&&this.triggerEnterRuleEvent()},p.prototype.exitRule=function(){this._ctx.stop=this._input.LT(-1),null!==this._parseListeners&&this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx},p.prototype.enterOuterAlt=function(t,e){t.setAltNumber(e),this.buildParseTrees&&this._ctx!==t&&null!==this._ctx.parentCtx&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(t)),this._ctx=t},p.prototype.getPrecedence=function(){return 0===this._precedenceStack.length?-1:this._precedenceStack[this._precedenceStack.length-1]},p.prototype.enterRecursionRule=function(t,e,n,r){this.state=e,this._precedenceStack.push(r),this._ctx=t,this._ctx.start=this._input.LT(1),null!==this._parseListeners&&this.triggerEnterRuleEvent()},p.prototype.pushNewRecursionContext=function(t,e,n){var r=this._ctx;r.parentCtx=t,r.invokingState=e,r.stop=this._input.LT(-1),this._ctx=t,this._ctx.start=r.start,this.buildParseTrees&&this._ctx.addChild(r),null!==this._parseListeners&&this.triggerEnterRuleEvent()},p.prototype.unrollRecursionContexts=function(t){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);var e=this._ctx;if(null!==this._parseListeners)for(;this._ctx!==t;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=t;e.parentCtx=t,this.buildParseTrees&&null!==t&&t.addChild(e)},p.prototype.getInvokingContext=function(t){for(var e=this._ctx;null!==e;){if(e.ruleIndex===t)return e;e=e.parentCtx}return null},p.prototype.precpred=function(t,e){return e>=this._precedenceStack[this._precedenceStack.length-1]},p.prototype.inContext=function(t){return!1},p.prototype.isExpectedToken=function(t){var e=this._interp.atn,n=this._ctx,i=e.states[this.state],o=e.nextTokens(i);if(o.contains(t))return!0;if(!o.contains(r.EPSILON))return!1;for(;null!==n&&n.invokingState>=0&&o.contains(r.EPSILON);){var s=e.states[n.invokingState].transitions[0];if((o=e.nextTokens(s.followState)).contains(t))return!0;n=n.parentCtx}return!(!o.contains(r.EPSILON)||t!==r.EOF)},p.prototype.getExpectedTokens=function(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)},p.prototype.getExpectedTokensWithinCurrentRule=function(){var t=this._interp.atn,e=t.states[this.state];return t.nextTokens(e)},p.prototype.getRuleIndex=function(t){var e=this.getRuleIndexMap()[t];return null!==e?e:-1},p.prototype.getRuleInvocationStack=function(t){null===(t=t||null)&&(t=this._ctx);for(var e=[];null!==t;){var n=t.ruleIndex;n<0?e.push("n/a"):e.push(this.ruleNames[n]),t=t.parentCtx}return e},p.prototype.getDFAStrings=function(){return this._interp.decisionToDFA.toString()},p.prototype.dumpDFA=function(){for(var t=!1,e=0;e0&&(t&&console.log(),this.printer.println("Decision "+n.decision+":"),this.printer.print(n.toString(this.literalNames,this.symbolicNames)),t=!0)}},p.prototype.getSourceName=function(){return this._input.sourceName},p.prototype.setTrace=function(t){t?(null!==this._tracer&&this.removeParseListener(this._tracer),this._tracer=new h(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)},e.Parser=p},function(t,e,n){var r=n(12),i=["悋Ꜫ脳맭䅼㯧瞆奤","ŝ\b\t\t","\t\t\t\t","\b\t\b\t\t\t\n\t\n\v\t\v","\f\t\f\r\t\r\t\t","\t\t\t\t","\t\t\t","\t\t\t\t","\t\t\t","\t\t \t ","","","","","","","","","","","","","","\b\b\t\t\n\n","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\v\v\v\v\v","\v\f\f\r\r","","Ó\n\fÖ","\v","Ü\n\fß\v","ã\n\fæ\v","ê\n","ï\n\fò","\v","ù\n","þ\n\fā\v","Ĉ\n","","","ę\n","Ĝ\n","ġ\n\rĢ","","ī\n\fĮ\v","","","Ŀ\n\fł","\v","Ō\n\f","ŏ\v ","    ŗ\n \f  Ś\v  "," ÔĬŀ!","\t\v\r\b\t\n\v\f\r","!#%","')+-/13579",";=?__C\\","2;C\\aac|c|$$^^\n$$11^^dd","hhppttvv))^^\n))11^^ddhhppttvv2;CHch",'\v\v""\f\f==~~',"ũ","\t","\v\r","","","","","!","#%","35","79;","=?","AI","K\t„","\v†\rˆ","“•","—™","ÄÆ","ÈÊ","Ì!Ù","#à%é'ë",")õ+ú","-Ą/ĉ","1ď3đ","5ě7Ġ","9Ħ;Ĵ=Ň","?ŒABi","BCtCDcDEo","EFoFGcGHtH","IJ=J","KLuLMvMNc","NOvOPGPQzQR","rRStSTUTUr","UVnVWkWXv",'XY"YZ<Z["[\\',")\\]?]^?^_",'?_`"`auabv',"bcccdvdeg","efofggghphi",'vij"jk`kl"',"lm?mn?no?",'op"pqgqrzrs',"rstttuguvu","vwuwxkxyq",'yzpz{"{|x|}','"}~?~?',"€?€)‚",'"‚ƒ=ƒ\b',"„…<…\n","†‡~‡\f","ˆ‰g‰ŠzŠ","‹r‹ŒtŒ","gŽuŽ","uk‘q","‘’p’","“”A”","•–-–","—˜,˜","™šOš›g","›œcœp","žkžŸpŸ ","i ¡h¡¢","w¢£n£¤U","¤¥r¥¦n","¦§k§¨v¨",'©"©ª<ª«','"«¬)¬­',"?­®?®¯?",'¯°"°±o',"±²g²³c³","´p´µkµ¶","p¶·i·¸","h¸¹w¹ºn",'º»"»¼`','¼½"½¾?¾',"¿?¿À?ÀÁ",')ÁÂ"ÂÃ',"=ÃÄÅ","*ÅÆÇ","+ÇÈÉ","€ÉÊË","0ËÌÔ","]ÍÎ^ÎÓ^","ÏÐ^ÐÓ_","ÑÓ\nÒÍ","ÒÏÒÑ","ÓÖÔÕ","ÔÒÕ×","ÖÔ×Ø_","Ø ÙÝ\tÚ","Ü\tÛÚÜ","ßÝÛÝ",'ÞÞ"ß',"Ýàä\tá","ã\tâáã","æäâä","åå$æ","äçê+è","ê'éçé","èê&ë","ð$ìï)íï","\nîìîí","ïòðî","ðññó","òðóô","$ô(õø","^öù\t÷ù/","øöø÷","ù*úÿ)","ûþ-üþ\n\býû","ýüþā","ÿýÿĀ","ĀĂāÿ","Ăă)ă,","Ąć^ąĈ\t\t","ĆĈ/ćą","ćĆĈ.","ĉĊwĊċ1","ċČ1Čč1č","Ď1Ď0ďĐ","\t\nĐ2đĒ%","Ēē!ēĔ","Ĕĕ\bĕ4","ĖĘėę\f","ĘėĘę","ęĜĚĜ\f","ěĖěĚ","ĜĝĝĞ\b","Ğ6ğġ\t\vĠ","ğġĢĢ","ĠĢģģ","ĤĤĥ\bĥ","8Ħħ1ħĨ",",ĨĬĩī","\vĪĩīĮ","ĬĭĬĪ","ĭįĮĬ","įİ,İı","1ıIJIJij","\bij:Ĵĵ","hĵĶtĶķc","ķĸiĸĹo","ĹĺgĺĻpĻ","ļvļŀĽ","Ŀ\vľĽĿ","łŀŁŀ","ľŁŃł","ŀŃń=ń","ŅŅņ\bņ","<Ňň1ňʼn","1ʼnōŊŌ","\n\fŋŊŌŏ","ōŋōŎ","ŎŐŏō","Őő\bő>","Œœ/œŔ@","ŔŘŕŗ\n\r","ŖŕŗŚ","ŘŖŘř","řśŚŘ","śŜ\b Ŝ@","ÒÔÝäéîðøýÿćĘ","ěĢĬŀōŘ\b"].join(""),o=(new r.atn.ATNDeserializer).deserialize(i),s=o.decisionToState.map(function(t,e){return new r.dfa.DFA(t,e)});function a(t){return r.Lexer.call(this,t),this._interp=new r.atn.LexerATNSimulator(this,o,s,new r.PredictionContextCache),this}a.prototype=Object.create(r.Lexer.prototype),a.prototype.constructor=a,a.EOF=r.Token.EOF,a.T__0=1,a.T__1=2,a.T__2=3,a.T__3=4,a.T__4=5,a.T__5=6,a.T__6=7,a.T__7=8,a.T__8=9,a.T__9=10,a.T__10=11,a.T__11=12,a.T__12=13,a.T__13=14,a.Brackets=15,a.LexerIdentifier=16,a.ParserIdentifier=17,a.String=18,a.LabelForParserRule=19,a.Newline=20,a.WhiteSpace=21,a.BlockComment=22,a.FragmentComment=23,a.LineComment=24,a.ArrowComment=25,a.prototype.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],a.prototype.modeNames=["DEFAULT_MODE"],a.prototype.literalNames=[null,"'grammar'","';'","'statExprSplit : '=== statement ^ === expression v ===' ;'","':'","'|'","'expression'","'?'","'+'","'*'","'MeaningfulSplit : '=== meaningful ^ ===' ;'","'('","')'","'~'","'.'"],a.prototype.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Brackets","LexerIdentifier","ParserIdentifier","String","LabelForParserRule","Newline","WhiteSpace","BlockComment","FragmentComment","LineComment","ArrowComment"],a.prototype.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","Brackets","LexerIdentifier","ParserIdentifier","String","STRING_double","ESC_double","STRING_single","ESC_single","UNICODE","HEX","LabelForParserRule","Newline","WhiteSpace","BlockComment","FragmentComment","LineComment","ArrowComment"],a.prototype.grammarFileName="BlocklyGrammer.g4",e.BlocklyGrammerLexer=a},function(t,e,n){var r=n(12),i=n(20).BlocklyGrammerVisitor,o=["悋Ꜫ脳맭䅼㯧瞆奤","Õ\t\t","\t\t\t\t","\b\t\b\t\t\t\n\t\n\v\t\v\f\t\f","\r\t\r\n\f"," \v$\n","\f'\v","","","8\n\r9","@\n\fC\v","F\n","L\n","Q\nS\n\fV\v","\\","\n\f_\vb\n","f\n\f","i\v\b\b\b\bn\n\b\bp\n\b","\b\b\b\bu\n\b\bw\n\b\b\b\b","\b|\n\b\b~\n\b\b\b\b\bƒ\n\b","\b…\n\b\b‡\n\b\t\tŠ\n\t\f\t","\t\v\t\n\n\v\v\v","\v\v\v\v\v\v","\v\v›\n\v\r\v\vœ","\v\v\v\v\v\v","\v\v¦\n\v\f\f\f\f«","\n\f\f­\n\f\f¯\n\f\r\f\f°\r","\r\r\r\r\r\r\r\r\r","\r\r\r\r\r\rÂ\n\r\r\r","\r\r\r\r\r\r\r\r","\rÎ\n\r\rÐ\n\r\f\r\rÓ\v\r\r","%‹\b\n\f","\t\v","\n\vð,","0\bE","\na\fc†","‹Ž","¥®","Á","\b"," ","!"," !%",'"$\n#"$\'',"%&%#","&('%()","\t)*\n*+\t+",",--../","/01","12334","4756","687589","979::;",";F<==A",">@\b?>@","CA?AB","BDCADF","E2E<F\t","GH\bHK","IL\fJLKI","KJLTMP","NQ\fOQPN","POQS","RMSVTR","TUUWVT","WbXYY]","Z\\\b[Z","\\_][]^","^`_]`b","aGaX","b\vcg\bdf","\bedfige","ghh\r","igjo\bkm\t","ln\tmlmn","npokop","p‡qv","rt\tsu\tts","tuuwvr","vww‡x}","y{\tz|\t{z","{||~","}y}~~‡","„€‚\t","ƒ\t‚","‚ƒƒ…","„€„…","…‡†j","†q†x","†‡","ˆŠ\v‰ˆ","Š‹Œ","‹‰Œ","‹Ž\f","‘","‘’’“\f","“””¦","•––—","—š\f˜™","™›\fš˜","›œœš","œž","žŸŸ¦"," ¡¡¢","¢£\r£¤","¤¦¥","¥•¥ ","¦§¬","¨ª\t©«\t","ª©ª«","«­¬¨","¬­­¯","®§¯°","°®°±","±²³\b\r³","´\r´µ\rµ¶","¶Â·¸","¸Â\r\b¹Â","º»»¼","¼½½Â","¾Â¿Â","ÀÂÁ²","Á·Á¹","ÁºÁ¾","Á¿ÁÀ","ÂÑÃÄ\f","\vÄÅÅÐ","\r\fÆÇ\f\nÇÐ\r\v","ÈÉ\f\rÉÐ\tÊË","\f\fËÍ\tÌÎ\t","ÍÌÍÎ","ÎÐÏÃ","ÏÆÏÈ","ÏÊÐÓ","ÑÏÑÒ","ÒÓÑ"," %9AEKPT]agmotv{}‚„†‹œ¥","ª¬°ÁÍÏÑ"].join(""),s=(new r.atn.ATNDeserializer).deserialize(o),a=s.decisionToState.map(function(t,e){return new r.dfa.DFA(t,e)}),l=new r.PredictionContextCache,u=[null,"'grammar'","';'","'statExprSplit : '=== statement ^ === expression v ===' ;'","':'","'|'","'expression'","'?'","'+'","'*'","'MeaningfulSplit : '=== meaningful ^ ===' ;'","'('","')'","'~'","'.'"],c=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Brackets","LexerIdentifier","ParserIdentifier","String","LabelForParserRule","Newline","WhiteSpace","BlockComment","FragmentComment","LineComment","ArrowComment"],h=["grammarFile","grammerDecl","statExprSplit","statementRule","expressionRule","arithmeticRuleCollection","parserRuleAtom","lexerRuleCollection","meaningfulSplit","lexerRule","strings","lexerRuleExpr"];function p(t){return r.Parser.call(this,t),this._interp=new r.atn.ParserATNSimulator(this,s,a,l),this.ruleNames=h,this.literalNames=u,this.symbolicNames=c,this}function f(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_grammarFile,this}function d(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_grammerDecl,this}function y(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_statExprSplit,this}function g(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_statementRule,this}function x(t,e){return g.call(this,t),g.prototype.copyFrom.call(this,e),this}function v(t,e){return g.call(this,t),g.prototype.copyFrom.call(this,e),this}function m(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_expressionRule,this}function _(t,e){return m.call(this,t),m.prototype.copyFrom.call(this,e),this}function T(t,e){return m.call(this,t),m.prototype.copyFrom.call(this,e),this}function S(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_arithmeticRuleCollection,this}function E(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_parserRuleAtom,this}function C(t,e){return E.call(this,t),E.prototype.copyFrom.call(this,e),this}function A(t,e){return E.call(this,t),E.prototype.copyFrom.call(this,e),this}function k(t,e){return E.call(this,t),E.prototype.copyFrom.call(this,e),this}function b(t,e){return E.call(this,t),E.prototype.copyFrom.call(this,e),this}function R(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_lexerRuleCollection,this}function L(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_meaningfulSplit,this}function N(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_lexerRule,this}function I(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function O(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function P(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function w(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_strings,this}function F(t,e,n){return void 0===e&&(e=null),void 0!==n&&null!==n||(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=p.RULE_lexerRuleExpr,this}p.prototype=Object.create(r.Parser.prototype),p.prototype.constructor=p,Object.defineProperty(p.prototype,"atn",{get:function(){return s}}),p.EOF=r.Token.EOF,p.T__0=1,p.T__1=2,p.T__2=3,p.T__3=4,p.T__4=5,p.T__5=6,p.T__6=7,p.T__7=8,p.T__8=9,p.T__9=10,p.T__10=11,p.T__11=12,p.T__12=13,p.T__13=14,p.Brackets=15,p.LexerIdentifier=16,p.ParserIdentifier=17,p.String=18,p.LabelForParserRule=19,p.Newline=20,p.WhiteSpace=21,p.BlockComment=22,p.FragmentComment=23,p.LineComment=24,p.ArrowComment=25,p.RULE_grammarFile=0,p.RULE_grammerDecl=1,p.RULE_statExprSplit=2,p.RULE_statementRule=3,p.RULE_expressionRule=4,p.RULE_arithmeticRuleCollection=5,p.RULE_parserRuleAtom=6,p.RULE_lexerRuleCollection=7,p.RULE_meaningfulSplit=8,p.RULE_lexerRule=9,p.RULE_strings=10,p.RULE_lexerRuleExpr=11,f.prototype=Object.create(r.ParserRuleContext.prototype),f.prototype.constructor=f,f.prototype.grammerDecl=function(){return this.getTypedRuleContext(d,0)},f.prototype.statExprSplit=function(){return this.getTypedRuleContext(y,0)},f.prototype.lexerRuleCollection=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(R):this.getTypedRuleContext(R,t)},f.prototype.meaningfulSplit=function(){return this.getTypedRuleContext(L,0)},f.prototype.statementRule=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(g):this.getTypedRuleContext(g,t)},f.prototype.expressionRule=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(m):this.getTypedRuleContext(m,t)},f.prototype.accept=function(t){return t instanceof i?t.visitGrammarFile(this):t.visitChildren(this)},p.GrammarFileContext=f,p.prototype.grammarFile=function(){var t=new f(this,this._ctx,this.state);this.enterRule(t,0,p.RULE_grammarFile);try{this.enterOuterAlt(t,1),this.state=24,this.grammerDecl(),this.state=28,this._errHandler.sync(this);for(var e=this._interp.adaptivePredict(this._input,0,this._ctx);1!=e&&e!=r.atn.ATN.INVALID_ALT_NUMBER;)2===e&&(this.state=25,this.statementRule()),this.state=30,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,0,this._ctx);this.state=31,this.statExprSplit(),this.state=35,this._errHandler.sync(this);for(e=this._interp.adaptivePredict(this._input,1,this._ctx);1!=e&&e!=r.atn.ATN.INVALID_ALT_NUMBER;)2===e&&(this.state=32,this.expressionRule()),this.state=37,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,1,this._ctx);this.state=38,this.lexerRuleCollection(),this.state=39,this.meaningfulSplit(),this.state=40,this.lexerRuleCollection()}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},d.prototype=Object.create(r.ParserRuleContext.prototype),d.prototype.constructor=d,d.prototype.LexerIdentifier=function(){return this.getToken(p.LexerIdentifier,0)},d.prototype.accept=function(t){return t instanceof i?t.visitGrammerDecl(this):t.visitChildren(this)},p.GrammerDeclContext=d,p.prototype.grammerDecl=function(){var t=new d(this,this._ctx,this.state);this.enterRule(t,2,p.RULE_grammerDecl);try{this.enterOuterAlt(t,1),this.state=42,this.match(p.T__0),this.state=43,this.match(p.LexerIdentifier),this.state=44,this.match(p.T__1)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},y.prototype=Object.create(r.ParserRuleContext.prototype),y.prototype.constructor=y,y.prototype.accept=function(t){return t instanceof i?t.visitStatExprSplit(this):t.visitChildren(this)},p.StatExprSplitContext=y,p.prototype.statExprSplit=function(){var t=new y(this,this._ctx,this.state);this.enterRule(t,4,p.RULE_statExprSplit);try{this.enterOuterAlt(t,1),this.state=46,this.match(p.T__2)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},g.prototype=Object.create(r.ParserRuleContext.prototype),g.prototype.constructor=g,g.prototype.copyFrom=function(t){r.ParserRuleContext.prototype.copyFrom.call(this,t)},x.prototype=Object.create(g.prototype),x.prototype.constructor=x,p.StatValueContext=x,x.prototype.ParserIdentifier=function(){return this.getToken(p.ParserIdentifier,0)},x.prototype.parserRuleAtom=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(E):this.getTypedRuleContext(E,t)},x.prototype.accept=function(t){return t instanceof i?t.visitStatValue(this):t.visitChildren(this)},v.prototype=Object.create(g.prototype),v.prototype.constructor=v,p.StatListContext=v,v.prototype.ParserIdentifier=function(t){return void 0===t&&(t=null),null===t?this.getTokens(p.ParserIdentifier):this.getToken(p.ParserIdentifier,t)},v.prototype.accept=function(t){return t instanceof i?t.visitStatList(this):t.visitChildren(this)},p.StatementRuleContext=g,p.prototype.statementRule=function(){var t=new g(this,this._ctx,this.state);this.enterRule(t,6,p.RULE_statementRule);var e=0;try{switch(this.state=67,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,4,this._ctx)){case 1:t=new v(this,t),this.enterOuterAlt(t,1),this.state=48,this.match(p.ParserIdentifier),this.state=49,this.match(p.T__3),this.state=50,this.match(p.ParserIdentifier),this.state=53,this._errHandler.sync(this),e=this._input.LA(1);do{this.state=51,this.match(p.T__4),this.state=52,this.match(p.ParserIdentifier),this.state=55,this._errHandler.sync(this),e=this._input.LA(1)}while(e===p.T__4);this.state=57,this.match(p.T__1);break;case 2:for(t=new x(this,t),this.enterOuterAlt(t,2),this.state=58,this.match(p.ParserIdentifier),this.state=59,this.match(p.T__3),this.state=63,this._errHandler.sync(this),e=this._input.LA(1);0==(-32&e)&&0!=(1<1)for(var i,o=0;i=t[1][o];o++)e[i]&&this.error("语句 "+i+" 同时在两个语句集合 "+e[i]+" 和 "+t[0]+" 中出现了"),e[i]=t[0],n(this.statementRules,i).length>1&&this.error(t[0]+" 下的子规则 "+i+' 包含了"|"');var s;for(r=0;s=this.expressionRules[r];r++)s[1].length>1&&"expression"!==s[0]&&this.error("表达式 "+s[0]+' 包含了"|"')},SymbolVisitor.prototype.visitGrammarFile=function(t){return this.visit(t.grammerDecl()),this.visit(t.statementRule()),this.visit(t.expressionRule()),this.visit(t.lexerRuleCollection(0)),this},SymbolVisitor.prototype.visitGrammerDecl=function(t){this.grammerName=t.children[1].getText()},SymbolVisitor.prototype.visitStatList=function(t){for(var e,n=t.ParserIdentifier(),r=0;e=n[r];r++)n[r]=e.getText();var i=n.shift();this.statementRules.push([i,n])},SymbolVisitor.prototype.visitStatValue=function(t){var e=t.ParserIdentifier(0).getText();this.statementRules.push([e,[e]])},SymbolVisitor.prototype.visitExprExpression=function(t){var e=[];this.expression_arithmetic_num=t.arithmeticRuleCollection().length;for(var n=0;n1){this.notEntry[t[e]]=!0;for(var n,r=0;n=o.check[r];r++){var i=this.getRule("statement",n);i.blockjs.nextStatement=o.check,this.setRule("statement",n,i),this.notEntry[n]=!0}}for(e=0;o=this.statementRules[t[e]];e++)this.notEntry[t[e]]||(this.notEntry[t[e]]=!1,delete o.blockjs.previousStatement,delete o.blockjs.nextStatement,delete o.blockjs.inputsInline,o.blockjs.colour=this.entryColor);var o,s=[],a=[];for(e=0;o=this.statementRules[t[e]];e++)if(o.check.length>1)a.push([t[e],o]);else{s.push(o),o.type="statement";var l=[],u="",c=function(t){t>0&&(u+=Array(2*t+1).join(" ")),t<0&&(u=u.slice(0,2*t))},h="Blockly."+this.generLanguage+".";l.push(u+"function(block) {\n"),c(1);for(r=0;y=o.blockobj.args[r];r++){var p=this.varPrefix+o.blockobj.vars[r];if(y.id&&"field_image"!=y.data.type)"value"===y.blockType?(l.push(u+"var "+p+" = "+h+"valueToCode(block, '"),l.push(p+"', \n "+u+h+this.recieveOrder+")")):"statement"===y.blockType?(l.push(u+"var "+p+" = "+h+"statementToCode(block, '"),l.push(p+"')")):(l.push(u+"var "+p+" = block.getFieldValue('"),l.push(p+"')")),"field_checkbox"===y.data.type&&l.push(" === 'TRUE'"),l.push(";\n"),y.multi,{field_checkbox:!0,field_dropdown:!0,field_number:!0,field_colour:!0,field_angle:!0,field_image:!0}[y.data.type]||y.omitted||(l.push(u+"if ("+p+"==='') {\n"),c(1),l.push(u+"throw new OmitedError(block,'"+p+"','"),l.push(t[e]+"');\n"),c(-1),l.push(u+"}\n")),"field"===y.blockType&&(l.push(u+p+" = "+this.grammerName+"Functions.pre('"),l.push(y.id+"')("+p+");\n"))}o.blockobj.inject.generFunc?(o.blockobj.inject.override&&(c(-9999),(l=[]).push(u+"function(block) {\n"),c(1)),l.push(u+o.blockobj.inject.generFunc.split("\n").join("\n"+u)),l.push("\n")):(l.push(u+"var code = "+this.grammerName+"Functions.defaultCode('"),l.push(o.check[0]+"',["+o.blockobj.vars.map(function(t){return null==t?'"\\n"':t}).join(",")+"]);\n"),l.push(u+"return code;\n")),c(-1),l.push(u+"}"),o.generFunc=l.join("")}t=Object.keys(this.expressionRules);var f;for(e=0;f=this.expressionRules[t[e]];e++)if(f.check.length>1)a.push([t[e],f]);else{s.push(f),f.type="value";l=[],u="",c=function(t){t>0&&(u+=Array(2*t+1).join(" ")),t<0&&(u=u.slice(0,2*t))},h="Blockly."+this.generLanguage+".";l.push(u+"function(block) {\n"),c(1);for(r=0;y=f.blockobj.args[r];r++){p=this.varPrefix+f.blockobj.vars[r];if(y.id)"value"===y.blockType?(l.push(u+"var "+p+" = "+h+"valueToCode(block, '"),l.push(p+"', \n "+u+h+this.recieveOrder+")")):"statement"===y.blockType?(l.push(u+"var "+p+" = "+h+"statementToCode(block, '"),l.push(p+"')")):(l.push(u+"var "+p+" = block.getFieldValue('"),l.push(p+"')")),"field_checkbox"===y.data.type&&l.push(" === 'TRUE'"),l.push(";\n"),y.multi,{field_checkbox:!0,field_dropdown:!0,field_number:!0,field_colour:!0,field_angle:!0,field_image:!0}[y.data.type]||y.omitted||(l.push(u+"if ("+p+"==='') {\n"),c(1),l.push(u+"throw new OmitedError(block,'"+p+"','"),l.push(t[e]+"');\n"),c(-1),l.push(u+"}\n")),"field"===y.blockType&&(l.push(u+p+" = "+this.grammerName+"Functions.pre('"),l.push(y.id+"')("+p+");\n"))}f.blockobj.inject.generFunc?(f.blockobj.inject.override&&(c(-9999),(l=[]).push(u+"function(block) {\n"),c(1)),l.push(u+f.blockobj.inject.generFunc.split("\n").join("\n"+u)),l.push("\n")):(l.push(u+"var code = "+this.grammerName+"Functions.defaultCode('"),l.push(f.check[0]+"',["+f.blockobj.vars.map(function(t){return null==t?'"\\n"':t}).join(",")+"]);\n"),l.push(u+"return [code, "+h+this.sendOrder+"];\n")),c(-1),l.push(u+"}"),f.generFunc=l.join("")}var d;for(e=0;d=s[e];e++){d.args=[],d.argsType=[],d.argsGrammarName=[];var y;for(r=0;y=d.blockobj.args[r];r++)y.id&&"field_image"!=y.data.type&&(d.args.push(d.blockobj.vars[r]),d.argsType.push(y.blockType),d.argsGrammarName.push(y.id));l=[],u="",c=function(t){t>0&&(u+=Array(2*t+1).join(" ")),t<0&&(u=u.slice(0,2*t))};var g=this.grammerName,x=d.check[0];l.push(u+"function (inputs,isShadow,comment) {\n"),c(1),l.push(u+"return "+g+"Functions.xmlText('"),l.push(x+"',inputs,isShadow,comment);\n"),c(-1),l.push(u+"}"),d.xmlText=l.join(""),l=[],c(-9999),l.push(u+"function (keyOrIndex) {\n"),c(1),l.push(u+"return "+g+"Functions.fieldDefault('"),l.push(x+"',keyOrIndex);\n"),c(-1),l.push(u+"}"),d.fieldDefault=l.join("")}this.temp_xml=s,this.temp_collection=a},EvalVisitor.prototype.generBlocks=function(){var t=[],e="",n=function(t){t>0&&(e+=Array(2*t+1).join(" ")),t<0&&(e=e.slice(0,2*t))},r=this.temp_xml;delete this.temp_xml;var i=this.temp_collection;delete this.temp_collection,t.push(e+"// 语句集合和表达式集合\n"),t.push(e+this.grammerName+"Blocks = {\n"),n(1);for(var o,s=0;o=i[s];s++)t.push(e+'"'+o[0]+'": '),t.push(JSON.stringify(o[1].check,null,2).split("\n").join("\n"+e)),t.push(",\n");function a(t,e,n){for(var r=JSON.parse(JSON.stringify(e.blockjs)),o={},s=0;c=e.blockobj.args[s];s++)if(c.id){var a=t.getRule(c.blockType,c.id);a&&1!==a.check.length&&(r.args0[s].check="1_fry2_3_inrgv"+c.id,o['"1_fry2_3_inrgv'+c.id+'"']=t.grammerName+"Blocks."+c.id)}if(r.nextStatement)for(var l,u=0;l=i[u];u++)if(-1!==l[1].check.indexOf(r.type)){r.nextStatement="1_fry2_3_inrgv"+l[0],o['"1_fry2_3_inrgv'+l[0]+'"']=t.grammerName+"Blocks."+l[0];break}s=0;for(var c,h=0;c=e.blockobj.args[s];s++)c.id&&"field_image"!=c.data.type&&"field"==e.argsType[h++]&&(o['"1_fry2_3_inrgv'+c.id+r.args0[s].name+'"']="Object.assign({},"+t.grammerName+"Blocks."+c.id+","+JSON.stringify(r.args0[s],null,2).split("\n").join("\n"+n+" ")+")",r.args0[s]="1_fry2_3_inrgv"+c.id+r.args0[s].name);var p=JSON.stringify(r,null,2).split("\n").join("\n"+n);for(var f in o)p=p.split(f).join(o[f]);return p}t.pop(),t.push("\n"),n(-1),t.push(e+"}\n"),t.push(e+"// 所有域的默认行为\n"),t.push(e+this.grammerName+"Blocks = Object.assign("),t.push(this.grammerName+"Blocks,"),t.push(function(t){var n=0,r={},i=JSON.stringify(t,function(t,i){return"options"===t&&"string"==typeof i&&"function"===i.slice(0,8)?(r['"_'+ ++n+'_1_fry2_3_inrgv"']=i.split("\n").join("\n "+e),"_"+n+"_1_fry2_3_inrgv"):i},2).split("\n").join("\n"+e);for(var o in r)i=i.split(o).join(r[o]);return i}(this.lexerRules)),t.push(e+");\n"),t.push(e+"// 所有方块的实际内容\n"),t.push(e+this.grammerName+"Blocks = Object.assign("),t.push(this.grammerName+"Blocks,{\n"),n(1);var l;for(s=0;l=r[s];s++){for(var u in t.push(e+'"'+l.check[0]+'": {\n'),n(1),t.push(e+'"type": "'+l.type+'",\n'),t.push(e+'"json": '),t.push(a(this,l,e)),t.push(",\n"),t.push(e+'"generFunc": '),t.push(l.generFunc.split("\n").join("\n"+e)),t.push(",\n"),t.push(e+'"args": '),t.push(JSON.stringify(l.args,null,2).split("\n").join("\n"+e)),t.push(",\n"),t.push(e+'"argsType": '),t.push(JSON.stringify(l.argsType,null,0)),t.push(",\n"),t.push(e+'"argsGrammarName": '),t.push(JSON.stringify(l.argsGrammarName,null,0)),t.push(",\n"),t.push(e+'"fieldDefault": '),t.push(l.fieldDefault.split("\n").join("\n"+e)),t.push(",\n"),t.push(e+'"menu": '),t.push(l.blockobj.inject.menu||"[]"),t.push(",\n"),l.blockobj.inject)-1===this.inject.indexOf(u)&&(t.push(e+'"'+u+'": '),t.push(JSON.stringify(l.blockobj.inject[u],null,0)),t.push(",\n"));t.push(e+'"xmlText": '),t.push(l.xmlText.split("\n").join("\n"+e)),t.push("\n"),n(-1),t.push(e+"},\n")}t.pop(),t.push(e+"}\n"),n(-1),t.push(e+"});\n"),this.blocks=t.join("")},EvalVisitor.prototype.SpeicalLexerRule=function(t){var e={};return"Bool"===t?(e={type:"field_checkbox",checked:!0},this.setRule("lexer",t,e),!0):"Int"===t?(e={type:"field_number",value:0,min:0,precision:1},this.setRule("lexer",t,e),!0):"Number"===t?(e={type:"field_number",value:0},this.setRule("lexer",t,e),!0):"Colour"===t?(e={type:"field_colour",colour:"#ff0000"},this.setRule("lexer",t,e),!0):"Angle"===t?(e={type:"field_angle",angle:90},this.setRule("lexer",t,e),!0):"BGNL"===t&&(e={type:"input_dummy"},this.setRule("lexer",t,e),!0)},EvalVisitor.prototype.visitGrammarFile=function(t){this.visit(t.lexerRuleCollection(0)),this.visit(t.statementRule()),this.expression_arithmetic_num=0,this.visit(t.expressionRule()),this.assemble()},EvalVisitor.prototype.visitStrings=function(t){for(var e,n=t.String(),r=0;e=n[r];r++)n[r]=this.escapeString(e.getText());return n.join(" ")},EvalVisitor.prototype.visitLexerRuleStrings=function(t){var e=t.LexerIdentifier(0).getText();if(!this.SpeicalLexerRule(e)){var n=this.visit(t.strings(0));this.setRule("lexer",e,n)}},EvalVisitor.prototype.visitLexerRuleList=function(ctx){var lexerId=ctx.LexerIdentifier(0).getText();if(!this.SpeicalLexerRule(lexerId))if("_List"===lexerId.slice(-5)||"_Img"===lexerId.slice(-4)){var strings=ctx.strings(),values=this.matchInject(lexerId);if(values=values?eval("("+values+")"):[],"function"!=typeof values){for(var ii=0,value;value=strings[ii];ii++){var string_=this.visit(value);strings[ii]=[string_,null==values[ii]?string_:values[ii]]}if("_List"===lexerId.slice(-5))var lexervalue={type:"field_dropdown",options:strings,default:strings[0][1]};else var lexervalue={type:"field_image",src:strings[0][0],width:strings[1]&&strings[1][0]||0,height:strings[2]&&strings[2][0]||0,alt:strings[3]&&strings[3][0]||"img"};this.setRule("lexer",lexerId,lexervalue)}else{var lexervalue={type:"field_dropdown",options:values.toString(),default:this.visit(strings[1])};this.setRule("lexer",lexerId,lexervalue)}}else this.visitLexerRuleComplex(ctx)},EvalVisitor.prototype.visitLexerRuleComplex=function(t){var e=t.LexerIdentifier(0).getText();if(!this.SpeicalLexerRule(e)){var n={type:"_Multi"!==e.slice(-6)?"field_input":"field_multilinetext",text:e+"_default"};this.setRule("lexer",e,n)}},EvalVisitor.prototype.visitStatValue=function(t){this.status={name:t.ParserIdentifier(0).getText(),type:"statement",message:[],args:[]},this.visitChildren(t);var e=this.status;delete this.status,this.initAssemble(e)},BlocklyGrammerVisitor.prototype.visitArithmeticRuleCollection=function(t){this.status={name:"expression",type:"value",message:["%1"],args:[{id:"expression",blockType:"value",omitted:!1,data:{type:"input_value"}}]},this.visitChildren(t),this.status.name="expression_arithmetic_"+this.expression_arithmetic_num,this.expression_arithmetic_num++;var e=this.status;delete this.status,this.initAssemble(e)},BlocklyGrammerVisitor.prototype.visitExprValue=function(t){this.status={name:t.ParserIdentifier(0).getText(),type:"value",message:[],args:[]},this.visitChildren(t);var e=this.status;delete this.status,this.initAssemble(e)},EvalVisitor.prototype.visitParserAtomExpr=function(t){var e={id:"expression",blockType:"value",omitted:t.children.length>1,data:{type:"input_value"}};this.status.args.push(e),this.status.message.push("%"+this.status.args.length)},EvalVisitor.prototype.visitParserAtomParserId=function(t){var e=t.children[0].getText(),n=t.children.length>1&&t.children[1].getText()||"",r=this.getRule("value",e)?"value":"statement",i={id:e,blockType:r,omitted:"?"===n||"*"===n,multi:"+"===n||"*"===n,data:{type:"input_"+r}};"value"===r&&i.multi&&this.error(this.status.name+" 下出现了复数组合的表达式 "+e+n),this.status.args.push(i),this.status.message.push("%"+this.status.args.length)},EvalVisitor.prototype.visitParserAtomLexerId=function(t){var e=t.children[0].getText(),n=this.getRule("lexer",e);if(n){var r={id:e,blockType:"field",omitted:t.children.length>1,data:n};"BGNL"===e&&(r={data:n}),"string"!=typeof n?(this.status.args.push(r),this.status.message.push("%"+this.status.args.length)):this.status.message.push(n)}},EvalVisitor.prototype.visitParserAtomStr=function(t){var e=this.escapeString(t.String().getText());this.status.message.push(e)},exports.SymbolVisitor=SymbolVisitor,exports.EvalVisitor=EvalVisitor},function(t,e){e.OmitedError=function(){return"//生成代码中,当一个不允许省略的值或块省略时,会抛出这个错误\nfunction OmitedError(block, var_, rule, fileName, lineNumber) {\n var message = 'no omitted '+var_+' at '+rule;\n var instance = new Error(message, fileName, lineNumber);\n instance.block = block;\n instance.varName = var_;\n instance.blockName = rule;\n instance.name = 'OmitedError';\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n if (Error.captureStackTrace) {\n Error.captureStackTrace(instance, OmitedError);\n }\n return instance;\n}\n\nOmitedError.prototype = Object.create(Error.prototype);\nOmitedError.prototype.constructor = OmitedError;\n//处理此错误的omitedcheckUpdateFunction定义在下面\n"},e.Functions_pre=function(t){return`${t}Functions.Int_pre = function(intstr) {\n return parseInt(intstr);\n}\n\n${t}Functions.Number_pre = function(intstr) {\n return parseFloat(intstr);\n}\n\n//返回各LexerRule文本域的预处理函数,方便用来统一转义等等\n${t}Functions.pre = function(LexerId) {\n if (${t}Functions.hasOwnProperty(LexerId+'_pre')) {\n return ${t}Functions[LexerId+'_pre'];\n }\n return function(obj){return obj}\n}\n`},e.Functions_fieldDefault=function(t){return`// ${t}Functions.fieldDefault\n// 根据输入是整数字符串或null\n// 第index个或者名字为key的域的默认值, null时返回所有field默认值的数组\n${t}Functions.fieldDefault = function (ruleName,keyOrIndex) {\n var rule = ${t}Blocks[ruleName];\n var iskey=typeof keyOrIndex==typeof '';\n var isindex=typeof keyOrIndex==typeof 0;\n function args0_content_to_default(cnt) {\n var key = ({\n 'field_input':'text',\n 'field_multilinetext':'text',\n 'field_number':'value',\n 'field_dropdown':'default',\n 'field_checkbox':'checked',\n 'field_colour':'colour',\n 'field_angle':'angle',\n // 'field_image':'src'\n })[cnt.type];\n return cnt[key];\n }\n var allDefault=[];\n for(var ii=0,index=-1,cnt;cnt=rule.json.args0[ii];ii++){\n if (!cnt.name || cnt.type.slice(0,5)!='field' || cnt.type=='field_image') continue;\n index++;\n if (iskey && cnt.name==keyOrIndex)return args0_content_to_default(cnt);\n if (isindex && index==keyOrIndex)return args0_content_to_default(cnt);\n allDefault.push(args0_content_to_default(cnt))\n }\n if (iskey || isindex) return undefined;\n return allDefault;\n}\n`},e.Functions_defaultCode=function(t){return`// ${t}Functions.defaultCode\n${t}Functions.defaultCode = function (ruleName,args) {\n var rule = ${t}Blocks[ruleName];\n var message=rule.json.message0;\n for(var ii=0;ii');\n if(!inputs)inputs=[];\n for (var ii=0,inputType;inputType=rule.argsType[ii];ii++) {\n var input = inputs[ii];\n var _input = '';\n var noinput = (input===null || input===undefined);\n if(noinput && inputType==='field' && ${t}Blocks[rule.argsGrammarName[ii]].type!=='field_dropdown') continue;\n if(noinput && inputType==='field') {\n noinput = false;\n input = rule.fieldDefault(rule.args[ii])\n }\n if(noinput) input = '';\n if(inputType!=='field') {\n var subList = false;\n var subrulename = rule.argsGrammarName[ii];\n var subrule = ${t}Blocks[subrulename];\n if (subrule instanceof Array) {\n subrulename=subrule[subrule.length-1];\n subrule = ${t}Blocks[subrulename];\n subList = true;\n }\n _input = subrule.xmlText([],true);\n if(noinput && !subList && !isShadow) {\n //无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块\n input = subrule.xmlText();\n }\n }\n xmlText.push('<'+inputType+' name="'+rule.args[ii]+'">');\n xmlText.push(_input+input);\n xmlText.push('');\n }\n if(comment){\n xmlText.push('/g,'] ] >'));\n xmlText.push(']]>');\n }\n var next = inputs[rule.args.length];\n if (next) {//next\n xmlText.push('');\n xmlText.push(next);\n xmlText.push('');\n }\n xmlText.push('');\n return xmlText.join('');\n}\n`},e.Functions_blocksIniter=function(t,e){return`// ${t}Functions.blocksIniter\n// 把各方块的信息注册到Blockly中\n${t}Functions.blocksIniter = function(){\n var blocksobj = ${t}Blocks;\n for(var key in blocksobj) {\n var value = blocksobj[key];\n if(value instanceof Array)continue;\n if(/^[A-Z].*$/.exec(key))continue;\n (function(key,value){\n if (value.menu && value.menu.length) {\n var menuRegisterMixin={\n customContextMenu: function(options) {\n for(var ii=0,op;op=value.menu[ii];ii++){\n var option = {enabled: true};\n option.text = op[0];\n var check = 'function('\n if (option.text.slice(0,check.length)==check){\n option.text=eval('('+option.text+')(this)');\n }\n (function(block,fstr){\n option.callback = function(){\n eval(fstr)\n }\n })(this,op[1]);\n options.push(option);\n }\n }\n };\n value.json.extensions=value.json.extensions||[];\n var mixinName = 'contextMenu_${t}_'+value.json.type\n value.json.extensions.push(mixinName)\n Blockly.Extensions.registerMixin(mixinName,menuRegisterMixin);\n }\n Blockly.Blocks[key] = {\n init: function() {this.jsonInit(value.json);}\n }\n Blockly.${e}[key] = value.generFunc;\n })(key,value);\n }\n}\n`},e.ToolboxObj=function(t,e,n){return`\nvar ${t} = (function(){\n\n var toolboxXml=document.createElement('xml')\n\n // 调整这个obj来更改侧边栏和其中的方块\n // 可以直接填 '...'\n // 标签 ''\n var toolboxObj = ${e}\n\n var getCategory = function(toolboxXml,name,custom){\n var node = document.createElement('category');\n node.setAttribute('name',name);\n if(custom)node.setAttribute('custom',custom);\n toolboxXml.appendChild(node);\n return node;\n }\n\n var toolboxGap = ''\n\n for (var name in toolboxObj){\n var custom = null;\n if(name=='xxxxxx')custom='xxxxxx';\n if(name=='zzzzzz')custom='zzzzzz';\n getCategory(toolboxXml,name,custom).innerHTML = toolboxObj[name].join(toolboxGap);\n var node = document.createElement('sep');\n node.setAttribute('gap',${n}*3);\n toolboxXml.appendChild(node);\n }\n\n return toolboxXml;\n})();\n`},e.mainFileTPL=function(t,e,n,r,i,o,s,a){return[`\n\n\n${t} --antlr-blockly`,'\n