cyclone-analyzer
Version:
A static analyzer library for Cyclone specification language
1 lines • 386 kB
JavaScript
import{createRequire as t}from"module";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},n={};e.d(n,{EM:()=>ia,KH:()=>na,ZP:()=>sa,ow:()=>ea,dK:()=>ta,Dl:()=>Jr,P6:()=>Zr});const i=(t,e)=>({line:t,column:e}),s=(t,e,n,s)=>({startPosition:i(t,e),stopPosition:i(n,s)}),r={pos:i,posPair:s,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)}},a=t(import.meta.url)("module");var 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:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},l={};o.d(l,{dx:()=>nt,q2:()=>Bt,FO:()=>Oe,xf:()=>be,Gy:()=>Me,s4:()=>Ft,c7:()=>Ge,_7:()=>fe,tx:()=>ve,gp:()=>Ce,cK:()=>Dt,zs:()=>Ae,Rh:()=>De,AV:()=>be,Xp:()=>C,VS:()=>I,ul:()=>et,hW:()=>Wt,x1:()=>ie,z5:()=>le,oN:()=>Te,TB:()=>me,u1:()=>Se,_b:()=>ze,$F:()=>ce,_T:()=>$e,db:()=>ue,Zx:()=>oe,_x:()=>zt,r8:()=>K,JI:()=>H,TP:()=>F,WU:()=>h,Nj:()=>g,ZP:()=>en});class h{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 c(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}h.INVALID_TYPE=0,h.EPSILON=-2,h.MIN_USER_TOKEN_TYPE=1,h.EOF=-1,h.DEFAULT_CHANNEL=0,h.HIDDEN_CHANNEL=1;const u=Math.round(Math.random()*Math.pow(2,32));function d(t){if(!t)return 0;const e=typeof t,n="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!n)return 0;let i,s;const r=3&n.length,a=n.length-r;let o=u;const l=3432918353,h=461845907;let c=0;for(;c<a;)s=255&n.charCodeAt(c)|(255&n.charCodeAt(++c))<<8|(255&n.charCodeAt(++c))<<16|(255&n.charCodeAt(++c))<<24,++c,s=(65535&s)*l+(((s>>>16)*l&65535)<<16)&4294967295,s=s<<15|s>>>17,s=(65535&s)*h+(((s>>>16)*h&65535)<<16)&4294967295,o^=s,o=o<<13|o>>>19,i=5*(65535&o)+((5*(o>>>16)&65535)<<16)&4294967295,o=27492+(65535&i)+((58964+(i>>>16)&65535)<<16);switch(s=0,r){case 3:s^=(255&n.charCodeAt(c+2))<<16;case 2:s^=(255&n.charCodeAt(c+1))<<8;case 1:s^=255&n.charCodeAt(c),s=(65535&s)*l+(((s>>>16)*l&65535)<<16)&4294967295,s=s<<15|s>>>17,s=(65535&s)*h+(((s>>>16)*h&65535)<<16)&4294967295,o^=s}return o^=n.length,o^=o>>>16,o=2246822507*(65535&o)+((2246822507*(o>>>16)&65535)<<16)&4294967295,o^=o>>>13,o=3266489909*(65535&o)+((3266489909*(o>>>16)&65535)<<16)&4294967295,o^=o>>>16,o>>>0}class p{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=d(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 p;return t.update.apply(t,arguments),t.finish()}}function x(t){return t?"string"==typeof t?d(t):t.hashCode():-1}function f(t,e){return t?t.equals(e):t===e}function E(t){return null===t?"null":t}function g(t){return Array.isArray(t)?"["+t.map(E).join(", ")+"]":"null"}const R="h-";class T{constructor(t,e){this.data={},this.hashFunction=t||x,this.equalsFunction=e||f}add(t){const e=R+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=R+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(R))).flatMap((t=>this.data[t]),this)}toString(){return g(this.values())}get length(){return Object.keys(this.data).filter((t=>t.startsWith(R))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}class m{hashCode(){const t=new p;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===m.NONE)return e;if(null===e||e===m.NONE)return t;const n=new S(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===m.NONE||e===m.NONE)return m.NONE;const n=new _(t,e);return 1===n.opnds.length?n.opnds[0]:n}}class S extends m{constructor(t,e){super();const n=new T;t instanceof S?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof S?e.opnds.map((function(t){n.add(t)})):n.add(e);const i=y(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 S&&c(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!==m.NONE&&i.push(a)}if(!n)return this;if(0===i.length)return m.NONE;let s=null;return i.map((function(t){s=null===s?t:m.andContext(s,t)})),s}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("&&")}}class _ extends m{constructor(t,e){super();const n=new T;t instanceof _?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof _?e.opnds.map((function(t){n.add(t)})):n.add(e);const i=y(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 _&&c(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===m.NONE)return m.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 y(t){const e=[];return t.values().map((function(t){t instanceof m.PrecedencePredicate&&e.push(t)})),e}function A(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 L{constructor(t,e){this.checkContext(t,e),t=A(t),e=A(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:m.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 p;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 L&&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 p;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof L&&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!==m.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class C{constructor(t,e){this.start=t,this.stop=e}clone(){return new C(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}}C.INVALID_INTERVAL=new C(-1,-2);class I{constructor(){this.intervals=null,this.readOnly=!1}first(t){return null===this.intervals||0===this.intervals.length?h.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new C(t,t+1))}addRange(t,e){this.addInterval(new C(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 C(t.start,n.stop));if(t.start<=n.stop)return this.intervals[e]=new C(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 C(e.start,n.stop),this.intervals.splice(t+1,1))}}complement(t,e){const n=new I;return n.addInterval(new C(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 C(n.start,t.start);const i=new C(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 C(n.start,t.start):t.stop<n.stop&&(this.intervals[e]=new C(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 C(n.start+1,n.stop));if(t===n.stop-1)return void(this.intervals[e]=new C(n.start,n.stop-1));if(t<n.stop-1){const i=new C(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 t=[];for(let e=0;e<this.intervals.length;e++){const n=this.intervals[e];n.stop===n.start+1?n.start===h.EOF?t.push("<EOF>"):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]}toIndexString(){const t=[];for(let e=0;e<this.intervals.length;e++){const n=this.intervals[e];n.stop===n.start+1?n.start===h.EOF?t.push("<EOF>"):t.push(n.start.toString()):t.push(n.start.toString()+".."+(n.stop-1).toString())}return t.length>1?"{"+t.join(", ")+"}":t[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(t,e,n){return n===h.EOF?"<EOF>":n===h.EPSILON?"<EPSILON>":t[n]||e[n]}get length(){return this.intervals.map((t=>t.length)).reduce(((t,e)=>t+e))}}class k{constructor(){this.atn=null,this.stateNumber=k.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 k&&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)}}k.INVALID_TYPE=0,k.BASIC=1,k.RULE_START=2,k.BLOCK_START=3,k.PLUS_BLOCK_START=4,k.STAR_BLOCK_START=5,k.TOKEN_START=6,k.RULE_STOP=7,k.BLOCK_END=8,k.STAR_LOOP_BACK=9,k.STAR_LOOP_ENTRY=10,k.PLUS_LOOP_BACK=11,k.LOOP_END=12,k.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"],k.INVALID_STATE_NUMBER=-1;class v extends k{constructor(){return super(),this.stateType=k.RULE_STOP,this}}class O{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}O.EPSILON=1,O.RANGE=2,O.RULE=3,O.PREDICATE=4,O.ATOM=5,O.ACTION=6,O.SET=7,O.NOT_SET=8,O.WILDCARD=9,O.PRECEDENCE=10,O.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],O.serializationTypes={EpsilonTransition:O.EPSILON,RangeTransition:O.RANGE,RuleTransition:O.RULE,PredicateTransition:O.PREDICATE,AtomTransition:O.ATOM,ActionTransition:O.ACTION,SetTransition:O.SET,NotSetTransition:O.NOT_SET,WildcardTransition:O.WILDCARD,PrecedencePredicateTransition:O.PRECEDENCE};class N extends O{constructor(t,e,n,i){super(t),this.ruleIndex=e,this.precedence=n,this.followState=i,this.serializationType=O.RULE,this.isEpsilon=!0}matches(t,e,n){return!1}}class P extends O{constructor(t,e){super(t),this.serializationType=O.SET,null!=e?this.label=e:(this.label=new I,this.label.addOne(h.INVALID_TYPE))}matches(t,e,n){return this.label.contains(t)}toString(){return this.label.toString()}}class b extends P{constructor(t,e){super(t,e),this.serializationType=O.NOT_SET}matches(t,e,n){return t>=e&&t<=n&&!super.matches(t,e,n)}toString(){return"~"+super.toString()}}class w extends O{constructor(t){super(t),this.serializationType=O.WILDCARD}matches(t,e,n){return t>=e&&t<=n}toString(){return"."}}class B extends O{constructor(t){super(t)}}class D{}class M extends D{}class U extends M{}class H extends U{get ruleContext(){throw new Error("missing interface implementation")}}class F extends U{}class G extends F{}const V={toStringTree:function(t,e,n){e=e||null,null!==(n=n||null)&&(e=n.ruleNames);let i=V.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=V.toStringTree(t.getChild(0),e),r=r.concat(i));for(let n=1;n<s;n++)i=V.toStringTree(t.getChild(n),e),r=r.concat(" "+i);return r=r.concat(")"),r},getNodeText:function(t,e,n){if(e=e||null,null!==(n=n||null)&&(e=n.ruleNames),null!==e){if(t instanceof H){const n=t.ruleContext.getAltNumber();return 0!=n?e[t.ruleIndex]+":"+n:e[t.ruleIndex]}if(t instanceof G)return t.toString();if(t instanceof F&&null!==t.symbol)return t.symbol.text}const i=t.getPayload();return i instanceof h?i.text:t.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 V.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return V.findAllNodes(t,e,!1)},findAllNodes:function(t,e,n){const i=[];return V._findAllNodes(t,e,n,i),i},_findAllNodes:function(t,e,n,i){n&&t instanceof F?t.symbol.type===e&&i.push(t):!n&&t instanceof H&&t.ruleIndex===e&&i.push(t);for(let s=0;s<t.getChildCount();s++)V._findAllNodes(t.getChild(s),e,n,i)},descendants:function(t){let e=[t];for(let n=0;n<t.getChildCount();n++)e=e.concat(V.descendants(t.getChild(n)));return e}},z=V;class K extends H{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 C.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 z.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 W{constructor(t){this.cachedHashCode=t}isEmpty(){return this===W.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===W.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}W.EMPTY=null,W.EMPTY_RETURN_STATE=2147483647,W.globalNodeCount=1,W.id=W.globalNodeCount,W.trace_atn_sim=!1;class $ extends W{constructor(t,e){const n=new p;return n.update(t,e),super(n.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===W.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof $&&this.hashCode()===t.hashCode()&&c(this.returnStates,t.returnStates)&&c(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]!==W.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 q extends W{constructor(t,e){let n=0;const i=new p;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 q&&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===W.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===W.EMPTY_RETURN_STATE&&null===t?W.EMPTY:new q(t,e)}}class Q extends q{constructor(){super(null,W.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}W.EMPTY=new Q;const Y="h-";class j{constructor(t,e){this.data={},this.hashFunction=t||x,this.equalsFunction=e||f}set(t,e){const n=Y+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=Y+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=Y+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(Y))).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(Y))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}function X(t,e){if(null==e&&(e=K.EMPTY),null===e.parentCtx||e===K.EMPTY)return W.EMPTY;const n=X(t,e.parentCtx),i=t.states[e.invokingState].transitions[0];return q.create(n,i.followState.stateNumber)}function Z(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=Z(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?W.EMPTY:1===r.length?q.create(r[0],t.getReturnState(0)):new $(r,t.returnStates),e.add(a),n.set(a,a),n.set(t,a),a}function J(t,e,n,i){if(t===e)return t;if(t instanceof q&&e instanceof q)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===W.EMPTY)return W.EMPTY;if(e===W.EMPTY)return W.EMPTY}else{if(t===W.EMPTY&&e===W.EMPTY)return W.EMPTY;if(t===W.EMPTY){const t=[e.returnState,W.EMPTY_RETURN_STATE],n=[e.parentCtx,null];return new $(n,t)}if(e===W.EMPTY){const e=[t.returnState,W.EMPTY_RETURN_STATE],n=[t.parentCtx,null];return new $(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=J(t.parentCtx,e.parentCtx,n,i);if(s===t.parentCtx)return t;if(s===e.parentCtx)return e;const r=q.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 $([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 $(r,s);return null!==i&&i.set(t,e,a),a}}(t,e,n,i);if(n){if(t instanceof Q)return t;if(e instanceof Q)return e}return t instanceof q&&(t=new $([t.getParent()],[t.returnState])),e instanceof q&&(e=new $([e.getParent()],[e.returnState])),function(t,e,n,i){if(null!==i){let n=i.get(t,e);if(null!==n)return W.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),n;if(n=i.get(e,t),null!==n)return W.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===W.EMPTY_RETURN_STATE&&null===h&&null===c||null!==h&&null!==c&&h===c?(l[a]=h,o[a]=e):(l[a]=J(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=q.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 $(l,o);return h.equals(t)?(null!==i&&i.set(t,e,t),W.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):h.equals(e)?(null!==i&&i.set(t,e,e),W.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new j;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),W.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+h),h)}(t,e,n,i)}class tt{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 p.hashStuff(this.values())}equals(t){return t instanceof tt&&c(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.values().length}}class et{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 I;const e=new T,s=!1;this._LOOK(t.transition(i).target,null,W.EMPTY,n[i],e,new tt,s,!1),(0===n[i].length||n[i].contains(et.HIT_PRED))&&(n[i]=null)}return n}LOOK(t,e,n){const i=new I,s=null!==(n=n||null)?X(t.atn,n):null;return this._LOOK(t,e,s,i,new T,new tt,!0,!0),i}_LOOK(t,e,n,i,s,r,a,o){const l=new L({state:t,alt:0,context:n},null);if(!s.has(l)){if(s.add(l),t===e){if(null===n)return void i.addOne(h.EPSILON);if(n.isEmpty()&&o)return void i.addOne(h.EOF)}if(t instanceof v){if(null===n)return void i.addOne(h.EPSILON);if(n.isEmpty()&&o)return void i.addOne(h.EOF);if(n!==W.EMPTY){const l=r.has(t.ruleIndex);try{r.remove(t.ruleIndex);for(let t=0;t<n.length;t++){const l=this.atn.states[n.getReturnState(t)];this._LOOK(l,e,n.getParent(t),i,s,r,a,o)}}finally{l&&r.add(t.ruleIndex)}return}}for(let l=0;l<t.transitions.length;l++){const c=t.transitions[l];if(c.constructor===N){if(r.has(c.target.ruleIndex))continue;const t=q.create(n,c.followState.stateNumber);try{r.add(c.target.ruleIndex),this._LOOK(c.target,e,t,i,s,r,a,o)}finally{r.remove(c.target.ruleIndex)}}else if(c instanceof B)a?this._LOOK(c.target,e,n,i,s,r,a,o):i.addOne(et.HIT_PRED);else if(c.isEpsilon)this._LOOK(c.target,e,n,i,s,r,a,o);else if(c.constructor===w)i.addRange(h.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let t=c.label;null!==t&&(c instanceof b&&(t=t.complement(h.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),i.addSet(t))}}}}}et.HIT_PRED=h.INVALID_TYPE;class nt{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 et(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(t,e){if(t<0||t>=this.states.length)throw"Invalid state number.";const n=this.states[t];let i=this.nextTokens(n);if(!i.contains(h.EPSILON))return i;const s=new I;for(s.addSet(i),s.removeOne(h.EPSILON);null!==e&&e.invokingState>=0&&i.contains(h.EPSILON);){const t=this.states[e.invokingState].transitions[0];i=this.nextTokens(t.followState),s.addSet(i),s.removeOne(h.EPSILON),e=e.parentCtx}return i.contains(h.EPSILON)&&s.addOne(h.EOF),s}}nt.INVALID_ALT_NUMBER=0;class it extends k{constructor(){super(),this.stateType=k.BASIC}}class st extends k{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class rt extends st{constructor(){return super(),this.endState=null,this}}class at extends k{constructor(){return super(),this.stateType=k.BLOCK_END,this.startState=null,this}}class ot extends k{constructor(){return super(),this.stateType=k.LOOP_END,this.loopBackState=null,this}}class lt extends k{constructor(){return super(),this.stateType=k.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class ht extends st{constructor(){return super(),this.stateType=k.TOKEN_START,this}}class ct extends st{constructor(){return super(),this.stateType=k.PLUS_LOOP_BACK,this}}class ut extends k{constructor(){return super(),this.stateType=k.STAR_LOOP_BACK,this}}class dt extends st{constructor(){return super(),this.stateType=k.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class pt extends rt{constructor(){return super(),this.stateType=k.PLUS_BLOCK_START,this.loopBackState=null,this}}class xt extends rt{constructor(){return super(),this.stateType=k.STAR_BLOCK_START,this}}class ft extends rt{constructor(){return super(),this.stateType=k.BLOCK_START,this}}class Et extends O{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=O.ATOM}makeLabel(){const t=new I;return t.addOne(this.label_),t}matches(t,e,n){return this.label_===t}toString(){return this.label_}}class gt extends O{constructor(t,e,n){super(t),this.serializationType=O.RANGE,this.start=e,this.stop=n,this.label=this.makeLabel()}makeLabel(){const t=new I;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 Rt extends O{constructor(t,e,n,i){super(t),this.serializationType=O.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 Tt extends O{constructor(t,e){super(t),this.serializationType=O.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,n){return!1}toString(){return"epsilon"}}class mt extends m{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 mt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}m.NONE=new mt;class St extends B{constructor(t,e,n,i){super(t),this.serializationType=O.PREDICATE,this.ruleIndex=e,this.predIndex=n,this.isCtxDependent=i,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new mt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class _t extends m{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)?m.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof _t&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}m.PrecedencePredicate=_t;class yt extends B{constructor(t,e){super(t),this.serializationType=O.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new _t(this.precedence)}toString(){return this.precedence+" >= _p"}}class At{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}At.defaultOptions=new At,At.defaultOptions.readOnly=!0;class Lt{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new p;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class Ct extends Lt{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}Ct.INSTANCE=new Ct;class It extends Lt{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 It&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class kt extends Lt{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 kt&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class vt extends Lt{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}vt.INSTANCE=new vt;class Ot extends Lt{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 Ot&&this.type===t.type}toString(){return"type("+this.type+")"}}class Nt extends Lt{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 Nt&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class Pt extends Lt{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}Pt.INSTANCE=new Pt;class bt extends Lt{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 bt&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function wt(t,e){const n=[];return n[t-1]=e,n.map((function(t){return e}))}class Bt{constructor(t){null==t&&(t=At.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 nt(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===k.INVALID_TYPE){t.addState(null);continue}let i=this.readInt();e&&65535===i&&(i=-1);const s=this.stateFactory(n,i);if(n===k.LOOP_END){const t=this.readInt();r.push([s,t])}else if(s instanceof rt){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(t,e){let n;const i=this.readInt();for(0===t.grammarType&&(t.ruleToTokenType=wt(i,0)),t.ruleToStartState=wt(i,0),n=0;n<i;n++){const i=this.readInt();if(t.ruleToStartState[n]=t.states[i],0===t.grammarType){let i=this.readInt();e&&65535===i&&(i=h.EOF),t.ruleToTokenType[n]=i}}for(t.ruleToStopState=wt(i,0),n=0;n<t.states.length;n++){const e=t.states[n];e instanceof v&&(t.ruleToStopState[e.ruleIndex]=e,t.ruleToStartState[e.ruleIndex].stopState=e)}}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 I;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 N))continue;let n=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(n=e.target.ruleIndex),r=new Tt(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 rt){if(null===s.endState)throw"IllegalState";if(null!==s.endState.startState)throw"IllegalState";s.endState.startState=s}if(s instanceof ct)for(i=0;i<s.transitions.length;i++)a=s.transitions[i].target,a instanceof pt&&(a.loopBackState=s);else if(s instanceof ut)for(i=0;i<s.transitions.length;i++)a=s.transitions[i].target,a instanceof dt&&(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=wt(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 ft;s.ruleIndex=e,t.addState(s);const r=new at;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 Tt(s)),r.addTransition(new Tt(o));const c=new it;t.addState(c),c.addTransition(new Et(r,t.ruleToTokenType[e])),s.addTransition(new Tt(c))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof dt))return null;const n=t.transitions[t.transitions.length-1].target;return n instanceof ot&&n.epsilonOnlyTransitions&&n.transitions[0].target instanceof v?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const n=t.states[e];if(n instanceof dt&&t.ruleToStartState[n.ruleIndex].isPrecedenceRule){const t=n.transitions[n.transitions.length-1].target;t instanceof ot&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof v&&(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 pt)this.checkCondition(null!==n.loopBackState);else if(n instanceof dt)if(this.checkCondition(null!==n.loopBackState),this.checkCondition(2===n.transitions.length),n.transitions[0].target instanceof xt)this.checkCondition(n.transitions[1].target instanceof ot),this.checkCondition(!n.nonGreedy);else{if(!(n.transitions[0].target instanceof ot))throw"IllegalState";this.checkCondition(n.transitions[1].target instanceof xt),this.checkCondition(n.nonGreedy)}else n instanceof ut?(this.checkCondition(1===n.transitions.length),this.checkCondition(n.transitions[0].target instanceof dt)):n instanceof ot?this.checkCondition(null!==n.loopBackState):n instanceof lt?this.checkCondition(null!==n.stopState):n instanceof rt?this.checkCondition(null!==n.endState):n instanceof at?this.checkCondition(null!==n.startState):n instanceof st?this.checkCondition(n.transitions.length<=1||n.decision>=0):this.checkCondition(n.transitions.length<=1||n instanceof v)}}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(t,e,n,i,s,r,a,o){const l=t.states[i];switch(e){case O.EPSILON:return new Tt(l);case O.RANGE:return new gt(l,0!==a?h.EOF:s,r);case O.RULE:return new N(t.states[s],r,a,l);case O.PREDICATE:return new St(l,s,r,0!==a);case O.PRECEDENCE:return new yt(l,s);case O.ATOM:return new Et(l,0!==a?h.EOF:s);case O.ACTION:return new Rt(l,s,r,0!==a);case O.SET:return new P(l,o[s]);case O.NOT_SET:return new b(l,o[s]);case O.WILDCARD:return new w(l);default:throw"The specified transition type: "+e+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[k.INVALID_TYPE]=null,t[k.BASIC]=()=>new it,t[k.RULE_START]=()=>new lt,t[k.BLOCK_START]=()=>new ft,t[k.PLUS_BLOCK_START]=()=>new pt,t[k.STAR_BLOCK_START]=()=>new xt,t[k.TOKEN_START]=()=>new ht,t[k.RULE_STOP]=()=>new v,t[k.BLOCK_END]=()=>new at,t[k.STAR_LOOP_BACK]=()=>new ut,t[k.STAR_LOOP_ENTRY]=()=>new dt,t[k.PLUS_LOOP_BACK]=()=>new ct,t[k.LOOP_END]=()=>new ot,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 It(t),t[1]=(t,e)=>new kt(t,e),t[2]=(t,e)=>new bt(t),t[3]=(t,e)=>vt.INSTANCE,t[4]=(t,e)=>Pt.INSTANCE,t[5]=(t,e)=>new Nt(t),t[6]=(t,e)=>Ct.INSTANCE,t[7]=(t,e)=>new Ot(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 Dt{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 Mt extends Dt{constructor(){super()}syntaxError(t,e,n,i,s,r){console.error("line "+n+":"+i+" "+s)}}Mt.INSTANCE=new Mt;class Ut extends Dt{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 Ht{constructor(){this._listeners=[Mt.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 t=this.getTokenNames();if(null===t)throw"The current recognizer does not provide a list of token names.";let e=this.tokenTypeMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,n){t[e]=n})),e.EOF=h.EOF,this.tokenTypeMapCache[t]=e),e}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(t){const e=this.getTokenTypeMap()[t];return void 0!==e?e:h.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(t){if(null===t)return"<no token>";let e=t.text;return null===e&&(e=t.type===h.EOF?"<EOF>":"<"+t.type+">"),e=e.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+e+"'"}getErrorListenerDispatch(){return new Ut(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}}Ht.tokenTypeMapCache={},Ht.ruleIndexMapCache={};class Ft extends h{constructor(t,e,n,i,s){super(),this.source=void 0!==t?t:Ft.EMPTY_SOURCE,this.type=void 0!==e?e:null,this.channel=void 0!==n?n:h.DEFAULT_CHANNEL,this.start=void 0!==i?i:-1,this.stop=void 0!==s?s:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=t[0].line,this.column=t[0].column):this.column=-1}clone(){const t=new Ft(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(t){const e=new Ft(this.source,t,this.channel,this.start,this.stop);return e.tokenIndex=this.tokenIndex,e.line=this.line,e.column=this.column,t===h.EOF&&(e.text=""),e}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}}Ft.EMPTY_SOURCE=[null,null];class Gt{}class Vt extends Gt{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,n,i,s,r,a,o){const l=new Ft(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 Ft(null,t);return n.text=e,n}}Vt.DEFAULT=new Vt;class zt extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,zt),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 Kt extends zt{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 C(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Wt extends Ht{constructor(t){super(),this._input=t,this._factory=Vt.DEFAULT,this._tokenFactorySourcePair=[this,t],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=h.DEFAULT_CHANNEL,this._type=h.INVALID_TYPE,this._modeStack=[],this._mode=Wt.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=h.INVALID_TYPE,this._channel=h.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Wt.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const t=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=h.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=h.INVALID_TYPE;let n=Wt.SKIP;try{n=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof zt))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===h.EOF&&(this._hitEOF=!0),this._type===h.INVALID_TYPE&&(this._type=n),this._type===Wt.SKIP){e=!0;break}if(this._type!==Wt.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(t)}}skip(){this._type=Wt.SKIP}more(){this._type=Wt.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 t=this.column,e=this.line,n=this._factory.create(this._tokenFactorySourcePair,h.EOF,null,h.DEFAULT_CHANNEL,this._input.index,this._input.index-1,e,t);return this.emitToken(n),n}getCharIndex(){return this._input.index}getAllTokens(){const t=[];let e=this.nextToken();for(;e.type!==h.EOF;)t.push(e),e=this.nextToken();return t}notifyListeners(t){const e=this._tokenStartCharIndex,n=this._input.index,i=this._input.getText(e,n),s="token recognition error at: '"+this.getErrorDisplay(i)+"'";this.getErrorListenerDispatch().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,s,t)}getErrorDisplay(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n]);return e.join("")}getErrorDisplayForChar(t){return t.charCodeAt(0)===h.