UNPKG

chevrotain

Version:

Chevrotain is a high performance fault tolerant javascript parsing DSL for building recursive decent parsers

155 lines 114 kB
var et="13.2.0";function ge(n){console&&console.error&&console.error(`Error: ${n}`)}function be(n){console&&console.warn&&console.warn(`Warning: ${n}`)}function we(n){let e=new Date().getTime(),t=n();return{time:new Date().getTime()-e,value:t}}function Fe(n){function e(){}e.prototype=n;let t=new e;function r(){return typeof t.bar}return r(),r(),n;(0,eval)(n)}function Wr(n){return Kr(n)?n.LABEL:n.name}function Kr(n){return typeof n.LABEL=="string"&&n.LABEL!==""}var K=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},N=class extends K{constructor(e){super([]),this.idx=1,Object.assign(this,Q(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},B=class extends K{constructor(e){super(e.definition),this.orgText="",Object.assign(this,Q(e))}},x=class extends K{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,Q(e))}},_=class extends K{constructor(e){super(e.definition),this.idx=1,Object.assign(this,Q(e))}},P=class extends K{constructor(e){super(e.definition),this.idx=1,Object.assign(this,Q(e))}},M=class extends K{constructor(e){super(e.definition),this.idx=1,Object.assign(this,Q(e))}},S=class extends K{constructor(e){super(e.definition),this.idx=1,Object.assign(this,Q(e))}},L=class extends K{constructor(e){super(e.definition),this.idx=1,Object.assign(this,Q(e))}},y=class extends K{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,Q(e))}},I=class{constructor(e){this.idx=1,Object.assign(this,Q(e))}accept(e){e.visit(this)}};function tt(n){return n.map(Ae)}function Ae(n){function e(t){return t.map(Ae)}if(n instanceof N){let t={type:"NonTerminal",name:n.nonTerminalName,idx:n.idx};return typeof n.label=="string"&&(t.label=n.label),t}else{if(n instanceof x)return{type:"Alternative",definition:e(n.definition)};if(n instanceof _)return{type:"Option",idx:n.idx,definition:e(n.definition)};if(n instanceof P)return{type:"RepetitionMandatory",idx:n.idx,definition:e(n.definition)};if(n instanceof M)return{type:"RepetitionMandatoryWithSeparator",idx:n.idx,separator:Ae(new I({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof L)return{type:"RepetitionWithSeparator",idx:n.idx,separator:Ae(new I({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof S)return{type:"Repetition",idx:n.idx,definition:e(n.definition)};if(n instanceof y)return{type:"Alternation",idx:n.idx,definition:e(n.definition)};if(n instanceof I){let t={type:"Terminal",name:n.terminalType.name,label:Wr(n.terminalType),idx:n.idx};typeof n.label=="string"&&(t.terminalLabel=n.label);let r=n.terminalType.PATTERN;return n.terminalType.PATTERN&&(t.pattern=r instanceof RegExp?r.source:r),t}else{if(n instanceof B)return{type:"Rule",name:n.name,orgText:n.orgText,definition:e(n.definition)};throw Error("non exhaustive match")}}}function Q(n){return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0))}var D=class{visit(e){let t=e;switch(t.constructor){case N:return this.visitNonTerminal(t);case x:return this.visitAlternative(t);case _:return this.visitOption(t);case P:return this.visitRepetitionMandatory(t);case M:return this.visitRepetitionMandatoryWithSeparator(t);case L:return this.visitRepetitionWithSeparator(t);case S:return this.visitRepetition(t);case y:return this.visitAlternation(t);case I:return this.visitTerminal(t);case B:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Wt(n){return n instanceof x||n instanceof _||n instanceof S||n instanceof P||n instanceof M||n instanceof L||n instanceof I||n instanceof B}function le(n,e=[]){return n instanceof _||n instanceof S||n instanceof L?!0:n instanceof y?n.definition.some(r=>le(r,e)):n instanceof N&&e.includes(n)?!1:n instanceof K?(n instanceof N&&e.push(n),n.definition.every(r=>le(r,e))):!1}function Kt(n){return n instanceof y}function W(n){if(n instanceof N)return"SUBRULE";if(n instanceof _)return"OPTION";if(n instanceof y)return"OR";if(n instanceof P)return"AT_LEAST_ONE";if(n instanceof M)return"AT_LEAST_ONE_SEP";if(n instanceof L)return"MANY_SEP";if(n instanceof S)return"MANY";if(n instanceof I)return"CONSUME";throw Error("non exhaustive match")}var ee=class{walk(e,t=[]){e.definition.forEach((r,i)=>{let s=e.definition.slice(i+1);if(r instanceof N)this.walkProdRef(r,s,t);else if(r instanceof I)this.walkTerminal(r,s,t);else if(r instanceof x)this.walkFlat(r,s,t);else if(r instanceof _)this.walkOption(r,s,t);else if(r instanceof P)this.walkAtLeastOne(r,s,t);else if(r instanceof M)this.walkAtLeastOneSep(r,s,t);else if(r instanceof L)this.walkManySep(r,s,t);else if(r instanceof S)this.walkMany(r,s,t);else if(r instanceof y)this.walkOr(r,s,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){let i=t.concat(r);this.walk(e,i)}walkOption(e,t,r){let i=t.concat(r);this.walk(e,i)}walkAtLeastOne(e,t,r){let i=[new _({definition:e.definition})].concat(t,r);this.walk(e,i)}walkAtLeastOneSep(e,t,r){let i=kn(e,t,r);this.walk(e,i)}walkMany(e,t,r){let i=[new _({definition:e.definition})].concat(t,r);this.walk(e,i)}walkManySep(e,t,r){let i=kn(e,t,r);this.walk(e,i)}walkOr(e,t,r){let i=t.concat(r);e.definition.forEach(s=>{let o=new x({definition:[s]});this.walk(o,i)})}};function kn(n,e,t){return[new _({definition:[new I({terminalType:n.separator})].concat(n.definition)})].concat(e,t)}function he(n){if(n instanceof N)return he(n.referencedRule);if(n instanceof I)return Xr(n);if(Wt(n))return Vr(n);if(Kt(n))return Hr(n);throw Error("non exhaustive match")}function Vr(n){let e=[],t=n.definition,r=0,i=t.length>r,s,o=!0;for(;i&&o;)s=t[r],o=le(s),e=e.concat(he(s)),r=r+1,i=t.length>r;return[...new Set(e)]}function Hr(n){let e=n.definition.map(t=>he(t));return[...new Set(e.flat())]}function Xr(n){return[n.terminalType]}var nt="_~IN~_";var Vt=class extends ee{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){let i=zr(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(r),o=new x({definition:s}),a=he(o);this.follows[i]=a}};function Cn(n){let e={};return n.forEach(t=>{let r=new Vt(t).startWalking();Object.assign(e,r)}),e}function zr(n,e){return n.name+e+nt}function g(n){return n.charCodeAt(0)}function rt(n,e){Array.isArray(n)?n.forEach(function(t){e.push(t)}):e.push(n)}function Re(n,e){if(n[e]===!0)throw"duplicate flag "+e;let t=n[e];n[e]=!0}function ue(n){if(n===void 0)throw Error("Internal Error - Should never get here!");return!0}function Ue(){throw Error("Internal Error - Should never get here!")}function Ht(n){return n.type==="Character"}var De=[];for(let n=g("0");n<=g("9");n++)De.push(n);var Ge=[g("_")].concat(De);for(let n=g("a");n<=g("z");n++)Ge.push(n);for(let n=g("A");n<=g("Z");n++)Ge.push(n);var Xt=[g(" "),g("\f"),g(`
`),g("\r"),g("	"),g("\v"),g("	"),g("\xA0"),g("\u1680"),g("\u2000"),g("\u2001"),g("\u2002"),g("\u2003"),g("\u2004"),g("\u2005"),g("\u2006"),g("\u2007"),g("\u2008"),g("\u2009"),g("\u200A"),g("\u2028"),g("\u2029"),g("\u202F"),g("\u205F"),g("\u3000"),g("\uFEFF")];var Yr=/[0-9a-fA-F]/,it=/[0-9]/,qr=/[1-9]/,je=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Re(r,"global");break;case"i":Re(r,"ignoreCase");break;case"m":Re(r,"multiLine");break;case"u":Re(r,"unicode");break;case"y":Re(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}ue(t);let r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return Ue()}quantifier(e=!1){let t,r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:i,atMost:s}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;ue(t);break}if(!(e===!0&&t===void 0)&&ue(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ue(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Ue()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[g(`
`),g("\r"),g("\u2028"),g("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=De;break;case"D":e=De,t=!0;break;case"s":e=Xt;break;case"S":e=Xt,t=!0;break;case"w":e=Ge;break;case"W":e=Ge,t=!0;break}return ue(e)?{type:"Set",value:e,complement:t}:Ue()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=g("\f");break;case"n":e=g(`
`);break;case"r":e=g("\r");break;case"t":e=g("	");break;case"v":e=g("\v");break}return ue(e)?{type:"Character",value:e}:Ue()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:g("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:g(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:g(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let r=this.classAtom(),i=r.type==="Character";if(Ht(r)&&this.isRangeDash()){this.consumeChar("-");let s=this.classAtom(),o=s.type==="Character";if(Ht(s)){if(s.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:s.value})}else rt(r.value,e),e.push(g("-")),rt(s.value,e)}else rt(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:g("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(")");let r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(qr.test(e)===!1)throw Error("Expecting a positive integer");for(;it.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(it.test(e)===!1)throw Error("Expecting an integer");for(;it.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:g(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return it.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let i=0;i<e;i++){let s=this.popChar();if(Yr.test(s)===!1)throw Error("Expecting a HexDecimal digits");t+=s}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};var se=class{visitChildren(e){for(let t in e){let r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var st={},Qr=new je;function de(n){let e=n.toString();if(st.hasOwnProperty(e))return st[e];{let t=Qr.pattern(e);return st[e]=t,t}}function Ln(){st={}}var vn="Complement Sets are not supported for first char optimization",Be=`Unable to use "first char" lexer optimizations:
`;function Pn(n,e=!1){try{let t=de(n);return zt(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===vn)e&&be(`${Be}	Unable to optimize: < ${n.toString()} >
	Complement Sets cannot be automatically optimized.
	This will disable the lexer's first char optimizations.
	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
	This will disable the lexer's first char optimizations.
	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),ge(`${Be}
	Failed parsing: < ${n.toString()} >
	Using the @chevrotain/regexp-to-ast library
	Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function zt(n,e,t){switch(n.type){case"Disjunction":for(let i=0;i<n.value.length;i++)zt(n.value[i],e,t);break;case"Alternative":let r=n.value;for(let i=0;i<r.length;i++){let s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let o=s;switch(o.type){case"Character":ot(o.value,e,t);break;case"Set":if(o.complement===!0)throw Error(vn);o.value.forEach(c=>{if(typeof c=="number")ot(c,e,t);else{let l=c;if(t===!0)for(let u=l.from;u<=l.to;u++)ot(u,e,t);else{for(let u=l.from;u<=l.to&&u<Ie;u++)ot(u,e,t);if(l.to>=Ie){let u=l.from>=Ie?l.from:Ie,h=l.to,f=Z(u),E=Z(h);for(let A=f;A<=E;A++)e[A]=A}}}});break;case"Group":zt(o.value,e,t);break;default:throw Error("Non Exhaustive Match")}let a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&Yt(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(e)}function ot(n,e,t){let r=Z(n);e[r]=r,t===!0&&Zr(n,e)}function Zr(n,e){let t=String.fromCharCode(n),r=t.toUpperCase();if(r!==t){let i=Z(r.charCodeAt(0));e[i]=i}else{let i=t.toLowerCase();if(i!==t){let s=Z(i.charCodeAt(0));e[s]=s}}}function yn(n,e){return n.value.find(t=>{if(typeof t=="number")return e.includes(t);{let r=t;return e.find(i=>r.from<=i&&i<=r.to)!==void 0}})}function Yt(n){let e=n.quantifier;return e&&e.atLeast===0?!0:n.value?Array.isArray(n.value)?n.value.every(Yt):Yt(n.value):!1}var qt=class extends se{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?yn(e,this.targetCharCodes)===void 0&&(this.found=!0):yn(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function at(n,e){if(e instanceof RegExp){let t=de(e),r=new qt(n);return r.visit(t),r.found}else{for(let t of e){let r=t.charCodeAt(0);if(n.includes(r))return!0}return!1}}var fe="PATTERN",Oe="defaultMode",ct="modes",ht=0,$e=1,ut=2,dt=3;function bn(n,e){e=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(m,d)=>d()},e);let t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{gi()});let r;t("Reject Lexer.NA",()=>{r=n.filter(m=>m[fe]!==F.NA)});let i=!1,s;t("Transform Patterns",()=>{i=!1,s=r.map(m=>{let d=m[fe];if(d instanceof RegExp){let p=d.source;return p.length===1&&p!=="^"&&p!=="$"&&p!=="."&&!d.ignoreCase?p:p.length===2&&p[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(p[1])?p[1]:Mn(d)}else{if(typeof d=="function")return i=!0,{exec:d};if(typeof d=="object")return i=!0,d;if(typeof d=="string"){if(d.length===1)return d;{let p=d.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),v=new RegExp(p);return Mn(v)}}else throw Error("non exhaustive match")}})});let o,a,c,l,u;t("misc mapping",()=>{o=r.map(m=>m.tokenTypeIdx),a=r.map(m=>{let d=m.GROUP;if(d!==F.SKIPPED){if(typeof d=="string")return d;if(d===void 0)return!1;throw Error("non exhaustive match")}}),c=r.map(m=>{let d=m.LONGER_ALT;if(d)return Array.isArray(d)?d.map(v=>r.indexOf(v)):[r.indexOf(d)]}),l=r.map(m=>m.PUSH_MODE),u=r.map(m=>Object.hasOwn(m,"POP_MODE"))});let h;t("Line Terminator Handling",()=>{let m=Bn(e.lineTerminatorCharacters);h=r.map(d=>!1),e.positionTracking!=="onlyOffset"&&(h=r.map(d=>Object.hasOwn(d,"LINE_BREAKS")?!!d.LINE_BREAKS:jn(d,m)===!1&&at(m,d.PATTERN)))});let f,E,A,R;t("Misc Mapping #2",()=>{f=r.map(Dn),E=s.map(Ei),A=r.reduce((m,d)=>{let p=d.GROUP;return typeof p=="string"&&p!==F.SKIPPED&&(m[p]=[]),m},{}),R=s.map((m,d)=>{let p=a[d]===void 0&&c[d]===void 0?Jr(r[d].PATTERN):void 0;return{pattern:s[d],asciiClass:p,longerAlt:c[d],canLineTerminator:h[d],matchType:p!==void 0?dt:E[d]!==!1?ht:f[d]?$e:ut,short:E[d],group:a[d],push:l[d],pop:u[d],tokenTypeIdx:o[d],tokenType:r[d]}})});let O=!0,T=[];return e.safeMode||t("First Char Optimization",()=>{T=r.reduce((m,d,p)=>{if(typeof d.PATTERN=="string"){let v=d.PATTERN.charCodeAt(0),X=Z(v);Qt(m,X,R[p])}else if(Array.isArray(d.START_CHARS_HINT)){let v;d.START_CHARS_HINT.forEach(X=>{let ie=typeof X=="string"?X.charCodeAt(0):X,ae=Z(ie);v!==ae&&(v=ae,Qt(m,ae,R[p]))})}else if(d.PATTERN instanceof RegExp)if(d.PATTERN.unicode)O=!1,e.ensureOptimizations&&ge(`${Be}	Unable to analyze < ${d.PATTERN.toString()} > pattern.
	The regexp unicode flag is not currently supported by the regexp-to-ast library.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let v=Pn(d.PATTERN,e.ensureOptimizations);v.length===0&&(O=!1),v.forEach(X=>{Qt(m,X,R[p])})}else e.ensureOptimizations&&ge(`${Be}	TokenType: <${d.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),O=!1;return m},[])}),{emptyGroups:A,patternIdxToConfig:R,charCodeToPatternIdxToConfig:T,hasCustom:i,canBeOptimized:O}}function Jr(n){var e,t;if(!(n instanceof RegExp)||n.flags!=="")return;let r;try{r=de(n)}catch{return}if(r.value.value.length!==1||r.value.value[0].value.length!==1)return;let i=r.value.value[0].value[0],s;for(;i.type==="Group";){if(i.capturing||i.quantifier!==void 0&&s!==void 0||i.value.value.length!==1||i.value.value[0].value.length!==1)return;s=(e=i.quantifier)!==null&&e!==void 0?e:s,i=i.value.value[0].value[0]}if(i.type!=="Set"||i.complement||i.quantifier!==void 0&&s!==void 0||(s=(t=i.quantifier)!==null&&t!==void 0?t:s,s?.atLeast!==1||s.atMost!==1/0||!s.greedy))return;let o=new Uint8Array(128);for(let a of i.value){let c=typeof a=="number"?a:a.from,l=typeof a=="number"?a:a.to;if(c<0||l>=o.length)return;o.fill(1,c,l+1)}return o}function wn(n,e){let t=[],r=ti(n);t=t.concat(r.errors);let i=ni(r.valid),s=i.valid;return t=t.concat(i.errors),t=t.concat(ei(s)),t=t.concat(hi(s)),t=t.concat(ui(s,e)),t=t.concat(di(s)),t}function ei(n){let e=[],t=n.filter(r=>r[fe]instanceof RegExp);return e=e.concat(ii(t)),e=e.concat(ai(t)),e=e.concat(ci(t)),e=e.concat(li(t)),e=e.concat(si(t)),e}function ti(n){let e=n.filter(i=>!Object.hasOwn(i,fe)),t=e.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:k.MISSING_PATTERN,tokenTypes:[i]})),r=n.filter(i=>!e.includes(i));return{errors:t,valid:r}}function ni(n){let e=n.filter(i=>{let s=i[fe];return!(s instanceof RegExp)&&typeof s!="function"&&!Object.hasOwn(s,"exec")&&typeof s!="string"}),t=e.map(i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:k.INVALID_PATTERN,tokenTypes:[i]})),r=n.filter(i=>!e.includes(i));return{errors:t,valid:r}}var ri=/[^\\][$]/;function ii(n){class e extends se{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}return n.filter(i=>{let s=i.PATTERN;try{let o=de(s),a=new e;return a.visit(o),a.found}catch{return ri.test(s.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
	Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
	See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,type:k.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function si(n){return n.filter(r=>r.PATTERN.test("")).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:k.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}var oi=/[^\\[][\^]|^\^/;function ai(n){class e extends se{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}return n.filter(i=>{let s=i.PATTERN;try{let o=de(s),a=new e;return a.visit(o),a.found}catch{return oi.test(s.source)}}).map(i=>({message:`Unexpected RegExp Anchor Error:
	Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,type:k.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function ci(n){return n.filter(r=>{let i=r[fe];return i instanceof RegExp&&(i.multiline||i.global)}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:k.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function li(n){let e=[],t=n.map(s=>n.reduce((o,a)=>(s.PATTERN.source===a.PATTERN.source&&!e.includes(a)&&a.PATTERN!==F.NA&&(e.push(a),o.push(a)),o),[]));return t=t.filter(Boolean),t.filter(s=>s.length>1).map(s=>{let o=s.map(c=>c.name);return{message:`The same RegExp pattern ->${s[0].PATTERN}<-has been used in all of the following Token Types: ${o.join(", ")} <-`,type:k.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function hi(n){return n.filter(r=>{if(!Object.hasOwn(r,"GROUP"))return!1;let i=r.GROUP;return i!==F.SKIPPED&&i!==F.NA&&typeof i!="string"}).map(r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:k.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function ui(n,e){return n.filter(i=>i.PUSH_MODE!==void 0&&!e.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:k.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function di(n){let e=[],t=n.reduce((r,i,s)=>{let o=i.PATTERN;return o===F.NA||(typeof o=="string"?r.push({str:o,idx:s,tokenType:i}):o instanceof RegExp&&pi(o)&&r.push({str:o.source,idx:s,tokenType:i})),r},[]);return n.forEach((r,i)=>{t.forEach(({str:s,idx:o,tokenType:a})=>{if(i<o&&fi(s,r.PATTERN)){let c=`Token: ->${a.name}<- can never be matched.
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:k.UNREACHABLE_PATTERN,tokenTypes:[r,a]})}})}),e}function fi(n,e){if(e instanceof RegExp){if(mi(e))return!1;let t=e.exec(n);return t!==null&&t.index===0}else{if(typeof e=="function")return e(n,0,[],{});if(Object.hasOwn(e,"exec"))return e.exec(n,0,[],{});if(typeof e=="string")return e===n;throw Error("non exhaustive match")}}function pi(n){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(t=>n.source.indexOf(t)!==-1)===void 0}function mi(n){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(n.source)}function Mn(n){let e=n.ignoreCase?"iy":"y";return new RegExp(`${n.source}`,e)}function Fn(n,e,t){let r=[];return Object.hasOwn(n,Oe)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Oe+`> property in its definition
`,type:k.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(n,ct)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+ct+`> property in its definition
`,type:k.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(n,ct)&&Object.hasOwn(n,Oe)&&!Object.hasOwn(n.modes,n.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Oe}: <${n.defaultMode}>which does not exist
`,type:k.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(n,ct)&&Object.keys(n.modes).forEach(i=>{let s=n.modes[i];s.forEach((o,a)=>{o===void 0?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${a}>
`,type:k.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(o,"LONGER_ALT")&&(Array.isArray(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT]).forEach(l=>{l!==void 0&&!s.includes(l)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${o.name}> outside of mode <${i}>
`,type:k.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}function Un(n,e,t){let r=[],i=!1,o=Object.values(n.modes||{}).flat().filter(Boolean).filter(c=>c[fe]!==F.NA),a=Bn(t);return e&&o.forEach(c=>{let l=jn(c,a);if(l!==!1){let h={message:Ti(c,l),type:l.issue,tokenType:c};r.push(h)}else Object.hasOwn(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):at(a,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
	This Lexer has been defined to track line and column information,
	But none of the Token Types can be identified as matching a line terminator.
	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS 
	for details.`,type:k.NO_LINE_BREAKS_FLAGS}),r}function Dn(n){let e=n.PATTERN;if(e instanceof RegExp)return!1;if(typeof e=="function")return!0;if(Object.hasOwn(e,"exec"))return!0;if(typeof e=="string")return!1;throw Error("non exhaustive match")}function Ei(n){return typeof n=="string"&&n.length===1?n.charCodeAt(0):!1}var Gn={test:function(n){let e=n.length;for(let t=this.lastIndex;t<e;t++){let r=n.charCodeAt(t);if(r===10)return this.lastIndex=t+1,!0;if(r===13)return n.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function jn(n,e){if(Object.hasOwn(n,"LINE_BREAKS"))return!1;if(n.PATTERN instanceof RegExp){try{at(e,n.PATTERN)}catch(t){return{issue:k.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if(typeof n.PATTERN=="string")return!1;if(Dn(n))return{issue:k.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Ti(n,e){if(e.issue===k.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
	The problem is in the <${n.name}> Token Type
	 Root cause: ${e.errMsg}.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===k.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
	The problem is in the <${n.name}> Token Type
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Bn(n){return n.map(t=>typeof t=="string"?t.charCodeAt(0):t)}function Qt(n,e,t){n[e]===void 0?n[e]=[t]:n[e].push(t)}var Ie=256,lt=[];function Z(n){return n<Ie?n:lt[n]}function gi(){if(lt.length===0){lt=new Array(65536);for(let n=0;n<65536;n++)lt[n]=n>255?255+~~(n/255):n}}function te(n,e){let t=n.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function Se(n,e){return n.tokenTypeIdx===e.tokenTypeIdx}var $n=1,Kn={};function ne(n){let e=Ai(n);Ri(e),Oi(e),Ii(e),e.forEach(t=>{t.isParent=t.categoryMatches.length>0})}function Ai(n){let e=[...n],t=n,r=!0;for(;r;){t=t.map(s=>s.CATEGORIES).flat().filter(Boolean);let i=t.filter(s=>!e.includes(s));e=e.concat(i),i.length===0?r=!1:t=i}return e}function Ri(n){n.forEach(e=>{Zt(e)||(Kn[$n]=e,e.tokenTypeIdx=$n++),Wn(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Wn(e)||(e.CATEGORIES=[]),Si(e)||(e.categoryMatches=[]),Ni(e)||(e.categoryMatchesMap={})})}function Ii(n){n.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(Kn[t].tokenTypeIdx)})})}function Oi(n){n.forEach(e=>{Vn([],e)})}function Vn(n,e){n.forEach(t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),e.CATEGORIES.forEach(t=>{let r=n.concat(e);r.includes(t)||Vn(r,t)})}function Zt(n){return Object.hasOwn(n??{},"tokenTypeIdx")}function Wn(n){return Object.hasOwn(n??{},"CATEGORIES")}function Si(n){return Object.hasOwn(n??{},"categoryMatches")}function Ni(n){return Object.hasOwn(n??{},"categoryMatchesMap")}function Hn(n){return Object.hasOwn(n??{},"tokenTypeIdx")}var Jt={buildUnableToPopLexerModeMessage(n){return`Unable to pop Lexer Mode after encountering Token ->${n.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(n,e,t,r,i,s){return`unexpected character: ->${n.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var k;(function(n){n[n.MISSING_PATTERN=0]="MISSING_PATTERN",n[n.INVALID_PATTERN=1]="INVALID_PATTERN",n[n.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",n[n.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",n[n.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",n[n.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",n[n.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",n[n.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",n[n.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",n[n.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",n[n.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",n[n.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",n[n.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",n[n.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",n[n.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",n[n.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",n[n.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",n[n.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(k||(k={}));var We={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Jt,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(We);var F=class{constructor(e,t=We){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let o=new Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${o}--> <${i}>`);let{time:a,value:c}=we(s),l=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${o}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}else return s()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=Object.assign({},We,t);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===We.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Gn;else if(this.config.lineTerminatorCharacters===We.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?i={modes:{defaultMode:[...e]},defaultMode:Oe}:(s=!1,i=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Fn(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Un(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([a,c])=>{i.modes[a]=c.filter(l=>l!==void 0)});let o=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([a,c])=>{this.TRACE_INIT(`Mode: <${a}> processing`,()=>{if(this.modes.push(a),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(wn(c,o))}),this.lexerDefinitionErrors.length===0){ne(c);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=bn(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[a]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[a]=l.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[a]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let c=this.lexerDefinitionErrors.map(l=>l.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+c)}this.lexerDefinitionWarning.forEach(a=>{be(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(s&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=a=>a),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let a=Object.entries(this.canModeBeOptimized).reduce((c,[l,u])=>(u===!1&&c.push(l),c),[]);if(t.ensureOptimizations&&a.length>0)throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
	 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
	 Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Ln()}),this.TRACE_INIT("toFastProperties",()=>{Fe(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let i=this.lexerDefinitionErrors.map(s=>s.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+i)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,i,s,o,a,c,l,u,h,f,E,A,R,O,T,m=e,d=m.length,p=0,v=0,X=this.hasCustom?0:Math.floor(e.length/10),ie=new Array(X),ae=[],ye=this.trackStartLines?1:void 0,q=this.trackStartLines?1:void 0,Te={};for(let b=0;b<this.cachedGroupKeys.length;b++)Te[this.cachedGroupKeys[b]]=[];let Br=this.trackStartLines,Dt=this.config.lineTerminatorsPattern,Gt=0,ce=[],ve=[],Pe=[],Nn=[];Object.freeze(Nn);let Me=!1,$r=b=>{if(Pe.length===1&&b.tokenType.PUSH_MODE===void 0){let H=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(b);ae.push({offset:b.startOffset,line:b.startLine,column:b.startColumn,length:b.image.length,message:H})}else{Pe.pop();let H=Pe.at(-1);ce=this.patternIdxToConfig[H],ve=this.charCodeToPatternIdxToConfig[H],Gt=ce.length;let jt=this.canModeBeOptimized[H]&&this.config.safeMode===!1;ve&&jt?Me=!0:Me=!1}};function xn(b){Pe.push(b),ve=this.charCodeToPatternIdxToConfig[b],ce=this.patternIdxToConfig[b],Gt=ce.length;let H=this.canModeBeOptimized[b]&&this.config.safeMode===!1;ve&&H?Me=!0:Me=!1}xn.call(this,t);let V,_n=this.config.recoveryEnabled;for(;p<d;){c=null,h=-1;let b=m.charCodeAt(p),H;if(Me){let U=Z(b),$=ve[U];H=$!==void 0?$:Nn}else H=ce;let jt=H.length;for(r=0;r<jt;r++){V=H[r];let U=V.pattern;switch(l=null,V.matchType){case ht:b===V.short&&(h=1,c=U);break;case $e:T=U.exec(m,p,ie,Te),T!==null?(c=T[0],h=c.length,T.payload!==void 0&&(l=T.payload)):c=null;break;case dt:{let $=V.asciiClass;if($[b]!==1){U.lastIndex=0;break}let j=p+1;for(;$[m.charCodeAt(j)]===1;)j++;h=j-p,U.lastIndex=j;break}case ut:U.lastIndex=p,h=this.matchLength(U,e,p);break}if(h!==-1){if(a=V.longerAlt,a!==void 0){c=e.substring(p,p+h);let $=a.length;for(s=0;s<$;s++){let j=ce[a[s]],J=j.pattern;if(u=null,j.matchType===$e?(T=J.exec(m,p,ie,Te),T!==null?(o=T[0],T.payload!==void 0&&(u=T.payload)):o=null):(J.lastIndex=p,o=this.match(J,e,p)),o&&o.length>c.length){c=o,h=o.length,l=u,V=j;break}}}break}}if(h!==-1){if(f=V.group,f!==void 0&&(c=c!==null?c:e.substring(p,p+h),E=V.tokenTypeIdx,A=this.createTokenInstance(c,p,E,V.tokenType,ye,q,h),this.handlePayload(A,l),f===!1?v=this.addToken(ie,v,A):Te[f].push(A)),Br===!0&&V.canLineTerminator===!0){let U=0,$,j;Dt.lastIndex=0;do c=c!==null?c:e.substring(p,p+h),$=Dt.test(c),$===!0&&(j=Dt.lastIndex-1,U++);while($===!0);U!==0?(ye=ye+U,q=h-j,this.updateTokenEndLineColumnLocation(A,f,j,U,ye,q,h)):q=this.computeNewColumn(q,h)}else q=this.computeNewColumn(q,h);p=p+h,this.handleModes(V,$r,xn,A)}else{let U=p,$=ye,j=q,J=_n===!1;for(;J===!1&&p<d;)for(p++,i=0;i<Gt;i++){let Bt=ce[i],$t=Bt.pattern;switch(Bt.matchType){case ht:m.charCodeAt(p)===Bt.short&&(J=!0);break;case $e:J=$t.exec(m,p,ie,Te)!==null;break;case dt:case ut:$t.lastIndex=p,J=$t.exec(e)!==null;break}if(J===!0)break}if(R=p-U,q=this.computeNewColumn(q,R),O=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(m,U,R,$,j,Pe.at(-1)),ae.push({offset:U,line:$,column:j,length:R,message:O}),_n===!1)break}}return this.hasCustom||(ie.length=v),{tokens:ie,groups:Te,errors:ae}}handleModes(e,t,r,i){if(e.pop===!0){let s=e.push;t(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,r,i,s,o,a){let c,l;t!==void 0&&(c=r===a-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=o-1+-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,r,i){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,t,r,i,s,o){return{image:e,startOffset:t,startLine:s,startColumn:o,tokenTypeIdx:r,tokenType:i}}createFullToken(e,t,r,i,s,o,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:s,endLine:s,startColumn:o,endColumn:o+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,t,r){return e.push(r),t}addTokenUsingMemberAccess(e,t,r){return e[t]=r,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,r){return e.test(t)===!0?t.substring(r,e.lastIndex):null}matchLength(e,t,r){return e.test(t)===!0?e.lastIndex-r:-1}};F.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";F.NA=/NOT_APPLICABLE/;function pe(n){return en(n)?n.LABEL:n.name}function xi(n){return n.name}function en(n){return typeof n.LABEL=="string"&&n.LABEL!==""}var _i="parent",Xn="categories",zn="label",Yn="group",qn="push_mode",Qn="pop_mode",Zn="longer_alt",Jn="line_breaks",er="start_chars_hint";function ft(n){return ki(n)}function ki(n){let e=n.pattern,t={};if(t.name=n.name,e!==void 0&&(t.PATTERN=e),Object.hasOwn(n,_i))throw`The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(n,Xn)&&(t.CATEGORIES=n[Xn]),ne([t]),Object.hasOwn(n,zn)&&(t.LABEL=n[zn]),Object.hasOwn(n,Yn)&&(t.GROUP=n[Yn]),Object.hasOwn(n,Qn)&&(t.POP_MODE=n[Qn]),Object.hasOwn(n,qn)&&(t.PUSH_MODE=n[qn]),Object.hasOwn(n,Zn)&&(t.LONGER_ALT=n[Zn]),Object.hasOwn(n,Jn)&&(t.LINE_BREAKS=n[Jn]),Object.hasOwn(n,er)&&(t.START_CHARS_HINT=n[er]),t}var z=ft({name:"EOF",pattern:F.NA});ne([z]);function me(n,e,t,r,i,s,o,a){return{image:e,startOffset:t,endOffset:r,startLine:i,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:n.tokenTypeIdx,tokenType:n}}function tn(n,e){return te(n,e)}var pt={buildMismatchTokenMessage({expected:n,actual:e,previous:t,ruleName:r}){return`Expecting ${en(n)?`--> ${pe(n)} <--`:`token of type --> ${n.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:n,ruleName:e}){return"Redundant input, expecting EOF but found: "+n.image},buildNoViableAltMessage({expectedPathsPerAlt:n,actual:e,previous:t,customUserDescription:r,ruleName:i}){let s="Expecting: ",a=`
but found: '`+e[0].image+"'";if(r)return s+r+a;{let h=`one of these possible Token sequences:
${n.reduce((f,E)=>f.concat(E),[]).map(f=>`[${f.map(E=>pe(E)).join(", ")}]`).map((f,E)=>`  ${E+1}. ${f}`).join(`
`)}`;return s+h+a}},buildEarlyExitMessage({expectedIterationPaths:n,actual:e,customUserDescription:t,ruleName:r}){let i="Expecting: ",o=`
but found: '`+e[0].image+"'";if(t)return i+t+o;{let c=`expecting at least one iteration which starts with one of these possible Token sequences::
  <${n.map(l=>`[${l.map(u=>pe(u)).join(",")}]`).join(" ,")}>`;return i+c+o}}};Object.freeze(pt);var tr={buildRuleNotFoundError(n,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+n.name+"<-"}},Y={buildDuplicateFoundError(n,e){function t(u){return u instanceof I?u.terminalType.name:u instanceof N?u.nonTerminalName:""}let r=n.name,i=e[0],s=i.idx,o=W(i),a=t(i),c=s>0,l=`->${o}${c?s:""}<- ${a?`with argument: ->${a}<-`:""}
                  appears more than once (${e.length} times) in the top level rule: ->${r}<-.                  
                  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES 
                  `;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
`),l},buildNamespaceConflictError(n){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${n.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(n){let e=n.prefixPath.map(i=>pe(i)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;return`Ambiguous alternatives: <${n.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${t}> inside <${n.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`},buildAlternationAmbiguityError(n){let e=n.alternation.idx===0?"":n.alternation.idx,t=n.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${n.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${n.topLevelRule.name}> Rule,
`;if(t)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
Only the last alternative may be empty.
`;else{let i=n.prefixPath.map(s=>pe(s)).join(", ");r+=`<${i}> may appears as a prefix path in all these alternatives.
`}return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,r},buildEmptyRepetitionError(n){let e=W(n.repetition);return n.repetition.idx!==0&&(e+=n.repetition.idx),`The repetition <${e}> within Rule <${n.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(n){return"deprecated"},buildEmptyAlternationError(n){return`Ambiguous empty alternative: <${n.emptyChoiceIdx+1}> in <OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(n){return`An Alternation cannot have more than 256 alternatives:
<OR${n.alternation.idx}> inside <${n.topLevelRule.name}> Rule.
 has ${n.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(n){let e=n.topLevelRule.name,t=n.leftRecursionPath.map(s=>s.name),r=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is: 
 ${r}
 To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(n){return"deprecated"},buildDuplicateRuleNameError(n){let e;return n.topLevelRule instanceof B?e=n.topLevelRule.name:e=n.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${n.grammarName}<-`}};function nr(n,e){let t=new nn(n,e);return t.resolveRefs(),t.errors}var nn=class extends D{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:w.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var rn=class extends ee{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},mt=class extends rn{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=t.concat(r),s=new x({definition:i});this.possibleTokTypes=he(s),this.found=!0}}},Ne=class extends ee{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Et=class extends Ne{walkMany(e,t,r){if(e.idx===this.occurrence){let i=t.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof I&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,r)}},Ke=class extends Ne{walkManySep(e,t,r){if(e.idx===this.occurrence){let i=t.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof I&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,r)}},Tt=class extends Ne{walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){let i=t.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof I&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,r)}},Ve=class extends Ne{walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){let i=t.concat(r)[0];this.result.isEndOfRule=i===void 0,i instanceof I&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,r)}};function gt(n,e,t=[]){t=[...t];let r=[],i=0;function s(a){return a.concat(n.slice(i+1))}function o(a){let c=gt(s(a),e,t);return r.concat(c)}for(;t.length<e&&i<n.length;){let a=n[i];if(a instanceof x)return o(a.definition);if(a instanceof N)return o(a.definition);if(a instanceof _)r=o(a.definition);else if(a instanceof P){let c=a.definition.concat([new S({definition:a.definition})]);return o(c)}else if(a instanceof M){let c=[new x({definition:a.definition}),new S({definition:[new I({terminalType:a.separator})].concat(a.definition)})];return o(c)}else if(a instanceof L){let c=a.definition.concat([new S({definition:[new I({terminalType:a.separator})].concat(a.definition)})]);r=o(c)}else if(a instanceof S){let c=a.definition.concat([new S({definition:a.definition})]);r=o(c)}else{if(a instanceof y)return a.definition.forEach(c=>{c.definition.length!==0&&(r=o(c.definition))}),r;if(a instanceof I)t.push(a.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:t,suffixDef:n.slice(i)}),r}function rr(n,e,t,r){let i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE",a=!1,c=e.length,l=c-r-1,u=[],h=[];for(h.push({idx:-1,def:n,ruleStack:[],occurrenceStack:[]});h.length!==0;){let f=h.pop();if(f===o){a&&h.at(-1).idx<=l&&h.pop();continue}let E=f.def,A=f.idx,R=f.ruleStack,O=f.occurrenceStack;if(E.length===0)continue;let T=E[0];if(T===i){let m={idx:A,def:E.slice(1),ruleStack:R.slice(0,-1),occurrenceStack:O.slice(0,-1)};h.push(m)}else if(T instanceof I)if(A<c-1){let m=A+1,d=e[m];if(t(d,T.terminalType)){let p={idx:m,def:E.slice(1),ruleStack:R,occurrenceStack:O};h.push(p)}}else if(A===c-1)u.push({nextTokenType:T.terminalType,nextTokenOccurrence:T.idx,ruleStack:R,occurrenceStack:O}),a=!0;else throw Error("non exhaustive match");else if(T instanceof N){let m=[...R];m.push(T.nonTerminalName);let d=[...O];d.push(T.idx);let p={idx:A,def:T.definition.concat(s,E.slice(1)),ruleStack:m,occurrenceStack:d};h.push(p)}else if(T instanceof _){let m={idx:A,def:E.slice(1),ruleStack:R,occurrenceStack:O};h.push(m),h.push(o);let d={idx:A,def:T.definition.concat(E.slice(1)),ruleStack:R,occurrenceStack:O};h.push(d)}else if(T instanceof P){let m=new S({definition:T.definition,idx:T.idx}),d=T.definition.concat([m],E.slice(1)),p={idx:A,def:d,ruleStack:R,occurrenceStack:O};h.push(p)}else if(T instanceof M){let m=new I({terminalType:T.separator}),d=new S({definition:[m].concat(T.definition),idx:T.idx}),p=T.definition.concat([d],E.slice(1)),v={idx:A,def:p,ruleStack:R,occurrenceStack:O};h.push(v)}else if(T instanceof L){let m={idx:A,def:E.slice(1),ruleStack:R,occurrenceStack:O};h.push(m),h.push(o);let d=new I({terminalType:T.separator}),p=new S({definition:[d].concat(T.definition),idx:T.idx}),v=T.definition.concat([p],E.slice(1)),X={idx:A,def:v,ruleStack:R,occurrenceStack:O};h.push(X)}else if(T instanceof S){let m={idx:A,def:E.slice(1),ruleStack:R,occurrenceStack:O};h.push(m),h.push(o);let d=new S({definition:T.definition,idx:T.idx}),p=T.definition.concat([d],E.slice(1)),v={idx:A,def:p,ruleStack:R,occurrenceStack:O};h.push(v)}else if(T instanceof y)for(let m=T.definition.length-1;m>=0;m--){let d=T.definition[m],p={idx:A,def:d.definition.concat(E.slice(1)),ruleStack:R,occurrenceStack:O};h.push(p),h.push(o)}else if(T instanceof x)h.push({idx:A,def:T.definition.concat(E.slice(1)),ruleStack:R,occurrenceStack:O});else if(T instanceof B)h.push(Ci(T,A,R,O));else throw Error("non exhaustive match")}return u}function Ci(n,e,t,r){let i=[...t];i.push(n.name);let s=[...r];return s.push(1),{idx:e,def:n.definition,ruleStack:i,occurrenceStack:s}}var C;(function(n){n[n.OPTION=0]="OPTION",n[n.REPETITION=1]="REPETITION",n[n.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",n[n.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",n[n.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",n[n.ALTERNATION=5]="ALTERNATION"})(C||(C={}));function He(n){if(n instanceof _||n==="Option")return C.OPTION;if(n instanceof S||n==="Repetition")return C.REPETITION;if(n instanceof P||n==="RepetitionMandatory")return C.REPETITION_MANDATORY;if(n instanceof M||n==="RepetitionMandatoryWithSeparator")return C.REPETITION_MANDATORY_WITH_SEPARATOR;if(n instanceof L||n==="RepetitionWithSeparator")return C.REPETITION_WITH_SEPARATOR;if(n instanceof y||n==="Alternation")return C.ALTERNATION;throw Error("non exhaustive match")}function Li(n){let{occurrence:e,rule:t,prodType:r,maxLookahead:i}=n,s=He(r);return s===C.ALTERNATION?xe(e,t,i):_e(e,t,s,i)}function sr(n,e,t,r,i,s){let o=xe(n,e,t),a=ur(o)?Se:te;return s(o,r,a,i)}function or(n,e,t,r,i,s){let o=_e(n,e,i,t),a=ur(o)?Se:te;return s(o[0],a,r)}function ar(n,e,t,r){let i=n.length,s=n.every(o=>o.every(a=>a.length===1));if(e)return function(o){let a=o.map(c=>c.GATE);for(let c=0;c<i;c++){let l=n[c],u=l.length,h=a[c];if(!(h!==void 0&&h.call(this)===!1))e:for(let f=0;f<u;f++){let E=l[f],A=E.length;for(let R=0;R<A;R++){let O=this.LA_FAST(R+1);if(t(O,E[R])===!1)continue e}return c}}};if(s&&!r){let a=n.map(c=>c.flat()).reduce((c,l,u)=>(l.forEach(h=>{h.tokenTypeIdx in c||(c[h.tokenTypeIdx]=u),h.categoryMatches.forEach(f=>{Object.hasOwn(c,f)||(c[f]=u)})}),c),{});return function(){let c=this.LA_FAST(1);return a[c.tokenTypeIdx]}}else return function(){for(let o=0;o<i;o++){let a=n[o],c=a.length;e:for(let l=0;l<c;l++){let u=a[l],h=u.length;for(let f=0;f<h;f++){let E=this.LA_FAST(f+1);if(t(E,u[f])===!1)continue e}return o}}}}function cr(n,e,t){let r=n.every(s=>s.length===1),i=n.length;if(r&&!t){let s=n.flat();if(s.length===1&&s[0].categoryMatches.length===0){let a=s[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===a}}else{let o=s.reduce((a,c,l)=>(a[c.tokenTypeIdx]=!0,c.categoryMatches.forEach(u=>{a[u]=!0}),a),[]);return function(){let a=this.LA_FAST(1);return o[a.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){let o=n[s],a=o.length;for(let c=0;c<a;c++){let l=this.LA_FAST(c+1);if(e(l,o[c])===!1)continue e}return!0}return!1}}var on=class extends ee{constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=r.concat(i),!0):!1}walkOption(e,t,r){this.checkIsTarget(e,C.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,C.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,C.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,C.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,C.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}},At=class extends D{constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,C.OPTION)}visitRepetition(e){this.checkIsTarget(e,C.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,C.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,C.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,C.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,C.ALTERNATION)}};function ir(n){let e=new Array(n);for(let t=0;t<n;t++)e[t]=[];return e}function sn(n){let e=[""];for(let t=0;t<n.length;t++){let r=n[t],i=[];for(let s=0;s<e.length;s++){let o=e[s];i.push(o+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){let c="_"+r.categoryMatches[a];i.push(o+c)}}e=i}return e}function yi(n,e,t){for(let r=0;r<n.length;r++){if(r===t)continue;let i=n[r];for(let s=0;s<e.length;s++){let o=e[s];if(i[o]===!0)return!1}}return!0}function lr(n,e){let t=n.map(o=>gt([o],1)),r=ir(t.length),i=t.map(o=>{let a={};return o.forEach(c=>{sn(c.partialPath).forEach(u=>{a[u]=!0})}),a}),s=t;for(let o=1;o<=e;o++){let a=s;s=ir(a.length);for(let c=0;c<a.length;c++){let l=a[c];for(let u=0;u<l.length;u++){let h=l[u].partialPath,f=l[u].suffixDef,E=sn(h);if(yi(i,E,c)||f.length===0||h.length===e){let R=r[c];if(Rt(R,h)===!1){R.push(h);for(let O=0;O<E.length;O++){let T=E[O];i[c][T]=!0}}}else{let R=gt(f,o+1,h);s[c]=s[c].concat(R),R.forEach(O=>{sn(O.partialPath).forEach(m=>{i[c][m]=!0})})}}}}return r}function xe(n,e,t,r){let i=new At(n,C.ALTERNATION,r);return e.accept(i),lr(i.result,t)}function _e(n,e,t,r){let i=new At(n,t);e.accept(i);let s=i.result,a=new on(e,n,t).startWalking(),c=new x({definition:s}),l=new x({definition:a});return lr([c,l],r)}function Rt(n,e){e:for(let t=0;t<n.length;t++){let r=n[t];if(r.length===e.length){for(let i=0;i<r.length;i++){let s=e[i],o=r[i];if((s===o||o.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function hr(n,e){return n.length<e.length&&n.every((t,r)=>{let i=e[r];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}function ur(n){return n.every(e=>e.every(t=>t.every(r=>r.categoryMatches.length===0)))}function dr(n){return n.lookaheadStrategy.validate({rules:n.rules,tokenTypes:n.tokenTypes,grammarName:n.grammarName}).map(t=>Object.assign({type:w.CUSTOM_LOOKAHEAD_VALIDATION},t))}function fr(n,e,t,r){let i=n.flatMap(c=>vi(c,t)),s=Ui(n,e,t),o=n.flatMap(c=>bi(c,t)),a=n.flatMap(c=>Mi(c,n,r,t));return i.concat(s,o,a)}function vi(n,e){let t=new an;n.accept(t);let r=t.allProductions,i=Object.groupBy(r,Pi),s=Object.fromEntries(Object.entries(i).filter(([a,c])=>c.length>1));return Object.values(s).map(a=>{let c=a[0],l=e.buildDuplicateFoundError(n,a),u=W(c),h={message:l,type:w.DUPLICATE_PRODUCTIONS,ruleName:n.name,dslName:u,occurrence:c.idx},f=pr(c);return f&&(h.parameter=f),h})}function Pi(n){return`${W(n)}_#_${n.idx}_#_${pr(n)}`}function pr(n){return n instanceof I?n.terminalType.name:n instanceof N?n.nonTerminalName:""}var an=class extends D{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function Mi(n,e,t,r){let i=[];if(e.reduce((o,a)=>a.name===n.name?o+1:o,0)>1){let o=r.buildDuplicateRuleNameError({topLevelRule:n,grammarName:t});i.push({message:o,type:w.DUPLICATE_RULE_NAME,ruleName:n.name})}return i}function mr(n,e,t){let r=[],i;return e.includes(n)||(i=`Invalid rule override, rule: ->${n}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,r.push({message:i,type:w.INVALID_RULE_OVERRIDE,ruleName:n})),r}function ln(n,e,t,r=[]){let i=[],s=It(e.definition);if(s.length===0)return[];{let o=n.name;s.includes(n)&&i.push({message:t.buildLeftRecursionError({topLevelRule:n,leftRecursionPath:r}),type:w.LEFT_RECURSION,ruleName:o});let c=r.concat([n]),u=s.filter(h=>!c.includes(h)).flatMap(h=>{let f=[...r];return f.push(h),ln(n,h,t,f)});return i.concat(u)}}function It(n){let e=[];if(n.length===0)return e;let t=n[0];if(t instanceof N)e.push(t.referencedRule);else if(t instanceof x||t instanceof _||t instanceof P||t instanceof M||t instanceof L||t instanceof S)e=e.concat(It(t.definition));else if(t instanceof y)e=t.definition.map(s=>It(s.definition)).flat();else if(!(t instanceof I))throw Error("non exhaustive match");let r=le(t),i=n.length>1;if(r&&i){let s=n.slice(1);return e.concat(It(s))}else return e}var Xe=class extends D{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Er(n,e){let t=new Xe;return n.accept(t),t.alternations.flatMap(s=>s.definition.slice(0,-1).flatMap((a,c)=>rr([a],[],te,1).length===0?[{message:e.buildEmptyAlternationError({topLevelRule:n,alternation:s,emptyChoiceIdx:c}),type:w.NONE_LAST_EMPTY_ALT,ruleName:n.name,occurrence:s.idx,alternative:c+1}]:[]))}function Tr(n,e,t){let r=new Xe;n.accept(r);let i=r.alternations;return i=i.filter(o=>o.ignoreAmbiguities!==!0),i.flatMap(o=>{let a=o.idx,c=o.maxLookahead||e,l=xe(a,n,c,o),u=wi(l,o,n,t),h=Fi(l,o,n,t);return u.concat(h)})}var cn=class extends D{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function bi(n,e){let t=new Xe;return n.accept(t),t.alternations.flatMap(s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:n,alternation:s}),type:w.TOO_MANY_ALTS,ruleName:n.name,occurrence:s.idx}]:[])}function gr(n,e,t){let r=[];return n.forEach(i=>{let s=new cn;i.accept(s),s.allProductions.forEach(a=>{let c=He(a),l=a.maxLookahead||e,u=a.idx;if(_e(u,i,c,l)[0].flat().length===0){let E=t.buildEmptyRepetitionError({topLevelRule:i,repetition:a});r.push({message:E,type:w.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function wi(n,e,t,r){let i=[];return n.reduce((a,c,l)=>(e.definition[l].ignoreAmbiguities===!0||c.forEach(u=>{let h=[l];n.forEach((f,E)=>{l!==E&&Rt(f,u)&&e.definition[E].ignoreAmbiguities!==!0&&h.push(E)}),h.length>1&&!Rt(i,u)&&(i.push(u),a.push({alts:h,path:u}))}),a),[]).map(a=>{let c=a.alts.map(u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:c,prefixPath:a.path}),type:w.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:a.alts}})}function Fi(n,e,t,r){let i=n.reduce((o,a,c)=>{let l=a.map(u=>({idx:c,path:u}));return o.concat(l)},[]);return i.flatMap(o=>{if(e.definition[o.idx].ignoreAmbiguities===!0)return[];let c=o.idx,l=o.path;return i.filter(f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<c&&hr(f.path,l)).map(f=>{let E=[f.idx+1,c+1],A=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:E,prefixPath:f.path}),type:w.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:A,alternatives:E}})})}function Ui(n,e,t){let r=[],i=e.map(s=>s.name);return n.forEach(s=>{let o=s.name;if(i.includes(o)){let a=t.buildNamespaceConflictError(s);r.push({message:a,type:w.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),r}function Ar(n){let e=Object.assign({errMsgProvider:tr},n),t={};return n.rules.forEach(r=>{t[r.name]=r}),nr(t,e.errMsgProvider)}function Rr(n){var e;let t=(e=n.errMsgProvider)!==null&&e!==void 0?e:Y;return fr(n.rules,n.tokenTypes,t,n.grammarName)}var Ir="MismatchedTokenException",Or="NoViableAltException",Sr="EarlyExitException",Nr="NotAllInputParsedException",xr=[Ir,Or,Sr,Nr];Object.freeze(xr);function oe(n){return xr.includes(n.name)}var ke=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Ee=class extends ke{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Ir}},ze=class extends ke{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Or}},Ye=class extends ke{constructor(e,t){super(e,t),this.name=Nr}},qe=class extends ke{constructor(e,t,r){super(e,t),this.previousToken=r,this.name=Sr}};var hn={},dn="InRuleRecoveryException",un=class extends Error{constructor(e){super(e),this.name=dn}},Ot=class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,"recoveryEnabled")?e.recoveryEnabled:G.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Di)}getTokenToInsert(e){let t=me(e,"",-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,i){let s=this.findReSyncTokenType(),o=this.exportLexerState(),a=[],c=!1,l=this.LA_FAST(1),u=this.LA_FAST(1),h=()=>{let f=this.LA(0),E=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),A=new Ee(E,l,this.LA(0));A.resyncedTokens=a.slice(0,-1),this.SAVE_ERROR(A)};for(;!c;)if(this.tokenMatcher(u,i)){h();return}else if(r.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(u,s)?c=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,a));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,t,r){return!(r===!1||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],i=this.getGAstProductions()[t];return new mt(i,e).startWalking()}getFollowsForInRuleRecovery(e,t){let r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new un("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let r=this.LA_FAST(1);return t.find(s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),r=2;for(;;){let i=e.find(s=>tn(t,s));if(i!==void 0)return i;t=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return hn;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,r=this.RULE_STACK_IDX+1,i=new Array(r);for(let s=0;s<r;s++)s===0?i[s]=hn:i[s]={ruleName:this.shortRuleNameToFullName(e[s]),idxInCallingRule:t[s],inRule:this.shortRuleNameToFullName(e[s-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(t=>this.getFollowSetFromFollowKey(t)).flat()}getFollowSetFromFollowKey(e){if(e===hn)return[z];let t=e.ruleName+e.idxInCallingRule+nt+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,z)||t.push(e),t}reSyncTo(e){let t=[],r=this.LA_FAST(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,r,i,s,o,a){}getCurrentGrammarPath(e,t){let r=this.getHumanReadableRuleStack(),i=this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=new Array(e);for(let r=0;r<e;r++)t[r]=this.shortRuleNameToFullName(this.RULE_STACK[r]);return t}};function Di(n,e,t,r,i,s,o){var a,c,l;let u=r|i,h=(a=(c=this.firstAfterRepMap)[l=this.currRuleShortName])!==null&&a!==void 0?a:c[l]=[],f=h[u];if(f===void 0){let O=this.getCurrRuleFullName(),T=this.getGAstProductions()[O];f=new s(T,i).startWalking(),h[u]=f}let E=f.token,A=f.occurrence,R=f.isEndOfRule;this.RULE_STACK_IDX===0&&R&&E===void 0&&(E=z,A=1),!(E===void 0||A===void 0)&&this.shouldInRepetitionRecoveryBeTried(E,A,o)&&this.tryInRepetitionRecovery(n,e,t,E)}var Qe=class{constructor(e){var t;this.maxLookahead=(t=e?.maxLookahead)!==null&&t!==void 0?t:G.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...r,...i,...s]}return t}validateNoLeftRecursion(e){return e.flatMap(t=>ln(t,t,Y))}validateEmptyOrAlternatives(e){return e.flatMap(t=>Er(t,Y))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(r=>Tr(r,t,Y))}validateSomeNonEmptyLookaheadPath(e,t){return gr(e,t,Y)}buildLookaheadForAlternation(e){return sr(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,ar)}buildLookaheadForOptional(e){return or(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,He(e.prodType),cr)}};var Nt=class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:G.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,"maxLookahead")?e.maxLookahead:G.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,"lookaheadStrategy")?e.lookaheadStrategy:new Qe({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:r,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:c}=Gi(t);r.forEach(l=>{let u=l.idx===0?"":l.idx;this.TRACE_INIT(`${W(l)}${u}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:t,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[t.name],256|l.idx,h)})}),i.forEach(l=>{this.computeLookaheadFunc(t,l.idx,768,"Repetition",l.maxLookahead,W(l))}),s.forEach(l=>{this.computeLookaheadFunc(t,l.idx,512,"Option",l.maxLookahead,W(l))}),o.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1024,"RepetitionMandatory",l.maxLookahead,W(l))}),a.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1536,"RepetitionMandatoryWithSeparator",l.maxLookahead,W(l))}),c.forEach(l=>{this.computeLookaheadFunc(t,l.idx,1280,"RepetitionWithSeparator",l.maxLookahead,W(l))})})})}computeLookaheadFunc(e,t,r,i,s,o){this.TRACE_INIT(`${o}${t===0?"":t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[e.name],r|t,a)})}setLaFuncCache(e,t,r){let i=this.lookAheadFuncsCache[e];i===void 0&&(i=[],this.lookAheadFuncsCache[e]=i),i[t]=r}},fn=class extends D{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},St=new fn;function Gi(n){St.reset(),n.accept(St);let e=St.dslMethods;return St.reset(),e}function En(n,e){n.startOffset===-1?(n.startOffset=e.startOffset,n.endOffset=e.endOffset):n.endOffset<e.endOffset&&(n.endOffset=e.endOffset)}function Tn(n,e){n.startOffset===-1?(n.startOffset=e.startOffset,n.startColumn=e.startColumn,n.startLine=e.startLine,n.endOffset=e.endOffset,n.endColumn=e.endColumn,n.endLine=e.endLine):n.endOffset<e.endOffset&&(n.endOffset=e.endOffset,n.endColumn=e.endColumn,n.endLine=e.endLine)}function _r(n,e,t){n.children[t]===void 0?n.children[t]=[e]:n.children[t].push(e)}function kr(n,e,t){n.children[e]===void 0?n.children[e]=[t]:n.children[e].push(t)}var ji="name";function gn(n,e){Object.defineProperty(n,ji,{enumerable:!1,configurable:!0,writable:!1,value:e})}function Bi(n,e){let t=Object.keys(n),r=t.length;for(let i=0;i<r;i++){let s=t[i],o=n[s],a=o.length;for(let c=0;c<a;c++){let l=o[c];l.tokenTypeIdx===void 0&&this[l.name](l.children,e)}}}function Cr(n,e){let t=function(){};gn(t,n+"BaseSemantics");let r={visit:function(i,s){if(Array.isArray(i)&&(i=i[0]),i!==void 0)return this[i.name](i.children,s)},validateVisitor:function(){let i=$i(this,e);if(i.length!==0){let s=i.map(o=>o.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
	${s.join(`

`).replace(/\n/g,`
	`)}`)}}};return t.prototype=r,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Lr(n,e,t){let r=function(){};gn(r,n+"BaseSemanticsWithDefaults");let i=Object.create(t.prototype);return e.forEach(s=>{i[s]=Bi}),r.prototype=i,r.prototype.constructor=r,r}var An;(function(n){n[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD"})(An||(An={}));function $i(n,e){return Wi(n,e)}function Wi(n,e){return e.filter(i=>typeof n[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${n.constructor.name} CST Visitor.`,type:An.MISSING_METHOD,methodName:i})).filter(Boolean)}var Ct=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:G.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Tn,this.setNodeLocationFromNode=Tn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=En,this.setNodeLocationFromNode=En,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),r=e.location;r.startOffset!==-1&&r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=-1,r.startLine=-1,r.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),r=e.location;r.startOffset!==-1&&r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=-1}cstPostTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];_r(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];kr(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}get currCSTNode(){let e=this;return e.CST_STACK[e.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Cr(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=Lr(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}};var Lt=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):re}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?re:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}};var yt=class{ACTION(e){return e.call(this)}consume(e,t,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,r=Ce){if(this.definedRulesNames.includes(e)){let o={message:Y.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:w.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);let i=this.defineRule(e,t,r);return this[e]=i,i}OVERRIDE_RULE(e,t,r=Ce){let i=mr(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let s=this.defineRule(e,t,r);return this[e]=s,s}BACKTRACK(e,t){var r;let i=(r=e.coreRule)!==null&&r!==void 0?r:e;return function(){this.isBackTrackingStack.push(1);let s=this.saveRecogState();try{return i.apply(this,t),!0}catch(o){if(oe(o))return!1;throw o}finally{this.reloadRecogState(s),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return tt(Object.values(this.gastProductionsCache))}};var vt=class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Se,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
	For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
	Note that the first argument for the parser constructor
	is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
	For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((s,o)=>(s[o.name]=o,s),{});else if(Object.hasOwn(e,"modes")&&Object.values(e.modes).flat().every(Hn)){let s=Object.values(e.modes).flat(),o=[...new Set(s)];this.tokensMap=o.reduce((a,c)=>(a[c.name]=c,a),{})}else if(typeof e=="object"&&e!==null)this.tokensMap=Object.assign({},e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=z;let i=(Object.hasOwn(e,"modes")?Object.values(e.modes).flat():Object.values(e)).every(s=>{var o;return((o=s.categoryMatches)===null||o===void 0?void 0:o.length)==0});this.tokenMatcher=i?Se:te,ne(Object.values(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=Object.hasOwn(r,"resyncEnabled")?r.resyncEnabled:Ce.resyncEnabled,s=Object.hasOwn(r,"recoveryValueFunc")?r.recoveryValueFunc:Ce.recoveryValueFunc,o=this.ruleShortNameIdx++;this.shortRuleNameToFull[o]=e,this.fullRuleNameToShort[e]=o;let a;return this.outputCst===!0?a=function(...h){try{this.ruleInvocationStateUpdate(o,e,this.subruleIdx),t.apply(this,h);let f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:a=function(...h){try{return this.ruleInvocationStateUpdate(o,e,this.subruleIdx),t.apply(this,h)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...h){this.onBeforeParse(e);try{return a.apply(this,h)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:a})}invokeRuleCatch(e,t,r){let i=this.RULE_STACK_IDX===0,s=t&&!this.isBackTracking()&&this.recoveryEnabled;if(oe(e)){let o=e;if(s){let a=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(a))if(o.resyncedTokens=this.reSyncTo(a),this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){let c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),r(e);throw o}}else throw e}optionInternal(e,t){let r=512|t;return this.optionInternalLogic(e,t,r)}optionInternalLogic(e,t,r){let i=this.currRuleLookaheadFuncs[r],s;if(typeof e!="function"){s=e.DEF;let o=e.GATE;if(o!==void 0){let a=i;i=()=>o.call(this)&&a.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,t){let r=1024|e;return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let i=this.currRuleLookaheadFuncs[r],s;if(typeof t!="function"){s=t.DEF;let o=t.GATE;if(o!==void 0){let a=i;i=()=>o.call(this)&&a.call(this)}}else s=t;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,C.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,1024,e,Tt)}atLeastOneSepFirstInternal(e,t){let r=1536|e;this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){let i=t.DEF,s=t.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),s);for(;this.tokenMatcher(this.LA_FAST(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,Ve],a,1536,e,Ve)}else throw this.raiseEarlyExitException(e,C.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let r=768|e;return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let i=this.currRuleLookaheadFuncs[r],s;if(typeof t!="function"){s=t.DEF;let a=t.GATE;if(a!==void 0){let c=i;i=()=>a.call(this)&&c.call(this)}}else s=t;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,o)}manySepFirstInternal(e,t){let r=1280|e;this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){let i=t.DEF,s=t.SEP;if(this.currRuleLookaheadFuncs[r].call(this)===!0){i.call(this);let a=()=>this.tokenMatcher(this.LA_FAST(1),s);for(;this.tokenMatcher(this.LA_FAST(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,a,i,Ke],a,1280,e,Ke)}}repetitionSepSecondInternal(e,t,r,i,s){for(;r();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,i,s],r,1536,e,s)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let r=256|t,i=Array.isArray(e)?e:e.DEF,o=this.currRuleLookaheadFuncs[r].call(this,i);if(o!==void 0)return i[o].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,r){let i;try{let s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=t,i=e.coreRule.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,t,r){throw oe(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let i;try{let s=this.LA_FAST(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,t,r){let i,s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Ee(i,t,s))}consumeInternalRecovery(e,t,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===dn?r:s}}else throw r}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let r=0;r<t.length;r++)this.RULE_STACK[r]=t[r];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,r){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=r,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),z)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let t=0;t<this.maxLookahead+1;t++)this.tokVector.push(re)}onAfterParse(e){if(this.isAtEndOfInput()===!1){let t=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Ye(r,t))}for(;this.tokVector.at(-1)===re;)this.tokVector.pop()}};var Pt=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,"errorMessageProvider")?e.errorMessageProvider:G.errorMessageProvider}SAVE_ERROR(e){if(oe(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){let i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],a=_e(e,s,t,this.maxLookahead)[0],c=[];for(let u=1;u<=this.maxLookahead;u++)c.push(this.LA(u));let l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new qe(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=xe(e,i,this.maxLookahead),o=[];for(let l=1;l<=this.maxLookahead;l++)o.push(this.LA(l));let a=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ze(c,this.LA(1),a))}};var wt={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(wt);var yr=!0,vr=255,Mr=ft({name:"RECORDING_PHASE_TOKEN",pattern:F.NA});ne([Mr]);var br=me(Mr,`This IToken indicates the Parser is in Recording Phase
	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(br);var Ki={name:`This CSTNode indicates the Parser is in Recording Phase
	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Mt=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${t}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return re}topLevelRuleRecord(e,t){try{let r=new B({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
	 This error was thrown during the "grammar recording phase" For more info see:
	https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return Je.call(this,_,e,t)}atLeastOneInternalRecord(e,t){Je.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Je.call(this,M,t,e,yr)}manyInternalRecord(e,t){Je.call(this,S,t,e)}manySepFirstInternalRecord(e,t){Je.call(this,L,t,e,yr)}orInternalRecord(e,t){return Vi.call(this,e,t)}subruleInternalRecord(e,t,r){if(bt(t),!e||!Object.hasOwn(e,"ruleName")){let a=new Error(`<SUBRULE${Pr(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=this.recordingProdStack.at(-1),s=e.ruleName,o=new N({idx:t,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?Ki:wt}consumeInternalRecord(e,t,r){if(bt(t),!Zt(e)){let o=new Error(`<CONSUME${Pr(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let i=this.recordingProdStack.at(-1),s=new I({idx:t,terminalType:e,label:r?.LABEL});return i.definition.push(s),br}};function Je(n,e,t,r=!1){bt(t);let i=this.recordingProdStack.at(-1),s=typeof e=="function"?e:e.DEF,o=new n({definition:[],idx:t});return r&&(o.separator=e.SEP),Object.hasOwn(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),wt}function Vi(n,e){bt(e);let t=this.recordingProdStack.at(-1),r=Array.isArray(n)===!1,i=r===!1?n:n.DEF,s=new y({definition:[],idx:e,ignoreAmbiguities:r&&n.IGNORE_AMBIGUITIES===!0});Object.hasOwn(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD);let o=i.some(a=>typeof a.GATE=="function");return s.hasPredicates=o,t.definition.push(s),i.forEach(a=>{let c=new x({definition:[]});s.definition.push(c),Object.hasOwn(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:Object.hasOwn(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),wt}function Pr(n){return n===0?"":`${n}`}function bt(n){if(n<0||n>vr){let e=new Error(`Invalid DSL Method idx value: <${n}>
	Idx value must be a none negative value smaller than ${vr+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var Ft=class{initPerformanceTracer(e){if(Object.hasOwn(e,"traceInitPerf")){let t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=G.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join("	");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);let{time:i,value:s}=we(t),o=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return t()}};function wr(n,e){e.forEach(t=>{let r=t.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;let s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(n.prototype,i,s):n.prototype[i]=t.prototype[i]})})}var re=me(z,"",-1,-1,-1,-1,-1,-1);Object.freeze(re);var G=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:pt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ce=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),w;(function(n){n[n.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",n[n.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",n[n.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",n[n.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",n[n.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",n[n.LEFT_RECURSION=5]="LEFT_RECURSION",n[n.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",n[n.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",n[n.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",n[n.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",n[n.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",n[n.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",n[n.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",n[n.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(w||(w={}));function Hi(n=void 0){return function(){return n}}var Le=class n{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.	\nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let t=this.className;this.TRACE_INIT("toFastProps",()=>{Fe(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{let o=this[i].originalGrammarAction,a;this.TRACE_INIT(`${i} Rule`,()=>{a=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=a})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=Ar({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(r.length===0&&this.skipValidations===!1){let i=Rr({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Y,grammarName:t}),s=dr({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(i,s)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=Cn(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!n.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw e=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
 ${e.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let r=this;if(r.initErrorHandler(t),r.initLexerAdapter(),r.initLooksAhead(t),r.initRecognizerEngine(e,t),r.initRecoverable(t),r.initTreeBuilder(t),r.initGastRecorder(t),r.initPerformanceTracer(t),Object.hasOwn(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
	Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
	See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
	For further details.`);this.skipValidations=Object.hasOwn(t,"skipValidations")?t.skipValidations:G.skipValidations}};Le.DEFER_DEFINITION_ERRORS_HANDLING=!1;wr(Le,[Ot,Nt,Ct,Lt,vt,yt,Pt,Mt,Ft]);var Rn=class extends Le{constructor(e,t=G){let r=Object.assign({},t);r.outputCst=!0,super(e,r)}},In=class extends Le{constructor(e,t=G){let r=Object.assign({},t);r.outputCst=!1,super(e,r)}};function Fr(n){let e=new On;return Object.values(n).map(r=>e.visitRule(r))}var On=class extends D{visitRule(e){let t=this.visitEach(e.definition),r=Object.groupBy(t,s=>s.propertyName),i=Object.entries(r).map(([s,o])=>{let a=!o.some(l=>!l.canBeNull),c=o[0].type;return o.length>1&&(c=o.map(l=>l.type)),{name:s,type:c,optional:a}});return{name:e.name,properties:i}}visitAlternative(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitOption(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitRepetition(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitRepetitionMandatory(e){return this.visitEach(e.definition)}visitRepetitionMandatoryWithSeparator(e){return this.visitEach(e.definition).concat({propertyName:e.separator.name,canBeNull:!0,type:Ut(e.separator)})}visitRepetitionWithSeparator(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0}).concat({propertyName:e.separator.name,canBeNull:!0,type:Ut(e.separator)})}visitAlternation(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitTerminal(e){return[{propertyName:e.label||e.terminalType.name,canBeNull:!1,type:Ut(e)}]}visitNonTerminal(e){return[{propertyName:e.label||e.nonTerminalName,canBeNull:!1,type:Ut(e)}]}visitEachAndOverrideWith(e,t){return this.visitEach(e).map(r=>Object.assign(Object.assign({},r),t))}visitEach(e){return e.flatMap(t=>this.visit(t))}};function Ut(n){return n instanceof N?{kind:"rule",name:n.referencedRule.name}:{kind:"token"}}function Dr(n,e){let t=[];return t=t.concat('import type { CstNode, ICstVisitor, IToken } from "chevrotain";'),t=t.concat(n.flatMap(r=>Xi(r))),e.includeVisitorInterface&&(t=t.concat(Qi(e.visitorInterfaceName,n))),t.join(`

`)+`
`}function Xi(n){let e=zi(n),t=Yi(n);return[e,t]}function zi(n){let e=Gr(n.name),t=Sn(n.name);return`export interface ${e} extends CstNode {
  name: "${n.name}";
  children: ${t};
}`}function Yi(n){return`export type ${Sn(n.name)} = {
  ${n.properties.map(t=>qi(t)).join(`
  `)}
};`}function qi(n){let e=Ji(n.type);return`${n.name}${n.optional?"?":""}: ${e}[];`}function Qi(n,e){return`export interface ${n}<IN, OUT> extends ICstVisitor<IN, OUT> {
  ${e.map(t=>Zi(t)).join(`
  `)}
}`}function Zi(n){let e=Sn(n.name);return`${n.name}(children: ${e}, param?: IN): OUT;`}function Ji(n){return Array.isArray(n)?"("+[...new Set(n.map(r=>Ur(r)))].join(" | ")+")":Ur(n)}function Ur(n){return n.kind==="token"?"IToken":Gr(n.name)}function Gr(n){return n.charAt(0).toUpperCase()+n.slice(1)+"CstNode"}function Sn(n){return n.charAt(0).toUpperCase()+n.slice(1)+"CstChildren"}var es={includeVisitorInterface:!0,visitorInterfaceName:"ICstNodeVisitor"};function ts(n,e){let t=Object.assign(Object.assign({},es),e),r=Fr(n);return Dr(r,t)}function ns(n,{resourceBase:e=`https://unpkg.com/chevrotain@${et}/diagrams/`,css:t=`https://unpkg.com/chevrotain@${et}/diagrams/diagrams.css`}={}){let r=`
<!-- This is a generated file -->
<!DOCTYPE html>
<meta charset="utf-8">
<style>
  body {
    background-color: hsl(30, 20%, 95%)
  }
</style>

`,i=`
<link rel='stylesheet' href='${t}'>
`,s=`
<script src='${e}vendor/railroad-diagrams.js'><\/script>
<script src='${e}src/diagrams_builder.js'><\/script>
<script src='${e}src/diagrams_behavior.js'><\/script>
<script src='${e}src/main.js'><\/script>
`,o=`
<div id="diagrams" align="center"></div>    
`,a=`
<script>
    window.serializedGrammar = ${JSON.stringify(n,null,"  ")};
<\/script>
`;return r+i+s+o+a+`
<script>
    var diagramsDiv = document.getElementById("diagrams");
    main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
<\/script>
`}function hc(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
	 It performs no action other than printing this message.
	 Please avoid using it as it will be completely removed in the future`)}var jr=class{constructor(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.	
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}};export{y as Alternation,x as Alternative,Rn as CstParser,Hi as EMPTY_ALT,z as EOF,qe as EarlyExitException,In as EmbeddedActionsParser,D as GAstVisitor,Qe as LLkLookaheadStrategy,F as Lexer,k as LexerDefinitionErrorType,Ee as MismatchedTokenException,ze as NoViableAltException,N as NonTerminal,Ye as NotAllInputParsedException,_ as Option,jr as Parser,w as ParserDefinitionErrorType,S as Repetition,P as RepetitionMandatory,M as RepetitionMandatoryWithSeparator,L as RepetitionWithSeparator,B as Rule,I as Terminal,et as VERSION,hc as clearCache,ns as createSyntaxDiagramsCode,ft as createToken,me as createTokenInstance,Jt as defaultLexerErrorProvider,pt as defaultParserErrorProvider,ts as generateCstDts,Li as getLookaheadPaths,oe as isRecognitionException,tt as serializeGrammar,Ae as serializeProduction,pe as tokenLabel,tn as tokenMatcher,xi as tokenName};
//# sourceMappingURL=chevrotain.min.mjs.map