cyclone-analyzer
Version:
A static analyzer library for Cyclone specification language
1 lines • 384 kB
JavaScript
(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{analyzer:()=>ci,blockBuilder:()=>hi,default:()=>ui,generated:()=>li,language:()=>oi,lib:()=>ai,utils:()=>ri});const n=(t,e)=>({line:t,column:e}),i=(t,e,i,s)=>({startPosition:n(t,e),stopPosition:n(i,s)}),s={pos:n,posPair:i,posRangeIncludes:(t,e)=>{let{line:n,column:i}=t;const{startPosition:s,stopPosition:r}=e;return n>=s.line&&n<=r.line&&(n>s.line&&n<r.line||n===s.line&&i>=s.column||n===r.line&&i<=r.column)}};var r={92:()=>{}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var n=a[t]={exports:{}};return r[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var l={};(()=>{o.d(l,{dx:()=>Y,q2:()=>kt,FO:()=>ye,xf:()=>Ce,Gy:()=>Oe,s4:()=>bt,c7:()=>we,_7:()=>le,tx:()=>_e,gp:()=>Te,cK:()=>vt,zs:()=>ge,AV:()=>Ce,Xp:()=>T,VS:()=>m,ul:()=>Q,hW:()=>Ut,x1:()=>jt,z5:()=>ee,oN:()=>de,TB:()=>pe,u1:()=>xe,_b:()=>De,$F:()=>ie,_T:()=>He,db:()=>se,Zx:()=>te,_x:()=>Dt,r8:()=>M,JI:()=>P,TP:()=>b,WU:()=>t,Nj:()=>c,ZP:()=>Qe});class t{constructor(){this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(t){this._text=t}}function e(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!(t[n]===e[n]||t[n].equals&&t[n].equals(e[n])))return!1;return!0}t.INVALID_TYPE=0,t.EPSILON=-2,t.MIN_USER_TOKEN_TYPE=1,t.EOF=-1,t.DEFAULT_CHANNEL=0,t.HIDDEN_CHANNEL=1;const n=Math.round(Math.random()*Math.pow(2,32));function i(t){if(!t)return 0;const e=typeof t,i="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!i)return 0;let s,r;const a=3&i.length,o=i.length-a;let l=n;const h=3432918353,c=461845907;let u=0;for(;u<o;)r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24,++u,r=(65535&r)*h+(((r>>>16)*h&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,l^=r,l=l<<13|l>>>19,s=5*(65535&l)+((5*(l>>>16)&65535)<<16)&4294967295,l=27492+(65535&s)+((58964+(s>>>16)&65535)<<16);switch(r=0,a){case 3:r^=(255&i.charCodeAt(u+2))<<16;case 2:r^=(255&i.charCodeAt(u+1))<<8;case 1:r^=255&i.charCodeAt(u),r=(65535&r)*h+(((r>>>16)*h&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,l^=r}return l^=i.length,l^=l>>>16,l=2246822507*(65535&l)+((2246822507*(l>>>16)&65535)<<16)&4294967295,l^=l>>>13,l=3266489909*(65535&l)+((3266489909*(l>>>16)&65535)<<16)&4294967295,l^=l>>>16,l>>>0}class s{constructor(){this.count=0,this.hash=0}update(){for(let t=0;t<arguments.length;t++){const e=arguments[t];if(null!=e)if(Array.isArray(e))this.update.apply(this,e);else{let t=0;switch(typeof e){case"undefined":case"function":continue;case"number":case"boolean":t=e;break;case"string":t=i(e);break;default:e.updateHashCode?e.updateHashCode(this):console.log("No updateHashCode for "+e.toString());continue}t*=3432918353,t=t<<15|t>>>17,t*=461845907,this.count=this.count+1;let n=this.hash^t;n=n<<13|n>>>19,n=5*n+3864292196,this.hash=n}}}finish(){let t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16,t}static hashStuff(){const t=new s;return t.update.apply(t,arguments),t.finish()}}function r(t){return t?"string"==typeof t?i(t):t.hashCode():-1}function a(t,e){return t?t.equals(e):t===e}function h(t){return null===t?"null":t}function c(t){return Array.isArray(t)?"["+t.map(h).join(", ")+"]":"null"}const u="h-";class d{constructor(t,e){this.data={},this.hashFunction=t||r,this.equalsFunction=e||a}add(t){const e=u+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++)if(this.equalsFunction(t,n[e]))return n[e];return n.push(t),t}return this.data[e]=[t],t}has(t){return null!=this.get(t)}get(t){const e=u+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++)if(this.equalsFunction(t,n[e]))return n[e]}return null}values(){return Object.keys(this.data).filter((t=>t.startsWith(u))).flatMap((t=>this.data[t]),this)}toString(){return c(this.values())}get length(){return Object.keys(this.data).filter((t=>t.startsWith(u))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}class p{hashCode(){const t=new s;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===p.NONE)return e;if(null===e||e===p.NONE)return t;const n=new x(t,e);return 1===n.opnds.length?n.opnds[0]:n}static orContext(t,e){if(null===t)return e;if(null===e)return t;if(t===p.NONE||e===p.NONE)return p.NONE;const n=new f(t,e);return 1===n.opnds.length?n.opnds[0]:n}}class x extends p{constructor(t,e){super();const n=new d;t instanceof x?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof x?e.opnds.map((function(t){n.add(t)})):n.add(e);const i=E(n);if(i.length>0){let t=null;i.map((function(e){(null===t||e.precedence<t.precedence)&&(t=e)})),n.add(t)}this.opnds=Array.from(n.values())}equals(t){return this===t||t instanceof x&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"AND")}evaluate(t,e){for(let n=0;n<this.opnds.length;n++)if(!this.opnds[n].evaluate(t,e))return!1;return!0}evalPrecedence(t,e){let n=!1;const i=[];for(let s=0;s<this.opnds.length;s++){const r=this.opnds[s],a=r.evalPrecedence(t,e);if(n|=a!==r,null===a)return null;a!==p.NONE&&i.push(a)}if(!n)return this;if(0===i.length)return p.NONE;let s=null;return i.map((function(t){s=null===s?t:p.andContext(s,t)})),s}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("&&")}}class f extends p{constructor(t,e){super();const n=new d;t instanceof f?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof f?e.opnds.map((function(t){n.add(t)})):n.add(e);const i=E(n);if(i.length>0){const t=i.sort((function(t,e){return t.compareTo(e)})),e=t[t.length-1];n.add(e)}this.opnds=Array.from(n.values())}equals(t){return this===t||t instanceof f&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"OR")}evaluate(t,e){for(let n=0;n<this.opnds.length;n++)if(this.opnds[n].evaluate(t,e))return!0;return!1}evalPrecedence(t,e){let n=!1;const i=[];for(let s=0;s<this.opnds.length;s++){const r=this.opnds[s],a=r.evalPrecedence(t,e);if(n|=a!==r,a===p.NONE)return p.NONE;null!==a&&i.push(a)}return n?(0===i.length||i.map((function(t){return t})),null):this}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("||")}}function E(t){const e=[];return t.values().map((function(t){t instanceof p.PrecedencePredicate&&e.push(t)})),e}function g(t,e){if(null===t){const t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}{const n={};return n.state=t.state||null,n.alt=void 0===t.alt?null:t.alt,n.context=t.context||null,n.semanticContext=t.semanticContext||null,e&&(n.reachesIntoOuterContext=t.reachesIntoOuterContext||0,n.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),n}}class R{constructor(t,e){this.checkContext(t,e),t=g(t),e=g(e,!0),this.state=null!==t.state?t.state:e.state,this.alt=null!==t.alt?t.alt:e.alt,this.context=null!==t.context?t.context:e.context,this.semanticContext=null!==t.semanticContext?t.semanticContext:null!==e.semanticContext?e.semanticContext:p.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed}checkContext(t,e){null!==t.context&&void 0!==t.context||null!==e&&null!==e.context&&void 0!==e.context||(this.context=null)}hashCode(){const t=new s;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(t){return this===t||t instanceof R&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&(null===this.context?null===t.context:this.context.equals(t.context))&&this.semanticContext.equals(t.semanticContext)&&this.precedenceFilterSuppressed===t.precedenceFilterSuppressed}hashCodeForConfigSet(){const t=new s;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof R&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&this.semanticContext.equals(t.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==p.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class T{constructor(t,e){this.start=t,this.stop=e}clone(){return new T(this.start,this.stop)}contains(t){return t>=this.start&&t<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}T.INVALID_INTERVAL=new T(-1,-2);class m{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?t.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new T(t,t+1))}addRange(t,e){this.addInterval(new T(t,e+1))}addInterval(t){if(null===this.intervals)this.intervals=[],this.intervals.push(t.clone());else{for(let e=0;e<this.intervals.length;e++){const n=this.intervals[e];if(t.stop<n.start)return void this.intervals.splice(e,0,t);if(t.stop===n.start)return void(this.intervals[e]=new T(t.start,n.stop));if(t.start<=n.stop)return this.intervals[e]=new T(Math.min(n.start,t.start),Math.max(n.stop,t.stop)),void this.reduce(e)}this.intervals.push(t.clone())}}addSet(t){return null!==t.intervals&&t.intervals.forEach((t=>this.addInterval(t)),this),this}reduce(t){if(t<this.intervals.length-1){const e=this.intervals[t],n=this.intervals[t+1];e.stop>=n.stop?(this.intervals.splice(t+1,1),this.reduce(t)):e.stop>=n.start&&(this.intervals[t]=new T(e.start,n.stop),this.intervals.splice(t+1,1))}}complement(t,e){const n=new m;return n.addInterval(new T(t,e+1)),null!==this.intervals&&this.intervals.forEach((t=>n.removeRange(t))),n}contains(t){if(null===this.intervals)return!1;for(let e=0;e<this.intervals.length;e++)if(this.intervals[e].contains(t))return!0;return!1}removeRange(t){if(t.start===t.stop-1)this.removeOne(t.start);else if(null!==this.intervals){let e=0;for(let n=0;n<this.intervals.length;n++){const n=this.intervals[e];if(t.stop<=n.start)return;if(t.start>n.start&&t.stop<n.stop){this.intervals[e]=new T(n.start,t.start);const i=new T(t.stop,n.stop);return void this.intervals.splice(e,0,i)}t.start<=n.start&&t.stop>=n.stop?(this.intervals.splice(e,1),e-=1):t.start<n.stop?this.intervals[e]=new T(n.start,t.start):t.stop<n.stop&&(this.intervals[e]=new T(t.stop,n.stop)),e+=1}}}removeOne(t){if(null!==this.intervals)for(let e=0;e<this.intervals.length;e++){const n=this.intervals[e];if(t<n.start)return;if(t===n.start&&t===n.stop-1)return void this.intervals.splice(e,1);if(t===n.start)return void(this.intervals[e]=new T(n.start+1,n.stop));if(t===n.stop-1)return void(this.intervals[e]=new T(n.start,n.stop-1));if(t<n.stop-1){const i=new T(n.start,t);return n.start=t+1,void this.intervals.splice(e,0,i)}}}toString(t,e,n){return t=t||null,e=e||null,n=n||!1,null===this.intervals?"{}":null!==t||null!==e?this.toTokenString(t,e):n?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let n=0;n<this.intervals.length;n++){const i=this.intervals[n];i.stop===i.start+1?i.start===t.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(i.start)+"'"):e.push("'"+String.fromCharCode(i.start)+"'..'"+String.fromCharCode(i.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let n=0;n<this.intervals.length;n++){const i=this.intervals[n];i.stop===i.start+1?i.start===t.EOF?e.push("<EOF>"):e.push(i.start.toString()):e.push(i.start.toString()+".."+(i.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(t,e){const n=[];for(let i=0;i<this.intervals.length;i++){const s=this.intervals[i];for(let i=s.start;i<s.stop;i++)n.push(this.elementName(t,e,i))}return n.length>1?"{"+n.join(", ")+"}":n[0]}elementName(e,n,i){return i===t.EOF?"<EOF>":i===t.EPSILON?"<EPSILON>":e[i]||n[i]}get length(){return this.intervals.map((t=>t.length)).reduce(((t,e)=>t+e))}}class S{constructor(){this.atn=null,this.stateNumber=S.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(t){return t instanceof S&&this.stateNumber===t.stateNumber}isNonGreedyExitState(){return!1}addTransition(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)}}S.INVALID_TYPE=0,S.BASIC=1,S.RULE_START=2,S.BLOCK_START=3,S.PLUS_BLOCK_START=4,S.STAR_BLOCK_START=5,S.TOKEN_START=6,S.RULE_STOP=7,S.BLOCK_END=8,S.STAR_LOOP_BACK=9,S.STAR_LOOP_ENTRY=10,S.PLUS_LOOP_BACK=11,S.LOOP_END=12,S.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"],S.INVALID_STATE_NUMBER=-1;class _ extends S{constructor(){return super(),this.stateType=S.RULE_STOP,this}}class y{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}y.EPSILON=1,y.RANGE=2,y.RULE=3,y.PREDICATE=4,y.ATOM=5,y.ACTION=6,y.SET=7,y.NOT_SET=8,y.WILDCARD=9,y.PRECEDENCE=10,y.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],y.serializationTypes={EpsilonTransition:y.EPSILON,RangeTransition:y.RANGE,RuleTransition:y.RULE,PredicateTransition:y.PREDICATE,AtomTransition:y.ATOM,ActionTransition:y.ACTION,SetTransition:y.SET,NotSetTransition:y.NOT_SET,WildcardTransition:y.WILDCARD,PrecedencePredicateTransition:y.PRECEDENCE};class A extends y{constructor(t,e,n,i){super(t),this.ruleIndex=e,this.precedence=n,this.followState=i,this.serializationType=y.RULE,this.isEpsilon=!0}matches(t,e,n){return!1}}class L extends y{constructor(e,n){super(e),this.serializationType=y.SET,null!=n?this.label=n:(this.label=new m,this.label.addOne(t.INVALID_TYPE))}matches(t,e,n){return this.label.contains(t)}toString(){return this.label.toString()}}class C extends L{constructor(t,e){super(t,e),this.serializationType=y.NOT_SET}matches(t,e,n){return t>=e&&t<=n&&!super.matches(t,e,n)}toString(){return"~"+super.toString()}}class I extends y{constructor(t){super(t),this.serializationType=y.WILDCARD}matches(t,e,n){return t>=e&&t<=n}toString(){return"."}}class k extends y{constructor(t){super(t)}}class v{}class O extends v{}class N extends O{}class P extends N{get ruleContext(){throw new Error("missing interface implementation")}}class b extends N{}class w extends b{}const B={toStringTree:function(t,e,n){e=e||null,null!==(n=n||null)&&(e=n.ruleNames);let i=B.getNodeText(t,e);i=function(t,e){return t.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(i);const s=t.getChildCount();if(0===s)return i;let r="("+i+" ";s>0&&(i=B.toStringTree(t.getChild(0),e),r=r.concat(i));for(let n=1;n<s;n++)i=B.toStringTree(t.getChild(n),e),r=r.concat(" "+i);return r=r.concat(")"),r},getNodeText:function(e,n,i){if(n=n||null,null!==(i=i||null)&&(n=i.ruleNames),null!==n){if(e instanceof P){const t=e.ruleContext.getAltNumber();return 0!=t?n[e.ruleIndex]+":"+t:n[e.ruleIndex]}if(e instanceof w)return e.toString();if(e instanceof b&&null!==e.symbol)return e.symbol.text}const s=e.getPayload();return s instanceof t?s.text:e.getPayload().toString()},getChildren:function(t){const e=[];for(let n=0;n<t.getChildCount();n++)e.push(t.getChild(n));return e},getAncestors:function(t){let e=[];for(t=t.getParent();null!==t;)e=[t].concat(e),t=t.getParent();return e},findAllTokenNodes:function(t,e){return B.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return B.findAllNodes(t,e,!1)},findAllNodes:function(t,e,n){const i=[];return B._findAllNodes(t,e,n,i),i},_findAllNodes:function(t,e,n,i){n&&t instanceof b?t.symbol.type===e&&i.push(t):!n&&t instanceof P&&t.ruleIndex===e&&i.push(t);for(let s=0;s<t.getChildCount();s++)B._findAllNodes(t.getChild(s),e,n,i)},descendants:function(t){let e=[t];for(let n=0;n<t.getChildCount();n++)e=e.concat(B.descendants(t.getChild(n)));return e}},D=B;class M extends P{constructor(t,e){super(),this.parentCtx=t||null,this.invokingState=e||-1}depth(){let t=0,e=this;for(;null!==e;)e=e.parentCtx,t+=1;return t}isEmpty(){return-1===this.invokingState}getSourceInterval(){return T.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map((function(t){return t.getText()})).join("")}getAltNumber(){return 0}setAltNumber(t){}getChild(t){return null}getChildCount(){return 0}accept(t){return t.visitChildren(this)}toStringTree(t,e){return D.toStringTree(this,t,e)}toString(t,e){t=t||null,e=e||null;let n=this,i="[";for(;null!==n&&n!==e;){if(null===t)n.isEmpty()||(i+=n.invokingState);else{const e=n.ruleIndex;i+=e>=0&&e<t.length?t[e]:""+e}null===n.parentCtx||null===t&&n.parentCtx.isEmpty()||(i+=" "),n=n.parentCtx}return i+="]",i}}class U{constructor(t){this.cachedHashCode=t}isEmpty(){return this===U.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===U.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}U.EMPTY=null,U.EMPTY_RETURN_STATE=2147483647,U.globalNodeCount=1,U.id=U.globalNodeCount,U.trace_atn_sim=!1;class H extends U{constructor(t,e){const n=new s;return n.update(t,e),super(n.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===U.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof H&&this.hashCode()===t.hashCode()&&e(this.returnStates,t.returnStates)&&e(this.parents,t.parents)}toString(){if(this.isEmpty())return"[]";{let t="[";for(let e=0;e<this.returnStates.length;e++)e>0&&(t+=", "),this.returnStates[e]!==U.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"}}get length(){return this.returnStates.length}}class F extends U{constructor(t,e){let n=0;const i=new s;null!==t?i.update(t,e):i.update(1),n=i.finish(),super(n),this.parentCtx=t,this.returnState=e}getParent(t){return this.parentCtx}getReturnState(t){return this.returnState}equals(t){return this===t||t instanceof F&&this.hashCode()===t.hashCode()&&this.returnState===t.returnState&&(null==this.parentCtx?null==t.parentCtx:this.parentCtx.equals(t.parentCtx))}toString(){const t=null===this.parentCtx?"":this.parentCtx.toString();return 0===t.length?this.returnState===U.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===U.EMPTY_RETURN_STATE&&null===t?U.EMPTY:new F(t,e)}}class G extends F{constructor(){super(null,U.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}U.EMPTY=new G;const V="h-";class z{constructor(t,e){this.data={},this.hashFunction=t||r,this.equalsFunction=e||a}set(t,e){const n=V+this.hashFunction(t);if(n in this.data){const i=this.data[n];for(let n=0;n<i.length;n++){const s=i[n];if(this.equalsFunction(t,s.key)){const t=s.value;return s.value=e,t}}return i.push({key:t,value:e}),e}return this.data[n]=[{key:t,value:e}],e}containsKey(t){const e=V+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++){const i=n[e];if(this.equalsFunction(t,i.key))return!0}}return!1}get(t){const e=V+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++){const i=n[e];if(this.equalsFunction(t,i.key))return i.value}}return null}entries(){return Object.keys(this.data).filter((t=>t.startsWith(V))).flatMap((t=>this.data[t]),this)}getKeys(){return this.entries().map((t=>t.key))}getValues(){return this.entries().map((t=>t.value))}toString(){return"["+this.entries().map((t=>"{"+t.key+":"+t.value+"}")).join(", ")+"]"}get length(){return Object.keys(this.data).filter((t=>t.startsWith(V))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}function K(t,e){if(null==e&&(e=M.EMPTY),null===e.parentCtx||e===M.EMPTY)return U.EMPTY;const n=K(t,e.parentCtx),i=t.states[e.invokingState].transitions[0];return F.create(n,i.followState.stateNumber)}function W(t,e,n){if(t.isEmpty())return t;let i=n.get(t)||null;if(null!==i)return i;if(i=e.get(t),null!==i)return n.set(t,i),i;let s=!1,r=[];for(let i=0;i<r.length;i++){const a=W(t.getParent(i),e,n);if(s||a!==t.getParent(i)){if(!s){r=[];for(let e=0;e<t.length;e++)r[e]=t.getParent(e);s=!0}r[i]=a}}if(!s)return e.add(t),n.set(t,t),t;let a=null;return a=0===r.length?U.EMPTY:1===r.length?F.create(r[0],t.getReturnState(0)):new H(r,t.returnStates),e.add(a),n.set(a,a),n.set(t,a),a}function $(t,e,n,i){if(t===e)return t;if(t instanceof F&&e instanceof F)return function(t,e,n,i){if(null!==i){let n=i.get(t,e);if(null!==n)return n;if(n=i.get(e,t),null!==n)return n}const s=function(t,e,n){if(n){if(t===U.EMPTY)return U.EMPTY;if(e===U.EMPTY)return U.EMPTY}else{if(t===U.EMPTY&&e===U.EMPTY)return U.EMPTY;if(t===U.EMPTY){const t=[e.returnState,U.EMPTY_RETURN_STATE],n=[e.parentCtx,null];return new H(n,t)}if(e===U.EMPTY){const e=[t.returnState,U.EMPTY_RETURN_STATE],n=[t.parentCtx,null];return new H(n,e)}}return null}(t,e,n);if(null!==s)return null!==i&&i.set(t,e,s),s;if(t.returnState===e.returnState){const s=$(t.parentCtx,e.parentCtx,n,i);if(s===t.parentCtx)return t;if(s===e.parentCtx)return e;const r=F.create(s,t.returnState);return null!==i&&i.set(t,e,r),r}{let n=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(n=t.parentCtx),null!==n){const s=[t.returnState,e.returnState];t.returnState>e.returnState&&(s[0]=e.returnState,s[1]=t.returnState);const r=new H([n,n],s);return null!==i&&i.set(t,e,r),r}const s=[t.returnState,e.returnState];let r=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(s[0]=e.returnState,s[1]=t.returnState,r=[e.parentCtx,t.parentCtx]);const a=new H(r,s);return null!==i&&i.set(t,e,a),a}}(t,e,n,i);if(n){if(t instanceof G)return t;if(e instanceof G)return e}return t instanceof F&&(t=new H([t.getParent()],[t.returnState])),e instanceof F&&(e=new H([e.getParent()],[e.returnState])),function(t,e,n,i){if(null!==i){let n=i.get(t,e);if(null!==n)return U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),n;if(n=i.get(e,t),null!==n)return U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),n}let s=0,r=0,a=0,o=new Array(t.returnStates.length+e.returnStates.length).fill(0),l=new Array(t.returnStates.length+e.returnStates.length).fill(null);for(;s<t.returnStates.length&&r<e.returnStates.length;){const h=t.parents[s],c=e.parents[r];if(t.returnStates[s]===e.returnStates[r]){const e=t.returnStates[s];e===U.EMPTY_RETURN_STATE&&null===h&&null===c||null!==h&&null!==c&&h===c?(l[a]=h,o[a]=e):(l[a]=$(h,c,n,i),o[a]=e),s+=1,r+=1}else t.returnStates[s]<e.returnStates[r]?(l[a]=h,o[a]=t.returnStates[s],s+=1):(l[a]=c,o[a]=e.returnStates[r],r+=1);a+=1}if(s<t.returnStates.length)for(let e=s;e<t.returnStates.length;e++)l[a]=t.parents[e],o[a]=t.returnStates[e],a+=1;else for(let t=r;t<e.returnStates.length;t++)l[a]=e.parents[t],o[a]=e.returnStates[t],a+=1;if(a<l.length){if(1===a){const n=F.create(l[0],o[0]);return null!==i&&i.set(t,e,n),n}l=l.slice(0,a),o=o.slice(0,a)}const h=new H(l,o);return h.equals(t)?(null!==i&&i.set(t,e,t),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):h.equals(e)?(null!==i&&i.set(t,e,e),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new z;for(let n=0;n<t.length;n++){const i=t[n];e.containsKey(i)||e.set(i,i)}for(let n=0;n<t.length;n++)t[n]=e.get(t[n])}(l),null!==i&&i.set(t,e,h),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+h),h)}(t,e,n,i)}class q{constructor(){this.data=[]}add(t){this.data[t]=!0}or(t){Object.keys(t.data).map((t=>this.add(t)),this)}remove(t){delete this.data[t]}has(t){return!0===this.data[t]}values(){return Object.keys(this.data)}minValue(){return Math.min.apply(null,this.values())}hashCode(){return s.hashStuff(this.values())}equals(t){return t instanceof q&&e(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.values().length}}class Q{constructor(t){this.atn=t}getDecisionLookahead(t){if(null===t)return null;const e=t.transitions.length,n=[];for(let i=0;i<e;i++){n[i]=new m;const e=new d,s=!1;this._LOOK(t.transition(i).target,null,U.EMPTY,n[i],e,new q,s,!1),(0===n[i].length||n[i].contains(Q.HIT_PRED))&&(n[i]=null)}return n}LOOK(t,e,n){const i=new m,s=null!==(n=n||null)?K(t.atn,n):null;return this._LOOK(t,e,s,i,new d,new q,!0,!0),i}_LOOK(e,n,i,s,r,a,o,l){const h=new R({state:e,alt:0,context:i},null);if(!r.has(h)){if(r.add(h),e===n){if(null===i)return void s.addOne(t.EPSILON);if(i.isEmpty()&&l)return void s.addOne(t.EOF)}if(e instanceof _){if(null===i)return void s.addOne(t.EPSILON);if(i.isEmpty()&&l)return void s.addOne(t.EOF);if(i!==U.EMPTY){const t=a.has(e.ruleIndex);try{a.remove(e.ruleIndex);for(let t=0;t<i.length;t++){const e=this.atn.states[i.getReturnState(t)];this._LOOK(e,n,i.getParent(t),s,r,a,o,l)}}finally{t&&a.add(e.ruleIndex)}return}}for(let h=0;h<e.transitions.length;h++){const c=e.transitions[h];if(c.constructor===A){if(a.has(c.target.ruleIndex))continue;const t=F.create(i,c.followState.stateNumber);try{a.add(c.target.ruleIndex),this._LOOK(c.target,n,t,s,r,a,o,l)}finally{a.remove(c.target.ruleIndex)}}else if(c instanceof k)o?this._LOOK(c.target,n,i,s,r,a,o,l):s.addOne(Q.HIT_PRED);else if(c.isEpsilon)this._LOOK(c.target,n,i,s,r,a,o,l);else if(c.constructor===I)s.addRange(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=c.label;null!==e&&(c instanceof C&&(e=e.complement(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),s.addSet(e))}}}}}Q.HIT_PRED=t.INVALID_TYPE;class Y{constructor(t,e){this.grammarType=t,this.maxTokenType=e,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(t,e){return new Q(this).LOOK(t,null,e)}nextTokensNoContext(t){return null!==t.nextTokenWithinRule||(t.nextTokenWithinRule=this.nextTokensInContext(t,null),t.nextTokenWithinRule.readOnly=!0),t.nextTokenWithinRule}nextTokens(t,e){return void 0===e?this.nextTokensNoContext(t):this.nextTokensInContext(t,e)}addState(t){null!==t&&(t.atn=this,t.stateNumber=this.states.length),this.states.push(t)}removeState(t){this.states[t.stateNumber]=null}defineDecisionState(t){return this.decisionToState.push(t),t.decision=this.decisionToState.length-1,t.decision}getDecisionState(t){return 0===this.decisionToState.length?null:this.decisionToState[t]}getExpectedTokens(e,n){if(e<0||e>=this.states.length)throw"Invalid state number.";const i=this.states[e];let s=this.nextTokens(i);if(!s.contains(t.EPSILON))return s;const r=new m;for(r.addSet(s),r.removeOne(t.EPSILON);null!==n&&n.invokingState>=0&&s.contains(t.EPSILON);){const e=this.states[n.invokingState].transitions[0];s=this.nextTokens(e.followState),r.addSet(s),r.removeOne(t.EPSILON),n=n.parentCtx}return s.contains(t.EPSILON)&&r.addOne(t.EOF),r}}Y.INVALID_ALT_NUMBER=0;class j extends S{constructor(){super(),this.stateType=S.BASIC}}class X extends S{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class J extends X{constructor(){return super(),this.endState=null,this}}class Z extends S{constructor(){return super(),this.stateType=S.BLOCK_END,this.startState=null,this}}class tt extends S{constructor(){return super(),this.stateType=S.LOOP_END,this.loopBackState=null,this}}class et extends S{constructor(){return super(),this.stateType=S.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class nt extends X{constructor(){return super(),this.stateType=S.TOKEN_START,this}}class it extends X{constructor(){return super(),this.stateType=S.PLUS_LOOP_BACK,this}}class st extends S{constructor(){return super(),this.stateType=S.STAR_LOOP_BACK,this}}class rt extends X{constructor(){return super(),this.stateType=S.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class at extends J{constructor(){return super(),this.stateType=S.PLUS_BLOCK_START,this.loopBackState=null,this}}class ot extends J{constructor(){return super(),this.stateType=S.STAR_BLOCK_START,this}}class lt extends J{constructor(){return super(),this.stateType=S.BLOCK_START,this}}class ht extends y{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=y.ATOM}makeLabel(){const t=new m;return t.addOne(this.label_),t}matches(t,e,n){return this.label_===t}toString(){return this.label_}}class ct extends y{constructor(t,e,n){super(t),this.serializationType=y.RANGE,this.start=e,this.stop=n,this.label=this.makeLabel()}makeLabel(){const t=new m;return t.addRange(this.start,this.stop),t}matches(t,e,n){return t>=this.start&&t<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends y{constructor(t,e,n,i){super(t),this.serializationType=y.ACTION,this.ruleIndex=e,this.actionIndex=void 0===n?-1:n,this.isCtxDependent=void 0!==i&&i,this.isEpsilon=!0}matches(t,e,n){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class dt extends y{constructor(t,e){super(t),this.serializationType=y.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,n){return!1}toString(){return"epsilon"}}class pt extends p{constructor(t,e,n){super(),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==n&&n}evaluate(t,e){const n=this.isCtxDependent?e:null;return t.sempred(n,this.ruleIndex,this.predIndex)}updateHashCode(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(t){return this===t||t instanceof pt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}p.NONE=new pt;class xt extends k{constructor(t,e,n,i){super(t),this.serializationType=y.PREDICATE,this.ruleIndex=e,this.predIndex=n,this.isCtxDependent=i,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new pt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class ft extends p{constructor(t){super(),this.precedence=void 0===t?0:t}evaluate(t,e){return t.precpred(e,this.precedence)}evalPrecedence(t,e){return t.precpred(e,this.precedence)?p.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof ft&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}p.PrecedencePredicate=ft;class Et extends k{constructor(t,e){super(t),this.serializationType=y.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new ft(this.precedence)}toString(){return this.precedence+" >= _p"}}class gt{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}gt.defaultOptions=new gt,gt.defaultOptions.readOnly=!0;class Rt{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new s;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class Tt extends Rt{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}Tt.INSTANCE=new Tt;class mt extends Rt{constructor(t){super(0),this.channel=t}execute(t){t._channel=this.channel}updateHashCode(t){t.update(this.actionType,this.channel)}equals(t){return this===t||t instanceof mt&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class St extends Rt{constructor(t,e){super(1),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0}execute(t){t.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(t){return this===t||t instanceof St&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class _t extends Rt{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}_t.INSTANCE=new _t;class yt extends Rt{constructor(t){super(7),this.type=t}execute(t){t.type=this.type}updateHashCode(t){t.update(this.actionType,this.type)}equals(t){return this===t||t instanceof yt&&this.type===t.type}toString(){return"type("+this.type+")"}}class At extends Rt{constructor(t){super(5),this.mode=t}execute(t){t.pushMode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof At&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class Lt extends Rt{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}Lt.INSTANCE=new Lt;class Ct extends Rt{constructor(t){super(2),this.mode=t}execute(t){t.mode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof Ct&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function It(t,e){const n=[];return n[t-1]=e,n.map((function(t){return e}))}class kt{constructor(t){null==t&&(t=gt.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null}deserialize(t){const e=this.reset(t);this.checkVersion(e),e&&this.skipUUID();const n=this.readATN();this.readStates(n,e),this.readRules(n,e),this.readModes(n);const i=[];return this.readSets(n,i,this.readInt.bind(this)),e&&this.readSets(n,i,this.readInt32.bind(this)),this.readEdges(n,i),this.readDecisions(n),this.readLexerActions(n,e),this.markPrecedenceDecisions(n),this.verifyATN(n),this.deserializationOptions.generateRuleBypassTransitions&&1===n.grammarType&&(this.generateRuleBypassTransitions(n),this.verifyATN(n)),n}reset(t){if(3===(t.charCodeAt?t.charCodeAt(0):t[0])){const e=function(t){const e=t.charCodeAt(0);return e>1?e-2:e+65534},n=t.split("").map(e);return n[0]=t.charCodeAt(0),this.data=n,this.pos=0,!0}return this.data=t,this.pos=0,!1}skipUUID(){let t=0;for(;t++<8;)this.readInt()}checkVersion(t){const e=this.readInt();if(!t&&4!==e)throw"Could not deserialize ATN with version "+e+" (expected 4)."}readATN(){const t=this.readInt(),e=this.readInt();return new Y(t,e)}readStates(t,e){let n,i,s;const r=[],a=[],o=this.readInt();for(let n=0;n<o;n++){const n=this.readInt();if(n===S.INVALID_TYPE){t.addState(null);continue}let i=this.readInt();e&&65535===i&&(i=-1);const s=this.stateFactory(n,i);if(n===S.LOOP_END){const t=this.readInt();r.push([s,t])}else if(s instanceof J){const t=this.readInt();a.push([s,t])}t.addState(s)}for(n=0;n<r.length;n++)i=r[n],i[0].loopBackState=t.states[i[1]];for(n=0;n<a.length;n++)i=a[n],i[0].endState=t.states[i[1]];let l=this.readInt();for(n=0;n<l;n++)s=this.readInt(),t.states[s].nonGreedy=!0;let h=this.readInt();for(n=0;n<h;n++)s=this.readInt(),t.states[s].isPrecedenceRule=!0}readRules(e,n){let i;const s=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=It(s,0)),e.ruleToStartState=It(s,0),i=0;i<s;i++){const s=this.readInt();if(e.ruleToStartState[i]=e.states[s],0===e.grammarType){let s=this.readInt();n&&65535===s&&(s=t.EOF),e.ruleToTokenType[i]=s}}for(e.ruleToStopState=It(s,0),i=0;i<e.states.length;i++){const t=e.states[i];t instanceof _&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(t){const e=this.readInt();for(let n=0;n<e;n++){let e=this.readInt();t.modeToStartState.push(t.states[e])}}readSets(t,e,n){const i=this.readInt();for(let t=0;t<i;t++){const t=new m;e.push(t);const i=this.readInt();0!==this.readInt()&&t.addOne(-1);for(let e=0;e<i;e++){const e=n(),i=n();t.addRange(e,i)}}}readEdges(t,e){let n,i,s,r,a;const o=this.readInt();for(n=0;n<o;n++){const n=this.readInt(),i=this.readInt(),s=this.readInt(),a=this.readInt(),o=this.readInt(),l=this.readInt();r=this.edgeFactory(t,s,n,i,a,o,l,e),t.states[n].addTransition(r)}for(n=0;n<t.states.length;n++)for(s=t.states[n],i=0;i<s.transitions.length;i++){const e=s.transitions[i];if(!(e instanceof A))continue;let n=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(n=e.target.ruleIndex),r=new dt(e.followState,n),t.ruleToStopState[e.target.ruleIndex].addTransition(r)}for(n=0;n<t.states.length;n++){if(s=t.states[n],s instanceof J){if(null===s.endState)throw"IllegalState";if(null!==s.endState.startState)throw"IllegalState";s.endState.startState=s}if(s instanceof it)for(i=0;i<s.transitions.length;i++)a=s.transitions[i].target,a instanceof at&&(a.loopBackState=s);else if(s instanceof st)for(i=0;i<s.transitions.length;i++)a=s.transitions[i].target,a instanceof rt&&(a.loopBackState=s)}}readDecisions(t){const e=this.readInt();for(let n=0;n<e;n++){const e=this.readInt(),i=t.states[e];t.decisionToState.push(i),i.decision=n}}readLexerActions(t,e){if(0===t.grammarType){const n=this.readInt();t.lexerActions=It(n,null);for(let i=0;i<n;i++){const n=this.readInt();let s=this.readInt();e&&65535===s&&(s=-1);let r=this.readInt();e&&65535===r&&(r=-1),t.lexerActions[i]=this.lexerActionFactory(n,s,r)}}}generateRuleBypassTransitions(t){let e;const n=t.ruleToStartState.length;for(e=0;e<n;e++)t.ruleToTokenType[e]=t.maxTokenType+e+1;for(e=0;e<n;e++)this.generateRuleBypassTransition(t,e)}generateRuleBypassTransition(t,e){let n,i;const s=new lt;s.ruleIndex=e,t.addState(s);const r=new Z;r.ruleIndex=e,t.addState(r),s.endState=r,t.defineDecisionState(s),r.startState=s;let a=null,o=null;if(t.ruleToStartState[e].isPrecedenceRule){for(o=null,n=0;n<t.states.length;n++)if(i=t.states[n],this.stateIsEndStateFor(i,e)){o=i,a=i.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else o=t.ruleToStopState[e];for(n=0;n<t.states.length;n++){i=t.states[n];for(let t=0;t<i.transitions.length;t++){const e=i.transitions[t];e!==a&&e.target===o&&(e.target=r)}}const l=t.ruleToStartState[e],h=l.transitions.length;for(;h>0;)s.addTransition(l.transitions[h-1]),l.transitions=l.transitions.slice(-1);t.ruleToStartState[e].addTransition(new dt(s)),r.addTransition(new dt(o));const c=new j;t.addState(c),c.addTransition(new ht(r,t.ruleToTokenType[e])),s.addTransition(new dt(c))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof rt))return null;const n=t.transitions[t.transitions.length-1].target;return n instanceof tt&&n.epsilonOnlyTransitions&&n.transitions[0].target instanceof _?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const n=t.states[e];if(n instanceof rt&&t.ruleToStartState[n.ruleIndex].isPrecedenceRule){const t=n.transitions[n.transitions.length-1].target;t instanceof tt&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof _&&(n.isPrecedenceDecision=!0)}}}verifyATN(t){if(this.deserializationOptions.verifyATN)for(let e=0;e<t.states.length;e++){const n=t.states[e];if(null!==n)if(this.checkCondition(n.epsilonOnlyTransitions||n.transitions.length<=1),n instanceof at)this.checkCondition(null!==n.loopBackState);else if(n instanceof rt)if(this.checkCondition(null!==n.loopBackState),this.checkCondition(2===n.transitions.length),n.transitions[0].target instanceof ot)this.checkCondition(n.transitions[1].target instanceof tt),this.checkCondition(!n.nonGreedy);else{if(!(n.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(n.transitions[1].target instanceof ot),this.checkCondition(n.nonGreedy)}else n instanceof st?(this.checkCondition(1===n.transitions.length),this.checkCondition(n.transitions[0].target instanceof rt)):n instanceof tt?this.checkCondition(null!==n.loopBackState):n instanceof et?this.checkCondition(null!==n.stopState):n instanceof J?this.checkCondition(null!==n.endState):n instanceof Z?this.checkCondition(null!==n.startState):n instanceof X?this.checkCondition(n.transitions.length<=1||n.decision>=0):this.checkCondition(n.transitions.length<=1||n instanceof _)}}checkCondition(t,e){if(!t)throw null==e&&(e="IllegalState"),e}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,n,i,s,r,a,o,l){const h=e.states[s];switch(n){case y.EPSILON:return new dt(h);case y.RANGE:return new ct(h,0!==o?t.EOF:r,a);case y.RULE:return new A(e.states[r],a,o,h);case y.PREDICATE:return new xt(h,r,a,0!==o);case y.PRECEDENCE:return new Et(h,r);case y.ATOM:return new ht(h,0!==o?t.EOF:r);case y.ACTION:return new ut(h,r,a,0!==o);case y.SET:return new L(h,l[r]);case y.NOT_SET:return new C(h,l[r]);case y.WILDCARD:return new I(h);default:throw"The specified transition type: "+n+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[S.INVALID_TYPE]=null,t[S.BASIC]=()=>new j,t[S.RULE_START]=()=>new et,t[S.BLOCK_START]=()=>new lt,t[S.PLUS_BLOCK_START]=()=>new at,t[S.STAR_BLOCK_START]=()=>new ot,t[S.TOKEN_START]=()=>new nt,t[S.RULE_STOP]=()=>new _,t[S.BLOCK_END]=()=>new Z,t[S.STAR_LOOP_BACK]=()=>new st,t[S.STAR_LOOP_ENTRY]=()=>new rt,t[S.PLUS_LOOP_BACK]=()=>new it,t[S.LOOP_END]=()=>new tt,this.stateFactories=t}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";{const n=this.stateFactories[t]();if(null!==n)return n.ruleIndex=e,n}}lexerActionFactory(t,e,n){if(null===this.actionFactories){const t=[];t[0]=(t,e)=>new mt(t),t[1]=(t,e)=>new St(t,e),t[2]=(t,e)=>new Ct(t),t[3]=(t,e)=>_t.INSTANCE,t[4]=(t,e)=>Lt.INSTANCE,t[5]=(t,e)=>new At(t),t[6]=(t,e)=>Tt.INSTANCE,t[7]=(t,e)=>new yt(t),this.actionFactories=t}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)}}class vt{syntaxError(t,e,n,i,s,r){}reportAmbiguity(t,e,n,i,s,r,a){}reportAttemptingFullContext(t,e,n,i,s,r){}reportContextSensitivity(t,e,n,i,s,r){}}class Ot extends vt{constructor(){super()}syntaxError(t,e,n,i,s,r){console.error("line "+n+":"+i+" "+s)}}Ot.INSTANCE=new Ot;class Nt extends vt{constructor(t){if(super(),null===t)throw"delegates";return this.delegates=t,this}syntaxError(t,e,n,i,s,r){this.delegates.map((a=>a.syntaxError(t,e,n,i,s,r)))}reportAmbiguity(t,e,n,i,s,r,a){this.delegates.map((o=>o.reportAmbiguity(t,e,n,i,s,r,a)))}reportAttemptingFullContext(t,e,n,i,s,r){this.delegates.map((a=>a.reportAttemptingFullContext(t,e,n,i,s,r)))}reportContextSensitivity(t,e,n,i,s,r){this.delegates.map((a=>a.reportContextSensitivity(t,e,n,i,s,r)))}}class Pt{constructor(){this._listeners=[Ot.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(t){const e="4.13.1";e!==t&&console.log("ANTLR runtime and generated code versions disagree: "+e+"!="+t)}addErrorListener(t){this._listeners.push(t)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const t=this.getLiteralNames(),e=this.getSymbolicNames(),n=t.length>e.length?t.length:e.length;this.tokenNames=[];for(let i=0;i<n;i++)this.tokenNames[i]=t[i]||e[i]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let n=this.tokenTypeMapCache[e];return void 0===n&&(n=e.reduce((function(t,e,n){t[e]=n})),n.EOF=t.EOF,this.tokenTypeMapCache[e]=n),n}getRuleIndexMap(){const t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";let e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,n){t[e]=n})),this.ruleIndexMapCache[t]=e),e}getTokenType(e){const n=this.getTokenTypeMap()[e];return void 0!==n?n:t.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let n=e.text;return null===n&&(n=e.type===t.EOF?"<EOF>":"<"+e.type+">"),n=n.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+n+"'"}getErrorListenerDispatch(){return new Nt(this._listeners)}sempred(t,e,n){return!0}precpred(t,e){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(t){this._stateNumber=t}}Pt.tokenTypeMapCache={},Pt.ruleIndexMapCache={};class bt extends t{constructor(e,n,i,s,r){super(),this.source=void 0!==e?e:bt.EMPTY_SOURCE,this.type=void 0!==n?n:null,this.channel=void 0!==i?i:t.DEFAULT_CHANNEL,this.start=void 0!==s?s:-1,this.stop=void 0!==r?r:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const t=new bt(this.source,this.type,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,t.text=this.text,t}cloneWithType(e){const n=new bt(this.source,e,this.channel,this.start,this.stop);return n.tokenIndex=this.tokenIndex,n.line=this.line,n.column=this.column,e===t.EOF&&(n.text=""),n}toString(){let t=this.text;return t=null!==t?t.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+t+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const t=this.getInputStream();if(null===t)return null;const e=t.size;return this.start<e&&this.stop<e?t.getText(this.start,this.stop):"<EOF>"}set text(t){this._text=t}}bt.EMPTY_SOURCE=[null,null];class wt{}class Bt extends wt{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,n,i,s,r,a,o){const l=new bt(t,e,i,s,r);return l.line=a,l.column=o,null!==n?l.text=n:this.copyText&&null!==t[1]&&(l.text=t[1].getText(s,r)),l}createThin(t,e){const n=new bt(null,t);return n.text=e,n}}Bt.DEFAULT=new Bt;class Dt extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,Dt),this.message=t.message,this.recognizer=t.recognizer,this.input=t.input,this.ctx=t.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class Mt extends Dt{constructor(t,e,n,i){super({message:"",recognizer:t,input:e,ctx:null}),this.startIndex=n,this.deadEndConfigs=i}toString(){let t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText(new T(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Ut extends Pt{constructor(e){super(),this._input=e,this._factory=Bt.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=t.DEFAULT_CHANNEL,this._type=t.INVALID_TYPE,this._modeStack=[],this._mode=Ut.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=t.INVALID_TYPE,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Ut.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let e=!1;for(;;){this._type=t.INVALID_TYPE;let n=Ut.SKIP;try{n=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof Dt))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===t.EOF&&(this._hitEOF=!0),this._type===t.INVALID_TYPE&&(this._type=n),this._type===Ut.SKIP){e=!0;break}if(this._type!==Ut.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Ut.SKIP}more(){this._type=Ut.MORE}mode(t){this._mode=t}pushMode(t){this._interp.debug&&console.log("pushMode "+t),this._modeStack.push(this._mode),this.mode(t)}popMode(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.mode(this._modeStack.pop()),this._mode}emitToken(t){this._token=t}emit(){const t=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(t),t}emitEOF(){const e=this.column,n=this.line,i=this._factory.create(this._tokenFactorySourcePair,t.EOF,null,t.DEFAULT_CHANNEL,this._input.index,this._input.index-1,n,e);return this.emitToken(i),i}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let n=this.nextToken();for(;n.type!==t.EOF;)e.push(n),n=this.nextToken();return e}notifyListeners(t){const e=this._tokenStartCharIndex,n=this._input.index,i=this._input.getText(e,n),s="token recognition error at: '"+this.getErr