140 lines
175 KiB
JavaScript
140 lines
175 KiB
JavaScript
|
|
import{At as e,Bt as t,C as n,Ct as r,E as i,Et as a,Ft as o,K as s,Tt as c,V as l,Z as u,_t as d,c as f,dt as p,et as m,f as h,ft as g,gt as _,h as v,l as y,m as b,p as x,pt as S,q as C,rt as w,tt as T,u as E,v as D,w as O,wt as k,y as A,yt as j,z as M,zt as N}from"./three.module-BFsVh7r1.js";var P=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),F=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION=`9.0.1`}),I=P((e,t)=>{var n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=e.timer=e.peek=e.isES2015MapSupported=e.PRINT_WARNING=e.PRINT_ERROR=e.packArray=e.IDENTITY=e.NOOP=e.merge=e.groupBy=e.defaults=e.assignNoOverwrite=e.assign=e.zipObject=e.sortBy=e.indexOf=e.some=e.difference=e.every=e.isObject=e.isRegExp=e.isArray=e.partial=e.uniq=e.compact=e.reduce=e.findAll=e.find=e.cloneObj=e.cloneArr=e.contains=e.has=e.pick=e.reject=e.filter=e.dropRight=e.drop=e.isFunction=e.isUndefined=e.isString=e.forEach=e.last=e.first=e.flatten=e.map=e.mapValues=e.values=e.keys=e.isEmpty=void 0;function r(e){return e&&e.length===0}e.isEmpty=r;function i(e){return e==null?[]:Object.keys(e)}e.keys=i;function a(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t}e.values=a;function o(e,t){for(var n=[],r=i(e),a=0;a<r.length;a++){var o=r[a];n.push(t.call(null,e[o],o))}return n}e.mapValues=o;function s(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t.call(null,e[r],r));return n}e.map=s;function c(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];Array.isArray(r)?t=t.concat(c(r)):t.push(r)}return t}e.flatten=c;function l(e){return r(e)?void 0:e[0]}e.first=l;function u(e){var t=e&&e.length;return t?e[t-1]:void 0}e.last=u;function d(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t.call(null,e[n],n);else if(M(e))for(var r=i(e),n=0;n<r.length;n++){var a=r[n],o=e[a];t.call(null,o,a)}else throw Error(`non exhaustive match`)}e.forEach=d;function f(e){return typeof e==`string`}e.isString=f;function p(e){return e===void 0}e.isUndefined=p;function m(e){return e instanceof Function}e.isFunction=m;function h(e,t){return t===void 0&&(t=1),e.slice(t,e.length)}e.drop=h;function g(e,t){return t===void 0&&(t=1),e.slice(0,e.length-t)}e.dropRight=g;function _(e,t){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.filter=_;function v(e,t){return _(e,function(e){return!t(e)})}e.reject=v;function y(e,t){for(var n=Object.keys(e),r={},i=0;i<n.length;i++){var a=n[i],o=e[a];t(o)&&(r[a]=o)}return r}e.pick=y;function b(e,t){return M(e)?e.hasOwnProperty(t):!1}e.has=b;function x(e,t){return w(e,function(e){return e===t})!==void 0}e.contains=x;function S(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}e.cloneArr=S;function C(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}e.cloneObj=C;function w(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t.call(null,r))return r}}e.find=w;function T(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.findAll=T;function E(e,t,n){for(var r=Array.isArray(e),o=r?e:a(e),s=r?[]:i(e),c=n,l=0;l<o.length;l++)c=t.call(null,c,o[l],r?l:s[l]);return c}e.reduce=E;function D(e){return v(e,function(e){return e==null})}e.compact=D;function O(e,t){t===void 0&&(t=function(e){return e});var n=[];return E(e,function(e,r){var i=t(r);return x(n,i)?e:(n.push(i),e.concat(r))},[])}e.uniq=O;function k(e){var t=[...arguments].slice(1),n=[null].concat(t);return Function.bind.apply(e,n)}e.partial=k;function A(e){return Array.isArray(e)}e.isArray=A;function j(e){return e instanceof RegExp}e.isRegExp=j;function M(e){return e instanceof Object}e.isObject=M;function N(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}e.every=N;function P(e,t){return v(e,function(e){return x(t,e)})}e.difference=P;function F(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!0;return!1}e.some=F;function I(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-
|
|||
|
|
`),i(`\r`),i(`\u2028`),i(`\u2029`)]}},e.prototype.atomEscape=function(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:`GroupBackReference`,value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case`d`:e=u;break;case`D`:e=u,t=!0;break;case`s`:e=f;break;case`S`:e=f,t=!0;break;case`w`:e=d;break;case`W`:e=d,t=!0;break}return s(e),{type:`Set`,value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case`f`:e=i(`\f`);break;case`n`:e=i(`
|
|||
|
|
`);break;case`r`:e=i(`\r`);break;case`t`:e=i(` `);break;case`v`:e=i(`\v`);break}return s(e),{type:`Character`,value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar(`c`);var e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar(`0`),{type:`Character`,value:i(`\0`)}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar(`x`),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar(`u`),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:`Character`,value:i(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|||
|
|
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:i(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){var n=this.classAtom();if(n.type===`Character`&&this.isRangeDash()){this.consumeChar(`-`);var r=this.classAtom();if(r.type===`Character`){if(r.value<n.value)throw Error(`Range out of order in character class`);e.push({from:n.value,to:r.value})}else a(n.value,e),e.push(i(`-`)),a(r.value,e)}else a(n.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case`]`:case`
|
|||
|
|
`:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}},e.prototype.classEscape=function(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:i(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.group=function(){var e=!0;switch(this.consumeChar(`(`),this.peekChar(0)){case`?`:this.consumeChar(`?`),this.consumeChar(`:`),e=!1;break;default:this.groupIdx++;break}var t=this.disjunction();this.consumeChar(`)`);var n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n},e.prototype.positiveInteger=function(){var e=this.popChar();if(r.test(e)===!1)throw Error(`Expecting a positive integer`);for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.integerIncludingZero=function(){var e=this.popChar();if(n.test(e)===!1)throw Error(`Expecting an integer`);for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.patternCharacter=function(){var e=this.popChar();switch(e){case`
|
|||
|
|
`:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:i(e)}}},e.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}},e.prototype.isRangeDash=function(){return this.peekChar()===`-`&&this.isClassAtom(1)},e.prototype.isDigit=function(){return n.test(this.peekChar(0))},e.prototype.isClassAtom=function(e){switch(e===void 0&&(e=0),this.peekChar(e)){case`]`:case`
|
|||
|
|
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}},e.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},e.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}},e.prototype.isAssertion=function(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`);default:return!1}},e.prototype.isQuantifier=function(){var e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}},e.prototype.isPatternCharacter=function(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
|
|||
|
|
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}},e.prototype.parseHexDigits=function(e){for(var n=``,r=0;r<e;r++){var i=this.popChar();if(t.test(i)===!1)throw Error(`Expecting a HexDecimal digits`);n+=i}return{type:`Character`,value:parseInt(n,16)}},e.prototype.peekChar=function(e){return e===void 0&&(e=0),this.input[this.idx+e]},e.prototype.popChar=function(){var e=this.peekChar(0);return this.consumeChar(),e},e.prototype.consumeChar=function(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++},e.prototype.loc=function(e){return{begin:e,end:this.idx}};var t=/[0-9a-fA-F]/,n=/[0-9]/,r=/[1-9]/;function i(e){return e.charCodeAt(0)}function a(e,t){e.length===void 0?t.push(e):e.forEach(function(e){t.push(e)})}function o(e,t){if(e[t]===!0)throw`duplicate flag `+t;e[t]=!0}function s(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`)}function c(){throw Error(`Internal Error - Should never get here!`)}var l,u=[];for(l=i(`0`);l<=i(`9`);l++)u.push(l);var d=[i(`_`)].concat(u);for(l=i(`a`);l<=i(`z`);l++)d.push(l);for(l=i(`A`);l<=i(`Z`);l++)d.push(l);var f=[i(` `),i(`\f`),i(`
|
|||
|
|
`),i(`\r`),i(` `),i(`\v`),i(` `),i(`\xA0`),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(`\u2028`),i(`\u2029`),i(` `),i(` `),i(` `),i(``)];function p(){}return p.prototype.visitChildren=function(e){for(var t in e){var n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(function(e){this.visit(e)},this):this.visit(n))}},p.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);break}this.visitChildren(e)},p.prototype.visitPattern=function(e){},p.prototype.visitFlags=function(e){},p.prototype.visitDisjunction=function(e){},p.prototype.visitAlternative=function(e){},p.prototype.visitStartAnchor=function(e){},p.prototype.visitEndAnchor=function(e){},p.prototype.visitWordBoundary=function(e){},p.prototype.visitNonWordBoundary=function(e){},p.prototype.visitLookahead=function(e){},p.prototype.visitNegativeLookahead=function(e){},p.prototype.visitCharacter=function(e){},p.prototype.visitSet=function(e){},p.prototype.visitGroup=function(e){},p.prototype.visitGroupBackReference=function(e){},p.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:p,VERSION:`0.5.0`}})}),te=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.clearRegExpParserCache=e.getRegExpAst=void 0;var t=ee(),n={},r=new t.RegExpParser;function i(e){var t=e.toString();if(n.hasOwnProperty(t))return n[t];var i=r.pattern(t);return n[t]=i,i}e.getRegExpAst=i;function a(){n={}}e.clearRegExpParserCache=a}),ne=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.canMatchCharCode=e.firstCharOptimizedIndices=e.getOptimizedStartCodesIndices=e.failedOptimizationPrefixMsg=void 0;var n=ee(),r=I(),i=te(),a=L(),o=`Complement Sets are not supported for first char optimization`;e.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
|
|||
|
|
`;function s(t,a){a===void 0&&(a=!1);try{var s=i.getRegExpAst(t);return c(s.value,{},s.flags.ignoreCase)}catch(i){if(i.message===o)a&&r.PRINT_WARNING(``+e.failedOptimizationPrefixMsg+(` Unable to optimize: < `+t.toString()+` >
|
|||
|
|
`)+` Complement Sets cannot be automatically optimized.
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var l=``;a&&(l=`
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),r.PRINT_ERROR(e.failedOptimizationPrefixMsg+`
|
|||
|
|
`+(` Failed parsing: < `+t.toString()+` >
|
|||
|
|
`)+(` Using the regexp-to-ast library version: `+n.VERSION+`
|
|||
|
|
`)+` Please open an issue at: https://github.com/bd82/regexp-to-ast/issues`+l)}}return[]}e.getOptimizedStartCodesIndices=s;function c(e,t,n){switch(e.type){case`Disjunction`:for(var i=0;i<e.value.length;i++)c(e.value[i],t,n);break;case`Alternative`:for(var s=e.value,i=0;i<s.length;i++){var u=s[i];switch(u.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}var d=u;switch(d.type){case`Character`:l(d.value,t,n);break;case`Set`:if(d.complement===!0)throw Error(o);r.forEach(d.value,function(e){if(typeof e==`number`)l(e,t,n);else{var r=e;if(n===!0)for(var i=r.from;i<=r.to;i++)l(i,t,n);else{for(var i=r.from;i<=r.to&&i<a.minOptimizationVal;i++)l(i,t,n);if(r.to>=a.minOptimizationVal)for(var o=r.from>=a.minOptimizationVal?r.from:a.minOptimizationVal,s=r.to,c=a.charCodeToOptimizedIndex(o),u=a.charCodeToOptimizedIndex(s),d=c;d<=u;d++)t[d]=d}}});break;case`Group`:c(d.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}var p=d.quantifier!==void 0&&d.quantifier.atLeast===0;if(d.type===`Group`&&f(d)===!1||d.type!==`Group`&&p===!1)break}break;default:throw Error(`non exhaustive match!`)}return r.values(t)}e.firstCharOptimizedIndices=c;function l(e,t,n){var r=a.charCodeToOptimizedIndex(e);t[r]=r,n===!0&&u(e,t)}function u(e,t){var n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){var i=a.charCodeToOptimizedIndex(r.charCodeAt(0));t[i]=i}else{var o=n.toLowerCase();if(o!==n){var i=a.charCodeToOptimizedIndex(o.charCodeAt(0));t[i]=i}}}function d(e,t){return r.find(e.value,function(e){if(typeof e==`number`)return r.contains(t,e);var n=e;return r.find(t,function(e){return n.from<=e&&e<=n.to})!==void 0})}function f(e){return e.quantifier&&e.quantifier.atLeast===0?!0:e.value?r.isArray(e.value)?r.every(e.value,f):f(e.value):!1}var p=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return n.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case`Lookahead`:this.visitLookahead(t);return;case`NegativeLookahead`:this.visitNegativeLookahead(t);return}e.prototype.visitChildren.call(this,t)}},n.prototype.visitCharacter=function(e){r.contains(this.targetCharCodes,e.value)&&(this.found=!0)},n.prototype.visitSet=function(e){e.complement?d(e,this.targetCharCodes)===void 0&&(this.found=!0):d(e,this.targetCharCodes)!==void 0&&(this.found=!0)},n}(n.BaseRegExpVisitor);function m(e,t){if(t instanceof RegExp){var n=i.getRegExpAst(t),a=new p(e);return a.visit(n),a.found}else return r.find(t,function(t){return r.contains(e,t.charCodeAt(0))})!==void 0}e.canMatchCharCode=m}),L=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.charCodeToOptimizedIndex=e.minOptimizationVal=e.buildLineBreakIssueMessage=e.LineTerminatorOptimizedTester=e.isShortPattern=e.isCustomPattern=e.cloneEmptyGroups=e.performWarningRuntimeChecks=e.performRuntimeChecks=e.addStickyFlag=e.addStartOfInput=e.findUnreachablePatterns=e.findModesThatDoNotExist=e.findInvalidGroupType=e.findDuplicatePatterns=e.findUnsupportedFlags=e.findStartOfInputAnchor=e.findEmptyMatchRegExps=e.findEndOfInputAnchor=e.findInvalidPatterns=e.findMissingPatterns=e.validatePatterns=e.analyzeTokenTypes=e.enableSticky=e.disableSticky=e.SUPPORT_STICKY=e.MODES=e.DEFAULT_MODE=void 0;var n=ee(),r=re(),i=I(),a=ne(),o=te(),s=`PATTERN`;e.DEFAULT_MODE=`defaultMode`,e.MODES=`modes`,e.SUPPORT_STICKY=typeof RegExp(`(?:)`).sticky==`boolean`;function c(){e.SUPPORT_STICKY=!1}e.disableSticky=c;function l(){e.SUPPORT_STICKY=!0}e.enableSticky=l;function u(t,n){n=i.defaults(n,{use
|
|||
|
|
`],tracer:function(e,t){return t()}});var o=n.tracer;o(`initCharCodeToOptimizedIndexMap`,function(){V()});var c;o(`Reject Lexer.NA`,function(){c=i.reject(t,function(e){return e[s]===r.Lexer.NA})});var l=!1,u;o(`Transform Patterns`,function(){l=!1,u=i.map(c,function(e){var t=e[s];if(i.isRegExp(t)){var r=t.source;return r.length===1&&r!==`^`&&r!==`$`&&r!==`.`&&!t.ignoreCase?r:r.length===2&&r[0]===`\\`&&!i.contains([`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`],r[1])?r[1]:n.useSticky?O(t):D(t)}else{if(i.isFunction(t))return l=!0,{exec:t};if(i.has(t,`exec`))return l=!0,t;if(typeof t==`string`){if(t.length===1)return t;var a=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),o=new RegExp(a);return n.useSticky?O(o):D(o)}else throw Error(`non exhaustive match`)}})});var d,f,p,m,h;o(`misc mapping`,function(){d=i.map(c,function(e){return e.tokenTypeIdx}),f=i.map(c,function(e){var t=e.GROUP;if(t!==r.Lexer.SKIPPED){if(i.isString(t))return t;if(i.isUndefined(t))return!1;throw Error(`non exhaustive match`)}}),p=i.map(c,function(e){var t=e.LONGER_ALT;if(t)return i.indexOf(c,t)}),m=i.map(c,function(e){return e.PUSH_MODE}),h=i.map(c,function(e){return i.has(e,`POP_MODE`)})});var g;o(`Line Terminator Handling`,function(){var e=L(n.lineTerminatorCharacters);g=i.map(c,function(e){return!1}),n.positionTracking!==`onlyOffset`&&(g=i.map(c,function(t){if(i.has(t,`LINE_BREAKS`))return t.LINE_BREAKS;if(P(t,e)===!1)return a.canMatchCharCode(e,t.PATTERN)}))});var _,v,y,b;o(`Misc Mapping #2`,function(){_=i.map(c,M),v=i.map(u,N),y=i.reduce(c,function(e,t){var n=t.GROUP;return i.isString(n)&&n!==r.Lexer.SKIPPED&&(e[n]=[]),e},{}),b=i.map(u,function(e,t){return{pattern:u[t],longerAlt:p[t],canLineTerminator:g[t],isCustom:_[t],short:v[t],group:f[t],push:m[t],pop:h[t],tokenTypeIdx:d[t],tokenType:c[t]}})});var x=!0,S=[];return n.safeMode||o(`First Char Optimization`,function(){S=i.reduce(c,function(e,t,r){if(typeof t.PATTERN==`string`)R(e,B(t.PATTERN.charCodeAt(0)),b[r]);else if(i.isArray(t.START_CHARS_HINT)){var o;i.forEach(t.START_CHARS_HINT,function(t){var n=B(typeof t==`string`?t.charCodeAt(0):t);o!==n&&(o=n,R(e,n,b[r]))})}else if(i.isRegExp(t.PATTERN))if(t.PATTERN.unicode)x=!1,n.ensureOptimizations&&i.PRINT_ERROR(``+a.failedOptimizationPrefixMsg+(` Unable to analyze < `+t.PATTERN.toString()+` > pattern.
|
|||
|
|
`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var s=a.getOptimizedStartCodesIndices(t.PATTERN,n.ensureOptimizations);i.isEmpty(s)&&(x=!1),i.forEach(s,function(t){R(e,t,b[r])})}else n.ensureOptimizations&&i.PRINT_ERROR(``+a.failedOptimizationPrefixMsg+(` TokenType: <`+t.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|||
|
|
`)+` This will disable the lexer's first char optimizations.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),x=!1;return e},[])}),o(`ArrayPacking`,function(){S=i.packArray(S)}),{emptyGroups:y,patternIdxToConfig:b,charCodeToPatternIdxToConfig:S,hasCustom:l,canBeOptimized:x}}e.analyzeTokenTypes=u;function d(e,t){var n=[],r=p(e);n=n.concat(r.errors);var i=m(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(f(a)),n=n.concat(S(a)),n=n.concat(C(a,t)),n=n.concat(w(a)),n}e.validatePatterns=d;function f(e){var t=[],n=i.filter(e,function(e){return i.isRegExp(e[s])});return t=t.concat(g(n)),t=t.concat(y(n)),t=t.concat(b(n)),t=t.concat(x(n)),t=t.concat(_(n)),t}function p(e){var t=i.filter(e,function(e){return!i.has(e,s)});return{errors:i.map(t,function(e){return{message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:r.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[e]}}),valid:i.difference(e,t)}}e.findMissingPatterns=p;function m(e){var t=i.filter(e,function(e){var t=e[s];return!i.isRegExp(t)&&!i.isFunction(t)&&!i.has(t,`exec`)&&!i.isString(t)});return{errors:i.map(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:r.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[e]}}),valid:i.difference(e,t)}}e.findInvalidPatterns=m;var h=/[^\\][\$]/;function g(e){var a=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.found=!1,t}return n.prototype.visitEndAnchor=function(e){this.found=!0},n}(n.BaseRegExpVisitor),c=i.filter(e,function(e){var t=e[s];try{var n=o.getRegExpAst(t),r=new a;return r.visit(n),r.found}catch{return h.test(t.source)}});return i.map(c,function(e){return{message:`Unexpected RegExp Anchor Error:
|
|||
|
|
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|||
|
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[e]}})}e.findEndOfInputAnchor=g;function _(e){var t=i.filter(e,function(e){return e[s].test(``)});return i.map(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:r.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[e]}})}e.findEmptyMatchRegExps=_;var v=/[^\\[][\^]|^\^/;function y(e){var a=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.found=!1,t}return n.prototype.visitStartAnchor=function(e){this.found=!0},n}(n.BaseRegExpVisitor),c=i.filter(e,function(e){var t=e[s];try{var n=o.getRegExpAst(t),r=new a;return r.visit(n),r.found}catch{return v.test(t.source)}});return i.map(c,function(e){return{message:`Unexpected RegExp Anchor Error:
|
|||
|
|
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:r.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[e]}})}e.findStartOfInputAnchor=y;function b(e){var t=i.filter(e,function(e){var t=e[s];return t instanceof RegExp&&(t.multiline||t.global)});return i.map(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:r.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}})}e.findUnsupportedFlags=b;function x(e){var t=[],n=i.map(e,function(n){return i.reduce(e,function(e,a){return n.PATTERN.source===a.PATTERN.source&&!i.contains(t,a)&&a.PATTERN!==r.Lexer.NA&&(t.push(a),e.push(a)),e},[])});n=i.compact(n);var a=i.filter(n,function(e){return e.length>1});return i.map(a,function(e){var t=i.map(e,function(e){return e.name});return{message:`The same RegExp pattern ->`+i.first(e).PATTERN+`<-`+(`has been used in all of the following Token Types: `+t.join(`, `)+` <-`),type:r.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}e.findDuplicatePatterns=x;function S(e){var t=i.filter(e,function(e){if(!i.has(e,`GROUP`))return!1;var t=e.GROUP;return t!==r.Lexer.SKIPPED&&t!==r.Lexer.NA&&!i.isString(t)});return i.map(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:r.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}})}e.findInvalidGroupType=S;function C(e,t){var n=i.filter(e,function(e){return e.PUSH_MODE!==void 0&&!i.contains(t,e.PUSH_MODE)});return i.map(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:r.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}})}e.findModesThatDoNotExist=C;function w(e){var t=[],n=i.reduce(e,function(e,t,n){var a=t.PATTERN;return a===r.Lexer.NA||(i.isString(a)?e.push({str:a,idx:n,tokenType:t}):i.isRegExp(a)&&E(a)&&e.push({str:a.source,idx:n,tokenType:t})),e},[]);return i.forEach(e,function(e,a){i.forEach(n,function(n){var i=n.str,o=n.idx,s=n.tokenType;if(a<o&&T(i,e.PATTERN)){var c=`Token: ->`+s.name+`<- can never be matched.
|
|||
|
|
`+(`Because it appears AFTER the Token Type ->`+e.name+`<-`)+`in the lexer's definition.
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:c,type:r.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}})}),t}e.findUnreachablePatterns=w;function T(e,t){if(i.isRegExp(t)){var n=t.exec(e);return n!==null&&n.index===0}else{if(i.isFunction(t))return t(e,0,[],{});if(i.has(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}}function E(e){return i.find([`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`],function(t){return e.source.indexOf(t)!==-1})===void 0}function D(e){var t=e.ignoreCase?`i`:``;return RegExp(`^(?:`+e.source+`)`,t)}e.addStartOfInput=D;function O(e){var t=e.ignoreCase?`iy`:`y`;return RegExp(``+e.source,t)}e.addStickyFlag=O;function k(t,n,a){var o=[];return i.has(t,e.DEFAULT_MODE)||o.push({message:`A MultiMode Lexer cannot be initialized without a <`+e.DEFAULT_MODE+`> property in its definition
|
|||
|
|
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),i.has(t,e.MODES)||o.push({message:`A MultiMode Lexer cannot be initialized without a <`+e.MODES+`> property in its definition
|
|||
|
|
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),i.has(t,e.MODES)&&i.has(t,e.DEFAULT_MODE)&&!i.has(t.modes,t.defaultMode)&&o.push({message:`A MultiMode Lexer cannot be initialized with a `+e.DEFAULT_MODE+`: <`+t.defaultMode+`>which does not exist
|
|||
|
|
`,type:r.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),i.has(t,e.MODES)&&i.forEach(t.modes,function(e,t){i.forEach(e,function(e,n){i.isUndefined(e)&&o.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:`+(`<`+t+`> at index: <`+n+`>
|
|||
|
|
`),type:r.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),o}e.performRuntimeChecks=k;function A(e,t,n){var o=[],c=!1,l=i.compact(i.flatten(i.mapValues(e.modes,function(e){return e}))),u=i.reject(l,function(e){return e[s]===r.Lexer.NA}),d=L(n);return t&&i.forEach(u,function(e){var t=P(e,d);if(t!==!1){var n={message:F(e,t),type:t.issue,tokenType:e};o.push(n)}else i.has(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(c=!0):a.canMatchCharCode(d,e.PATTERN)&&(c=!0)}),t&&!c&&o.push({message:`Warning: No LINE_BREAKS Found.
|
|||
|
|
This Lexer has been defined to track line and column information,
|
|||
|
|
But none of the Token Types can be identified as matching a line terminator.
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|||
|
|
for details.`,type:r.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),o}e.performWarningRuntimeChecks=A;function j(e){var t={},n=i.keys(e);return i.forEach(n,function(n){var r=e[n];if(i.isArray(r))t[n]=[];else throw Error(`non exhaustive match`)}),t}e.cloneEmptyGroups=j;function M(e){var t=e.PATTERN;if(i.isRegExp(t))return!1;if(i.isFunction(t)||i.has(t,`exec`))return!0;if(i.isString(t))return!1;throw Error(`non exhaustive match`)}e.isCustomPattern=M;function N(e){return i.isString(e)&&e.length===1?e.charCodeAt(0):!1}e.isShortPattern=N,e.LineTerminatorOptimizedTester={test:function(e){for(var t=e.length,n=this.lastIndex;n<t;n++){var r=e.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return e.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function P(e,t){if(i.has(e,`LINE_BREAKS`))return!1;if(i.isRegExp(e.PATTERN)){try{a.canMatchCharCode(t,e.PATTERN)}catch(e){return{issue:r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}else{if(i.isString(e.PATTERN))return!1;if(M(e))return{issue:r.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}}function F(e,t){if(t.issue===r.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|||
|
|
`+(` The problem is in the <`+e.name+`> Token Type
|
|||
|
|
`)+(` Root cause: `+t.errMsg+`.
|
|||
|
|
`)+` For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===r.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|||
|
|
`+(` The problem is in the <`+e.name+`> Token Type
|
|||
|
|
`)+` For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}e.buildLineBreakIssueMessage=F;function L(e){return i.map(e,function(e){return i.isString(e)&&e.length>0?e.charCodeAt(0):e})}function R(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}e.minOptimizationVal=256;var z=[];function B(t){return t<e.minOptimizationVal?t:z[t]}e.charCodeToOptimizedIndex=B;function V(){if(i.isEmpty(z)){z=Array(65536);for(var e=0;e<65536;e++)z[e]=e>255?255+~~(e/255):e}}}),R=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isTokenType=e.hasExtendingTokensTypesMapProperty=e.hasExtendingTokensTypesProperty=e.hasCategoriesProperty=e.hasShortKeyProperty=e.singleAssignCategoriesToksMap=e.assignCategoriesMapProp=e.assignCategoriesTokensProp=e.assignTokenDefaultProps=e.expandCategories=e.augmentTokenTypes=e.tokenIdxToClass=e.tokenShortNameIdx=e.tokenStructuredMatcherNoCategories=e.tokenStructuredMatcher=void 0;var t=I();function n(e,t){var n=e.tokenTypeIdx;return n===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[n]===!0}e.tokenStructuredMatcher=n;function r(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}e.tokenStructuredMatcherNoCategories=r,e.tokenShortNameIdx=1,e.tokenIdxToClass={};function i(e){var n=a(e);o(n),c(n),s(n),t.forEach(n,function(e){e.isParent=e.categoryMatches.length>0})}e.augmentTokenTypes=i;function a(e){for(var n=t.cloneArr(e),r=e,i=!0;i;){r=t.compact(t.flatten(t.map(r,function(e){return e.CATEGORIES})));var a=t.difference(r,n);n=n.concat(a),t.isEmpty(a)?i=!1:r=a}return n}e.expandCategories=a;function o(n){t.forEach(n,function(n){u(n)||(e.tokenIdxToClass[e.tokenShortNameIdx]=n,n.tokenTypeIdx=e.tokenShortNameIdx++),d(n)&&!t.isArray(n.CATEGORIES)&&(n.CATEGORIES=[n.CATEGORIES]),d(n)||(n.CATEGORIES=[]),f(n)||(n.categoryMatches=[]),p(n)||(n.categoryMatchesMap={})})}e.assignTokenDefaultProps=o;function s(n){t.forEach(n,function(n){n.categoryMatches=[],t.forEach(n.categoryMatchesMap,function(t,r){n.categoryMatches.push(e.tokenIdxToClass[r].tokenTypeIdx)})})}e.assignCategoriesTokensProp=s;function c(e){t.forEach(e,function(e){l([],e)})}e.assignCategoriesMapProp=c;function l(e,n){t.forEach(e,function(e){n.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.forEach(n.CATEGORIES,function(r){var i=e.concat(n);t.contains(i,r)||l(i,r)})}e.singleAssignCategoriesToksMap=l;function u(e){return t.has(e,`tokenTypeIdx`)}e.hasShortKeyProperty=u;function d(e){return t.has(e,`CATEGORIES`)}e.hasCategoriesProperty=d;function f(e){return t.has(e,`categoryMatches`)}e.hasExtendingTokensTypesProperty=f;function p(e){return t.has(e,`categoryMatchesMap`)}e.hasExtendingTokensTypesMapProperty=p;function m(e){return t.has(e,`tokenTypeIdx`)}e.isTokenType=m}),z=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultLexerErrorProvider=void 0,e.defaultLexerErrorProvider={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.`)}}}),re=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=e.LexerDefinitionErrorType=void 0;var t=L(),n=I(),r=R(),i=z(),a=te();(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
|
|||
|
|
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:i.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(o),e.Lexer=function(){function e(e,i){var s=this;if(i===void 0&&(i=o),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={},typeof i==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|||
|
|
a boolean 2nd argument is no longer supported`);this.config=n.merge(o,i);var c=this.config.traceInitPerf;c===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof c==`number`&&(this.traceInitMaxIdent=c,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,function(){var c,l=!0;s.TRACE_INIT(`Lexer Config handling`,function(){if(s.config.lineTerminatorsPattern===o.lineTerminatorsPattern)s.config.lineTerminatorsPattern=t.LineTerminatorOptimizedTester;else if(s.config.lineTerminatorCharacters===o.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(i.safeMode&&i.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);s.trackStartLines=/full|onlyStart/i.test(s.config.positionTracking),s.trackEndLines=/full/i.test(s.config.positionTracking),n.isArray(e)?(c={modes:{}},c.modes[t.DEFAULT_MODE]=n.cloneArr(e),c[t.DEFAULT_MODE]=t.DEFAULT_MODE):(l=!1,c=n.cloneObj(e))}),s.config.skipValidations===!1&&(s.TRACE_INIT(`performRuntimeChecks`,function(){s.lexerDefinitionErrors=s.lexerDefinitionErrors.concat(t.performRuntimeChecks(c,s.trackStartLines,s.config.lineTerminatorCharacters))}),s.TRACE_INIT(`performWarningRuntimeChecks`,function(){s.lexerDefinitionWarning=s.lexerDefinitionWarning.concat(t.performWarningRuntimeChecks(c,s.trackStartLines,s.config.lineTerminatorCharacters))})),c.modes=c.modes?c.modes:{},n.forEach(c.modes,function(e,t){c.modes[t]=n.reject(e,function(e){return n.isUndefined(e)})});var u=n.keys(c.modes);if(n.forEach(c.modes,function(e,a){s.TRACE_INIT(`Mode: <`+a+`> processing`,function(){if(s.modes.push(a),s.config.skipValidations===!1&&s.TRACE_INIT(`validatePatterns`,function(){s.lexerDefinitionErrors=s.lexerDefinitionErrors.concat(t.validatePatterns(e,u))}),n.isEmpty(s.lexerDefinitionErrors)){r.augmentTokenTypes(e);var o;s.TRACE_INIT(`analyzeTokenTypes`,function(){o=t.analyzeTokenTypes(e,{lineTerminatorCharacters:s.config.lineTerminatorCharacters,positionTracking:i.positionTracking,ensureOptimizations:i.ensureOptimizations,safeMode:i.safeMode,tracer:s.TRACE_INIT.bind(s)})}),s.patternIdxToConfig[a]=o.patternIdxToConfig,s.charCodeToPatternIdxToConfig[a]=o.charCodeToPatternIdxToConfig,s.emptyGroups=n.merge(s.emptyGroups,o.emptyGroups),s.hasCustom=o.hasCustom||s.hasCustom,s.canModeBeOptimized[a]=o.canBeOptimized}})}),s.defaultMode=c.defaultMode,!n.isEmpty(s.lexerDefinitionErrors)&&!s.config.deferDefinitionErrorsHandling){var d=n.map(s.lexerDefinitionErrors,function(e){return e.message}).join(`-----------------------
|
|||
|
|
`);throw Error(`Errors detected in definition of Lexer:
|
|||
|
|
`+d)}n.forEach(s.lexerDefinitionWarning,function(e){n.PRINT_WARNING(e.message)}),s.TRACE_INIT(`Choosing sub-methods implementations`,function(){if(t.SUPPORT_STICKY?(s.chopInput=n.IDENTITY,s.match=s.matchWithTest):(s.updateLastIndex=n.NOOP,s.match=s.matchWithExec),l&&(s.handleModes=n.NOOP),s.trackStartLines===!1&&(s.computeNewColumn=n.IDENTITY),s.trackEndLines===!1&&(s.updateTokenEndLineColumnLocation=n.NOOP),/full/i.test(s.config.positionTracking))s.createTokenInstance=s.createFullToken;else if(/onlyStart/i.test(s.config.positionTracking))s.createTokenInstance=s.createStartOnlyToken;else if(/onlyOffset/i.test(s.config.positionTracking))s.createTokenInstance=s.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "`+s.config.positionTracking+`"`);s.hasCustom?(s.addToken=s.addTokenUsingPush,s.handlePayload=s.handlePayloadWithCustom):(s.addToken=s.addTokenUsingMemberAccess,s.handlePayload=s.handlePayloadNoCustom)}),s.TRACE_INIT(`Failed Optimization Warnings`,function(){var e=n.reduce(s.canModeBeOptimized,function(e,t,n){return t===!1&&e.push(n),e},[]);if(i.ensureOptimizations&&!n.isEmpty(e))throw Error(`Lexer Modes: < `+e.join(`, `)+` > cannot be optimized.
|
|||
|
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|||
|
|
Or inspect the console log for details on how to resolve these issues.`)}),s.TRACE_INIT(`clearRegExpParserCache`,function(){a.clearRegExpParserCache()}),s.TRACE_INIT(`toFastProperties`,function(){n.toFastProperties(s)})})}return e.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!n.isEmpty(this.lexerDefinitionErrors)){var r=n.map(this.lexerDefinitionErrors,function(e){return e.message}).join(`-----------------------
|
|||
|
|
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|||
|
|
`+r)}return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,r){var i=this,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y=e,b=y.length,x=0,S=0,C=this.hasCustom?0:Math.floor(e.length/10),w=Array(C),T=[],E=this.trackStartLines?1:void 0,D=this.trackStartLines?1:void 0,O=t.cloneEmptyGroups(this.emptyGroups),k=this.trackStartLines,A=this.config.lineTerminatorsPattern,j=0,M=[],N=[],P=[],F=[];Object.freeze(F);var I=void 0;function ee(){return M}function te(e){var n=t.charCodeToOptimizedIndex(e),r=N[n];return r===void 0?F:r}var ne=function(e){if(P.length===1&&e.tokenType.PUSH_MODE===void 0){var t=i.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);T.push({offset:e.startOffset,line:e.startLine===void 0?void 0:e.startLine,column:e.startColumn===void 0?void 0:e.startColumn,length:e.image.length,message:t})}else{P.pop();var r=n.last(P);M=i.patternIdxToConfig[r],N=i.charCodeToPatternIdxToConfig[r],j=M.length;var a=i.canModeBeOptimized[r]&&i.config.safeMode===!1;I=N&&a?te:ee}};function L(e){P.push(e),N=this.charCodeToPatternIdxToConfig[e],M=this.patternIdxToConfig[e],j=M.length,j=M.length;var t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;I=N&&t?te:ee}L.call(this,r);for(var R;x<b;){l=null;var z=y.charCodeAt(x),re=I(z),B=re.length;for(a=0;a<B;a++){R=re[a];var V=R.pattern;u=null;var H=R.short;if(H===!1?R.isCustom===!0?(v=V.exec(y,x,w,O),v===null?l=null:(l=v[0],v.payload!==void 0&&(u=v.payload))):(this.updateLastIndex(V,x),l=this.match(V,e,x)):z===H&&(l=V),l!==null){if(c=R.longerAlt,c!==void 0){var U=M[c],W=U.pattern;d=null,U.isCustom===!0?(v=W.exec(y,x,w,O),v===null?s=null:(s=v[0],v.payload!==void 0&&(d=v.payload))):(this.updateLastIndex(W,x),s=this.match(W,e,x)),s&&s.length>l.length&&(l=s,u=d,R=U)}break}}if(l!==null){if(f=l.length,p=R.group,p!==void 0&&(m=R.tokenTypeIdx,h=this.createTokenInstance(l,x,m,R.tokenType,E,D,f),this.handlePayload(h,u),p===!1?S=this.addToken(w,S,h):O[p].push(h)),e=this.chopInput(e,f),x+=f,D=this.computeNewColumn(D,f),k===!0&&R.canLineTerminator===!0){var G=0,ie=void 0,ae=void 0;A.lastIndex=0;do ie=A.test(l),ie===!0&&(ae=A.lastIndex-1,G++);while(ie===!0);G!==0&&(E+=G,D=f-ae,this.updateTokenEndLineColumnLocation(h,p,ae,G,E,D,f))}this.handleModes(R,ne,L,h)}else{for(var K=x,oe=E,se=D,q=!1;!q&&x<b;)for(y.charCodeAt(x),e=this.chopInput(e,1),x++,o=0;o<j;o++){var ce=M[o],V=ce.pattern,H=ce.short;if(H===!1?ce.isCustom===!0?q=V.exec(y,x,w,O)!==null:(this.updateLastIndex(V,x),q=V.exec(e)!==null):y.charCodeAt(x)===H&&(q=!0),q===!0)break}g=x-K,_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(y,K,g,oe,se),T.push({offset:K,line:oe,column:se,length:g,message:_})}}return this.hasCustom||(w.length=S),{tokens:w,groups:O,errors:T}},e.prototype.handleModes=function(e,t,n,r){if(e.pop===!0){var i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)},e.prototype.chopInput=function(e,t){return e.substring(t)},e.prototype.updateLastIndex=function(e,t){e.lastIndex=t},e.prototype.updateTokenEndLineColumnLocation=function(e,t,n,r,i,a,o){var s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&s===!0||(e.endLine=i+c,e.endColumn=a-1+-c))},e.prototype.computeNewColumn=function(e,t){return e+t},e.prototype.createTokenInstance=function(){return null},e.prototype.createOffsetOnlyToken=function(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}},e.prototype.createStartOnlyToken=function(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}},e.prototype.createFullToken=function(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}},e.prototype.addToken=function(e,t,n){return 666},e.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},e.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,t++,t},e.prototype.handlePayload=function(e,t){},e.prototype.handlePayloadNoCustom=function(e,t){},e.prototype.handlePayloadWithCustom=function(e,t){t!==null&&(e.payload=t)},e.prototype.match=function(e,t,n){return null},e.prototype.match
|
|||
|
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return t.has(e,c)&&(i.CATEGORIES=e[c]),r.augmentTokenTypes([i]),t.has(e,l)&&(i.LABEL=e[l]),t.has(e,u)&&(i.GROUP=e[u]),t.has(e,f)&&(i.POP_MODE=e[f]),t.has(e,d)&&(i.PUSH_MODE=e[d]),t.has(e,p)&&(i.LONGER_ALT=e[p]),t.has(e,m)&&(i.LINE_BREAKS=e[m]),t.has(e,h)&&(i.START_CHARS_HINT=e[h]),i}e.EOF=g({name:`EOF`,pattern:n.Lexer.NA}),r.augmentTokenTypes([e.EOF]);function v(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}e.createTokenInstance=v;function y(e,t){return r.tokenStructuredMatcher(e,t)}e.tokenMatcher=y}),V=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.serializeProduction=e.serializeGrammar=e.Terminal=e.Alternation=e.RepetitionWithSeparator=e.Repetition=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Option=e.Alternative=e.Rule=e.NonTerminal=e.AbstractProduction=void 0;var n=I(),r=B(),i=function(){function e(e){this._definition=e}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){e.visit(this),n.forEach(this.definition,function(t){t.accept(e)})},e}();e.AbstractProduction=i;var a=function(e){t(r,e);function r(t){var r=e.call(this,[])||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return Object.defineProperty(r.prototype,"definition",{get:function(){return this.referencedRule===void 0?[]:this.referencedRule.definition},set:function(e){},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this)},r}(i);e.NonTerminal=a;var o=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.orgText=``,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.Rule=o;var s=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.ignoreAmbiguities=!1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.Alternative=s;var c=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.Option=c;var l=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.RepetitionMandatory=l;var u=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.RepetitionMandatoryWithSeparator=u;var d=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.Repetition=d;var f=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return r}(i);e.RepetitionWithSeparator=f;var p=function(e){t(r,e);function r(t){var r=e.call(this,t.definition)||this;return r.idx=1,r.ignoreAmbiguities=!1,r.hasPredicates=!1,n.assign(r,n.pick(t,function(e){return e!==void 0})),r}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r}(i);e.Alternation=p;var m=function(){function e(e){this.idx=1,n.assign(this,n.pick(e,function(e){return e!==void 0}))}return e.prototype.accept=function(e){e.visit(this)},e}();e.Terminal=m;function h(e){return n.map(e,g)}e.serializ
|
|||
|
|
but found: '`+r.first(i).image+`'`;if(a)return o+a+s;var c=r.reduce(n,function(e,t){return e.concat(t)},[]),l=r.map(c,function(e){return`[`+r.map(e,function(e){return t.tokenLabel(e)}).join(`, `)+`]`});return o+(`one of these possible Token sequences:
|
|||
|
|
`+r.map(l,function(e,t){return` `+(t+1)+`. `+e}).join(`
|
|||
|
|
`))+s},buildEarlyExitMessage:function(e){var n=e.expectedIterationPaths,i=e.actual,a=e.customUserDescription;e.ruleName;var o=`Expecting: `,s=`
|
|||
|
|
but found: '`+r.first(i).image+`'`;return a?o+a+s:o+(`expecting at least one iteration which starts with one of these possible Token sequences::
|
|||
|
|
`+(`<`+r.map(n,function(e){return`[`+r.map(e,function(e){return t.tokenLabel(e)}).join(`,`)+`]`}).join(` ,`)+`>`))+s}},Object.freeze(e.defaultParserErrorProvider),e.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
|
|||
|
|
inside top level rule: ->`+e.name+`<-`}},e.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(e,t){function n(e){return e instanceof i.Terminal?e.terminalType.name:e instanceof i.NonTerminal?e.nonTerminalName:``}var o=e.name,s=r.first(t),c=s.idx,l=a.getProductionDslName(s),u=n(s),d=c>0,f=`->`+l+(d?c:``)+`<- `+(u?`with argument: ->`+u+`<-`:``)+`
|
|||
|
|
appears more than once (`+t.length+` times) in the top level rule: ->`+o+`<-.
|
|||
|
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|||
|
|
`;return f=f.replace(/[ \t]+/g,` `),f=f.replace(/\s\s+/g,`
|
|||
|
|
`),f},buildNamespaceConflictError:function(e){return`Namespace conflict found in grammar.
|
|||
|
|
`+(`The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <`+e.name+`>.
|
|||
|
|
`)+`To resolve this make sure each Terminal and Non-Terminal names are unique
|
|||
|
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|||
|
|
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError:function(e){var n=r.map(e.prefixPath,function(e){return t.tokenLabel(e)}).join(`, `),i=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <`+e.ambiguityIndices.join(` ,`)+`> due to common lookahead prefix
|
|||
|
|
`+(`in <OR`+i+`> inside <`+e.topLevelRule.name+`> Rule,
|
|||
|
|
`)+(`<`+n+`> may appears as a prefix path in all these alternatives.
|
|||
|
|
`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|||
|
|
For Further details.`},buildAlternationAmbiguityError:function(e){var n=r.map(e.prefixPath,function(e){return t.tokenLabel(e)}).join(`, `),i=e.alternation.idx===0?``:e.alternation.idx,a=`Ambiguous Alternatives Detected: <`+e.ambiguityIndices.join(` ,`)+`> in <OR`+i+`>`+(` inside <`+e.topLevelRule.name+`> Rule,
|
|||
|
|
`)+(`<`+n+`> may appears as a prefix path in all these alternatives.
|
|||
|
|
`);return a+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|||
|
|
For Further details.`,a},buildEmptyRepetitionError:function(e){var t=a.getProductionDslName(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <`+t+`> within Rule <`+e.topLevelRule.name+`> can never consume any tokens.
|
|||
|
|
This could lead to an infinite loop.`},buildTokenNameError:function(e){return`deprecated`},buildEmptyAlternationError:function(e){return`Ambiguous empty alternative: <`+(e.emptyChoiceIdx+1)+`>`+(` in <OR`+e.alternation.idx+`> inside <`+e.topLevelRule.name+`> Rule.
|
|||
|
|
`)+`Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError:function(e){return`An Alternation cannot have more than 256 alternatives:
|
|||
|
|
`+(`<OR`+e.alternation.idx+`> inside <`+e.topLevelRule.name+`> Rule.
|
|||
|
|
has `+(e.alternation.definition.length+1)+` alternatives.`)},buildLeftRecursionError:function(e){var t=e.topLevelRule.name,r=n.map(e.leftRecursionPath,function(e){return e.name}),i=t+` --> `+r.concat([t]).join(` --> `);return`Left Recursion found in grammar.
|
|||
|
|
`+(`rule: <`+t+`> can be invoked from itself (directly or indirectly)
|
|||
|
|
`)+(`without consuming any Tokens. The grammar path that causes this is:
|
|||
|
|
`+i+`
|
|||
|
|
`)+` To fix this refactor your grammar to remove the left recursion.
|
|||
|
|
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`},buildInvalidRuleNameError:function(e){return`deprecated`},buildDuplicateRuleNameError:function(e){return`Duplicate definition, rule: ->`+(e.topLevelRule instanceof i.Rule?e.topLevelRule.name:e.topLevelRule)+`<- is already defined in the grammar: ->`+e.grammarName+`<-`}}}),oe=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.GastRefResolverVisitor=e.resolveGrammar=void 0;var n=Z(),r=I(),i=U();function a(e,t){var n=new o(e,t);return n.resolveRefs(),n.errors}e.resolveGrammar=a;var o=function(e){t(i,e);function i(t,n){var r=e.call(this)||this;return r.nameToTopRule=t,r.errMsgProvider=n,r.errors=[],r}return i.prototype.resolveRefs=function(){var e=this;r.forEach(r.values(this.nameToTopRule),function(t){e.currTopLevel=t,t.accept(e)})},i.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:n.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},i}(i.GAstVisitor);e.GastRefResolverVisitor=o}),se=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.nextPossibleTokensAfter=e.possiblePathsFrom=e.NextTerminalAfterAtLeastOneSepWalker=e.NextTerminalAfterAtLeastOneWalker=e.NextTerminalAfterManySepWalker=e.NextTerminalAfterManyWalker=e.AbstractNextTerminalAfterProductionWalker=e.NextAfterTokenWalker=e.AbstractNextPossibleTokensWalker=void 0;var n=H(),r=I(),i=G(),a=V(),o=function(e){t(n,e);function n(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 n.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=r.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=r.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},n.prototype.walk=function(t,n){n===void 0&&(n=[]),this.found||e.prototype.walk.call(this,t,n)},n.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)}},n.prototype.updateExpectedNext=function(){r.isEmpty(this.ruleStack)?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},n}(n.RestWalker);e.AbstractNextPossibleTokensWalker=o,e.NextAfterTokenWalker=function(e){t(n,e);function n(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 n.prototype.walkTerminal=function(e,t,n){if(this.isAtEndO
|
|||
|
|
`+(``+i.join(`
|
|||
|
|
|
|||
|
|
`).replace(/\n/g,`
|
|||
|
|
`)))}}},i.prototype.constructor=i,i._RULE_NAMES=r,i}e.createBaseSemanticVisitorConstructor=i;function a(e,i,a){var o=function(){};n.defineNameProp(o,e+`BaseSemanticsWithDefaults`);var s=Object.create(a.prototype);return t.forEach(i,function(e){s[e]=r}),o.prototype=s,o.prototype.constructor=o,o}e.createBaseVisitorConstructorWithDefaults=a;var o;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(o=e.CstVisitorDefinitionError||={});function s(e,t){var n=c(e,t),r=u(e,t);return n.concat(r)}e.validateVisitor=s;function c(e,r){var i=t.map(r,function(r){if(!t.isFunction(e[r]))return{msg:`Missing visitor method: <`+r+`> on `+n.functionName(e.constructor)+` CST Visitor.`,type:o.MISSING_METHOD,methodName:r}});return t.compact(i)}e.validateMissingCstMethods=c;var l=[`constructor`,`visit`,`validateVisitor`];function u(e,r){var i=[];for(var a in e)t.isFunction(e[a])&&!t.contains(l,a)&&!t.contains(r,a)&&i.push({msg:`Redundant visitor method: <`+a+`> on `+n.functionName(e.constructor)+` CST Visitor
|
|||
|
|
There is no Grammar Rule corresponding to this method's name.
|
|||
|
|
`,type:o.REDUNDANT_METHOD,methodName:a});return i}e.validateRedundantMethods=u}),_e=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeBuilder=void 0;var t=me(),n=I(),r=ge(),i=Z();e.TreeBuilder=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=n.has(e,`nodeLocationTracking`)?e.nodeLocationTracking:i.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=n.NOOP,this.cstFinallyStateUpdate=n.NOOP,this.cstPostTerminal=n.NOOP,this.cstPostNonTerminal=n.NOOP,this.cstPostRule=n.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=t.setNodeLocationFull,this.setNodeLocationFromNode=t.setNodeLocationFull,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=t.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=t.setNodeLocationOnlyOffset,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=n.NOOP;else throw Error(`Invalid <nodeLocationTracking> config option: "`+e.nodeLocationTracking+`"`)},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?(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?n.endOffset=t.endOffset:n.startOffset=NaN},e.prototype.cstPostTerminal=function(e,n){var r=this.CST_STACK[this.CST_STACK.length-1];t.addTerminalToCst(r,n,e),this.setNodeLocationFromToken(r.location,n)},e.prototype.cstPostNonTerminal=function(e,n){var r=this.CST_STACK[this.CST_STACK.length-1];t.addNoneTerminalToCst(r,n,e),this.setNodeLocationFromNode(r.location,e.location)},e.prototype.getBaseCstVisitorConstructor=function(){if(n.isUndefined(this.baseCstVisitorConstructor)){var e=r.createBaseSemanticVisitorConstructor(this.className,n.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(n.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var e=r.createBaseVisitorConstructorWithDefaults(this.className,n.keys(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.getPreviousExpli
|
|||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|||
|
|
For Further details.`);if(t.isArray(e)){if(t.isEmpty(e))throw Error(`A Token Vocabulary cannot be empty.
|
|||
|
|
Note that the first argument for the parser constructor
|
|||
|
|
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==`number`)throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|||
|
|
For Further details.`)}if(t.isArray(e))this.tokensMap=t.reduce(e,function(e,t){return e[t.name]=t,e},{});else if(t.has(e,`modes`)&&t.every(t.flatten(t.values(e.modes)),l.isTokenType)){var r=t.flatten(t.values(e.modes)),i=t.uniq(r);this.tokensMap=t.reduce(i,function(e,t){return e[t.name]=t,e},{})}else if(t.isObject(e))this.tokensMap=t.cloneObj(e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=c.EOF;var a=t.every(t.values(e),function(e){return t.isEmpty(e.categoryMatches)});this.tokenMatcher=a?l.tokenStructuredMatcherNoCategories:l.tokenStructuredMatcher,l.augmentTokenTypes(t.values(this.tokensMap))},e.prototype.defineRule=function(e,r,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <`+e+`> may not be defined after the 'performSelfAnalysis' method has been called'
|
|||
|
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var a=t.has(i,`resyncEnabled`)?i.resyncEnabled:o.DEFAULT_RULE_CONFIG.resyncEnabled,s=t.has(i,`recoveryValueFunc`)?i.recoveryValueFunc:o.DEFAULT_RULE_CONFIG.recoveryValueFunc,c=this.ruleShortNameIdx<<n.BITS_FOR_METHOD_TYPE+n.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[c]=e,this.fullRuleNameToShort[e]=c;function l(e){try{if(this.outputCst===!0){r.apply(this,e);var t=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(t),t}else return r.apply(this,e)}catch(e){return this.invokeRuleCatch(e,a,s)}finally{this.ruleFinallyStateUpdate()}}var u=function(t,n){return t===void 0&&(t=0),this.ruleInvocationStateUpdate(c,e,t),l.call(this,n)},d=`ruleName`;return u[d]=e,u.originalGrammarAction=r,u},e.prototype.invokeRuleCatch=function(e,t,n){var i=this.RULE_STACK.length===1,a=t&&!this.isBackTracking()&&this.recoveryEnabled;if(r.isRecognitionException(e)){var o=e;if(a){var s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s))if(o.resyncedTokens=this.reSyncTo(s),this.outputCst){var c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return n();else{if(this.outputCst){var c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,o.partialCstResult=c}throw o}}else{if(i)return this.moveToTerminatedState(),n();throw o}}else throw e},e.prototype.optionInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.OPTION_IDX,t);return this.optionInternalLogic(e,t,r)},e.prototype.optionInternalLogic=function(e,t,n){var r=this,i=this.getLaFuncFromCache(n),a,o;if(e.DEF!==void 0){if(a=e.DEF,o=e.GATE,o!==void 0){var s=i;i=function(){return o.call(r)&&s.call(r)}}}else a=e;if(i.call(this)===!0)return a.call(this)},e.prototype.atLeastOneInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,r)},e.prototype.atLeastOneInternalLogic=function(e,t,r){var o=this,s=this.getLaFuncFromCache(r),c,l;if(t.DEF!==void 0){if(c=t.DEF,l=t.GATE,l!==void 0){var u=s;s=function(){return l.call(o)&&u.call(o)}}}else c=t;if(s.call(this)===!0)for(var d=this.doSingleRepetition(c);s.call(this)===!0&&d===!0;)d=this.doSingleRepetition(c);else throw this.raiseEarlyExitException(e,i.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],s,n.AT_LEAST_ONE_IDX,e,a.NextTerminalAfterAtLeastOneWalker)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,r)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,r){var o=this,s=t.DEF,c=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){s.call(this);for(var l=function(){return o.tokenMatcher(o.LA(1),c)};this.tokenMatcher(this.LA(1),c)===!0;)this.CONSUME(c),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,c,l,s,a.NextTerminalAfterAtLeastOneSepWalker],l,n.AT_LEAST_ONE_SEP_IDX,e,a.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(e,i.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},e.prototype.manyInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.MANY_IDX,e);return this.manyInternalLogic(e,t,r)},e.prototype.manyInternalLogic=function(e,t,r){var i=this,o=this.getLaFuncFromCache(r),s,c;if(t.DEF!==void 0){if(s=t.DEF,c=t.GATE,c!==void 0){var l=o;o=function(){return c.call(i)&&l.call(i)}}}else s=t;for(var u=!0;o.call(this)===!0&&u===!0;)u=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],o,n.MANY_IDX,e,a.NextTerminalAfterManyWalker,u)},e.prototype.manySepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,r)},e.prototype.manySepFirstInternalLogic=function(e,t,r){var i=this,o=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){o.call(this);for(var c=function(){return i.tokenMatcher(i.LA(1),s)};this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),o.call(this);th
|
|||
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(f);var p={name:`This CSTNode indicates the Parser is in Recording Phase
|
|||
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};e.GastRecorder=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 o.END_OF_FILE},e.prototype.topLevelRuleRecord=function(e,t){try{var r=new n.Rule({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
|
|||
|
|
This error was thrown during the "grammar recording phase" For more info see:
|
|||
|
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}},e.prototype.optionInternalRecord=function(e,t){return m.call(this,n.Option,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){m.call(this,n.RepetitionMandatory,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){m.call(this,n.RepetitionMandatoryWithSeparator,t,e,l)},e.prototype.manyInternalRecord=function(e,t){m.call(this,n.Repetition,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){m.call(this,n.RepetitionWithSeparator,t,e,l)},e.prototype.orInternalRecord=function(e,t){return h.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,r,i){if(_(r),!e||t.has(e,`ruleName`)===!1){var a=Error(`<SUBRULE`+g(r)+`> argument is invalid`+(` expecting a Parser method reference but got: <`+JSON.stringify(e)+`>`)+(`
|
|||
|
|
inside top level rule: <`+this.recordingProdStack[0].name+`>`));throw a.KNOWN_RECORDER_ERROR=!0,a}var o=t.peek(this.recordingProdStack),s=e.ruleName,l=new n.NonTerminal({idx:r,nonTerminalName:s,referencedRule:void 0});return o.definition.push(l),this.outputCst?p:c},e.prototype.consumeInternalRecord=function(e,r,a){if(_(r),!i.hasShortKeyProperty(e)){var o=Error(`<CONSUME`+g(r)+`> argument is invalid`+(` expecting a TokenType reference but got: <`+JSON.stringify(e)+`>`)+(`
|
|||
|
|
inside top level rule: <`+this.recordingProdStack[0].name+`>`));throw o.KNOWN_RECORDER_ERROR=!0,o}var s=t.peek(this.recordingProdStack),c=new n.Terminal({idx:r,terminalType:e});return s.definition.push(c),f},e}();function m(e,n,r,i){i===void 0&&(i=!1),_(r);var a=t.peek(this.recordingProdStack),o=t.isFunction(n)?n:n.DEF,s=new e({definition:[],idx:r});return i&&(s.separator=n.SEP),t.has(n,`MAX_LOOKAHEAD`)&&(s.maxLookahead=n.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),a.definition.push(s),this.recordingProdStack.pop(),c}function h(e,r){var i=this;_(r);var a=t.peek(this.recordingProdStack),o=t.isArray(e)===!1,s=o===!1?e:e.DEF,l=new n.Alternation({definition:[],idx:r,ignoreAmbiguities:o&&e.IGNORE_AMBIGUITIES===!0});return t.has(e,`MAX_LOOKAHEAD`)&&(l.maxLookahead=e.MAX_LOOKAHEAD),l.hasPredicates=t.some(s,function(e){return t.isFunction(e.GATE)}),a.definition.push(l),t.forEach(s,function(e){var r=new n.Alternative({definition:[]});l.definition.push(r),t.has(e,`IGNORE_AMBIGUITIES`)?r.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:t.has(e,`GATE`)&&(r.ignoreAmbiguities=!0),i.recordingProdStack.push(r),e.ALT.call(i),i.recordingProdStack.pop()}),c}function g(e){return e===0?``:``+e}function _(e){if(e<0||e>u){var t=Error(`Invalid DSL Method idx value: <`+e+`>
|
|||
|
|
`+(`Idx value must be a none negative value smaller than `+(u+1)));throw t.KNOWN_RECORDER_ERROR=!0,t}}}),Y=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PerformanceTracer=void 0;var t=I(),n=Z();e.PerformanceTracer=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if(t.has(e,`traceInitPerf`)){var r=e.traceInitPerf,i=typeof r==`number`;this.traceInitMaxIdent=i?r:1/0,this.traceInitPerf=i?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=n.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;var r=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(r+`--> <`+e+`>`);var i=t.timer(n),a=i.time,o=i.value,s=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(r+`<-- <`+e+`> time: `+a+`ms`),this.traceInitIndent--,o}else return n()},e}()}),X=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMixins=void 0;function t(e,t){t.forEach(function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach(function(r){if(r!==`constructor`){var i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]}})})}e.applyMixins=t}),Z=P(e=>{var t=e&&e.__extends||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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddedActionsParser=e.CstParser=e.Parser=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.DEFAULT_RULE_CONFIG=e.DEFAULT_PARSER_CONFIG=e.END_OF_FILE=void 0;var n=I(),r=ae(),i=B(),a=K(),o=le(),s=de(),c=pe(),l=_e(),u=ve(),d=ye(),f=be(),p=xe(),m=Se(),h=J(),g=Y(),_=X();e.END_OF_FILE=i.createTokenInstance(i.EOF,``,NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(e.END_OF_FILE),e.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:a.defaultParserErrorProvider,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),e.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(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`})(e.ParserDefinitionErrorType||={});function v(e){return e===void 0&&(e=void 0),function(){return e}}e.EMPTY_ALT=v;var y=function(){function t(t,r){this.definitionErrors=[],this.selfAnalysisDone=!1;var i=this;if(i.initErrorHandler(r),i.initLexerAdapter(),i.initLooksAhead(r),i.initRecognizerEngine(t,r),i.initRecoverable(r),i.initTreeBuilder(r),i.initContentAssist(),i.initGastRecorder(r),i.initPerformanceTracer(r),n.has(r,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|||
|
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|||
|
|
For further details.`);this.skipValidations=n.has(r,`skipValidations`)?r.skipValidations:e.DEFAULT_PARSER_CONFIG.skipValidations}return t.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},t.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT(`performSelfAnalysis`,function(){var i;e.selfAnalysisDone=!0;var s=e.className;e.TRACE_INIT(`toFastProps`,function(){n.toFastProperties(e)}),e.TRACE_INIT(`Grammar Recording`,function(){try{e.enableRecording(),n.forEach(e.definedRulesNames,function(t){var n=e[t].originalGrammarAction,r=void 0;e.TRACE_INIT(t+` Rule`,function(){r=e.topLevelRuleRecord(t,n)}),e.gastProductionsCache[t]=r})}finally{e.disableRecording()}});var c=[];if(e.TRACE_INIT(`Grammar Resolving`,function(){c=o.resolveGrammar({rules:n.values(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(c)}),e.TRACE_INIT(`Grammar Validations`,function(){if(n.isEmpty(c)&&e.skipValidations===!1){var t=o.validateGrammar({rules:n.values(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:n.values(e.tokensMap),errMsgProvider:a.defaultGrammarValidatorErrorProvider,grammarName:s});e.definitionErrors=e.definitionErrors.concat(t)}}),n.isEmpty(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT(`computeAllProdsFollows`,function(){e.resyncFollows=r.computeAllProdsFollows(n.values(e.gastProductionsCache))}),e.TRACE_INIT(`ComputeLookaheadFunctions`,function(){e.preComputeLookaheadFunctions(n.values(e.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!n.isEmpty(e.definitionErrors))throw i=n.map(e.definitionErrors,function(e){return e.message}),Error(`Parser Definition Errors detected:
|
|||
|
|
`+i.join(`
|
|||
|
|
-------------------------------
|
|||
|
|
`))})},t.DEFER_DEFINITION_ERRORS_HANDLING=!1,t}();e.Parser=y,_.applyMixins(y,[s.Recoverable,c.LooksAhead,l.TreeBuilder,u.LexerAdapter,f.RecognizerEngine,d.RecognizerApi,p.ErrorHandler,m.ContentAssist,h.GastRecorder,g.PerformanceTracer]),e.CstParser=function(r){t(i,r);function i(t,i){i===void 0&&(i=e.DEFAULT_PARSER_CONFIG);var a=this,o=n.cloneObj(i);return o.outputCst=!0,a=r.call(this,t,o)||this,a}return i}(y),e.EmbeddedActionsParser=function(r){t(i,r);function i(t,i){i===void 0&&(i=e.DEFAULT_PARSER_CONFIG);var a=this,o=n.cloneObj(i);return o.outputCst=!1,a=r.call(this,t,o)||this,a}return i}(y)}),Ce=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createSyntaxDiagramsCode=void 0;var t=F();function n(e,n){var r=n===void 0?{}:n,i=r.resourceBase,a=i===void 0?`https://unpkg.com/chevrotain@`+t.VERSION+`/diagrams/`:i,o=r.css,s=o===void 0?`https://unpkg.com/chevrotain@`+t.VERSION+`/diagrams/diagrams.css`:o,c=`
|
|||
|
|
<!-- This is a generated file -->
|
|||
|
|
<!DOCTYPE html>
|
|||
|
|
<meta charset="utf-8">
|
|||
|
|
<style>
|
|||
|
|
body {
|
|||
|
|
background-color: hsl(30, 20%, 95%)
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
|
|||
|
|
`,l=`
|
|||
|
|
<link rel='stylesheet' href='`+s+`'>
|
|||
|
|
`,u=`
|
|||
|
|
<script src='`+a+`vendor/railroad-diagrams.js'><\/script>
|
|||
|
|
<script src='`+a+`src/diagrams_builder.js'><\/script>
|
|||
|
|
<script src='`+a+`src/diagrams_behavior.js'><\/script>
|
|||
|
|
<script src='`+a+`src/main.js'><\/script>
|
|||
|
|
`,d=`
|
|||
|
|
<div id="diagrams" align="center"></div>
|
|||
|
|
`,f=`
|
|||
|
|
<script>
|
|||
|
|
window.serializedGrammar = `+JSON.stringify(e,null,` `)+`;
|
|||
|
|
<\/script>
|
|||
|
|
`;return c+l+u+d+f+`
|
|||
|
|
<script>
|
|||
|
|
var diagramsDiv = document.getElementById("diagrams");
|
|||
|
|
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
|
|||
|
|
<\/script>
|
|||
|
|
`}e.createSyntaxDiagramsCode=n}),we=P(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=e.createSyntaxDiagramsCode=e.clearCache=e.GAstVisitor=e.serializeProduction=e.serializeGrammar=e.Terminal=e.Rule=e.RepetitionWithSeparator=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Repetition=e.Option=e.NonTerminal=e.Alternative=e.Alternation=e.defaultLexerErrorProvider=e.NoViableAltException=e.NotAllInputParsedException=e.MismatchedTokenException=e.isRecognitionException=e.EarlyExitException=e.defaultParserErrorProvider=e.tokenName=e.tokenMatcher=e.tokenLabel=e.EOF=e.createTokenInstance=e.createToken=e.LexerDefinitionErrorType=e.Lexer=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.EmbeddedActionsParser=e.CstParser=e.VERSION=void 0;var t=F();Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return t.VERSION}});var n=Z();Object.defineProperty(e,"CstParser",{enumerable:!0,get:function(){return n.CstParser}}),Object.defineProperty(e,"EmbeddedActionsParser",{enumerable:!0,get:function(){return n.EmbeddedActionsParser}}),Object.defineProperty(e,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return n.ParserDefinitionErrorType}}),Object.defineProperty(e,"EMPTY_ALT",{enumerable:!0,get:function(){return n.EMPTY_ALT}});var r=re();Object.defineProperty(e,"Lexer",{enumerable:!0,get:function(){return r.Lexer}}),Object.defineProperty(e,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return r.LexerDefinitionErrorType}});var i=B();Object.defineProperty(e,"createToken",{enumerable:!0,get:function(){return i.createToken}}),Object.defineProperty(e,"createTokenInstance",{enumerable:!0,get:function(){return i.createTokenInstance}}),Object.defineProperty(e,"EOF",{enumerable:!0,get:function(){return i.EOF}}),Object.defineProperty(e,"tokenLabel",{enumerable:!0,get:function(){return i.tokenLabel}}),Object.defineProperty(e,"tokenMatcher",{enumerable:!0,get:function(){return i.tokenMatcher}}),Object.defineProperty(e,"tokenName",{enumerable:!0,get:function(){return i.tokenName}});var a=K();Object.defineProperty(e,"defaultParserErrorProvider",{enumerable:!0,get:function(){return a.defaultParserErrorProvider}});var o=ue();Object.defineProperty(e,"EarlyExitException",{enumerable:!0,get:function(){return o.EarlyExitException}}),Object.defineProperty(e,"isRecognitionException",{enumerable:!0,get:function(){return o.isRecognitionException}}),Object.defineProperty(e,"MismatchedTokenException",{enumerable:!0,get:function(){return o.MismatchedTokenException}}),Object.defineProperty(e,"NotAllInputParsedException",{enumerable:!0,get:function(){return o.NotAllInputParsedException}}),Object.defineProperty(e,"NoViableAltException",{enumerable:!0,get:function(){return o.NoViableAltException}});var s=z();Object.defineProperty(e,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return s.defaultLexerErrorProvider}});var c=V();Object.defineProperty(e,"Alternation",{enumerable:!0,get:function(){return c.Alternation}}),Object.defineProperty(e,"Alternative",{enumerable:!0,get:function(){return c.Alternative}}),Object.defineProperty(e,"NonTerminal",{enumerable:!0,get:function(){return c.NonTerminal}}),Object.defineProperty(e,"Option",{enumerable:!0,get:function(){return c.Option}}),Object.defineProperty(e,"Repetition",{enumerable:!0,get:function(){return c.Repetition}}),Object.defineProperty(e,"RepetitionMandatory",{enumerable:!0,get:function(){return c.RepetitionMandatory}}),Object.defineProperty(e,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return c.RepetitionMandatoryWithSeparator}}),Object.defineProperty(e,"RepetitionWithSeparator",{enumerable:!0,get:function(){return c.RepetitionWithSeparator}}),Object.defineProperty(e,"Rule",{enumerable:!0,get:function(){return c.Rule}}),Object.defineProperty(e,"Terminal",{enumerable:!0,get:function(){return c.Terminal}});var l=V();Object.defineProperty(e,"serializeGrammar",{enumerable:!0,get:function(){return l.serializeGrammar}}),Object.defineProperty(e,"serializeProduction",{enumerable:!0,get:function(){return l.serializeProduction}});var u=U();Object.defi
|
|||
|
|
It performs no action other than printing this message.
|
|||
|
|
Please avoid using it as it will be completely removed in the future`)}e.clearCache=d;var f=Ce();Object.defineProperty(e,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return f.createSyntaxDiagramsCode}}),e.Parser=function(){function e(){throw Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
|
|||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return e}()})(),Te=class extends s{constructor(e){super(e)}load(e,t,r,i){let a=this,o=a.path===``?C.extractUrlBase(e):a.path,s=new n(a.manager);s.setPath(a.path),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,function(n){try{t(a.parse(n,o))}catch(t){i?i(t):console.error(t),a.manager.itemError(e)}},r,i)}parse(n,C){let P={};function F(e){let t=I(),n=new Ee(t.tokens),r=new Oe(t.tokenVocabulary),i=ee(r.getBaseCstVisitorConstructor());r.input=n.lex(e).tokens;let a=r.vrml();if(r.errors.length>0)throw console.error(r.errors),Error(`THREE.VRMLLoader: Parsing errors detected.`);return i.visit(a)}function I(){let e=we.createToken,t=e({name:`RouteIdentifier`,pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),n=e({name:`Identifier`,pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]([^\0-\x20\x22\x27\x23\x2b\x2c\x2e\x5b\x5d\x5c\x7b\x7d])*/,longer_alt:t}),r=`Anchor.Billboard.Collision.Group.Transform.Inline.LOD.Switch.PerspectiveCamera.OrthographicCamera.AudioClip.DirectionalLight.PointLight.Script.Shape.Sound.SpotLight.WorldInfo.CylinderSensor.PlaneSensor.ProximitySensor.SphereSensor.TimeSensor.TouchSensor.VisibilitySensor.Box.Cone.Cylinder.ElevationGrid.Extrusion.IndexedFaceSet.IndexedLineSet.PointSet.Sphere.Color.Coordinate.Normal.TextureCoordinate.Appearance.FontStyle.ImageTexture.Material.MovieTexture.PixelTexture.TextureTransform.ColorInterpolator.CoordinateInterpolator.NormalInterpolator.OrientationInterpolator.PositionInterpolator.ScalarInterpolator.Background.Fog.NavigationInfo.Viewpoint.Text`.split(`.`),i=e({name:`Version`,pattern:/#VRML.*/,longer_alt:n}),a=e({name:`NodeName`,pattern:new RegExp(r.join(`|`)),longer_alt:n}),o=e({name:`DEF`,pattern:/DEF/,longer_alt:n}),s=e({name:`USE`,pattern:/USE/,longer_alt:n}),c=e({name:`ROUTE`,pattern:/ROUTE/,longer_alt:n}),l=e({name:`TO`,pattern:/TO/,longer_alt:n}),u=e({name:`StringLiteral`,pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),d=e({name:`HexLiteral`,pattern:/0[xX][0-9a-fA-F]+/}),f=e({name:`NumberLiteral`,pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),p=e({name:`TrueLiteral`,pattern:/TRUE/}),m=e({name:`FalseLiteral`,pattern:/FALSE/}),h=e({name:`NullLiteral`,pattern:/NULL/}),g=e({name:`LSquare`,pattern:/\[/}),_=e({name:`RSquare`,pattern:/]/}),v=e({name:`LCurly`,pattern:/{/}),y=e({name:`RCurly`,pattern:/}/}),b=e({name:`Comment`,pattern:/#.*/,group:we.Lexer.SKIPPED}),x=[e({name:`WhiteSpace`,pattern:/[ ,\s]/,group:we.Lexer.SKIPPED}),a,o,s,c,l,p,m,h,i,n,t,u,d,f,g,_,v,y,b],S={};for(let e=0,t=x.length;e<t;e++){let t=x[e];S[t.name]=t}return{tokens:x,tokenVocabulary:S}}function ee(e){class t extends e{constructor(){super(),this.validateVisitor()}vrml(e){let t={version:this.visit(e.version),nodes:[],routes:[]};for(let n=0,r=e.node.length;n<r;n++){let r=e.node[n];t.nodes.push(this.visit(r))}if(e.route)for(let n=0,r=e.route.length;n<r;n++){let r=e.route[n];t.routes.push(this.visit(r))}return t}version(e){return e.Version[0].image}node(e){let t={name:e.NodeName[0].image,fields:[]};if(e.field)for(let n=0,r=e.field.length;n<r;n++){let r=e.field[n];t.fields.push(this.visit(r))}return e.def&&(t.DEF=this.visit(e.def[0])),t}field(e){let t={name:e.Identifier[0].image,type:null,values:null},n;return e.singleFieldValue&&(n=this.visit(e.singleFieldValue[0])),e.multiFieldValue&&(n=this.visit(e.multiFieldValue[0])),t.type=n.type,t.values=n.values,t}def(e){return(e.Identifier||e.NodeName)[0].image}use(e){return{USE:(e.Identifier||e.NodeName)[0].image}}singleFieldValue(e){return n(this,e)}multiFieldValue(e){return n(this,e)}route(e){return{FROM:e.RouteIdentifier[0].image,TO:e.RouteIdentifier[1].image}}}function n(e,t){let n={type:null,values:[]};if(t.node){n.type=`node`;for(let r=0,i=t.node.length;r<i;r++){let
|