173 lines
621 KiB
JavaScript
173 lines
621 KiB
JavaScript
|
|
import{a as i}from"./chunk-AQ6EADP3.mjs";var $S=Object.create,gs=Object.defineProperty,AS=Object.getOwnPropertyDescriptor,Bf=Object.getOwnPropertyNames,ES=Object.getPrototypeOf,_S=Object.prototype.hasOwnProperty,o=i((e,t)=>gs(e,"name",{value:t,configurable:!0}),"__name"),CS=i((e,t)=>i(function(){return e&&(t=(0,e[Bf(e)[0]])(e=0)),t},"__init"),"__esm"),Y=i((e,t)=>i(function(){return t||(0,e[Bf(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require"),"__commonJS"),xr=i((e,t)=>{for(var r in t)gs(e,r,{get:t[r],enumerable:!0})},"__export"),bo=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Bf(t))!_S.call(e,a)&&a!==r&&gs(e,a,{get:i(()=>t[a],"get"),enumerable:!(n=AS(t,a))||n.enumerable});return e},"__copyProps"),ml=i((e,t,r)=>(bo(e,t,"default"),r&&bo(r,t,"default")),"__reExport"),Kf=i((e,t,r)=>(r=e!=null?$S(ES(e)):{},bo(t||!e||!e.__esModule?gs(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),qf=i(e=>bo(gs({},"__esModule",{value:!0}),e),"__toCommonJS"),gl={};xr(gl,{AnnotatedTextEdit:i(()=>ar,"AnnotatedTextEdit"),ChangeAnnotation:i(()=>Hr,"ChangeAnnotation"),ChangeAnnotationIdentifier:i(()=>Be,"ChangeAnnotationIdentifier"),CodeAction:i(()=>bc,"CodeAction"),CodeActionContext:i(()=>Cc,"CodeActionContext"),CodeActionKind:i(()=>_c,"CodeActionKind"),CodeActionTriggerKind:i(()=>ki,"CodeActionTriggerKind"),CodeDescription:i(()=>rc,"CodeDescription"),CodeLens:i(()=>Sc,"CodeLens"),Color:i(()=>no,"Color"),ColorInformation:i(()=>Xu,"ColorInformation"),ColorPresentation:i(()=>Ju,"ColorPresentation"),Command:i(()=>Vr,"Command"),CompletionItem:i(()=>dc,"CompletionItem"),CompletionItemKind:i(()=>sc,"CompletionItemKind"),CompletionItemLabelDetails:i(()=>fc,"CompletionItemLabelDetails"),CompletionItemTag:i(()=>lc,"CompletionItemTag"),CompletionList:i(()=>pc,"CompletionList"),CreateFile:i(()=>na,"CreateFile"),DeleteFile:i(()=>ia,"DeleteFile"),Diagnostic:i(()=>Si,"Diagnostic"),DiagnosticRelatedInformation:i(()=>ao,"DiagnosticRelatedInformation"),DiagnosticSeverity:i(()=>ec,"DiagnosticSeverity"),DiagnosticTag:i(()=>tc,"DiagnosticTag"),DocumentHighlight:i(()=>vc,"DocumentHighlight"),DocumentHighlightKind:i(()=>yc,"DocumentHighlightKind"),DocumentLink:i(()=>Ic,"DocumentLink"),DocumentSymbol:i(()=>Ec,"DocumentSymbol"),DocumentUri:i(()=>Vu,"DocumentUri"),EOL:i(()=>yg,"EOL"),FoldingRange:i(()=>Qu,"FoldingRange"),FoldingRangeKind:i(()=>Zu,"FoldingRangeKind"),FormattingOptions:i(()=>wc,"FormattingOptions"),Hover:i(()=>hc,"Hover"),InlayHint:i(()=>Fc,"InlayHint"),InlayHintKind:i(()=>oo,"InlayHintKind"),InlayHintLabelPart:i(()=>lo,"InlayHintLabelPart"),InlineCompletionContext:i(()=>Kc,"InlineCompletionContext"),InlineCompletionItem:i(()=>jc,"InlineCompletionItem"),InlineCompletionList:i(()=>Uc,"InlineCompletionList"),InlineCompletionTriggerKind:i(()=>zc,"InlineCompletionTriggerKind"),InlineValueContext:i(()=>xc,"InlineValueContext"),InlineValueEvaluatableExpression:i(()=>Mc,"InlineValueEvaluatableExpression"),InlineValueText:i(()=>Lc,"InlineValueText"),InlineValueVariableLookup:i(()=>Dc,"InlineValueVariableLookup"),InsertReplaceEdit:i(()=>uc,"InsertReplaceEdit"),InsertTextFormat:i(()=>oc,"InsertTextFormat"),InsertTextMode:i(()=>cc,"InsertTextMode"),Location:i(()=>bi,"Location"),LocationLink:i(()=>Yu,"LocationLink"),MarkedString:i(()=>Ni,"MarkedString"),MarkupContent:i(()=>sa,"MarkupContent"),MarkupKind:i(()=>so,"MarkupKind"),OptionalVersionedTextDocumentIdentifier:i(()=>Ii,"OptionalVersionedTextDocumentIdentifier"),ParameterInformation:i(()=>mc,"ParameterInformation"),Position:i(()=>ae,"Position"),Range:i(()=>Q,"Range"),RenameFile:i(()=>aa,"RenameFile"),SelectedCompletionInfo:i(()=>Bc,"SelectedCompletionInfo"),SelectionRange:i(()=>Nc,"SelectionRange"),SemanticTokenModifiers:i(()=>Pc,"SemanticTokenModifiers"),SemanticTokenTypes:i(()=>kc,"SemanticTokenTypes"),SemanticTokens:i(()=>Oc,"SemanticTokens"),SignatureInformation:i(()=>gc,"SignatureInformation"),StringValue:i(()=>Gc,"StringValue"),SymbolInformation:i(()=>$c,"SymbolInformation"),SymbolKind:i(()=>Tc,"SymbolKind"),SymbolTag:i(()=>Rc,"SymbolTag"),TextDocument:i(()=>Wc,"Tex
|
||
|
|
`,`\r
|
||
|
|
`,"\r"],(function(e){function t(s,l,u,c){return new Nh(s,l,u,c)}i(t,"create"),o(t,"create"),e.create=t;function r(s){let l=s;return!!(A.defined(l)&&A.string(l.uri)&&(A.undefined(l.languageId)||A.string(l.languageId))&&A.uinteger(l.lineCount)&&A.func(l.getText)&&A.func(l.positionAt)&&A.func(l.offsetAt))}i(r,"is"),o(r,"is"),e.is=r;function n(s,l){let u=s.getText(),c=a(l,(d,p)=>{let m=d.range.start.line-p.range.start.line;return m===0?d.range.start.character-p.range.start.character:m}),f=u.length;for(let d=c.length-1;d>=0;d--){let p=c[d],m=s.offsetAt(p.range.start),v=s.offsetAt(p.range.end);if(v<=f)u=u.substring(0,m)+p.newText+u.substring(v,u.length);else throw new Error("Overlapping edit");f=m}return u}i(n,"applyEdits"),o(n,"applyEdits"),e.applyEdits=n;function a(s,l){if(s.length<=1)return s;let u=s.length/2|0,c=s.slice(0,u),f=s.slice(u);a(c,l),a(f,l);let d=0,p=0,m=0;for(;d<c.length&&p<f.length;)l(c[d],f[p])<=0?s[m++]=c[d++]:s[m++]=f[p++];for(;d<c.length;)s[m++]=c[d++];for(;p<f.length;)s[m++]=f[p++];return s}i(a,"mergeSort2"),o(a,"mergeSort")})(Wc||(Wc={})),Nh=class{static{i(this,"FullTextDocument")}static{o(this,"FullTextDocument")}constructor(e,t,r,n){this._uri=e,this._languageId=t,this._version=r,this._content=n,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(t,r)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,r=!0;for(let n=0;n<t.length;n++){r&&(e.push(n),r=!1);let a=t.charAt(n);r=a==="\r"||a===`
|
||
|
|
`,a==="\r"&&n+1<t.length&&t.charAt(n+1)===`
|
||
|
|
`&&n++}r&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,n=t.length;if(n===0)return ae.create(0,e);for(;r<n;){let s=Math.floor((r+n)/2);t[s]>e?n=s:r=s+1}let a=r-1;return ae.create(a,e-t[a])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,n),r)}get lineCount(){return this.getLineOffsets().length}},(function(e){let t=Object.prototype.toString;function r(v){return typeof v<"u"}i(r,"defined"),o(r,"defined"),e.defined=r;function n(v){return typeof v>"u"}i(n,"undefined2"),o(n,"undefined"),e.undefined=n;function a(v){return v===!0||v===!1}i(a,"boolean"),o(a,"boolean"),e.boolean=a;function s(v){return t.call(v)==="[object String]"}i(s,"string"),o(s,"string"),e.string=s;function l(v){return t.call(v)==="[object Number]"}i(l,"number"),o(l,"number"),e.number=l;function u(v,T,w){return t.call(v)==="[object Number]"&&T<=v&&v<=w}i(u,"numberRange"),o(u,"numberRange"),e.numberRange=u;function c(v){return t.call(v)==="[object Number]"&&-2147483648<=v&&v<=2147483647}i(c,"integer2"),o(c,"integer"),e.integer=c;function f(v){return t.call(v)==="[object Number]"&&0<=v&&v<=2147483647}i(f,"uinteger2"),o(f,"uinteger"),e.uinteger=f;function d(v){return t.call(v)==="[object Function]"}i(d,"func"),o(d,"func"),e.func=d;function p(v){return v!==null&&typeof v=="object"}i(p,"objectLiteral"),o(p,"objectLiteral"),e.objectLiteral=p;function m(v,T){return Array.isArray(v)&&v.every(T)}i(m,"typedArray"),o(m,"typedArray"),e.typedArray=m})(A||(A={}))}}),_n=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t;function r(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}i(r,"RAL"),o(r,"RAL"),(function(n){function a(s){if(s===void 0)throw new Error("No runtime abstraction layer provided");t=s}i(a,"install"),o(a,"install"),n.install=a})(r||(r={})),e.default=r}}),vs=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(c){return c===!0||c===!1}i(t,"boolean"),o(t,"boolean"),e.boolean=t;function r(c){return typeof c=="string"||c instanceof String}i(r,"string"),o(r,"string"),e.string=r;function n(c){return typeof c=="number"||c instanceof Number}i(n,"number"),o(n,"number"),e.number=n;function a(c){return c instanceof Error}i(a,"error"),o(a,"error"),e.error=a;function s(c){return typeof c=="function"}i(s,"func"),o(s,"func"),e.func=s;function l(c){return Array.isArray(c)}i(l,"array"),o(l,"array"),e.array=l;function u(c){return l(c)&&c.every(f=>r(f))}i(u,"stringArray"),o(u,"stringArray"),e.stringArray=u}}),Fa=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=_n(),r;(function(s){let l={dispose(){}};s.None=function(){return l}})(r||(e.Event=r={}));var n=class{static{i(this,"CallbackList")}static{o(this,"CallbackList")}add(s,l=null,u){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(l),Array.isArray(u)&&u.push({dispose:o(()=>this.remove(s,l),"dispose")})}remove(s,l=null){if(!this._callbacks)return;let u=!1;for(let c=0,f=this._callbacks.length;c<f;c++)if(this._callbacks[c]===s)if(this._contexts[c]===l){this._callbacks.splice(c,1),this._contexts.splice(c,1);return}else u=!0;if(u)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];let l=[],u=this._callbacks.slice(0),c=this._contexts.slice(0);for(let f=0,d=u.length;f<d;f++)try{l.push(u[f].apply(c[f],s))}catch(p){(0,t.default)().
|
||
|
|
${JSON.stringify(Object.fromEntries(p))}`));return}let v=parseInt(m);if(isNaN(v)){this.fireError(new Error(`Content-Length value must be a number. Got ${m}`));return}this.nextMessageLength=v}let d=this.buffer.tryReadBody(this.nextMessageLength);if(d===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let p=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(d):d,m=await this.options.contentTypeDecoder.decode(p,this.options);this.callback(m)}).catch(p=>{this.fireError(p)})}}catch(d){this.fireError(d)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((f,d)=>{this.partialMessageTimer=void 0,f===this.messageToken&&(this.firePartialMessage({messageToken:f,waitingTime:d}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};e.ReadableStreamMessageReader=c}}),IS=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=_n(),r=vs(),n=Ag(),a=Fa(),s="Content-Length: ",l=`\r
|
||
|
|
`,u;(function(p){function m(v){let T=v;return T&&r.func(T.dispose)&&r.func(T.onClose)&&r.func(T.onError)&&r.func(T.write)}i(m,"is"),o(m,"is"),p.is=m})(u||(e.MessageWriter=u={}));var c=class{static{i(this,"AbstractMessageWriter")}static{o(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new a.Emitter,this.closeEmitter=new a.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(p,m,v){this.errorEmitter.fire([this.asError(p),m,v])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(p){return p instanceof Error?p:new Error(`Writer received error. Reason: ${r.string(p.message)?p.message:"unknown"}`)}};e.AbstractMessageWriter=c;var f;(function(p){function m(v){return v===void 0||typeof v=="string"?{charset:v??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:v.charset??"utf-8",contentEncoder:v.contentEncoder,contentTypeEncoder:v.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}i(m,"fromOptions"),o(m,"fromOptions"),p.fromOptions=m})(f||(f={}));var d=class extends c{static{i(this,"WriteableStreamMessageWriter")}static{o(this,"WriteableStreamMessageWriter")}constructor(p,m){super(),this.writable=p,this.options=f.fromOptions(m),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(v=>this.fireError(v)),this.writable.onClose(()=>this.fireClose())}async write(p){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(p,this.options).then(v=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(v):v).then(v=>{let T=[];return T.push(s,v.byteLength.toString(),l),T.push(l),this.doWrite(p,T,v)},v=>{throw this.fireError(v),v}))}async doWrite(p,m,v){try{return await this.writable.write(m.join(""),"ascii"),this.writable.write(v)}catch(T){return this.handleError(T,p),Promise.reject(T)}}handleError(p,m){this.errorCount++,this.fireError(p,m,this.errorCount)}end(){this.writable.end()}};e.WriteableStreamMessageWriter=d}}),NS=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,r=10,n=`\r
|
||
|
|
`,a=class{static{i(this,"AbstractMessageBuffer")}static{o(this,"AbstractMessageBuffer")}constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){let l=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(l),this._totalLength+=l.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let l=0,u=0,c=0,f=0;e:for(;u<this._chunks.length;){let v=this._chunks[u];for(c=0;c<v.length;){switch(v[c]){case t:switch(l){case 0:l=1;break;case 2:l=3;break;default:l=0}break;case r:switch(l){case 1:l=2;break;case 3:l=4,c++;break e;default:l=0}break;default:l=0}c++}f+=v.byteLength,u++}if(l!==4)return;let d=this._read(f+c),p=new Map,m=this.toString(d,"ascii").split(n);if(m.length<2)return p;for(let v=0;v<m.length-2;v++){let T=m[v],w=T.indexOf(":");if(w===-1)throw new Error(`Message header must separate key and value using ':'
|
||
|
|
${T}`);let N=T.substr(0,w),I=T.substr(w+1).trim();p.set(s?N.toLowerCase():N,I)}return p}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){let f=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(f)}if(this._chunks[0].byteLength>s){let f=this._chunks[0],d=this.asNative(f,s);return this._chunks[0]=f.slice(s),this._totalLength-=s,d}let l=this.allocNative(s),u=0,c=0;for(;s>0;){let f=this._chunks[c];if(f.byteLength>s){let d=f.slice(0,s);l.set(d,u),u+=s,this._chunks[c]=f.slice(s),this._totalLength-=s,s-=s}else l.set(f,u),u+=f.byteLength,this._chunks.shift(),this._totalLength-=f.byteLength,s-=f.byteLength}return l}};e.AbstractMessageBuffer=a}}),kS=Y({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=_n(),r=vs(),n=Tg(),a=$g(),s=Fa(),l=yl(),u;(function(y){y.type=new n.NotificationType("$/cancelRequest")})(u||(u={}));var c;(function(y){function E(R){return typeof R=="string"||typeof R=="number"}i(E,"is"),o(E,"is"),y.is=E})(c||(e.ProgressToken=c={}));var f;(function(y){y.type=new n.NotificationType("$/progress")})(f||(f={}));var d=class{static{i(this,"ProgressType")}static{o(this,"ProgressType")}constructor(){}};e.ProgressType=d;var p;(function(y){function E(R){return r.func(R)}i(E,"is"),o(E,"is"),y.is=E})(p||(p={})),e.NullLogger=Object.freeze({error:o(()=>{},"error"),warn:o(()=>{},"warn"),info:o(()=>{},"info"),log:o(()=>{},"log")});var m;(function(y){y[y.Off=0]="Off",y[y.Messages=1]="Messages",y[y.Compact=2]="Compact",y[y.Verbose=3]="Verbose"})(m||(e.Trace=m={}));var v;(function(y){y.Off="off",y.Messages="messages",y.Compact="compact",y.Verbose="verbose"})(v||(e.TraceValues=v={})),(function(y){function E($){if(!r.string($))return y.Off;switch($=$.toLowerCase(),$){case"off":return y.Off;case"messages":return y.Messages;case"compact":return y.Compact;case"verbose":return y.Verbose;default:return y.Off}}i(E,"fromString"),o(E,"fromString"),y.fromString=E;function R($){switch($){case y.Off:return"off";case y.Messages:return"messages";case y.Compact:return"compact";case y.Verbose:return"verbose";default:return"off"}}i(R,"toString4"),o(R,"toString"),y.toString=R})(m||(e.Trace=m={}));var T;(function(y){y.Text="text",y.JSON="json"})(T||(e.TraceFormat=T={})),(function(y){function E(R){return r.string(R)?(R=R.toLowerCase(),R==="json"?y.JSON:y.Text):y.Text}i(E,"fromString"),o(E,"fromString"),y.fromString=E})(T||(e.TraceFormat=T={}));var w;(function(y){y.type=new n.NotificationType("$/setTrace")})(w||(e.SetTraceNotification=w={}));var N;(function(y){y.type=new n.NotificationType("$/logTrace")})(N||(e.LogTraceNotification=N={}));var I;(function(y){y[y.Closed=1]="Closed",y[y.Disposed=2]="Disposed",y[y.AlreadyListening=3]="AlreadyListening"})(I||(e.ConnectionErrors=I={}));var S=class Eg extends Error{static{i(this,"_ConnectionError")}static{o(this,"ConnectionError")}constructor(E,R){super(R),this.code=E,Object.setPrototypeOf(this,Eg.prototype)}};e.ConnectionError=S;var _;(function(y){function E(R){let $=R;return $&&r.func($.cancelUndispatched)}i(E,"is"),o(E,"is"),y.is=E})(_||(e.ConnectionStrategy=_={}));var P;(function(y){function E(R){let $=R;return $&&($.kind===void 0||$.kind==="id")&&r.func($.createCancellationTokenSource)&&($.dispose===void 0||r.func($.dispose))}i(E,"is"),o(E,"is"),y.is=E})(P||(e.IdCancellationReceiverStrategy=P={}));var j;(function(y){function E(R){let $=R;return $&&$.kind==
|
||
|
|
${JSON.stringify(g.error,void 0,4)}`):b.error("Received response message without id. No further error information provided.");else{let k=g.id,D=$e.get(k);if(di(g,D),D!==void 0){$e.delete(k);try{if(g.error){let F=g.error;D.reject(new n.ResponseError(F.code,F.message,F.data))}else if(g.result!==void 0)D.resolve(g.result);else throw new Error("Should never happen.")}catch(F){F.message?b.error(`Response handler '${D.method}' failed with message: ${F.message}`):b.error(`Response handler '${D.method}' failed unexpectedly.`)}}}}i(si,"handleResponse"),o(si,"handleResponse");function oi(g){if(Ft())return;let k,D;if(g.method===u.type.method){let F=g.params.id;ze.delete(F),zr(g);return}else{let F=Oe.get(g.method);F&&(D=F.handler,k=F.type)}if(D||H)try{if(zr(g),D)if(g.params===void 0)k!==void 0&&k.numberOfParams!==0&&k.parameterStructures!==n.ParameterStructures.byName&&b.error(`Notification ${g.method} defines ${k.numberOfParams} params but received none.`),D();else if(Array.isArray(g.params)){let F=g.params;g.method===f.type.method&&F.length===2&&c.is(F[0])?D({token:F[0],value:F[1]}):(k!==void 0&&(k.parameterStructures===n.ParameterStructures.byName&&b.error(`Notification ${g.method} defines parameters by name but received parameters by position`),k.numberOfParams!==g.params.length&&b.error(`Notification ${g.method} defines ${k.numberOfParams} params but received ${F.length} arguments`)),D(...F))}else k!==void 0&&k.parameterStructures===n.ParameterStructures.byPosition&&b.error(`Notification ${g.method} defines parameters by position but received parameters by name`),D(g.params);else H&&H(g.method,g.params)}catch(F){F.message?b.error(`Notification handler '${g.method}' failed with message: ${F.message}`):b.error(`Notification handler '${g.method}' failed unexpectedly.`)}else Ya.fire(g)}i(oi,"handleNotification"),o(oi,"handleNotification");function li(g){if(!g){b.error("Received empty message.");return}b.error(`Received message which is neither a response nor a notification message:
|
||
|
|
${JSON.stringify(g,null,4)}`);let k=g;if(r.string(k.id)||r.number(k.id)){let D=k.id,F=$e.get(D);F&&F.reject(new Error("The received response has neither a result nor an error property."))}}i(li,"handleInvalidMessage"),o(li,"handleInvalidMessage");function Rt(g){if(g!=null)switch(J){case m.Verbose:return JSON.stringify(g,null,4);case m.Compact:return JSON.stringify(g);default:return}}i(Rt,"stringifyTrace"),o(Rt,"stringifyTrace");function ui(g){if(!(J===m.Off||!fe))if(Ge===T.Text){let k;(J===m.Verbose||J===m.Compact)&&g.params&&(k=`Params: ${Rt(g.params)}
|
||
|
|
|
||
|
|
`),fe.log(`Sending request '${g.method} - (${g.id})'.`,k)}else Gt("send-request",g)}i(ui,"traceSendingRequest"),o(ui,"traceSendingRequest");function ci(g){if(!(J===m.Off||!fe))if(Ge===T.Text){let k;(J===m.Verbose||J===m.Compact)&&(g.params?k=`Params: ${Rt(g.params)}
|
||
|
|
|
||
|
|
`:k=`No parameters provided.
|
||
|
|
|
||
|
|
`),fe.log(`Sending notification '${g.method}'.`,k)}else Gt("send-notification",g)}i(ci,"traceSendingNotification"),o(ci,"traceSendingNotification");function Cr(g,k,D){if(!(J===m.Off||!fe))if(Ge===T.Text){let F;(J===m.Verbose||J===m.Compact)&&(g.error&&g.error.data?F=`Error data: ${Rt(g.error.data)}
|
||
|
|
|
||
|
|
`:g.result?F=`Result: ${Rt(g.result)}
|
||
|
|
|
||
|
|
`:g.error===void 0&&(F=`No result returned.
|
||
|
|
|
||
|
|
`)),fe.log(`Sending response '${k} - (${g.id})'. Processing request took ${Date.now()-D}ms`,F)}else Gt("send-response",g)}i(Cr,"traceSendingResponse"),o(Cr,"traceSendingResponse");function fi(g){if(!(J===m.Off||!fe))if(Ge===T.Text){let k;(J===m.Verbose||J===m.Compact)&&g.params&&(k=`Params: ${Rt(g.params)}
|
||
|
|
|
||
|
|
`),fe.log(`Received request '${g.method} - (${g.id})'.`,k)}else Gt("receive-request",g)}i(fi,"traceReceivedRequest"),o(fi,"traceReceivedRequest");function zr(g){if(!(J===m.Off||!fe||g.method===N.type.method))if(Ge===T.Text){let k;(J===m.Verbose||J===m.Compact)&&(g.params?k=`Params: ${Rt(g.params)}
|
||
|
|
|
||
|
|
`:k=`No parameters provided.
|
||
|
|
|
||
|
|
`),fe.log(`Received notification '${g.method}'.`,k)}else Gt("receive-notification",g)}i(zr,"traceReceivedNotification"),o(zr,"traceReceivedNotification");function di(g,k){if(!(J===m.Off||!fe))if(Ge===T.Text){let D;if((J===m.Verbose||J===m.Compact)&&(g.error&&g.error.data?D=`Error data: ${Rt(g.error.data)}
|
||
|
|
|
||
|
|
`:g.result?D=`Result: ${Rt(g.result)}
|
||
|
|
|
||
|
|
`:g.error===void 0&&(D=`No result returned.
|
||
|
|
|
||
|
|
`)),k){let F=g.error?` Request failed: ${g.error.message} (${g.error.code}).`:"";fe.log(`Received response '${k.method} - (${g.id})' in ${Date.now()-k.timerStart}ms.${F}`,D)}else fe.log(`Received response ${g.id} without active response promise.`,D)}else Gt("receive-response",g)}i(di,"traceReceivedResponse"),o(di,"traceReceivedResponse");function Gt(g,k){if(!fe||J===m.Off)return;let D={isLSPMessage:!0,type:g,message:k,timestamp:Date.now()};fe.log(D)}i(Gt,"logLSPMessage"),o(Gt,"logLSPMessage");function tr(){if(Hn())throw new S(I.Closed,"Connection is closed.");if(Ft())throw new S(I.Disposed,"Connection is disposed.")}i(tr,"throwIfClosedOrDisposed"),o(tr,"throwIfClosedOrDisposed");function pi(){if(Vn())throw new S(I.AlreadyListening,"Connection is already listening")}i(pi,"throwIfListening"),o(pi,"throwIfListening");function hi(){if(!Vn())throw new Error("Call listen() first.")}i(hi,"throwIfNotListening"),o(hi,"throwIfNotListening");function rr(g){return g===void 0?null:g}i(rr,"undefinedToNull"),o(rr,"undefinedToNull");function Zn(g){if(g!==null)return g}i(Zn,"nullToUndefined"),o(Zn,"nullToUndefined");function h(g){return g!=null&&!Array.isArray(g)&&typeof g=="object"}i(h,"isNamedParam"),o(h,"isNamedParam");function ne(g,k){switch(g){case n.ParameterStructures.auto:return h(k)?Zn(k):[rr(k)];case n.ParameterStructures.byName:if(!h(k))throw new Error("Received parameters by name but param is not an object literal.");return Zn(k);case n.ParameterStructures.byPosition:return[rr(k)];default:throw new Error(`Unknown parameter structure ${g.toString()}`)}}i(ne,"computeSingleParam"),o(ne,"computeSingleParam");function Ae(g,k){let D,F=g.numberOfParams;switch(F){case 0:D=void 0;break;case 1:D=ne(g.parameterStructures,k[0]);break;default:D=[];for(let ge=0;ge<k.length&&ge<F;ge++)D.push(rr(k[ge]));if(k.length<F)for(let ge=k.length;ge<F;ge++)D.push(null);break}return D}i(Ae,"computeMessageParams"),o(Ae,"computeMessageParams");let V={sendNotification:o((g,...k)=>{tr();let D,F;if(r.string(g)){D=g;let ue=k[0],be=0,Ne=n.ParameterStructures.auto;n.ParameterStructures.is(ue)&&(be=1,Ne=ue);let te=k.length,Ee=te-be;switch(Ee){case 0:F=void 0;break;case 1:F=ne(Ne,k[be]);break;default:if(Ne===n.ParameterStructures.byName)throw new Error(`Received ${Ee} parameters for 'by Name' notification parameter structure.`);F=k.slice(be,te).map(se=>rr(se));break}}else{let ue=k;D=g.method,F=Ae(g,ue)}let ge={jsonrpc:U,method:D,params:F};return ci(ge),E.write(ge).catch(ue=>{throw b.error("Sending notification failed."),ue})},"sendNotification"),onNotification:o((g,k)=>{tr();let D;return r.func(g)?H=g:k&&(r.string(g)?(D=g,Oe.set(g,{type:void 0,handler:k})):(D=g.method,Oe.set(g.method,{type:g,handler:k}))),{dispose:o(()=>{D!==void 0?Oe.delete(D):H=void 0},"dispose")}},"onNotification"),onProgress:o((g,k,D)=>{if(ie.has(k))throw new Error(`Progress handler for token ${k} already registered`);return ie.set(k,D),{dispose:o(()=>{ie.delete(k)},"dispose")}},"onProgress"),sendProgress:o((g,k,D)=>V.sendNotification(f.type,{token:k,value:D}),"sendProgress"),onUnhandledProgress:Xa.event,sendRequest:o((g,...k)=>{tr(),hi();let D,F,ge;if(r.string(g)){D=g;let te=k[0],Ee=k[k.length-1],se=0,De=n.ParameterStructures.auto;n.ParameterStructures.is(te)&&(se=1,De=te);let He=k.length;l.CancellationToken.is(Ee)&&(He=He-1,ge=Ee);let jt=He-se;switch(jt){case 0:F=void 0;break;case 1:F=ne(De,k[se]);break;default:if(De===n.ParameterStructures.byName)throw new Error(`Received ${jt} parameters for 'by Name' request parameter structure.`);F=k.slice(se,He).map(RS=>rr(RS));break}}else{let te=k;D=g.method,F=Ae(g,te);let Ee=g.numberOfParams;ge=l.CancellationToken.is(te[Ee])?te[Ee]:void 0}let ue=L++,be;ge&&(be=ge.onCancellationRequested(()=>{let te=St.sender.sendCancellation(V,ue);return te===void 0?(b.log(`Received no promise from cancellation strategy when cancelling id ${ue}`),Promise.resolve()):te.catch(()=>{b.log(`Sending cancellation messages for id ${ue} failed`)})}));let Ne={jsonrpc:U,id:ue,method:D,params:F};return ui(Ne),typeof St.sender.enableCancellation=="function"&&St.sender.enableCan
|
||
|
|
`),K("\r"),K(" "),K("\v"),K(" "),K("\xA0"),K("\u1680"),K("\u2000"),K("\u2001"),K("\u2002"),K("\u2003"),K("\u2004"),K("\u2005"),K("\u2006"),K("\u2007"),K("\u2008"),K("\u2009"),K("\u200A"),K("\u2028"),K("\u2029"),K("\u202F"),K("\u205F"),K("\u3000"),K("\uFEFF")],iw=/[0-9a-fA-F]/,Fs=/[0-9]/,sw=/[1-9]/,Zg=class{static{i(this,"RegExpParser")}static{o(this,"RegExpParser")}constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":oa(r,"global");break;case"i":oa(r,"ignoreCase");break;case"m":oa(r,"multiLine");break;case"u":oa(r,"unicode");break;case"y":oa(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Yr(t);let r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return Pi()}quantifier(e=!1){let t,r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),t={atLeast:n,atMost:a}):t={atLeast:n,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Yr(t);break}if(!(e===!0&&t===void 0)&&Yr(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Yr(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Pi()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[K(`
|
||
|
|
`),K("\r"),K("\u2028"),K("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=Ko;break;case"D":e=Ko,t=!0;break;case"s":e=Ph;break;case"S":e=Ph,t=!0;break;case"w":e=qo;break;case"W":e=qo,t=!0;break}return Yr(e)?{type:"Set",value:e,complement:t}:Pi()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=K("\f");break;case"n":e=K(`
|
||
|
|
`);break;case"r":e=K("\r");break;case"t":e=K(" ");break;case"v":e=K("\v");break}return Yr(e)?{type:"Character",value:e}:Pi()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:K("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:K(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
||
|
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:K(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let r=this.classAtom(),n=r.type==="Character";if(Yc(r)&&this.isRangeDash()){this.consumeChar("-");let a=this.classAtom(),s=a.type==="Character";if(Yc(a)){if(a.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:a.value})}else co(r.value,e),e.push(K("-")),co(a.value,e)}else co(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
||
|
|
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:K("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}let t=this.disjunction();this.consumeChar(")");let r={type:"Group",capturing:e,value:t};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(sw.test(e)===!1)throw Error("Expecting a positive integer");for(;Fs.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Fs.test(e)===!1)throw Error("Expecting an integer");for(;Fs.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
|
||
|
|
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:K(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Fs.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
||
|
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
||
|
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n<e;n++){let a=this.popChar();if(iw.test(a)===!1)throw Error("Expecting a HexDecimal digits");t+=a}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}},Sl=class{static{i(this,"BaseRegExpVisitor")}static{o(this,"BaseRegExpVisitor")}visitChildren(e){for(let t in e){let r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(n=>{this.visit(n)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},Qg=/\r?\n/gm,ey=new Zg,ow=class extends Sl{static{i(this,"TerminalRegExpVisitor")}static{o(this,"TerminalRegExpVisitor")}constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
|
||
|
|
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=ja(t);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(t);this.multiline=!!`
|
||
|
|
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},hn=new ow;function ty(e){try{typeof e!="string"&&(e=e.source),e=`/${e}/`;let t=ey.pattern(e),r=[];for(let n of t.value.value)hn.reset(e),hn.visit(n),r.push({start:hn.startRegexp,end:hn.endRegex});return r}catch{return[]}}i(ty,"getTerminalParts");o(ty,"getTerminalParts");function Id(e){try{return typeof e=="string"&&(e=new RegExp(e)),e=e.toString(),hn.reset(e),hn.visit(ey.pattern(e)),hn.multiline}catch{return!1}}i(Id,"isMultilineComment");o(Id,"isMultilineComment");var ry=`\f
|
||
|
|
\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");function wl(e){let t=typeof e=="string"?new RegExp(e):e;return ry.some(r=>t.test(r))}i(wl,"isWhitespace");o(wl,"isWhitespace");function ja(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(ja,"escapeRegExp");o(ja,"escapeRegExp");function Nd(e,t){let r=kd(e),n=t.match(r);return!!n&&n[0].length>0}i(Nd,"partialMatches");o(Nd,"partialMatches");function kd(e){typeof e=="string"&&(e=new RegExp(e));let t=e,r=e.source,n=0;function a(){let s="",l;function u(f){s+=r.substr(n,f),n+=f}i(u,"appendRaw"),o(u,"appendRaw");function c(f){s+="(?:"+r.substr(n,f)+"|$)",n+=f}for(i(c,"appendOptional"),o(c,"appendOptional");n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":c(3);break;case"x":c(4);break;case"u":t.unicode?r[n+2]==="{"?c(r.indexOf("}",n)-n+1):c(6):c(2);break;case"p":case"P":t.unicode?c(r.indexOf("}",n)-n+1):c(2);break;case"k":c(r.indexOf(">",n)-n+1);break;default:c(2);break}break;case"[":l=/\[(?:\\.|.)*?\]/g,l.lastIndex=n,l=l.exec(r)||[],c(l[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":u(1);break;case"{":l=/\{\d+,?\d*\}/g,l.lastIndex=n,l=l.exec(r),l?u(l[0].length):c(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":s+="(?:",n+=3,s+=a()+"|$)";break;case"=":s+="(?=",n+=3,s+=a()+")";break;case"!":l=n,n+=3,a(),s+=r.substr(l,n-l);break;case"<":switch(r[n+3]){case"=":case"!":l=n,n+=4,a(),s+=r.substr(l,n-l);break;default:u(r.indexOf(">",n)-n+1),s+=a()+"|$)";break}break}else u(1),s+=a()+"|$)";break;case")":return++n,s;default:c(1);break}return s}return i(a,"process2"),o(a,"process"),new RegExp(a(),e.flags)}i(kd,"partialRegExp");o(kd,"partialRegExp");function Pd(e){return e.rules.find(t=>Qe(t)&&t.entry)}i(Pd,"getEntryRule");o(Pd,"getEntryRule");function Od(e){return e.rules.filter(t=>Ct(t)&&t.hidden)}i(Od,"getHiddenRules");o(Od,"getHiddenRules");function Il(e,t){let r=new Set,n=Pd(e);if(!n)return new Set(e.rules);let a=[n].concat(Od(e));for(let l of a)Ld(l,r,t);let s=new Set;for(let l of e.rules)(r.has(l.name)||Ct(l)&&l.hidden)&&s.add(l);return s}i(Il,"getAllReachableRules");o(Il,"getAllReachableRules");function Ld(e,t,r){t.add(e.name),$r(e).forEach(n=>{if(hr(n)||r&&Al(n)){let a=n.rule.ref;a&&!t.has(a.name)&&Ld(a,t,r)}})}i(Ld,"ruleDfs");o(Ld,"ruleDfs");function ny(e){let t=new Set;return $r(e).forEach(r=>{wn(r)&&(Qe(r.type.ref)&&t.add(r.type.ref),Rs(r.type.ref)&&Qe(r.type.ref.$container)&&t.add(r.type.ref.$container))}),t}i(ny,"getAllRulesUsedForCrossReferences");o(ny,"getAllRulesUsedForCrossReferences");function Dd(e){if(e.terminal)return e.terminal;if(e.type.ref)return Ol(e.type.ref)?.terminal}i(Dd,"getCrossReferenceTerminal");o(Dd,"getCrossReferenceTerminal");function Md(e){return e.hidden&&!wl(Es(e))}i(Md,"isCommentTerminal");o(Md,"isCommentTerminal");function xd(e,t){return!e||!t?[]:kl(e,t,e.astNode,!0)}i(xd,"findNodesForProperty");o(xd,"findNodesForProperty");function Nl(e,t,r){if(!e||!t)return;let n=kl(e,t,e.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}i(Nl,"findNodeForProperty");o(Nl,"findNodeForProperty");function kl(e,t,r,n){if(!n){let a=bn(e.grammarSource,dr);if(a&&a.feature===t)return[e]}return fr(e)&&e.astNode===r?e.content.flatMap(a=>kl(a,t,r,!1)):[]}i(kl,"findNodesForPropertyInternal");o(kl,"findNodesForPropertyInternal");function ay(e,t){return e?Pl(e,t,e?.astNode):[]}i(ay,"findNodesForKeyword");o(ay,"findNodesForKeyword");function Fd(e,t,r){if(!e)return;let n=Pl(e,t,e?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}i(Fd,"findNodeForKeyword");o(Fd,"findNodeForKeyword");function Pl(e,t,r){if(e.astNode!==r)return[];if(pr(e.grammarSource)&&e.grammarSource.value===t)return[e];let n=ka(e).iterator(),a,s=[];do if(a=n.next(),!a.done){let l=a.value;l.astNode===r?pr(l.grammarSource)&&l.grammarSource.value===t&&s.push(l):n.prune()}while(!a.done);return s}i(Pl,"findNodesForKeywordInternal");o(Pl,"findNodesForKeywordInternal");function Gd(e){let t=e.astNode;for(;t===e.container?.astNod
|
||
|
|
`;function E$(e,t=!1){try{let r=Ps(e);return Jo(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===A$)t&&pp(`${Xo} Unable to optimize: < ${e.toString()} >
|
||
|
|
Complement Sets cannot be automatically optimized.
|
||
|
|
This will disable the lexer's first char optimizations.
|
||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n=`
|
||
|
|
This will disable the lexer's first char optimizations.
|
||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Yo(`${Xo}
|
||
|
|
Failed parsing: < ${e.toString()} >
|
||
|
|
Using the @chevrotain/regexp-to-ast library
|
||
|
|
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}i(E$,"getOptimizedStartCodesIndices");o(E$,"getOptimizedStartCodesIndices");function Jo(e,t,r){switch(e.type){case"Disjunction":for(let a=0;a<e.value.length;a++)Jo(e.value[a],t,r);break;case"Alternative":let n=e.value;for(let a=0;a<n.length;a++){let s=n[a];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let l=s;switch(l.type){case"Character":Oi(l.value,t,r);break;case"Set":if(l.complement===!0)throw Error(A$);q(l.value,c=>{if(typeof c=="number")Oi(c,t,r);else{let f=c;if(r===!0)for(let d=f.from;d<=f.to;d++)Oi(d,t,r);else{for(let d=f.from;d<=f.to&&d<Di;d++)Oi(d,t,r);if(f.to>=Di){let d=f.from>=Di?f.from:Di,p=f.to,m=yr(d),v=yr(p);for(let T=m;T<=v;T++)t[T]=T}}}});break;case"Group":Jo(l.value,t,r);break;default:throw Error("Non Exhaustive Match")}let u=l.quantifier!==void 0&&l.quantifier.atLeast===0;if(l.type==="Group"&&Zo(l)===!1||l.type!=="Group"&&u===!1)break}break;default:throw Error("non exhaustive match!")}return xe(t)}i(Jo,"firstCharOptimizedIndices");o(Jo,"firstCharOptimizedIndices");function Oi(e,t,r){let n=yr(e);t[n]=n,r===!0&&_$(e,t)}i(Oi,"addOptimizedIdxToResult");o(Oi,"addOptimizedIdxToResult");function _$(e,t){let r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){let a=yr(n.charCodeAt(0));t[a]=a}else{let a=r.toLowerCase();if(a!==r){let s=yr(a.charCodeAt(0));t[s]=s}}}i(_$,"handleIgnoreCase");o(_$,"handleIgnoreCase");function tf(e,t){return Da(e.value,r=>{if(typeof r=="number")return nt(t,r);{let n=r;return Da(t,a=>n.from<=a&&a<=n.to)!==void 0}})}i(tf,"findCode");o(tf,"findCode");function Zo(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?re(e.value)?Lt(e.value,Zo):Zo(e.value):!1}i(Zo,"isWholeOptional");o(Zo,"isWholeOptional");var NO=class extends Sl{static{i(this,"CharCodeFinder")}static{o(this,"CharCodeFinder")}constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){nt(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?tf(e,this.targetCharCodes)===void 0&&(this.found=!0):tf(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Yl(e,t){if(t instanceof RegExp){let r=Ps(t),n=new NO(e);return n.visit(r),n.found}else return Da(t,r=>nt(e,r.charCodeAt(0)))!==void 0}i(Yl,"canMatchCharCode");o(Yl,"canMatchCharCode");var An="PATTERN",Li="defaultMode",js="modes",C$=typeof new RegExp("(?:)").sticky=="boolean";function b$(e,t){t=fp(t,{useSticky:C$,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
||
|
|
`],tracer:o((S,_)=>_(),"tracer")});let r=t.tracer;r("initCharCodeToOptimizedIndexMap",()=>{V$()});let n;r("Reject Lexer.NA",()=>{n=Vl(e,S=>S[An]===Ze.NA)});let a=!1,s;r("Transform Patterns",()=>{a=!1,s=G(n,S=>{let _=S[An];if(mr(_)){let P=_.source;return P.length===1&&P!=="^"&&P!=="$"&&P!=="."&&!_.ignoreCase?P:P.length===2&&P[0]==="\\"&&!nt(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],P[1])?P[1]:t.useSticky?nf(_):rf(_)}else{if(Ar(_))return a=!0,{exec:_};if(typeof _=="object")return a=!0,_;if(typeof _=="string"){if(_.length===1)return _;{let P=_.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),j=new RegExp(P);return t.useSticky?nf(j):rf(j)}}else throw Error("non exhaustive match")}})});let l,u,c,f,d;r("misc mapping",()=>{l=G(n,S=>S.tokenTypeIdx),u=G(n,S=>{let _=S.GROUP;if(_!==Ze.SKIPPED){if(ot(_))return _;if(gr(_))return!1;throw Error("non exhaustive match")}}),c=G(n,S=>{let _=S.LONGER_ALT;if(_)return re(_)?G(_,j=>fm(n,j)):[fm(n,_)]}),f=G(n,S=>S.PUSH_MODE),d=G(n,S=>B(S,"POP_MODE"))});let p;r("Line Terminator Handling",()=>{let S=vp(t.lineTerminatorCharacters);p=G(n,_=>!1),t.positionTracking!=="onlyOffset"&&(p=G(n,_=>B(_,"LINE_BREAKS")?!!_.LINE_BREAKS:yp(_,S)===!1&&Yl(S,_.PATTERN)))});let m,v,T,w;r("Misc Mapping #2",()=>{m=G(n,gp),v=G(s,q$),T=mt(n,(S,_)=>{let P=_.GROUP;return ot(P)&&P!==Ze.SKIPPED&&(S[P]=[]),S},{}),w=G(s,(S,_)=>({pattern:s[_],longerAlt:c[_],canLineTerminator:p[_],isCustom:m[_],short:v[_],group:u[_],push:f[_],pop:d[_],tokenTypeIdx:l[_],tokenType:n[_]}))});let N=!0,I=[];return t.safeMode||r("First Char Optimization",()=>{I=mt(n,(S,_,P)=>{if(typeof _.PATTERN=="string"){let j=_.PATTERN.charCodeAt(0),ee=yr(j);ho(S,ee,w[P])}else if(re(_.START_CHARS_HINT)){let j;q(_.START_CHARS_HINT,ee=>{let X=typeof ee=="string"?ee.charCodeAt(0):ee,ce=yr(X);j!==ce&&(j=ce,ho(S,ce,w[P]))})}else if(mr(_.PATTERN))if(_.PATTERN.unicode)N=!1,t.ensureOptimizations&&Yo(`${Xo} Unable to analyze < ${_.PATTERN.toString()} > pattern.
|
||
|
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
||
|
|
This will disable the lexer's first char optimizations.
|
||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let j=E$(_.PATTERN,t.ensureOptimizations);he(j)&&(N=!1),q(j,ee=>{ho(S,ee,w[P])})}else t.ensureOptimizations&&Yo(`${Xo} TokenType: <${_.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`),N=!1;return S},[])}),{emptyGroups:T,patternIdxToConfig:w,charCodeToPatternIdxToConfig:I,hasCustom:a,canBeOptimized:N}}i(b$,"analyzeTokenTypes");o(b$,"analyzeTokenTypes");function S$(e,t){let r=[],n=I$(e);r=r.concat(n.errors);let a=N$(n.valid),s=a.valid;return r=r.concat(a.errors),r=r.concat(w$(s)),r=r.concat(M$(s)),r=r.concat(x$(s,t)),r=r.concat(F$(s)),r}i(S$,"validatePatterns");o(S$,"validatePatterns");function w$(e){let t=[],r=bt(e,n=>mr(n[An]));return t=t.concat(k$(r)),t=t.concat(O$(r)),t=t.concat(L$(r)),t=t.concat(D$(r)),t=t.concat(P$(r)),t}i(w$,"validateRegExpPattern");o(w$,"validateRegExpPattern");function I$(e){let t=bt(e,a=>!B(a,An)),r=G(t,a=>({message:"Token Type: ->"+a.name+"<- missing static 'PATTERN' property",type:we.MISSING_PATTERN,tokenTypes:[a]})),n=Wl(e,t);return{errors:r,valid:n}}i(I$,"findMissingPatterns");o(I$,"findMissingPatterns");function N$(e){let t=bt(e,a=>{let s=a[An];return!mr(s)&&!Ar(s)&&!B(s,"exec")&&!ot(s)}),r=G(t,a=>({message:"Token Type: ->"+a.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:we.INVALID_PATTERN,tokenTypes:[a]})),n=Wl(e,t);return{errors:r,valid:n}}i(N$,"findInvalidPatterns");o(N$,"findInvalidPatterns");var kO=/[^\\][$]/;function k$(e){class t extends Sl{static{i(this,"EndAnchorFinder")}static{o(this,"EndAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}let r=bt(e,a=>{let s=a.PATTERN;try{let l=Ps(s),u=new t;return u.visit(l),u.found}catch{return kO.test(s.source)}});return G(r,a=>({message:`Unexpected RegExp Anchor Error:
|
||
|
|
Token Type: ->`+a.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
||
|
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:we.EOI_ANCHOR_FOUND,tokenTypes:[a]}))}i(k$,"findEndOfInputAnchor");o(k$,"findEndOfInputAnchor");function P$(e){let t=bt(e,n=>n.PATTERN.test(""));return G(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:we.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}i(P$,"findEmptyMatchRegExps");o(P$,"findEmptyMatchRegExps");var PO=/[^\\[][\^]|^\^/;function O$(e){class t extends Sl{static{i(this,"StartAnchorFinder")}static{o(this,"StartAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}let r=bt(e,a=>{let s=a.PATTERN;try{let l=Ps(s),u=new t;return u.visit(l),u.found}catch{return PO.test(s.source)}});return G(r,a=>({message:`Unexpected RegExp Anchor Error:
|
||
|
|
Token Type: ->`+a.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:we.SOI_ANCHOR_FOUND,tokenTypes:[a]}))}i(O$,"findStartOfInputAnchor");o(O$,"findStartOfInputAnchor");function L$(e){let t=bt(e,n=>{let a=n[An];return a instanceof RegExp&&(a.multiline||a.global)});return G(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:we.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}i(L$,"findUnsupportedFlags");o(L$,"findUnsupportedFlags");function D$(e){let t=[],r=G(e,s=>mt(e,(l,u)=>(s.PATTERN.source===u.PATTERN.source&&!nt(t,u)&&u.PATTERN!==Ze.NA&&(t.push(u),l.push(u)),l),[]));r=ks(r);let n=bt(r,s=>s.length>1);return G(n,s=>{let l=G(s,c=>c.name);return{message:`The same RegExp pattern ->${Mt(s).PATTERN}<-has been used in all of the following Token Types: ${l.join(", ")} <-`,type:we.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}i(D$,"findDuplicatePatterns");o(D$,"findDuplicatePatterns");function M$(e){let t=bt(e,n=>{if(!B(n,"GROUP"))return!1;let a=n.GROUP;return a!==Ze.SKIPPED&&a!==Ze.NA&&!ot(a)});return G(t,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:we.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}i(M$,"findInvalidGroupType");o(M$,"findInvalidGroupType");function x$(e,t){let r=bt(e,a=>a.PUSH_MODE!==void 0&&!nt(t,a.PUSH_MODE));return G(r,a=>({message:`Token Type: ->${a.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${a.PUSH_MODE}<-which does not exist`,type:we.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[a]}))}i(x$,"findModesThatDoNotExist");o(x$,"findModesThatDoNotExist");function F$(e){let t=[],r=mt(e,(n,a,s)=>{let l=a.PATTERN;return l===Ze.NA||(ot(l)?n.push({str:l,idx:s,tokenType:a}):mr(l)&&j$(l)&&n.push({str:l.source,idx:s,tokenType:a})),n},[]);return q(e,(n,a)=>{q(r,({str:s,idx:l,tokenType:u})=>{if(a<l&&G$(s,n.PATTERN)){let c=`Token: ->${u.name}<- can never be matched.
|
||
|
|
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:c,type:we.UNREACHABLE_PATTERN,tokenTypes:[n,u]})}})}),t}i(F$,"findUnreachablePatterns");o(F$,"findUnreachablePatterns");function G$(e,t){if(mr(t)){if(U$(t))return!1;let r=t.exec(e);return r!==null&&r.index===0}else{if(Ar(t))return t(e,0,[],{});if(B(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}i(G$,"tryToMatchStrToPattern");o(G$,"tryToMatchStrToPattern");function j$(e){return Da([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>e.source.indexOf(r)!==-1)===void 0}i(j$,"noMetaChar");o(j$,"noMetaChar");function U$(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}i(U$,"usesLookAheadOrBehind");o(U$,"usesLookAheadOrBehind");function rf(e){let t=e.ignoreCase?"i":"";return new RegExp(`^(?:${e.source})`,t)}i(rf,"addStartOfInput");o(rf,"addStartOfInput");function nf(e){let t=e.ignoreCase?"iy":"y";return new RegExp(`${e.source}`,t)}i(nf,"addStickyFlag");o(nf,"addStickyFlag");function z$(e,t,r){let n=[];return B(e,Li)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Li+`> property in its definition
|
||
|
|
`,type:we.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),B(e,js)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+js+`> property in its definition
|
||
|
|
`,type:we.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),B(e,js)&&B(e,Li)&&!B(e.modes,e.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Li}: <${e.defaultMode}>which does not exist
|
||
|
|
`,type:we.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),B(e,js)&&q(e.modes,(a,s)=>{q(a,(l,u)=>{if(gr(l))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${u}>
|
||
|
|
`,type:we.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(B(l,"LONGER_ALT")){let c=re(l.LONGER_ALT)?l.LONGER_ALT:[l.LONGER_ALT];q(c,f=>{!gr(f)&&!nt(a,f)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${f.name}> on token <${l.name}> outside of mode <${s}>
|
||
|
|
`,type:we.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}i(z$,"performRuntimeChecks");o(z$,"performRuntimeChecks");function B$(e,t,r){let n=[],a=!1,s=ks(Ot(xe(e.modes))),l=Vl(s,c=>c[An]===Ze.NA),u=vp(r);return t&&q(l,c=>{let f=yp(c,u);if(f!==!1){let p={message:W$(c,f),type:f.issue,tokenType:c};n.push(p)}else B(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(a=!0):Yl(u,c.PATTERN)&&(a=!0)}),t&&!a&&n.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:we.NO_LINE_BREAKS_FLAGS}),n}i(B$,"performWarningRuntimeChecks");o(B$,"performWarningRuntimeChecks");function K$(e){let t={},r=pt(e);return q(r,n=>{let a=e[n];if(re(a))t[n]=[];else throw Error("non exhaustive match")}),t}i(K$,"cloneEmptyGroups");o(K$,"cloneEmptyGroups");function gp(e){let t=e.PATTERN;if(mr(t))return!1;if(Ar(t))return!0;if(B(t,"exec"))return!0;if(ot(t))return!1;throw Error("non exhaustive match")}i(gp,"isCustomPattern");o(gp,"isCustomPattern");function q$(e){return ot(e)&&e.length===1?e.charCodeAt(0):!1}i(q$,"isShortPattern");o(q$,"isShortPattern");var OO={test:o(function(e){let t=e.length;for(let r=this.lastIndex;r<t;r++){let n=e.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return e.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},"test"),lastIndex:0};function yp(e,t){if(B(e,"LINE_BREAKS"))return!1;if(mr(e.PATTERN)){try{Yl(t,e.PATTERN)}catch(r){return{issue:we.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(ot(e.PATTERN))return!1;if(gp(e))return{issue:we.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}i(yp,"checkLineBreaksIssues");o(yp,"checkLineBreaksIssues");function W$(e,t){if(t.issue===we.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===we.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")}i(W$,"buildLineBreakIssueMessage");o(W$,"buildLineBreakIssueMessage");function vp(e){return G(e,r=>ot(r)?r.charCodeAt(0):r)}i(vp,"getCharCodes");o(vp,"getCharCodes");function ho(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(ho,"addToMapOfArrays");o(ho,"addToMapOfArrays");var Di=256,mo=[];function yr(e){return e<Di?e:mo[e]}i(yr,"charCodeToOptimizedIndex");o(yr,"charCodeToOptimizedIndex");function V$(){if(he(mo)){mo=new Array(65536);for(let e=0;e<65536;e++)mo[e]=e>255?255+~~(e/255):e}}i(V$,"initCharCodeToOptimizedIndexMap");o(V$,"initCharCodeToOptimizedIndexMap");function Ka(e,t){let r=e.tokenTypeIdx;return r===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[r]===!0}i(Ka,"tokenStructuredMatcher");o(Ka,"tokenStructuredMatcher");function ls(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}i(ls,"tokenStructuredMatcherNoCategories");o(ls,"tokenStructuredMatcherNoCategories");var pm=1,H$={};function qa(e){let t=Y$(e);X$(t),Z$(t),J$(t),q(t,r=>{r.isParent=r.categoryMatches.length>0})}i(qa,"augmentTokenTypes");o(qa,"augmentTokenTypes");function Y$(e){let t=Ve(e),r=e,n=!0;for(;n;){r=ks(Ot(G(r,s=>s.CATEGORIES)));let a=Wl(r,t);t=t.concat(a),he(a)?n=!1:r=a}return t}i(Y$,"expandCategories");o(Y$,"expandCategories");function X$(e){q(e,t=>{Rp(t)||(H$[pm]=t,t.tokenTypeIdx=pm++),af(t)&&!re(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),af(t)||(t.CATEGORIES=[]),Q$(t)||(t.categoryMatches=[]),eA(t)||(t.categoryMatchesMap={})})}i(X$,"assignTokenDefaultProps");o(X$,"assignTokenDefaultProps");function J$(e){q(e,t=>{t.categoryMatches=[],q(t.categoryMatchesMap,(r,n)=>{t.categoryMatches.push(H$[n].tokenTypeIdx)})})}i(J$,"assignCategoriesTokensProp");o(J$,"assignCategoriesTokensProp");function Z$(e){q(e,t=>{Tp([],t)})}i(Z$,"assignCategoriesMapProp");o(Z$,"assignCategoriesMapProp");function Tp(e,t){q(e,r=>{t.categoryMatchesMap[r.tokenTypeIdx]=!0}),q(t.CATEGORIES,r=>{let n=e.concat(t);nt(n,r)||Tp(n,r)})}i(Tp,"singleAssignCategoriesToksMap");o(Tp,"singleAssignCategoriesToksMap");function Rp(e){return B(e,"tokenTypeIdx")}i(Rp,"hasShortKeyProperty");o(Rp,"hasShortKeyProperty");function af(e){return B(e,"CATEGORIES")}i(af,"hasCategoriesProperty");o(af,"hasCategoriesProperty");function Q$(e){return B(e,"categoryMatches")}i(Q$,"hasExtendingTokensTypesProperty");o(Q$,"hasExtendingTokensTypesProperty");function eA(e){return B(e,"categoryMatchesMap")}i(eA,"hasExtendingTokensTypesMapProperty");o(eA,"hasExtendingTokensTypesMapProperty");function tA(e){return B(e,"tokenTypeIdx")}i(tA,"isTokenType");o(tA,"isTokenType");var sf={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,r,n,a,s){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`}},we;(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",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(we||(
|
||
|
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:sf,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Mi);var Ze=class{static{i(this,"Lexer")}static{o(this,"Lexer")}constructor(e,t=Mi){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(n,a)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${n}>`);let{time:l,value:u}=hp(a),c=l>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${s}<-- <${n}> time: ${l}ms`),this.traceInitIndent--,u}else return a()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
||
|
|
a boolean 2nd argument is no longer supported`);this.config=ht({},Mi,t);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let n,a=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Mi.lineTerminatorsPattern)this.config.lineTerminatorsPattern=OO;else if(this.config.lineTerminatorCharacters===Mi.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),re(e)?n={modes:{defaultMode:Ve(e)},defaultMode:Li}:(a=!1,n=Ve(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(z$(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(B$(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},q(n.modes,(l,u)=>{n.modes[u]=Vl(l,c=>gr(c))});let s=pt(n.modes);if(q(n.modes,(l,u)=>{this.TRACE_INIT(`Mode: <${u}> processing`,()=>{if(this.modes.push(u),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(S$(l,s))}),he(this.lexerDefinitionErrors)){qa(l);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=b$(l,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[u]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[u]=c.charCodeToPatternIdxToConfig,this.emptyGroups=ht({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[u]=c.canBeOptimized}})}),this.defaultMode=n.defaultMode,!he(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let u=G(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
|
||
|
|
`);throw new Error(`Errors detected in definition of Lexer:
|
||
|
|
`+u)}q(this.lexerDefinitionWarning,l=>{pp(l.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(C$?(this.chopInput=Oa,this.match=this.matchWithTest):(this.updateLastIndex=Me,this.match=this.matchWithExec),a&&(this.handleModes=Me),this.trackStartLines===!1&&(this.computeNewColumn=Oa),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Me),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let l=mt(this.canModeBeOptimized,(u,c,f)=>(c===!1&&u.push(f),u),[]);if(t.ensureOptimizations&&!he(l))throw Error(`Lexer Modes: < ${l.join(", ")} > cannot be optimized.
|
||
|
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
||
|
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{$$()}),this.TRACE_INIT("toFastProperties",()=>{mp(this)})})}tokenize(e,t=this.defaultMode){if(!he(this.lexerDefinitionErrors)){let n=G(this.lexerDefinitionErrors,a=>a.message).join(`-----------------------
|
||
|
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
||
|
|
`+n)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,n,a,s,l,u,c,f,d,p,m,v,T,w,N,I,S=e,_=S.length,P=0,j=0,ee=this.hasCustom?0:Math.floor(e.length/10),X=new Array(ee),ce=[],me=this.trackStartLines?1:void 0,Re=this.trackStartLines?1:void 0,O=K$(this.emptyGroups),C=this.trackStartLines,y=this.config.lineTerminatorsPattern,E=0,R=[],$=[],b=[],L=[];Object.freeze(L);let x;function M(){return R}i(M,"getPossiblePatternsSlow"),o(M,"getPossiblePatternsSlow");function U(ie){let Le=yr(ie),Ue=$[Le];return Ue===void 0?L:Ue}i(U,"getPossiblePatternsOptimized"),o(U,"getPossiblePatternsOptimized");let W=o(ie=>{if(b.length===1&&ie.tokenType.PUSH_MODE===void 0){let Le=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ie);ce.push({offset:ie.startOffset,line:ie.startLine,column:ie.startColumn,length:ie.image.length,message:Le})}else{b.pop();let Le=$n(b);R=this.patternIdxToConfig[Le],$=this.charCodeToPatternIdxToConfig[Le],E=R.length;let Ue=this.canModeBeOptimized[Le]&&this.config.safeMode===!1;$&&Ue?x=U:x=M}},"pop_mode");function le(ie){b.push(ie),$=this.charCodeToPatternIdxToConfig[ie],R=this.patternIdxToConfig[ie],E=R.length,E=R.length;let Le=this.canModeBeOptimized[ie]&&this.config.safeMode===!1;$&&Le?x=U:x=M}i(le,"push_mode"),o(le,"push_mode"),le.call(this,t);let H,Oe=this.config.recoveryEnabled;for(;P<_;){u=null;let ie=S.charCodeAt(P),Le=x(ie),Ue=Le.length;for(r=0;r<Ue;r++){H=Le[r];let $e=H.pattern;c=null;let ze=H.short;if(ze!==!1?ie===ze&&(u=$e):H.isCustom===!0?(I=$e.exec(S,P,X,O),I!==null?(u=I[0],I.payload!==void 0&&(c=I.payload)):u=null):(this.updateLastIndex($e,P),u=this.match($e,e,P)),u!==null){if(l=H.longerAlt,l!==void 0){let Ie=l.length;for(a=0;a<Ie;a++){let J=R[l[a]],Ge=J.pattern;if(f=null,J.isCustom===!0?(I=Ge.exec(S,P,X,O),I!==null?(s=I[0],I.payload!==void 0&&(f=I.payload)):s=null):(this.updateLastIndex(Ge,P),s=this.match(Ge,e,P)),s&&s.length>u.length){u=s,c=f,H=J;break}}}break}}if(u!==null){if(d=u.length,p=H.group,p!==void 0&&(m=H.tokenTypeIdx,v=this.createTokenInstance(u,P,m,H.tokenType,me,Re,d),this.handlePayload(v,c),p===!1?j=this.addToken(X,j,v):O[p].push(v)),e=this.chopInput(e,d),P=P+d,Re=this.computeNewColumn(Re,d),C===!0&&H.canLineTerminator===!0){let $e=0,ze,Ie;y.lastIndex=0;do ze=y.test(u),ze===!0&&(Ie=y.lastIndex-1,$e++);while(ze===!0);$e!==0&&(me=me+$e,Re=d-Ie,this.updateTokenEndLineColumnLocation(v,p,Ie,$e,me,Re,d))}this.handleModes(H,W,le,v)}else{let $e=P,ze=me,Ie=Re,J=Oe===!1;for(;J===!1&&P<_;)for(e=this.chopInput(e,1),P++,n=0;n<E;n++){let Ge=R[n],fe=Ge.pattern,at=Ge.short;if(at!==!1?S.charCodeAt(P)===at&&(J=!0):Ge.isCustom===!0?J=fe.exec(S,P,X,O)!==null:(this.updateLastIndex(fe,P),J=fe.exec(e)!==null),J===!0)break}if(T=P-$e,Re=this.computeNewColumn(Re,T),N=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(S,$e,T,ze,Ie,$n(b)),ce.push({offset:$e,line:ze,column:Ie,length:T,message:N}),Oe===!1)break}}return this.hasCustom||(X.length=j),{tokens:X,groups:O,errors:ce}}handleModes(e,t,r,n){if(e.pop===!0){let a=e.push;t(n),a!==void 0&&r.call(this,a)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,t){return e.substring(t)}updateLastIndex(e,t){e.lastIndex=t}updateTokenEndLineColumnLocation(e,t,r,n,a,s,l){let u,c;t!==void 0&&(u=r===l-1,c=u?-1:0,n===1&&u===!0||(e.endLine=a+c,e.endColumn=s-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,r,n){return{image:e,startOffset:t,tokenTypeIdx:r,tokenType:n}}createStartOnlyToken(e,t,r,n,a,s){return{image:e,startOffset:t,startLine:a,startColumn:s,tokenTypeIdx:r,tokenType:n}}createFullToken(e,t,r,n,a,s,l){return{image:e,startOffset:t,endOffset:t+l-1,startLine:a,endLine:a,startColumn:s,endColumn:s+l-1,tokenTypeIdx:r,tokenType:n}}addTokenUsingPush(e,t,r){return e.push(r),t}addTokenUsingMemberAccess(e,t,r){return e[t]=r,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}matchWithTest(e,t,r){return e.test(t)===!0?t.substring(r,e.lastIndex):null}matchWithExec(e,t){let r=e.exec(t);return r!==null?r[0]:null}};Ze.SKIPPED="This marks a skipped Token pattern, this means each token identified by
|
||
|
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return B(e,hm)&&(r.CATEGORIES=e[hm]),qa([r]),B(e,mm)&&(r.LABEL=e[mm]),B(e,gm)&&(r.GROUP=e[gm]),B(e,vm)&&(r.POP_MODE=e[vm]),B(e,ym)&&(r.PUSH_MODE=e[ym]),B(e,Tm)&&(r.LONGER_ALT=e[Tm]),B(e,Rm)&&(r.LINE_BREAKS=e[Rm]),B(e,$m)&&(r.START_CHARS_HINT=e[$m]),r}i(rA,"createTokenInternal");o(rA,"createTokenInternal");var Lr=_a({name:"EOF",pattern:Ze.NA});qa([Lr]);function Os(e,t,r,n,a,s,l,u){return{image:t,startOffset:r,endOffset:n,startLine:a,endLine:s,startColumn:l,endColumn:u,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}i(Os,"createTokenInstance");o(Os,"createTokenInstance");function Ap(e,t){return Ka(e,t)}i(Ap,"tokenMatcher");o(Ap,"tokenMatcher");var $a={buildMismatchTokenMessage({expected:e,actual:t,previous:r,ruleName:n}){return`Expecting ${$p(e)?`--> ${vn(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:r,customUserDescription:n,ruleName:a}){let s="Expecting: ",u=`
|
||
|
|
but found: '`+Mt(t).image+"'";if(n)return s+n+u;{let c=mt(e,(m,v)=>m.concat(v),[]),f=G(c,m=>`[${G(m,v=>vn(v)).join(", ")}]`),p=`one of these possible Token sequences:
|
||
|
|
${G(f,(m,v)=>` ${v+1}. ${m}`).join(`
|
||
|
|
`)}`;return s+p+u}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:r,ruleName:n}){let a="Expecting: ",l=`
|
||
|
|
but found: '`+Mt(t).image+"'";if(r)return a+r+l;{let c=`expecting at least one iteration which starts with one of these possible Token sequences::
|
||
|
|
<${G(e,f=>`[${G(f,d=>vn(d)).join(",")}]`).join(" ,")}>`;return a+c+l}}};Object.freeze($a);var DO={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<-
|
||
|
|
inside top level rule: ->`+e.name+"<-"}},mn={buildDuplicateFoundError(e,t){function r(d){return d instanceof Te?d.terminalType.name:d instanceof et?d.nonTerminalName:""}i(r,"getExtraProductionArgument2"),o(r,"getExtraProductionArgument");let n=e.name,a=Mt(t),s=a.idx,l=It(a),u=r(a),c=s>0,f=`->${l}${c?s:""}<- ${u?`with argument: ->${u}<-`:""}
|
||
|
|
appears more than once (${t.length} times) in the top level rule: ->${n}<-.
|
||
|
|
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(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(e){let t=G(e.prefixPath,a=>vn(a)).join(", "),r=e.alternation.idx===0?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
||
|
|
in <OR${r}> inside <${e.topLevelRule.name}> Rule,
|
||
|
|
<${t}> 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(e){let t=G(e.prefixPath,a=>vn(a)).join(", "),r=e.alternation.idx===0?"":e.alternation.idx,n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${e.topLevelRule.name}> Rule,
|
||
|
|
<${t}> may appears as a prefix path in all these alternatives.
|
||
|
|
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
||
|
|
For Further details.`,n},buildEmptyRepetitionError(e){let t=It(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(e){return"deprecated"},buildEmptyAlternationError(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(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(e){let t=e.topLevelRule.name,r=G(e.leftRecursionPath,s=>s.name),n=`${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:
|
||
|
|
${n}
|
||
|
|
To fix this refactor your grammar to remove the left recursion.
|
||
|
|
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof Ua?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function nA(e,t){let r=new MO(e,t);return r.resolveRefs(),r.errors}i(nA,"resolveGrammar");o(nA,"resolveGrammar");var MO=class extends za{static{i(this,"GastRefResolverVisitor")}static{o(this,"GastRefResolverVisitor")}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){q(xe(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:tt.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},xO=class extends Hl{static{i(this,"AbstractNextPossibleTokensWalker")}static{o(this,"AbstractNextPossibleTokensWalker")}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=Ve(this.path.ruleStack).reverse(),this.occurrenceStack=Ve(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){he(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},FO=class extends xO{static{i(this,"NextAfterTokenWalker")}static{o(this,"NextAfterTokenWalker")}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=t.concat(r),a=new lt({definition:n});this.possibleTokTypes=Ba(a),this.found=!0}}},Xl=class extends Hl{static{i(this,"AbstractNextTerminalAfterProductionWalker")}static{o(this,"AbstractNextTerminalAfterProductionWalker")}constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},GO=class extends Xl{static{i(this,"NextTerminalAfterManyWalker")}static{o(this,"NextTerminalAfterManyWalker")}walkMany(e,t,r){if(e.idx===this.occurrence){let n=Mt(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Te&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkMany(e,t,r)}},Am=class extends Xl{static{i(this,"NextTerminalAfterManySepWalker")}static{o(this,"NextTerminalAfterManySepWalker")}walkManySep(e,t,r){if(e.idx===this.occurrence){let n=Mt(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Te&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkManySep(e,t,r)}},jO=class extends Xl{static{i(this,"NextTerminalAfterAtLeastOneWalker")}static{o(this,"NextTerminalAfterAtLeastOneWalker")}walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){let n=Mt(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Te&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkAtLeastOne(e,t,r)}},Em=class extends Xl{static{i(this,"NextTerminalAfterAtLeastOneSepWalker")}static{o(this,"NextTerminalAfterAtLeastOneSepWalker")}walkAtLe
|
||
|
|
${s.join(`
|
||
|
|
|
||
|
|
`).replace(/\n/g,`
|
||
|
|
`)}`)}},"validateVisitor")};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=t,r}i(UA,"createBaseSemanticVisitorConstructor");o(UA,"createBaseSemanticVisitorConstructor");function zA(e,t,r){let n=o(function(){},"derivedConstructor");Np(n,e+"BaseSemanticsWithDefaults");let a=Object.create(r.prototype);return q(t,s=>{a[s]=jA}),n.prototype=a,n.prototype.constructor=n,n}i(zA,"createBaseVisitorConstructorWithDefaults");o(zA,"createBaseVisitorConstructorWithDefaults");var hf;(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(hf||(hf={}));function BA(e,t){return KA(e,t)}i(BA,"validateVisitor");o(BA,"validateVisitor");function KA(e,t){let r=bt(t,a=>Ar(e[a])===!1),n=G(r,a=>({msg:`Missing visitor method: <${a}> on ${e.constructor.name} CST Visitor.`,type:hf.MISSING_METHOD,methodName:a}));return ks(n)}i(KA,"validateMissingCstMethods");o(KA,"validateMissingCstMethods");var eL=class{static{i(this,"TreeBuilder")}static{o(this,"TreeBuilder")}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=B(e,"nodeLocationTracking")?e.nodeLocationTracking:vr.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Me,this.cstFinallyStateUpdate=Me,this.cstPostTerminal=Me,this.cstPostNonTerminal=Me,this.cstPostRule=Me;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=pf,this.setNodeLocationFromNode=pf,this.cstPostRule=Me,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Me,this.setNodeLocationFromNode=Me,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=df,this.setNodeLocationFromNode=df,this.cstPostRule=Me,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Me,this.setNodeLocationFromNode=Me,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Me,this.setNodeLocationFromNode=Me,this.cstPostRule=Me,this.setInitialNodeLocation=Me;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];FA(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];GA(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(gr(this.baseCstVisitorConstructor)){let e=UA(this.className,pt(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(gr(this.baseCstVisitorWithDefaultsConstructor)){let e=zA(this.className,pt(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e
|
||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
||
|
|
For Further details.`);if(re(e)){if(he(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(re(e))this.tokensMap=mt(e,(a,s)=>(a[s.name]=s,a),{});else if(B(e,"modes")&&Lt(Ot(xe(e.modes)),tA)){let a=Ot(xe(e.modes)),s=dp(a);this.tokensMap=mt(s,(l,u)=>(l[u.name]=u,l),{})}else if(_t(e))this.tokensMap=Ve(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Lr;let r=B(e,"modes")?Ot(xe(e.modes)):xe(e),n=Lt(r,a=>he(a.categoryMatches));this.tokenMatcher=n?ls:Ka,qa(xe(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
||
|
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=B(r,"resyncEnabled")?r.resyncEnabled:rl.resyncEnabled,a=B(r,"recoveryValueFunc")?r.recoveryValueFunc:rl.recoveryValueFunc,s=this.ruleShortNameIdx<<YO+jr;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let l;return this.outputCst===!0?l=o(i(function(...f){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,f);let d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}catch(d){return this.invokeRuleCatch(d,n,a)}finally{this.ruleFinallyStateUpdate()}},"invokeRuleWithTry2"),"invokeRuleWithTry"):l=o(i(function(...f){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),t.apply(this,f)}catch(d){return this.invokeRuleCatch(d,n,a)}finally{this.ruleFinallyStateUpdate()}},"invokeRuleWithTryCst"),"invokeRuleWithTryCst"),Object.assign(l,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,r){let n=this.RULE_STACK.length===1,a=t&&!this.isBackTracking()&&this.recoveryEnabled;if(us(e)){let s=e;if(a){let l=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(l))if(s.resyncedTokens=this.reSyncTo(l),this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return r(e);else{if(this.outputCst){let u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,s.partialCstResult=u}throw s}}else{if(n)return this.moveToTerminatedState(),r(e);throw s}}else throw e}optionInternal(e,t){let r=this.getKeyForAutomaticLookahead(MA,t);return this.optionInternalLogic(e,t,r)}optionInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),a;if(typeof e!="function"){a=e.DEF;let s=e.GATE;if(s!==void 0){let l=n;n=o(()=>s.call(this)&&l.call(this),"lookAheadFunc")}}else a=e;if(n.call(this)===!0)return a.call(this)}atLeastOneInternal(e,t){let r=this.getKeyForAutomaticLookahead(cf,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),a;if(typeof t!="function"){a=t.DEF;let s=t.GATE;if(s!==void 0){let l=n;n=o(()=>s.call(this)&&l.call(this),"lookAheadFunc")}}else a=t;if(n.call(this)===!0){let s=this.doSingleRepetition(a);for(;n.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a)}else throw this.raiseEarlyExitException(e,_e.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],n,cf,e,jO)}atLeastOneSepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(yo,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){let n=t.DEF,a=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let l=o(()=>this.tokenMatcher(this.LA(1),a),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,l,n,Em],l,yo,e,Em)}else throw this.raiseEarlyExitException(e,_e.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let r=this.getKeyForAutomaticLookahead(uf,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),a;if(typeof t!="function"){a=t.DEF;let l=t.GATE;if(l!==void 0){let u=n;n=o(()=>l.call(this)&&u.call(this),"lookaheadFunction")}}else a=t;let s=!0;for(;n.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,uf,e,GO,s)}manySepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(ff,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){let n=t.DEF,a=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let l=o(()=>this.tokenMatcher(this.LA(1),a),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,l,n,Am],l,ff,e,Am)}}repetitionSepSecondInternal(e,t,r,n,a){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,a],r,yo,e,a)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),th
|
||
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(WA);var sL={name:`This CSTNode indicates the Parser is in Recording Phase
|
||
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},oL=class{static{i(this,"GastRecorder")}static{o(this,"GastRecorder")}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(r,n){return this.consumeInternalRecord(r,e,n)},this[`SUBRULE${t}`]=function(r,n){return this.subruleInternalRecord(r,e,n)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return tl}topLevelRuleRecord(e,t){try{let r=new Ua({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
||
|
|
This error was thrown during the "grammar recording phase" For more info see:
|
||
|
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return la.call(this,We,e,t)}atLeastOneInternalRecord(e,t){la.call(this,gt,t,e)}atLeastOneSepFirstInternalRecord(e,t){la.call(this,yt,t,e,_m)}manyInternalRecord(e,t){la.call(this,Se,t,e)}manySepFirstInternalRecord(e,t){la.call(this,ut,t,e,_m)}orInternalRecord(e,t){return VA.call(this,e,t)}subruleInternalRecord(e,t,r){if(cs(t),!e||B(e,"ruleName")===!1){let l=new Error(`<SUBRULE${mf(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
||
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw l.KNOWN_RECORDER_ERROR=!0,l}let n=$n(this.recordingProdStack),a=e.ruleName,s=new et({idx:t,nonTerminalName:a,label:r?.LABEL,referencedRule:void 0});return n.definition.push(s),this.outputCst?sL:Ql}consumeInternalRecord(e,t,r){if(cs(t),!Rp(e)){let s=new Error(`<CONSUME${mf(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
||
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let n=$n(this.recordingProdStack),a=new Te({idx:t,terminalType:e,label:r?.LABEL});return n.definition.push(a),WA}};function la(e,t,r,n=!1){cs(r);let a=$n(this.recordingProdStack),s=Ar(t)?t:t.DEF,l=new e({definition:[],idx:r});return n&&(l.separator=t.SEP),B(t,"MAX_LOOKAHEAD")&&(l.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(l),s.call(this),a.definition.push(l),this.recordingProdStack.pop(),Ql}i(la,"recordProd");o(la,"recordProd");function VA(e,t){cs(t);let r=$n(this.recordingProdStack),n=re(e)===!1,a=n===!1?e:e.DEF,s=new ct({definition:[],idx:t,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});B(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD);let l=o$(a,u=>Ar(u.GATE));return s.hasPredicates=l,r.definition.push(s),q(a,u=>{let c=new lt({definition:[]});s.definition.push(c),B(u,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=u.IGNORE_AMBIGUITIES:B(u,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),u.ALT.call(this),this.recordingProdStack.pop()}),Ql}i(VA,"recordOrProd");o(VA,"recordOrProd");function mf(e){return e===0?"":`${e}`}i(mf,"getIdxSuffix");o(mf,"getIdxSuffix");function cs(e){if(e<0||e>Cm){let t=new Error(`Invalid DSL Method idx value: <${e}>
|
||
|
|
Idx value must be a none negative value smaller than ${Cm+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}i(cs,"assertMethodIdxIsValid");o(cs,"assertMethodIdxIsValid");var lL=class{static{i(this,"PerformanceTracer")}static{o(this,"PerformanceTracer")}initPerformanceTracer(e){if(B(e,"traceInitPerf")){let t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=vr.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);let{time:n,value:a}=hp(t),s=n>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${n}ms`),this.traceInitIndent--,a}else return t()}};function HA(e,t){t.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(a=>{if(a==="constructor")return;let s=Object.getOwnPropertyDescriptor(n,a);s&&(s.get||s.set)?Object.defineProperty(e.prototype,a,s):e.prototype[a]=r.prototype[a]})})}i(HA,"applyMixins");o(HA,"applyMixins");var tl=Os(Lr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(tl);var vr=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:$a,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),rl=Object.freeze({recoveryValueFunc:o(()=>{},"recoveryValueFunc"),resyncEnabled:!0}),tt;(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[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(tt||(tt={}));function gf(e=void 0){return function(){return e}}i(gf,"EMPTY_ALT");o(gf,"EMPTY_ALT");var kp=class YA{static{i(this,"_Parser")}static{o(this,"Parser")}static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{mp(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),q(this.definedRulesNames,a=>{let l=this[a].originalGrammarAction,u;this.TRACE_INIT(`${a} Rule`,()=>{u=this.topLevelRuleRecord(a,l)}),this.gastProductionsCache[a]=u})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=CA({rules:xe(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(he(n)&&this.skipValidations===!1){let a=bA({rules:xe(this.gastProductionsCache),tokenTypes:xe(this.tokensMap),errMsgProvider:mn,grammarName:r}),s=dA({lookaheadStrategy:this.lookaheadStrategy,rules:xe(this.gastProductionsCache),tokenTypes:xe(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(a,s)}}),he(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let a=T$(xe(this.gastProductionsCache));this.resyncFollows=a}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var a,s;(s=(a=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(a,{rules:xe(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(xe(this.gastProductionsCache))})),!YA.DEFER_DEFINITION_ERRORS_HANDLING&&!he(this.definitionErrors))throw t=G(this.definitionErrors,a=>a.message),new Error(`Parser Definition Errors detected:
|
||
|
|
${t.join(`
|
||
|
|
-------------------------------
|
||
|
|
`)}`)})}constructor(t,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(t,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),B(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
||
|
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
||
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
||
|
|
For further details.`);this.skipValidations=B(r,"skipValidations")?r.skipValidations:vr.skipValidations}};kp.DEFER_DEFINITION_ERRORS_HANDLING=!1;HA(kp,[HO,JO,eL,tL,nL,rL,aL,iL,oL,lL]);var uL=class extends kp{static{i(this,"EmbeddedActionsParser")}static{o(this,"EmbeddedActionsParser")}constructor(e,t=vr){let r=Ve(t);r.outputCst=!1,super(e,r)}};function XA(e,t){for(var r=-1,n=e==null?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}i(XA,"arrayMap2");o(XA,"arrayMap");var JA=XA;function ZA(){this.__data__=[],this.size=0}i(ZA,"listCacheClear2");o(ZA,"listCacheClear");var cL=ZA;function QA(e,t){return e===t||e!==e&&t!==t}i(QA,"eq2");o(QA,"eq");var eE=QA;function tE(e,t){for(var r=e.length;r--;)if(eE(e[r][0],t))return r;return-1}i(tE,"assocIndexOf2");o(tE,"assocIndexOf");var eu=tE,fL=Array.prototype,dL=fL.splice;function rE(e){var t=this.__data__,r=eu(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():dL.call(t,r,1),--this.size,!0}i(rE,"listCacheDelete2");o(rE,"listCacheDelete");var pL=rE;function nE(e){var t=this.__data__,r=eu(t,e);return r<0?void 0:t[r][1]}i(nE,"listCacheGet2");o(nE,"listCacheGet");var hL=nE;function aE(e){return eu(this.__data__,e)>-1}i(aE,"listCacheHas2");o(aE,"listCacheHas");var mL=aE;function iE(e,t){var r=this.__data__,n=eu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}i(iE,"listCacheSet2");o(iE,"listCacheSet");var gL=iE;function Fn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}i(Fn,"ListCache2");o(Fn,"ListCache");Fn.prototype.clear=cL;Fn.prototype.delete=pL;Fn.prototype.get=hL;Fn.prototype.has=mL;Fn.prototype.set=gL;var tu=Fn;function sE(){this.__data__=new tu,this.size=0}i(sE,"stackClear2");o(sE,"stackClear");var yL=sE;function oE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}i(oE,"stackDelete2");o(oE,"stackDelete");var vL=oE;function lE(e){return this.__data__.get(e)}i(lE,"stackGet2");o(lE,"stackGet");var TL=lE;function uE(e){return this.__data__.has(e)}i(uE,"stackHas2");o(uE,"stackHas");var RL=uE,$L=typeof global=="object"&&global&&global.Object===Object&&global,cE=$L,AL=typeof self=="object"&&self&&self.Object===Object&&self,EL=cE||AL||Function("return this")(),Er=EL,_L=Er.Symbol,Xt=_L,fE=Object.prototype,CL=fE.hasOwnProperty,bL=fE.toString,yi=Xt?Xt.toStringTag:void 0;function dE(e){var t=CL.call(e,yi),r=e[yi];try{e[yi]=void 0;var n=!0}catch{}var a=bL.call(e);return n&&(t?e[yi]=r:delete e[yi]),a}i(dE,"getRawTag2");o(dE,"getRawTag");var SL=dE,wL=Object.prototype,IL=wL.toString;function pE(e){return IL.call(e)}i(pE,"objectToString2");o(pE,"objectToString");var NL=pE,kL="[object Null]",PL="[object Undefined]",bm=Xt?Xt.toStringTag:void 0;function hE(e){return e==null?e===void 0?PL:kL:bm&&bm in Object(e)?SL(e):NL(e)}i(hE,"baseGetTag2");o(hE,"baseGetTag");var Wa=hE;function mE(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}i(mE,"isObject2");o(mE,"isObject");var Pp=mE,OL="[object AsyncFunction]",LL="[object Function]",DL="[object GeneratorFunction]",ML="[object Proxy]";function gE(e){if(!Pp(e))return!1;var t=Wa(e);return t==LL||t==DL||t==OL||t==ML}i(gE,"isFunction2");o(gE,"isFunction");var yE=gE,xL=Er["__core-js_shared__"],Nu=xL,Sm=(function(){var e=/[^.]+$/.exec(Nu&&Nu.keys&&Nu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function vE(e){return!!Sm&&Sm in e}i(vE,"isMasked2");o(vE,"isMasked");var FL=vE,GL=Function.prototype,jL=GL.toString;function TE(e){if(e!=null){try{return jL.call(e)}catch{}try{return e+""}catch{}}return""}i(TE,"toSource2");o(TE,"toSource");var Gn=TE,UL=/[\\^$.*+?()[\]{}|]/g,zL=/^\[object .+?Constructor\]$/,BL=Function.prototype,KL=Object.prototype,qL=BL.toString,WL=KL.hasOwnProperty,VL=RegExp("^"+qL.call(WL).replace(UL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function RE(e){if(!Pp(e)||FL(e))return!1;var t=yE(e)?VL:zL;return t.test(Gn(e))}i(RE,"baseIsNative2");o(RE,"baseIsNative");var HL=RE;function $E(e,t){return e?.[t]}i($E,"getValue2");o($E,"getValue");var YL=$E;function AE(e,t){var r=YL(e,t);return HL(r)?r:void 0}i(AE,"getNat
|
||
|
|
<${t}> may appears as a prefix path in all these alternatives.
|
||
|
|
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
||
|
|
For Further details.`,n}i(YC,"buildAmbiguityError");o(YC,"buildAmbiguityError");function XC(e){if(e instanceof et)return"SUBRULE";if(e instanceof We)return"OPTION";if(e instanceof ct)return"OR";if(e instanceof gt)return"AT_LEAST_ONE";if(e instanceof yt)return"AT_LEAST_ONE_SEP";if(e instanceof ut)return"MANY_SEP";if(e instanceof Se)return"MANY";if(e instanceof Te)return"CONSUME";throw Error("non exhaustive match")}i(XC,"getProductionDslName2");o(XC,"getProductionDslName");function JC(e,t,r){let n=Qx(t.configs.elements,s=>s.state.transitions),a=d1(n.filter(s=>s instanceof zp).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:a,tokenPath:e}}i(JC,"buildAdaptivePredictError");o(JC,"buildAdaptivePredictError");function ZC(e,t){return e.edges[t.tokenTypeIdx]}i(ZC,"getExistingTargetState");o(ZC,"getExistingTargetState");function QC(e,t,r){let n=new $f,a=[];for(let l of e.elements){if(r.is(l.alt)===!1)continue;if(l.state.type===Ms){a.push(l);continue}let u=l.state.transitions.length;for(let c=0;c<u;c++){let f=l.state.transitions[c],d=eb(f,t);d!==void 0&&n.add({state:d,alt:l.alt,stack:l.stack})}}let s;if(a.length===0&&n.size===1&&(s=n),s===void 0){s=new $f;for(let l of n.elements)hs(l,s)}if(a.length>0&&!ab(s))for(let l of a)s.add(l);return s}i(QC,"computeReachSet");o(QC,"computeReachSet");function eb(e,t){if(e instanceof zp&&Ap(t,e.tokenType))return e.target}i(eb,"getReachableTarget");o(eb,"getReachableTarget");function tb(e,t){let r;for(let n of e.elements)if(t.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}i(tb,"getUniqueAlt");o(tb,"getUniqueAlt");function Yp(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}i(Yp,"newDFAState");o(Yp,"newDFAState");function Ef(e,t,r,n){return n=Xp(e,n),t.edges[r.tokenTypeIdx]=n,n}i(Ef,"addDFAEdge");o(Ef,"addDFAEdge");function Xp(e,t){if(t===al)return t;let r=t.configs.key,n=e.states[r];return n!==void 0?n:(t.configs.finalize(),e.states[r]=t,t)}i(Xp,"addDFAState");o(Xp,"addDFAState");function rb(e){let t=new $f,r=e.transitions.length;for(let n=0;n<r;n++){let s={state:e.transitions[n].target,alt:n,stack:[]};hs(s,t)}return t}i(rb,"computeStartState");o(rb,"computeStartState");function hs(e,t){let r=e.state;if(r.type===Ms){if(e.stack.length>0){let a=[...e.stack],l={state:a.pop(),alt:e.alt,stack:a};hs(l,t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);let n=r.transitions.length;for(let a=0;a<n;a++){let s=r.transitions[a],l=nb(e,s);l!==void 0&&hs(l,t)}}i(hs,"closure");o(hs,"closure");function nb(e,t){if(t instanceof iC)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof Bp){let r=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:r}}}i(nb,"getEpsilonTarget");o(nb,"getEpsilonTarget");function ab(e){for(let t of e.elements)if(t.state.type===Ms)return!0;return!1}i(ab,"hasConfigInRuleStopState");o(ab,"hasConfigInRuleStopState");function ib(e){for(let t of e.elements)if(t.state.type!==Ms)return!1;return!0}i(ib,"allConfigsInRuleStopStates");o(ib,"allConfigsInRuleStopStates");function sb(e){if(ib(e))return!0;let t=ob(e.elements);return lb(t)&&!ub(t)}i(sb,"hasConflictTerminatingPrediction");o(sb,"hasConflictTerminatingPrediction");function ob(e){let t=new Map;for(let r of e){let n=Vp(r,!1),a=t.get(n);a===void 0&&(a={},t.set(n,a)),a[r.alt]=!0}return t}i(ob,"getConflictingAltSets");o(ob,"getConflictingAltSets");function lb(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}i(lb,"hasConflictingAltSet");o(lb,"hasConflictingAltSet");function ub(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}i(ub,"hasStateAssociatedWithOneAlt");o(ub,"hasStateAssociatedWithOneAlt");ys();var cb=class{static{i(this,"CstNodeBuilder")}static{o(this,"CstNodeBuilder")}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new Zp(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new pu;return t.grammarSource=e,t.root=this.r
|
||
|
|
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return f}}i(r,"convertEscapeCharacter"),o(r,"convertEscapeCharacter");function n(f){return f.charAt(0)==="^"?f.substring(1):f}i(n,"convertID"),o(n,"convertID"),e.convertID=n;function a(f){return parseInt(f)}i(a,"convertInt"),o(a,"convertInt"),e.convertInt=a;function s(f){return BigInt(f)}i(s,"convertBigint"),o(s,"convertBigint"),e.convertBigint=s;function l(f){return new Date(f)}i(l,"convertDate"),o(l,"convertDate"),e.convertDate=l;function u(f){return Number(f)}i(u,"convertNumber"),o(u,"convertNumber"),e.convertNumber=u;function c(f){return f.toLowerCase()==="true"}i(c,"convertBoolean"),o(c,"convertBoolean"),e.convertBoolean=c})(Kt||(Kt={}));var pe={};ml(pe,Kf(yl(),1));function yu(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}i(yu,"delayNextTick");o(yu,"delayNextTick");var Ao=0,Sb=10;function vu(){return Ao=performance.now(),new pe.CancellationTokenSource}i(vu,"startCancelableOperation");o(vu,"startCancelableOperation");function oh(e){Sb=e}i(oh,"setInterruptionPeriod");o(oh,"setInterruptionPeriod");var Vt=Symbol("OperationCancelled");function Kn(e){return e===Vt}i(Kn,"isOperationCancelled");o(Kn,"isOperationCancelled");async function je(e){if(e===pe.CancellationToken.None)return;let t=performance.now();if(t-Ao>=Sb&&(Ao=t,await yu(),Ao=performance.now()),e.isCancellationRequested)throw Vt}i(je,"interruptAndCheck");o(je,"interruptAndCheck");var Tr=class{static{i(this,"Deferred")}static{o(this,"Deferred")}constructor(){this.promise=new Promise((e,t)=>{this.resolve=r=>(e(r),this),this.reject=r=>(t(r),this)})}},Zm=class _f{static{i(this,"_FullTextDocument")}static{o(this,"FullTextDocument")}constructor(t,r,n,a){this._uri=t,this._languageId=r,this._version=n,this._content=a,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){for(let n of t)if(_f.isIncremental(n)){let a=uh(n.range),s=this.offsetAt(a.start),l=this.offsetAt(a.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(l,this._content.length);let u=Math.max(a.start.line,0),c=Math.max(a.end.line,0),f=this._lineOffsets,d=Cf(n.text,!1,s);if(c-u===d.length)for(let m=0,v=d.length;m<v;m++)f[m+u+1]=d[m];else d.length<1e4?f.splice(u+1,c-u,...d):this._lineOffsets=f=f.slice(0,u+1).concat(d,f.slice(c+1));let p=n.text.length-(l-s);if(p!==0)for(let m=u+1+d.length,v=f.length;m<v;m++)f[m]=f[m]+p}else if(_f.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Cf(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,a=r.length;if(a===0)return{line:0,character:t};for(;n<a;){let l=Math.floor((n+a)/2);r[l]>t?a=l:n=l+1}let s=n-1;return t=this.ensureBeforeEOL(t,r[s]),{line:s,character:t-r[s]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line];if(t.character<=0)return n;let a=t.line+1<r.length?r[t.line+1]:this._content.length,s=Math.min(n+t.character,a);return this.ensureBeforeEOL(s,n)}ensureBeforeEOL(t,r){for(;t>r&&lh(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},ll;(function(e){function t(a,s,l,u){return new Zm(a,s,l,u)}i(t,"create"),o(t,"create"),e.create=t;function r(a,s,l){if(a instanceof Zm)return a.update(s,l),a;throw new Error("TextDocument.update: document must be created by TextDocument.create")}i(r,"update"),o(r,"update"),e.update=r;fu
|
||
|
|
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let a=iS(this.name,t,e??{});if(typeof a=="string")return a}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let n=`${r}@${this.name}${r}`;return this.content.inlines.length===1?n=`${n} \u2014 ${t}`:this.content.inlines.length>1&&(n=`${n}
|
||
|
|
${t}`),this.inline?`{${n}}`:n}};function iS(e,t,r){if(e==="linkplain"||e==="linkcode"||e==="link"){let n=t.indexOf(" "),a=t;if(n>0){let l=pl(t,n);a=t.substring(l),t=t.substring(0,n)}return(e==="linkcode"||e==="link"&&r.link==="code")&&(a=`\`${a}\``),r.renderLink?.(t,a)??sS(t,a)}}i(iS,"renderInlineTag");o(iS,"renderInlineTag");function sS(e,t){try{return dt.parse(e,!0),`[${t}](${e})`}catch{return e}}i(sS,"renderLinkDefault");o(sS,"renderLinkDefault");var wf=class{static{i(this,"JSDocTextImpl")}static{o(this,"JSDocTextImpl")}constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;t<this.inlines.length;t++){let r=this.inlines[t],n=this.inlines[t+1];e+=r.toString(),n&&n.range.start.line>r.range.start.line&&(e+=`
|
||
|
|
`)}return e}toMarkdown(e){let t="";for(let r=0;r<this.inlines.length;r++){let n=this.inlines[r],a=this.inlines[r+1];t+=n.toMarkdown(e),a&&a.range.start.line>n.range.start.line&&(t+=`
|
||
|
|
`)}return t}},oS=class{static{i(this,"JSDocLineImpl")}static{o(this,"JSDocLineImpl")}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function If(e){return e.endsWith(`
|
||
|
|
`)?`
|
||
|
|
`:`
|
||
|
|
|
||
|
|
`}i(If,"fillNewlines");o(If,"fillNewlines");var lS=class{static{i(this,"JSDocDocumentationProvider")}static{o(this,"JSDocDocumentationProvider")}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Rh(t))return Th(t).toMarkdown({renderLink:o((n,a)=>this.documentationLinkRenderer(e,n,a),"renderLink"),renderTag:o(n=>this.documentationTagRenderer(e,n),"renderTag")})}documentationLinkRenderer(e,t,r){let n=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(n&&n.nameSegment){let a=n.nameSegment.range.start.line+1,s=n.nameSegment.range.start.character+1,l=n.documentUri.with({fragment:`L${a},${s}`});return`[${r}](${l.toString()})`}else return}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){let n=kt(e).localSymbols;if(!n)return;let a=e;do{let l=n.getStream(a).find(u=>u.name===t);if(l)return l;a=a.$container}while(a)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(n=>n.name===t)}},uS=class{static{i(this,"DefaultCommentProvider")}static{o(this,"DefaultCommentProvider")}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return hh(e)?e.$comment:Ad(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},cS=class{static{i(this,"DefaultAsyncParser")}static{o(this,"DefaultAsyncParser")}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},P1=class{static{i(this,"AbstractThreadedAsyncParser")}static{o(this,"AbstractThreadedAsyncParser")}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length<this.threadCount;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let r=await this.acquireParserWorker(t),n=new Tr,a,s=t.onCancellationRequested(()=>{a=setTimeout(()=>{this.terminateWorker(r)},this.terminationDelay)});return r.parse(e).then(l=>{let u=this.hydrator.hydrate(l);n.resolve(u)}).catch(l=>{n.reject(l)}).finally(()=>{s.dispose(),clearTimeout(a)}),n.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let r of this.workerPool)if(r.ready)return r.lock(),r;let t=new Tr;return e.onCancellationRequested(()=>{let r=this.queue.indexOf(t);r>=0&&this.queue.splice(r,1),t.reject(Vt)}),this.queue.push(t),t.promise}},O1=class{static{i(this,"ParserWorker")}static{o(this,"ParserWorker")}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,r,n){this.onReadyEmitter=new $u.Emitter,this.deferred=new Tr,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=n,t(a=>{let s=a;this.deferred.resolve(s),this.unlock()}),r(a=>{this.deferred.reject(a),this.unlock()})}terminate(){this.deferred.reject(Vt),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new Tr,this.sendMessage(e),this.deferred.promise}},fS=class{static{i(this,"DefaultWorkspaceLock")}static{o(this,"DefaultWorkspaceLock")}constructor(){this.previousTokenSource=new pe.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=vu();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=pe.CancellationToken.None){let n=new Tr,a={action:t,deferred:n,cancellationToken:r};return e.push(a),this.performNextOperation(),n.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await
|
||
|
|
`.includes(e[t-1])}matchWhitespace(e,t,r,n){this.whitespaceRegExp.lastIndex=t;let a=this.whitespaceRegExp.exec(e);return{currIndentLevel:a?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:a}}createIndentationTokenInstance(e,t,r,n){let a=this.getLineNumber(t,n);return Os(e,r,n,n+r.length,a,a,1,r.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:a,prevIndentLevel:s,match:l}=this.matchWhitespace(e,t,r,n);return a<=s?null:(this.indentationStack.push(a),l)}dedentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:a,prevIndentLevel:s,match:l}=this.matchWhitespace(e,t,r,n);if(a>=s)return null;let u=this.indentationStack.lastIndexOf(a);if(u===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${a} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:l?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let c=this.indentationStack.length-u-1,f=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let d=0;d<c;d++){let p=this.createIndentationTokenInstance(this.dedentTokenType,e,"",t-(f-1));r.push(p),this.indentationStack.pop()}return null}buildTerminalToken(e){let t=super.buildTerminalToken(e),{indentTokenName:r,dedentTokenName:n,whitespaceTokenName:a}=this.options;return t.name===r?this.indentTokenType:t.name===n?this.dedentTokenType:t.name===a?_a({name:a,pattern:this.whitespaceRegExp,group:Ze.SKIPPED}):t}flushRemainingDedents(e){let t=[];for(;this.indentationStack.length>1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},L1=class extends vh{static{i(this,"IndentationAwareLexer")}static{o(this,"IndentationAwareLexer")}constructor(e){if(super(e),e.parser.TokenBuilder instanceof hS)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,t=yh){let r=super.tokenize(e),n=r.report;t?.mode==="full"&&r.tokens.push(...n.remainingDedents),n.remainingDedents=[];let{indentTokenType:a,dedentTokenType:s}=this.indentationTokenBuilder,l=a.tokenTypeIdx,u=s.tokenTypeIdx,c=[],f=r.tokens.length-1;for(let d=0;d<f;d++){let p=r.tokens[d],m=r.tokens[d+1];if(p.tokenTypeIdx===l&&m.tokenTypeIdx===u){d++;continue}c.push(p)}return f>=0&&c.push(r.tokens[f]),r.tokens=c,r}},Ih={};xr(Ih,{AstUtils:i(()=>Xf,"AstUtils"),BiMap:i(()=>cl,"BiMap"),Cancellation:i(()=>pe,"Cancellation"),ContextCache:i(()=>Ru,"ContextCache"),CstUtils:i(()=>Vf,"CstUtils"),DONE_RESULT:i(()=>Ye,"DONE_RESULT"),Deferred:i(()=>Tr,"Deferred"),Disposable:i(()=>Tn,"Disposable"),DisposableCache:i(()=>Tu,"DisposableCache"),DocumentCache:i(()=>xb,"DocumentCache"),EMPTY_STREAM:i(()=>ba,"EMPTY_STREAM"),ErrorWithLocation:i(()=>bl,"ErrorWithLocation"),GrammarUtils:i(()=>bd,"GrammarUtils"),MultiMap:i(()=>Rr,"MultiMap"),OperationCancelled:i(()=>Vt,"OperationCancelled"),Reduction:i(()=>es,"Reduction"),RegExpUtils:i(()=>wd,"RegExpUtils"),SimpleCache:i(()=>dh,"SimpleCache"),StreamImpl:i(()=>Wt,"StreamImpl"),TreeStreamImpl:i(()=>Sa,"TreeStreamImpl"),URI:i(()=>dt,"URI"),UriTrie:i(()=>ch,"UriTrie"),UriUtils:i(()=>Je,"UriUtils"),WorkspaceCache:i(()=>ph,"WorkspaceCache"),assertCondition:i(()=>Sd,"assertCondition"),assertUnreachable:i(()=>Fr,"assertUnreachable"),delayNextTick:i(()=>yu,"delayNextTick"),interruptAndCheck:i(()=>je,"interruptAndCheck"),isOperationCancelled:i(()=>Kn,"isOperationCancelled"),loadGrammarFromJson:i(()=>vt,"loadGrammarFromJson"),setInterruptionPeriod:i(()=>oh,"setInterruptionPeriod"),startCancelableOperation:i(()=>vu,"startCancelableOperation"),stream:i(()=>oe,"stream")});ml(Ih,$u);var mS=class{static{i(this,"EmptyFileSystemProvider")}static{o(this,"EmptyFileSystemProvider")}stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file
|
||
|
|
`)}}},xF=class extends AF{static{i(this,"CommonValueConverter")}static{o(this,"CommonValueConverter")}runCustomConverter(e,t,r){}},EF=class extends gu{static{i(this,"AbstractMermaidTokenBuilder")}static{o(this,"AbstractMermaidTokenBuilder")}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){let n=super.buildKeywordTokens(e,t,r);return n.forEach(a=>{this.keywords.has(a.name)&&a.PATTERN!==void 0&&(a.PATTERN=new RegExp(a.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},FF=class extends EF{static{i(this,"CommonTokenBuilder")}static{o(this,"CommonTokenBuilder")}};export{o as a,Ch as b,bh as c,hl as d,gS as e,z1 as f,bF as g,SF as h,wF as i,IF as j,NF as k,kF as l,PF as m,OF as n,LF as o,DF as p,MF as q,AF as r,xF as s,EF as t};
|
||
|
|
/*! Bundled license information:
|
||
|
|
|
||
|
|
lodash-es/lodash.js:
|
||
|
|
(**
|
||
|
|
* @license
|
||
|
|
* Lodash (Custom Build) <https://lodash.com/>
|
||
|
|
* Build: `lodash modularize exports="es" -o ./`
|
||
|
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||
|
|
* Released under MIT license <https://lodash.com/license>
|
||
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
|
|
*)
|
||
|
|
*/
|