mirror of
https://github.com/pdemian/human2regex.git
synced 2025-05-16 04:20:35 -07:00
7 lines
157 KiB
JavaScript
7 lines
157 KiB
JavaScript
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";function r(t){return t&&0===t.length}function i(t){return null==t?[]:Object.keys(t)}function o(t){for(var e=[],n=Object.keys(t),r=0;r<n.length;r++)e.push(t[n[r]]);return e}function a(t,e){for(var n=[],r=i(t),o=0;o<r.length;o++){var a=r[o];n.push(e.call(null,t[a],a))}return n}function s(t,e){for(var n=[],r=0;r<t.length;r++)n.push(e.call(null,t[r],r));return n}function c(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];Array.isArray(r)?e=e.concat(c(r)):e.push(r)}return e}function u(t){return r(t)?void 0:t[0]}function l(t){var e=t&&t.length;return e?t[e-1]:void 0}function h(t,e){if(Array.isArray(t))for(var n=0;n<t.length;n++)e.call(null,t[n],n);else{if(!x(t))throw Error("non exhaustive match");var r=i(t);for(n=0;n<r.length;n++){var o=r[n],a=t[o];e.call(null,a,o)}}}function p(t){return"string"==typeof t}function f(t){return void 0===t}function d(t){return t instanceof Function}function m(t,e){return void 0===e&&(e=1),t.slice(e,t.length)}function O(t,e){return void 0===e&&(e=1),t.slice(0,t.length-e)}function v(t,e){var n=[];if(Array.isArray(t))for(var r=0;r<t.length;r++){var i=t[r];e.call(null,i)&&n.push(i)}return n}function T(t,e){return v(t,(function(t){return!e(t)}))}function E(t,e){for(var n=Object.keys(t),r={},i=0;i<n.length;i++){var o=n[i],a=t[o];e(a)&&(r[o]=a)}return r}function y(t,e){return!!x(t)&&t.hasOwnProperty(e)}function g(t,e){return void 0!==N(t,(function(t){return t===e}))}function S(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e}function b(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function N(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(e.call(null,r))return r}}function A(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r];e.call(null,i)&&n.push(i)}return n}function I(t,e,n){for(var r=Array.isArray(t),a=r?t:o(t),s=r?[]:i(t),c=n,u=0;u<a.length;u++)c=e.call(null,c,a[u],r?u:s[u]);return c}function R(t){return T(t,(function(t){return null==t}))}function k(t,e){void 0===e&&(e=function(t){return t});var n=[];return I(t,(function(t,r){var i=e(r);return g(n,i)?t:(n.push(i),t.concat(r))}),[])}function L(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=[null],i=r.concat(e);return Function.bind.apply(t,i)}function C(t){return Array.isArray(t)}function _(t){return t instanceof RegExp}function x(t){return t instanceof Object}function M(t,e){for(var n=0;n<t.length;n++)if(!e(t[n],n))return!1;return!0}function P(t,e){return T(t,(function(t){return g(e,t)}))}function j(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}function w(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}function U(t,e){var n=S(t);return n.sort((function(t,n){return e(t)-e(n)})),n}function F(t,e){if(t.length!==e.length)throw Error("can't zipObject with different number of keys and values!");for(var n={},r=0;r<t.length;r++)n[t[r]]=e[r];return n}function D(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++)for(var o=e[r],a=i(o),s=0;s<a.length;s++){var c=a[s];t[c]=o[c]}return t}function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++)for(var o=e[r],a=i(o),s=0;s<a.length;s++){var c=a[s];y(t,c)||(t[c]=o[c])}return t}function G(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return B.apply(null,[{}].concat(t))}function W(t,e){var n={};return h(t,(function(t){var r=e(t),i=n[r];i?i.push(t):n[r]=[t]})),n}function K(t,e){for(var n=b(t),r=i(e),o=0;o<r.length;o++){var a=r[o],s=e[a];n[a]=s}return n}function V(){}function H(t){return t}function z(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];e.push(void 0!==r?r:void 0)}return e}function Y(t){console&&console.error&&console.error("Error: "+t)}function X(t){console&&console.warn&&console.warn("Warning: "+t)}function $(){return"function"==typeof Map}function q(t,e){e.forEach((function(e){var n=e.prototype;Object.getOwnPropertyNames(n).forEach((function(r){if("constructor"!==r){var i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(t.prototype,r,i):t.prototype[r]=e.prototype[r]}}))}))}function J(t){function e(){}e.prototype=t;var n=new e;function r(){return typeof n.bar}return r(),r(),t}function Q(t){return t[t.length-1]}function Z(t){var e=(new Date).getTime(),n=t();return{time:(new Date).getTime()-e,value:n}}n.d(e,"A",(function(){return r})),n.d(e,"G",(function(){return i})),n.d(e,"U",(function(){return o})),n.d(e,"J",(function(){return a})),n.d(e,"I",(function(){return s})),n.d(e,"t",(function(){return c})),n.d(e,"s",(function(){return u})),n.d(e,"H",(function(){return l})),n.d(e,"u",(function(){return h})),n.d(e,"E",(function(){return p})),n.d(e,"F",(function(){return f})),n.d(e,"B",(function(){return d})),n.d(e,"m",(function(){return m})),n.d(e,"n",(function(){return O})),n.d(e,"p",(function(){return v})),n.d(e,"P",(function(){return T})),n.d(e,"N",(function(){return E})),n.d(e,"w",(function(){return y})),n.d(e,"j",(function(){return g})),n.d(e,"g",(function(){return S})),n.d(e,"h",(function(){return b})),n.d(e,"q",(function(){return N})),n.d(e,"r",(function(){return A})),n.d(e,"O",(function(){return I})),n.d(e,"i",(function(){return R})),n.d(e,"T",(function(){return k})),n.d(e,"y",(function(){return C})),n.d(e,"D",(function(){return _})),n.d(e,"C",(function(){return x})),n.d(e,"o",(function(){return M})),n.d(e,"l",(function(){return P})),n.d(e,"Q",(function(){return j})),n.d(e,"x",(function(){return w})),n.d(e,"f",(function(){return D})),n.d(e,"k",(function(){return G})),n.d(e,"v",(function(){return W})),n.d(e,"K",(function(){return K})),n.d(e,"b",(function(){return V})),n.d(e,"a",(function(){return H})),n.d(e,"L",(function(){return z})),n.d(e,"c",(function(){return Y})),n.d(e,"d",(function(){return X})),n.d(e,"z",(function(){return $})),n.d(e,"e",(function(){return q})),n.d(e,"S",(function(){return J})),n.d(e,"M",(function(){return Q})),n.d(e,"R",(function(){return Z}))},function(t,e,n){var r,i,o;"undefined"!=typeof self&&self,i=[],void 0===(o="function"==typeof(r=function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx},t.prototype.pattern=function(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");var e=this.disjunction();this.consumeChar("/");for(var n={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":s(n,"global");break;case"i":s(n,"ignoreCase");break;case"m":s(n,"multiLine");break;case"u":s(n,"unicode");break;case"y":s(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:e,loc:this.loc(0)}},t.prototype.disjunction=function(){var t=[],e=this.idx;for(t.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(e)}},t.prototype.alternative=function(){for(var t=[],e=this.idx;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(e)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":var e;switch(this.consumeChar("?"),this.popChar()){case"=":e="Lookahead";break;case"!":e="NegativeLookahead"}c(e);var n=this.disjunction();return this.consumeChar(")"),{type:e,value:n,loc:this.loc(t)}}!function(){throw Error("Internal Error - Should never get here!")}()},t.prototype.quantifier=function(t){var e,n=this.idx;switch(this.popChar()){case"*":e={atLeast:0,atMost:1/0};break;case"+":e={atLeast:1,atMost:1/0};break;case"?":e={atLeast:0,atMost:1};break;case"{":var r=this.integerIncludingZero();switch(this.popChar()){case"}":e={atLeast:r,atMost:r};break;case",":e=this.isDigit()?{atLeast:r,atMost:this.integerIncludingZero()}:{atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===t&&void 0===e)return;c(e)}if(!0!==t||void 0!==e)return c(e),"?"===this.peekChar(0)?(this.consumeChar("?"),e.greedy=!1):e.greedy=!0,e.type="Quantifier",e.loc=this.loc(n),e},t.prototype.atom=function(){var t,e=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group()}return void 0===t&&this.isPatternCharacter()&&(t=this.patternCharacter()),c(t),t.loc=this.loc(e),this.isQuantifier()&&(t.quantifier=this.quantifier()),t},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o("\n"),o("\r"),o("\u2028"),o("\u2029")]}},t.prototype.atomEscape=function(){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()}},t.prototype.decimalEscapeAtom=function(){return{type:"GroupBackReference",value:this.positiveInteger()}},t.prototype.characterClassEscape=function(){var t,e=!1;switch(this.popChar()){case"d":t=u;break;case"D":t=u,e=!0;break;case"s":t=h;break;case"S":t=h,e=!0;break;case"w":t=l;break;case"W":t=l,e=!0}return c(t),{type:"Set",value:t,complement:e}},t.prototype.controlEscapeAtom=function(){var t;switch(this.popChar()){case"f":t=o("\f");break;case"n":t=o("\n");break;case"r":t=o("\r");break;case"t":t=o("\t");break;case"v":t=o("\v")}return c(t),{type:"Character",value:t}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var t=this.popChar();if(!1===/[a-zA-Z]/.test(t))throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){return{type:"Character",value:o(this.popChar())}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:o(this.popChar())}}},t.prototype.characterClass=function(){var t=[],e=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),e=!0);this.isClassAtom();){var n=this.classAtom();if("Character"===n.type&&this.isRangeDash()){this.consumeChar("-");var r=this.classAtom();if("Character"===r.type){if(r.value<n.value)throw Error("Range out of order in character class");t.push({from:n.value,to:r.value})}else a(n.value,t),t.push(o("-")),a(r.value,t)}else a(n.value,t)}return this.consumeChar("]"),{type:"Set",complement:e,value:t}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},t.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:o("\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()}},t.prototype.group=function(){var t=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),t=!1;break;default:this.groupIdx++}var e=this.disjunction();this.consumeChar(")");var n={type:"Group",capturing:t,value:e};return t&&(n.idx=this.groupIdx),n},t.prototype.positiveInteger=function(){var t=this.popChar();if(!1===i.test(t))throw Error("Expecting a positive integer");for(;r.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)},t.prototype.integerIncludingZero=function(){var t=this.popChar();if(!1===r.test(t))throw Error("Expecting an integer");for(;r.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)},t.prototype.patternCharacter=function(){var t=this.popChar();switch(t){case"\n":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:o(t)}}},t.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},t.prototype.isRangeDash=function(){return"-"===this.peekChar()&&this.isClassAtom(1)},t.prototype.isDigit=function(){return r.test(this.peekChar(0))},t.prototype.isClassAtom=function(t){switch(void 0===t&&(t=0),this.peekChar(t)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},t.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},t.prototype.isAssertion=function(){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));default:return!1}},t.prototype.isQuantifier=function(){var t=this.saveState();try{return void 0!==this.quantifier(!0)}catch(t){return!1}finally{this.restoreState(t)}},t.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(t){for(var e="",r=0;r<t;r++){var i=this.popChar();if(!1===n.test(i))throw Error("Expecting a HexDecimal digits");e+=i}return{type:"Character",value:parseInt(e,16)}},t.prototype.peekChar=function(t){return void 0===t&&(t=0),this.input[this.idx+t]},t.prototype.popChar=function(){var t=this.peekChar(0);return this.consumeChar(),t},t.prototype.consumeChar=function(t){if(void 0!==t&&this.input[this.idx]!==t)throw Error("Expected: '"+t+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},t.prototype.loc=function(t){return{begin:t,end:this.idx}};var e,n=/[0-9a-fA-F]/,r=/[0-9]/,i=/[1-9]/;function o(t){return t.charCodeAt(0)}function a(t,e){void 0!==t.length?t.forEach((function(t){e.push(t)})):e.push(t)}function s(t,e){if(!0===t[e])throw"duplicate flag "+e;t[e]=!0}function c(t){if(void 0===t)throw Error("Internal Error - Should never get here!")}var u=[];for(e=o("0");e<=o("9");e++)u.push(e);var l=[o("_")].concat(u);for(e=o("a");e<=o("z");e++)l.push(e);for(e=o("A");e<=o("Z");e++)l.push(e);var h=[o(" "),o("\f"),o("\n"),o("\r"),o("\t"),o("\v"),o("\t"),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o("\u2028"),o("\u2029"),o(" "),o(" "),o(" "),o("\ufeff")];function p(){}return p.prototype.visitChildren=function(t){for(var e in t){var n=t[e];t.hasOwnProperty(e)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((function(t){this.visit(t)}),this))}},p.prototype.visit=function(t){switch(t.type){case"Pattern":this.visitPattern(t);break;case"Flags":this.visitFlags(t);break;case"Disjunction":this.visitDisjunction(t);break;case"Alternative":this.visitAlternative(t);break;case"StartAnchor":this.visitStartAnchor(t);break;case"EndAnchor":this.visitEndAnchor(t);break;case"WordBoundary":this.visitWordBoundary(t);break;case"NonWordBoundary":this.visitNonWordBoundary(t);break;case"Lookahead":this.visitLookahead(t);break;case"NegativeLookahead":this.visitNegativeLookahead(t);break;case"Character":this.visitCharacter(t);break;case"Set":this.visitSet(t);break;case"Group":this.visitGroup(t);break;case"GroupBackReference":this.visitGroupBackReference(t);break;case"Quantifier":this.visitQuantifier(t)}this.visitChildren(t)},p.prototype.visitPattern=function(t){},p.prototype.visitFlags=function(t){},p.prototype.visitDisjunction=function(t){},p.prototype.visitAlternative=function(t){},p.prototype.visitStartAnchor=function(t){},p.prototype.visitEndAnchor=function(t){},p.prototype.visitWordBoundary=function(t){},p.prototype.visitNonWordBoundary=function(t){},p.prototype.visitLookahead=function(t){},p.prototype.visitNegativeLookahead=function(t){},p.prototype.visitCharacter=function(t){},p.prototype.visitSet=function(t){},p.prototype.visitGroup=function(t){},p.prototype.visitGroupBackReference=function(t){},p.prototype.visitQuantifier=function(t){},{RegExpParser:t,BaseRegExpVisitor:p,VERSION:"0.5.0"}})?r.apply(e,i):r)||(t.exports=o)},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(e,"__esModule",{value:!0}),e.semanticErrorToCommonError=e.parseErrorToCommonError=e.lexErrorToCommonError=e.regexEscape=e.removeQuotes=e.findLastIndexPredicate=e.findLastIndex=e.last=e.first=e.isSingleRegexCharacter=e.combineFlags=e.hasFlag=void 0,e.hasFlag=function(t,e){return 0!=(t&e)},e.combineFlags=function(t,e){return t|e},e.isSingleRegexCharacter=function(t){return t.startsWith("\\u")&&6===t.length||t.startsWith("\\U")&&8===t.length||t.startsWith("\\")&&2===t.length||1===t.length},e.first=function(t){return t[0]},e.last=function(t){return t[t.length-1]},e.findLastIndex=function(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]===e)return n;return-1},e.findLastIndexPredicate=function(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1},e.removeQuotes=function(t){return t.substring(1,t.length-1)},e.regexEscape=function(t){return t.replace("\\","\\\\").replace(/([=:\-\.\[\]\^\|\(\)\*\+\?\{\}\$\/])/g,"\\$1")},e.lexErrorToCommonError=function(t){return{type:"Lexer Error",startLine:t.line,startColumn:t.column,length:t.length,message:t.message}},e.parseErrorToCommonError=function(t){var e,n,r;return{type:"Parser Error",startLine:null!==(e=t.token.startLine)&&void 0!==e?e:NaN,startColumn:null!==(n=t.token.startColumn)&&void 0!==n?n:NaN,length:null!==(r=t.token.endOffset)&&void 0!==r?r:NaN-t.token.startOffset,message:t.name+": "+t.message}},e.semanticErrorToCommonError=function(t){return t.type="Semantic Error",t}},function(t,e,n){"use strict";n.r(e),n.d(e,"VERSION",(function(){return r})),n.d(e,"CstParser",(function(){return rn})),n.d(e,"EmbeddedActionsParser",(function(){return on})),n.d(e,"ParserDefinitionErrorType",(function(){return Qe})),n.d(e,"EMPTY_ALT",(function(){return en})),n.d(e,"Lexer",(function(){return X})),n.d(e,"LexerDefinitionErrorType",(function(){return H})),n.d(e,"createToken",(function(){return Q})),n.d(e,"createTokenInstance",(function(){return tt})),n.d(e,"EOF",(function(){return Z})),n.d(e,"tokenLabel",(function(){return $})),n.d(e,"tokenMatcher",(function(){return et})),n.d(e,"tokenName",(function(){return q})),n.d(e,"defaultGrammarResolverErrorProvider",(function(){return Lt})),n.d(e,"defaultGrammarValidatorErrorProvider",(function(){return Ct})),n.d(e,"defaultParserErrorProvider",(function(){return kt})),n.d(e,"EarlyExitException",(function(){return ve})),n.d(e,"isRecognitionException",(function(){return fe})),n.d(e,"MismatchedTokenException",(function(){return de})),n.d(e,"NotAllInputParsedException",(function(){return Oe})),n.d(e,"NoViableAltException",(function(){return me})),n.d(e,"defaultLexerErrorProvider",(function(){return z})),n.d(e,"Alternation",(function(){return pt})),n.d(e,"Alternative",(function(){return at})),n.d(e,"NonTerminal",(function(){return it})),n.d(e,"Option",(function(){return st})),n.d(e,"Repetition",(function(){return lt})),n.d(e,"RepetitionMandatory",(function(){return ct})),n.d(e,"RepetitionMandatoryWithSeparator",(function(){return ut})),n.d(e,"RepetitionWithSeparator",(function(){return ht})),n.d(e,"Rule",(function(){return ot})),n.d(e,"Terminal",(function(){return ft})),n.d(e,"serializeGrammar",(function(){return dt})),n.d(e,"serializeProduction",(function(){return mt})),n.d(e,"GAstVisitor",(function(){return Tt})),n.d(e,"assignOccurrenceIndices",(function(){return he})),n.d(e,"resolveGrammar",(function(){return ue})),n.d(e,"validateGrammar",(function(){return le})),n.d(e,"clearCache",(function(){return vn})),n.d(e,"createSyntaxDiagramsCode",(function(){return an})),n.d(e,"generateParserFactory",(function(){return mn})),n.d(e,"generateParserModule",(function(){return On})),n.d(e,"Parser",(function(){return Tn}));var r="7.0.2",i=n(0),o=n(1),a={},s=new o.RegExpParser;function c(t){var e=t.toString();if(a.hasOwnProperty(e))return a[e];var n=s.pattern(e);return a[e]=n,n}var u,l=(u=function(t,e){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),h='Unable to use "first char" lexer optimizations:\n';function p(t,e){void 0===e&&(e=!1);try{var n=c(t);return function t(e,n,r){switch(e.type){case"Disjunction":for(var o=0;o<e.value.length;o++)t(e.value[o],n,r);break;case"Alternative":var a=e.value;for(o=0;o<a.length;o++){var s=a[o];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var c=s;switch(c.type){case"Character":f(c.value,n,r);break;case"Set":if(!0===c.complement)throw Error("Complement Sets are not supported for first char optimization");Object(i.u)(c.value,(function(t){if("number"==typeof t)f(t,n,r);else{var e=t;if(!0===r)for(var i=e.from;i<=e.to;i++)f(i,n,r);else{for(i=e.from;i<=e.to&&i<P;i++)f(i,n,r);if(e.to>=P)for(var o=e.from>=P?e.from:P,a=e.to,s=j(o),c=j(a),u=s;u<=c;u++)n[u]=u}}}));break;case"Group":t(c.value,n,r);break;default:throw Error("Non Exhaustive Match")}var u=void 0!==c.quantifier&&0===c.quantifier.atLeast;if("Group"===c.type&&!1===m(c)||"Group"!==c.type&&!1===u)break}break;default:throw Error("non exhaustive match!")}return Object(i.U)(n)}(n.value,{},n.flags.ignoreCase)}catch(n){if("Complement Sets are not supported for first char optimization"===n.message)e&&Object(i.d)(h+"\tUnable to optimize: < "+t.toString()+" >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var r="";e&&(r="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),Object(i.c)(h+"\n\tFailed parsing: < "+t.toString()+" >\n\tUsing the regexp-to-ast library version: "+o.VERSION+"\n\tPlease open an issue at: https://github.com/bd82/regexp-to-ast/issues"+r)}}return[]}function f(t,e,n){var r=j(t);e[r]=r,!0===n&&function(t,e){var n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){var i=j(r.charCodeAt(0));e[i]=i}else{var o=n.toLowerCase();if(o!==n){i=j(o.charCodeAt(0));e[i]=i}}}(t,e)}function d(t,e){return Object(i.q)(t.value,(function(t){if("number"==typeof t)return Object(i.j)(e,t);var n=t;return void 0!==Object(i.q)(e,(function(t){return n.from<=t&&t<=n.to}))}))}function m(t){return!(!t.quantifier||0!==t.quantifier.atLeast)||!!t.value&&(Object(i.y)(t.value)?Object(i.o)(t.value,m):m(t.value))}var O=function(t){function e(e){var n=t.call(this)||this;return n.targetCharCodes=e,n.found=!1,n}return l(e,t),e.prototype.visitChildren=function(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}t.prototype.visitChildren.call(this,e)}},e.prototype.visitCharacter=function(t){Object(i.j)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?void 0===d(t,this.targetCharCodes)&&(this.found=!0):void 0!==d(t,this.targetCharCodes)&&(this.found=!0)},e}(o.BaseRegExpVisitor);function v(t,e){if(e instanceof RegExp){var n=c(e),r=new O(t);return r.visit(n),r.found}return void 0!==Object(i.q)(e,(function(e){return Object(i.j)(t,e.charCodeAt(0))}))}var T=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),E="PATTERN",y="boolean"==typeof new RegExp("(?:)").sticky;function g(t,e){var n,r=(e=Object(i.k)(e,{useSticky:y,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(t,e){return e()}})).tracer;r("initCharCodeToOptimizedIndexMap",(function(){!function(){if(Object(i.A)(w)){w=new Array(65536);for(var t=0;t<65536;t++)w[t]=t>255?255+~~(t/255):t}}()})),r("Reject Lexer.NA",(function(){n=Object(i.P)(t,(function(t){return t[E]===X.NA}))}));var o,a,s,c,u,l,f,d,m,O,T,g=!1;r("Transform Patterns",(function(){g=!1,o=Object(i.I)(n,(function(t){var n=t[E];if(Object(i.D)(n)){var r=n.source;return 1!==r.length||"^"===r||"$"===r||"."===r||n.ignoreCase?2!==r.length||"\\"!==r[0]||Object(i.j)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],r[1])?e.useSticky?I(n):A(n):r[1]:r}if(Object(i.B)(n))return g=!0,{exec:n};if(Object(i.w)(n,"exec"))return g=!0,n;if("string"==typeof n){if(1===n.length)return n;var o=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),a=new RegExp(o);return e.useSticky?I(a):A(a)}throw Error("non exhaustive match")}))})),r("misc mapping",(function(){a=Object(i.I)(n,(function(t){return t.tokenTypeIdx})),s=Object(i.I)(n,(function(t){var e=t.GROUP;if(e!==X.SKIPPED){if(Object(i.E)(e))return e;if(Object(i.F)(e))return!1;throw Error("non exhaustive match")}})),c=Object(i.I)(n,(function(t){var e=t.LONGER_ALT;if(e)return Object(i.x)(n,e)})),u=Object(i.I)(n,(function(t){return t.PUSH_MODE})),l=Object(i.I)(n,(function(t){return Object(i.w)(t,"POP_MODE")}))})),r("Line Terminator Handling",(function(){var t=x(e.lineTerminatorCharacters);f=Object(i.I)(n,(function(t){return!1})),"onlyOffset"!==e.positionTracking&&(f=Object(i.I)(n,(function(e){return Object(i.w)(e,"LINE_BREAKS")?e.LINE_BREAKS:!1===_(e,t)?v(t,e.PATTERN):void 0})))})),r("Misc Mapping #2",(function(){d=Object(i.I)(n,k),m=Object(i.I)(o,L),O=Object(i.O)(n,(function(t,e){var n=e.GROUP;return Object(i.E)(n)&&n!==X.SKIPPED&&(t[n]=[]),t}),{}),T=Object(i.I)(o,(function(t,e){return{pattern:o[e],longerAlt:c[e],canLineTerminator:f[e],isCustom:d[e],short:m[e],group:s[e],push:u[e],pop:l[e],tokenTypeIdx:a[e],tokenType:n[e]}}))}));var S=!0,b=[];return e.safeMode||r("First Char Optimization",(function(){b=Object(i.O)(n,(function(t,n,r){if("string"==typeof n.PATTERN){var o=j(n.PATTERN.charCodeAt(0));M(t,o,T[r])}else if(Object(i.y)(n.START_CHARS_HINT)){var a;Object(i.u)(n.START_CHARS_HINT,(function(e){var n=j("string"==typeof e?e.charCodeAt(0):e);a!==n&&(a=n,M(t,n,T[r]))}))}else if(Object(i.D)(n.PATTERN))if(n.PATTERN.unicode)S=!1,e.ensureOptimizations&&Object(i.c)(h+"\tUnable to analyze < "+n.PATTERN.toString()+" > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var s=p(n.PATTERN,e.ensureOptimizations);Object(i.A)(s)&&(S=!1),Object(i.u)(s,(function(e){M(t,e,T[r])}))}else e.ensureOptimizations&&Object(i.c)(h+"\tTokenType: <"+n.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),S=!1;return t}),[])})),r("ArrayPacking",(function(){b=Object(i.L)(b)})),{emptyGroups:O,patternIdxToConfig:T,charCodeToPatternIdxToConfig:b,hasCustom:g,canBeOptimized:S}}function S(t,e){var n=[],r=function(t){var e=Object(i.p)(t,(function(t){return!Object(i.w)(t,E)})),n=Object(i.I)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- missing static 'PATTERN' property",type:H.MISSING_PATTERN,tokenTypes:[t]}})),r=Object(i.l)(t,e);return{errors:n,valid:r}}(t);n=n.concat(r.errors);var a=function(t){var e=Object(i.p)(t,(function(t){var e=t[E];return!(Object(i.D)(e)||Object(i.B)(e)||Object(i.w)(e,"exec")||Object(i.E)(e))})),n=Object(i.I)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:H.INVALID_PATTERN,tokenTypes:[t]}})),r=Object(i.l)(t,e);return{errors:n,valid:r}}(r.valid),s=a.valid;return n=(n=(n=(n=(n=n.concat(a.errors)).concat(function(t){var e=[],n=Object(i.p)(t,(function(t){return Object(i.D)(t[E])}));return e=(e=(e=(e=(e=e.concat(function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.found=!1,e}return T(e,t),e.prototype.visitEndAnchor=function(t){this.found=!0},e}(o.BaseRegExpVisitor),n=Object(i.p)(t,(function(t){var n=t[E];try{var r=c(n),i=new e;return i.visit(r),i.found}catch(t){return b.test(n.source)}}));return Object(i.I)(n,(function(t){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+t.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:H.EOI_ANCHOR_FOUND,tokenTypes:[t]}}))}(n))).concat(function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.found=!1,e}return T(e,t),e.prototype.visitStartAnchor=function(t){this.found=!0},e}(o.BaseRegExpVisitor),n=Object(i.p)(t,(function(t){var n=t[E];try{var r=c(n),i=new e;return i.visit(r),i.found}catch(t){return N.test(n.source)}}));return Object(i.I)(n,(function(t){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+t.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:H.SOI_ANCHOR_FOUND,tokenTypes:[t]}}))}(n))).concat(function(t){var e=Object(i.p)(t,(function(t){var e=t[E];return e instanceof RegExp&&(e.multiline||e.global)}));return Object(i.I)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:H.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[t]}}))}(n))).concat(function(t){var e=[],n=Object(i.I)(t,(function(n){return Object(i.O)(t,(function(t,r){return n.PATTERN.source!==r.PATTERN.source||Object(i.j)(e,r)||r.PATTERN===X.NA||(e.push(r),t.push(r)),t}),[])}));n=Object(i.i)(n);var r=Object(i.p)(n,(function(t){return t.length>1}));return Object(i.I)(r,(function(t){var e=Object(i.I)(t,(function(t){return t.name}));return{message:"The same RegExp pattern ->"+Object(i.s)(t).PATTERN+"<-has been used in all of the following Token Types: "+e.join(", ")+" <-",type:H.DUPLICATE_PATTERNS_FOUND,tokenTypes:t}}))}(n))).concat(function(t){var e=Object(i.p)(t,(function(t){return t[E].test("")}));return Object(i.I)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' must not match an empty string",type:H.EMPTY_MATCH_PATTERN,tokenTypes:[t]}}))}(n))}(s))).concat(function(t){var e=Object(i.p)(t,(function(t){if(!Object(i.w)(t,"GROUP"))return!1;var e=t.GROUP;return e!==X.SKIPPED&&e!==X.NA&&!Object(i.E)(e)}));return Object(i.I)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:H.INVALID_GROUP_TYPE_FOUND,tokenTypes:[t]}}))}(s))).concat(function(t,e){var n=Object(i.p)(t,(function(t){return void 0!==t.PUSH_MODE&&!Object(i.j)(e,t.PUSH_MODE)}));return Object(i.I)(n,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+t.PUSH_MODE+"<-which does not exist",type:H.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[t]}}))}(s,e))).concat(function(t){var e=[],n=Object(i.O)(t,(function(t,e,n){var r,o=e.PATTERN;return o===X.NA||(Object(i.E)(o)?t.push({str:o,idx:n,tokenType:e}):Object(i.D)(o)&&(r=o,void 0===Object(i.q)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(function(t){return-1!==r.source.indexOf(t)})))&&t.push({str:o.source,idx:n,tokenType:e})),t}),[]);return Object(i.u)(t,(function(t,r){Object(i.u)(n,(function(n){var o=n.str,a=n.idx,s=n.tokenType;if(r<a&&function(t,e){if(Object(i.D)(e)){var n=e.exec(t);return null!==n&&0===n.index}if(Object(i.B)(e))return e(t,0,[],{});if(Object(i.w)(e,"exec"))return e.exec(t,0,[],{});if("string"==typeof e)return e===t;throw Error("non exhaustive match")}(o,t.PATTERN)){var c="Token: ->"+s.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+t.name+"<-in the lexer's definition.\nSee https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#UNREACHABLE";e.push({message:c,type:H.UNREACHABLE_PATTERN,tokenTypes:[t,s]})}}))})),e}(s))}var b=/[^\\][\$]/;var N=/[^\\[][\^]|^\^/;function A(t){var e=t.ignoreCase?"i":"";return new RegExp("^(?:"+t.source+")",e)}function I(t){var e=t.ignoreCase?"iy":"y";return new RegExp(""+t.source,e)}function R(t,e,n){var r=[],o=!1,a=Object(i.i)(Object(i.t)(Object(i.J)(t.modes,(function(t){return t})))),s=Object(i.P)(a,(function(t){return t[E]===X.NA})),c=x(n);return e&&Object(i.u)(s,(function(t){var e=_(t,c);if(!1!==e){var n={message:function(t,e){if(e.issue===H.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <"+t.name+"> Token Type\n\t Root cause: "+e.errMsg+".\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===H.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <"+t.name+"> Token Type\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}(t,e),type:e.issue,tokenType:t};r.push(n)}else Object(i.w)(t,"LINE_BREAKS")?!0===t.LINE_BREAKS&&(o=!0):v(c,t.PATTERN)&&(o=!0)})),e&&!o&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:H.NO_LINE_BREAKS_FLAGS}),r}function k(t){var e=t.PATTERN;if(Object(i.D)(e))return!1;if(Object(i.B)(e))return!0;if(Object(i.w)(e,"exec"))return!0;if(Object(i.E)(e))return!1;throw Error("non exhaustive match")}function L(t){return!(!Object(i.E)(t)||1!==t.length)&&t.charCodeAt(0)}var C={test:function(t){for(var e=t.length,n=this.lastIndex;n<e;n++){var r=t.charCodeAt(n);if(10===r)return this.lastIndex=n+1,!0;if(13===r)return 10===t.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function _(t,e){if(Object(i.w)(t,"LINE_BREAKS"))return!1;if(Object(i.D)(t.PATTERN)){try{v(e,t.PATTERN)}catch(t){return{issue:H.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}if(Object(i.E)(t.PATTERN))return!1;if(k(t))return{issue:H.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function x(t){return Object(i.I)(t,(function(t){return Object(i.E)(t)&&t.length>0?t.charCodeAt(0):t}))}function M(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}var P=256;function j(t){return t<P?t:w[t]}var w=[];function U(t,e){var n=t.tokenTypeIdx;return n===e.tokenTypeIdx||!0===e.isParent&&!0===e.categoryMatchesMap[n]}function F(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var D=1,B={};function G(t){var e=function(t){var e=Object(i.g)(t),n=t,r=!0;for(;r;){n=Object(i.i)(Object(i.t)(Object(i.I)(n,(function(t){return t.CATEGORIES}))));var o=Object(i.l)(n,e);e=e.concat(o),Object(i.A)(o)?r=!1:n=o}return e}(t);!function(t){Object(i.u)(t,(function(t){var e;W(t)||(B[D]=t,t.tokenTypeIdx=D++),K(t)&&!Object(i.y)(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),K(t)||(t.CATEGORIES=[]),e=t,Object(i.w)(e,"categoryMatches")||(t.categoryMatches=[]),function(t){return Object(i.w)(t,"categoryMatchesMap")}(t)||(t.categoryMatchesMap={})}))}(e),function(t){Object(i.u)(t,(function(t){!function t(e,n){Object(i.u)(e,(function(t){n.categoryMatchesMap[t.tokenTypeIdx]=!0})),Object(i.u)(n.CATEGORIES,(function(r){var o=e.concat(n);Object(i.j)(o,r)||t(o,r)}))}([],t)}))}(e),function(t){Object(i.u)(t,(function(t){t.categoryMatches=[],Object(i.u)(t.categoryMatchesMap,(function(e,n){t.categoryMatches.push(B[n].tokenTypeIdx)}))}))}(e),Object(i.u)(e,(function(t){t.isParent=t.categoryMatches.length>0}))}function W(t){return Object(i.w)(t,"tokenTypeIdx")}function K(t){return Object(i.w)(t,"CATEGORIES")}function V(t){return Object(i.w)(t,"tokenTypeIdx")}var H,z={buildUnableToPopLexerModeMessage:function(t){return"Unable to pop Lexer Mode after encountering Token ->"+t.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(t,e,n,r,i){return"unexpected character: ->"+t.charAt(e)+"<- at offset: "+e+", skipped "+n+" characters."}};!function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"}(H||(H={}));var Y={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:z,traceInitPerf:!1,skipValidations:!1};Object.freeze(Y);var X=function(){function t(t,e){var n=this;if(void 0===e&&(e=Y),this.lexerDefinition=t,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof e)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Object(i.K)(Y,e);var r=this.config.traceInitPerf;!0===r?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof r&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(function(){var r,o=!0;n.TRACE_INIT("Lexer Config handling",(function(){if(n.config.lineTerminatorsPattern===Y.lineTerminatorsPattern)n.config.lineTerminatorsPattern=C;else if(n.config.lineTerminatorCharacters===Y.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(e.safeMode&&e.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');n.trackStartLines=/full|onlyStart/i.test(n.config.positionTracking),n.trackEndLines=/full/i.test(n.config.positionTracking),Object(i.y)(t)?((r={modes:{}}).modes.defaultMode=Object(i.g)(t),r.defaultMode="defaultMode"):(o=!1,r=Object(i.h)(t))})),!1===n.config.skipValidations&&(n.TRACE_INIT("performRuntimeChecks",(function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat(function(t,e,n){var r=[];return Object(i.w)(t,"defaultMode")||r.push({message:"A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition\n",type:H.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object(i.w)(t,"modes")||r.push({message:"A MultiMode Lexer cannot be initialized without a <modes> property in its definition\n",type:H.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object(i.w)(t,"modes")&&Object(i.w)(t,"defaultMode")&&!Object(i.w)(t.modes,t.defaultMode)&&r.push({message:"A MultiMode Lexer cannot be initialized with a defaultMode: <"+t.defaultMode+">which does not exist\n",type:H.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object(i.w)(t,"modes")&&Object(i.u)(t.modes,(function(t,e){Object(i.u)(t,(function(t,n){Object(i.F)(t)&&r.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:<"+e+"> at index: <"+n+">\n",type:H.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})}))})),r}(r,n.trackStartLines,n.config.lineTerminatorCharacters))})),n.TRACE_INIT("performWarningRuntimeChecks",(function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat(R(r,n.trackStartLines,n.config.lineTerminatorCharacters))}))),r.modes=r.modes?r.modes:{},Object(i.u)(r.modes,(function(t,e){r.modes[e]=Object(i.P)(t,(function(t){return Object(i.F)(t)}))}));var s=Object(i.G)(r.modes);if(Object(i.u)(r.modes,(function(t,r){n.TRACE_INIT("Mode: <"+r+"> processing",(function(){var o;(n.modes.push(r),!1===n.config.skipValidations&&n.TRACE_INIT("validatePatterns",(function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat(S(t,s))})),Object(i.A)(n.lexerDefinitionErrors))&&(G(t),n.TRACE_INIT("analyzeTokenTypes",(function(){o=g(t,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:e.positionTracking,ensureOptimizations:e.ensureOptimizations,safeMode:e.safeMode,tracer:n.TRACE_INIT.bind(n)})})),n.patternIdxToConfig[r]=o.patternIdxToConfig,n.charCodeToPatternIdxToConfig[r]=o.charCodeToPatternIdxToConfig,n.emptyGroups=Object(i.K)(n.emptyGroups,o.emptyGroups),n.hasCustom=o.hasCustom||n.hasCustom,n.canModeBeOptimized[r]=o.canBeOptimized)}))})),n.defaultMode=r.defaultMode,!Object(i.A)(n.lexerDefinitionErrors)&&!n.config.deferDefinitionErrorsHandling){var c=Object(i.I)(n.lexerDefinitionErrors,(function(t){return t.message})).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+c)}Object(i.u)(n.lexerDefinitionWarning,(function(t){Object(i.d)(t.message)})),n.TRACE_INIT("Choosing sub-methods implementations",(function(){if(y?(n.chopInput=i.a,n.match=n.matchWithTest):(n.updateLastIndex=i.b,n.match=n.matchWithExec),o&&(n.handleModes=i.b),!1===n.trackStartLines&&(n.computeNewColumn=i.a),!1===n.trackEndLines&&(n.updateTokenEndLineColumnLocation=i.b),/full/i.test(n.config.positionTracking))n.createTokenInstance=n.createFullToken;else if(/onlyStart/i.test(n.config.positionTracking))n.createTokenInstance=n.createStartOnlyToken;else{if(!/onlyOffset/i.test(n.config.positionTracking))throw Error('Invalid <positionTracking> config option: "'+n.config.positionTracking+'"');n.createTokenInstance=n.createOffsetOnlyToken}n.hasCustom?(n.addToken=n.addTokenUsingPush,n.handlePayload=n.handlePayloadWithCustom):(n.addToken=n.addTokenUsingMemberAccess,n.handlePayload=n.handlePayloadNoCustom)})),n.TRACE_INIT("Failed Optimization Warnings",(function(){var t=Object(i.O)(n.canModeBeOptimized,(function(t,e,n){return!1===e&&t.push(n),t}),[]);if(e.ensureOptimizations&&!Object(i.A)(t))throw Error("Lexer Modes: < "+t.join(", ")+' > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.')})),n.TRACE_INIT("clearRegExpParserCache",(function(){a={}})),n.TRACE_INIT("toFastProperties",(function(){Object(i.S)(n)}))}))}return t.prototype.tokenize=function(t,e){if(void 0===e&&(e=this.defaultMode),!Object(i.A)(this.lexerDefinitionErrors)){var n=Object(i.I)(this.lexerDefinitionErrors,(function(t){return t.message})).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+n)}return this.tokenizeInternal(t,e)},t.prototype.tokenizeInternal=function(t,e){var n,r,o,a,s,c,u,l,h,p,f,d,m,O,v,T,E,y=this,g=t,S=g.length,b=0,N=0,A=this.hasCustom?0:Math.floor(t.length/10),I=new Array(A),R=[],k=this.trackStartLines?1:void 0,L=this.trackStartLines?1:void 0,C=(v=this.emptyGroups,T={},E=Object(i.G)(v),Object(i.u)(E,(function(t){var e=v[t];if(!Object(i.y)(e))throw Error("non exhaustive match");T[t]=[]})),T),_=this.trackStartLines,x=this.config.lineTerminatorsPattern,M=0,P=[],w=[],U=[],F=[];Object.freeze(F);var D=void 0;function B(){return P}function G(t){var e=j(t),n=w[e];return void 0===n?F:n}var W,K=function(t){if(1===U.length&&void 0===t.tokenType.PUSH_MODE){var e=y.config.errorMessageProvider.buildUnableToPopLexerModeMessage(t);R.push({offset:t.startOffset,line:void 0!==t.startLine?t.startLine:void 0,column:void 0!==t.startColumn?t.startColumn:void 0,length:t.image.length,message:e})}else{U.pop();var n=Object(i.H)(U);P=y.patternIdxToConfig[n],w=y.charCodeToPatternIdxToConfig[n],M=P.length;var r=y.canModeBeOptimized[n]&&!1===y.config.safeMode;D=w&&r?G:B}};function V(t){U.push(t),w=this.charCodeToPatternIdxToConfig[t],P=this.patternIdxToConfig[t],M=P.length,M=P.length;var e=this.canModeBeOptimized[t]&&!1===this.config.safeMode;D=w&&e?G:B}for(V.call(this,e);b<S;){s=null;var H=g.charCodeAt(b),z=D(H),Y=z.length;for(n=0;n<Y;n++){var X=(W=z[n]).pattern;if(c=null,!1!==(it=W.short)?H===it&&(s=X):!0===W.isCustom?null!==(O=X.exec(g,b,I,C))?(s=O[0],void 0!==O.payload&&(c=O.payload)):s=null:(this.updateLastIndex(X,b),s=this.match(X,t,b)),null!==s){if(void 0!==(a=W.longerAlt)){var $=P[a],q=$.pattern;u=null,!0===$.isCustom?null!==(O=q.exec(g,b,I,C))?(o=O[0],void 0!==O.payload&&(u=O.payload)):o=null:(this.updateLastIndex(q,b),o=this.match(q,t,b)),o&&o.length>s.length&&(s=o,c=u,W=$)}break}}if(null!==s){if(l=s.length,void 0!==(h=W.group)&&(p=W.tokenTypeIdx,f=this.createTokenInstance(s,b,p,W.tokenType,k,L,l),this.handlePayload(f,c),!1===h?N=this.addToken(I,N,f):C[h].push(f)),t=this.chopInput(t,l),b+=l,L=this.computeNewColumn(L,l),!0===_&&!0===W.canLineTerminator){var J=0,Q=void 0,Z=void 0;x.lastIndex=0;do{!0===(Q=x.test(s))&&(Z=x.lastIndex-1,J++)}while(!0===Q);0!==J&&(k+=J,L=l-Z,this.updateTokenEndLineColumnLocation(f,h,Z,J,k,L,l))}this.handleModes(W,K,V,f)}else{for(var tt=b,et=k,nt=L,rt=!1;!rt&&b<S;)for(g.charCodeAt(b),t=this.chopInput(t,1),b++,r=0;r<M;r++){var it,ot=P[r];X=ot.pattern;if(!1!==(it=ot.short)?g.charCodeAt(b)===it&&(rt=!0):!0===ot.isCustom?rt=null!==X.exec(g,b,I,C):(this.updateLastIndex(X,b),rt=null!==X.exec(t)),!0===rt)break}d=b-tt,m=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,tt,d,et,nt),R.push({offset:tt,line:et,column:nt,length:d,message:m})}}return this.hasCustom||(I.length=N),{tokens:I,groups:C,errors:R}},t.prototype.handleModes=function(t,e,n,r){if(!0===t.pop){var i=t.push;e(r),void 0!==i&&n.call(this,i)}else void 0!==t.push&&n.call(this,t.push)},t.prototype.chopInput=function(t,e){return t.substring(e)},t.prototype.updateLastIndex=function(t,e){t.lastIndex=e},t.prototype.updateTokenEndLineColumnLocation=function(t,e,n,r,i,o,a){var s,c;void 0!==e&&(c=(s=n===a-1)?-1:0,1===r&&!0===s||(t.endLine=i+c,t.endColumn=o-1-c))},t.prototype.computeNewColumn=function(t,e){return t+e},t.prototype.createTokenInstance=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return null},t.prototype.createOffsetOnlyToken=function(t,e,n,r){return{image:t,startOffset:e,tokenTypeIdx:n,tokenType:r}},t.prototype.createStartOnlyToken=function(t,e,n,r,i,o){return{image:t,startOffset:e,startLine:i,startColumn:o,tokenTypeIdx:n,tokenType:r}},t.prototype.createFullToken=function(t,e,n,r,i,o,a){return{image:t,startOffset:e,endOffset:e+a-1,startLine:i,endLine:i,startColumn:o,endColumn:o+a-1,tokenTypeIdx:n,tokenType:r}},t.prototype.addToken=function(t,e,n){return 666},t.prototype.addTokenUsingPush=function(t,e,n){return t.push(n),e},t.prototype.addTokenUsingMemberAccess=function(t,e,n){return t[e]=n,++e},t.prototype.handlePayload=function(t,e){},t.prototype.handlePayloadNoCustom=function(t,e){},t.prototype.handlePayloadWithCustom=function(t,e){null!==e&&(t.payload=e)},t.prototype.match=function(t,e,n){return null},t.prototype.matchWithTest=function(t,e,n){return!0===t.test(e)?e.substring(n,t.lastIndex):null},t.prototype.matchWithExec=function(t,e){var n=t.exec(e);return null!==n?n[0]:n},t.prototype.TRACE_INIT=function(t,e){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--\x3e <"+t+">");var r=Object(i.R)(e),o=r.time,a=r.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+t+"> time: "+o+"ms"),this.traceInitIndent--,a}return e()},t.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",t.NA=/NOT_APPLICABLE/,t}();function $(t){return J(t)?t.LABEL:t.name}function q(t){return t.name}function J(t){return Object(i.E)(t.LABEL)&&""!==t.LABEL}function Q(t){return function(t){var e=t.pattern,n={};n.name=t.name,Object(i.F)(e)||(n.PATTERN=e);if(Object(i.w)(t,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/SAP/chevrotain/issues/564#issuecomment-349062346 for details.";Object(i.w)(t,"categories")&&(n.CATEGORIES=t.categories);G([n]),Object(i.w)(t,"label")&&(n.LABEL=t.label);Object(i.w)(t,"group")&&(n.GROUP=t.group);Object(i.w)(t,"pop_mode")&&(n.POP_MODE=t.pop_mode);Object(i.w)(t,"push_mode")&&(n.PUSH_MODE=t.push_mode);Object(i.w)(t,"longer_alt")&&(n.LONGER_ALT=t.longer_alt);Object(i.w)(t,"line_breaks")&&(n.LINE_BREAKS=t.line_breaks);Object(i.w)(t,"start_chars_hint")&&(n.START_CHARS_HINT=t.start_chars_hint);return n}(t)}var Z=Q({name:"EOF",pattern:X.NA});function tt(t,e,n,r,i,o,a,s){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function et(t,e){return U(t,e)}G([Z]);var nt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),rt=function(){function t(t){this.definition=t}return t.prototype.accept=function(t){t.visit(this),Object(i.u)(this.definition,(function(e){e.accept(t)}))},t}(),it=function(t){function e(e){var n=t.call(this,[])||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),Object.defineProperty(e.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(rt),ot=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.orgText="",Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),at=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.ignoreAmbiguities=!1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),st=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),ct=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),ut=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),lt=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),ht=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),pt=function(t){function e(e){var n=t.call(this,e.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,Object(i.f)(n,Object(i.N)(e,(function(t){return void 0!==t}))),n}return nt(e,t),e}(rt),ft=function(){function t(t){this.idx=1,Object(i.f)(this,Object(i.N)(t,(function(t){return void 0!==t})))}return t.prototype.accept=function(t){t.visit(this)},t}();function dt(t){return Object(i.I)(t,mt)}function mt(t){function e(t){return Object(i.I)(t,mt)}if(t instanceof it)return{type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};if(t instanceof at)return{type:"Alternative",definition:e(t.definition)};if(t instanceof st)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof ct)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ut)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:mt(new ft({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ht)return{type:"RepetitionWithSeparator",idx:t.idx,separator:mt(new ft({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof lt)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof pt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof ft){var n={type:"Terminal",name:t.terminalType.name,label:$(t.terminalType),idx:t.idx},r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Object(i.D)(r)?r.source:r),n}if(t instanceof ot)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}var Ot=function(){function t(){}return t.prototype.walk=function(t,e){var n=this;void 0===e&&(e=[]),Object(i.u)(t.definition,(function(r,o){var a=Object(i.m)(t.definition,o+1);if(r instanceof it)n.walkProdRef(r,a,e);else if(r instanceof ft)n.walkTerminal(r,a,e);else if(r instanceof at)n.walkFlat(r,a,e);else if(r instanceof st)n.walkOption(r,a,e);else if(r instanceof ct)n.walkAtLeastOne(r,a,e);else if(r instanceof ut)n.walkAtLeastOneSep(r,a,e);else if(r instanceof ht)n.walkManySep(r,a,e);else if(r instanceof lt)n.walkMany(r,a,e);else{if(!(r instanceof pt))throw Error("non exhaustive match");n.walkOr(r,a,e)}}))},t.prototype.walkTerminal=function(t,e,n){},t.prototype.walkProdRef=function(t,e,n){},t.prototype.walkFlat=function(t,e,n){var r=e.concat(n);this.walk(t,r)},t.prototype.walkOption=function(t,e,n){var r=e.concat(n);this.walk(t,r)},t.prototype.walkAtLeastOne=function(t,e,n){var r=[new st({definition:t.definition})].concat(e,n);this.walk(t,r)},t.prototype.walkAtLeastOneSep=function(t,e,n){var r=vt(t,e,n);this.walk(t,r)},t.prototype.walkMany=function(t,e,n){var r=[new st({definition:t.definition})].concat(e,n);this.walk(t,r)},t.prototype.walkManySep=function(t,e,n){var r=vt(t,e,n);this.walk(t,r)},t.prototype.walkOr=function(t,e,n){var r=this,o=e.concat(n);Object(i.u)(t.definition,(function(t){var e=new at({definition:[t]});r.walk(e,o)}))},t}();function vt(t,e,n){return[new st({definition:[new ft({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}var Tt=function(){function t(){}return t.prototype.visit=function(t){var e=t;switch(e.constructor){case it:return this.visitNonTerminal(e);case at:return this.visitAlternative(e);case st:return this.visitOption(e);case ct:return this.visitRepetitionMandatory(e);case ut:return this.visitRepetitionMandatoryWithSeparator(e);case ht:return this.visitRepetitionWithSeparator(e);case lt:return this.visitRepetition(e);case pt:return this.visitAlternation(e);case ft:return this.visitTerminal(e);case ot:return this.visitRule(e);default:throw Error("non exhaustive match")}},t.prototype.visitNonTerminal=function(t){},t.prototype.visitAlternative=function(t){},t.prototype.visitOption=function(t){},t.prototype.visitRepetition=function(t){},t.prototype.visitRepetitionMandatory=function(t){},t.prototype.visitRepetitionMandatoryWithSeparator=function(t){},t.prototype.visitRepetitionWithSeparator=function(t){},t.prototype.visitAlternation=function(t){},t.prototype.visitTerminal=function(t){},t.prototype.visitRule=function(t){},t}(),Et=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function yt(t,e){return void 0===e&&(e=[]),!!(t instanceof st||t instanceof lt||t instanceof ht)||(t instanceof pt?Object(i.Q)(t.definition,(function(t){return yt(t,e)})):!(t instanceof it&&Object(i.j)(e,t))&&(t instanceof rt&&(t instanceof it&&e.push(t),Object(i.o)(t.definition,(function(t){return yt(t,e)})))))}function gt(t){if(t instanceof it)return"SUBRULE";if(t instanceof st)return"OPTION";if(t instanceof pt)return"OR";if(t instanceof ct)return"AT_LEAST_ONE";if(t instanceof ut)return"AT_LEAST_ONE_SEP";if(t instanceof ht)return"MANY_SEP";if(t instanceof lt)return"MANY";if(t instanceof ft)return"CONSUME";throw Error("non exhaustive match")}var St=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.separator="-",e.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},e}return Et(e,t),e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var e=t.terminalType.name+this.separator+"Terminal";Object(i.w)(this.dslMethods,e)||(this.dslMethods[e]=[]),this.dslMethods[e].push(t)},e.prototype.visitNonTerminal=function(t){var e=t.nonTerminalName+this.separator+"Terminal";Object(i.w)(this.dslMethods,e)||(this.dslMethods[e]=[]),this.dslMethods[e].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(Tt),bt=new St;function Nt(t){if(t instanceof it)return Nt(t.referencedRule);if(t instanceof ft)return[t.terminalType];if(function(t){return t instanceof at||t instanceof st||t instanceof lt||t instanceof ct||t instanceof ut||t instanceof ht||t instanceof ft||t instanceof ot}(t))return function(t){var e,n=[],r=t.definition,o=0,a=r.length>o,s=!0;for(;a&&s;)e=r[o],s=yt(e),n=n.concat(Nt(e)),o+=1,a=r.length>o;return Object(i.T)(n)}(t);if(function(t){return t instanceof pt}(t))return function(t){var e=Object(i.I)(t.definition,(function(t){return Nt(t)}));return Object(i.T)(Object(i.t)(e))}(t);throw Error("non exhaustive match")}var At="_~IN~_",It=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Rt=function(t){function e(e){var n=t.call(this)||this;return n.topProd=e,n.follows={},n}return It(e,t),e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,e,n){},e.prototype.walkProdRef=function(t,e,n){var r,i,o=(r=t.referencedRule,i=t.idx,r.name+i+At+this.topProd.name),a=e.concat(n),s=Nt(new at({definition:a}));this.follows[o]=s},e}(Ot);var kt={buildMismatchTokenMessage:function(t){var e=t.expected,n=t.actual;t.previous,t.ruleName;return"Expecting "+(J(e)?"--\x3e "+$(e)+" <--":"token of type --\x3e "+e.name+" <--")+" but found --\x3e '"+n.image+"' <--"},buildNotAllInputParsedMessage:function(t){var e=t.firstRedundant;t.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(t){var e=t.expectedPathsPerAlt,n=t.actual,r=(t.previous,t.customUserDescription),o=(t.ruleName,"\nbut found: '"+Object(i.s)(n).image+"'");if(r)return"Expecting: "+r+o;var a=Object(i.O)(e,(function(t,e){return t.concat(e)}),[]),s=Object(i.I)(a,(function(t){return"["+Object(i.I)(t,(function(t){return $(t)})).join(", ")+"]"}));return"Expecting: "+("one of these possible Token sequences:\n"+Object(i.I)(s,(function(t,e){return" "+(e+1)+". "+t})).join("\n"))+o},buildEarlyExitMessage:function(t){var e=t.expectedIterationPaths,n=t.actual,r=t.customUserDescription,o=(t.ruleName,"\nbut found: '"+Object(i.s)(n).image+"'");return r?"Expecting: "+r+o:"Expecting: "+("expecting at least one iteration which starts with one of these possible Token sequences::\n <"+Object(i.I)(e,(function(t){return"["+Object(i.I)(t,(function(t){return $(t)})).join(",")+"]"})).join(" ,")+">")+o}};Object.freeze(kt);var Lt={buildRuleNotFoundError:function(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+"<-\ninside top level rule: ->"+t.name+"<-"}},Ct={buildDuplicateFoundError:function(t,e){var n,r=t.name,o=Object(i.s)(e),a=o.idx,s=gt(o),c=(n=o)instanceof ft?n.terminalType.name:n instanceof it?n.nonTerminalName:"",u="->"+s+(a>0?a:"")+"<- "+(c?"with argument: ->"+c+"<-":"")+"\n appears more than once ("+e.length+" times) in the top level rule: ->"+r+"<-. \n For further details see: https://sap.github.io/chevrotain/docs/FAQ.html#NUMERICAL_SUFFIXES \n ";return u=(u=u.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(t){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+t.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(t){var e=Object(i.I)(t.prefixPath,(function(t){return $(t)})).join(", "),n=0===t.alternation.idx?"":t.alternation.idx;return"Ambiguous alternatives: <"+t.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\nin <OR"+n+"> inside <"+t.topLevelRule.name+"> Rule,\n<"+e+"> may appears as a prefix path in all these alternatives.\nSee: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(t){var e=Object(i.I)(t.prefixPath,(function(t){return $(t)})).join(", "),n=0===t.alternation.idx?"":t.alternation.idx,r="Ambiguous Alternatives Detected: <"+t.ambiguityIndices.join(" ,")+"> in <OR"+n+"> inside <"+t.topLevelRule.name+"> Rule,\n<"+e+"> may appears as a prefix path in all these alternatives.\n";return r+="See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(t){var e=gt(t.repetition);return 0!==t.repetition.idx&&(e+=t.repetition.idx),"The repetition <"+e+"> within Rule <"+t.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(t){return"Invalid Grammar Token name: ->"+t.tokenType.name+"<- it must match the pattern: ->"+t.expectedPattern.toString()+"<-"},buildEmptyAlternationError:function(t){return"Ambiguous empty alternative: <"+(t.emptyChoiceIdx+1)+"> in <OR"+t.alternation.idx+"> inside <"+t.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(t){return"An Alternation cannot have more than 256 alternatives:\n<OR"+t.alternation.idx+"> inside <"+t.topLevelRule.name+"> Rule.\n has "+(t.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(t){var e=t.topLevelRule.name;return"Left Recursion found in grammar.\nrule: <"+e+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+(e+" --\x3e "+i.I(t.leftRecursionPath,(function(t){return t.name})).concat([e]).join(" --\x3e "))+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(t){return"Invalid grammar rule name: ->"+t.topLevelRule.name+"<- it must match the pattern: ->"+t.expectedPattern.toString()+"<-"},buildDuplicateRuleNameError:function(t){return"Duplicate definition, rule: ->"+(t.topLevelRule instanceof ot?t.topLevelRule.name:t.topLevelRule)+"<- is already defined in the grammar: ->"+t.grammarName+"<-"}},_t=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();var xt=function(t){function e(e,n){var r=t.call(this)||this;return r.nameToTopRule=e,r.errMsgProvider=n,r.errors=[],r}return _t(e,t),e.prototype.resolveRefs=function(){var t=this;Object(i.u)(Object(i.U)(this.nameToTopRule),(function(e){t.currTopLevel=e,e.accept(t)}))},e.prototype.visitNonTerminal=function(t){var e=this.nameToTopRule[t.nonTerminalName];if(e)t.referencedRule=e;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:n,type:Qe.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(Tt),Mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.path=n,r.nextTerminalName="",r.nextTerminalOccurrence=0,r.nextTerminalName=r.path.lastTok.name,r.nextTerminalOccurrence=r.path.lastTokOccurrence,r}return Mt(e,t),e.prototype.walkTerminal=function(t,e,n){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var r=e.concat(n),i=new at({definition:r});this.possibleTokTypes=Nt(i),this.found=!0}},e}(function(t){function e(e,n){var r=t.call(this)||this;return r.topProd=e,r.path=n,r.possibleTokTypes=[],r.nextProductionName="",r.nextProductionOccurrence=0,r.found=!1,r.isAtEndOfPath=!1,r}return Mt(e,t),e.prototype.startWalking=function(){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=Object(i.g)(this.path.ruleStack).reverse(),this.occurrenceStack=Object(i.g)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(e,n){void 0===n&&(n=[]),this.found||t.prototype.walk.call(this,e,n)},e.prototype.walkProdRef=function(t,e,n){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var r=e.concat(n);this.updateExpectedNext(),this.walk(t.referencedRule,r)}},e.prototype.updateExpectedNext=function(){Object(i.A)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(Ot)),jt=function(t){function e(e,n){var r=t.call(this)||this;return r.topRule=e,r.occurrence=n,r.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},r}return Mt(e,t),e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(Ot),wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mt(e,t),e.prototype.walkMany=function(e,n,r){if(e.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof ft&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else t.prototype.walkMany.call(this,e,n,r)},e}(jt),Ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mt(e,t),e.prototype.walkManySep=function(e,n,r){if(e.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof ft&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else t.prototype.walkManySep.call(this,e,n,r)},e}(jt),Ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mt(e,t),e.prototype.walkAtLeastOne=function(e,n,r){if(e.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof ft&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else t.prototype.walkAtLeastOne.call(this,e,n,r)},e}(jt),Dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mt(e,t),e.prototype.walkAtLeastOneSep=function(e,n,r){if(e.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof ft&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else t.prototype.walkAtLeastOneSep.call(this,e,n,r)},e}(jt);function Bt(t,e,n){void 0===n&&(n=[]),n=Object(i.g)(n);var r=[],o=0;function a(a){var s=Bt(a.concat(Object(i.m)(t,o+1)),e,n);return r.concat(s)}for(;n.length<e&&o<t.length;){var s=t[o];if(s instanceof at)return a(s.definition);if(s instanceof it)return a(s.definition);if(s instanceof st)r=a(s.definition);else{if(s instanceof ct)return a(c=s.definition.concat([new lt({definition:s.definition})]));if(s instanceof ut)return a(c=[new at({definition:s.definition}),new lt({definition:[new ft({terminalType:s.separator})].concat(s.definition)})]);if(s instanceof ht){var c=s.definition.concat([new lt({definition:[new ft({terminalType:s.separator})].concat(s.definition)})]);r=a(c)}else if(s instanceof lt){c=s.definition.concat([new lt({definition:s.definition})]);r=a(c)}else{if(s instanceof pt)return Object(i.u)(s.definition,(function(t){!1===Object(i.A)(t.definition)&&(r=a(t.definition))})),r;if(!(s instanceof ft))throw Error("non exhaustive match");n.push(s.terminalType)}}o++}return r.push({partialPath:n,suffixDef:Object(i.m)(t,o)}),r}function Gt(t,e,n,r){var o=["EXIT_NONE_TERMINAL"],a=!1,s=e.length,c=s-r-1,u=[],l=[];for(l.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Object(i.A)(l);){var h=l.pop();if("EXIT_ALTERNATIVE"!==h){var p=h.def,f=h.idx,d=h.ruleStack,m=h.occurrenceStack;if(!Object(i.A)(p)){var O=p[0];if("EXIT_NONE_TERMINAL"===O){var v={idx:f,def:Object(i.m)(p),ruleStack:Object(i.n)(d),occurrenceStack:Object(i.n)(m)};l.push(v)}else if(O instanceof ft)if(f<s-1){var T=f+1;if(n(e[T],O.terminalType)){v={idx:T,def:Object(i.m)(p),ruleStack:d,occurrenceStack:m};l.push(v)}}else{if(f!==s-1)throw Error("non exhaustive match");u.push({nextTokenType:O.terminalType,nextTokenOccurrence:O.idx,ruleStack:d,occurrenceStack:m}),a=!0}else if(O instanceof it){var E=Object(i.g)(d);E.push(O.nonTerminalName);var y=Object(i.g)(m);y.push(O.idx);v={idx:f,def:O.definition.concat(o,Object(i.m)(p)),ruleStack:E,occurrenceStack:y};l.push(v)}else if(O instanceof st){var g={idx:f,def:Object(i.m)(p),ruleStack:d,occurrenceStack:m};l.push(g),l.push("EXIT_ALTERNATIVE");var S={idx:f,def:O.definition.concat(Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(S)}else if(O instanceof ct){var b=new lt({definition:O.definition,idx:O.idx});v={idx:f,def:O.definition.concat([b],Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(v)}else if(O instanceof ut){var N=new ft({terminalType:O.separator});b=new lt({definition:[N].concat(O.definition),idx:O.idx}),v={idx:f,def:O.definition.concat([b],Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(v)}else if(O instanceof ht){g={idx:f,def:Object(i.m)(p),ruleStack:d,occurrenceStack:m};l.push(g),l.push("EXIT_ALTERNATIVE");N=new ft({terminalType:O.separator});var A=new lt({definition:[N].concat(O.definition),idx:O.idx});S={idx:f,def:O.definition.concat([A],Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(S)}else if(O instanceof lt){g={idx:f,def:Object(i.m)(p),ruleStack:d,occurrenceStack:m};l.push(g),l.push("EXIT_ALTERNATIVE");A=new lt({definition:O.definition,idx:O.idx}),S={idx:f,def:O.definition.concat([A],Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(S)}else if(O instanceof pt)for(var I=O.definition.length-1;I>=0;I--){var R={idx:f,def:O.definition[I].definition.concat(Object(i.m)(p)),ruleStack:d,occurrenceStack:m};l.push(R),l.push("EXIT_ALTERNATIVE")}else if(O instanceof at)l.push({idx:f,def:O.definition.concat(Object(i.m)(p)),ruleStack:d,occurrenceStack:m});else{if(!(O instanceof ot))throw Error("non exhaustive match");l.push(Wt(O,f,d,m))}}}else a&&Object(i.H)(l).idx<=c&&l.pop()}return u}function Wt(t,e,n,r){var o=Object(i.g)(n);o.push(t.name);var a=Object(i.g)(r);return a.push(1),{idx:e,def:t.definition,ruleStack:o,occurrenceStack:a}}var Kt,Vt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"}(Kt||(Kt={}));var Ht=function(t){function e(e,n,r){var i=t.call(this)||this;return i.topProd=e,i.targetOccurrence=n,i.targetProdType=r,i}return Vt(e,t),e.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},e.prototype.checkIsTarget=function(t,e,n,r){return t.idx===this.targetOccurrence&&this.targetProdType===e&&(this.restDef=n.concat(r),!0)},e.prototype.walkOption=function(e,n,r){this.checkIsTarget(e,Kt.OPTION,n,r)||t.prototype.walkOption.call(this,e,n,r)},e.prototype.walkAtLeastOne=function(e,n,r){this.checkIsTarget(e,Kt.REPETITION_MANDATORY,n,r)||t.prototype.walkOption.call(this,e,n,r)},e.prototype.walkAtLeastOneSep=function(e,n,r){this.checkIsTarget(e,Kt.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||t.prototype.walkOption.call(this,e,n,r)},e.prototype.walkMany=function(e,n,r){this.checkIsTarget(e,Kt.REPETITION,n,r)||t.prototype.walkOption.call(this,e,n,r)},e.prototype.walkManySep=function(e,n,r){this.checkIsTarget(e,Kt.REPETITION_WITH_SEPARATOR,n,r)||t.prototype.walkOption.call(this,e,n,r)},e}(Ot),zt=function(t){function e(e,n,r){var i=t.call(this)||this;return i.targetOccurrence=e,i.targetProdType=n,i.targetRef=r,i.result=[],i}return Vt(e,t),e.prototype.checkIsTarget=function(t,e){t.idx!==this.targetOccurrence||this.targetProdType!==e||void 0!==this.targetRef&&t!==this.targetRef||(this.result=t.definition)},e.prototype.visitOption=function(t){this.checkIsTarget(t,Kt.OPTION)},e.prototype.visitRepetition=function(t){this.checkIsTarget(t,Kt.REPETITION)},e.prototype.visitRepetitionMandatory=function(t){this.checkIsTarget(t,Kt.REPETITION_MANDATORY)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.checkIsTarget(t,Kt.REPETITION_MANDATORY_WITH_SEPARATOR)},e.prototype.visitRepetitionWithSeparator=function(t){this.checkIsTarget(t,Kt.REPETITION_WITH_SEPARATOR)},e.prototype.visitAlternation=function(t){this.checkIsTarget(t,Kt.ALTERNATION)},e}(Tt);function Yt(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=[];return e}function Xt(t){for(var e=[""],n=0;n<t.length;n++){for(var r=t[n],i=[],o=0;o<e.length;o++){var a=e[o];i.push(a+"_"+r.tokenTypeIdx);for(var s=0;s<r.categoryMatches.length;s++){var c="_"+r.categoryMatches[s];i.push(a+c)}}e=i}return e}function $t(t,e,n){for(var r=0;r<t.length;r++)if(r!==n)for(var i=t[r],o=0;o<e.length;o++){if(!0===i[e[o]])return!1}return!0}function qt(t,e){for(var n=Object(i.I)(t,(function(t){return Bt([t],1)})),r=Yt(n.length),o=Object(i.I)(n,(function(t){var e={};return Object(i.u)(t,(function(t){var n=Xt(t.partialPath);Object(i.u)(n,(function(t){e[t]=!0}))})),e})),a=n,s=1;s<=e;s++){var c=a;a=Yt(c.length);for(var u=function(t){for(var n=c[t],u=0;u<n.length;u++){var l=n[u].partialPath,h=n[u].suffixDef,p=Xt(l);if($t(o,p,t)||Object(i.A)(h)||l.length===e){var f=r[t];if(!1===Zt(f,l)){f.push(l);for(var d=0;d<p.length;d++){var m=p[d];o[t][m]=!0}}}else{var O=Bt(h,s+1,l);a[t]=a[t].concat(O),Object(i.u)(O,(function(e){var n=Xt(e.partialPath);Object(i.u)(n,(function(e){o[t][e]=!0}))}))}}},l=0;l<c.length;l++)u(l)}return r}function Jt(t,e,n,r){var i=new zt(t,Kt.ALTERNATION,r);return e.accept(i),qt(i.result,n)}function Qt(t,e,n,r){var i=new zt(t,n);e.accept(i);var o=i.result,a=new Ht(e,t,n).startWalking();return qt([new at({definition:o}),new at({definition:a})],r)}function Zt(t,e){t:for(var n=0;n<t.length;n++){var r=t[n];if(r.length===e.length){for(var i=0;i<r.length;i++){var o=e[i],a=r[i];if(!1===(o===a||void 0!==a.categoryMatchesMap[o.tokenTypeIdx]))continue t}return!0}}return!1}function te(t){return Object(i.o)(t,(function(t){return Object(i.o)(t,(function(t){return Object(i.o)(t,(function(t){return Object(i.A)(t.categoryMatches)}))}))}))}var ee=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function ne(t,e,n,r,o){var a=i.I(t,(function(t){return function(t,e){var n=new oe;t.accept(n);var r=n.allProductions,o=i.v(r,re),a=i.N(o,(function(t){return t.length>1}));return i.I(i.U(a),(function(n){var r=i.s(n),o=e.buildDuplicateFoundError(t,n),a=gt(r),s={message:o,type:Qe.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:a,occurrence:r.idx},c=ie(r);return c&&(s.parameter=c),s}))}(t,r)})),s=i.I(t,(function(t){return function t(e,n,r,o){void 0===o&&(o=[]);var a=[],s=function t(e){var n=[];if(i.A(e))return n;var r=i.s(e);if(r instanceof it)n.push(r.referencedRule);else if(r instanceof at||r instanceof st||r instanceof ct||r instanceof ut||r instanceof ht||r instanceof lt)n=n.concat(t(r.definition));else if(r instanceof pt)n=i.t(i.I(r.definition,(function(e){return t(e.definition)})));else if(!(r instanceof ft))throw Error("non exhaustive match");var o=yt(r),a=e.length>1;if(o&&a){var s=i.m(e);return n.concat(t(s))}return n}(n.definition);if(i.A(s))return[];var c=e.name;i.j(s,e)&&a.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:o}),type:Qe.LEFT_RECURSION,ruleName:c});var u=i.l(s,o.concat([e])),l=i.I(u,(function(n){var a=i.g(o);return a.push(n),t(e,n,r,a)}));return a.concat(i.t(l))}(t,t,r)})),c=[],u=[],l=[];Object(i.o)(s,i.A)&&(c=Object(i.I)(t,(function(t){return function(t,e){var n=new se;t.accept(n);var r=n.alternations;return i.O(r,(function(n,r){var o=i.n(r.definition),a=i.I(o,(function(n,o){var a=Gt([n],[],null,1);return i.A(a)?{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:r,emptyChoiceIdx:o}),type:Qe.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:r.idx,alternative:o+1}:null}));return n.concat(i.i(a))}),[])}(t,r)})),u=Object(i.I)(t,(function(t){return function(t,e,n){var r=new se;t.accept(r);var o=r.alternations;return o=Object(i.P)(o,(function(t){return!0===t.ignoreAmbiguities})),i.O(o,(function(r,o){var a=o.idx,s=o.maxLookahead||e,c=Jt(a,t,s,o),u=function(t,e,n,r){var o=[],a=Object(i.O)(t,(function(n,r,a){return!0===e.definition[a].ignoreAmbiguities||Object(i.u)(r,(function(r){var s=[a];Object(i.u)(t,(function(t,n){a!==n&&Zt(t,r)&&!0!==e.definition[n].ignoreAmbiguities&&s.push(n)})),s.length>1&&!Zt(o,r)&&(o.push(r),n.push({alts:s,path:r}))})),n}),[]);return i.I(a,(function(t){var o=Object(i.I)(t.alts,(function(t){return t+1}));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:o,prefixPath:t.path}),type:Qe.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:[t.alts]}}))}(c,o,t,n),l=function(t,e,n,r){var o=[],a=Object(i.O)(t,(function(t,e,n){var r=Object(i.I)(e,(function(t){return{idx:n,path:t}}));return t.concat(r)}),[]);return Object(i.u)(a,(function(t){if(!0!==e.definition[t.idx].ignoreAmbiguities){var s=t.idx,c=t.path,u=Object(i.r)(a,(function(t){return!0!==e.definition[t.idx].ignoreAmbiguities&&t.idx<s&&(n=t.path,r=c,n.length<r.length&&Object(i.o)(n,(function(t,e){var n=r[e];return t===n||n.categoryMatchesMap[t.tokenTypeIdx]})));var n,r})),l=Object(i.I)(u,(function(t){var i=[t.idx+1,s+1],o=0===e.idx?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:i,prefixPath:t.path}),type:Qe.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}}));o=o.concat(l)}})),o}(c,o,t,n);return r.concat(u,l)}),[])}(t,e,r)})),l=function(t,e,n){var r=[];return Object(i.u)(t,(function(t){var o=new ce;t.accept(o);var a=o.allProductions;Object(i.u)(a,(function(o){var a=function(t){if(t instanceof st)return Kt.OPTION;if(t instanceof lt)return Kt.REPETITION;if(t instanceof ct)return Kt.REPETITION_MANDATORY;if(t instanceof ut)return Kt.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof ht)return Kt.REPETITION_WITH_SEPARATOR;if(t instanceof pt)return Kt.ALTERNATION;throw Error("non exhaustive match")}(o),s=o.maxLookahead||e,c=Qt(o.idx,t,a,s)[0];if(Object(i.A)(Object(i.t)(c))){var u=n.buildEmptyRepetitionError({topLevelRule:t,repetition:o});r.push({message:u,type:Qe.NO_NON_EMPTY_LOOKAHEAD,ruleName:t.name})}}))})),r}(t,e,r));var h=function(t,e,n){var r=[],o=Object(i.I)(e,(function(t){return t.name}));return Object(i.u)(t,(function(t){var e=t.name;if(Object(i.j)(o,e)){var a=n.buildNamespaceConflictError(t);r.push({message:a,type:Qe.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:e})}})),r}(t,n,r),p=i.I(n,(function(t){return function(t,e){var n=[];t.name.match(ae)||n.push({message:e.buildTokenNameError({tokenType:t,expectedPattern:ae}),type:Qe.INVALID_TOKEN_NAME});return n}(t,r)})),f=Object(i.I)(t,(function(t){return function(t,e){var n=new se;t.accept(n);var r=n.alternations;return i.O(r,(function(n,r){return r.definition.length>255&&n.push({message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:r}),type:Qe.TOO_MANY_ALTS,ruleName:t.name,occurrence:r.idx}),n}),[])}(t,r)})),d=Object(i.I)(t,(function(t){return function(t,e){var n=[],r=t.name;r.match(ae)||n.push({message:e.buildInvalidRuleNameError({topLevelRule:t,expectedPattern:ae}),type:Qe.INVALID_RULE_NAME,ruleName:r});return n}(t,r)})),m=Object(i.I)(t,(function(e){return function(t,e,n,r){var o=[];if(Object(i.O)(e,(function(e,n){return n.name===t.name?e+1:e}),0)>1){var a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});o.push({message:a,type:Qe.DUPLICATE_RULE_NAME,ruleName:t.name})}return o}(e,t,o,r)}));return i.t(a.concat(p,l,s,c,u,h,f,d,m))}function re(t){return gt(t)+"_#_"+t.idx+"_#_"+ie(t)}function ie(t){return t instanceof ft?t.terminalType.name:t instanceof it?t.nonTerminalName:""}var oe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.allProductions=[],e}return ee(e,t),e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(Tt),ae=/^[a-zA-Z_]\w*$/;var se=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.alternations=[],e}return ee(e,t),e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(Tt);var ce=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.allProductions=[],e}return ee(e,t),e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(Tt);function ue(t){t=Object(i.k)(t,{errMsgProvider:Lt});var e,n,r,o={};return Object(i.u)(t.rules,(function(t){o[t.name]=t})),e=o,n=t.errMsgProvider,(r=new xt(e,n)).resolveRefs(),r.errors}function le(t){return ne((t=Object(i.k)(t,{errMsgProvider:Ct})).rules,t.maxLookahead,t.tokenTypes,t.errMsgProvider,t.grammarName)}function he(t){Object(i.u)(t.rules,(function(t){var e=new St;t.accept(e),Object(i.u)(e.dslMethods,(function(t){Object(i.u)(t,(function(t,e){t.idx=e+1}))}))}))}var pe=["MismatchedTokenException","NoViableAltException","EarlyExitException","NotAllInputParsedException"];function fe(t){return Object(i.j)(pe,t.name)}function de(t,e,n){this.name="MismatchedTokenException",this.message=t,this.token=e,this.previousToken=n,this.resyncedTokens=[]}function me(t,e,n){this.name="NoViableAltException",this.message=t,this.token=e,this.previousToken=n,this.resyncedTokens=[]}function Oe(t,e){this.name="NotAllInputParsedException",this.message=t,this.token=e,this.resyncedTokens=[]}function ve(t,e,n){this.name="EarlyExitException",this.message=t,this.token=e,this.previousToken=n,this.resyncedTokens=[]}Object.freeze(pe),de.prototype=Error.prototype,me.prototype=Error.prototype,Oe.prototype=Error.prototype,ve.prototype=Error.prototype;var Te={};function Ee(t){this.name="InRuleRecoveryException",this.message=t}Ee.prototype=Error.prototype;var ye=function(){function t(){}return t.prototype.initRecoverable=function(t){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Object(i.w)(t,"recoveryEnabled")?t.recoveryEnabled:Ze.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=ge)},t.prototype.getTokenToInsert=function(t){var e=tt(t,"",NaN,NaN,NaN,NaN,NaN,NaN);return e.isInsertedInRecovery=!0,e},t.prototype.canTokenTypeBeInsertedInRecovery=function(t){return!0},t.prototype.tryInRepetitionRecovery=function(t,e,n,r){for(var o=this,a=this.findReSyncTokenType(),s=this.exportLexerState(),c=[],u=!1,l=this.LA(1),h=this.LA(1),p=function(){var t=o.LA(0),e=new de(o.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:t,ruleName:o.getCurrRuleFullName()}),l,o.LA(0));e.resyncedTokens=Object(i.n)(c),o.SAVE_ERROR(e)};!u;){if(this.tokenMatcher(h,r))return void p();if(n.call(this))return p(),void t.apply(this,e);this.tokenMatcher(h,a)?u=!0:(h=this.SKIP_TOKEN(),this.addToResyncTokens(h,c))}this.importLexerState(s)},t.prototype.shouldInRepetitionRecoveryBeTried=function(t,e,n){return!1!==n&&(void 0!==t&&void 0!==e&&(!this.tokenMatcher(this.LA(1),t)&&(!this.isBackTracking()&&!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e)))))},t.prototype.getFollowsForInRuleRecovery=function(t,e){var n=this.getCurrentGrammarPath(t,e);return this.getNextPossibleTokenTypes(n)},t.prototype.tryInRuleRecovery=function(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Ee("sad sad panda")},t.prototype.canPerformInRuleRecovery=function(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)},t.prototype.canRecoverWithSingleTokenInsertion=function(t,e){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(t))return!1;if(Object(i.A)(e))return!1;var r=this.LA(1);return void 0!==Object(i.q)(e,(function(t){return n.tokenMatcher(r,t)}))},t.prototype.canRecoverWithSingleTokenDeletion=function(t){return this.tokenMatcher(this.LA(2),t)},t.prototype.isInCurrentRuleReSyncSet=function(t){var e=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(e);return Object(i.j)(n,t)},t.prototype.findReSyncTokenType=function(){for(var t=this.flattenFollowSet(),e=this.LA(1),n=2;;){var r=e.tokenType;if(Object(i.j)(t,r))return r;e=this.LA(n),n++}},t.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return Te;var t=this.getLastExplicitRuleShortName(),e=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:e,inRule:this.shortRuleNameToFullName(n)}},t.prototype.buildFullFollowKeyStack=function(){var t=this,e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return Object(i.I)(e,(function(r,i){return 0===i?Te:{ruleName:t.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:t.shortRuleNameToFullName(e[i-1])}}))},t.prototype.flattenFollowSet=function(){var t=this,e=Object(i.I)(this.buildFullFollowKeyStack(),(function(e){return t.getFollowSetFromFollowKey(e)}));return Object(i.t)(e)},t.prototype.getFollowSetFromFollowKey=function(t){if(t===Te)return[Z];var e=t.ruleName+t.idxInCallingRule+At+t.inRule;return this.resyncFollows[e]},t.prototype.addToResyncTokens=function(t,e){return this.tokenMatcher(t,Z)||e.push(t),e},t.prototype.reSyncTo=function(t){for(var e=[],n=this.LA(1);!1===this.tokenMatcher(n,t);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,e);return Object(i.n)(e)},t.prototype.attemptInRepetitionRecovery=function(t,e,n,r,i,o,a){},t.prototype.getCurrentGrammarPath=function(t,e){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:Object(i.g)(this.RULE_OCCURRENCE_STACK),lastTok:t,lastTokOccurrence:e}},t.prototype.getHumanReadableRuleStack=function(){var t=this;return Object(i.I)(this.RULE_STACK,(function(e){return t.shortRuleNameToFullName(e)}))},t}();function ge(t,e,n,r,i,o,a){var s=this.getKeyForAutomaticLookahead(r,i),c=this.firstAfterRepMap[s];if(void 0===c){var u=this.getCurrRuleFullName();c=new o(this.getGAstProductions()[u],i).startWalking(),this.firstAfterRepMap[s]=c}var l=c.token,h=c.occurrence,p=c.isEndOfRule;1===this.RULE_STACK.length&&p&&void 0===l&&(l=Z,h=1),this.shouldInRepetitionRecoveryBeTried(l,h,a)&&this.tryInRepetitionRecovery(t,e,n,l)}function Se(t,e,n){return n|e|t}var be=function(){function t(){}return t.prototype.initLooksAhead=function(t){this.dynamicTokensEnabled=Object(i.w)(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:Ze.dynamicTokensEnabled,this.maxLookahead=Object(i.w)(t,"maxLookahead")?t.maxLookahead:Ze.maxLookahead,this.lookAheadFuncsCache=Object(i.z)()?new Map:[],Object(i.z)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},t.prototype.preComputeLookaheadFunctions=function(t){var e=this;Object(i.u)(t,(function(t){e.TRACE_INIT(t.name+" Rule Lookahead",(function(){var n=function(t){bt.reset(),t.accept(bt);var e=bt.dslMethods;return bt.reset(),e}(t),r=n.alternation,o=n.repetition,a=n.option,s=n.repetitionMandatory,c=n.repetitionMandatoryWithSeparator,u=n.repetitionWithSeparator;Object(i.u)(r,(function(n){var r=0===n.idx?"":n.idx;e.TRACE_INIT(""+gt(n)+r,(function(){var r,i,o,a,s,c,u,l=(r=n.idx,i=t,o=n.maxLookahead||e.maxLookahead,a=n.hasPredicates,s=e.dynamicTokensEnabled,c=e.lookAheadBuilderForAlternatives,u=Jt(r,i,o),c(u,a,te(u)?F:U,s)),h=Se(e.fullRuleNameToShort[t.name],256,n.idx);e.setLaFuncCache(h,l)}))})),Object(i.u)(o,(function(n){e.computeLookaheadFunc(t,n.idx,768,Kt.REPETITION,n.maxLookahead,gt(n))})),Object(i.u)(a,(function(n){e.computeLookaheadFunc(t,n.idx,512,Kt.OPTION,n.maxLookahead,gt(n))})),Object(i.u)(s,(function(n){e.computeLookaheadFunc(t,n.idx,1024,Kt.REPETITION_MANDATORY,n.maxLookahead,gt(n))})),Object(i.u)(c,(function(n){e.computeLookaheadFunc(t,n.idx,1536,Kt.REPETITION_MANDATORY_WITH_SEPARATOR,n.maxLookahead,gt(n))})),Object(i.u)(u,(function(n){e.computeLookaheadFunc(t,n.idx,1280,Kt.REPETITION_WITH_SEPARATOR,n.maxLookahead,gt(n))}))}))}))},t.prototype.computeLookaheadFunc=function(t,e,n,r,i,o){var a=this;this.TRACE_INIT(""+o+(0===e?"":e),(function(){var o=function(t,e,n,r,i,o){var a=Qt(t,e,i,n),s=te(a)?F:U;return o(a[0],s,r)}(e,t,i||a.maxLookahead,a.dynamicTokensEnabled,r,a.lookAheadBuilderForOptional),s=Se(a.fullRuleNameToShort[t.name],n,e);a.setLaFuncCache(s,o)}))},t.prototype.lookAheadBuilderForOptional=function(t,e,n){return function(t,e,n){var r=Object(i.o)(t,(function(t){return 1===t.length})),o=t.length;if(r&&!n){var a=Object(i.t)(t);if(1===a.length&&Object(i.A)(a[0].categoryMatches)){var s=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}var c=Object(i.O)(a,(function(t,e,n){return t[e.tokenTypeIdx]=!0,Object(i.u)(e.categoryMatches,(function(e){t[e]=!0})),t}),[]);return function(){var t=this.LA(1);return!0===c[t.tokenTypeIdx]}}return function(){t:for(var n=0;n<o;n++){for(var r=t[n],i=r.length,a=0;a<i;a++){var s=this.LA(a+1);if(!1===e(s,r[a]))continue t}return!0}return!1}}(t,e,n)},t.prototype.lookAheadBuilderForAlternatives=function(t,e,n,r){return function(t,e,n,r){var o=t.length,a=Object(i.o)(t,(function(t){return Object(i.o)(t,(function(t){return 1===t.length}))}));if(e)return function(e){for(var r=Object(i.I)(e,(function(t){return t.GATE})),a=0;a<o;a++){var s=t[a],c=s.length,u=r[a];if(void 0===u||!1!==u.call(this))t:for(var l=0;l<c;l++){for(var h=s[l],p=h.length,f=0;f<p;f++){var d=this.LA(f+1);if(!1===n(d,h[f]))continue t}return a}}};if(a&&!r){var s=Object(i.I)(t,(function(t){return Object(i.t)(t)})),c=Object(i.O)(s,(function(t,e,n){return Object(i.u)(e,(function(e){Object(i.w)(t,e.tokenTypeIdx)||(t[e.tokenTypeIdx]=n),Object(i.u)(e.categoryMatches,(function(e){Object(i.w)(t,e)||(t[e]=n)}))})),t}),[]);return function(){var t=this.LA(1);return c[t.tokenTypeIdx]}}return function(){for(var e=0;e<o;e++){var r=t[e],i=r.length;t:for(var a=0;a<i;a++){for(var s=r[a],c=s.length,u=0;u<c;u++){var l=this.LA(u+1);if(!1===n(l,s[u]))continue t}return e}}}}(t,e,n,r)},t.prototype.getKeyForAutomaticLookahead=function(t,e){return Se(this.getLastExplicitRuleShortName(),t,e)},t.prototype.getLaFuncFromCache=function(t){},t.prototype.getLaFuncFromMap=function(t){return this.lookAheadFuncsCache.get(t)},t.prototype.getLaFuncFromObj=function(t){return this.lookAheadFuncsCache[t]},t.prototype.setLaFuncCache=function(t,e){},t.prototype.setLaFuncCacheUsingMap=function(t,e){this.lookAheadFuncsCache.set(t,e)},t.prototype.setLaFuncUsingObj=function(t,e){this.lookAheadFuncsCache[t]=e},t}();function Ne(t,e){!0===isNaN(t.startOffset)?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset==!0&&(t.endOffset=e.endOffset)}function Ae(t,e){!0===isNaN(t.startOffset)?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset==!0&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}var Ie,Re=/^\s*function\s*(\S*)\s*\(/;function ke(t){var e=t.name;return e||t.toString().match(Re)[1]}function Le(t,e){var n=Object.getOwnPropertyDescriptor(t,"name");return!(!Object(i.F)(n)&&!n.configurable)&&(Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:e}),!0)}function Ce(t,e){for(var n=Object(i.G)(t),r=n.length,o=0;o<r;o++)for(var a=t[n[o]],s=a.length,c=0;c<s;c++){var u=a[c];void 0===u.tokenTypeIdx&&this[u.name](u.children,e)}}function _e(t,e){var n=function(){};return Le(n,t+"BaseSemantics"),(n.prototype={visit:function(t,e){if(Object(i.y)(t)&&(t=t[0]),!Object(i.F)(t))return this[t.name](t.children,e)},validateVisitor:function(){var t=function(t,e){var n=function(t,e){var n=Object(i.I)(e,(function(e){if(!Object(i.B)(t[e]))return{msg:"Missing visitor method: <"+e+"> on "+ke(t.constructor)+" CST Visitor.",type:Ie.MISSING_METHOD,methodName:e}}));return Object(i.i)(n)}(t,e),r=function(t,e){var n=[];for(var r in t)ae.test(r)&&Object(i.B)(t[r])&&!Object(i.j)(xe,r)&&!Object(i.j)(e,r)&&n.push({msg:"Redundant visitor method: <"+r+"> on "+ke(t.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\nFor utility methods on visitor classes use methods names that do not match /"+ae.source+"/.",type:Ie.REDUNDANT_METHOD,methodName:r});return n}(t,e);return n.concat(r)}(this,e);if(!Object(i.A)(t)){var n=Object(i.I)(t,(function(t){return t.msg}));throw Error("Errors Detected in CST Visitor <"+ke(this.constructor)+">:\n\t"+n.join("\n\n").replace(/\n/g,"\n\t"))}}}).constructor=n,n._RULE_NAMES=e,n}!function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"}(Ie||(Ie={}));var xe=["constructor","visit","validateVisitor"];var Me=function(){function t(){}return t.prototype.initTreeBuilder=function(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=Object(i.w)(t,"nodeLocationTracking")?t.nodeLocationTracking:Ze.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ae,this.setNodeLocationFromNode=Ae,this.cstPostRule=i.b,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=i.b,this.setNodeLocationFromNode=i.b,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ne,this.setNodeLocationFromNode=Ne,this.cstPostRule=i.b,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=i.b,this.setNodeLocationFromNode=i.b,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error('Invalid <nodeLocationTracking> config option: "'+t.nodeLocationTracking+'"');this.setNodeLocationFromToken=i.b,this.setNodeLocationFromNode=i.b,this.cstPostRule=i.b,this.setInitialNodeLocation=i.b}else this.cstInvocationStateUpdate=i.b,this.cstFinallyStateUpdate=i.b,this.cstPostTerminal=i.b,this.cstPostNonTerminal=i.b,this.cstPostRule=i.b},t.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(t){t.location={startOffset:NaN,endOffset:NaN}},t.prototype.setInitialNodeLocationOnlyOffsetRegular=function(t){t.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},t.prototype.setInitialNodeLocationFullRecovery=function(t){t.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},t.prototype.setInitialNodeLocationFullRegular=function(t){var e=this.LA(1);t.location={startOffset:e.startOffset,startLine:e.startLine,startColumn:e.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},t.prototype.cstInvocationStateUpdate=function(t,e){var n={name:t,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},t.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},t.prototype.cstPostRuleFull=function(t){var e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==!0?(n.endOffset=e.endOffset,n.endLine=e.endLine,n.endColumn=e.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)},t.prototype.cstPostRuleOnlyOffset=function(t){var e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==!0?n.endOffset=e.endOffset:n.startOffset=NaN},t.prototype.cstPostTerminal=function(t,e){var n,r,i,o=this.CST_STACK[this.CST_STACK.length-1];r=e,i=t,void 0===(n=o).children[i]?n.children[i]=[r]:n.children[i].push(r),this.setNodeLocationFromToken(o.location,e)},t.prototype.cstPostNonTerminal=function(t,e){var n=this.CST_STACK[this.CST_STACK.length-1];!function(t,e,n){void 0===t.children[e]?t.children[e]=[n]:t.children[e].push(n)}(n,e,t),this.setNodeLocationFromNode(n.location,t.location)},t.prototype.getBaseCstVisitorConstructor=function(){if(Object(i.F)(this.baseCstVisitorConstructor)){var t=_e(this.className,Object(i.G)(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor},t.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(Object(i.F)(this.baseCstVisitorWithDefaultsConstructor)){var t=function(t,e,n){var r=function(){};Le(r,t+"BaseSemanticsWithDefaults");var o=Object.create(n.prototype);return Object(i.u)(e,(function(t){o[t]=Ce})),(r.prototype=o).constructor=r,r}(this.className,Object(i.G)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor},t.prototype.getLastExplicitRuleShortName=function(){var t=this.RULE_STACK;return t[t.length-1]},t.prototype.getPreviousExplicitRuleShortName=function(){var t=this.RULE_STACK;return t[t.length-2]},t.prototype.getLastExplicitRuleOccurrenceIndex=function(){var t=this.RULE_OCCURRENCE_STACK;return t[t.length-1]},t}(),Pe=function(){function t(){}return t.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(t.prototype,"input",{get:function(){return this.tokVector},set:function(t){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length},enumerable:!1,configurable:!0}),t.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Je},t.prototype.LA=function(t){var e=this.currIdx+t;return e<0||this.tokVectorLength<=e?Je:this.tokVector[e]},t.prototype.consumeToken=function(){this.currIdx++},t.prototype.exportLexerState=function(){return this.currIdx},t.prototype.importLexerState=function(t){this.currIdx=t},t.prototype.resetLexerState=function(){this.currIdx=-1},t.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},t.prototype.getLexerPosition=function(){return this.exportLexerState()},t}(),je=function(){function t(){}return t.prototype.ACTION=function(t){return t.call(this)},t.prototype.consume=function(t,e,n){return this.consumeInternal(e,t,n)},t.prototype.subrule=function(t,e,n){return this.subruleInternal(e,t,n)},t.prototype.option=function(t,e){return this.optionInternal(e,t)},t.prototype.or=function(t,e){return this.orInternal(e,t)},t.prototype.many=function(t,e){return this.manyInternal(t,e)},t.prototype.atLeastOne=function(t,e){return this.atLeastOneInternal(t,e)},t.prototype.CONSUME=function(t,e){return this.consumeInternal(t,0,e)},t.prototype.CONSUME1=function(t,e){return this.consumeInternal(t,1,e)},t.prototype.CONSUME2=function(t,e){return this.consumeInternal(t,2,e)},t.prototype.CONSUME3=function(t,e){return this.consumeInternal(t,3,e)},t.prototype.CONSUME4=function(t,e){return this.consumeInternal(t,4,e)},t.prototype.CONSUME5=function(t,e){return this.consumeInternal(t,5,e)},t.prototype.CONSUME6=function(t,e){return this.consumeInternal(t,6,e)},t.prototype.CONSUME7=function(t,e){return this.consumeInternal(t,7,e)},t.prototype.CONSUME8=function(t,e){return this.consumeInternal(t,8,e)},t.prototype.CONSUME9=function(t,e){return this.consumeInternal(t,9,e)},t.prototype.SUBRULE=function(t,e){return this.subruleInternal(t,0,e)},t.prototype.SUBRULE1=function(t,e){return this.subruleInternal(t,1,e)},t.prototype.SUBRULE2=function(t,e){return this.subruleInternal(t,2,e)},t.prototype.SUBRULE3=function(t,e){return this.subruleInternal(t,3,e)},t.prototype.SUBRULE4=function(t,e){return this.subruleInternal(t,4,e)},t.prototype.SUBRULE5=function(t,e){return this.subruleInternal(t,5,e)},t.prototype.SUBRULE6=function(t,e){return this.subruleInternal(t,6,e)},t.prototype.SUBRULE7=function(t,e){return this.subruleInternal(t,7,e)},t.prototype.SUBRULE8=function(t,e){return this.subruleInternal(t,8,e)},t.prototype.SUBRULE9=function(t,e){return this.subruleInternal(t,9,e)},t.prototype.OPTION=function(t){return this.optionInternal(t,0)},t.prototype.OPTION1=function(t){return this.optionInternal(t,1)},t.prototype.OPTION2=function(t){return this.optionInternal(t,2)},t.prototype.OPTION3=function(t){return this.optionInternal(t,3)},t.prototype.OPTION4=function(t){return this.optionInternal(t,4)},t.prototype.OPTION5=function(t){return this.optionInternal(t,5)},t.prototype.OPTION6=function(t){return this.optionInternal(t,6)},t.prototype.OPTION7=function(t){return this.optionInternal(t,7)},t.prototype.OPTION8=function(t){return this.optionInternal(t,8)},t.prototype.OPTION9=function(t){return this.optionInternal(t,9)},t.prototype.OR=function(t){return this.orInternal(t,0)},t.prototype.OR1=function(t){return this.orInternal(t,1)},t.prototype.OR2=function(t){return this.orInternal(t,2)},t.prototype.OR3=function(t){return this.orInternal(t,3)},t.prototype.OR4=function(t){return this.orInternal(t,4)},t.prototype.OR5=function(t){return this.orInternal(t,5)},t.prototype.OR6=function(t){return this.orInternal(t,6)},t.prototype.OR7=function(t){return this.orInternal(t,7)},t.prototype.OR8=function(t){return this.orInternal(t,8)},t.prototype.OR9=function(t){return this.orInternal(t,9)},t.prototype.MANY=function(t){this.manyInternal(0,t)},t.prototype.MANY1=function(t){this.manyInternal(1,t)},t.prototype.MANY2=function(t){this.manyInternal(2,t)},t.prototype.MANY3=function(t){this.manyInternal(3,t)},t.prototype.MANY4=function(t){this.manyInternal(4,t)},t.prototype.MANY5=function(t){this.manyInternal(5,t)},t.prototype.MANY6=function(t){this.manyInternal(6,t)},t.prototype.MANY7=function(t){this.manyInternal(7,t)},t.prototype.MANY8=function(t){this.manyInternal(8,t)},t.prototype.MANY9=function(t){this.manyInternal(9,t)},t.prototype.MANY_SEP=function(t){this.manySepFirstInternal(0,t)},t.prototype.MANY_SEP1=function(t){this.manySepFirstInternal(1,t)},t.prototype.MANY_SEP2=function(t){this.manySepFirstInternal(2,t)},t.prototype.MANY_SEP3=function(t){this.manySepFirstInternal(3,t)},t.prototype.MANY_SEP4=function(t){this.manySepFirstInternal(4,t)},t.prototype.MANY_SEP5=function(t){this.manySepFirstInternal(5,t)},t.prototype.MANY_SEP6=function(t){this.manySepFirstInternal(6,t)},t.prototype.MANY_SEP7=function(t){this.manySepFirstInternal(7,t)},t.prototype.MANY_SEP8=function(t){this.manySepFirstInternal(8,t)},t.prototype.MANY_SEP9=function(t){this.manySepFirstInternal(9,t)},t.prototype.AT_LEAST_ONE=function(t){this.atLeastOneInternal(0,t)},t.prototype.AT_LEAST_ONE1=function(t){return this.atLeastOneInternal(1,t)},t.prototype.AT_LEAST_ONE2=function(t){this.atLeastOneInternal(2,t)},t.prototype.AT_LEAST_ONE3=function(t){this.atLeastOneInternal(3,t)},t.prototype.AT_LEAST_ONE4=function(t){this.atLeastOneInternal(4,t)},t.prototype.AT_LEAST_ONE5=function(t){this.atLeastOneInternal(5,t)},t.prototype.AT_LEAST_ONE6=function(t){this.atLeastOneInternal(6,t)},t.prototype.AT_LEAST_ONE7=function(t){this.atLeastOneInternal(7,t)},t.prototype.AT_LEAST_ONE8=function(t){this.atLeastOneInternal(8,t)},t.prototype.AT_LEAST_ONE9=function(t){this.atLeastOneInternal(9,t)},t.prototype.AT_LEAST_ONE_SEP=function(t){this.atLeastOneSepFirstInternal(0,t)},t.prototype.AT_LEAST_ONE_SEP1=function(t){this.atLeastOneSepFirstInternal(1,t)},t.prototype.AT_LEAST_ONE_SEP2=function(t){this.atLeastOneSepFirstInternal(2,t)},t.prototype.AT_LEAST_ONE_SEP3=function(t){this.atLeastOneSepFirstInternal(3,t)},t.prototype.AT_LEAST_ONE_SEP4=function(t){this.atLeastOneSepFirstInternal(4,t)},t.prototype.AT_LEAST_ONE_SEP5=function(t){this.atLeastOneSepFirstInternal(5,t)},t.prototype.AT_LEAST_ONE_SEP6=function(t){this.atLeastOneSepFirstInternal(6,t)},t.prototype.AT_LEAST_ONE_SEP7=function(t){this.atLeastOneSepFirstInternal(7,t)},t.prototype.AT_LEAST_ONE_SEP8=function(t){this.atLeastOneSepFirstInternal(8,t)},t.prototype.AT_LEAST_ONE_SEP9=function(t){this.atLeastOneSepFirstInternal(9,t)},t.prototype.RULE=function(t,e,n){if(void 0===n&&(n=tn),Object(i.j)(this.definedRulesNames,t)){var r={message:Ct.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:Qe.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(r)}this.definedRulesNames.push(t);var o=this.defineRule(t,e,n);return this[t]=o,o},t.prototype.OVERRIDE_RULE=function(t,e,n){void 0===n&&(n=tn);var r,o,a,s,c,u=[];u=u.concat((r=t,o=this.definedRulesNames,a=this.className,c=[],i.j(o,r)||(s="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+a+"<-as it is not defined in any of the super grammars ",c.push({message:s,type:Qe.INVALID_RULE_OVERRIDE,ruleName:r})),c)),this.definitionErrors.push.apply(this.definitionErrors,u);var l=this.defineRule(t,e,n);return this[t]=l,l},t.prototype.BACKTRACK=function(t,e){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return t.apply(this,e),!0}catch(t){if(fe(t))return!1;throw t}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},t.prototype.getGAstProductions=function(){return this.gastProductionsCache},t.prototype.getSerializedGastProductions=function(){return dt(Object(i.U)(this.gastProductionsCache))},t}(),we=function(){function t(){}return t.prototype.initRecognizerEngine=function(t,e){if(this.className=ke(this.constructor),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=F,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Object(i.w)(e,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(Object(i.y)(t)){if(Object(i.A)(t))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof t[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(Object(i.y)(t))this.tokensMap=Object(i.O)(t,(function(t,e){return t[e.name]=e,t}),{});else if(Object(i.w)(t,"modes")&&Object(i.o)(Object(i.t)(Object(i.U)(t.modes)),V)){var n=Object(i.t)(Object(i.U)(t.modes)),r=Object(i.T)(n);this.tokensMap=Object(i.O)(r,(function(t,e){return t[e.name]=e,t}),{})}else{if(!Object(i.C)(t))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=Object(i.h)(t)}this.tokensMap.EOF=Z;var o=Object(i.o)(Object(i.U)(t),(function(t){return Object(i.A)(t.categoryMatches)}));this.tokenMatcher=o?F:U,G(Object(i.U)(this.tokensMap))},t.prototype.defineRule=function(t,e,n){if(this.selfAnalysisDone)throw Error("Grammar rule <"+t+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var r,o=Object(i.w)(n,"resyncEnabled")?n.resyncEnabled:tn.resyncEnabled,a=Object(i.w)(n,"recoveryValueFunc")?n.recoveryValueFunc:tn.recoveryValueFunc,s=this.ruleShortNameIdx<<12;function c(t){try{if(!0===this.outputCst){e.apply(this,t);var n=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(n),n}return e.apply(this,t)}catch(t){return this.invokeRuleCatch(t,o,a)}finally{this.ruleFinallyStateUpdate()}}this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=t,this.fullRuleNameToShort[t]=s;return(r=function(e,n){return void 0===e&&(e=0),this.ruleInvocationStateUpdate(s,t,e),c.call(this,n)}).ruleName=t,r.originalGrammarAction=e,r},t.prototype.invokeRuleCatch=function(t,e,n){var r=1===this.RULE_STACK.length,i=e&&!this.isBackTracking()&&this.recoveryEnabled;if(fe(t)){var o=t;if(i){var a,s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s))return o.resyncedTokens=this.reSyncTo(s),this.outputCst?((a=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,a):n();throw this.outputCst&&((a=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,o.partialCstResult=a),o}if(r)return this.moveToTerminatedState(),n();throw o}throw t},t.prototype.optionInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(512,e);return this.optionInternalLogic(t,e,n)},t.prototype.optionInternalLogic=function(t,e,n){var r,i,o=this,a=this.getLaFuncFromCache(n);if(void 0!==t.DEF){if(r=t.DEF,void 0!==(i=t.GATE)){var s=a;a=function(){return i.call(o)&&s.call(o)}}}else r=t;if(!0===a.call(this))return r.call(this)},t.prototype.atLeastOneInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(1024,t);return this.atLeastOneInternalLogic(t,e,n)},t.prototype.atLeastOneInternalLogic=function(t,e,n){var r,i,o=this,a=this.getLaFuncFromCache(n);if(void 0!==e.DEF){if(r=e.DEF,void 0!==(i=e.GATE)){var s=a;a=function(){return i.call(o)&&s.call(o)}}}else r=e;if(!0!==a.call(this))throw this.raiseEarlyExitException(t,Kt.REPETITION_MANDATORY,e.ERR_MSG);for(var c=this.doSingleRepetition(r);!0===a.call(this)&&!0===c;)c=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,e],a,1024,t,Ft)},t.prototype.atLeastOneSepFirstInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(1536,t);this.atLeastOneSepFirstInternalLogic(t,e,n)},t.prototype.atLeastOneSepFirstInternalLogic=function(t,e,n){var r=this,i=e.DEF,o=e.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(t,Kt.REPETITION_MANDATORY_WITH_SEPARATOR,e.ERR_MSG);i.call(this);for(var a=function(){return r.tokenMatcher(r.LA(1),o)};!0===this.tokenMatcher(this.LA(1),o);)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,Dt],a,1536,t,Dt)},t.prototype.manyInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(768,t);return this.manyInternalLogic(t,e,n)},t.prototype.manyInternalLogic=function(t,e,n){var r,i,o=this,a=this.getLaFuncFromCache(n);if(void 0!==e.DEF){if(r=e.DEF,void 0!==(i=e.GATE)){var s=a;a=function(){return i.call(o)&&s.call(o)}}}else r=e;for(var c=!0;!0===a.call(this)&&!0===c;)c=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[t,e],a,768,t,wt,c)},t.prototype.manySepFirstInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(1280,t);this.manySepFirstInternalLogic(t,e,n)},t.prototype.manySepFirstInternalLogic=function(t,e,n){var r=this,i=e.DEF,o=e.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){i.call(this);for(var a=function(){return r.tokenMatcher(r.LA(1),o)};!0===this.tokenMatcher(this.LA(1),o);)this.CONSUME(o),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,o,a,i,Ut],a,1280,t,Ut)}},t.prototype.repetitionSepSecondInternal=function(t,e,n,r,i){for(;n();)this.CONSUME(e),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i],n,1536,t,i)},t.prototype.doSingleRepetition=function(t){var e=this.getLexerPosition();return t.call(this),this.getLexerPosition()>e},t.prototype.orInternal=function(t,e){var n=this.getKeyForAutomaticLookahead(256,e),r=Object(i.y)(t)?t:t.DEF,o=this.getLaFuncFromCache(n).call(this,r);if(void 0!==o)return r[o].ALT.call(this);this.raiseNoAltException(e,t.ERR_MSG)},t.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var t=this.LA(1),e=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Oe(e,t))}},t.prototype.subruleInternal=function(t,e,n){var r;try{var i=void 0!==n?n.ARGS:void 0;return r=t.call(this,e,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:t.ruleName),r}catch(e){this.subruleInternalError(e,n,t.ruleName)}},t.prototype.subruleInternalError=function(t,e,n){throw fe(t)&&void 0!==t.partialCstResult&&(this.cstPostNonTerminal(t.partialCstResult,void 0!==e&&void 0!==e.LABEL?e.LABEL:n),delete t.partialCstResult),t},t.prototype.consumeInternal=function(t,e,n){var r;try{var i=this.LA(1);!0===this.tokenMatcher(i,t)?(this.consumeToken(),r=i):this.consumeInternalError(t,i,n)}catch(n){r=this.consumeInternalRecovery(t,e,n)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:t.name,r),r},t.prototype.consumeInternalError=function(t,e,n){var r,i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:e,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new de(r,e,i))},t.prototype.consumeInternalRecovery=function(t,e,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;var r=this.getFollowsForInRuleRecovery(t,e);try{return this.tryInRuleRecovery(t,r)}catch(t){throw"InRuleRecoveryException"===t.name?n:t}},t.prototype.saveRecogState=function(){var t=this.errors,e=Object(i.g)(this.RULE_STACK);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:e,CST_STACK:this.CST_STACK}},t.prototype.reloadRecogState=function(t){this.errors=t.errors,this.importLexerState(t.lexerState),this.RULE_STACK=t.RULE_STACK},t.prototype.ruleInvocationStateUpdate=function(t,e,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(t),this.cstInvocationStateUpdate(e,t)},t.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},t.prototype.getCurrRuleFullName=function(){var t=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[t]},t.prototype.shortRuleNameToFullName=function(t){return this.shortRuleNameToFull[t]},t.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),Z)},t.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},t}(),Ue=function(){function t(){}return t.prototype.initErrorHandler=function(t){this._errors=[],this.errorMessageProvider=Object(i.w)(t,"errorMessageProvider")?t.errorMessageProvider:Ze.errorMessageProvider},t.prototype.SAVE_ERROR=function(t){if(fe(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Object(i.g)(this.RULE_OCCURRENCE_STACK)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(t.prototype,"errors",{get:function(){return Object(i.g)(this._errors)},set:function(t){this._errors=t},enumerable:!1,configurable:!0}),t.prototype.raiseEarlyExitException=function(t,e,n){for(var r=this.getCurrRuleFullName(),i=Qt(t,this.getGAstProductions()[r],e,this.maxLookahead)[0],o=[],a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));var s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new ve(s,this.LA(1),this.LA(0)))},t.prototype.raiseNoAltException=function(t,e){for(var n=this.getCurrRuleFullName(),r=Jt(t,this.getGAstProductions()[n],this.maxLookahead),i=[],o=1;o<=this.maxLookahead;o++)i.push(this.LA(o));var a=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:e,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new me(s,this.LA(1),a))},t}(),Fe=function(){function t(){}return t.prototype.initContentAssist=function(){},t.prototype.computeContentAssist=function(t,e){var n=this.gastProductionsCache[t];if(Object(i.F)(n))throw Error("Rule ->"+t+"<- does not exist in this grammar.");return Gt([n],e,this.tokenMatcher,this.maxLookahead)},t.prototype.getNextPossibleTokenTypes=function(t){var e=Object(i.s)(t.ruleStack),n=this.getGAstProductions()[e];return new Pt(n,t).startWalking()},t}(),De={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(De);var Be=Math.pow(2,8)-1,Ge=Q({name:"RECORDING_PHASE_TOKEN",pattern:X.NA});G([Ge]);var We=tt(Ge,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(We);var Ke={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording for details",children:{}},Ve=function(){function t(){}return t.prototype.initGastRecorder=function(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1},t.prototype.enableRecording=function(){var t=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",(function(){for(var e=function(e){var n=e>0?e:"";t["CONSUME"+n]=function(t,n){return this.consumeInternalRecord(t,e,n)},t["SUBRULE"+n]=function(t,n){return this.subruleInternalRecord(t,e,n)},t["OPTION"+n]=function(t){return this.optionInternalRecord(t,e)},t["OR"+n]=function(t){return this.orInternalRecord(t,e)},t["MANY"+n]=function(t){this.manyInternalRecord(e,t)},t["MANY_SEP"+n]=function(t){this.manySepFirstInternalRecord(e,t)},t["AT_LEAST_ONE"+n]=function(t){this.atLeastOneInternalRecord(e,t)},t["AT_LEAST_ONE_SEP"+n]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}},n=0;n<10;n++)e(n);t.consume=function(t,e,n){return this.consumeInternalRecord(e,t,n)},t.subrule=function(t,e,n){return this.subruleInternalRecord(e,t,n)},t.option=function(t,e){return this.optionInternalRecord(e,t)},t.or=function(t,e){return this.orInternalRecord(e,t)},t.many=function(t,e){this.manyInternalRecord(t,e)},t.atLeastOne=function(t,e){this.atLeastOneInternalRecord(t,e)},t.ACTION=t.ACTION_RECORD,t.BACKTRACK=t.BACKTRACK_RECORD,t.LA=t.LA_RECORD}))},t.prototype.disableRecording=function(){var t=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",(function(){for(var e=0;e<10;e++){var n=e>0?e:"";delete t["CONSUME"+n],delete t["SUBRULE"+n],delete t["OPTION"+n],delete t["OR"+n],delete t["MANY"+n],delete t["MANY_SEP"+n],delete t["AT_LEAST_ONE"+n],delete t["AT_LEAST_ONE_SEP"+n]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA}))},t.prototype.ACTION_RECORD=function(t){},t.prototype.BACKTRACK_RECORD=function(t,e){return function(){return!0}},t.prototype.LA_RECORD=function(t){return Je},t.prototype.topLevelRuleRecord=function(t,e){try{var n=new ot({definition:[],name:t});return n.name=t,this.recordingProdStack.push(n),e.call(this),this.recordingProdStack.pop(),n}catch(t){if(!0!==t.KNOWN_RECORDER_ERROR)try{t.message=t.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://sap.github.io/chevrotain/docs/guide/internals.html#grammar-recording'}catch(e){throw t}throw t}},t.prototype.optionInternalRecord=function(t,e){return He.call(this,st,t,e)},t.prototype.atLeastOneInternalRecord=function(t,e){He.call(this,ct,e,t)},t.prototype.atLeastOneSepFirstInternalRecord=function(t,e){He.call(this,ut,e,t,!0)},t.prototype.manyInternalRecord=function(t,e){He.call(this,lt,e,t)},t.prototype.manySepFirstInternalRecord=function(t,e){He.call(this,ht,e,t,!0)},t.prototype.orInternalRecord=function(t,e){return ze.call(this,t,e)},t.prototype.subruleInternalRecord=function(t,e,n){if(Xe(e),!t||!1===Object(i.w)(t,"ruleName")){var r=new Error("<SUBRULE"+Ye(e)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(t)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw r.KNOWN_RECORDER_ERROR=!0,r}var o=Object(i.M)(this.recordingProdStack),a=t.ruleName,s=new it({idx:e,nonTerminalName:a,referencedRule:void 0});return o.definition.push(s),this.outputCst?Ke:De},t.prototype.consumeInternalRecord=function(t,e,n){if(Xe(e),!W(t)){var r=new Error("<CONSUME"+Ye(e)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(t)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw r.KNOWN_RECORDER_ERROR=!0,r}var o=Object(i.M)(this.recordingProdStack),a=new ft({idx:e,terminalType:t});return o.definition.push(a),We},t}();function He(t,e,n,r){void 0===r&&(r=!1),Xe(n);var o=Object(i.M)(this.recordingProdStack),a=Object(i.B)(e)?e:e.DEF,s=new t({definition:[],idx:n});return r&&(s.separator=e.SEP),Object(i.w)(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),o.definition.push(s),this.recordingProdStack.pop(),De}function ze(t,e){var n=this;Xe(e);var r=Object(i.M)(this.recordingProdStack),o=!1===Object(i.y)(t),a=!1===o?t:t.DEF,s=new pt({definition:[],idx:e,ignoreAmbiguities:o&&!0===t.IGNORE_AMBIGUITIES});Object(i.w)(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);var c=Object(i.Q)(a,(function(t){return Object(i.B)(t.GATE)}));return s.hasPredicates=c,r.definition.push(s),Object(i.u)(a,(function(t){var e=new at({definition:[]});s.definition.push(e),Object(i.w)(t,"IGNORE_AMBIGUITIES")?e.ignoreAmbiguities=t.IGNORE_AMBIGUITIES:Object(i.w)(t,"GATE")&&(e.ignoreAmbiguities=!0),n.recordingProdStack.push(e),t.ALT.call(n),n.recordingProdStack.pop()})),De}function Ye(t){return 0===t?"":""+t}function Xe(t){if(t<0||t>Be){var e=new Error("Invalid DSL Method idx value: <"+t+">\n\tIdx value must be a none negative value smaller than "+(Be+1));throw e.KNOWN_RECORDER_ERROR=!0,e}}var $e=function(){function t(){}return t.prototype.initPerformanceTracer=function(t){if(Object(i.w)(t,"traceInitPerf")){var e=t.traceInitPerf,n="number"==typeof e;this.traceInitMaxIdent=n?e:1/0,this.traceInitPerf=n?e>0:e}else this.traceInitMaxIdent=0,this.traceInitPerf=Ze.traceInitPerf;this.traceInitIndent=-1},t.prototype.TRACE_INIT=function(t,e){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--\x3e <"+t+">");var r=Object(i.R)(e),o=r.time,a=r.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+t+"> time: "+o+"ms"),this.traceInitIndent--,a}return e()},t}(),qe=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Je=tt(Z,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Je);var Qe,Ze=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:kt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),tn=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});function en(t){return void 0===t&&(t=void 0),function(){return t}}!function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(Qe||(Qe={}));var nn=function(){function t(t,e){this.definitionErrors=[],this.selfAnalysisDone=!1;if(this.initErrorHandler(e),this.initLexerAdapter(),this.initLooksAhead(e),this.initRecognizerEngine(t,e),this.initRecoverable(e),this.initTreeBuilder(e),this.initContentAssist(),this.initGastRecorder(e),this.initPerformanceTracer(e),Object(i.w)(e,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=Object(i.w)(e,"skipValidations")?e.skipValidations:Ze.skipValidations}return t.performSelfAnalysis=function(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")},t.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",(function(){var n;e.selfAnalysisDone=!0;var r=e.className;e.TRACE_INIT("toFastProps",(function(){Object(i.S)(e)})),e.TRACE_INIT("Grammar Recording",(function(){try{e.enableRecording(),Object(i.u)(e.definedRulesNames,(function(t){var n=e[t].originalGrammarAction,r=void 0;e.TRACE_INIT(t+" Rule",(function(){r=e.topLevelRuleRecord(t,n)})),e.gastProductionsCache[t]=r}))}finally{e.disableRecording()}}));var o=[];if(e.TRACE_INIT("Grammar Resolving",(function(){o=ue({rules:Object(i.U)(e.gastProductionsCache)}),e.definitionErrors.push.apply(e.definitionErrors,o)})),e.TRACE_INIT("Grammar Validations",(function(){if(Object(i.A)(o)&&!1===e.skipValidations){var t=le({rules:Object(i.U)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:Object(i.U)(e.tokensMap),errMsgProvider:Ct,grammarName:r});e.definitionErrors.push.apply(e.definitionErrors,t)}})),Object(i.A)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",(function(){var t,n,r=(t=Object(i.U)(e.gastProductionsCache),n={},Object(i.u)(t,(function(t){var e=new Rt(t).startWalking();Object(i.f)(n,e)})),n);e.resyncFollows=r})),e.TRACE_INIT("ComputeLookaheadFunctions",(function(){e.preComputeLookaheadFunctions(Object(i.U)(e.gastProductionsCache))}))),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!Object(i.A)(e.definitionErrors))throw n=Object(i.I)(e.definitionErrors,(function(t){return t.message})),new Error("Parser Definition Errors detected:\n "+n.join("\n-------------------------------\n"))}))},t.DEFER_DEFINITION_ERRORS_HANDLING=!1,t}();Object(i.e)(nn,[ye,be,Me,Pe,we,je,Ue,Fe,Ve,$e]);var rn=function(t){function e(e,n){void 0===n&&(n=Ze);var r=Object(i.h)(n);return r.outputCst=!0,t.call(this,e,r)||this}return qe(e,t),e}(nn),on=function(t){function e(e,n){void 0===n&&(n=Ze);var r=Object(i.h)(n);return r.outputCst=!1,t.call(this,e,r)||this}return qe(e,t),e}(nn);function an(t,e){var n=void 0===e?{}:e,i=n.resourceBase,o=void 0===i?"https://unpkg.com/chevrotain@"+r+"/diagrams/":i,a=n.css;return'\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset="utf-8">\n<style>\n body {\n background-color: hsl(30, 20%, 95%)\n }\n</style>\n\n'+("\n<link rel='stylesheet' href='"+(void 0===a?"https://unpkg.com/chevrotain@"+r+"/diagrams/diagrams.css":a)+"'>\n")+("\n<script src='"+o+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+o+"src/diagrams_builder.js'><\/script>\n<script src='"+o+"src/diagrams_behavior.js'><\/script>\n<script src='"+o+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div> \n'+("\n<script>\n window.serializedGrammar = "+JSON.stringify(t,null," ")+";\n<\/script>\n")+'\n<script>\n var diagramsDiv = document.getElementById("diagrams");\n main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}var sn="\n";function cn(t){var e;return"\nfunction "+t.name+"(tokenVocabulary, config) {\n // invoke super constructor\n // No support for embedded actions currently, so we can 'hardcode'\n // The use of CstParser.\n chevrotain.CstParser.call(this, tokenVocabulary, config)\n\n const $ = this\n\n "+(e=t.rules,Object(i.I)(e,(function(t){return r=dn(n=1,'$.RULE("'+(e=t).name+'", function() {')+sn,r+=fn(e.definition,n+1),r+=dn(n+1,"})")+sn;var e,n,r})).join("\n")+"\n\n // very important to call this after all the rules have been defined.\n // otherwise the parser may not work correctly as it will lack information\n // derived during the self analysis phase.\n this.performSelfAnalysis(this)\n}\n\n// inheritance as implemented in javascript in the previous decade... :(\n")+t.name+".prototype = Object.create(chevrotain.CstParser.prototype)\n"+t.name+".prototype.constructor = "+t.name+" \n "}function un(t,e){var n=dn(e,"$.OR"+t.idx+"([")+sn,r=Object(i.I)(t.definition,(function(t){return function(t,e){var n=dn(e,"{")+sn;return n+=dn(e+1,"ALT: function() {")+sn,n+=fn(t.definition,e+1),n+=dn(e+1,"}")+sn,n+=dn(e,"}")}(t,e+1)}));return n+=r.join(",\n"),n+=sn+dn(e,"])\n")}function ln(t,e){if(t instanceof it)return function(t,e){return dn(e,"$.SUBRULE"+t.idx+"($."+t.nonTerminalName+")"+sn)}(t,e);if(t instanceof st)return hn("OPTION",t,e);if(t instanceof ct)return hn("AT_LEAST_ONE",t,e);if(t instanceof ut)return hn("AT_LEAST_ONE_SEP",t,e);if(t instanceof ht)return hn("MANY_SEP",t,e);if(t instanceof lt)return hn("MANY",t,e);if(t instanceof pt)return un(t,e);if(t instanceof ft)return function(t,e){var n=t.terminalType.name;return dn(e,"$.CONSUME"+t.idx+"(this.tokensMap."+n+")"+sn)}(t,e);if(t instanceof at)return fn(t.definition,e);throw Error("non exhaustive match")}function hn(t,e,n){var r=dn(n,"$."+(t+e.idx)+"(");return e.separator?(r+="{\n",r+=dn(n+1,"SEP: this.tokensMap."+e.separator.name)+","+sn,r+="DEF: "+pn(e.definition,n+2)+sn,r+=dn(n,"}")+sn):r+=pn(e.definition,n+1),r+=dn(n,")")+sn}function pn(t,e){var n="function() {\n";return n+=fn(t,e),n+=dn(e,"}")+sn}function fn(t,e){var n="";return Object(i.u)(t,(function(t){n+=ln(t,e+1)})),n}function dn(t,e){return Array(4*t+1).join(" ")+e}function mn(t){var e=function(t){return" \n"+cn(t)+"\nreturn new "+t.name+"(tokenVocabulary, config) \n"}({name:t.name,rules:t.rules}),r=new Function("tokenVocabulary","config","chevrotain",e);return function(e){return r(t.tokenVocabulary,e,n(3))}}function On(t){return function(t){return"\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['chevrotain'], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require('chevrotain'));\n } else {\n // Browser globals (root is window)\n root.returnExports = factory(root.b);\n }\n}(typeof self !== 'undefined' ? self : this, function (chevrotain) {\n\n"+cn(t)+"\n \nreturn {\n "+t.name+": "+t.name+" \n}\n}));\n"}({name:t.name,rules:t.rules})}function vn(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n\t It performs no action other than printing this message.\n\t Please avoid using it as it will be completely removed in the future")}var Tn=function(){throw new Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.\t\nSee: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_7-0-0")}},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(e,"__esModule",{value:!0}),e.AllTokens=e.Outdent=e.Indent=e.StringLiteral=e.NumberLiteral=e.Identifier=e.MultilineComment=e.SingleLineComment=e.WS=e.EndOfLine=e.OrMore=e.CaseSensitive=e.CaseInsensitive=e.CarriageReturn=e.Newline=e.Repeat=e.Called=e.Create=e.To=e.From=e.Exclusive=e.Inclusive=e.Exactly=e.Times=e.A=e.Group=e.Linefeed=e.Tab=e.Between=e.Not=e.Matching=e.Exact=e.Multiline=e.Global=e.Using=e.Number=e.Whitespace=e.Character=e.Digit=e.Word=e.And=e.Or=e.Anything=e.Then=e.Match=e.Optional=e.Ten=e.Nine=e.Eight=e.Seven=e.Six=e.Five=e.Four=e.Three=e.Two=e.One=e.Zero=void 0;const r=n(3);e.Zero=r.createToken({name:"Zero",pattern:/zero/i}),e.One=r.createToken({name:"One",pattern:/one/i}),e.Two=r.createToken({name:"Two",pattern:/two/i}),e.Three=r.createToken({name:"Three",pattern:/three/i}),e.Four=r.createToken({name:"Four",pattern:/four/i}),e.Five=r.createToken({name:"Five",pattern:/five/i}),e.Six=r.createToken({name:"Six",pattern:/six/i}),e.Seven=r.createToken({name:"Seven",pattern:/seven/i}),e.Eight=r.createToken({name:"Eight",pattern:/eight/i}),e.Nine=r.createToken({name:"Nine",pattern:/nine/i}),e.Ten=r.createToken({name:"Ten",pattern:/ten/i}),e.Optional=r.createToken({name:"Optional",pattern:/optional(ly)?/i}),e.Match=r.createToken({name:"Match",pattern:/match(es)?/i}),e.Then=r.createToken({name:"Then",pattern:/then/i}),e.Anything=r.createToken({name:"Anything",pattern:/(any thing|any|anything)(s)?/i}),e.Or=r.createToken({name:"Or",pattern:/or/i}),e.And=r.createToken({name:"And",pattern:/and|,/i}),e.Word=r.createToken({name:"WordSpecifier",pattern:/word(s)?/i}),e.Digit=r.createToken({name:"DigitSpecifier",pattern:/digit(s)?/i}),e.Character=r.createToken({name:"CharacterSpecifier",pattern:/character(s)?/i}),e.Whitespace=r.createToken({name:"WhitespaceSpecifier",pattern:/(white space|whitespace)(s)?/i}),e.Number=r.createToken({name:"NumberSpecifier",pattern:/number(s)?/i}),e.Using=r.createToken({name:"Using",pattern:/using/i}),e.Global=r.createToken({name:"Global",pattern:/global/i}),e.Multiline=r.createToken({name:"Multiline",pattern:/(multi line|multiline)/i}),e.Exact=r.createToken({name:"Exact",pattern:/exact/i}),e.Matching=r.createToken({name:"Matching",pattern:/matching/i}),e.Not=r.createToken({name:"Not",pattern:/not/i}),e.Between=r.createToken({name:"Between",pattern:/between/i}),e.Tab=r.createToken({name:"Tab",pattern:/tab/i}),e.Linefeed=r.createToken({name:"Linefeed",pattern:/(line feed|linefeed)/i}),e.Group=r.createToken({name:"Group",pattern:/group/i}),e.A=r.createToken({name:"A",pattern:/a(n)?/i}),e.Times=r.createToken({name:"Times",pattern:/times/i}),e.Exactly=r.createToken({name:"Exactly",pattern:/exact(ly)?/i}),e.Inclusive=r.createToken({name:"Inclusive",pattern:/inclusive(ly)?/i}),e.Exclusive=r.createToken({name:"Exclusive",pattern:/exclusive(ly)?/i}),e.From=r.createToken({name:"From",pattern:/from/i}),e.To=r.createToken({name:"To",pattern:/(to|through|thru|\-|\.\.|\.\.\.)/i}),e.Create=r.createToken({name:"Create",pattern:/create(s)?/i}),e.Called=r.createToken({name:"Called",pattern:/name(d)?|call(ed)?/i}),e.Repeat=r.createToken({name:"Repeat",pattern:/repeat(s|ing)?/i}),e.Newline=r.createToken({name:"Newline",pattern:/(new line|newline)/i}),e.CarriageReturn=r.createToken({name:"CarriageReturn",pattern:/carriage return/i}),e.CaseInsensitive=r.createToken({name:"CaseInsensitive",pattern:/case insensitive/i}),e.CaseSensitive=r.createToken({name:"CaseSensitive",pattern:/case sensitive/i}),e.OrMore=r.createToken({name:"OrMore",pattern:/\+|or more/i}),e.EndOfLine=r.createToken({name:"EOL",pattern:/\n/}),e.WS=r.createToken({name:"Whitespace",pattern:/\s+/,group:r.Lexer.SKIPPED}),e.SingleLineComment=r.createToken({name:"SingleLineComment",pattern:/(#|\/\/).*/,group:r.Lexer.SKIPPED}),e.MultilineComment=r.createToken({name:"MultiLineComment",pattern:/\/\*(.*)\*\//,line_breaks:!0,group:r.Lexer.SKIPPED}),e.Identifier=r.createToken({name:"Identifier",pattern:/[a-z]\w*/i}),e.NumberLiteral=r.createToken({name:"NumberLiteral",pattern:/-?\d+/}),e.StringLiteral=r.createToken({name:"StringLiteral",pattern:/"(?:[^\\"]|\\(?:[bfnrtv"\\/]|u[0-9a-f]{4}|U[0-9a-f]{8}))*"/i}),e.Indent=r.createToken({name:"Indent"}),e.Outdent=r.createToken({name:"Outdent"}),e.AllTokens=[e.Zero,e.One,e.Two,e.Three,e.Four,e.Five,e.Six,e.Seven,e.Eight,e.Nine,e.Ten,e.Optional,e.Matching,e.Match,e.Then,e.Anything,e.And,e.Word,e.Digit,e.Character,e.Whitespace,e.Number,e.Using,e.Global,e.Multiline,e.Exact,e.Not,e.Between,e.Tab,e.Linefeed,e.Group,e.A,e.Times,e.Exactly,e.Inclusive,e.Exclusive,e.From,e.Create,e.Called,e.Repeat,e.Newline,e.CarriageReturn,e.CaseInsensitive,e.CaseSensitive,e.OrMore,e.Or,e.To,e.EndOfLine,e.Indent,e.WS,e.SingleLineComment,e.MultilineComment,e.Identifier,e.NumberLiteral,e.StringLiteral]},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(e,"__esModule",{value:!0}),e.RegularExpressionCST=e.GroupStatementCST=e.RepeatStatementCST=e.MatchStatementCST=e.CountSubStatementCST=e.UsingStatementCST=e.MatchSubStatementCST=e.StatementCST=e.MatchStatementValue=e.MatchSubStatementValue=e.MatchSubStatementType=e.UsingFlags=e.H2RCST=e.RobotLanguage=void 0;const r=n(2);var i,o,a;!function(t){t[t.JS=0]="JS",t[t.Perl=1]="Perl",t[t.DotNet=2]="DotNet",t[t.Java=3]="Java"}(i=e.RobotLanguage||(e.RobotLanguage={}));class s{constructor(t){this.tokens=t}error(t){var e,n,i;const o=r.first(this.tokens),a=r.last(this.tokens);return{startLine:null!==(e=o.startLine)&&void 0!==e?e:NaN,startColumn:null!==(n=o.startColumn)&&void 0!==n?n:NaN,length:(null!==(i=a.endOffset)&&void 0!==i?i:a.startOffset)-o.startOffset,message:t}}}e.H2RCST=s,function(t){t[t.Multiline=1]="Multiline",t[t.Global=2]="Global",t[t.Sensitive=4]="Sensitive",t[t.Insensitive=8]="Insensitive",t[t.Exact=16]="Exact"}(o=e.UsingFlags||(e.UsingFlags={})),function(t){t[t.SingleString=0]="SingleString",t[t.Between=1]="Between",t[t.Anything=2]="Anything",t[t.Word=3]="Word",t[t.Digit=4]="Digit",t[t.Character=5]="Character",t[t.Whitespace=6]="Whitespace",t[t.Number=7]="Number",t[t.Tab=8]="Tab",t[t.Linefeed=9]="Linefeed",t[t.Newline=10]="Newline",t[t.CarriageReturn=11]="CarriageReturn"}(a=e.MatchSubStatementType||(e.MatchSubStatementType={}));e.MatchSubStatementValue=class{constructor(t,e=null,n=null){this.type=t,this.from=e,this.to=n}};e.MatchStatementValue=class{constructor(t,e){this.optional=t,this.statement=e}};class c extends s{}e.StatementCST=c;e.MatchSubStatementCST=class extends s{constructor(t,e,n=!1,r){super(t),this.tokens=t,this.count=e,this.invert=n,this.values=r}validate(t){let e=[];this.count&&(e=e.concat(this.count.validate(t)));for(const t of this.values)if(t.type===a.Between){let n=t.from,i=t.to;r.isSingleRegexCharacter(n)?(n.startsWith("\\u")||n.startsWith("\\U")||n.startsWith("\\"))&&(n=JSON.parse(`"${r.regexEscape(n)}"`)):e.push(this.error("Between statement must begin with a single character")),r.isSingleRegexCharacter(i)?(i.startsWith("\\u")||i.startsWith("\\U")||i.startsWith("\\"))&&(i=JSON.parse(`"${r.regexEscape(i)}"`)):e.push(this.error("Between statement must end with a single character")),n.charCodeAt(0)>=i.charCodeAt(0)&&e.push(this.error("Between statement range invalid"))}return e}toRegex(t){const e=[];for(const t of this.values)switch(t.type){case a.SingleString:{const n=r.regexEscape(r.removeQuotes(t.from));e.push(this.invert?`(?:(?!${n}))`:n);break}case a.Between:e.push(this.invert?`[^${t.from}-${t.to}]`:`[${t.from}-${t.to}]`);break;case a.Word:e.push(this.invert?"\\W+":"\\w+");break;case a.Digit:e.push(this.invert?"\\D":"\\d");break;case a.Character:e.push(this.invert?"\\W":"\\w");break;case a.Whitespace:e.push(this.invert?"\\S":"\\s");break;case a.Number:e.push(this.invert?"\\D+":"\\d+");break;case a.Tab:e.push(this.invert?"[^\\t]":"\\t");break;case a.Newline:case a.Linefeed:e.push(this.invert?"[^\\n]":"\\n");break;case a.CarriageReturn:e.push(this.invert?"[^\\r]":"\\r");break;default:e.push(this.invert?"[^.]":".")}let n="";return n=1===e.length?e[0]:e.every(r.isSingleRegexCharacter)?"["+e.join("")+"]":"(?:"+e.join("|")+")",this.count&&(1===this.count.from&&null===this.count.to?"+"===this.count.opt&&(n+="+"):0===this.count.from&&null===this.count.to?"+"===this.count.opt?n+="*":n="":n+=this.count.toRegex(t)),n}};e.UsingStatementCST=class extends s{constructor(t,e){super(t),this.tokens=t,this.flags=e}validate(t){const e=[];let n=this.flags[0];for(let t=1;t<this.flags.length;t++)r.hasFlag(n,this.flags[t])&&e.push(this.error("Duplicate modifier: "+a[this.flags[t]])),n=r.combineFlags(n,this.flags[t]);return r.hasFlag(n,o.Sensitive)&&r.hasFlag(n,o.Insensitive)&&e.push(this.error("Cannot be both case sensitive and insensitive")),e}toRegex(t){let e="",n=!1;for(const t of this.flags)r.hasFlag(t,o.Multiline)?e+="m":r.hasFlag(t,o.Global)?e+="g":r.hasFlag(t,o.Insensitive)?e+="i":r.hasFlag(t,o.Exact)&&(n=!0);return n?"/^{regex}$/"+e:"/{regex}/"+e}};e.CountSubStatementCST=class extends s{constructor(t,e,n=null,r=null){super(t),this.tokens=t,this.from=e,this.to=n,this.opt=r}validate(t){const e=[];return this.from<0?e.push(this.error("Value cannot be negative")):null!==this.to&&("exclusive"===this.opt&&this.to-1<=this.from||this.to<=this.from)&&e.push(this.error("Values must be in range of eachother")),e}toRegex(t){const e=this.from;let n=this.to;return null!==n&&"exclusive"===this.opt&&n--,null!==n?`{${e},${n}}`:"+"===this.opt?`{${e},}`:`{${this.from}}`}};e.MatchStatementCST=class extends c{constructor(t,e){super(t),this.tokens=t,this.matches=e}validate(t){let e=[];for(const n of this.matches)e=e.concat(n.statement.validate(t));return e}toRegex(t){return this.matches.map(e=>e.statement.toRegex(t)+(e.optional?"?":"")).join("")}};e.RepeatStatementCST=class extends c{constructor(t,e,n,r){super(t),this.tokens=t,this.optional=e,this.count=n,this.statements=r}validate(t){let e=[];null!==this.count&&(e=e.concat(this.count.validate(t)));for(const n of this.statements)e=e.concat(n.validate(t));return e}toRegex(t){let e="("+this.statements.map(e=>e.toRegex(t)).join("")+")";return null!==this.count?1===this.count.from&&null===this.count.to?"+"===this.count.opt&&(e+="+"):0===this.count.from&&null===this.count.to?"+"===this.count.opt?e+="*":e="":e+=this.count.toRegex(t):e+="*",e}};e.GroupStatementCST=class extends c{constructor(t,e,n,r){super(t),this.tokens=t,this.optional=e,this.name=n,this.statements=r}validate(t){let e=[];t!==i.DotNet&&t!==i.JS&&e.push(this.error("This language does not support named groups"));for(const n of this.statements)e=e.concat(n.validate(t));return e}toRegex(t){let e="(";return null!==this.name&&(e+=`?<${this.name}>`),e+=this.statements.map(e=>e.toRegex(t)).join(""),e+=")",this.optional&&(e+="?"),e}};e.RegularExpressionCST=class extends s{constructor(t,e,n){super(t),this.tokens=t,this.usings=e,this.statements=n}validate(t){let e=this.usings.validate(t);for(const n of this.statements)e=e.concat(n.validate(t));return e}toRegex(t){const e=this.usings.toRegex(t),n=this.statements.map(e=>e.toRegex(t)).join("");return e.replace("{regex}",n)}}},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(e,"__esModule",{value:!0}),n(7);const r=n(8),i=n(9),o=n(5),a=n(2),s=new r.Human2RegexLexer(new r.Human2RegexLexerOptions(!1)),c=new i.Human2RegexParser(new i.Human2RegexParserOptions(!1));console.time("tokenize");const u=s.tokenize('\n// H2R supports // # and /**/ as comments\n// A group is only captured if given a name. \n// You can use "and", "or", "not" to specify "[]" regex\n// You can use "then" to combine match statements, however I find using multiple "match" statements easier to read\n\n// exact matching means use a ^ and $ to signify the start and end of the string\n\nusing global and exact matching\ncreate an optional group called protocol\n\tmatch "http"\n\toptionally match "s"\n\tmatch "://"\ncreate an optional group called subdomain\n\trepeat\n\t\tmatch a word\n\t\tmatch "."\ncreate a group called domain\n\tmatch 1+ words or "_" or "-"\n\tmatch "."\n\tmatch a word\n# port, but we don\'t care about it, so ignore it\noptionally match ":" then 0+ digits\ncreate an optional group called path\n\trepeat\n\t\tmatch "/"\n\t\tmatch 0+ words or "_" or "-"\ncreate an optional group\n\t# we don\'t want to capture the \'?\', so don\'t name the group until afterwards\n\tmatch "?"\n\tcreate a group called query\n\t\trepeat\n\t\t\tmatch 1+ words or "_" or "-"\n\t\t\tmatch "="\n\t\t\tmatch 1+ words or "_" or "-"\ncreate an optional group\n\t# fragment, again, we don\'t care, so ignore everything afterwards\n\tmatch "#"\n\tmatch 0+ any thing\n');console.timeEnd("tokenize");const l=[];if(u.errors.map(a.lexErrorToCommonError).forEach(t=>l.push(t)),0===l.length){c.input=u.tokens,console.time("parse");const t=c.parse();console.timeEnd("parse"),c.errors.map(a.parseErrorToCommonError).forEach(t=>l.push(t)),console.time("validate");const e=t.validate(o.RobotLanguage.JS);if(console.timeEnd("validate"),e.map(a.semanticErrorToCommonError).forEach(t=>l.push(t)),0===l.length){console.time("to regex");const e=t.toRegex(o.RobotLanguage.JS);console.timeEnd("to regex"),console.log(e)}}console.log("Errors = "+l)},function(t,e,n){"use strict";n.r(e)},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(e,"__esModule",{value:!0}),e.Human2RegexLexer=e.Human2RegexLexerOptions=e.IndentType=void 0;const r=n(3),i=n(2),o=n(4);var a;!function(t){t[t.Tabs=0]="Tabs",t[t.Spaces=1]="Spaces",t[t.Both=2]="Both"}(a=e.IndentType||(e.IndentType={}));class s{constructor(t=!1,e=a.Both,n=4){this.skip_validations=t,this.type=e,this.spaces_per_tab=n}}e.Human2RegexLexerOptions=s;class c{constructor(t=new s){if(c.already_init)throw new Error("Only 1 instance of Human2RegexLexer allowed");c.already_init=!0,this.setOptions(t)}setOptions(t){this.options=t;let e=null;if(this.options.type===a.Tabs)e=/\t/y;else{let t=` {${this.options.spaces_per_tab}}`;this.options.type===a.Both&&(t+="|\\t"),e=new RegExp(t,"y")}o.Indent.PATTERN=e,this.lexer=new r.Lexer(o.AllTokens,{ensureOptimizations:!0,skipValidations:t.skip_validations})}lexError(t){var e,n,r;return{offset:t.startOffset,line:null!==(e=t.startLine)&&void 0!==e?e:NaN,column:null!==(n=t.startColumn)&&void 0!==n?n:NaN,length:null!==(r=t.endOffset)&&void 0!==r?r:NaN-t.startOffset,message:"Unexpected indentation found"}}tokenize(t){var e,n,a,s,c,u,l,h,p,f,d,m,O,v;const T=this.lexer.tokenize(t);if(0===T.tokens.length)return T;const E=[],y=[0];let g=0,S=!0,b=!1;for(let t=0;t<T.tokens.length;t++)if(T.tokens[t].tokenType===o.EndOfLine)0===E.length||E[E.length-1].tokenType===o.EndOfLine||(S=!0,E.push(T.tokens[t]));else if(T.tokens[t].tokenType===o.Indent){b=!0,g=1;const c=T.tokens[t];let u=T.tokens[t].image.length;for(;T.tokens.length>t&&T.tokens[t+1].tokenType===o.Indent;)g++,t++,u+=T.tokens[t].image.length;if(c.endOffset=c.startOffset+u,c.endColumn=T.tokens[t].endColumn,T.tokens.length>t&&T.tokens[t+1].tokenType===o.EndOfLine);else if(!S||g>i.last(y)+1)T.errors.push(this.lexError(c));else if(g>i.last(y))y.push(g),E.push(c);else if(g<i.last(y)){const t=i.findLastIndex(y,g);if(t<0)T.errors.push(this.lexError(c));else{const i=y.length-t-1;for(let t=0;t<i;t++)y.pop(),E.push(r.createTokenInstance(o.Outdent,"",c.startOffset,c.startOffset+u,null!==(e=c.startLine)&&void 0!==e?e:NaN,null!==(n=c.endLine)&&void 0!==n?n:NaN,null!==(a=c.startColumn)&&void 0!==a?a:NaN,(null!==(s=c.startColumn)&&void 0!==s?s:NaN)+u))}}}else{if(S&&!b){const e=T.tokens[t];for(;y.length>1;)y.pop(),E.push(r.createTokenInstance(o.Outdent,"",e.startOffset,e.startOffset,null!==(c=e.startLine)&&void 0!==c?c:NaN,NaN,null!==(u=e.startColumn)&&void 0!==u?u:NaN,NaN))}S=!1,b=!1,E.push(T.tokens[t])}const N=i.last(E);for(N.tokenType!==o.EndOfLine&&E.push(r.createTokenInstance(o.EndOfLine,"\n",null!==(l=N.endOffset)&&void 0!==l?l:NaN,null!==(h=N.endOffset)&&void 0!==h?h:NaN,null!==(p=N.startLine)&&void 0!==p?p:NaN,NaN,null!==(f=N.startColumn)&&void 0!==f?f:NaN,NaN));y.length>1;)y.pop(),E.push(r.createTokenInstance(o.Outdent,"",null!==(d=N.endOffset)&&void 0!==d?d:NaN,null!==(m=N.endOffset)&&void 0!==m?m:NaN,null!==(O=N.startLine)&&void 0!==O?O:NaN,NaN,null!==(v=N.startColumn)&&void 0!==v?v:NaN,NaN));return T.tokens=E,T}}e.Human2RegexLexer=c,c.already_init=!1},function(t,e,n){"use strict";
|
||
/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.Human2RegexParser=e.Human2RegexParserOptions=void 0;const a=n(3),s=o(n(4)),c=n(5),u=n(2);class l{constructor(t=!1){this.skip_validations=t}}e.Human2RegexParserOptions=l;class h{constructor(t,e){this.token=t,this.value=e}}class p{constructor(t,e){this.tokens=t,this.value=e}}class f extends a.EmbeddedActionsParser{constructor(t=new l){if(super(s.AllTokens,{recoveryEnabled:!1,maxLookahead:2,skipValidations:t.skip_validations}),this.options=t,f.already_init)throw new Error("Only 1 instance of Human2RegexParser allowed");f.already_init=!0;const e=this;let n=null;const r=e.RULE("NumberSubStatement",()=>e.OR(n||(n=[{ALT:()=>new h(e.CONSUME(s.Zero),0)},{ALT:()=>new h(e.CONSUME(s.One),1)},{ALT:()=>new h(e.CONSUME(s.Two),2)},{ALT:()=>new h(e.CONSUME(s.Three),3)},{ALT:()=>new h(e.CONSUME(s.Four),4)},{ALT:()=>new h(e.CONSUME(s.Five),5)},{ALT:()=>new h(e.CONSUME(s.Six),6)},{ALT:()=>new h(e.CONSUME(s.Seven),7)},{ALT:()=>new h(e.CONSUME(s.Eight),8)},{ALT:()=>new h(e.CONSUME(s.Nine),9)},{ALT:()=>new h(e.CONSUME(s.Ten),10)},{ALT:()=>{const t=e.CONSUME(s.NumberLiteral);return new h(t,parseInt(t.image))}}]))),i=e.RULE("CountSubStatement",()=>e.OR([{ALT:()=>{const t=[];t.push(e.CONSUME(s.Between));const n=e.SUBRULE4(r);e.OR3([{ALT:()=>e.CONSUME2(s.To)},{ALT:()=>e.CONSUME(s.And)}]);const i=e.SUBRULE5(r);t.push(i.token),e.OPTION4(()=>t.push(e.CONSUME3(s.Times)));const o=e.OPTION5(()=>e.OR4([{ALT:()=>(t.push(e.CONSUME(s.Inclusive)),"inclusive")},{ALT:()=>(t.push(e.CONSUME(s.Exclusive)),"exclusive")}]));return new c.CountSubStatementCST(t,n.value,i.value,o)}},{ALT:()=>{const t=[];e.OPTION2(()=>t.push(e.CONSUME(s.From)));const n=e.SUBRULE2(r),i=e.OR2([{ALT:()=>new h(e.CONSUME(s.OrMore),[null,"+"])},{ALT:()=>{e.CONSUME(s.To);const t=e.SUBRULE3(r);return new h(t.token,[t.value,null])}}]);return t.push(i.token),e.OPTION3(()=>t.push(e.CONSUME2(s.Times))),new c.CountSubStatementCST(t,n.value,i.value?i.value[0]:null,i.value?i.value[1]:null)}},{ALT:()=>{const t=[];e.OPTION(()=>t.push(e.CONSUME(s.Exactly)));const n=e.SUBRULE(r);return t.push(n.token),e.OPTION6(()=>t.push(e.CONSUME(s.Times))),new c.CountSubStatementCST(t,n.value)}}]));let o=null;const a=e.RULE("MatchSubStatement",()=>{let t=null,n=!1;const r=[];let a=null,l=null,h=c.MatchSubStatementType.Anything;const p=[];return t=e.OPTION(()=>{const t=e.SUBRULE(i);return t.tokens&&p.push(u.first(t.tokens)),t}),n=e.OPTION2(()=>(p.push(e.CONSUME(s.Not)),!0)),e.AT_LEAST_ONE_SEP({SEP:s.Or,DEF:()=>{e.OPTION3(()=>e.CONSUME(s.A)),r.push(e.OR(o||(o=[{ALT:()=>{e.OPTION4(()=>e.CONSUME(s.From)),a=e.CONSUME2(s.StringLiteral).image,e.CONSUME(s.To);const t=e.CONSUME3(s.StringLiteral);return p.push(t),l=t.image,h=c.MatchSubStatementType.Between,new c.MatchSubStatementValue(h,a,l)}},{ALT:()=>{e.CONSUME(s.Between),a=e.CONSUME4(s.StringLiteral).image,e.CONSUME(s.And);const t=e.CONSUME5(s.StringLiteral);return l=t.image,p.push(t),h=c.MatchSubStatementType.Between,new c.MatchSubStatementValue(h,a,l)}},{ALT:()=>{const t=e.CONSUME(s.StringLiteral);return p.push(t),a=t.image,h=c.MatchSubStatementType.SingleString,new c.MatchSubStatementValue(h,a)}},{ALT:()=>(p.push(e.CONSUME(s.Anything)),h=c.MatchSubStatementType.Anything,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Word)),h=c.MatchSubStatementType.Word,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Digit)),h=c.MatchSubStatementType.Digit,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Character)),h=c.MatchSubStatementType.Character,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Whitespace)),h=c.MatchSubStatementType.Whitespace,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Number)),h=c.MatchSubStatementType.Number,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Tab)),h=c.MatchSubStatementType.Tab,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Linefeed)),h=c.MatchSubStatementType.Linefeed,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.Newline)),h=c.MatchSubStatementType.Newline,new c.MatchSubStatementValue(h))},{ALT:()=>(p.push(e.CONSUME(s.CarriageReturn)),h=c.MatchSubStatementType.CarriageReturn,new c.MatchSubStatementValue(h))}])))}}),new c.MatchSubStatementCST(p,t,n,r)}),d=e.RULE("MatchStatement",()=>{let t=!1;const n=[],r=[];return e.OPTION(()=>{r.push(e.CONSUME(s.Optional)),t=!0}),r.push(e.CONSUME(s.Match)),n.push(new c.MatchStatementValue(t,e.SUBRULE(a))),e.MANY(()=>{e.OR([{ALT:()=>{e.OPTION2(()=>e.CONSUME2(s.And)),e.CONSUME(s.Then)}},{ALT:()=>e.CONSUME(s.And)}]),t=!1,e.OPTION3(()=>{e.CONSUME2(s.Optional),t=!0}),n.push(new c.MatchStatementValue(t,e.SUBRULE2(a)))}),r.push(e.CONSUME(s.EndOfLine)),new c.MatchStatementCST(r,n)});let m=null;const O=e.RULE("UsingStatement",()=>{const t=[],n=[e.CONSUME(s.Using)];return e.AT_LEAST_ONE_SEP({SEP:s.And,DEF:()=>{t.push(e.OR(m||(m=[{ALT:()=>(e.CONSUME(s.Multiline),c.UsingFlags.Multiline)},{ALT:()=>(e.CONSUME(s.Global),c.UsingFlags.Global)},{ALT:()=>(e.CONSUME(s.CaseInsensitive),c.UsingFlags.Insensitive)},{ALT:()=>(e.CONSUME(s.CaseSensitive),c.UsingFlags.Sensitive)},{ALT:()=>(e.CONSUME(s.Exact),c.UsingFlags.Exact)}]))),e.OPTION(()=>e.CONSUME(s.Matching))}}),n.push(e.CONSUME(s.EndOfLine)),new p(n,t)}),v=e.RULE("GroupStatement",()=>{const t=[];let n=!1,r=null;const i=[];return t.push(e.OR([{ALT:()=>{n=!0;const t=e.CONSUME(s.Optional);return e.CONSUME(s.Create),e.CONSUME(s.A),t}},{ALT:()=>{const t=e.CONSUME2(s.Create);return e.CONSUME2(s.A),e.OPTION2(()=>{e.CONSUME2(s.Optional),n=!0}),t}}])),e.CONSUME(s.Group),e.OPTION(()=>{e.CONSUME(s.Called),r=e.CONSUME(s.Identifier).image}),t.push(e.CONSUME2(s.EndOfLine)),e.CONSUME(s.Indent),e.AT_LEAST_ONE(()=>{i.push(e.SUBRULE(E))}),e.CONSUME(s.Outdent),new c.GroupStatementCST(t,n,r,i)}),T=e.RULE("RepeatStatement",()=>{const t=[];let n=!1,r=null;const o=[];return e.OPTION3(()=>{t.push(e.CONSUME(s.Optional)),n=!0}),t.push(e.CONSUME(s.Repeat)),e.OPTION(()=>r=e.SUBRULE(i)),e.CONSUME3(s.EndOfLine),e.CONSUME(s.Indent),e.AT_LEAST_ONE(()=>{o.push(e.SUBRULE(E))}),t.push(e.CONSUME(s.Outdent)),new c.RepeatStatementCST(t,n,r,o)}),E=e.RULE("Statement",()=>e.OR([{ALT:()=>e.SUBRULE(d)},{ALT:()=>e.SUBRULE(v)},{ALT:()=>e.SUBRULE(T)}])),y=e.RULE("Regex",()=>{let t=[],n=[];const r=[];return e.MANY(()=>{const r=e.SUBRULE(O);t=t.concat(r.tokens),n=n.concat(r.value)}),e.MANY2(()=>r.push(e.SUBRULE(E))),new c.RegularExpressionCST([],new c.UsingStatementCST(t,n),r)});this.performSelfAnalysis(),this.parse=y}}e.Human2RegexParser=f,f.already_init=!1}]); |