From 424cb59d6ddd4aa78229a14e2bf1e10ae4633b53 Mon Sep 17 00:00:00 2001 From: Patrick Demian Date: Sun, 1 Nov 2020 23:19:30 -0500 Subject: [PATCH] Refactored code for later migration to npm --- docs/bundle.min.js | 16 +- src/generator.ts | 383 ++++++++++++++++++++++++++++++++------------- src/lexer.ts | 53 ++++++- src/parser.ts | 80 +++++++--- src/script.ts | 28 ++-- src/tokens.ts | 121 +++++++------- src/utilities.ts | 162 +++++++++++++++++-- 7 files changed, 619 insertions(+), 224 deletions(-) diff --git a/docs/bundle.min.js b/docs/bundle.min.js index 4bd7311..840ac98 100644 --- a/docs/bundle.min.js +++ b/docs/bundle.min.js @@ -1,10 +1,10 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";function r(e){return e&&0===e.length}function i(e){return null==e?[]:Object.keys(e)}function o(e){for(var t=[],n=Object.keys(e),r=0;r=this.input.length)throw Error("Unexpected end of input");this.idx++},e.prototype.loc=function(e){return{begin:e,end:this.idx}};var t,n=/[0-9a-fA-F]/,r=/[0-9]/,i=/[1-9]/;function o(e){return e.charCodeAt(0)}function a(e,t){void 0!==e.length?e.forEach((function(e){t.push(e)})):t.push(e)}function s(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t]=!0}function u(e){if(void 0===e)throw Error("Internal Error - Should never get here!")}var c=[];for(t=o("0");t<=o("9");t++)c.push(t);var l=[o("_")].concat(c);for(t=o("a");t<=o("z");t++)l.push(t);for(t=o("A");t<=o("Z");t++)l.push(t);var f=[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 h(){}return h.prototype.visitChildren=function(e){for(var t in e){var n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((function(e){this.visit(e)}),this))}},h.prototype.visit=function(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)},h.prototype.visitPattern=function(e){},h.prototype.visitFlags=function(e){},h.prototype.visitDisjunction=function(e){},h.prototype.visitAlternative=function(e){},h.prototype.visitStartAnchor=function(e){},h.prototype.visitEndAnchor=function(e){},h.prototype.visitWordBoundary=function(e){},h.prototype.visitNonWordBoundary=function(e){},h.prototype.visitLookahead=function(e){},h.prototype.visitNegativeLookahead=function(e){},h.prototype.visitCharacter=function(e){},h.prototype.visitSet=function(e){},h.prototype.visitGroup=function(e){},h.prototype.visitGroupBackReference=function(e){},h.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:h,VERSION:"0.5.0"}})?r.apply(t,i):r)||(e.exports=o)},function(e,t,n){"use strict"; -/*! Copyright (c) 2020 Patrick Demian; Licensed under MIT */Object.defineProperty(t,"__esModule",{value:!0}),t.CommonError=t.regexEscape=t.removeQuotes=t.findLastIndexPredicate=t.findLastIndex=t.last=t.first=t.isSingleRegexCharacter=t.combineFlags=t.hasFlag=void 0,t.hasFlag=function(e,t){return 0!=(e&t)},t.combineFlags=function(e,t){return e|t},t.isSingleRegexCharacter=function(e){return e.startsWith("\\u")&&6===e.length||e.startsWith("\\U")&&8===e.length||e.startsWith("\\")&&2===e.length||1===e.length},t.first=function(e){return e[0]},t.last=function(e){return e[e.length-1]},t.findLastIndex=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1},t.findLastIndexPredicate=function(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1},t.removeQuotes=function(e){return e.substring(1,e.length-1)},t.regexEscape=function(e){return e.replace("\\","\\\\").replace(/([=:\-\.\[\]\^\|\(\)\*\+\?\{\}\$\/])/g,"\\$1")};class r{constructor(e,t,n,r,i){this.type=e,this.start_line=t,this.start_column=n,this.length=r,this.message=i}static fromLexError(e){return new r("Lexer Error",e.line,e.column,e.length,e.message)}static fromParseError(e){var t,n,i;return new r("Parser Error",null!==(t=e.token.startLine)&&void 0!==t?t:NaN,null!==(n=e.token.startColumn)&&void 0!==n?n:NaN,null!==(i=e.token.endOffset)&&void 0!==i?i:NaN-e.token.startOffset,e.name+": "+e.message)}static fromSemanticError(e){return new r("Semantic Error",e.startLine,e.startColumn,e.length,e.message)}toString(){return`${this.type} @ ${this.start_line} ${this.start_column}: ${this.message}`}}t.CommonError=r},function(e,t,n){"use strict";n.r(t),n.d(t,"VERSION",(function(){return r})),n.d(t,"CstParser",(function(){return rn})),n.d(t,"EmbeddedActionsParser",(function(){return on})),n.d(t,"ParserDefinitionErrorType",(function(){return Jt})),n.d(t,"EMPTY_ALT",(function(){return tn})),n.d(t,"Lexer",(function(){return $})),n.d(t,"LexerDefinitionErrorType",(function(){return V})),n.d(t,"createToken",(function(){return J})),n.d(t,"createTokenInstance",(function(){return ee})),n.d(t,"EOF",(function(){return Q})),n.d(t,"tokenLabel",(function(){return Y})),n.d(t,"tokenMatcher",(function(){return te})),n.d(t,"tokenName",(function(){return X})),n.d(t,"defaultGrammarResolverErrorProvider",(function(){return Ae})),n.d(t,"defaultGrammarValidatorErrorProvider",(function(){return Le})),n.d(t,"defaultParserErrorProvider",(function(){return Ne})),n.d(t,"EarlyExitException",(function(){return gt})),n.d(t,"isRecognitionException",(function(){return pt})),n.d(t,"MismatchedTokenException",(function(){return dt})),n.d(t,"NotAllInputParsedException",(function(){return vt})),n.d(t,"NoViableAltException",(function(){return mt})),n.d(t,"defaultLexerErrorProvider",(function(){return K})),n.d(t,"Alternation",(function(){return he})),n.d(t,"Alternative",(function(){return ae})),n.d(t,"NonTerminal",(function(){return ie})),n.d(t,"Option",(function(){return se})),n.d(t,"Repetition",(function(){return le})),n.d(t,"RepetitionMandatory",(function(){return ue})),n.d(t,"RepetitionMandatoryWithSeparator",(function(){return ce})),n.d(t,"RepetitionWithSeparator",(function(){return fe})),n.d(t,"Rule",(function(){return oe})),n.d(t,"Terminal",(function(){return pe})),n.d(t,"serializeGrammar",(function(){return de})),n.d(t,"serializeProduction",(function(){return me})),n.d(t,"GAstVisitor",(function(){return ye})),n.d(t,"assignOccurrenceIndices",(function(){return ft})),n.d(t,"resolveGrammar",(function(){return ct})),n.d(t,"validateGrammar",(function(){return lt})),n.d(t,"clearCache",(function(){return gn})),n.d(t,"createSyntaxDiagramsCode",(function(){return an})),n.d(t,"generateParserFactory",(function(){return mn})),n.d(t,"generateParserModule",(function(){return vn})),n.d(t,"Parser",(function(){return yn}));var r="7.0.2",i=n(0),o=n(1),a={},s=new o.RegExpParser;function u(e){var t=e.toString();if(a.hasOwnProperty(t))return a[t];var n=s.pattern(t);return a[t]=n,n}var c,l=(c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f='Unable to use "first char" lexer optimizations:\n';function h(e,t){void 0===t&&(t=!1);try{var n=u(e);return function e(t,n,r){switch(t.type){case"Disjunction":for(var o=0;o=P)for(var o=t.from>=P?t.from:P,a=t.to,s=_(o),u=_(a),c=s;c<=u;c++)n[c]=c}}}));break;case"Group":e(u.value,n,r);break;default:throw Error("Non Exhaustive Match")}var c=void 0!==u.quantifier&&0===u.quantifier.atLeast;if("Group"===u.type&&!1===m(u)||"Group"!==u.type&&!1===c)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)t&&Object(i.d)(f+"\tUnable to optimize: < "+e.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="";t&&(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)(f+"\n\tFailed parsing: < "+e.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 p(e,t,n){var r=_(e);t[r]=r,!0===n&&function(e,t){var n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){var i=_(r.charCodeAt(0));t[i]=i}else{var o=n.toLowerCase();if(o!==n){i=_(o.charCodeAt(0));t[i]=i}}}(e,t)}function d(e,t){return Object(i.q)(e.value,(function(e){if("number"==typeof e)return Object(i.j)(t,e);var n=e;return void 0!==Object(i.q)(t,(function(e){return n.from<=e&&e<=n.to}))}))}function m(e){return!(!e.quantifier||0!==e.quantifier.atLeast)||!!e.value&&(Object(i.y)(e.value)?Object(i.o)(e.value,m):m(e.value))}var v=function(e){function t(t){var n=e.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return l(t,e),t.prototype.visitChildren=function(t){if(!0!==this.found){switch(t.type){case"Lookahead":return void this.visitLookahead(t);case"NegativeLookahead":return void this.visitNegativeLookahead(t)}e.prototype.visitChildren.call(this,t)}},t.prototype.visitCharacter=function(e){Object(i.j)(this.targetCharCodes,e.value)&&(this.found=!0)},t.prototype.visitSet=function(e){e.complement?void 0===d(e,this.targetCharCodes)&&(this.found=!0):void 0!==d(e,this.targetCharCodes)&&(this.found=!0)},t}(o.BaseRegExpVisitor);function g(e,t){if(t instanceof RegExp){var n=u(t),r=new v(e);return r.visit(n),r.found}return void 0!==Object(i.q)(t,(function(t){return Object(i.j)(e,t.charCodeAt(0))}))}var y=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),b="PATTERN",T="boolean"==typeof new RegExp("(?:)").sticky;function x(e,t){var n,r=(t=Object(i.k)(t,{useSticky:T,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(e,t){return t()}})).tracer;r("initCharCodeToOptimizedIndexMap",(function(){!function(){if(Object(i.A)(j)){j=new Array(65536);for(var e=0;e<65536;e++)j[e]=e>255?255+~~(e/255):e}}()})),r("Reject Lexer.NA",(function(){n=Object(i.P)(e,(function(e){return e[b]===$.NA}))}));var o,a,s,u,c,l,p,d,m,v,y,x=!1;r("Transform Patterns",(function(){x=!1,o=Object(i.I)(n,(function(e){var n=e[b];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])?t.useSticky?C(n):E(n):r[1]:r}if(Object(i.B)(n))return x=!0,{exec:n};if(Object(i.w)(n,"exec"))return x=!0,n;if("string"==typeof n){if(1===n.length)return n;var o=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),a=new RegExp(o);return t.useSticky?C(a):E(a)}throw Error("non exhaustive match")}))})),r("misc mapping",(function(){a=Object(i.I)(n,(function(e){return e.tokenTypeIdx})),s=Object(i.I)(n,(function(e){var t=e.GROUP;if(t!==$.SKIPPED){if(Object(i.E)(t))return t;if(Object(i.F)(t))return!1;throw Error("non exhaustive match")}})),u=Object(i.I)(n,(function(e){var t=e.LONGER_ALT;if(t)return Object(i.x)(n,t)})),c=Object(i.I)(n,(function(e){return e.PUSH_MODE})),l=Object(i.I)(n,(function(e){return Object(i.w)(e,"POP_MODE")}))})),r("Line Terminator Handling",(function(){var e=R(t.lineTerminatorCharacters);p=Object(i.I)(n,(function(e){return!1})),"onlyOffset"!==t.positionTracking&&(p=Object(i.I)(n,(function(t){return Object(i.w)(t,"LINE_BREAKS")?t.LINE_BREAKS:!1===I(t,e)?g(e,t.PATTERN):void 0})))})),r("Misc Mapping #2",(function(){d=Object(i.I)(n,N),m=Object(i.I)(o,A),v=Object(i.O)(n,(function(e,t){var n=t.GROUP;return Object(i.E)(n)&&n!==$.SKIPPED&&(e[n]=[]),e}),{}),y=Object(i.I)(o,(function(e,t){return{pattern:o[t],longerAlt:u[t],canLineTerminator:p[t],isCustom:d[t],short:m[t],group:s[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:n[t]}}))}));var O=!0,S=[];return t.safeMode||r("First Char Optimization",(function(){S=Object(i.O)(n,(function(e,n,r){if("string"==typeof n.PATTERN){var o=_(n.PATTERN.charCodeAt(0));M(e,o,y[r])}else if(Object(i.y)(n.START_CHARS_HINT)){var a;Object(i.u)(n.START_CHARS_HINT,(function(t){var n=_("string"==typeof t?t.charCodeAt(0):t);a!==n&&(a=n,M(e,n,y[r]))}))}else if(Object(i.D)(n.PATTERN))if(n.PATTERN.unicode)O=!1,t.ensureOptimizations&&Object(i.c)(f+"\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=h(n.PATTERN,t.ensureOptimizations);Object(i.A)(s)&&(O=!1),Object(i.u)(s,(function(t){M(e,t,y[r])}))}else t.ensureOptimizations&&Object(i.c)(f+"\tTokenType: <"+n.name+"> is using a custom token pattern without providing 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"),O=!1;return e}),[])})),r("ArrayPacking",(function(){S=Object(i.L)(S)})),{emptyGroups:v,patternIdxToConfig:y,charCodeToPatternIdxToConfig:S,hasCustom:x,canBeOptimized:O}}function O(e,t){var n=[],r=function(e){var t=Object(i.p)(e,(function(e){return!Object(i.w)(e,b)})),n=Object(i.I)(t,(function(e){return{message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:V.MISSING_PATTERN,tokenTypes:[e]}})),r=Object(i.l)(e,t);return{errors:n,valid:r}}(e);n=n.concat(r.errors);var a=function(e){var t=Object(i.p)(e,(function(e){var t=e[b];return!(Object(i.D)(t)||Object(i.B)(t)||Object(i.w)(t,"exec")||Object(i.E)(t))})),n=Object(i.I)(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:V.INVALID_PATTERN,tokenTypes:[e]}})),r=Object(i.l)(e,t);return{errors:n,valid:r}}(r.valid),s=a.valid;return n=(n=(n=(n=(n=n.concat(a.errors)).concat(function(e){var t=[],n=Object(i.p)(e,(function(e){return Object(i.D)(e[b])}));return t=(t=(t=(t=(t=t.concat(function(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return y(t,e),t.prototype.visitEndAnchor=function(e){this.found=!0},t}(o.BaseRegExpVisitor),n=Object(i.p)(e,(function(e){var n=e[b];try{var r=u(n),i=new t;return i.visit(r),i.found}catch(e){return S.test(n.source)}}));return Object(i.I)(n,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.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:V.EOI_ANCHOR_FOUND,tokenTypes:[e]}}))}(n))).concat(function(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return y(t,e),t.prototype.visitStartAnchor=function(e){this.found=!0},t}(o.BaseRegExpVisitor),n=Object(i.p)(e,(function(e){var n=e[b];try{var r=u(n),i=new t;return i.visit(r),i.found}catch(e){return w.test(n.source)}}));return Object(i.I)(n,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.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:V.SOI_ANCHOR_FOUND,tokenTypes:[e]}}))}(n))).concat(function(e){var t=Object(i.p)(e,(function(e){var t=e[b];return t instanceof RegExp&&(t.multiline||t.global)}));return Object(i.I)(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:V.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}}))}(n))).concat(function(e){var t=[],n=Object(i.I)(e,(function(n){return Object(i.O)(e,(function(e,r){return n.PATTERN.source!==r.PATTERN.source||Object(i.j)(t,r)||r.PATTERN===$.NA||(t.push(r),e.push(r)),e}),[])}));n=Object(i.i)(n);var r=Object(i.p)(n,(function(e){return e.length>1}));return Object(i.I)(r,(function(e){var t=Object(i.I)(e,(function(e){return e.name}));return{message:"The same RegExp pattern ->"+Object(i.s)(e).PATTERN+"<-has been used in all of the following Token Types: "+t.join(", ")+" <-",type:V.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}))}(n))).concat(function(e){var t=Object(i.p)(e,(function(e){return e[b].test("")}));return Object(i.I)(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:V.EMPTY_MATCH_PATTERN,tokenTypes:[e]}}))}(n))}(s))).concat(function(e){var t=Object(i.p)(e,(function(e){if(!Object(i.w)(e,"GROUP"))return!1;var t=e.GROUP;return t!==$.SKIPPED&&t!==$.NA&&!Object(i.E)(t)}));return Object(i.I)(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:V.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}}))}(s))).concat(function(e,t){var n=Object(i.p)(e,(function(e){return void 0!==e.PUSH_MODE&&!Object(i.j)(t,e.PUSH_MODE)}));return Object(i.I)(n,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+e.PUSH_MODE+"<-which does not exist",type:V.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}}))}(s,t))).concat(function(e){var t=[],n=Object(i.O)(e,(function(e,t,n){var r,o=t.PATTERN;return o===$.NA||(Object(i.E)(o)?e.push({str:o,idx:n,tokenType:t}):Object(i.D)(o)&&(r=o,void 0===Object(i.q)([".","\\","[","]","|","^","$","(",")","?","*","+","{"],(function(e){return-1!==r.source.indexOf(e)})))&&e.push({str:o.source,idx:n,tokenType:t})),e}),[]);return Object(i.u)(e,(function(e,r){Object(i.u)(n,(function(n){var o=n.str,a=n.idx,s=n.tokenType;if(r"+e.name+"<-in the lexer's definition.\nSee https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#UNREACHABLE";t.push({message:u,type:V.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}}))})),t}(s))}var S=/[^\\][\$]/;var w=/[^\\[][\^]|^\^/;function E(e){var t=e.ignoreCase?"i":"";return new RegExp("^(?:"+e.source+")",t)}function C(e){var t=e.ignoreCase?"iy":"y";return new RegExp(""+e.source,t)}function k(e,t,n){var r=[],o=!1,a=Object(i.i)(Object(i.t)(Object(i.J)(e.modes,(function(e){return e})))),s=Object(i.P)(a,(function(e){return e[b]===$.NA})),u=R(n);return t&&Object(i.u)(s,(function(e){var t=I(e,u);if(!1!==t){var n={message:function(e,t){if(t.issue===V.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <"+e.name+"> Token Type\n\t Root cause: "+t.errMsg+".\n\tFor details See: https://sap.github.io/chevrotain/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(t.issue===V.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the option.\n\tThe problem is in the <"+e.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")}(e,t),type:t.issue,tokenType:e};r.push(n)}else Object(i.w)(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(o=!0):g(u,e.PATTERN)&&(o=!0)})),t&&!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:V.NO_LINE_BREAKS_FLAGS}),r}function N(e){var t=e.PATTERN;if(Object(i.D)(t))return!1;if(Object(i.B)(t))return!0;if(Object(i.w)(t,"exec"))return!0;if(Object(i.E)(t))return!1;throw Error("non exhaustive match")}function A(e){return!(!Object(i.E)(e)||1!==e.length)&&e.charCodeAt(0)}var L={test:function(e){for(var t=e.length,n=this.lastIndex;n0?e.charCodeAt(0):e}))}function M(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}var P=256;function _(e){return e0}))}function B(e){return Object(i.w)(e,"tokenTypeIdx")}function z(e){return Object(i.w)(e,"CATEGORIES")}function G(e){return Object(i.w)(e,"tokenTypeIdx")}var V,K={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,n,r,i){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+", skipped "+n+" characters."}};!function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"}(V||(V={}));var q={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:K,traceInitPerf:!1,skipValidations:!1};Object.freeze(q);var $=function(){function e(e,t){var n=this;if(void 0===t&&(t=q),this.lexerDefinition=e,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 t)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)(q,t);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===q.lineTerminatorsPattern)n.config.lineTerminatorsPattern=L;else if(n.config.lineTerminatorCharacters===q.lineTerminatorCharacters)throw Error("Error: Missing 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(t.safeMode&&t.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)(e)?((r={modes:{}}).modes.defaultMode=Object(i.g)(e),r.defaultMode="defaultMode"):(o=!1,r=Object(i.h)(e))})),!1===n.config.skipValidations&&(n.TRACE_INIT("performRuntimeChecks",(function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat(function(e,t,n){var r=[];return Object(i.w)(e,"defaultMode")||r.push({message:"A MultiMode Lexer cannot be initialized without a property in its definition\n",type:V.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object(i.w)(e,"modes")||r.push({message:"A MultiMode Lexer cannot be initialized without a property in its definition\n",type:V.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object(i.w)(e,"modes")&&Object(i.w)(e,"defaultMode")&&!Object(i.w)(e.modes,e.defaultMode)&&r.push({message:"A MultiMode Lexer cannot be initialized with a defaultMode: <"+e.defaultMode+">which does not exist\n",type:V.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object(i.w)(e,"modes")&&Object(i.u)(e.modes,(function(e,t){Object(i.u)(e,(function(e,n){Object(i.F)(e)&&r.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:<"+t+"> at index: <"+n+">\n",type:V.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})}))})),r}(r,n.trackStartLines,n.config.lineTerminatorCharacters))})),n.TRACE_INIT("performWarningRuntimeChecks",(function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat(k(r,n.trackStartLines,n.config.lineTerminatorCharacters))}))),r.modes=r.modes?r.modes:{},Object(i.u)(r.modes,(function(e,t){r.modes[t]=Object(i.P)(e,(function(e){return Object(i.F)(e)}))}));var s=Object(i.G)(r.modes);if(Object(i.u)(r.modes,(function(e,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(O(e,s))})),Object(i.A)(n.lexerDefinitionErrors))&&(H(e),n.TRACE_INIT("analyzeTokenTypes",(function(){o=x(e,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.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 u=Object(i.I)(n.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+u)}Object(i.u)(n.lexerDefinitionWarning,(function(e){Object(i.d)(e.message)})),n.TRACE_INIT("Choosing sub-methods implementations",(function(){if(T?(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 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 e=Object(i.O)(n.canModeBeOptimized,(function(e,t,n){return!1===t&&e.push(n),e}),[]);if(t.ensureOptimizations&&!Object(i.A)(e))throw Error("Lexer Modes: < "+e.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 e.prototype.tokenize=function(e,t){if(void 0===t&&(t=this.defaultMode),!Object(i.A)(this.lexerDefinitionErrors)){var n=Object(i.I)(this.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+n)}return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,t){var n,r,o,a,s,u,c,l,f,h,p,d,m,v,g,y,b,T=this,x=e,O=x.length,S=0,w=0,E=this.hasCustom?0:Math.floor(e.length/10),C=new Array(E),k=[],N=this.trackStartLines?1:void 0,A=this.trackStartLines?1:void 0,L=(g=this.emptyGroups,y={},b=Object(i.G)(g),Object(i.u)(b,(function(e){var t=g[e];if(!Object(i.y)(t))throw Error("non exhaustive match");y[e]=[]})),y),I=this.trackStartLines,R=this.config.lineTerminatorsPattern,M=0,P=[],j=[],D=[],F=[];Object.freeze(F);var U=void 0;function W(){return P}function H(e){var t=_(e),n=j[t];return void 0===n?F:n}var B,z=function(e){if(1===D.length&&void 0===e.tokenType.PUSH_MODE){var t=T.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);k.push({offset:e.startOffset,line:void 0!==e.startLine?e.startLine:void 0,column:void 0!==e.startColumn?e.startColumn:void 0,length:e.image.length,message:t})}else{D.pop();var n=Object(i.H)(D);P=T.patternIdxToConfig[n],j=T.charCodeToPatternIdxToConfig[n],M=P.length;var r=T.canModeBeOptimized[n]&&!1===T.config.safeMode;U=j&&r?H:W}};function G(e){D.push(e),j=this.charCodeToPatternIdxToConfig[e],P=this.patternIdxToConfig[e],M=P.length,M=P.length;var t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;U=j&&t?H:W}for(G.call(this,t);Ss.length&&(s=o,u=c,B=Y)}break}}if(null!==s){if(l=s.length,void 0!==(f=B.group)&&(h=B.tokenTypeIdx,p=this.createTokenInstance(s,S,h,B.tokenType,N,A,l),this.handlePayload(p,u),!1===f?w=this.addToken(C,w,p):L[f].push(p)),e=this.chopInput(e,l),S+=l,A=this.computeNewColumn(A,l),!0===I&&!0===B.canLineTerminator){var Z=0,J=void 0,Q=void 0;R.lastIndex=0;do{!0===(J=R.test(s))&&(Q=R.lastIndex-1,Z++)}while(!0===J);0!==Z&&(N+=Z,A=l-Q,this.updateTokenEndLineColumnLocation(p,f,Q,Z,N,A,l))}this.handleModes(B,z,G,p)}else{for(var ee=S,te=N,ne=A,re=!1;!re&&S");var r=Object(i.R)(t),o=r.time,a=r.value,s=o>10?console.warn:console.log;return this.traceInitIndent time: "+o+"ms"),this.traceInitIndent--,a}return t()},e.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.",e.NA=/NOT_APPLICABLE/,e}();function Y(e){return Z(e)?e.LABEL:e.name}function X(e){return e.name}function Z(e){return Object(i.E)(e.LABEL)&&""!==e.LABEL}function J(e){return function(e){var t=e.pattern,n={};n.name=e.name,Object(i.F)(t)||(n.PATTERN=t);if(Object(i.w)(e,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/SAP/chevrotain/issues/564#issuecomment-349062346 for details.";Object(i.w)(e,"categories")&&(n.CATEGORIES=e.categories);H([n]),Object(i.w)(e,"label")&&(n.LABEL=e.label);Object(i.w)(e,"group")&&(n.GROUP=e.group);Object(i.w)(e,"pop_mode")&&(n.POP_MODE=e.pop_mode);Object(i.w)(e,"push_mode")&&(n.PUSH_MODE=e.push_mode);Object(i.w)(e,"longer_alt")&&(n.LONGER_ALT=e.longer_alt);Object(i.w)(e,"line_breaks")&&(n.LINE_BREAKS=e.line_breaks);Object(i.w)(e,"start_chars_hint")&&(n.START_CHARS_HINT=e.start_chars_hint);return n}(e)}var Q=J({name:"EOF",pattern:$.NA});function ee(e,t,n,r,i,o,a,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function te(e,t){return D(e,t)}H([Q]);var ne=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),re=function(){function e(e){this.definition=e}return e.prototype.accept=function(e){e.visit(this),Object(i.u)(this.definition,(function(t){t.accept(e)}))},e}(),ie=function(e){function t(t){var n=e.call(this,[])||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.accept=function(e){e.visit(this)},t}(re),oe=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.orgText="",Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),ae=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),se=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),ue=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),ce=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),le=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),fe=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),he=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,Object(i.f)(n,Object(i.N)(t,(function(e){return void 0!==e}))),n}return ne(t,e),t}(re),pe=function(){function e(e){this.idx=1,Object(i.f)(this,Object(i.N)(e,(function(e){return void 0!==e})))}return e.prototype.accept=function(e){e.visit(this)},e}();function de(e){return Object(i.I)(e,me)}function me(e){function t(e){return Object(i.I)(e,me)}if(e instanceof ie)return{type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(e instanceof ae)return{type:"Alternative",definition:t(e.definition)};if(e instanceof se)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof ue)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof ce)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:me(new pe({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof fe)return{type:"RepetitionWithSeparator",idx:e.idx,separator:me(new pe({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof le)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof he)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof pe){var n={type:"Terminal",name:e.terminalType.name,label:Y(e.terminalType),idx:e.idx},r=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(n.pattern=Object(i.D)(r)?r.source:r),n}if(e instanceof oe)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}var ve=function(){function e(){}return e.prototype.walk=function(e,t){var n=this;void 0===t&&(t=[]),Object(i.u)(e.definition,(function(r,o){var a=Object(i.m)(e.definition,o+1);if(r instanceof ie)n.walkProdRef(r,a,t);else if(r instanceof pe)n.walkTerminal(r,a,t);else if(r instanceof ae)n.walkFlat(r,a,t);else if(r instanceof se)n.walkOption(r,a,t);else if(r instanceof ue)n.walkAtLeastOne(r,a,t);else if(r instanceof ce)n.walkAtLeastOneSep(r,a,t);else if(r instanceof fe)n.walkManySep(r,a,t);else if(r instanceof le)n.walkMany(r,a,t);else{if(!(r instanceof he))throw Error("non exhaustive match");n.walkOr(r,a,t)}}))},e.prototype.walkTerminal=function(e,t,n){},e.prototype.walkProdRef=function(e,t,n){},e.prototype.walkFlat=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkOption=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkAtLeastOne=function(e,t,n){var r=[new se({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkAtLeastOneSep=function(e,t,n){var r=ge(e,t,n);this.walk(e,r)},e.prototype.walkMany=function(e,t,n){var r=[new se({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkManySep=function(e,t,n){var r=ge(e,t,n);this.walk(e,r)},e.prototype.walkOr=function(e,t,n){var r=this,o=t.concat(n);Object(i.u)(e.definition,(function(e){var t=new ae({definition:[e]});r.walk(t,o)}))},e}();function ge(e,t,n){return[new se({definition:[new pe({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}var ye=function(){function e(){}return e.prototype.visit=function(e){var t=e;switch(t.constructor){case ie:return this.visitNonTerminal(t);case ae:return this.visitAlternative(t);case se:return this.visitOption(t);case ue:return this.visitRepetitionMandatory(t);case ce:return this.visitRepetitionMandatoryWithSeparator(t);case fe:return this.visitRepetitionWithSeparator(t);case le:return this.visitRepetition(t);case he:return this.visitAlternation(t);case pe:return this.visitTerminal(t);case oe:return this.visitRule(t);default:throw Error("non exhaustive match")}},e.prototype.visitNonTerminal=function(e){},e.prototype.visitAlternative=function(e){},e.prototype.visitOption=function(e){},e.prototype.visitRepetition=function(e){},e.prototype.visitRepetitionMandatory=function(e){},e.prototype.visitRepetitionMandatoryWithSeparator=function(e){},e.prototype.visitRepetitionWithSeparator=function(e){},e.prototype.visitAlternation=function(e){},e.prototype.visitTerminal=function(e){},e.prototype.visitRule=function(e){},e}(),be=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Te(e,t){return void 0===t&&(t=[]),!!(e instanceof se||e instanceof le||e instanceof fe)||(e instanceof he?Object(i.Q)(e.definition,(function(e){return Te(e,t)})):!(e instanceof ie&&Object(i.j)(t,e))&&(e instanceof re&&(e instanceof ie&&t.push(e),Object(i.o)(e.definition,(function(e){return Te(e,t)})))))}function xe(e){if(e instanceof ie)return"SUBRULE";if(e instanceof se)return"OPTION";if(e instanceof he)return"OR";if(e instanceof ue)return"AT_LEAST_ONE";if(e instanceof ce)return"AT_LEAST_ONE_SEP";if(e instanceof fe)return"MANY_SEP";if(e instanceof le)return"MANY";if(e instanceof pe)return"CONSUME";throw Error("non exhaustive match")}var Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return be(t,e),t.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},t.prototype.visitTerminal=function(e){var t=e.terminalType.name+this.separator+"Terminal";Object(i.w)(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitNonTerminal=function(e){var t=e.nonTerminalName+this.separator+"Terminal";Object(i.w)(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitOption=function(e){this.dslMethods.option.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.dslMethods.repetitionWithSeparator.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.dslMethods.repetitionMandatory.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)},t.prototype.visitRepetition=function(e){this.dslMethods.repetition.push(e)},t.prototype.visitAlternation=function(e){this.dslMethods.alternation.push(e)},t}(ye),Se=new Oe;function we(e){if(e instanceof ie)return we(e.referencedRule);if(e instanceof pe)return[e.terminalType];if(function(e){return e instanceof ae||e instanceof se||e instanceof le||e instanceof ue||e instanceof ce||e instanceof fe||e instanceof pe||e instanceof oe}(e))return function(e){var t,n=[],r=e.definition,o=0,a=r.length>o,s=!0;for(;a&&s;)t=r[o],s=Te(t),n=n.concat(we(t)),o+=1,a=r.length>o;return Object(i.T)(n)}(e);if(function(e){return e instanceof he}(e))return function(e){var t=Object(i.I)(e.definition,(function(e){return we(e)}));return Object(i.T)(Object(i.t)(t))}(e);throw Error("non exhaustive match")}var Ee="_~IN~_",Ce=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ke=function(e){function t(t){var n=e.call(this)||this;return n.topProd=t,n.follows={},n}return Ce(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},t.prototype.walkTerminal=function(e,t,n){},t.prototype.walkProdRef=function(e,t,n){var r,i,o=(r=e.referencedRule,i=e.idx,r.name+i+Ee+this.topProd.name),a=t.concat(n),s=we(new ae({definition:a}));this.follows[o]=s},t}(ve);var Ne={buildMismatchTokenMessage:function(e){var t=e.expected,n=e.actual;e.previous,e.ruleName;return"Expecting "+(Z(t)?"--\x3e "+Y(t)+" <--":"token of type --\x3e "+t.name+" <--")+" but found --\x3e '"+n.image+"' <--"},buildNotAllInputParsedMessage:function(e){var t=e.firstRedundant;e.ruleName;return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage:function(e){var t=e.expectedPathsPerAlt,n=e.actual,r=(e.previous,e.customUserDescription),o=(e.ruleName,"\nbut found: '"+Object(i.s)(n).image+"'");if(r)return"Expecting: "+r+o;var a=Object(i.O)(t,(function(e,t){return e.concat(t)}),[]),s=Object(i.I)(a,(function(e){return"["+Object(i.I)(e,(function(e){return Y(e)})).join(", ")+"]"}));return"Expecting: "+("one of these possible Token sequences:\n"+Object(i.I)(s,(function(e,t){return" "+(t+1)+". "+e})).join("\n"))+o},buildEarlyExitMessage:function(e){var t=e.expectedIterationPaths,n=e.actual,r=e.customUserDescription,o=(e.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)(t,(function(e){return"["+Object(i.I)(e,(function(e){return Y(e)})).join(",")+"]"})).join(" ,")+">")+o}};Object.freeze(Ne);var Ae={buildRuleNotFoundError:function(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"}},Le={buildDuplicateFoundError:function(e,t){var n,r=e.name,o=Object(i.s)(t),a=o.idx,s=xe(o),u=(n=o)instanceof pe?n.terminalType.name:n instanceof ie?n.nonTerminalName:"",c="->"+s+(a>0?a:"")+"<- "+(u?"with argument: ->"+u+"<-":"")+"\n appears more than once ("+t.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 c=(c=c.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(e){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+e.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(e){var t=Object(i.I)(e.prefixPath,(function(e){return Y(e)})).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;return"Ambiguous alternatives: <"+e.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\nin inside <"+e.topLevelRule.name+"> Rule,\n<"+t+"> 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(e){var t=Object(i.I)(e.prefixPath,(function(e){return Y(e)})).join(", "),n=0===e.alternation.idx?"":e.alternation.idx,r="Ambiguous Alternatives Detected: <"+e.ambiguityIndices.join(" ,")+"> in inside <"+e.topLevelRule.name+"> Rule,\n<"+t+"> 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(e){var t=xe(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),"The repetition <"+t+"> within Rule <"+e.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(e){return"Invalid Grammar Token name: ->"+e.tokenType.name+"<- it must match the pattern: ->"+e.expectedPattern.toString()+"<-"},buildEmptyAlternationError:function(e){return"Ambiguous empty alternative: <"+(e.emptyChoiceIdx+1)+"> in inside <"+e.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(e){return"An Alternation cannot have more than 256 alternatives:\n inside <"+e.topLevelRule.name+"> Rule.\n has "+(e.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(e){var t=e.topLevelRule.name;return"Left Recursion found in grammar.\nrule: <"+t+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+(t+" --\x3e "+i.I(e.leftRecursionPath,(function(e){return e.name})).concat([t]).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(e){return"Invalid grammar rule name: ->"+e.topLevelRule.name+"<- it must match the pattern: ->"+e.expectedPattern.toString()+"<-"},buildDuplicateRuleNameError:function(e){return"Duplicate definition, rule: ->"+(e.topLevelRule instanceof oe?e.topLevelRule.name:e.topLevelRule)+"<- is already defined in the grammar: ->"+e.grammarName+"<-"}},Ie=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();var Re=function(e){function t(t,n){var r=e.call(this)||this;return r.nameToTopRule=t,r.errMsgProvider=n,r.errors=[],r}return Ie(t,e),t.prototype.resolveRefs=function(){var e=this;Object(i.u)(Object(i.U)(this.nameToTopRule),(function(t){e.currTopLevel=t,t.accept(e)}))},t.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:Jt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},t}(ye),Me=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pe=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.path=n,r.nextTerminalName="",r.nextTerminalOccurrence=0,r.nextTerminalName=r.path.lastTok.name,r.nextTerminalOccurrence=r.path.lastTokOccurrence,r}return Me(t,e),t.prototype.walkTerminal=function(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){var r=t.concat(n),i=new ae({definition:r});this.possibleTokTypes=we(i),this.found=!0}},t}(function(e){function t(t,n){var r=e.call(this)||this;return r.topProd=t,r.path=n,r.possibleTokTypes=[],r.nextProductionName="",r.nextProductionOccurrence=0,r.found=!1,r.isAtEndOfPath=!1,r}return Me(t,e),t.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},t.prototype.walk=function(t,n){void 0===n&&(n=[]),this.found||e.prototype.walk.call(this,t,n)},t.prototype.walkProdRef=function(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){var r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}},t.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())},t}(ve)),_e=function(e){function t(t,n){var r=e.call(this)||this;return r.topRule=t,r.occurrence=n,r.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},r}return Me(t,e),t.prototype.startWalking=function(){return this.walk(this.topRule),this.result},t}(ve),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Me(t,e),t.prototype.walkMany=function(t,n,r){if(t.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof pe&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkMany.call(this,t,n,r)},t}(_e),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Me(t,e),t.prototype.walkManySep=function(t,n,r){if(t.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof pe&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkManySep.call(this,t,n,r)},t}(_e),Fe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Me(t,e),t.prototype.walkAtLeastOne=function(t,n,r){if(t.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof pe&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkAtLeastOne.call(this,t,n,r)},t}(_e),Ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Me(t,e),t.prototype.walkAtLeastOneSep=function(t,n,r){if(t.idx===this.occurrence){var o=Object(i.s)(n.concat(r));this.result.isEndOfRule=void 0===o,o instanceof pe&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else e.prototype.walkAtLeastOneSep.call(this,t,n,r)},t}(_e);function We(e,t,n){void 0===n&&(n=[]),n=Object(i.g)(n);var r=[],o=0;function a(a){var s=We(a.concat(Object(i.m)(e,o+1)),t,n);return r.concat(s)}for(;n.length=0;C--){var k={idx:p,def:v.definition[C].definition.concat(Object(i.m)(h)),ruleStack:d,occurrenceStack:m};l.push(k),l.push("EXIT_ALTERNATIVE")}else if(v instanceof ae)l.push({idx:p,def:v.definition.concat(Object(i.m)(h)),ruleStack:d,occurrenceStack:m});else{if(!(v instanceof oe))throw Error("non exhaustive match");l.push(Be(v,p,d,m))}}}else a&&Object(i.H)(l).idx<=u&&l.pop()}return c}function Be(e,t,n,r){var o=Object(i.g)(n);o.push(e.name);var a=Object(i.g)(r);return a.push(1),{idx:t,def:e.definition,ruleStack:o,occurrenceStack:a}}var ze,Ge=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(ze||(ze={}));var Ve=function(e){function t(t,n,r){var i=e.call(this)||this;return i.topProd=t,i.targetOccurrence=n,i.targetProdType=r,i}return Ge(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},t.prototype.checkIsTarget=function(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)},t.prototype.walkOption=function(t,n,r){this.checkIsTarget(t,ze.OPTION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOne=function(t,n,r){this.checkIsTarget(t,ze.REPETITION_MANDATORY,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOneSep=function(t,n,r){this.checkIsTarget(t,ze.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkMany=function(t,n,r){this.checkIsTarget(t,ze.REPETITION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkManySep=function(t,n,r){this.checkIsTarget(t,ze.REPETITION_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t}(ve),Ke=function(e){function t(t,n,r){var i=e.call(this)||this;return i.targetOccurrence=t,i.targetProdType=n,i.targetRef=r,i.result=[],i}return Ge(t,e),t.prototype.checkIsTarget=function(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)},t.prototype.visitOption=function(e){this.checkIsTarget(e,ze.OPTION)},t.prototype.visitRepetition=function(e){this.checkIsTarget(e,ze.REPETITION)},t.prototype.visitRepetitionMandatory=function(e){this.checkIsTarget(e,ze.REPETITION_MANDATORY)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.checkIsTarget(e,ze.REPETITION_MANDATORY_WITH_SEPARATOR)},t.prototype.visitRepetitionWithSeparator=function(e){this.checkIsTarget(e,ze.REPETITION_WITH_SEPARATOR)},t.prototype.visitAlternation=function(e){this.checkIsTarget(e,ze.ALTERNATION)},t}(ye);function qe(e){for(var t=new Array(e),n=0;n1}));return i.I(i.U(a),(function(n){var r=i.s(n),o=t.buildDuplicateFoundError(e,n),a=xe(r),s={message:o,type:Jt.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},u=it(r);return u&&(s.parameter=u),s}))}(e,r)})),s=i.I(e,(function(e){return function e(t,n,r,o){void 0===o&&(o=[]);var a=[],s=function e(t){var n=[];if(i.A(t))return n;var r=i.s(t);if(r instanceof ie)n.push(r.referencedRule);else if(r instanceof ae||r instanceof se||r instanceof ue||r instanceof ce||r instanceof fe||r instanceof le)n=n.concat(e(r.definition));else if(r instanceof he)n=i.t(i.I(r.definition,(function(t){return e(t.definition)})));else if(!(r instanceof pe))throw Error("non exhaustive match");var o=Te(r),a=t.length>1;if(o&&a){var s=i.m(t);return n.concat(e(s))}return n}(n.definition);if(i.A(s))return[];var u=t.name;i.j(s,t)&&a.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:o}),type:Jt.LEFT_RECURSION,ruleName:u});var c=i.l(s,o.concat([t])),l=i.I(c,(function(n){var a=i.g(o);return a.push(n),e(t,n,r,a)}));return a.concat(i.t(l))}(e,e,r)})),u=[],c=[],l=[];Object(i.o)(s,i.A)&&(u=Object(i.I)(e,(function(e){return function(e,t){var n=new st;e.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=He([n],[],null,1);return i.A(a)?{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:r,emptyChoiceIdx:o}),type:Jt.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:r.idx,alternative:o+1}:null}));return n.concat(i.i(a))}),[])}(e,r)})),c=Object(i.I)(e,(function(e){return function(e,t,n){var r=new st;e.accept(r);var o=r.alternations;return o=Object(i.P)(o,(function(e){return!0===e.ignoreAmbiguities})),i.O(o,(function(r,o){var a=o.idx,s=o.maxLookahead||t,u=Ze(a,e,s,o),c=function(e,t,n,r){var o=[],a=Object(i.O)(e,(function(n,r,a){return!0===t.definition[a].ignoreAmbiguities||Object(i.u)(r,(function(r){var s=[a];Object(i.u)(e,(function(e,n){a!==n&&Qe(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&s.push(n)})),s.length>1&&!Qe(o,r)&&(o.push(r),n.push({alts:s,path:r}))})),n}),[]);return i.I(a,(function(e){var o=Object(i.I)(e.alts,(function(e){return e+1}));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:o,prefixPath:e.path}),type:Jt.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:[e.alts]}}))}(u,o,e,n),l=function(e,t,n,r){var o=[],a=Object(i.O)(e,(function(e,t,n){var r=Object(i.I)(t,(function(e){return{idx:n,path:e}}));return e.concat(r)}),[]);return Object(i.u)(a,(function(e){if(!0!==t.definition[e.idx].ignoreAmbiguities){var s=e.idx,u=e.path,c=Object(i.r)(a,(function(e){return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx255&&n.push({message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:r}),type:Jt.TOO_MANY_ALTS,ruleName:e.name,occurrence:r.idx}),n}),[])}(e,r)})),d=Object(i.I)(e,(function(e){return function(e,t){var n=[],r=e.name;r.match(at)||n.push({message:t.buildInvalidRuleNameError({topLevelRule:e,expectedPattern:at}),type:Jt.INVALID_RULE_NAME,ruleName:r});return n}(e,r)})),m=Object(i.I)(e,(function(t){return function(e,t,n,r){var o=[];if(Object(i.O)(t,(function(t,n){return n.name===e.name?t+1:t}),0)>1){var a=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});o.push({message:a,type:Jt.DUPLICATE_RULE_NAME,ruleName:e.name})}return o}(t,e,o,r)}));return i.t(a.concat(h,l,s,u,c,f,p,d,m))}function rt(e){return xe(e)+"_#_"+e.idx+"_#_"+it(e)}function it(e){return e instanceof pe?e.terminalType.name:e instanceof ie?e.nonTerminalName:""}var ot=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return tt(t,e),t.prototype.visitNonTerminal=function(e){this.allProductions.push(e)},t.prototype.visitOption=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t.prototype.visitAlternation=function(e){this.allProductions.push(e)},t.prototype.visitTerminal=function(e){this.allProductions.push(e)},t}(ye),at=/^[a-zA-Z_]\w*$/;var st=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.alternations=[],t}return tt(t,e),t.prototype.visitAlternation=function(e){this.alternations.push(e)},t}(ye);var ut=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return tt(t,e),t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t}(ye);function ct(e){e=Object(i.k)(e,{errMsgProvider:Ae});var t,n,r,o={};return Object(i.u)(e.rules,(function(e){o[e.name]=e})),t=o,n=e.errMsgProvider,(r=new Re(t,n)).resolveRefs(),r.errors}function lt(e){return nt((e=Object(i.k)(e,{errMsgProvider:Le})).rules,e.maxLookahead,e.tokenTypes,e.errMsgProvider,e.grammarName)}function ft(e){Object(i.u)(e.rules,(function(e){var t=new Oe;e.accept(t),Object(i.u)(t.dslMethods,(function(e){Object(i.u)(e,(function(e,t){e.idx=t+1}))}))}))}var ht=["MismatchedTokenException","NoViableAltException","EarlyExitException","NotAllInputParsedException"];function pt(e){return Object(i.j)(ht,e.name)}function dt(e,t,n){this.name="MismatchedTokenException",this.message=e,this.token=t,this.previousToken=n,this.resyncedTokens=[]}function mt(e,t,n){this.name="NoViableAltException",this.message=e,this.token=t,this.previousToken=n,this.resyncedTokens=[]}function vt(e,t){this.name="NotAllInputParsedException",this.message=e,this.token=t,this.resyncedTokens=[]}function gt(e,t,n){this.name="EarlyExitException",this.message=e,this.token=t,this.previousToken=n,this.resyncedTokens=[]}Object.freeze(ht),dt.prototype=Error.prototype,mt.prototype=Error.prototype,vt.prototype=Error.prototype,gt.prototype=Error.prototype;var yt={};function bt(e){this.name="InRuleRecoveryException",this.message=e}bt.prototype=Error.prototype;var Tt=function(){function e(){}return e.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Object(i.w)(e,"recoveryEnabled")?e.recoveryEnabled:Qt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=xt)},e.prototype.getTokenToInsert=function(e){var t=ee(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},e.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},e.prototype.tryInRepetitionRecovery=function(e,t,n,r){for(var o=this,a=this.findReSyncTokenType(),s=this.exportLexerState(),u=[],c=!1,l=this.LA(1),f=this.LA(1),h=function(){var e=o.LA(0),t=new dt(o.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:l,previous:e,ruleName:o.getCurrRuleFullName()}),l,o.LA(0));t.resyncedTokens=Object(i.n)(u),o.SAVE_ERROR(t)};!c;){if(this.tokenMatcher(f,r))return void h();if(n.call(this))return h(),void e.apply(this,t);this.tokenMatcher(f,a)?c=!0:(f=this.SKIP_TOKEN(),this.addToResyncTokens(f,u))}this.importLexerState(s)},e.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!1!==n&&(void 0!==e&&void 0!==t&&(!this.tokenMatcher(this.LA(1),e)&&(!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))))},e.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)},e.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new bt("sad sad panda")},e.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},e.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(Object(i.A)(t))return!1;var r=this.LA(1);return void 0!==Object(i.q)(t,(function(e){return n.tokenMatcher(r,e)}))},e.prototype.canRecoverWithSingleTokenDeletion=function(e){return this.tokenMatcher(this.LA(2),e)},e.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return Object(i.j)(n,e)},e.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),n=2;;){var r=t.tokenType;if(Object(i.j)(e,r))return r;t=this.LA(n),n++}},e.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return yt;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}},e.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return Object(i.I)(t,(function(r,i){return 0===i?yt:{ruleName:e.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:e.shortRuleNameToFullName(t[i-1])}}))},e.prototype.flattenFollowSet=function(){var e=this,t=Object(i.I)(this.buildFullFollowKeyStack(),(function(t){return e.getFollowSetFromFollowKey(t)}));return Object(i.t)(t)},e.prototype.getFollowSetFromFollowKey=function(e){if(e===yt)return[Q];var t=e.ruleName+e.idxInCallingRule+Ee+e.inRule;return this.resyncFollows[t]},e.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,Q)||t.push(e),t},e.prototype.reSyncTo=function(e){for(var t=[],n=this.LA(1);!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return Object(i.n)(t)},e.prototype.attemptInRepetitionRecovery=function(e,t,n,r,i,o,a){},e.prototype.getCurrentGrammarPath=function(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:Object(i.g)(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}},e.prototype.getHumanReadableRuleStack=function(){var e=this;return Object(i.I)(this.RULE_STACK,(function(t){return e.shortRuleNameToFullName(t)}))},e}();function xt(e,t,n,r,i,o,a){var s=this.getKeyForAutomaticLookahead(r,i),u=this.firstAfterRepMap[s];if(void 0===u){var c=this.getCurrRuleFullName();u=new o(this.getGAstProductions()[c],i).startWalking(),this.firstAfterRepMap[s]=u}var l=u.token,f=u.occurrence,h=u.isEndOfRule;1===this.RULE_STACK.length&&h&&void 0===l&&(l=Q,f=1),this.shouldInRepetitionRecoveryBeTried(l,f,a)&&this.tryInRepetitionRecovery(e,t,n,l)}function Ot(e,t,n){return n|t|e}var St=function(){function e(){}return e.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=Object(i.w)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Qt.dynamicTokensEnabled,this.maxLookahead=Object(i.w)(e,"maxLookahead")?e.maxLookahead:Qt.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)},e.prototype.preComputeLookaheadFunctions=function(e){var t=this;Object(i.u)(e,(function(e){t.TRACE_INIT(e.name+" Rule Lookahead",(function(){var n=function(e){Se.reset(),e.accept(Se);var t=Se.dslMethods;return Se.reset(),t}(e),r=n.alternation,o=n.repetition,a=n.option,s=n.repetitionMandatory,u=n.repetitionMandatoryWithSeparator,c=n.repetitionWithSeparator;Object(i.u)(r,(function(n){var r=0===n.idx?"":n.idx;t.TRACE_INIT(""+xe(n)+r,(function(){var r,i,o,a,s,u,c,l=(r=n.idx,i=e,o=n.maxLookahead||t.maxLookahead,a=n.hasPredicates,s=t.dynamicTokensEnabled,u=t.lookAheadBuilderForAlternatives,c=Ze(r,i,o),u(c,a,et(c)?F:D,s)),f=Ot(t.fullRuleNameToShort[e.name],256,n.idx);t.setLaFuncCache(f,l)}))})),Object(i.u)(o,(function(n){t.computeLookaheadFunc(e,n.idx,768,ze.REPETITION,n.maxLookahead,xe(n))})),Object(i.u)(a,(function(n){t.computeLookaheadFunc(e,n.idx,512,ze.OPTION,n.maxLookahead,xe(n))})),Object(i.u)(s,(function(n){t.computeLookaheadFunc(e,n.idx,1024,ze.REPETITION_MANDATORY,n.maxLookahead,xe(n))})),Object(i.u)(u,(function(n){t.computeLookaheadFunc(e,n.idx,1536,ze.REPETITION_MANDATORY_WITH_SEPARATOR,n.maxLookahead,xe(n))})),Object(i.u)(c,(function(n){t.computeLookaheadFunc(e,n.idx,1280,ze.REPETITION_WITH_SEPARATOR,n.maxLookahead,xe(n))}))}))}))},e.prototype.computeLookaheadFunc=function(e,t,n,r,i,o){var a=this;this.TRACE_INIT(""+o+(0===t?"":t),(function(){var o=function(e,t,n,r,i,o){var a=Je(e,t,i,n),s=et(a)?F:D;return o(a[0],s,r)}(t,e,i||a.maxLookahead,a.dynamicTokensEnabled,r,a.lookAheadBuilderForOptional),s=Ot(a.fullRuleNameToShort[e.name],n,t);a.setLaFuncCache(s,o)}))},e.prototype.lookAheadBuilderForOptional=function(e,t,n){return function(e,t,n){var r=Object(i.o)(e,(function(e){return 1===e.length})),o=e.length;if(r&&!n){var a=Object(i.t)(e);if(1===a.length&&Object(i.A)(a[0].categoryMatches)){var s=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}var u=Object(i.O)(a,(function(e,t,n){return e[t.tokenTypeIdx]=!0,Object(i.u)(t.categoryMatches,(function(t){e[t]=!0})),e}),[]);return function(){var e=this.LA(1);return!0===u[e.tokenTypeIdx]}}return function(){e:for(var n=0;n on "+Nt(e.constructor)+" CST Visitor.",type:Ct.MISSING_METHOD,methodName:t}}));return Object(i.i)(n)}(e,t),r=function(e,t){var n=[];for(var r in e)at.test(r)&&Object(i.B)(e[r])&&!Object(i.j)(Rt,r)&&!Object(i.j)(t,r)&&n.push({msg:"Redundant visitor method: <"+r+"> on "+Nt(e.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 /"+at.source+"/.",type:Ct.REDUNDANT_METHOD,methodName:r});return n}(e,t);return n.concat(r)}(this,t);if(!Object(i.A)(e)){var n=Object(i.I)(e,(function(e){return e.msg}));throw Error("Errors Detected in CST Visitor <"+Nt(this.constructor)+">:\n\t"+n.join("\n\n").replace(/\n/g,"\n\t"))}}}).constructor=n,n._RULE_NAMES=t,n}!function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(Ct||(Ct={}));var Rt=["constructor","visit","validateVisitor"];var Mt=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object(i.w)(e,"nodeLocationTracking")?e.nodeLocationTracking:Qt.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Et,this.setNodeLocationFromNode=Et,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=wt,this.setNodeLocationFromNode=wt,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 config option: "'+e.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},e.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},e.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},e.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.cstInvocationStateUpdate=function(e,t){var n={name:e,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},e.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},e.prototype.cstPostRuleFull=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==!0?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)},e.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==!0?n.endOffset=t.endOffset:n.startOffset=NaN},e.prototype.cstPostTerminal=function(e,t){var n,r,i,o=this.CST_STACK[this.CST_STACK.length-1];r=t,i=e,void 0===(n=o).children[i]?n.children[i]=[r]:n.children[i].push(r),this.setNodeLocationFromToken(o.location,t)},e.prototype.cstPostNonTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];!function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}(n,t,e),this.setNodeLocationFromNode(n.location,e.location)},e.prototype.getBaseCstVisitorConstructor=function(){if(Object(i.F)(this.baseCstVisitorConstructor)){var e=It(this.className,Object(i.G)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(Object(i.F)(this.baseCstVisitorWithDefaultsConstructor)){var e=function(e,t,n){var r=function(){};At(r,e+"BaseSemanticsWithDefaults");var o=Object.create(n.prototype);return Object(i.u)(t,(function(e){o[e]=Lt})),(r.prototype=o).constructor=r,r}(this.className,Object(i.G)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},e.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},e.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},e.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},e}(),Pt=function(){function e(){}return e.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(e.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(!0!==this.selfAnalysisDone)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),e.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Zt},e.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Zt:this.tokVector[t]},e.prototype.consumeToken=function(){this.currIdx++},e.prototype.exportLexerState=function(){return this.currIdx},e.prototype.importLexerState=function(e){this.currIdx=e},e.prototype.resetLexerState=function(){this.currIdx=-1},e.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},e.prototype.getLexerPosition=function(){return this.exportLexerState()},e}(),_t=function(){function e(){}return e.prototype.ACTION=function(e){return e.call(this)},e.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},e.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},e.prototype.option=function(e,t){return this.optionInternal(t,e)},e.prototype.or=function(e,t){return this.orInternal(t,e)},e.prototype.many=function(e,t){return this.manyInternal(e,t)},e.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},e.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},e.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},e.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},e.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},e.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},e.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},e.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},e.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},e.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},e.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},e.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},e.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},e.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},e.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},e.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},e.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},e.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},e.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},e.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},e.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},e.prototype.OPTION=function(e){return this.optionInternal(e,0)},e.prototype.OPTION1=function(e){return this.optionInternal(e,1)},e.prototype.OPTION2=function(e){return this.optionInternal(e,2)},e.prototype.OPTION3=function(e){return this.optionInternal(e,3)},e.prototype.OPTION4=function(e){return this.optionInternal(e,4)},e.prototype.OPTION5=function(e){return this.optionInternal(e,5)},e.prototype.OPTION6=function(e){return this.optionInternal(e,6)},e.prototype.OPTION7=function(e){return this.optionInternal(e,7)},e.prototype.OPTION8=function(e){return this.optionInternal(e,8)},e.prototype.OPTION9=function(e){return this.optionInternal(e,9)},e.prototype.OR=function(e){return this.orInternal(e,0)},e.prototype.OR1=function(e){return this.orInternal(e,1)},e.prototype.OR2=function(e){return this.orInternal(e,2)},e.prototype.OR3=function(e){return this.orInternal(e,3)},e.prototype.OR4=function(e){return this.orInternal(e,4)},e.prototype.OR5=function(e){return this.orInternal(e,5)},e.prototype.OR6=function(e){return this.orInternal(e,6)},e.prototype.OR7=function(e){return this.orInternal(e,7)},e.prototype.OR8=function(e){return this.orInternal(e,8)},e.prototype.OR9=function(e){return this.orInternal(e,9)},e.prototype.MANY=function(e){this.manyInternal(0,e)},e.prototype.MANY1=function(e){this.manyInternal(1,e)},e.prototype.MANY2=function(e){this.manyInternal(2,e)},e.prototype.MANY3=function(e){this.manyInternal(3,e)},e.prototype.MANY4=function(e){this.manyInternal(4,e)},e.prototype.MANY5=function(e){this.manyInternal(5,e)},e.prototype.MANY6=function(e){this.manyInternal(6,e)},e.prototype.MANY7=function(e){this.manyInternal(7,e)},e.prototype.MANY8=function(e){this.manyInternal(8,e)},e.prototype.MANY9=function(e){this.manyInternal(9,e)},e.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},e.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},e.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},e.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},e.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},e.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},e.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},e.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},e.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},e.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},e.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},e.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},e.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},e.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},e.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},e.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},e.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},e.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},e.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},e.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},e.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},e.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},e.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},e.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},e.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},e.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},e.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},e.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},e.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},e.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},e.prototype.RULE=function(e,t,n){if(void 0===n&&(n=en),Object(i.j)(this.definedRulesNames,e)){var r={message:Le.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Jt.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(r)}this.definedRulesNames.push(e);var o=this.defineRule(e,t,n);return this[e]=o,o},e.prototype.OVERRIDE_RULE=function(e,t,n){void 0===n&&(n=en);var r,o,a,s,u,c=[];c=c.concat((r=e,o=this.definedRulesNames,a=this.className,u=[],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 ",u.push({message:s,type:Jt.INVALID_RULE_OVERRIDE,ruleName:r})),u)),this.definitionErrors.push.apply(this.definitionErrors,c);var l=this.defineRule(e,t,n);return this[e]=l,l},e.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(pt(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},e.prototype.getGAstProductions=function(){return this.gastProductionsCache},e.prototype.getSerializedGastProductions=function(){return de(Object(i.U)(this.gastProductionsCache))},e}(),jt=function(){function e(){}return e.prototype.initRecognizerEngine=function(e,t){if(this.className=Nt(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)(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a property.\n\tSee: https://sap.github.io/chevrotain/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(Object(i.y)(e)){if(Object(i.A)(e))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 e[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)(e))this.tokensMap=Object(i.O)(e,(function(e,t){return e[t.name]=t,e}),{});else if(Object(i.w)(e,"modes")&&Object(i.o)(Object(i.t)(Object(i.U)(e.modes)),G)){var n=Object(i.t)(Object(i.U)(e.modes)),r=Object(i.T)(n);this.tokensMap=Object(i.O)(r,(function(e,t){return e[t.name]=t,e}),{})}else{if(!Object(i.C)(e))throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=Object(i.h)(e)}this.tokensMap.EOF=Q;var o=Object(i.o)(Object(i.U)(e),(function(e){return Object(i.A)(e.categoryMatches)}));this.tokenMatcher=o?F:D,H(Object(i.U)(this.tokensMap))},e.prototype.defineRule=function(e,t,n){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+"> 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:en.resyncEnabled,a=Object(i.w)(n,"recoveryValueFunc")?n.recoveryValueFunc:en.recoveryValueFunc,s=this.ruleShortNameIdx<<12;function u(e){try{if(!0===this.outputCst){t.apply(this,e);var n=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(n),n}return t.apply(this,e)}catch(e){return this.invokeRuleCatch(e,o,a)}finally{this.ruleFinallyStateUpdate()}}this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;return(r=function(t,n){return void 0===t&&(t=0),this.ruleInvocationStateUpdate(s,e,t),u.call(this,n)}).ruleName=e,r.originalGrammarAction=t,r},e.prototype.invokeRuleCatch=function(e,t,n){var r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(pt(e)){var o=e;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 e},e.prototype.optionInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,n)},e.prototype.optionInternalLogic=function(e,t,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))return r.call(this)},e.prototype.atLeastOneInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,t,n)},e.prototype.atLeastOneInternalLogic=function(e,t,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))throw this.raiseEarlyExitException(e,ze.REPETITION_MANDATORY,t.ERR_MSG);for(var u=this.doSingleRepetition(r);!0===a.call(this)&&!0===u;)u=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],a,1024,e,Fe)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,t,n)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,n){var r=this,i=t.DEF,o=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,ze.REPETITION_MANDATORY_WITH_SEPARATOR,t.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,[e,o,a,i,Ue],a,1536,e,Ue)},e.prototype.manyInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,n)},e.prototype.manyInternalLogic=function(e,t,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;for(var u=!0;!0===a.call(this)&&!0===u;)u=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],a,768,e,je,u)},e.prototype.manySepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,t,n)},e.prototype.manySepFirstInternalLogic=function(e,t,n){var r=this,i=t.DEF,o=t.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,[e,o,a,i,De],a,1280,e,De)}},e.prototype.repetitionSepSecondInternal=function(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,1536,e,i)},e.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t},e.prototype.orInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(256,t),r=Object(i.y)(e)?e:e.DEF,o=this.getLaFuncFromCache(n).call(this,r);if(void 0!==o)return r[o].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)},e.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new vt(t,e))}},e.prototype.subruleInternal=function(e,t,n){var r;try{var i=void 0!==n?n.ARGS:void 0;return r=e.call(this,t,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(t){this.subruleInternalError(t,n,e.ruleName)}},e.prototype.subruleInternalError=function(e,t,n){throw pt(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e},e.prototype.consumeInternal=function(e,t,n){var r;try{var i=this.LA(1);!0===this.tokenMatcher(i,e)?(this.consumeToken(),r=i):this.consumeInternalError(e,i,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r},e.prototype.consumeInternalError=function(e,t,n){var r,i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new dt(r,t,i))},e.prototype.consumeInternalRecovery=function(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;var r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw"InRuleRecoveryException"===e.name?n:e}},e.prototype.saveRecogState=function(){var e=this.errors,t=Object(i.g)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},e.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},e.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},e.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},e.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},e.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},e.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),Q)},e.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},e}(),Dt=function(){function e(){}return e.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=Object(i.w)(e,"errorMessageProvider")?e.errorMessageProvider:Qt.errorMessageProvider},e.prototype.SAVE_ERROR=function(e){if(pt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:Object(i.g)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(e.prototype,"errors",{get:function(){return Object(i.g)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),e.prototype.raiseEarlyExitException=function(e,t,n){for(var r=this.getCurrRuleFullName(),i=Je(e,this.getGAstProductions()[r],t,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 gt(s,this.LA(1),this.LA(0)))},e.prototype.raiseNoAltException=function(e,t){for(var n=this.getCurrRuleFullName(),r=Ze(e,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:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new mt(s,this.LA(1),a))},e}(),Ft=function(){function e(){}return e.prototype.initContentAssist=function(){},e.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if(Object(i.F)(n))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return He([n],t,this.tokenMatcher,this.maxLookahead)},e.prototype.getNextPossibleTokenTypes=function(e){var t=Object(i.s)(e.ruleStack),n=this.getGAstProductions()[t];return new Pe(n,e).startWalking()},e}(),Ut={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ut);var Wt=Math.pow(2,8)-1,Ht=J({name:"RECORDING_PHASE_TOKEN",pattern:$.NA});H([Ht]);var Bt=ee(Ht,"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(Bt);var zt={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:{}},Gt=function(){function e(){}return e.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},e.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",(function(){for(var t=function(t){var n=t>0?t:"";e["CONSUME"+n]=function(e,n){return this.consumeInternalRecord(e,t,n)},e["SUBRULE"+n]=function(e,n){return this.subruleInternalRecord(e,t,n)},e["OPTION"+n]=function(e){return this.optionInternalRecord(e,t)},e["OR"+n]=function(e){return this.orInternalRecord(e,t)},e["MANY"+n]=function(e){this.manyInternalRecord(t,e)},e["MANY_SEP"+n]=function(e){this.manySepFirstInternalRecord(t,e)},e["AT_LEAST_ONE"+n]=function(e){this.atLeastOneInternalRecord(t,e)},e["AT_LEAST_ONE_SEP"+n]=function(e){this.atLeastOneSepFirstInternalRecord(t,e)}},n=0;n<10;n++)t(n);e.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},e.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},e.option=function(e,t){return this.optionInternalRecord(t,e)},e.or=function(e,t){return this.orInternalRecord(t,e)},e.many=function(e,t){this.manyInternalRecord(e,t)},e.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD}))},e.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",(function(){for(var t=0;t<10;t++){var n=t>0?t:"";delete e["CONSUME"+n],delete e["SUBRULE"+n],delete e["OPTION"+n],delete e["OR"+n],delete e["MANY"+n],delete e["MANY_SEP"+n],delete e["AT_LEAST_ONE"+n],delete e["AT_LEAST_ONE_SEP"+n]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA}))},e.prototype.ACTION_RECORD=function(e){},e.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},e.prototype.LA_RECORD=function(e){return Zt},e.prototype.topLevelRuleRecord=function(e,t){try{var n=new oe({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.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(t){throw e}throw e}},e.prototype.optionInternalRecord=function(e,t){return Vt.call(this,se,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){Vt.call(this,ue,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){Vt.call(this,ce,t,e,!0)},e.prototype.manyInternalRecord=function(e,t){Vt.call(this,le,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){Vt.call(this,fe,t,e,!0)},e.prototype.orInternalRecord=function(e,t){return Kt.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,t,n){if($t(t),!e||!1===Object(i.w)(e,"ruleName")){var r=new Error(" argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw r.KNOWN_RECORDER_ERROR=!0,r}var o=Object(i.M)(this.recordingProdStack),a=e.ruleName,s=new ie({idx:t,nonTerminalName:a,referencedRule:void 0});return o.definition.push(s),this.outputCst?zt:Ut},e.prototype.consumeInternalRecord=function(e,t,n){if($t(t),!B(e)){var r=new Error(" argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(e)+">\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 pe({idx:t,terminalType:e});return o.definition.push(a),Bt},e}();function Vt(e,t,n,r){void 0===r&&(r=!1),$t(n);var o=Object(i.M)(this.recordingProdStack),a=Object(i.B)(t)?t:t.DEF,s=new e({definition:[],idx:n});return r&&(s.separator=t.SEP),Object(i.w)(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),o.definition.push(s),this.recordingProdStack.pop(),Ut}function Kt(e,t){var n=this;$t(t);var r=Object(i.M)(this.recordingProdStack),o=!1===Object(i.y)(e),a=!1===o?e:e.DEF,s=new he({definition:[],idx:t,ignoreAmbiguities:o&&!0===e.IGNORE_AMBIGUITIES});Object(i.w)(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);var u=Object(i.Q)(a,(function(e){return Object(i.B)(e.GATE)}));return s.hasPredicates=u,r.definition.push(s),Object(i.u)(a,(function(e){var t=new ae({definition:[]});s.definition.push(t),Object(i.w)(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object(i.w)(e,"GATE")&&(t.ignoreAmbiguities=!0),n.recordingProdStack.push(t),e.ALT.call(n),n.recordingProdStack.pop()})),Ut}function qt(e){return 0===e?"":""+e}function $t(e){if(e<0||e>Wt){var t=new Error("Invalid DSL Method idx value: <"+e+">\n\tIdx value must be a none negative value smaller than "+(Wt+1));throw t.KNOWN_RECORDER_ERROR=!0,t}}var Yt=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if(Object(i.w)(e,"traceInitPerf")){var t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Qt.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent");var r=Object(i.R)(t),o=r.time,a=r.value,s=o>10?console.warn:console.log;return this.traceInitIndent time: "+o+"ms"),this.traceInitIndent--,a}return t()},e}(),Xt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zt=ee(Q,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Zt);var Jt,Qt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Ne,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),en=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});function tn(e){return void 0===e&&(e=void 0),function(){return e}}!function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(Jt||(Jt={}));var nn=function(){function e(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;if(this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initContentAssist(),this.initGastRecorder(t),this.initPerformanceTracer(t),Object(i.w)(t,"ignoredIssues"))throw new Error("The IParserConfig property has been deprecated.\n\tPlease use the 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)(t,"skipValidations")?t.skipValidations:Qt.skipValidations}return e.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")},e.prototype.performSelfAnalysis=function(){var t=this;this.TRACE_INIT("performSelfAnalysis",(function(){var n;t.selfAnalysisDone=!0;var r=t.className;t.TRACE_INIT("toFastProps",(function(){Object(i.S)(t)})),t.TRACE_INIT("Grammar Recording",(function(){try{t.enableRecording(),Object(i.u)(t.definedRulesNames,(function(e){var n=t[e].originalGrammarAction,r=void 0;t.TRACE_INIT(e+" Rule",(function(){r=t.topLevelRuleRecord(e,n)})),t.gastProductionsCache[e]=r}))}finally{t.disableRecording()}}));var o=[];if(t.TRACE_INIT("Grammar Resolving",(function(){o=ct({rules:Object(i.U)(t.gastProductionsCache)}),t.definitionErrors.push.apply(t.definitionErrors,o)})),t.TRACE_INIT("Grammar Validations",(function(){if(Object(i.A)(o)&&!1===t.skipValidations){var e=lt({rules:Object(i.U)(t.gastProductionsCache),maxLookahead:t.maxLookahead,tokenTypes:Object(i.U)(t.tokensMap),errMsgProvider:Le,grammarName:r});t.definitionErrors.push.apply(t.definitionErrors,e)}})),Object(i.A)(t.definitionErrors)&&(t.recoveryEnabled&&t.TRACE_INIT("computeAllProdsFollows",(function(){var e,n,r=(e=Object(i.U)(t.gastProductionsCache),n={},Object(i.u)(e,(function(e){var t=new ke(e).startWalking();Object(i.f)(n,t)})),n);t.resyncFollows=r})),t.TRACE_INIT("ComputeLookaheadFunctions",(function(){t.preComputeLookaheadFunctions(Object(i.U)(t.gastProductionsCache))}))),!e.DEFER_DEFINITION_ERRORS_HANDLING&&!Object(i.A)(t.definitionErrors))throw n=Object(i.I)(t.definitionErrors,(function(e){return e.message})),new Error("Parser Definition Errors detected:\n "+n.join("\n-------------------------------\n"))}))},e.DEFER_DEFINITION_ERRORS_HANDLING=!1,e}();Object(i.e)(nn,[Tt,St,Mt,Pt,jt,_t,Dt,Ft,Gt,Yt]);var rn=function(e){function t(t,n){void 0===n&&(n=Qt);var r=Object(i.h)(n);return r.outputCst=!0,e.call(this,t,r)||this}return Xt(t,e),t}(nn),on=function(e){function t(t,n){void 0===n&&(n=Qt);var r=Object(i.h)(n);return r.outputCst=!1,e.call(this,t,r)||this}return Xt(t,e),t}(nn);function an(e,t){var n=void 0===t?{}:t,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\n\n\n\n'+("\n\n")+("\n