diff --git a/intellij-plugin/src/main/kotlin/org/zowe/pli/init/PliPluginState.kt b/intellij-plugin/src/main/kotlin/org/zowe/pli/init/PliPluginState.kt index f02e0f1..23ec70e 100644 --- a/intellij-plugin/src/main/kotlin/org/zowe/pli/init/PliPluginState.kt +++ b/intellij-plugin/src/main/kotlin/org/zowe/pli/init/PliPluginState.kt @@ -33,7 +33,10 @@ private const val VSIX_NAME = "pli-language-support" private const val VSIX_VERSION = "0.0.1" private const val TEXTMATE_BUNDLE_NAME = "pli" -// TODO: doc +/** + * State of the PL/I plug-in. Provides initialization methods to set up all the things before the correct usage of + * the syntax highlighting and the LSP features + */ class PliPluginState private constructor() : Disposable { companion object { diff --git a/intellij-plugin/src/main/resources/language/generated/ast.js b/intellij-plugin/src/main/resources/language/generated/ast.js deleted file mode 100644 index 289c88a..0000000 --- a/intellij-plugin/src/main/resources/language/generated/ast.js +++ /dev/null @@ -1,125 +0,0 @@ -/****************************************************************************** - * This file was generated by langium-cli 3.0.3. - * DO NOT EDIT MANUALLY! - ******************************************************************************/ -import { AbstractAstReflection } from 'langium'; -export const PlOneTerminals = { - WS: /\s+/, - ID: /[_a-zA-Z][\w_]*/, - INT: /[0-9]+/, - ML_COMMENT: /\/\*[\s\S]*?\*\//, - SL_COMMENT: /\/\/[^\n\r]*/, -}; -export const EndProgram = 'EndProgram'; -export function isEndProgram(item) { - return reflection.isInstance(item, EndProgram); -} -export const Greeting = 'Greeting'; -export function isGreeting(item) { - return reflection.isInstance(item, Greeting); -} -export const Loop = 'Loop'; -export function isLoop(item) { - return reflection.isInstance(item, Loop); -} -export const Model = 'Model'; -export function isModel(item) { - return reflection.isInstance(item, Model); -} -export const Person = 'Person'; -export function isPerson(item) { - return reflection.isInstance(item, Person); -} -export const Progname = 'Progname'; -export function isProgname(item) { - return reflection.isInstance(item, Progname); -} -export class PlOneAstReflection extends AbstractAstReflection { - getAllTypes() { - return ['EndProgram', 'Greeting', 'Loop', 'Model', 'Person', 'Progname']; - } - computeIsSubtype(subtype, supertype) { - switch (subtype) { - default: { - return false; - } - } - } - getReferenceType(refInfo) { - const referenceId = `${refInfo.container.$type}:${refInfo.property}`; - switch (referenceId) { - case 'Greeting:person': { - return Person; - } - default: { - throw new Error(`${referenceId} is not a valid reference id.`); - } - } - } - getTypeMetaData(type) { - switch (type) { - case 'EndProgram': { - return { - name: 'EndProgram', - properties: [ - { name: 'name' } - ] - }; - } - case 'Greeting': { - return { - name: 'Greeting', - properties: [ - { name: 'person' } - ] - }; - } - case 'Loop': { - return { - name: 'Loop', - properties: [ - { name: 'name' }, - { name: 'num' } - ] - }; - } - case 'Model': { - return { - name: 'Model', - properties: [ - { name: 'endProgram' }, - { name: 'greetings', defaultValue: [] }, - { name: 'loop', defaultValue: [] }, - { name: 'persons', defaultValue: [] }, - { name: 'progname', defaultValue: [] } - ] - }; - } - case 'Person': { - return { - name: 'Person', - properties: [ - { name: 'name' } - ] - }; - } - case 'Progname': { - return { - name: 'Progname', - properties: [ - { name: 'name' }, - { name: 'num' } - ] - }; - } - default: { - return { - name: type, - properties: [] - }; - } - } - } -} -export const reflection = new PlOneAstReflection(); -//# sourceMappingURL=ast.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/generated/ast.js.map b/intellij-plugin/src/main/resources/language/generated/ast.js.map deleted file mode 100644 index e277742..0000000 --- a/intellij-plugin/src/main/resources/language/generated/ast.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/language/generated/ast.ts"],"names":[],"mappings":"AAAA;;;gFAGgF;AAIhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,iBAAiB;IACrB,GAAG,EAAE,QAAQ;IACb,UAAU,EAAE,kBAAkB;IAC9B,UAAU,EAAE,cAAc;CAC7B,CAAC;AAQF,MAAM,CAAC,MAAM,UAAU,GAA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E;qBACzC;iBACJ,CAAC;aACL;YACD,KAAK,QAAQ,CAAC,CAAC;gBACX,OAAO;oBACH,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACR,EAAE,IAAI,EAAE,MAAM,EAAE;qBACnB;iBACJ,CAAC;aACL;YACD,KAAK,UAAU,CAAC,CAAC;gBACb,OAAO;oBACH,IAAI,EAAE,UAAU;oBAChB,UAAU,EAAE;wBACR,EAAE,IAAI,EAAE,MAAM,EAAE;wBAChB,EAAE,IAAI,EAAE,KAAK,EAAE;qBAClB;iBACJ,CAAC;aACL;YACD,OAAO,CAAC,CAAC;gBACL,OAAO;oBACH,IAAI,EAAE,IAAI;oBACV,UAAU,EAAE,EAAE;iBACjB,CAAC;aACL;SACJ;IACL,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,kBAAkB,EAAE,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/generated/grammar.js b/intellij-plugin/src/main/resources/language/generated/grammar.js deleted file mode 100644 index ec99ee4..0000000 --- a/intellij-plugin/src/main/resources/language/generated/grammar.js +++ /dev/null @@ -1,484 +0,0 @@ -/****************************************************************************** - * This file was generated by langium-cli 3.0.3. - * DO NOT EDIT MANUALLY! - ******************************************************************************/ -import { loadGrammarFromJson } from 'langium'; -let loadedPlOneGrammar; -export const PlOneGrammar = () => loadedPlOneGrammar !== null && loadedPlOneGrammar !== void 0 ? loadedPlOneGrammar : (loadedPlOneGrammar = loadGrammarFromJson(`{ - "$type": "Grammar", - "isDeclared": true, - "name": "PlOne", - "imports": [], - "rules": [ - { - "$type": "ParserRule", - "name": "Model", - "entry": true, - "definition": { - "$type": "Alternatives", - "elements": [ - { - "$type": "Group", - "elements": [ - { - "$type": "Assignment", - "feature": "progname", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@1" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "loop", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@2" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "endProgram", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@3" - }, - "arguments": [] - } - } - ], - "cardinality": "*" - }, - { - "$type": "Alternatives", - "elements": [ - { - "$type": "Assignment", - "feature": "persons", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@4" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "greetings", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@5" - }, - "arguments": [] - } - } - ], - "cardinality": "*" - } - ] - }, - "definesHiddenTokens": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Progname", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ":" - }, - { - "$type": "Keyword", - "value": "PROCEDURE" - }, - { - "$type": "Keyword", - "value": "OPTIONS" - }, - { - "$type": "Keyword", - "value": "(MAIN)" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "/*" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": "*/" - } - ], - "cardinality": "*" - }, - { - "$type": "Keyword", - "value": "FLAG" - }, - { - "$type": "Keyword", - "value": "=" - }, - { - "$type": "Assignment", - "feature": "num", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@8" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ";" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Loop", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "LOOP" - }, - { - "$type": "Keyword", - "value": ":" - }, - { - "$type": "Keyword", - "value": "DO" - }, - { - "$type": "Keyword", - "value": "WHILE" - }, - { - "$type": "Keyword", - "value": "(" - }, - { - "$type": "Keyword", - "value": "FLAG" - }, - { - "$type": "Keyword", - "value": "=" - }, - { - "$type": "Assignment", - "feature": "num", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@8" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ")" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Keyword", - "value": "PUT" - }, - { - "$type": "Keyword", - "value": "SKIP" - }, - { - "$type": "Keyword", - "value": "DATA" - }, - { - "$type": "Keyword", - "value": "(" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ")" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Keyword", - "value": "END" - }, - { - "$type": "Keyword", - "value": "LOOP;" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "EndProgram", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "END" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ";" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Person", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "person" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false, - "$comment": "/*just simple program*/" - }, - { - "$type": "ParserRule", - "name": "Greeting", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "Hello" - }, - { - "$type": "Assignment", - "feature": "person", - "operator": "=", - "terminal": { - "$type": "CrossReference", - "type": { - "$ref": "#/rules@4" - }, - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - }, - "deprecatedSyntax": false - } - }, - { - "$type": "Keyword", - "value": "!" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "WS", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\s+/" - }, - "fragment": false - }, - { - "$type": "TerminalRule", - "name": "ID", - "definition": { - "$type": "RegexToken", - "regex": "/[_a-zA-Z][\\\\w_]*/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "name": "INT", - "type": { - "$type": "ReturnType", - "name": "number" - }, - "definition": { - "$type": "RegexToken", - "regex": "/[0-9]+/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "name": "STRING", - "definition": { - "$type": "RegexToken", - "regex": "/\\"(\\\\\\\\.|[^\\"\\\\\\\\])*\\"|'(\\\\\\\\.|[^'\\\\\\\\])*'/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "ML_COMMENT", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//" - }, - "fragment": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "SL_COMMENT", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\/\\\\/[^\\\\n\\\\r]*/" - }, - "fragment": false - } - ], - "definesHiddenTokens": false, - "hiddenTokens": [], - "interfaces": [], - "types": [], - "usedGrammars": [] -}`)); -//# sourceMappingURL=grammar.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/generated/grammar.js.map b/intellij-plugin/src/main/resources/language/generated/grammar.js.map deleted file mode 100644 index 257dd2d..0000000 --- a/intellij-plugin/src/main/resources/language/generated/grammar.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"grammar.js","sourceRoot":"","sources":["../../../src/language/generated/grammar.ts"],"names":[],"mappings":"AAAA;;;gFAGgF;AAGhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,IAAI,kBAAuC,CAAC;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,GAAY,EAAE,CAAC,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4dzG,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/generated/module.js b/intellij-plugin/src/main/resources/language/generated/module.js deleted file mode 100644 index ba037e9..0000000 --- a/intellij-plugin/src/main/resources/language/generated/module.js +++ /dev/null @@ -1,20 +0,0 @@ -/****************************************************************************** - * This file was generated by langium-cli 3.0.3. - * DO NOT EDIT MANUALLY! - ******************************************************************************/ -import { PlOneAstReflection } from './ast.js'; -import { PlOneGrammar } from './grammar.js'; -export const PlOneLanguageMetaData = { - languageId: 'pl-one', - fileExtensions: ['.pl1', '.PLI'], - caseInsensitive: false -}; -export const PlOneGeneratedSharedModule = { - AstReflection: () => new PlOneAstReflection() -}; -export const PlOneGeneratedModule = { - Grammar: () => PlOneGrammar(), - LanguageMetaData: () => PlOneLanguageMetaData, - parser: {} -}; -//# sourceMappingURL=module.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/generated/module.js.map b/intellij-plugin/src/main/resources/language/generated/module.js.map deleted file mode 100644 index d5faa58..0000000 --- a/intellij-plugin/src/main/resources/language/generated/module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/language/generated/module.ts"],"names":[],"mappings":"AAAA;;;gFAGgF;AAGhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAChC,eAAe,EAAE,KAAK;CACW,CAAC;AAEtC,MAAM,CAAC,MAAM,0BAA0B,GAA0E;IAC7G,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,kBAAkB,EAAE;CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAA8D;IAC3F,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE;IAC7B,gBAAgB,EAAE,GAAG,EAAE,CAAC,qBAAqB;IAC7C,MAAM,EAAE,EAAE;CACb,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/main-browser.js b/intellij-plugin/src/main/resources/language/main-browser.js deleted file mode 100644 index 31a8640..0000000 --- a/intellij-plugin/src/main/resources/language/main-browser.js +++ /dev/null @@ -1,10 +0,0 @@ -import { EmptyFileSystem } from 'langium'; -import { startLanguageServer } from 'langium/lsp'; -import { BrowserMessageReader, BrowserMessageWriter, createConnection } from 'vscode-languageserver/browser.js'; -import { createPlOneServices } from './pl-one-module.js'; -const messageReader = new BrowserMessageReader(self); -const messageWriter = new BrowserMessageWriter(self); -const connection = createConnection(messageReader, messageWriter); -const { shared } = createPlOneServices(Object.assign({ connection }, EmptyFileSystem)); -startLanguageServer(shared); -//# sourceMappingURL=main-browser.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/main-browser.js.map b/intellij-plugin/src/main/resources/language/main-browser.js.map deleted file mode 100644 index 10d4fe1..0000000 --- a/intellij-plugin/src/main/resources/language/main-browser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main-browser.js","sourceRoot":"","sources":["../../src/language/main-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAErD,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAElE,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,iBAAG,UAAU,IAAK,eAAe,EAAG,CAAC;AAE3E,mBAAmB,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/main.cjs b/intellij-plugin/src/main/resources/language/main.cjs deleted file mode 100644 index 7b7d3cd..0000000 --- a/intellij-plugin/src/main/resources/language/main.cjs +++ /dev/null @@ -1,30530 +0,0 @@ -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a2, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a2, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a2, prop, b[prop]); - } - return a2; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; - -// node_modules/vscode-languageserver/lib/common/utils/is.js -var require_is = __commonJS({ - "node_modules/vscode-languageserver/lib/common/utils/is.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.thenable = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; - function boolean(value) { - return value === true || value === false; - } - exports2.boolean = boolean; - function string(value) { - return typeof value === "string" || value instanceof String; - } - exports2.string = string; - function number(value) { - return typeof value === "number" || value instanceof Number; - } - exports2.number = number; - function error(value) { - return value instanceof Error; - } - exports2.error = error; - function func(value) { - return typeof value === "function"; - } - exports2.func = func; - function array(value) { - return Array.isArray(value); - } - exports2.array = array; - function stringArray(value) { - return array(value) && value.every((elem) => string(elem)); - } - exports2.stringArray = stringArray; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - exports2.typedArray = typedArray; - function thenable(value) { - return value && func(value.then); - } - exports2.thenable = thenable; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/is.js -var require_is2 = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/is.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; - function boolean(value) { - return value === true || value === false; - } - exports2.boolean = boolean; - function string(value) { - return typeof value === "string" || value instanceof String; - } - exports2.string = string; - function number(value) { - return typeof value === "number" || value instanceof Number; - } - exports2.number = number; - function error(value) { - return value instanceof Error; - } - exports2.error = error; - function func(value) { - return typeof value === "function"; - } - exports2.func = func; - function array(value) { - return Array.isArray(value); - } - exports2.array = array; - function stringArray(value) { - return array(value) && value.every((elem) => string(elem)); - } - exports2.stringArray = stringArray; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/messages.js -var require_messages = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Message = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0; - var is = require_is2(); - var ErrorCodes; - (function(ErrorCodes2) { - ErrorCodes2.ParseError = -32700; - ErrorCodes2.InvalidRequest = -32600; - ErrorCodes2.MethodNotFound = -32601; - ErrorCodes2.InvalidParams = -32602; - ErrorCodes2.InternalError = -32603; - ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; - ErrorCodes2.serverErrorStart = -32099; - ErrorCodes2.MessageWriteError = -32099; - ErrorCodes2.MessageReadError = -32098; - ErrorCodes2.PendingResponseRejected = -32097; - ErrorCodes2.ConnectionInactive = -32096; - ErrorCodes2.ServerNotInitialized = -32002; - ErrorCodes2.UnknownErrorCode = -32001; - ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; - ErrorCodes2.serverErrorEnd = -32e3; - })(ErrorCodes || (exports2.ErrorCodes = ErrorCodes = {})); - var ResponseError2 = class _ResponseError extends Error { - constructor(code, message, data) { - super(message); - this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; - this.data = data; - Object.setPrototypeOf(this, _ResponseError.prototype); - } - toJson() { - const result = { - code: this.code, - message: this.message - }; - if (this.data !== void 0) { - result.data = this.data; - } - return result; - } - }; - exports2.ResponseError = ResponseError2; - var ParameterStructures = class _ParameterStructures { - constructor(kind) { - this.kind = kind; - } - static is(value) { - return value === _ParameterStructures.auto || value === _ParameterStructures.byName || value === _ParameterStructures.byPosition; - } - toString() { - return this.kind; - } - }; - exports2.ParameterStructures = ParameterStructures; - ParameterStructures.auto = new ParameterStructures("auto"); - ParameterStructures.byPosition = new ParameterStructures("byPosition"); - ParameterStructures.byName = new ParameterStructures("byName"); - var AbstractMessageSignature = class { - constructor(method, numberOfParams) { - this.method = method; - this.numberOfParams = numberOfParams; - } - get parameterStructures() { - return ParameterStructures.auto; - } - }; - exports2.AbstractMessageSignature = AbstractMessageSignature; - var RequestType0 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 0); - } - }; - exports2.RequestType0 = RequestType0; - var RequestType = class extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } - }; - exports2.RequestType = RequestType; - var RequestType1 = class extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } - }; - exports2.RequestType1 = RequestType1; - var RequestType2 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 2); - } - }; - exports2.RequestType2 = RequestType2; - var RequestType3 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 3); - } - }; - exports2.RequestType3 = RequestType3; - var RequestType4 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 4); - } - }; - exports2.RequestType4 = RequestType4; - var RequestType5 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 5); - } - }; - exports2.RequestType5 = RequestType5; - var RequestType6 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 6); - } - }; - exports2.RequestType6 = RequestType6; - var RequestType7 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 7); - } - }; - exports2.RequestType7 = RequestType7; - var RequestType8 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 8); - } - }; - exports2.RequestType8 = RequestType8; - var RequestType9 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 9); - } - }; - exports2.RequestType9 = RequestType9; - var NotificationType = class extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } - }; - exports2.NotificationType = NotificationType; - var NotificationType0 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 0); - } - }; - exports2.NotificationType0 = NotificationType0; - var NotificationType1 = class extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } - }; - exports2.NotificationType1 = NotificationType1; - var NotificationType2 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 2); - } - }; - exports2.NotificationType2 = NotificationType2; - var NotificationType3 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 3); - } - }; - exports2.NotificationType3 = NotificationType3; - var NotificationType4 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 4); - } - }; - exports2.NotificationType4 = NotificationType4; - var NotificationType5 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 5); - } - }; - exports2.NotificationType5 = NotificationType5; - var NotificationType6 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 6); - } - }; - exports2.NotificationType6 = NotificationType6; - var NotificationType7 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 7); - } - }; - exports2.NotificationType7 = NotificationType7; - var NotificationType8 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 8); - } - }; - exports2.NotificationType8 = NotificationType8; - var NotificationType9 = class extends AbstractMessageSignature { - constructor(method) { - super(method, 9); - } - }; - exports2.NotificationType9 = NotificationType9; - var Message; - (function(Message2) { - function isRequest(message) { - const candidate = message; - return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); - } - Message2.isRequest = isRequest; - function isNotification(message) { - const candidate = message; - return candidate && is.string(candidate.method) && message.id === void 0; - } - Message2.isNotification = isNotification; - function isResponse(message) { - const candidate = message; - return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); - } - Message2.isResponse = isResponse; - })(Message || (exports2.Message = Message = {})); - } -}); - -// node_modules/vscode-jsonrpc/lib/common/linkedMap.js -var require_linkedMap = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) { - "use strict"; - var _a; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0; - var Touch; - (function(Touch2) { - Touch2.None = 0; - Touch2.First = 1; - Touch2.AsOld = Touch2.First; - Touch2.Last = 2; - Touch2.AsNew = Touch2.Last; - })(Touch || (exports2.Touch = Touch = {})); - var LinkedMap = class { - constructor() { - this[_a] = "LinkedMap"; - this._map = /* @__PURE__ */ new Map(); - this._head = void 0; - this._tail = void 0; - this._size = 0; - this._state = 0; - } - clear() { - this._map.clear(); - this._head = void 0; - this._tail = void 0; - this._size = 0; - this._state++; - } - isEmpty() { - return !this._head && !this._tail; - } - get size() { - return this._size; - } - get first() { - var _a2; - return (_a2 = this._head) == null ? void 0 : _a2.value; - } - get last() { - var _a2; - return (_a2 = this._tail) == null ? void 0 : _a2.value; - } - has(key) { - return this._map.has(key); - } - get(key, touch = Touch.None) { - const item = this._map.get(key); - if (!item) { - return void 0; - } - if (touch !== Touch.None) { - this.touch(item, touch); - } - return item.value; - } - set(key, value, touch = Touch.None) { - let item = this._map.get(key); - if (item) { - item.value = value; - if (touch !== Touch.None) { - this.touch(item, touch); - } - } else { - item = { key, value, next: void 0, previous: void 0 }; - switch (touch) { - case Touch.None: - this.addItemLast(item); - break; - case Touch.First: - this.addItemFirst(item); - break; - case Touch.Last: - this.addItemLast(item); - break; - default: - this.addItemLast(item); - break; - } - this._map.set(key, item); - this._size++; - } - return this; - } - delete(key) { - return !!this.remove(key); - } - remove(key) { - const item = this._map.get(key); - if (!item) { - return void 0; - } - this._map.delete(key); - this.removeItem(item); - this._size--; - return item.value; - } - shift() { - if (!this._head && !this._tail) { - return void 0; - } - if (!this._head || !this._tail) { - throw new Error("Invalid list"); - } - const item = this._head; - this._map.delete(item.key); - this.removeItem(item); - this._size--; - return item.value; - } - forEach(callbackfn, thisArg) { - const state = this._state; - let current = this._head; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } else { - callbackfn(current.value, current.key, this); - } - if (this._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - current = current.next; - } - } - keys() { - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]: () => { - return iterator; - }, - next: () => { - if (this._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: current.key, done: false }; - current = current.next; - return result; - } else { - return { value: void 0, done: true }; - } - } - }; - return iterator; - } - values() { - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]: () => { - return iterator; - }, - next: () => { - if (this._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: current.value, done: false }; - current = current.next; - return result; - } else { - return { value: void 0, done: true }; - } - } - }; - return iterator; - } - entries() { - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]: () => { - return iterator; - }, - next: () => { - if (this._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: [current.key, current.value], done: false }; - current = current.next; - return result; - } else { - return { value: void 0, done: true }; - } - } - }; - return iterator; - } - [(_a = Symbol.toStringTag, Symbol.iterator)]() { - return this.entries(); - } - trimOld(newSize) { - if (newSize >= this.size) { - return; - } - if (newSize === 0) { - this.clear(); - return; - } - let current = this._head; - let currentSize = this.size; - while (current && currentSize > newSize) { - this._map.delete(current.key); - current = current.next; - currentSize--; - } - this._head = current; - this._size = currentSize; - if (current) { - current.previous = void 0; - } - this._state++; - } - addItemFirst(item) { - if (!this._head && !this._tail) { - this._tail = item; - } else if (!this._head) { - throw new Error("Invalid list"); - } else { - item.next = this._head; - this._head.previous = item; - } - this._head = item; - this._state++; - } - addItemLast(item) { - if (!this._head && !this._tail) { - this._head = item; - } else if (!this._tail) { - throw new Error("Invalid list"); - } else { - item.previous = this._tail; - this._tail.next = item; - } - this._tail = item; - this._state++; - } - removeItem(item) { - if (item === this._head && item === this._tail) { - this._head = void 0; - this._tail = void 0; - } else if (item === this._head) { - if (!item.next) { - throw new Error("Invalid list"); - } - item.next.previous = void 0; - this._head = item.next; - } else if (item === this._tail) { - if (!item.previous) { - throw new Error("Invalid list"); - } - item.previous.next = void 0; - this._tail = item.previous; - } else { - const next = item.next; - const previous = item.previous; - if (!next || !previous) { - throw new Error("Invalid list"); - } - next.previous = previous; - previous.next = next; - } - item.next = void 0; - item.previous = void 0; - this._state++; - } - touch(item, touch) { - if (!this._head || !this._tail) { - throw new Error("Invalid list"); - } - if (touch !== Touch.First && touch !== Touch.Last) { - return; - } - if (touch === Touch.First) { - if (item === this._head) { - return; - } - const next = item.next; - const previous = item.previous; - if (item === this._tail) { - previous.next = void 0; - this._tail = previous; - } else { - next.previous = previous; - previous.next = next; - } - item.previous = void 0; - item.next = this._head; - this._head.previous = item; - this._head = item; - this._state++; - } else if (touch === Touch.Last) { - if (item === this._tail) { - return; - } - const next = item.next; - const previous = item.previous; - if (item === this._head) { - next.previous = void 0; - this._head = next; - } else { - next.previous = previous; - previous.next = next; - } - item.next = void 0; - item.previous = this._tail; - this._tail.next = item; - this._tail = item; - this._state++; - } - } - toJSON() { - const data = []; - this.forEach((value, key) => { - data.push([key, value]); - }); - return data; - } - fromJSON(data) { - this.clear(); - for (const [key, value] of data) { - this.set(key, value); - } - } - }; - exports2.LinkedMap = LinkedMap; - var LRUCache = class extends LinkedMap { - constructor(limit, ratio = 1) { - super(); - this._limit = limit; - this._ratio = Math.min(Math.max(0, ratio), 1); - } - get limit() { - return this._limit; - } - set limit(limit) { - this._limit = limit; - this.checkTrim(); - } - get ratio() { - return this._ratio; - } - set ratio(ratio) { - this._ratio = Math.min(Math.max(0, ratio), 1); - this.checkTrim(); - } - get(key, touch = Touch.AsNew) { - return super.get(key, touch); - } - peek(key) { - return super.get(key, Touch.None); - } - set(key, value) { - super.set(key, value, Touch.Last); - this.checkTrim(); - return this; - } - checkTrim() { - if (this.size > this._limit) { - this.trimOld(Math.round(this._limit * this._ratio)); - } - } - }; - exports2.LRUCache = LRUCache; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/disposable.js -var require_disposable = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Disposable = void 0; - var Disposable2; - (function(Disposable3) { - function create(func) { - return { - dispose: func - }; - } - Disposable3.create = create; - })(Disposable2 || (exports2.Disposable = Disposable2 = {})); - } -}); - -// node_modules/vscode-jsonrpc/lib/common/ral.js -var require_ral = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var _ral; - function RAL() { - if (_ral === void 0) { - throw new Error(`No runtime abstraction layer installed`); - } - return _ral; - } - (function(RAL2) { - function install(ral) { - if (ral === void 0) { - throw new Error(`No runtime abstraction layer provided`); - } - _ral = ral; - } - RAL2.install = install; - })(RAL || (RAL = {})); - exports2.default = RAL; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/events.js -var require_events = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/events.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Emitter = exports2.Event = void 0; - var ral_1 = require_ral(); - var Event; - (function(Event2) { - const _disposable = { dispose() { - } }; - Event2.None = function() { - return _disposable; - }; - })(Event || (exports2.Event = Event = {})); - var CallbackList = class { - add(callback, context = null, bucket) { - if (!this._callbacks) { - this._callbacks = []; - this._contexts = []; - } - this._callbacks.push(callback); - this._contexts.push(context); - if (Array.isArray(bucket)) { - bucket.push({ dispose: () => this.remove(callback, context) }); - } - } - remove(callback, context = null) { - if (!this._callbacks) { - return; - } - let foundCallbackWithDifferentContext = false; - for (let i = 0, len = this._callbacks.length; i < len; i++) { - if (this._callbacks[i] === callback) { - if (this._contexts[i] === context) { - this._callbacks.splice(i, 1); - this._contexts.splice(i, 1); - return; - } else { - foundCallbackWithDifferentContext = true; - } - } - } - if (foundCallbackWithDifferentContext) { - throw new Error("When adding a listener with a context, you should remove it with the same context"); - } - } - invoke(...args) { - if (!this._callbacks) { - return []; - } - const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); - for (let i = 0, len = callbacks.length; i < len; i++) { - try { - ret.push(callbacks[i].apply(contexts[i], args)); - } catch (e) { - (0, ral_1.default)().console.error(e); - } - } - return ret; - } - isEmpty() { - return !this._callbacks || this._callbacks.length === 0; - } - dispose() { - this._callbacks = void 0; - this._contexts = void 0; - } - }; - var Emitter3 = class _Emitter { - constructor(_options) { - this._options = _options; - } - /** - * For the public to allow to subscribe - * to events from this Emitter - */ - get event() { - if (!this._event) { - this._event = (listener, thisArgs, disposables) => { - if (!this._callbacks) { - this._callbacks = new CallbackList(); - } - if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { - this._options.onFirstListenerAdd(this); - } - this._callbacks.add(listener, thisArgs); - const result = { - dispose: () => { - if (!this._callbacks) { - return; - } - this._callbacks.remove(listener, thisArgs); - result.dispose = _Emitter._noop; - if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { - this._options.onLastListenerRemove(this); - } - } - }; - if (Array.isArray(disposables)) { - disposables.push(result); - } - return result; - }; - } - return this._event; - } - /** - * To be kept private to fire an event to - * subscribers - */ - fire(event) { - if (this._callbacks) { - this._callbacks.invoke.call(this._callbacks, event); - } - } - dispose() { - if (this._callbacks) { - this._callbacks.dispose(); - this._callbacks = void 0; - } - } - }; - exports2.Emitter = Emitter3; - Emitter3._noop = function() { - }; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/cancellation.js -var require_cancellation = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CancellationTokenSource = exports2.CancellationToken = void 0; - var ral_1 = require_ral(); - var Is2 = require_is2(); - var events_1 = require_events(); - var CancellationToken18; - (function(CancellationToken19) { - CancellationToken19.None = Object.freeze({ - isCancellationRequested: false, - onCancellationRequested: events_1.Event.None - }); - CancellationToken19.Cancelled = Object.freeze({ - isCancellationRequested: true, - onCancellationRequested: events_1.Event.None - }); - function is(value) { - const candidate = value; - return candidate && (candidate === CancellationToken19.None || candidate === CancellationToken19.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); - } - CancellationToken19.is = is; - })(CancellationToken18 || (exports2.CancellationToken = CancellationToken18 = {})); - var shortcutEvent = Object.freeze(function(callback, context) { - const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0); - return { dispose() { - handle.dispose(); - } }; - }); - var MutableToken = class { - constructor() { - this._isCancelled = false; - } - cancel() { - if (!this._isCancelled) { - this._isCancelled = true; - if (this._emitter) { - this._emitter.fire(void 0); - this.dispose(); - } - } - } - get isCancellationRequested() { - return this._isCancelled; - } - get onCancellationRequested() { - if (this._isCancelled) { - return shortcutEvent; - } - if (!this._emitter) { - this._emitter = new events_1.Emitter(); - } - return this._emitter.event; - } - dispose() { - if (this._emitter) { - this._emitter.dispose(); - this._emitter = void 0; - } - } - }; - var CancellationTokenSource3 = class { - get token() { - if (!this._token) { - this._token = new MutableToken(); - } - return this._token; - } - cancel() { - if (!this._token) { - this._token = CancellationToken18.Cancelled; - } else { - this._token.cancel(); - } - } - dispose() { - if (!this._token) { - this._token = CancellationToken18.None; - } else if (this._token instanceof MutableToken) { - this._token.dispose(); - } - } - }; - exports2.CancellationTokenSource = CancellationTokenSource3; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js -var require_sharedArrayCancellation = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = void 0; - var cancellation_1 = require_cancellation(); - var CancellationState; - (function(CancellationState2) { - CancellationState2.Continue = 0; - CancellationState2.Cancelled = 1; - })(CancellationState || (CancellationState = {})); - var SharedArraySenderStrategy = class { - constructor() { - this.buffers = /* @__PURE__ */ new Map(); - } - enableCancellation(request) { - if (request.id === null) { - return; - } - const buffer = new SharedArrayBuffer(4); - const data = new Int32Array(buffer, 0, 1); - data[0] = CancellationState.Continue; - this.buffers.set(request.id, buffer); - request.$cancellationData = buffer; - } - async sendCancellation(_conn, id) { - const buffer = this.buffers.get(id); - if (buffer === void 0) { - return; - } - const data = new Int32Array(buffer, 0, 1); - Atomics.store(data, 0, CancellationState.Cancelled); - } - cleanup(id) { - this.buffers.delete(id); - } - dispose() { - this.buffers.clear(); - } - }; - exports2.SharedArraySenderStrategy = SharedArraySenderStrategy; - var SharedArrayBufferCancellationToken = class { - constructor(buffer) { - this.data = new Int32Array(buffer, 0, 1); - } - get isCancellationRequested() { - return Atomics.load(this.data, 0) === CancellationState.Cancelled; - } - get onCancellationRequested() { - throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`); - } - }; - var SharedArrayBufferCancellationTokenSource = class { - constructor(buffer) { - this.token = new SharedArrayBufferCancellationToken(buffer); - } - cancel() { - } - dispose() { - } - }; - var SharedArrayReceiverStrategy = class { - constructor() { - this.kind = "request"; - } - createCancellationTokenSource(request) { - const buffer = request.$cancellationData; - if (buffer === void 0) { - return new cancellation_1.CancellationTokenSource(); - } - return new SharedArrayBufferCancellationTokenSource(buffer); - } - }; - exports2.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/semaphore.js -var require_semaphore = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Semaphore = void 0; - var ral_1 = require_ral(); - var Semaphore = class { - constructor(capacity = 1) { - if (capacity <= 0) { - throw new Error("Capacity must be greater than 0"); - } - this._capacity = capacity; - this._active = 0; - this._waiting = []; - } - lock(thunk) { - return new Promise((resolve, reject2) => { - this._waiting.push({ thunk, resolve, reject: reject2 }); - this.runNext(); - }); - } - get active() { - return this._active; - } - runNext() { - if (this._waiting.length === 0 || this._active === this._capacity) { - return; - } - (0, ral_1.default)().timer.setImmediate(() => this.doRunNext()); - } - doRunNext() { - if (this._waiting.length === 0 || this._active === this._capacity) { - return; - } - const next = this._waiting.shift(); - this._active++; - if (this._active > this._capacity) { - throw new Error(`To many thunks active`); - } - try { - const result = next.thunk(); - if (result instanceof Promise) { - result.then((value) => { - this._active--; - next.resolve(value); - this.runNext(); - }, (err) => { - this._active--; - next.reject(err); - this.runNext(); - }); - } else { - this._active--; - next.resolve(result); - this.runNext(); - } - } catch (err) { - this._active--; - next.reject(err); - this.runNext(); - } - } - }; - exports2.Semaphore = Semaphore; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/messageReader.js -var require_messageReader = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0; - var ral_1 = require_ral(); - var Is2 = require_is2(); - var events_1 = require_events(); - var semaphore_1 = require_semaphore(); - var MessageReader; - (function(MessageReader2) { - function is(value) { - let candidate = value; - return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage); - } - MessageReader2.is = is; - })(MessageReader || (exports2.MessageReader = MessageReader = {})); - var AbstractMessageReader = class { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - this.partialMessageEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error) { - this.errorEmitter.fire(this.asError(error)); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(void 0); - } - get onPartialMessage() { - return this.partialMessageEmitter.event; - } - firePartialMessage(info) { - this.partialMessageEmitter.fire(info); - } - asError(error) { - if (error instanceof Error) { - return error; - } else { - return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); - } - } - }; - exports2.AbstractMessageReader = AbstractMessageReader; - var ResolvedMessageReaderOptions; - (function(ResolvedMessageReaderOptions2) { - function fromOptions(options) { - var _a; - let charset; - let result; - let contentDecoder; - const contentDecoders = /* @__PURE__ */ new Map(); - let contentTypeDecoder; - const contentTypeDecoders = /* @__PURE__ */ new Map(); - if (options === void 0 || typeof options === "string") { - charset = options != null ? options : "utf-8"; - } else { - charset = (_a = options.charset) != null ? _a : "utf-8"; - if (options.contentDecoder !== void 0) { - contentDecoder = options.contentDecoder; - contentDecoders.set(contentDecoder.name, contentDecoder); - } - if (options.contentDecoders !== void 0) { - for (const decoder of options.contentDecoders) { - contentDecoders.set(decoder.name, decoder); - } - } - if (options.contentTypeDecoder !== void 0) { - contentTypeDecoder = options.contentTypeDecoder; - contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); - } - if (options.contentTypeDecoders !== void 0) { - for (const decoder of options.contentTypeDecoders) { - contentTypeDecoders.set(decoder.name, decoder); - } - } - } - if (contentTypeDecoder === void 0) { - contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder; - contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); - } - return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; - } - ResolvedMessageReaderOptions2.fromOptions = fromOptions; - })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); - var ReadableStreamMessageReader = class extends AbstractMessageReader { - constructor(readable, options) { - super(); - this.readable = readable; - this.options = ResolvedMessageReaderOptions.fromOptions(options); - this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset); - this._partialMessageTimeout = 1e4; - this.nextMessageLength = -1; - this.messageToken = 0; - this.readSemaphore = new semaphore_1.Semaphore(1); - } - set partialMessageTimeout(timeout) { - this._partialMessageTimeout = timeout; - } - get partialMessageTimeout() { - return this._partialMessageTimeout; - } - listen(callback) { - this.nextMessageLength = -1; - this.messageToken = 0; - this.partialMessageTimer = void 0; - this.callback = callback; - const result = this.readable.onData((data) => { - this.onData(data); - }); - this.readable.onError((error) => this.fireError(error)); - this.readable.onClose(() => this.fireClose()); - return result; - } - onData(data) { - try { - this.buffer.append(data); - while (true) { - if (this.nextMessageLength === -1) { - const headers = this.buffer.tryReadHeaders(true); - if (!headers) { - return; - } - const contentLength = headers.get("content-length"); - if (!contentLength) { - this.fireError(new Error(`Header must provide a Content-Length property. -${JSON.stringify(Object.fromEntries(headers))}`)); - return; - } - const length = parseInt(contentLength); - if (isNaN(length)) { - this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`)); - return; - } - this.nextMessageLength = length; - } - const body = this.buffer.tryReadBody(this.nextMessageLength); - if (body === void 0) { - this.setPartialMessageTimer(); - return; - } - this.clearPartialMessageTimer(); - this.nextMessageLength = -1; - this.readSemaphore.lock(async () => { - const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body; - const message = await this.options.contentTypeDecoder.decode(bytes, this.options); - this.callback(message); - }).catch((error) => { - this.fireError(error); - }); - } - } catch (error) { - this.fireError(error); - } - } - clearPartialMessageTimer() { - if (this.partialMessageTimer) { - this.partialMessageTimer.dispose(); - this.partialMessageTimer = void 0; - } - } - setPartialMessageTimer() { - this.clearPartialMessageTimer(); - if (this._partialMessageTimeout <= 0) { - return; - } - this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => { - this.partialMessageTimer = void 0; - if (token === this.messageToken) { - this.firePartialMessage({ messageToken: token, waitingTime: timeout }); - this.setPartialMessageTimer(); - } - }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); - } - }; - exports2.ReadableStreamMessageReader = ReadableStreamMessageReader; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/messageWriter.js -var require_messageWriter = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0; - var ral_1 = require_ral(); - var Is2 = require_is2(); - var semaphore_1 = require_semaphore(); - var events_1 = require_events(); - var ContentLength = "Content-Length: "; - var CRLF = "\r\n"; - var MessageWriter; - (function(MessageWriter2) { - function is(value) { - let candidate = value; - return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write); - } - MessageWriter2.is = is; - })(MessageWriter || (exports2.MessageWriter = MessageWriter = {})); - var AbstractMessageWriter = class { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error, message, count) { - this.errorEmitter.fire([this.asError(error), message, count]); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(void 0); - } - asError(error) { - if (error instanceof Error) { - return error; - } else { - return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); - } - } - }; - exports2.AbstractMessageWriter = AbstractMessageWriter; - var ResolvedMessageWriterOptions; - (function(ResolvedMessageWriterOptions2) { - function fromOptions(options) { - var _a, _b; - if (options === void 0 || typeof options === "string") { - return { charset: options != null ? options : "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder }; - } else { - return { charset: (_a = options.charset) != null ? _a : "utf-8", contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) != null ? _b : (0, ral_1.default)().applicationJson.encoder }; - } - } - ResolvedMessageWriterOptions2.fromOptions = fromOptions; - })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); - var WriteableStreamMessageWriter = class extends AbstractMessageWriter { - constructor(writable, options) { - super(); - this.writable = writable; - this.options = ResolvedMessageWriterOptions.fromOptions(options); - this.errorCount = 0; - this.writeSemaphore = new semaphore_1.Semaphore(1); - this.writable.onError((error) => this.fireError(error)); - this.writable.onClose(() => this.fireClose()); - } - async write(msg) { - return this.writeSemaphore.lock(async () => { - const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { - if (this.options.contentEncoder !== void 0) { - return this.options.contentEncoder.encode(buffer); - } else { - return buffer; - } - }); - return payload.then((buffer) => { - const headers = []; - headers.push(ContentLength, buffer.byteLength.toString(), CRLF); - headers.push(CRLF); - return this.doWrite(msg, headers, buffer); - }, (error) => { - this.fireError(error); - throw error; - }); - }); - } - async doWrite(msg, headers, data) { - try { - await this.writable.write(headers.join(""), "ascii"); - return this.writable.write(data); - } catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - this.writable.end(); - } - }; - exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/messageBuffer.js -var require_messageBuffer = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AbstractMessageBuffer = void 0; - var CR = 13; - var LF = 10; - var CRLF = "\r\n"; - var AbstractMessageBuffer = class { - constructor(encoding = "utf-8") { - this._encoding = encoding; - this._chunks = []; - this._totalLength = 0; - } - get encoding() { - return this._encoding; - } - append(chunk) { - const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; - this._chunks.push(toAppend); - this._totalLength += toAppend.byteLength; - } - tryReadHeaders(lowerCaseKeys = false) { - if (this._chunks.length === 0) { - return void 0; - } - let state = 0; - let chunkIndex = 0; - let offset = 0; - let chunkBytesRead = 0; - row: - while (chunkIndex < this._chunks.length) { - const chunk = this._chunks[chunkIndex]; - offset = 0; - column: - while (offset < chunk.length) { - const value = chunk[offset]; - switch (value) { - case CR: - switch (state) { - case 0: - state = 1; - break; - case 2: - state = 3; - break; - default: - state = 0; - } - break; - case LF: - switch (state) { - case 1: - state = 2; - break; - case 3: - state = 4; - offset++; - break row; - default: - state = 0; - } - break; - default: - state = 0; - } - offset++; - } - chunkBytesRead += chunk.byteLength; - chunkIndex++; - } - if (state !== 4) { - return void 0; - } - const buffer = this._read(chunkBytesRead + offset); - const result = /* @__PURE__ */ new Map(); - const headers = this.toString(buffer, "ascii").split(CRLF); - if (headers.length < 2) { - return result; - } - for (let i = 0; i < headers.length - 2; i++) { - const header = headers[i]; - const index = header.indexOf(":"); - if (index === -1) { - throw new Error(`Message header must separate key and value using ':' -${header}`); - } - const key = header.substr(0, index); - const value = header.substr(index + 1).trim(); - result.set(lowerCaseKeys ? key.toLowerCase() : key, value); - } - return result; - } - tryReadBody(length) { - if (this._totalLength < length) { - return void 0; - } - return this._read(length); - } - get numberOfBytes() { - return this._totalLength; - } - _read(byteCount) { - if (byteCount === 0) { - return this.emptyBuffer(); - } - if (byteCount > this._totalLength) { - throw new Error(`Cannot read so many bytes!`); - } - if (this._chunks[0].byteLength === byteCount) { - const chunk = this._chunks[0]; - this._chunks.shift(); - this._totalLength -= byteCount; - return this.asNative(chunk); - } - if (this._chunks[0].byteLength > byteCount) { - const chunk = this._chunks[0]; - const result2 = this.asNative(chunk, byteCount); - this._chunks[0] = chunk.slice(byteCount); - this._totalLength -= byteCount; - return result2; - } - const result = this.allocNative(byteCount); - let resultOffset = 0; - let chunkIndex = 0; - while (byteCount > 0) { - const chunk = this._chunks[chunkIndex]; - if (chunk.byteLength > byteCount) { - const chunkPart = chunk.slice(0, byteCount); - result.set(chunkPart, resultOffset); - resultOffset += byteCount; - this._chunks[chunkIndex] = chunk.slice(byteCount); - this._totalLength -= byteCount; - byteCount -= byteCount; - } else { - result.set(chunk, resultOffset); - resultOffset += chunk.byteLength; - this._chunks.shift(); - this._totalLength -= chunk.byteLength; - byteCount -= chunk.byteLength; - } - } - return result; - } - }; - exports2.AbstractMessageBuffer = AbstractMessageBuffer; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/connection.js -var require_connection = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createMessageConnection = exports2.ConnectionOptions = exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.RequestCancellationReceiverStrategy = exports2.IdCancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = exports2.NullLogger = exports2.ProgressType = exports2.ProgressToken = void 0; - var ral_1 = require_ral(); - var Is2 = require_is2(); - var messages_1 = require_messages(); - var linkedMap_1 = require_linkedMap(); - var events_1 = require_events(); - var cancellation_1 = require_cancellation(); - var CancelNotification; - (function(CancelNotification2) { - CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); - })(CancelNotification || (CancelNotification = {})); - var ProgressToken; - (function(ProgressToken2) { - function is(value) { - return typeof value === "string" || typeof value === "number"; - } - ProgressToken2.is = is; - })(ProgressToken || (exports2.ProgressToken = ProgressToken = {})); - var ProgressNotification; - (function(ProgressNotification2) { - ProgressNotification2.type = new messages_1.NotificationType("$/progress"); - })(ProgressNotification || (ProgressNotification = {})); - var ProgressType = class { - constructor() { - } - }; - exports2.ProgressType = ProgressType; - var StarRequestHandler; - (function(StarRequestHandler2) { - function is(value) { - return Is2.func(value); - } - StarRequestHandler2.is = is; - })(StarRequestHandler || (StarRequestHandler = {})); - exports2.NullLogger = Object.freeze({ - error: () => { - }, - warn: () => { - }, - info: () => { - }, - log: () => { - } - }); - var Trace; - (function(Trace2) { - Trace2[Trace2["Off"] = 0] = "Off"; - Trace2[Trace2["Messages"] = 1] = "Messages"; - Trace2[Trace2["Compact"] = 2] = "Compact"; - Trace2[Trace2["Verbose"] = 3] = "Verbose"; - })(Trace || (exports2.Trace = Trace = {})); - var TraceValues; - (function(TraceValues2) { - TraceValues2.Off = "off"; - TraceValues2.Messages = "messages"; - TraceValues2.Compact = "compact"; - TraceValues2.Verbose = "verbose"; - })(TraceValues || (exports2.TraceValues = TraceValues = {})); - (function(Trace2) { - function fromString(value) { - if (!Is2.string(value)) { - return Trace2.Off; - } - value = value.toLowerCase(); - switch (value) { - case "off": - return Trace2.Off; - case "messages": - return Trace2.Messages; - case "compact": - return Trace2.Compact; - case "verbose": - return Trace2.Verbose; - default: - return Trace2.Off; - } - } - Trace2.fromString = fromString; - function toString3(value) { - switch (value) { - case Trace2.Off: - return "off"; - case Trace2.Messages: - return "messages"; - case Trace2.Compact: - return "compact"; - case Trace2.Verbose: - return "verbose"; - default: - return "off"; - } - } - Trace2.toString = toString3; - })(Trace || (exports2.Trace = Trace = {})); - var TraceFormat; - (function(TraceFormat2) { - TraceFormat2["Text"] = "text"; - TraceFormat2["JSON"] = "json"; - })(TraceFormat || (exports2.TraceFormat = TraceFormat = {})); - (function(TraceFormat2) { - function fromString(value) { - if (!Is2.string(value)) { - return TraceFormat2.Text; - } - value = value.toLowerCase(); - if (value === "json") { - return TraceFormat2.JSON; - } else { - return TraceFormat2.Text; - } - } - TraceFormat2.fromString = fromString; - })(TraceFormat || (exports2.TraceFormat = TraceFormat = {})); - var SetTraceNotification; - (function(SetTraceNotification2) { - SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); - })(SetTraceNotification || (exports2.SetTraceNotification = SetTraceNotification = {})); - var LogTraceNotification; - (function(LogTraceNotification2) { - LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); - })(LogTraceNotification || (exports2.LogTraceNotification = LogTraceNotification = {})); - var ConnectionErrors; - (function(ConnectionErrors2) { - ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; - ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; - ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; - })(ConnectionErrors || (exports2.ConnectionErrors = ConnectionErrors = {})); - var ConnectionError = class _ConnectionError extends Error { - constructor(code, message) { - super(message); - this.code = code; - Object.setPrototypeOf(this, _ConnectionError.prototype); - } - }; - exports2.ConnectionError = ConnectionError; - var ConnectionStrategy; - (function(ConnectionStrategy2) { - function is(value) { - const candidate = value; - return candidate && Is2.func(candidate.cancelUndispatched); - } - ConnectionStrategy2.is = is; - })(ConnectionStrategy || (exports2.ConnectionStrategy = ConnectionStrategy = {})); - var IdCancellationReceiverStrategy; - (function(IdCancellationReceiverStrategy2) { - function is(value) { - const candidate = value; - return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); - } - IdCancellationReceiverStrategy2.is = is; - })(IdCancellationReceiverStrategy || (exports2.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {})); - var RequestCancellationReceiverStrategy; - (function(RequestCancellationReceiverStrategy2) { - function is(value) { - const candidate = value; - return candidate && candidate.kind === "request" && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); - } - RequestCancellationReceiverStrategy2.is = is; - })(RequestCancellationReceiverStrategy || (exports2.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {})); - var CancellationReceiverStrategy; - (function(CancellationReceiverStrategy2) { - CancellationReceiverStrategy2.Message = Object.freeze({ - createCancellationTokenSource(_2) { - return new cancellation_1.CancellationTokenSource(); - } - }); - function is(value) { - return IdCancellationReceiverStrategy.is(value) || RequestCancellationReceiverStrategy.is(value); - } - CancellationReceiverStrategy2.is = is; - })(CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = CancellationReceiverStrategy = {})); - var CancellationSenderStrategy; - (function(CancellationSenderStrategy2) { - CancellationSenderStrategy2.Message = Object.freeze({ - sendCancellation(conn, id) { - return conn.sendNotification(CancelNotification.type, { id }); - }, - cleanup(_2) { - } - }); - function is(value) { - const candidate = value; - return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup); - } - CancellationSenderStrategy2.is = is; - })(CancellationSenderStrategy || (exports2.CancellationSenderStrategy = CancellationSenderStrategy = {})); - var CancellationStrategy; - (function(CancellationStrategy2) { - CancellationStrategy2.Message = Object.freeze({ - receiver: CancellationReceiverStrategy.Message, - sender: CancellationSenderStrategy.Message - }); - function is(value) { - const candidate = value; - return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); - } - CancellationStrategy2.is = is; - })(CancellationStrategy || (exports2.CancellationStrategy = CancellationStrategy = {})); - var MessageStrategy; - (function(MessageStrategy2) { - function is(value) { - const candidate = value; - return candidate && Is2.func(candidate.handleMessage); - } - MessageStrategy2.is = is; - })(MessageStrategy || (exports2.MessageStrategy = MessageStrategy = {})); - var ConnectionOptions; - (function(ConnectionOptions2) { - function is(value) { - const candidate = value; - return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy)); - } - ConnectionOptions2.is = is; - })(ConnectionOptions || (exports2.ConnectionOptions = ConnectionOptions = {})); - var ConnectionState; - (function(ConnectionState2) { - ConnectionState2[ConnectionState2["New"] = 1] = "New"; - ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; - ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; - ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; - })(ConnectionState || (ConnectionState = {})); - function createMessageConnection(messageReader, messageWriter, _logger, options) { - const logger = _logger !== void 0 ? _logger : exports2.NullLogger; - let sequenceNumber = 0; - let notificationSequenceNumber = 0; - let unknownResponseSequenceNumber = 0; - const version = "2.0"; - let starRequestHandler = void 0; - const requestHandlers = /* @__PURE__ */ new Map(); - let starNotificationHandler = void 0; - const notificationHandlers = /* @__PURE__ */ new Map(); - const progressHandlers = /* @__PURE__ */ new Map(); - let timer2; - let messageQueue = new linkedMap_1.LinkedMap(); - let responsePromises = /* @__PURE__ */ new Map(); - let knownCanceledRequests = /* @__PURE__ */ new Set(); - let requestTokens = /* @__PURE__ */ new Map(); - let trace = Trace.Off; - let traceFormat = TraceFormat.Text; - let tracer; - let state = ConnectionState.New; - const errorEmitter = new events_1.Emitter(); - const closeEmitter = new events_1.Emitter(); - const unhandledNotificationEmitter = new events_1.Emitter(); - const unhandledProgressEmitter = new events_1.Emitter(); - const disposeEmitter = new events_1.Emitter(); - const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message; - function createRequestQueueKey(id) { - if (id === null) { - throw new Error(`Can't send requests with id null since the response can't be correlated.`); - } - return "req-" + id.toString(); - } - function createResponseQueueKey(id) { - if (id === null) { - return "res-unknown-" + (++unknownResponseSequenceNumber).toString(); - } else { - return "res-" + id.toString(); - } - } - function createNotificationQueueKey() { - return "not-" + (++notificationSequenceNumber).toString(); - } - function addMessageToQueue(queue, message) { - if (messages_1.Message.isRequest(message)) { - queue.set(createRequestQueueKey(message.id), message); - } else if (messages_1.Message.isResponse(message)) { - queue.set(createResponseQueueKey(message.id), message); - } else { - queue.set(createNotificationQueueKey(), message); - } - } - function cancelUndispatched(_message) { - return void 0; - } - function isListening() { - return state === ConnectionState.Listening; - } - function isClosed() { - return state === ConnectionState.Closed; - } - function isDisposed() { - return state === ConnectionState.Disposed; - } - function closeHandler() { - if (state === ConnectionState.New || state === ConnectionState.Listening) { - state = ConnectionState.Closed; - closeEmitter.fire(void 0); - } - } - function readErrorHandler(error) { - errorEmitter.fire([error, void 0, void 0]); - } - function writeErrorHandler(data) { - errorEmitter.fire(data); - } - messageReader.onClose(closeHandler); - messageReader.onError(readErrorHandler); - messageWriter.onClose(closeHandler); - messageWriter.onError(writeErrorHandler); - function triggerMessageQueue() { - if (timer2 || messageQueue.size === 0) { - return; - } - timer2 = (0, ral_1.default)().timer.setImmediate(() => { - timer2 = void 0; - processMessageQueue(); - }); - } - function handleMessage(message) { - if (messages_1.Message.isRequest(message)) { - handleRequest(message); - } else if (messages_1.Message.isNotification(message)) { - handleNotification(message); - } else if (messages_1.Message.isResponse(message)) { - handleResponse(message); - } else { - handleInvalidMessage(message); - } - } - function processMessageQueue() { - if (messageQueue.size === 0) { - return; - } - const message = messageQueue.shift(); - try { - const messageStrategy = options == null ? void 0 : options.messageStrategy; - if (MessageStrategy.is(messageStrategy)) { - messageStrategy.handleMessage(message, handleMessage); - } else { - handleMessage(message); - } - } finally { - triggerMessageQueue(); - } - } - const callback = (message) => { - try { - if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) { - const cancelId = message.params.id; - const key = createRequestQueueKey(cancelId); - const toCancel = messageQueue.get(key); - if (messages_1.Message.isRequest(toCancel)) { - const strategy = options == null ? void 0 : options.connectionStrategy; - const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); - if (response && (response.error !== void 0 || response.result !== void 0)) { - messageQueue.delete(key); - requestTokens.delete(cancelId); - response.id = toCancel.id; - traceSendingResponse(response, message.method, Date.now()); - messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`)); - return; - } - } - const cancellationToken = requestTokens.get(cancelId); - if (cancellationToken !== void 0) { - cancellationToken.cancel(); - traceReceivedNotification(message); - return; - } else { - knownCanceledRequests.add(cancelId); - } - } - addMessageToQueue(messageQueue, message); - } finally { - triggerMessageQueue(); - } - }; - function handleRequest(requestMessage) { - var _a; - if (isDisposed()) { - return; - } - function reply(resultOrError, method, startTime2) { - const message = { - jsonrpc: version, - id: requestMessage.id - }; - if (resultOrError instanceof messages_1.ResponseError) { - message.error = resultOrError.toJson(); - } else { - message.result = resultOrError === void 0 ? null : resultOrError; - } - traceSendingResponse(message, method, startTime2); - messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); - } - function replyError(error, method, startTime2) { - const message = { - jsonrpc: version, - id: requestMessage.id, - error: error.toJson() - }; - traceSendingResponse(message, method, startTime2); - messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); - } - function replySuccess(result, method, startTime2) { - if (result === void 0) { - result = null; - } - const message = { - jsonrpc: version, - id: requestMessage.id, - result - }; - traceSendingResponse(message, method, startTime2); - messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); - } - traceReceivedRequest(requestMessage); - const element = requestHandlers.get(requestMessage.method); - let type; - let requestHandler; - if (element) { - type = element.type; - requestHandler = element.handler; - } - const startTime = Date.now(); - if (requestHandler || starRequestHandler) { - const tokenKey = (_a = requestMessage.id) != null ? _a : String(Date.now()); - const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage); - if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { - cancellationSource.cancel(); - } - if (requestMessage.id !== null) { - requestTokens.set(tokenKey, cancellationSource); - } - try { - let handlerResult; - if (requestHandler) { - if (requestMessage.params === void 0) { - if (type !== void 0 && type.numberOfParams !== 0) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(cancellationSource.token); - } else if (Array.isArray(requestMessage.params)) { - if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); - } else { - if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(requestMessage.params, cancellationSource.token); - } - } else if (starRequestHandler) { - handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); - } - const promise = handlerResult; - if (!handlerResult) { - requestTokens.delete(tokenKey); - replySuccess(handlerResult, requestMessage.method, startTime); - } else if (promise.then) { - promise.then((resultOrError) => { - requestTokens.delete(tokenKey); - reply(resultOrError, requestMessage.method, startTime); - }, (error) => { - requestTokens.delete(tokenKey); - if (error instanceof messages_1.ResponseError) { - replyError(error, requestMessage.method, startTime); - } else if (error && Is2.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - }); - } else { - requestTokens.delete(tokenKey); - reply(handlerResult, requestMessage.method, startTime); - } - } catch (error) { - requestTokens.delete(tokenKey); - if (error instanceof messages_1.ResponseError) { - reply(error, requestMessage.method, startTime); - } else if (error && Is2.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - } - } else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); - } - } - function handleResponse(responseMessage) { - if (isDisposed()) { - return; - } - if (responseMessage.id === null) { - if (responseMessage.error) { - logger.error(`Received response message without id: Error is: -${JSON.stringify(responseMessage.error, void 0, 4)}`); - } else { - logger.error(`Received response message without id. No further error information provided.`); - } - } else { - const key = responseMessage.id; - const responsePromise = responsePromises.get(key); - traceReceivedResponse(responseMessage, responsePromise); - if (responsePromise !== void 0) { - responsePromises.delete(key); - try { - if (responseMessage.error) { - const error = responseMessage.error; - responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); - } else if (responseMessage.result !== void 0) { - responsePromise.resolve(responseMessage.result); - } else { - throw new Error("Should never happen."); - } - } catch (error) { - if (error.message) { - logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); - } else { - logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); - } - } - } - } - } - function handleNotification(message) { - if (isDisposed()) { - return; - } - let type = void 0; - let notificationHandler; - if (message.method === CancelNotification.type.method) { - const cancelId = message.params.id; - knownCanceledRequests.delete(cancelId); - traceReceivedNotification(message); - return; - } else { - const element = notificationHandlers.get(message.method); - if (element) { - notificationHandler = element.handler; - type = element.type; - } - } - if (notificationHandler || starNotificationHandler) { - try { - traceReceivedNotification(message); - if (notificationHandler) { - if (message.params === void 0) { - if (type !== void 0) { - if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { - logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`); - } - } - notificationHandler(); - } else if (Array.isArray(message.params)) { - const params = message.params; - if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) { - notificationHandler({ token: params[0], value: params[1] }); - } else { - if (type !== void 0) { - if (type.parameterStructures === messages_1.ParameterStructures.byName) { - logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); - } - if (type.numberOfParams !== message.params.length) { - logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`); - } - } - notificationHandler(...params); - } - } else { - if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { - logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); - } - notificationHandler(message.params); - } - } else if (starNotificationHandler) { - starNotificationHandler(message.method, message.params); - } - } catch (error) { - if (error.message) { - logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); - } else { - logger.error(`Notification handler '${message.method}' failed unexpectedly.`); - } - } - } else { - unhandledNotificationEmitter.fire(message); - } - } - function handleInvalidMessage(message) { - if (!message) { - logger.error("Received empty message."); - return; - } - logger.error(`Received message which is neither a response nor a notification message: -${JSON.stringify(message, null, 4)}`); - const responseMessage = message; - if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) { - const key = responseMessage.id; - const responseHandler = responsePromises.get(key); - if (responseHandler) { - responseHandler.reject(new Error("The received response has neither a result nor an error property.")); - } - } - } - function stringifyTrace(params) { - if (params === void 0 || params === null) { - return void 0; - } - switch (trace) { - case Trace.Verbose: - return JSON.stringify(params, null, 4); - case Trace.Compact: - return JSON.stringify(params); - default: - return void 0; - } - } - function traceSendingRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { - data = `Params: ${stringifyTrace(message.params)} - -`; - } - tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); - } else { - logLSPMessage("send-request", message); - } - } - function traceSendingNotification(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if (trace === Trace.Verbose || trace === Trace.Compact) { - if (message.params) { - data = `Params: ${stringifyTrace(message.params)} - -`; - } else { - data = "No parameters provided.\n\n"; - } - } - tracer.log(`Sending notification '${message.method}'.`, data); - } else { - logLSPMessage("send-notification", message); - } - } - function traceSendingResponse(message, method, startTime) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if (trace === Trace.Verbose || trace === Trace.Compact) { - if (message.error && message.error.data) { - data = `Error data: ${stringifyTrace(message.error.data)} - -`; - } else { - if (message.result) { - data = `Result: ${stringifyTrace(message.result)} - -`; - } else if (message.error === void 0) { - data = "No result returned.\n\n"; - } - } - } - tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); - } else { - logLSPMessage("send-response", message); - } - } - function traceReceivedRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { - data = `Params: ${stringifyTrace(message.params)} - -`; - } - tracer.log(`Received request '${message.method} - (${message.id})'.`, data); - } else { - logLSPMessage("receive-request", message); - } - } - function traceReceivedNotification(message) { - if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if (trace === Trace.Verbose || trace === Trace.Compact) { - if (message.params) { - data = `Params: ${stringifyTrace(message.params)} - -`; - } else { - data = "No parameters provided.\n\n"; - } - } - tracer.log(`Received notification '${message.method}'.`, data); - } else { - logLSPMessage("receive-notification", message); - } - } - function traceReceivedResponse(message, responsePromise) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = void 0; - if (trace === Trace.Verbose || trace === Trace.Compact) { - if (message.error && message.error.data) { - data = `Error data: ${stringifyTrace(message.error.data)} - -`; - } else { - if (message.result) { - data = `Result: ${stringifyTrace(message.result)} - -`; - } else if (message.error === void 0) { - data = "No result returned.\n\n"; - } - } - } - if (responsePromise) { - const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; - tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); - } else { - tracer.log(`Received response ${message.id} without active response promise.`, data); - } - } else { - logLSPMessage("receive-response", message); - } - } - function logLSPMessage(type, message) { - if (!tracer || trace === Trace.Off) { - return; - } - const lspMessage = { - isLSPMessage: true, - type, - message, - timestamp: Date.now() - }; - tracer.log(lspMessage); - } - function throwIfClosedOrDisposed() { - if (isClosed()) { - throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); - } - if (isDisposed()) { - throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); - } - } - function throwIfListening() { - if (isListening()) { - throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); - } - } - function throwIfNotListening() { - if (!isListening()) { - throw new Error("Call listen() first."); - } - } - function undefinedToNull(param) { - if (param === void 0) { - return null; - } else { - return param; - } - } - function nullToUndefined(param) { - if (param === null) { - return void 0; - } else { - return param; - } - } - function isNamedParam(param) { - return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; - } - function computeSingleParam(parameterStructures, param) { - switch (parameterStructures) { - case messages_1.ParameterStructures.auto: - if (isNamedParam(param)) { - return nullToUndefined(param); - } else { - return [undefinedToNull(param)]; - } - case messages_1.ParameterStructures.byName: - if (!isNamedParam(param)) { - throw new Error(`Received parameters by name but param is not an object literal.`); - } - return nullToUndefined(param); - case messages_1.ParameterStructures.byPosition: - return [undefinedToNull(param)]; - default: - throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); - } - } - function computeMessageParams(type, params) { - let result; - const numberOfParams = type.numberOfParams; - switch (numberOfParams) { - case 0: - result = void 0; - break; - case 1: - result = computeSingleParam(type.parameterStructures, params[0]); - break; - default: - result = []; - for (let i = 0; i < params.length && i < numberOfParams; i++) { - result.push(undefinedToNull(params[i])); - } - if (params.length < numberOfParams) { - for (let i = params.length; i < numberOfParams; i++) { - result.push(null); - } - } - break; - } - return result; - } - const connection2 = { - sendNotification: (type, ...args) => { - throwIfClosedOrDisposed(); - let method; - let messageParams; - if (Is2.string(type)) { - method = type; - const first2 = args[0]; - let paramStart = 0; - let parameterStructures = messages_1.ParameterStructures.auto; - if (messages_1.ParameterStructures.is(first2)) { - paramStart = 1; - parameterStructures = first2; - } - let paramEnd = args.length; - const numberOfParams = paramEnd - paramStart; - switch (numberOfParams) { - case 0: - messageParams = void 0; - break; - case 1: - messageParams = computeSingleParam(parameterStructures, args[paramStart]); - break; - default: - if (parameterStructures === messages_1.ParameterStructures.byName) { - throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); - } - messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); - break; - } - } else { - const params = args; - method = type.method; - messageParams = computeMessageParams(type, params); - } - const notificationMessage = { - jsonrpc: version, - method, - params: messageParams - }; - traceSendingNotification(notificationMessage); - return messageWriter.write(notificationMessage).catch((error) => { - logger.error(`Sending notification failed.`); - throw error; - }); - }, - onNotification: (type, handler) => { - throwIfClosedOrDisposed(); - let method; - if (Is2.func(type)) { - starNotificationHandler = type; - } else if (handler) { - if (Is2.string(type)) { - method = type; - notificationHandlers.set(type, { type: void 0, handler }); - } else { - method = type.method; - notificationHandlers.set(type.method, { type, handler }); - } - } - return { - dispose: () => { - if (method !== void 0) { - notificationHandlers.delete(method); - } else { - starNotificationHandler = void 0; - } - } - }; - }, - onProgress: (_type, token, handler) => { - if (progressHandlers.has(token)) { - throw new Error(`Progress handler for token ${token} already registered`); - } - progressHandlers.set(token, handler); - return { - dispose: () => { - progressHandlers.delete(token); - } - }; - }, - sendProgress: (_type, token, value) => { - return connection2.sendNotification(ProgressNotification.type, { token, value }); - }, - onUnhandledProgress: unhandledProgressEmitter.event, - sendRequest: (type, ...args) => { - throwIfClosedOrDisposed(); - throwIfNotListening(); - let method; - let messageParams; - let token = void 0; - if (Is2.string(type)) { - method = type; - const first2 = args[0]; - const last2 = args[args.length - 1]; - let paramStart = 0; - let parameterStructures = messages_1.ParameterStructures.auto; - if (messages_1.ParameterStructures.is(first2)) { - paramStart = 1; - parameterStructures = first2; - } - let paramEnd = args.length; - if (cancellation_1.CancellationToken.is(last2)) { - paramEnd = paramEnd - 1; - token = last2; - } - const numberOfParams = paramEnd - paramStart; - switch (numberOfParams) { - case 0: - messageParams = void 0; - break; - case 1: - messageParams = computeSingleParam(parameterStructures, args[paramStart]); - break; - default: - if (parameterStructures === messages_1.ParameterStructures.byName) { - throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); - } - messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); - break; - } - } else { - const params = args; - method = type.method; - messageParams = computeMessageParams(type, params); - const numberOfParams = type.numberOfParams; - token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; - } - const id = sequenceNumber++; - let disposable; - if (token) { - disposable = token.onCancellationRequested(() => { - const p = cancellationStrategy.sender.sendCancellation(connection2, id); - if (p === void 0) { - logger.log(`Received no promise from cancellation strategy when cancelling id ${id}`); - return Promise.resolve(); - } else { - return p.catch(() => { - logger.log(`Sending cancellation messages for id ${id} failed`); - }); - } - }); - } - const requestMessage = { - jsonrpc: version, - id, - method, - params: messageParams - }; - traceSendingRequest(requestMessage); - if (typeof cancellationStrategy.sender.enableCancellation === "function") { - cancellationStrategy.sender.enableCancellation(requestMessage); - } - return new Promise(async (resolve, reject2) => { - const resolveWithCleanup = (r) => { - resolve(r); - cancellationStrategy.sender.cleanup(id); - disposable == null ? void 0 : disposable.dispose(); - }; - const rejectWithCleanup = (r) => { - reject2(r); - cancellationStrategy.sender.cleanup(id); - disposable == null ? void 0 : disposable.dispose(); - }; - const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; - try { - await messageWriter.write(requestMessage); - responsePromises.set(id, responsePromise); - } catch (error) { - logger.error(`Sending request failed.`); - responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : "Unknown reason")); - throw error; - } - }); - }, - onRequest: (type, handler) => { - throwIfClosedOrDisposed(); - let method = null; - if (StarRequestHandler.is(type)) { - method = void 0; - starRequestHandler = type; - } else if (Is2.string(type)) { - method = null; - if (handler !== void 0) { - method = type; - requestHandlers.set(type, { handler, type: void 0 }); - } - } else { - if (handler !== void 0) { - method = type.method; - requestHandlers.set(type.method, { type, handler }); - } - } - return { - dispose: () => { - if (method === null) { - return; - } - if (method !== void 0) { - requestHandlers.delete(method); - } else { - starRequestHandler = void 0; - } - } - }; - }, - hasPendingResponse: () => { - return responsePromises.size > 0; - }, - trace: async (_value, _tracer, sendNotificationOrTraceOptions) => { - let _sendNotification = false; - let _traceFormat = TraceFormat.Text; - if (sendNotificationOrTraceOptions !== void 0) { - if (Is2.boolean(sendNotificationOrTraceOptions)) { - _sendNotification = sendNotificationOrTraceOptions; - } else { - _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; - _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; - } - } - trace = _value; - traceFormat = _traceFormat; - if (trace === Trace.Off) { - tracer = void 0; - } else { - tracer = _tracer; - } - if (_sendNotification && !isClosed() && !isDisposed()) { - await connection2.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); - } - }, - onError: errorEmitter.event, - onClose: closeEmitter.event, - onUnhandledNotification: unhandledNotificationEmitter.event, - onDispose: disposeEmitter.event, - end: () => { - messageWriter.end(); - }, - dispose: () => { - if (isDisposed()) { - return; - } - state = ConnectionState.Disposed; - disposeEmitter.fire(void 0); - const error = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed"); - for (const promise of responsePromises.values()) { - promise.reject(error); - } - responsePromises = /* @__PURE__ */ new Map(); - requestTokens = /* @__PURE__ */ new Map(); - knownCanceledRequests = /* @__PURE__ */ new Set(); - messageQueue = new linkedMap_1.LinkedMap(); - if (Is2.func(messageWriter.dispose)) { - messageWriter.dispose(); - } - if (Is2.func(messageReader.dispose)) { - messageReader.dispose(); - } - }, - listen: () => { - throwIfClosedOrDisposed(); - throwIfListening(); - state = ConnectionState.Listening; - messageReader.listen(callback); - }, - inspect: () => { - (0, ral_1.default)().console.log("inspect"); - } - }; - connection2.onNotification(LogTraceNotification.type, (params) => { - if (trace === Trace.Off || !tracer) { - return; - } - const verbose = trace === Trace.Verbose || trace === Trace.Compact; - tracer.log(params.message, verbose ? params.verbose : void 0); - }); - connection2.onNotification(ProgressNotification.type, (params) => { - const handler = progressHandlers.get(params.token); - if (handler) { - handler(params.value); - } else { - unhandledProgressEmitter.fire(params); - } - }); - return connection2; - } - exports2.createMessageConnection = createMessageConnection; - } -}); - -// node_modules/vscode-jsonrpc/lib/common/api.js -var require_api = __commonJS({ - "node_modules/vscode-jsonrpc/lib/common/api.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ProgressType = exports2.ProgressToken = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.AbstractMessageBuffer = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.LRUCache = exports2.Touch = exports2.LinkedMap = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.Message = exports2.RAL = void 0; - exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = void 0; - var messages_1 = require_messages(); - Object.defineProperty(exports2, "Message", { enumerable: true, get: function() { - return messages_1.Message; - } }); - Object.defineProperty(exports2, "RequestType", { enumerable: true, get: function() { - return messages_1.RequestType; - } }); - Object.defineProperty(exports2, "RequestType0", { enumerable: true, get: function() { - return messages_1.RequestType0; - } }); - Object.defineProperty(exports2, "RequestType1", { enumerable: true, get: function() { - return messages_1.RequestType1; - } }); - Object.defineProperty(exports2, "RequestType2", { enumerable: true, get: function() { - return messages_1.RequestType2; - } }); - Object.defineProperty(exports2, "RequestType3", { enumerable: true, get: function() { - return messages_1.RequestType3; - } }); - Object.defineProperty(exports2, "RequestType4", { enumerable: true, get: function() { - return messages_1.RequestType4; - } }); - Object.defineProperty(exports2, "RequestType5", { enumerable: true, get: function() { - return messages_1.RequestType5; - } }); - Object.defineProperty(exports2, "RequestType6", { enumerable: true, get: function() { - return messages_1.RequestType6; - } }); - Object.defineProperty(exports2, "RequestType7", { enumerable: true, get: function() { - return messages_1.RequestType7; - } }); - Object.defineProperty(exports2, "RequestType8", { enumerable: true, get: function() { - return messages_1.RequestType8; - } }); - Object.defineProperty(exports2, "RequestType9", { enumerable: true, get: function() { - return messages_1.RequestType9; - } }); - Object.defineProperty(exports2, "ResponseError", { enumerable: true, get: function() { - return messages_1.ResponseError; - } }); - Object.defineProperty(exports2, "ErrorCodes", { enumerable: true, get: function() { - return messages_1.ErrorCodes; - } }); - Object.defineProperty(exports2, "NotificationType", { enumerable: true, get: function() { - return messages_1.NotificationType; - } }); - Object.defineProperty(exports2, "NotificationType0", { enumerable: true, get: function() { - return messages_1.NotificationType0; - } }); - Object.defineProperty(exports2, "NotificationType1", { enumerable: true, get: function() { - return messages_1.NotificationType1; - } }); - Object.defineProperty(exports2, "NotificationType2", { enumerable: true, get: function() { - return messages_1.NotificationType2; - } }); - Object.defineProperty(exports2, "NotificationType3", { enumerable: true, get: function() { - return messages_1.NotificationType3; - } }); - Object.defineProperty(exports2, "NotificationType4", { enumerable: true, get: function() { - return messages_1.NotificationType4; - } }); - Object.defineProperty(exports2, "NotificationType5", { enumerable: true, get: function() { - return messages_1.NotificationType5; - } }); - Object.defineProperty(exports2, "NotificationType6", { enumerable: true, get: function() { - return messages_1.NotificationType6; - } }); - Object.defineProperty(exports2, "NotificationType7", { enumerable: true, get: function() { - return messages_1.NotificationType7; - } }); - Object.defineProperty(exports2, "NotificationType8", { enumerable: true, get: function() { - return messages_1.NotificationType8; - } }); - Object.defineProperty(exports2, "NotificationType9", { enumerable: true, get: function() { - return messages_1.NotificationType9; - } }); - Object.defineProperty(exports2, "ParameterStructures", { enumerable: true, get: function() { - return messages_1.ParameterStructures; - } }); - var linkedMap_1 = require_linkedMap(); - Object.defineProperty(exports2, "LinkedMap", { enumerable: true, get: function() { - return linkedMap_1.LinkedMap; - } }); - Object.defineProperty(exports2, "LRUCache", { enumerable: true, get: function() { - return linkedMap_1.LRUCache; - } }); - Object.defineProperty(exports2, "Touch", { enumerable: true, get: function() { - return linkedMap_1.Touch; - } }); - var disposable_1 = require_disposable(); - Object.defineProperty(exports2, "Disposable", { enumerable: true, get: function() { - return disposable_1.Disposable; - } }); - var events_1 = require_events(); - Object.defineProperty(exports2, "Event", { enumerable: true, get: function() { - return events_1.Event; - } }); - Object.defineProperty(exports2, "Emitter", { enumerable: true, get: function() { - return events_1.Emitter; - } }); - var cancellation_1 = require_cancellation(); - Object.defineProperty(exports2, "CancellationTokenSource", { enumerable: true, get: function() { - return cancellation_1.CancellationTokenSource; - } }); - Object.defineProperty(exports2, "CancellationToken", { enumerable: true, get: function() { - return cancellation_1.CancellationToken; - } }); - var sharedArrayCancellation_1 = require_sharedArrayCancellation(); - Object.defineProperty(exports2, "SharedArraySenderStrategy", { enumerable: true, get: function() { - return sharedArrayCancellation_1.SharedArraySenderStrategy; - } }); - Object.defineProperty(exports2, "SharedArrayReceiverStrategy", { enumerable: true, get: function() { - return sharedArrayCancellation_1.SharedArrayReceiverStrategy; - } }); - var messageReader_1 = require_messageReader(); - Object.defineProperty(exports2, "MessageReader", { enumerable: true, get: function() { - return messageReader_1.MessageReader; - } }); - Object.defineProperty(exports2, "AbstractMessageReader", { enumerable: true, get: function() { - return messageReader_1.AbstractMessageReader; - } }); - Object.defineProperty(exports2, "ReadableStreamMessageReader", { enumerable: true, get: function() { - return messageReader_1.ReadableStreamMessageReader; - } }); - var messageWriter_1 = require_messageWriter(); - Object.defineProperty(exports2, "MessageWriter", { enumerable: true, get: function() { - return messageWriter_1.MessageWriter; - } }); - Object.defineProperty(exports2, "AbstractMessageWriter", { enumerable: true, get: function() { - return messageWriter_1.AbstractMessageWriter; - } }); - Object.defineProperty(exports2, "WriteableStreamMessageWriter", { enumerable: true, get: function() { - return messageWriter_1.WriteableStreamMessageWriter; - } }); - var messageBuffer_1 = require_messageBuffer(); - Object.defineProperty(exports2, "AbstractMessageBuffer", { enumerable: true, get: function() { - return messageBuffer_1.AbstractMessageBuffer; - } }); - var connection_1 = require_connection(); - Object.defineProperty(exports2, "ConnectionStrategy", { enumerable: true, get: function() { - return connection_1.ConnectionStrategy; - } }); - Object.defineProperty(exports2, "ConnectionOptions", { enumerable: true, get: function() { - return connection_1.ConnectionOptions; - } }); - Object.defineProperty(exports2, "NullLogger", { enumerable: true, get: function() { - return connection_1.NullLogger; - } }); - Object.defineProperty(exports2, "createMessageConnection", { enumerable: true, get: function() { - return connection_1.createMessageConnection; - } }); - Object.defineProperty(exports2, "ProgressToken", { enumerable: true, get: function() { - return connection_1.ProgressToken; - } }); - Object.defineProperty(exports2, "ProgressType", { enumerable: true, get: function() { - return connection_1.ProgressType; - } }); - Object.defineProperty(exports2, "Trace", { enumerable: true, get: function() { - return connection_1.Trace; - } }); - Object.defineProperty(exports2, "TraceValues", { enumerable: true, get: function() { - return connection_1.TraceValues; - } }); - Object.defineProperty(exports2, "TraceFormat", { enumerable: true, get: function() { - return connection_1.TraceFormat; - } }); - Object.defineProperty(exports2, "SetTraceNotification", { enumerable: true, get: function() { - return connection_1.SetTraceNotification; - } }); - Object.defineProperty(exports2, "LogTraceNotification", { enumerable: true, get: function() { - return connection_1.LogTraceNotification; - } }); - Object.defineProperty(exports2, "ConnectionErrors", { enumerable: true, get: function() { - return connection_1.ConnectionErrors; - } }); - Object.defineProperty(exports2, "ConnectionError", { enumerable: true, get: function() { - return connection_1.ConnectionError; - } }); - Object.defineProperty(exports2, "CancellationReceiverStrategy", { enumerable: true, get: function() { - return connection_1.CancellationReceiverStrategy; - } }); - Object.defineProperty(exports2, "CancellationSenderStrategy", { enumerable: true, get: function() { - return connection_1.CancellationSenderStrategy; - } }); - Object.defineProperty(exports2, "CancellationStrategy", { enumerable: true, get: function() { - return connection_1.CancellationStrategy; - } }); - Object.defineProperty(exports2, "MessageStrategy", { enumerable: true, get: function() { - return connection_1.MessageStrategy; - } }); - var ral_1 = require_ral(); - exports2.RAL = ral_1.default; - } -}); - -// node_modules/vscode-jsonrpc/lib/node/ril.js -var require_ril = __commonJS({ - "node_modules/vscode-jsonrpc/lib/node/ril.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var util_1 = require("util"); - var api_1 = require_api(); - var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer { - constructor(encoding = "utf-8") { - super(encoding); - } - emptyBuffer() { - return _MessageBuffer.emptyBuffer; - } - fromString(value, encoding) { - return Buffer.from(value, encoding); - } - toString(value, encoding) { - if (value instanceof Buffer) { - return value.toString(encoding); - } else { - return new util_1.TextDecoder(encoding).decode(value); - } - } - asNative(buffer, length) { - if (length === void 0) { - return buffer instanceof Buffer ? buffer : Buffer.from(buffer); - } else { - return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); - } - } - allocNative(length) { - return Buffer.allocUnsafe(length); - } - }; - MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); - var ReadableStreamWrapper = class { - constructor(stream2) { - this.stream = stream2; - } - onClose(listener) { - this.stream.on("close", listener); - return api_1.Disposable.create(() => this.stream.off("close", listener)); - } - onError(listener) { - this.stream.on("error", listener); - return api_1.Disposable.create(() => this.stream.off("error", listener)); - } - onEnd(listener) { - this.stream.on("end", listener); - return api_1.Disposable.create(() => this.stream.off("end", listener)); - } - onData(listener) { - this.stream.on("data", listener); - return api_1.Disposable.create(() => this.stream.off("data", listener)); - } - }; - var WritableStreamWrapper = class { - constructor(stream2) { - this.stream = stream2; - } - onClose(listener) { - this.stream.on("close", listener); - return api_1.Disposable.create(() => this.stream.off("close", listener)); - } - onError(listener) { - this.stream.on("error", listener); - return api_1.Disposable.create(() => this.stream.off("error", listener)); - } - onEnd(listener) { - this.stream.on("end", listener); - return api_1.Disposable.create(() => this.stream.off("end", listener)); - } - write(data, encoding) { - return new Promise((resolve, reject2) => { - const callback = (error) => { - if (error === void 0 || error === null) { - resolve(); - } else { - reject2(error); - } - }; - if (typeof data === "string") { - this.stream.write(data, encoding, callback); - } else { - this.stream.write(data, callback); - } - }); - } - end() { - this.stream.end(); - } - }; - var _ril = Object.freeze({ - messageBuffer: Object.freeze({ - create: (encoding) => new MessageBuffer(encoding) - }), - applicationJson: Object.freeze({ - encoder: Object.freeze({ - name: "application/json", - encode: (msg, options) => { - try { - return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options.charset)); - } catch (err) { - return Promise.reject(err); - } - } - }), - decoder: Object.freeze({ - name: "application/json", - decode: (buffer, options) => { - try { - if (buffer instanceof Buffer) { - return Promise.resolve(JSON.parse(buffer.toString(options.charset))); - } else { - return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer))); - } - } catch (err) { - return Promise.reject(err); - } - } - }) - }), - stream: Object.freeze({ - asReadableStream: (stream2) => new ReadableStreamWrapper(stream2), - asWritableStream: (stream2) => new WritableStreamWrapper(stream2) - }), - console, - timer: Object.freeze({ - setTimeout(callback, ms, ...args) { - const handle = setTimeout(callback, ms, ...args); - return { dispose: () => clearTimeout(handle) }; - }, - setImmediate(callback, ...args) { - const handle = setImmediate(callback, ...args); - return { dispose: () => clearImmediate(handle) }; - }, - setInterval(callback, ms, ...args) { - const handle = setInterval(callback, ms, ...args); - return { dispose: () => clearInterval(handle) }; - } - }) - }); - function RIL() { - return _ril; - } - (function(RIL2) { - function install() { - api_1.RAL.install(_ril); - } - RIL2.install = install; - })(RIL || (RIL = {})); - exports2.default = RIL; - } -}); - -// node_modules/vscode-jsonrpc/lib/node/main.js -var require_main = __commonJS({ - "node_modules/vscode-jsonrpc/lib/node/main.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) - __createBinding(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.PortMessageWriter = exports2.PortMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0; - var ril_1 = require_ril(); - ril_1.default.install(); - var path = require("path"); - var os = require("os"); - var crypto_1 = require("crypto"); - var net_1 = require("net"); - var api_1 = require_api(); - __exportStar(require_api(), exports2); - var IPCMessageReader = class extends api_1.AbstractMessageReader { - constructor(process2) { - super(); - this.process = process2; - let eventEmitter = this.process; - eventEmitter.on("error", (error) => this.fireError(error)); - eventEmitter.on("close", () => this.fireClose()); - } - listen(callback) { - this.process.on("message", callback); - return api_1.Disposable.create(() => this.process.off("message", callback)); - } - }; - exports2.IPCMessageReader = IPCMessageReader; - var IPCMessageWriter = class extends api_1.AbstractMessageWriter { - constructor(process2) { - super(); - this.process = process2; - this.errorCount = 0; - const eventEmitter = this.process; - eventEmitter.on("error", (error) => this.fireError(error)); - eventEmitter.on("close", () => this.fireClose); - } - write(msg) { - try { - if (typeof this.process.send === "function") { - this.process.send(msg, void 0, void 0, (error) => { - if (error) { - this.errorCount++; - this.handleError(error, msg); - } else { - this.errorCount = 0; - } - }); - } - return Promise.resolve(); - } catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - } - }; - exports2.IPCMessageWriter = IPCMessageWriter; - var PortMessageReader = class extends api_1.AbstractMessageReader { - constructor(port) { - super(); - this.onData = new api_1.Emitter(); - port.on("close", () => this.fireClose); - port.on("error", (error) => this.fireError(error)); - port.on("message", (message) => { - this.onData.fire(message); - }); - } - listen(callback) { - return this.onData.event(callback); - } - }; - exports2.PortMessageReader = PortMessageReader; - var PortMessageWriter = class extends api_1.AbstractMessageWriter { - constructor(port) { - super(); - this.port = port; - this.errorCount = 0; - port.on("close", () => this.fireClose()); - port.on("error", (error) => this.fireError(error)); - } - write(msg) { - try { - this.port.postMessage(msg); - return Promise.resolve(); - } catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - } - }; - exports2.PortMessageWriter = PortMessageWriter; - var SocketMessageReader = class extends api_1.ReadableStreamMessageReader { - constructor(socket, encoding = "utf-8") { - super((0, ril_1.default)().stream.asReadableStream(socket), encoding); - } - }; - exports2.SocketMessageReader = SocketMessageReader; - var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter { - constructor(socket, options) { - super((0, ril_1.default)().stream.asWritableStream(socket), options); - this.socket = socket; - } - dispose() { - super.dispose(); - this.socket.destroy(); - } - }; - exports2.SocketMessageWriter = SocketMessageWriter; - var StreamMessageReader = class extends api_1.ReadableStreamMessageReader { - constructor(readable, encoding) { - super((0, ril_1.default)().stream.asReadableStream(readable), encoding); - } - }; - exports2.StreamMessageReader = StreamMessageReader; - var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter { - constructor(writable, options) { - super((0, ril_1.default)().stream.asWritableStream(writable), options); - } - }; - exports2.StreamMessageWriter = StreamMessageWriter; - var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"]; - var safeIpcPathLengths = /* @__PURE__ */ new Map([ - ["linux", 107], - ["darwin", 103] - ]); - function generateRandomPipeName() { - const randomSuffix = (0, crypto_1.randomBytes)(21).toString("hex"); - if (process.platform === "win32") { - return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; - } - let result; - if (XDG_RUNTIME_DIR) { - result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); - } else { - result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`); - } - const limit = safeIpcPathLengths.get(process.platform); - if (limit !== void 0 && result.length > limit) { - (0, ril_1.default)().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); - } - return result; - } - exports2.generateRandomPipeName = generateRandomPipeName; - function createClientPipeTransport(pipeName, encoding = "utf-8") { - let connectResolve; - const connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject2) => { - let server = (0, net_1.createServer)((socket) => { - server.close(); - connectResolve([ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]); - }); - server.on("error", reject2); - server.listen(pipeName, () => { - server.removeListener("error", reject2); - resolve({ - onConnected: () => { - return connected; - } - }); - }); - }); - } - exports2.createClientPipeTransport = createClientPipeTransport; - function createServerPipeTransport(pipeName, encoding = "utf-8") { - const socket = (0, net_1.createConnection)(pipeName); - return [ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]; - } - exports2.createServerPipeTransport = createServerPipeTransport; - function createClientSocketTransport(port, encoding = "utf-8") { - let connectResolve; - const connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject2) => { - const server = (0, net_1.createServer)((socket) => { - server.close(); - connectResolve([ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]); - }); - server.on("error", reject2); - server.listen(port, "127.0.0.1", () => { - server.removeListener("error", reject2); - resolve({ - onConnected: () => { - return connected; - } - }); - }); - }); - } - exports2.createClientSocketTransport = createClientSocketTransport; - function createServerSocketTransport(port, encoding = "utf-8") { - const socket = (0, net_1.createConnection)(port, "127.0.0.1"); - return [ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]; - } - exports2.createServerSocketTransport = createServerSocketTransport; - function isReadableStream(value) { - const candidate = value; - return candidate.read !== void 0 && candidate.addListener !== void 0; - } - function isWritableStream(value) { - const candidate = value; - return candidate.write !== void 0 && candidate.addListener !== void 0; - } - function createMessageConnection(input, output, logger, options) { - if (!logger) { - logger = api_1.NullLogger; - } - const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; - const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; - if (api_1.ConnectionStrategy.is(options)) { - options = { connectionStrategy: options }; - } - return (0, api_1.createMessageConnection)(reader, writer, logger, options); - } - exports2.createMessageConnection = createMessageConnection; - } -}); - -// node_modules/vscode-jsonrpc/node.js -var require_node = __commonJS({ - "node_modules/vscode-jsonrpc/node.js"(exports2, module2) { - "use strict"; - module2.exports = require_main(); - } -}); - -// node_modules/vscode-languageserver-types/lib/umd/main.js -var require_main2 = __commonJS({ - "node_modules/vscode-languageserver-types/lib/umd/main.js"(exports2, module2) { - (function(factory) { - if (typeof module2 === "object" && typeof module2.exports === "object") { - var v = factory(require, exports2); - if (v !== void 0) - module2.exports = v; - } else if (typeof define === "function" && define.amd) { - define(["require", "exports"], factory); - } - })(function(require2, exports3) { - "use strict"; - Object.defineProperty(exports3, "__esModule", { value: true }); - exports3.TextDocument = exports3.EOL = exports3.WorkspaceFolder = exports3.InlineCompletionContext = exports3.SelectedCompletionInfo = exports3.InlineCompletionTriggerKind = exports3.InlineCompletionList = exports3.InlineCompletionItem = exports3.StringValue = exports3.InlayHint = exports3.InlayHintLabelPart = exports3.InlayHintKind = exports3.InlineValueContext = exports3.InlineValueEvaluatableExpression = exports3.InlineValueVariableLookup = exports3.InlineValueText = exports3.SemanticTokens = exports3.SemanticTokenModifiers = exports3.SemanticTokenTypes = exports3.SelectionRange = exports3.DocumentLink = exports3.FormattingOptions = exports3.CodeLens = exports3.CodeAction = exports3.CodeActionContext = exports3.CodeActionTriggerKind = exports3.CodeActionKind = exports3.DocumentSymbol = exports3.WorkspaceSymbol = exports3.SymbolInformation = exports3.SymbolTag = exports3.SymbolKind = exports3.DocumentHighlight = exports3.DocumentHighlightKind = exports3.SignatureInformation = exports3.ParameterInformation = exports3.Hover = exports3.MarkedString = exports3.CompletionList = exports3.CompletionItem = exports3.CompletionItemLabelDetails = exports3.InsertTextMode = exports3.InsertReplaceEdit = exports3.CompletionItemTag = exports3.InsertTextFormat = exports3.CompletionItemKind = exports3.MarkupContent = exports3.MarkupKind = exports3.TextDocumentItem = exports3.OptionalVersionedTextDocumentIdentifier = exports3.VersionedTextDocumentIdentifier = exports3.TextDocumentIdentifier = exports3.WorkspaceChange = exports3.WorkspaceEdit = exports3.DeleteFile = exports3.RenameFile = exports3.CreateFile = exports3.TextDocumentEdit = exports3.AnnotatedTextEdit = exports3.ChangeAnnotationIdentifier = exports3.ChangeAnnotation = exports3.TextEdit = exports3.Command = exports3.Diagnostic = exports3.CodeDescription = exports3.DiagnosticTag = exports3.DiagnosticSeverity = exports3.DiagnosticRelatedInformation = exports3.FoldingRange = exports3.FoldingRangeKind = exports3.ColorPresentation = exports3.ColorInformation = exports3.Color = exports3.LocationLink = exports3.Location = exports3.Range = exports3.Position = exports3.uinteger = exports3.integer = exports3.URI = exports3.DocumentUri = void 0; - var DocumentUri2; - (function(DocumentUri3) { - function is(value) { - return typeof value === "string"; - } - DocumentUri3.is = is; - })(DocumentUri2 || (exports3.DocumentUri = DocumentUri2 = {})); - var URI3; - (function(URI4) { - function is(value) { - return typeof value === "string"; - } - URI4.is = is; - })(URI3 || (exports3.URI = URI3 = {})); - var integer2; - (function(integer3) { - integer3.MIN_VALUE = -2147483648; - integer3.MAX_VALUE = 2147483647; - function is(value) { - return typeof value === "number" && integer3.MIN_VALUE <= value && value <= integer3.MAX_VALUE; - } - integer3.is = is; - })(integer2 || (exports3.integer = integer2 = {})); - var uinteger2; - (function(uinteger3) { - uinteger3.MIN_VALUE = 0; - uinteger3.MAX_VALUE = 2147483647; - function is(value) { - return typeof value === "number" && uinteger3.MIN_VALUE <= value && value <= uinteger3.MAX_VALUE; - } - uinteger3.is = is; - })(uinteger2 || (exports3.uinteger = uinteger2 = {})); - var Position3; - (function(Position4) { - function create(line, character) { - if (line === Number.MAX_VALUE) { - line = uinteger2.MAX_VALUE; - } - if (character === Number.MAX_VALUE) { - character = uinteger2.MAX_VALUE; - } - return { line, character }; - } - Position4.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.uinteger(candidate.line) && Is2.uinteger(candidate.character); - } - Position4.is = is; - })(Position3 || (exports3.Position = Position3 = {})); - var Range2; - (function(Range3) { - function create(one, two, three, four) { - if (Is2.uinteger(one) && Is2.uinteger(two) && Is2.uinteger(three) && Is2.uinteger(four)) { - return { start: Position3.create(one, two), end: Position3.create(three, four) }; - } else if (Position3.is(one) && Position3.is(two)) { - return { start: one, end: two }; - } else { - throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]")); - } - } - Range3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Position3.is(candidate.start) && Position3.is(candidate.end); - } - Range3.is = is; - })(Range2 || (exports3.Range = Range2 = {})); - var Location3; - (function(Location4) { - function create(uri, range) { - return { uri, range }; - } - Location4.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Range2.is(candidate.range) && (Is2.string(candidate.uri) || Is2.undefined(candidate.uri)); - } - Location4.is = is; - })(Location3 || (exports3.Location = Location3 = {})); - var LocationLink3; - (function(LocationLink4) { - function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { - return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; - } - LocationLink4.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Range2.is(candidate.targetRange) && Is2.string(candidate.targetUri) && Range2.is(candidate.targetSelectionRange) && (Range2.is(candidate.originSelectionRange) || Is2.undefined(candidate.originSelectionRange)); - } - LocationLink4.is = is; - })(LocationLink3 || (exports3.LocationLink = LocationLink3 = {})); - var Color2; - (function(Color3) { - function create(red, green, blue, alpha) { - return { - red, - green, - blue, - alpha - }; - } - Color3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.numberRange(candidate.red, 0, 1) && Is2.numberRange(candidate.green, 0, 1) && Is2.numberRange(candidate.blue, 0, 1) && Is2.numberRange(candidate.alpha, 0, 1); - } - Color3.is = is; - })(Color2 || (exports3.Color = Color2 = {})); - var ColorInformation2; - (function(ColorInformation3) { - function create(range, color) { - return { - range, - color - }; - } - ColorInformation3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Range2.is(candidate.range) && Color2.is(candidate.color); - } - ColorInformation3.is = is; - })(ColorInformation2 || (exports3.ColorInformation = ColorInformation2 = {})); - var ColorPresentation2; - (function(ColorPresentation3) { - function create(label, textEdit, additionalTextEdits) { - return { - label, - textEdit, - additionalTextEdits - }; - } - ColorPresentation3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.string(candidate.label) && (Is2.undefined(candidate.textEdit) || TextEdit2.is(candidate)) && (Is2.undefined(candidate.additionalTextEdits) || Is2.typedArray(candidate.additionalTextEdits, TextEdit2.is)); - } - ColorPresentation3.is = is; - })(ColorPresentation2 || (exports3.ColorPresentation = ColorPresentation2 = {})); - var FoldingRangeKind3; - (function(FoldingRangeKind4) { - FoldingRangeKind4.Comment = "comment"; - FoldingRangeKind4.Imports = "imports"; - FoldingRangeKind4.Region = "region"; - })(FoldingRangeKind3 || (exports3.FoldingRangeKind = FoldingRangeKind3 = {})); - var FoldingRange3; - (function(FoldingRange4) { - function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { - var result = { - startLine, - endLine - }; - if (Is2.defined(startCharacter)) { - result.startCharacter = startCharacter; - } - if (Is2.defined(endCharacter)) { - result.endCharacter = endCharacter; - } - if (Is2.defined(kind)) { - result.kind = kind; - } - if (Is2.defined(collapsedText)) { - result.collapsedText = collapsedText; - } - return result; - } - FoldingRange4.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.uinteger(candidate.startLine) && Is2.uinteger(candidate.startLine) && (Is2.undefined(candidate.startCharacter) || Is2.uinteger(candidate.startCharacter)) && (Is2.undefined(candidate.endCharacter) || Is2.uinteger(candidate.endCharacter)) && (Is2.undefined(candidate.kind) || Is2.string(candidate.kind)); - } - FoldingRange4.is = is; - })(FoldingRange3 || (exports3.FoldingRange = FoldingRange3 = {})); - var DiagnosticRelatedInformation2; - (function(DiagnosticRelatedInformation3) { - function create(location, message) { - return { - location, - message - }; - } - DiagnosticRelatedInformation3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Location3.is(candidate.location) && Is2.string(candidate.message); - } - DiagnosticRelatedInformation3.is = is; - })(DiagnosticRelatedInformation2 || (exports3.DiagnosticRelatedInformation = DiagnosticRelatedInformation2 = {})); - var DiagnosticSeverity2; - (function(DiagnosticSeverity3) { - DiagnosticSeverity3.Error = 1; - DiagnosticSeverity3.Warning = 2; - DiagnosticSeverity3.Information = 3; - DiagnosticSeverity3.Hint = 4; - })(DiagnosticSeverity2 || (exports3.DiagnosticSeverity = DiagnosticSeverity2 = {})); - var DiagnosticTag2; - (function(DiagnosticTag3) { - DiagnosticTag3.Unnecessary = 1; - DiagnosticTag3.Deprecated = 2; - })(DiagnosticTag2 || (exports3.DiagnosticTag = DiagnosticTag2 = {})); - var CodeDescription2; - (function(CodeDescription3) { - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.string(candidate.href); - } - CodeDescription3.is = is; - })(CodeDescription2 || (exports3.CodeDescription = CodeDescription2 = {})); - var Diagnostic2; - (function(Diagnostic3) { - function create(range, message, severity, code, source, relatedInformation) { - var result = { range, message }; - if (Is2.defined(severity)) { - result.severity = severity; - } - if (Is2.defined(code)) { - result.code = code; - } - if (Is2.defined(source)) { - result.source = source; - } - if (Is2.defined(relatedInformation)) { - result.relatedInformation = relatedInformation; - } - return result; - } - Diagnostic3.create = create; - function is(value) { - var _a; - var candidate = value; - return Is2.defined(candidate) && Range2.is(candidate.range) && Is2.string(candidate.message) && (Is2.number(candidate.severity) || Is2.undefined(candidate.severity)) && (Is2.integer(candidate.code) || Is2.string(candidate.code) || Is2.undefined(candidate.code)) && (Is2.undefined(candidate.codeDescription) || Is2.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is2.string(candidate.source) || Is2.undefined(candidate.source)) && (Is2.undefined(candidate.relatedInformation) || Is2.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation2.is)); - } - Diagnostic3.is = is; - })(Diagnostic2 || (exports3.Diagnostic = Diagnostic2 = {})); - var Command2; - (function(Command3) { - function create(title, command) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - var result = { title, command }; - if (Is2.defined(args) && args.length > 0) { - result.arguments = args; - } - return result; - } - Command3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.title) && Is2.string(candidate.command); - } - Command3.is = is; - })(Command2 || (exports3.Command = Command2 = {})); - var TextEdit2; - (function(TextEdit3) { - function replace(range, newText) { - return { range, newText }; - } - TextEdit3.replace = replace; - function insert(position, newText) { - return { range: { start: position, end: position }, newText }; - } - TextEdit3.insert = insert; - function del(range) { - return { range, newText: "" }; - } - TextEdit3.del = del; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.string(candidate.newText) && Range2.is(candidate.range); - } - TextEdit3.is = is; - })(TextEdit2 || (exports3.TextEdit = TextEdit2 = {})); - var ChangeAnnotation2; - (function(ChangeAnnotation3) { - function create(label, needsConfirmation, description) { - var result = { label }; - if (needsConfirmation !== void 0) { - result.needsConfirmation = needsConfirmation; - } - if (description !== void 0) { - result.description = description; - } - return result; - } - ChangeAnnotation3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Is2.string(candidate.label) && (Is2.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is2.string(candidate.description) || candidate.description === void 0); - } - ChangeAnnotation3.is = is; - })(ChangeAnnotation2 || (exports3.ChangeAnnotation = ChangeAnnotation2 = {})); - var ChangeAnnotationIdentifier2; - (function(ChangeAnnotationIdentifier3) { - function is(value) { - var candidate = value; - return Is2.string(candidate); - } - ChangeAnnotationIdentifier3.is = is; - })(ChangeAnnotationIdentifier2 || (exports3.ChangeAnnotationIdentifier = ChangeAnnotationIdentifier2 = {})); - var AnnotatedTextEdit2; - (function(AnnotatedTextEdit3) { - function replace(range, newText, annotation) { - return { range, newText, annotationId: annotation }; - } - AnnotatedTextEdit3.replace = replace; - function insert(position, newText, annotation) { - return { range: { start: position, end: position }, newText, annotationId: annotation }; - } - AnnotatedTextEdit3.insert = insert; - function del(range, annotation) { - return { range, newText: "", annotationId: annotation }; - } - AnnotatedTextEdit3.del = del; - function is(value) { - var candidate = value; - return TextEdit2.is(candidate) && (ChangeAnnotation2.is(candidate.annotationId) || ChangeAnnotationIdentifier2.is(candidate.annotationId)); - } - AnnotatedTextEdit3.is = is; - })(AnnotatedTextEdit2 || (exports3.AnnotatedTextEdit = AnnotatedTextEdit2 = {})); - var TextDocumentEdit2; - (function(TextDocumentEdit3) { - function create(textDocument, edits) { - return { textDocument, edits }; - } - TextDocumentEdit3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && OptionalVersionedTextDocumentIdentifier2.is(candidate.textDocument) && Array.isArray(candidate.edits); - } - TextDocumentEdit3.is = is; - })(TextDocumentEdit2 || (exports3.TextDocumentEdit = TextDocumentEdit2 = {})); - var CreateFile2; - (function(CreateFile3) { - function create(uri, options, annotation) { - var result = { - kind: "create", - uri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - CreateFile3.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === "create" && Is2.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is2.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is2.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier2.is(candidate.annotationId)); - } - CreateFile3.is = is; - })(CreateFile2 || (exports3.CreateFile = CreateFile2 = {})); - var RenameFile2; - (function(RenameFile3) { - function create(oldUri, newUri, options, annotation) { - var result = { - kind: "rename", - oldUri, - newUri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - RenameFile3.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === "rename" && Is2.string(candidate.oldUri) && Is2.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is2.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is2.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier2.is(candidate.annotationId)); - } - RenameFile3.is = is; - })(RenameFile2 || (exports3.RenameFile = RenameFile2 = {})); - var DeleteFile2; - (function(DeleteFile3) { - function create(uri, options, annotation) { - var result = { - kind: "delete", - uri - }; - if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - DeleteFile3.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === "delete" && Is2.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is2.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is2.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier2.is(candidate.annotationId)); - } - DeleteFile3.is = is; - })(DeleteFile2 || (exports3.DeleteFile = DeleteFile2 = {})); - var WorkspaceEdit2; - (function(WorkspaceEdit3) { - function is(value) { - var candidate = value; - return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) { - if (Is2.string(change.kind)) { - return CreateFile2.is(change) || RenameFile2.is(change) || DeleteFile2.is(change); - } else { - return TextDocumentEdit2.is(change); - } - })); - } - WorkspaceEdit3.is = is; - })(WorkspaceEdit2 || (exports3.WorkspaceEdit = WorkspaceEdit2 = {})); - var TextEditChangeImpl = ( - /** @class */ - function() { - function TextEditChangeImpl2(edits, changeAnnotations) { - this.edits = edits; - this.changeAnnotations = changeAnnotations; - } - TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) { - var edit; - var id; - if (annotation === void 0) { - edit = TextEdit2.insert(position, newText); - } else if (ChangeAnnotationIdentifier2.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit2.insert(position, newText, annotation); - } else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit2.insert(position, newText, id); - } - this.edits.push(edit); - if (id !== void 0) { - return id; - } - }; - TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) { - var edit; - var id; - if (annotation === void 0) { - edit = TextEdit2.replace(range, newText); - } else if (ChangeAnnotationIdentifier2.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit2.replace(range, newText, annotation); - } else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit2.replace(range, newText, id); - } - this.edits.push(edit); - if (id !== void 0) { - return id; - } - }; - TextEditChangeImpl2.prototype.delete = function(range, annotation) { - var edit; - var id; - if (annotation === void 0) { - edit = TextEdit2.del(range); - } else if (ChangeAnnotationIdentifier2.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit2.del(range, annotation); - } else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit2.del(range, id); - } - this.edits.push(edit); - if (id !== void 0) { - return id; - } - }; - TextEditChangeImpl2.prototype.add = function(edit) { - this.edits.push(edit); - }; - TextEditChangeImpl2.prototype.all = function() { - return this.edits; - }; - TextEditChangeImpl2.prototype.clear = function() { - this.edits.splice(0, this.edits.length); - }; - TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) { - if (value === void 0) { - throw new Error("Text edit change is not configured to manage change annotations."); - } - }; - return TextEditChangeImpl2; - }() - ); - var ChangeAnnotations = ( - /** @class */ - function() { - function ChangeAnnotations2(annotations) { - this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; - this._counter = 0; - this._size = 0; - } - ChangeAnnotations2.prototype.all = function() { - return this._annotations; - }; - Object.defineProperty(ChangeAnnotations2.prototype, "size", { - get: function() { - return this._size; - }, - enumerable: false, - configurable: true - }); - ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) { - var id; - if (ChangeAnnotationIdentifier2.is(idOrAnnotation)) { - id = idOrAnnotation; - } else { - id = this.nextId(); - annotation = idOrAnnotation; - } - if (this._annotations[id] !== void 0) { - throw new Error("Id ".concat(id, " is already in use.")); - } - if (annotation === void 0) { - throw new Error("No annotation provided for id ".concat(id)); - } - this._annotations[id] = annotation; - this._size++; - return id; - }; - ChangeAnnotations2.prototype.nextId = function() { - this._counter++; - return this._counter.toString(); - }; - return ChangeAnnotations2; - }() - ); - var WorkspaceChange = ( - /** @class */ - function() { - function WorkspaceChange2(workspaceEdit) { - var _this = this; - this._textEditChanges = /* @__PURE__ */ Object.create(null); - if (workspaceEdit !== void 0) { - this._workspaceEdit = workspaceEdit; - if (workspaceEdit.documentChanges) { - this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); - workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - workspaceEdit.documentChanges.forEach(function(change) { - if (TextDocumentEdit2.is(change)) { - var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); - _this._textEditChanges[change.textDocument.uri] = textEditChange; - } - }); - } else if (workspaceEdit.changes) { - Object.keys(workspaceEdit.changes).forEach(function(key) { - var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); - _this._textEditChanges[key] = textEditChange; - }); - } - } else { - this._workspaceEdit = {}; - } - } - Object.defineProperty(WorkspaceChange2.prototype, "edit", { - /** - * Returns the underlying {@link WorkspaceEdit} literal - * use to be returned from a workspace edit operation like rename. - */ - get: function() { - this.initDocumentChanges(); - if (this._changeAnnotations !== void 0) { - if (this._changeAnnotations.size === 0) { - this._workspaceEdit.changeAnnotations = void 0; - } else { - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - } - return this._workspaceEdit; - }, - enumerable: false, - configurable: true - }); - WorkspaceChange2.prototype.getTextEditChange = function(key) { - if (OptionalVersionedTextDocumentIdentifier2.is(key)) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === void 0) { - throw new Error("Workspace edit is not configured for document changes."); - } - var textDocument = { uri: key.uri, version: key.version }; - var result = this._textEditChanges[textDocument.uri]; - if (!result) { - var edits = []; - var textDocumentEdit = { - textDocument, - edits - }; - this._workspaceEdit.documentChanges.push(textDocumentEdit); - result = new TextEditChangeImpl(edits, this._changeAnnotations); - this._textEditChanges[textDocument.uri] = result; - } - return result; - } else { - this.initChanges(); - if (this._workspaceEdit.changes === void 0) { - throw new Error("Workspace edit is not configured for normal text edit changes."); - } - var result = this._textEditChanges[key]; - if (!result) { - var edits = []; - this._workspaceEdit.changes[key] = edits; - result = new TextEditChangeImpl(edits); - this._textEditChanges[key] = result; - } - return result; - } - }; - WorkspaceChange2.prototype.initDocumentChanges = function() { - if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { - this._changeAnnotations = new ChangeAnnotations(); - this._workspaceEdit.documentChanges = []; - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - }; - WorkspaceChange2.prototype.initChanges = function() { - if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { - this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); - } - }; - WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === void 0) { - throw new Error("Workspace edit is not configured for document changes."); - } - var annotation; - if (ChangeAnnotation2.is(optionsOrAnnotation) || ChangeAnnotationIdentifier2.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === void 0) { - operation = CreateFile2.create(uri, options); - } else { - id = ChangeAnnotationIdentifier2.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = CreateFile2.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== void 0) { - return id; - } - }; - WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === void 0) { - throw new Error("Workspace edit is not configured for document changes."); - } - var annotation; - if (ChangeAnnotation2.is(optionsOrAnnotation) || ChangeAnnotationIdentifier2.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === void 0) { - operation = RenameFile2.create(oldUri, newUri, options); - } else { - id = ChangeAnnotationIdentifier2.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = RenameFile2.create(oldUri, newUri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== void 0) { - return id; - } - }; - WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === void 0) { - throw new Error("Workspace edit is not configured for document changes."); - } - var annotation; - if (ChangeAnnotation2.is(optionsOrAnnotation) || ChangeAnnotationIdentifier2.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === void 0) { - operation = DeleteFile2.create(uri, options); - } else { - id = ChangeAnnotationIdentifier2.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = DeleteFile2.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== void 0) { - return id; - } - }; - return WorkspaceChange2; - }() - ); - exports3.WorkspaceChange = WorkspaceChange; - var TextDocumentIdentifier2; - (function(TextDocumentIdentifier3) { - function create(uri) { - return { uri }; - } - TextDocumentIdentifier3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.uri); - } - TextDocumentIdentifier3.is = is; - })(TextDocumentIdentifier2 || (exports3.TextDocumentIdentifier = TextDocumentIdentifier2 = {})); - var VersionedTextDocumentIdentifier2; - (function(VersionedTextDocumentIdentifier3) { - function create(uri, version) { - return { uri, version }; - } - VersionedTextDocumentIdentifier3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.uri) && Is2.integer(candidate.version); - } - VersionedTextDocumentIdentifier3.is = is; - })(VersionedTextDocumentIdentifier2 || (exports3.VersionedTextDocumentIdentifier = VersionedTextDocumentIdentifier2 = {})); - var OptionalVersionedTextDocumentIdentifier2; - (function(OptionalVersionedTextDocumentIdentifier3) { - function create(uri, version) { - return { uri, version }; - } - OptionalVersionedTextDocumentIdentifier3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.uri) && (candidate.version === null || Is2.integer(candidate.version)); - } - OptionalVersionedTextDocumentIdentifier3.is = is; - })(OptionalVersionedTextDocumentIdentifier2 || (exports3.OptionalVersionedTextDocumentIdentifier = OptionalVersionedTextDocumentIdentifier2 = {})); - var TextDocumentItem2; - (function(TextDocumentItem3) { - function create(uri, languageId, version, text) { - return { uri, languageId, version, text }; - } - TextDocumentItem3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.uri) && Is2.string(candidate.languageId) && Is2.integer(candidate.version) && Is2.string(candidate.text); - } - TextDocumentItem3.is = is; - })(TextDocumentItem2 || (exports3.TextDocumentItem = TextDocumentItem2 = {})); - var MarkupKind2; - (function(MarkupKind3) { - MarkupKind3.PlainText = "plaintext"; - MarkupKind3.Markdown = "markdown"; - function is(value) { - var candidate = value; - return candidate === MarkupKind3.PlainText || candidate === MarkupKind3.Markdown; - } - MarkupKind3.is = is; - })(MarkupKind2 || (exports3.MarkupKind = MarkupKind2 = {})); - var MarkupContent2; - (function(MarkupContent3) { - function is(value) { - var candidate = value; - return Is2.objectLiteral(value) && MarkupKind2.is(candidate.kind) && Is2.string(candidate.value); - } - MarkupContent3.is = is; - })(MarkupContent2 || (exports3.MarkupContent = MarkupContent2 = {})); - var CompletionItemKind4; - (function(CompletionItemKind5) { - CompletionItemKind5.Text = 1; - CompletionItemKind5.Method = 2; - CompletionItemKind5.Function = 3; - CompletionItemKind5.Constructor = 4; - CompletionItemKind5.Field = 5; - CompletionItemKind5.Variable = 6; - CompletionItemKind5.Class = 7; - CompletionItemKind5.Interface = 8; - CompletionItemKind5.Module = 9; - CompletionItemKind5.Property = 10; - CompletionItemKind5.Unit = 11; - CompletionItemKind5.Value = 12; - CompletionItemKind5.Enum = 13; - CompletionItemKind5.Keyword = 14; - CompletionItemKind5.Snippet = 15; - CompletionItemKind5.Color = 16; - CompletionItemKind5.File = 17; - CompletionItemKind5.Reference = 18; - CompletionItemKind5.Folder = 19; - CompletionItemKind5.EnumMember = 20; - CompletionItemKind5.Constant = 21; - CompletionItemKind5.Struct = 22; - CompletionItemKind5.Event = 23; - CompletionItemKind5.Operator = 24; - CompletionItemKind5.TypeParameter = 25; - })(CompletionItemKind4 || (exports3.CompletionItemKind = CompletionItemKind4 = {})); - var InsertTextFormat2; - (function(InsertTextFormat3) { - InsertTextFormat3.PlainText = 1; - InsertTextFormat3.Snippet = 2; - })(InsertTextFormat2 || (exports3.InsertTextFormat = InsertTextFormat2 = {})); - var CompletionItemTag2; - (function(CompletionItemTag3) { - CompletionItemTag3.Deprecated = 1; - })(CompletionItemTag2 || (exports3.CompletionItemTag = CompletionItemTag2 = {})); - var InsertReplaceEdit2; - (function(InsertReplaceEdit3) { - function create(newText, insert, replace) { - return { newText, insert, replace }; - } - InsertReplaceEdit3.create = create; - function is(value) { - var candidate = value; - return candidate && Is2.string(candidate.newText) && Range2.is(candidate.insert) && Range2.is(candidate.replace); - } - InsertReplaceEdit3.is = is; - })(InsertReplaceEdit2 || (exports3.InsertReplaceEdit = InsertReplaceEdit2 = {})); - var InsertTextMode2; - (function(InsertTextMode3) { - InsertTextMode3.asIs = 1; - InsertTextMode3.adjustIndentation = 2; - })(InsertTextMode2 || (exports3.InsertTextMode = InsertTextMode2 = {})); - var CompletionItemLabelDetails2; - (function(CompletionItemLabelDetails3) { - function is(value) { - var candidate = value; - return candidate && (Is2.string(candidate.detail) || candidate.detail === void 0) && (Is2.string(candidate.description) || candidate.description === void 0); - } - CompletionItemLabelDetails3.is = is; - })(CompletionItemLabelDetails2 || (exports3.CompletionItemLabelDetails = CompletionItemLabelDetails2 = {})); - var CompletionItem2; - (function(CompletionItem3) { - function create(label) { - return { label }; - } - CompletionItem3.create = create; - })(CompletionItem2 || (exports3.CompletionItem = CompletionItem2 = {})); - var CompletionList3; - (function(CompletionList4) { - function create(items, isIncomplete) { - return { items: items ? items : [], isIncomplete: !!isIncomplete }; - } - CompletionList4.create = create; - })(CompletionList3 || (exports3.CompletionList = CompletionList3 = {})); - var MarkedString2; - (function(MarkedString3) { - function fromPlainText(plainText) { - return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); - } - MarkedString3.fromPlainText = fromPlainText; - function is(value) { - var candidate = value; - return Is2.string(candidate) || Is2.objectLiteral(candidate) && Is2.string(candidate.language) && Is2.string(candidate.value); - } - MarkedString3.is = is; - })(MarkedString2 || (exports3.MarkedString = MarkedString2 = {})); - var Hover2; - (function(Hover3) { - function is(value) { - var candidate = value; - return !!candidate && Is2.objectLiteral(candidate) && (MarkupContent2.is(candidate.contents) || MarkedString2.is(candidate.contents) || Is2.typedArray(candidate.contents, MarkedString2.is)) && (value.range === void 0 || Range2.is(value.range)); - } - Hover3.is = is; - })(Hover2 || (exports3.Hover = Hover2 = {})); - var ParameterInformation2; - (function(ParameterInformation3) { - function create(label, documentation) { - return documentation ? { label, documentation } : { label }; - } - ParameterInformation3.create = create; - })(ParameterInformation2 || (exports3.ParameterInformation = ParameterInformation2 = {})); - var SignatureInformation2; - (function(SignatureInformation3) { - function create(label, documentation) { - var parameters = []; - for (var _i = 2; _i < arguments.length; _i++) { - parameters[_i - 2] = arguments[_i]; - } - var result = { label }; - if (Is2.defined(documentation)) { - result.documentation = documentation; - } - if (Is2.defined(parameters)) { - result.parameters = parameters; - } else { - result.parameters = []; - } - return result; - } - SignatureInformation3.create = create; - })(SignatureInformation2 || (exports3.SignatureInformation = SignatureInformation2 = {})); - var DocumentHighlightKind2; - (function(DocumentHighlightKind3) { - DocumentHighlightKind3.Text = 1; - DocumentHighlightKind3.Read = 2; - DocumentHighlightKind3.Write = 3; - })(DocumentHighlightKind2 || (exports3.DocumentHighlightKind = DocumentHighlightKind2 = {})); - var DocumentHighlight3; - (function(DocumentHighlight4) { - function create(range, kind) { - var result = { range }; - if (Is2.number(kind)) { - result.kind = kind; - } - return result; - } - DocumentHighlight4.create = create; - })(DocumentHighlight3 || (exports3.DocumentHighlight = DocumentHighlight3 = {})); - var SymbolKind5; - (function(SymbolKind6) { - SymbolKind6.File = 1; - SymbolKind6.Module = 2; - SymbolKind6.Namespace = 3; - SymbolKind6.Package = 4; - SymbolKind6.Class = 5; - SymbolKind6.Method = 6; - SymbolKind6.Property = 7; - SymbolKind6.Field = 8; - SymbolKind6.Constructor = 9; - SymbolKind6.Enum = 10; - SymbolKind6.Interface = 11; - SymbolKind6.Function = 12; - SymbolKind6.Variable = 13; - SymbolKind6.Constant = 14; - SymbolKind6.String = 15; - SymbolKind6.Number = 16; - SymbolKind6.Boolean = 17; - SymbolKind6.Array = 18; - SymbolKind6.Object = 19; - SymbolKind6.Key = 20; - SymbolKind6.Null = 21; - SymbolKind6.EnumMember = 22; - SymbolKind6.Struct = 23; - SymbolKind6.Event = 24; - SymbolKind6.Operator = 25; - SymbolKind6.TypeParameter = 26; - })(SymbolKind5 || (exports3.SymbolKind = SymbolKind5 = {})); - var SymbolTag2; - (function(SymbolTag3) { - SymbolTag3.Deprecated = 1; - })(SymbolTag2 || (exports3.SymbolTag = SymbolTag2 = {})); - var SymbolInformation2; - (function(SymbolInformation3) { - function create(name, kind, range, uri, containerName) { - var result = { - name, - kind, - location: { uri, range } - }; - if (containerName) { - result.containerName = containerName; - } - return result; - } - SymbolInformation3.create = create; - })(SymbolInformation2 || (exports3.SymbolInformation = SymbolInformation2 = {})); - var WorkspaceSymbol2; - (function(WorkspaceSymbol3) { - function create(name, kind, uri, range) { - return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } }; - } - WorkspaceSymbol3.create = create; - })(WorkspaceSymbol2 || (exports3.WorkspaceSymbol = WorkspaceSymbol2 = {})); - var DocumentSymbol2; - (function(DocumentSymbol3) { - function create(name, detail, kind, range, selectionRange, children) { - var result = { - name, - detail, - kind, - range, - selectionRange - }; - if (children !== void 0) { - result.children = children; - } - return result; - } - DocumentSymbol3.create = create; - function is(value) { - var candidate = value; - return candidate && Is2.string(candidate.name) && Is2.number(candidate.kind) && Range2.is(candidate.range) && Range2.is(candidate.selectionRange) && (candidate.detail === void 0 || Is2.string(candidate.detail)) && (candidate.deprecated === void 0 || Is2.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); - } - DocumentSymbol3.is = is; - })(DocumentSymbol2 || (exports3.DocumentSymbol = DocumentSymbol2 = {})); - var CodeActionKind2; - (function(CodeActionKind3) { - CodeActionKind3.Empty = ""; - CodeActionKind3.QuickFix = "quickfix"; - CodeActionKind3.Refactor = "refactor"; - CodeActionKind3.RefactorExtract = "refactor.extract"; - CodeActionKind3.RefactorInline = "refactor.inline"; - CodeActionKind3.RefactorRewrite = "refactor.rewrite"; - CodeActionKind3.Source = "source"; - CodeActionKind3.SourceOrganizeImports = "source.organizeImports"; - CodeActionKind3.SourceFixAll = "source.fixAll"; - })(CodeActionKind2 || (exports3.CodeActionKind = CodeActionKind2 = {})); - var CodeActionTriggerKind2; - (function(CodeActionTriggerKind3) { - CodeActionTriggerKind3.Invoked = 1; - CodeActionTriggerKind3.Automatic = 2; - })(CodeActionTriggerKind2 || (exports3.CodeActionTriggerKind = CodeActionTriggerKind2 = {})); - var CodeActionContext2; - (function(CodeActionContext3) { - function create(diagnostics, only, triggerKind) { - var result = { diagnostics }; - if (only !== void 0 && only !== null) { - result.only = only; - } - if (triggerKind !== void 0 && triggerKind !== null) { - result.triggerKind = triggerKind; - } - return result; - } - CodeActionContext3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.typedArray(candidate.diagnostics, Diagnostic2.is) && (candidate.only === void 0 || Is2.typedArray(candidate.only, Is2.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind2.Invoked || candidate.triggerKind === CodeActionTriggerKind2.Automatic); - } - CodeActionContext3.is = is; - })(CodeActionContext2 || (exports3.CodeActionContext = CodeActionContext2 = {})); - var CodeAction2; - (function(CodeAction3) { - function create(title, kindOrCommandOrEdit, kind) { - var result = { title }; - var checkKind = true; - if (typeof kindOrCommandOrEdit === "string") { - checkKind = false; - result.kind = kindOrCommandOrEdit; - } else if (Command2.is(kindOrCommandOrEdit)) { - result.command = kindOrCommandOrEdit; - } else { - result.edit = kindOrCommandOrEdit; - } - if (checkKind && kind !== void 0) { - result.kind = kind; - } - return result; - } - CodeAction3.create = create; - function is(value) { - var candidate = value; - return candidate && Is2.string(candidate.title) && (candidate.diagnostics === void 0 || Is2.typedArray(candidate.diagnostics, Diagnostic2.is)) && (candidate.kind === void 0 || Is2.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command2.is(candidate.command)) && (candidate.isPreferred === void 0 || Is2.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit2.is(candidate.edit)); - } - CodeAction3.is = is; - })(CodeAction2 || (exports3.CodeAction = CodeAction2 = {})); - var CodeLens2; - (function(CodeLens3) { - function create(range, data) { - var result = { range }; - if (Is2.defined(data)) { - result.data = data; - } - return result; - } - CodeLens3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Range2.is(candidate.range) && (Is2.undefined(candidate.command) || Command2.is(candidate.command)); - } - CodeLens3.is = is; - })(CodeLens2 || (exports3.CodeLens = CodeLens2 = {})); - var FormattingOptions2; - (function(FormattingOptions3) { - function create(tabSize, insertSpaces) { - return { tabSize, insertSpaces }; - } - FormattingOptions3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.uinteger(candidate.tabSize) && Is2.boolean(candidate.insertSpaces); - } - FormattingOptions3.is = is; - })(FormattingOptions2 || (exports3.FormattingOptions = FormattingOptions2 = {})); - var DocumentLink2; - (function(DocumentLink3) { - function create(range, target, data) { - return { range, target, data }; - } - DocumentLink3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Range2.is(candidate.range) && (Is2.undefined(candidate.target) || Is2.string(candidate.target)); - } - DocumentLink3.is = is; - })(DocumentLink2 || (exports3.DocumentLink = DocumentLink2 = {})); - var SelectionRange2; - (function(SelectionRange3) { - function create(range, parent) { - return { range, parent }; - } - SelectionRange3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Range2.is(candidate.range) && (candidate.parent === void 0 || SelectionRange3.is(candidate.parent)); - } - SelectionRange3.is = is; - })(SelectionRange2 || (exports3.SelectionRange = SelectionRange2 = {})); - var SemanticTokenTypes3; - (function(SemanticTokenTypes4) { - SemanticTokenTypes4["namespace"] = "namespace"; - SemanticTokenTypes4["type"] = "type"; - SemanticTokenTypes4["class"] = "class"; - SemanticTokenTypes4["enum"] = "enum"; - SemanticTokenTypes4["interface"] = "interface"; - SemanticTokenTypes4["struct"] = "struct"; - SemanticTokenTypes4["typeParameter"] = "typeParameter"; - SemanticTokenTypes4["parameter"] = "parameter"; - SemanticTokenTypes4["variable"] = "variable"; - SemanticTokenTypes4["property"] = "property"; - SemanticTokenTypes4["enumMember"] = "enumMember"; - SemanticTokenTypes4["event"] = "event"; - SemanticTokenTypes4["function"] = "function"; - SemanticTokenTypes4["method"] = "method"; - SemanticTokenTypes4["macro"] = "macro"; - SemanticTokenTypes4["keyword"] = "keyword"; - SemanticTokenTypes4["modifier"] = "modifier"; - SemanticTokenTypes4["comment"] = "comment"; - SemanticTokenTypes4["string"] = "string"; - SemanticTokenTypes4["number"] = "number"; - SemanticTokenTypes4["regexp"] = "regexp"; - SemanticTokenTypes4["operator"] = "operator"; - SemanticTokenTypes4["decorator"] = "decorator"; - })(SemanticTokenTypes3 || (exports3.SemanticTokenTypes = SemanticTokenTypes3 = {})); - var SemanticTokenModifiers3; - (function(SemanticTokenModifiers4) { - SemanticTokenModifiers4["declaration"] = "declaration"; - SemanticTokenModifiers4["definition"] = "definition"; - SemanticTokenModifiers4["readonly"] = "readonly"; - SemanticTokenModifiers4["static"] = "static"; - SemanticTokenModifiers4["deprecated"] = "deprecated"; - SemanticTokenModifiers4["abstract"] = "abstract"; - SemanticTokenModifiers4["async"] = "async"; - SemanticTokenModifiers4["modification"] = "modification"; - SemanticTokenModifiers4["documentation"] = "documentation"; - SemanticTokenModifiers4["defaultLibrary"] = "defaultLibrary"; - })(SemanticTokenModifiers3 || (exports3.SemanticTokenModifiers = SemanticTokenModifiers3 = {})); - var SemanticTokens2; - (function(SemanticTokens3) { - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); - } - SemanticTokens3.is = is; - })(SemanticTokens2 || (exports3.SemanticTokens = SemanticTokens2 = {})); - var InlineValueText2; - (function(InlineValueText3) { - function create(range, text) { - return { range, text }; - } - InlineValueText3.create = create; - function is(value) { - var candidate = value; - return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is2.string(candidate.text); - } - InlineValueText3.is = is; - })(InlineValueText2 || (exports3.InlineValueText = InlineValueText2 = {})); - var InlineValueVariableLookup2; - (function(InlineValueVariableLookup3) { - function create(range, variableName, caseSensitiveLookup) { - return { range, variableName, caseSensitiveLookup }; - } - InlineValueVariableLookup3.create = create; - function is(value) { - var candidate = value; - return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && Is2.boolean(candidate.caseSensitiveLookup) && (Is2.string(candidate.variableName) || candidate.variableName === void 0); - } - InlineValueVariableLookup3.is = is; - })(InlineValueVariableLookup2 || (exports3.InlineValueVariableLookup = InlineValueVariableLookup2 = {})); - var InlineValueEvaluatableExpression2; - (function(InlineValueEvaluatableExpression3) { - function create(range, expression) { - return { range, expression }; - } - InlineValueEvaluatableExpression3.create = create; - function is(value) { - var candidate = value; - return candidate !== void 0 && candidate !== null && Range2.is(candidate.range) && (Is2.string(candidate.expression) || candidate.expression === void 0); - } - InlineValueEvaluatableExpression3.is = is; - })(InlineValueEvaluatableExpression2 || (exports3.InlineValueEvaluatableExpression = InlineValueEvaluatableExpression2 = {})); - var InlineValueContext2; - (function(InlineValueContext3) { - function create(frameId, stoppedLocation) { - return { frameId, stoppedLocation }; - } - InlineValueContext3.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Range2.is(value.stoppedLocation); - } - InlineValueContext3.is = is; - })(InlineValueContext2 || (exports3.InlineValueContext = InlineValueContext2 = {})); - var InlayHintKind2; - (function(InlayHintKind3) { - InlayHintKind3.Type = 1; - InlayHintKind3.Parameter = 2; - function is(value) { - return value === 1 || value === 2; - } - InlayHintKind3.is = is; - })(InlayHintKind2 || (exports3.InlayHintKind = InlayHintKind2 = {})); - var InlayHintLabelPart2; - (function(InlayHintLabelPart3) { - function create(value) { - return { value }; - } - InlayHintLabelPart3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is2.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.location === void 0 || Location3.is(candidate.location)) && (candidate.command === void 0 || Command2.is(candidate.command)); - } - InlayHintLabelPart3.is = is; - })(InlayHintLabelPart2 || (exports3.InlayHintLabelPart = InlayHintLabelPart2 = {})); - var InlayHint2; - (function(InlayHint3) { - function create(position, label, kind) { - var result = { position, label }; - if (kind !== void 0) { - result.kind = kind; - } - return result; - } - InlayHint3.create = create; - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && Position3.is(candidate.position) && (Is2.string(candidate.label) || Is2.typedArray(candidate.label, InlayHintLabelPart2.is)) && (candidate.kind === void 0 || InlayHintKind2.is(candidate.kind)) && candidate.textEdits === void 0 || Is2.typedArray(candidate.textEdits, TextEdit2.is) && (candidate.tooltip === void 0 || Is2.string(candidate.tooltip) || MarkupContent2.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is2.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is2.boolean(candidate.paddingRight)); - } - InlayHint3.is = is; - })(InlayHint2 || (exports3.InlayHint = InlayHint2 = {})); - var StringValue2; - (function(StringValue3) { - function createSnippet(value) { - return { kind: "snippet", value }; - } - StringValue3.createSnippet = createSnippet; - })(StringValue2 || (exports3.StringValue = StringValue2 = {})); - var InlineCompletionItem2; - (function(InlineCompletionItem3) { - function create(insertText, filterText, range, command) { - return { insertText, filterText, range, command }; - } - InlineCompletionItem3.create = create; - })(InlineCompletionItem2 || (exports3.InlineCompletionItem = InlineCompletionItem2 = {})); - var InlineCompletionList2; - (function(InlineCompletionList3) { - function create(items) { - return { items }; - } - InlineCompletionList3.create = create; - })(InlineCompletionList2 || (exports3.InlineCompletionList = InlineCompletionList2 = {})); - var InlineCompletionTriggerKind2; - (function(InlineCompletionTriggerKind3) { - InlineCompletionTriggerKind3.Invoked = 0; - InlineCompletionTriggerKind3.Automatic = 1; - })(InlineCompletionTriggerKind2 || (exports3.InlineCompletionTriggerKind = InlineCompletionTriggerKind2 = {})); - var SelectedCompletionInfo2; - (function(SelectedCompletionInfo3) { - function create(range, text) { - return { range, text }; - } - SelectedCompletionInfo3.create = create; - })(SelectedCompletionInfo2 || (exports3.SelectedCompletionInfo = SelectedCompletionInfo2 = {})); - var InlineCompletionContext2; - (function(InlineCompletionContext3) { - function create(triggerKind, selectedCompletionInfo) { - return { triggerKind, selectedCompletionInfo }; - } - InlineCompletionContext3.create = create; - })(InlineCompletionContext2 || (exports3.InlineCompletionContext = InlineCompletionContext2 = {})); - var WorkspaceFolder2; - (function(WorkspaceFolder3) { - function is(value) { - var candidate = value; - return Is2.objectLiteral(candidate) && URI3.is(candidate.uri) && Is2.string(candidate.name); - } - WorkspaceFolder3.is = is; - })(WorkspaceFolder2 || (exports3.WorkspaceFolder = WorkspaceFolder2 = {})); - exports3.EOL = ["\n", "\r\n", "\r"]; - var TextDocument3; - (function(TextDocument4) { - function create(uri, languageId, version, content) { - return new FullTextDocument3(uri, languageId, version, content); - } - TextDocument4.create = create; - function is(value) { - var candidate = value; - return Is2.defined(candidate) && Is2.string(candidate.uri) && (Is2.undefined(candidate.languageId) || Is2.string(candidate.languageId)) && Is2.uinteger(candidate.lineCount) && Is2.func(candidate.getText) && Is2.func(candidate.positionAt) && Is2.func(candidate.offsetAt) ? true : false; - } - TextDocument4.is = is; - function applyEdits(document, edits) { - var text = document.getText(); - var sortedEdits = mergeSort2(edits, function(a2, b) { - var diff = a2.range.start.line - b.range.start.line; - if (diff === 0) { - return a2.range.start.character - b.range.start.character; - } - return diff; - }); - var lastModifiedOffset = text.length; - for (var i = sortedEdits.length - 1; i >= 0; i--) { - var e = sortedEdits[i]; - var startOffset = document.offsetAt(e.range.start); - var endOffset = document.offsetAt(e.range.end); - if (endOffset <= lastModifiedOffset) { - text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); - } else { - throw new Error("Overlapping edit"); - } - lastModifiedOffset = startOffset; - } - return text; - } - TextDocument4.applyEdits = applyEdits; - function mergeSort2(data, compare) { - if (data.length <= 1) { - return data; - } - var p = data.length / 2 | 0; - var left = data.slice(0, p); - var right = data.slice(p); - mergeSort2(left, compare); - mergeSort2(right, compare); - var leftIdx = 0; - var rightIdx = 0; - var i = 0; - while (leftIdx < left.length && rightIdx < right.length) { - var ret = compare(left[leftIdx], right[rightIdx]); - if (ret <= 0) { - data[i++] = left[leftIdx++]; - } else { - data[i++] = right[rightIdx++]; - } - } - while (leftIdx < left.length) { - data[i++] = left[leftIdx++]; - } - while (rightIdx < right.length) { - data[i++] = right[rightIdx++]; - } - return data; - } - })(TextDocument3 || (exports3.TextDocument = TextDocument3 = {})); - var FullTextDocument3 = ( - /** @class */ - function() { - function FullTextDocument4(uri, languageId, version, content) { - this._uri = uri; - this._languageId = languageId; - this._version = version; - this._content = content; - this._lineOffsets = void 0; - } - Object.defineProperty(FullTextDocument4.prototype, "uri", { - get: function() { - return this._uri; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument4.prototype, "languageId", { - get: function() { - return this._languageId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument4.prototype, "version", { - get: function() { - return this._version; - }, - enumerable: false, - configurable: true - }); - FullTextDocument4.prototype.getText = function(range) { - if (range) { - var start = this.offsetAt(range.start); - var end = this.offsetAt(range.end); - return this._content.substring(start, end); - } - return this._content; - }; - FullTextDocument4.prototype.update = function(event, version) { - this._content = event.text; - this._version = version; - this._lineOffsets = void 0; - }; - FullTextDocument4.prototype.getLineOffsets = function() { - if (this._lineOffsets === void 0) { - var lineOffsets = []; - var text = this._content; - var isLineStart = true; - for (var i = 0; i < text.length; i++) { - if (isLineStart) { - lineOffsets.push(i); - isLineStart = false; - } - var ch = text.charAt(i); - isLineStart = ch === "\r" || ch === "\n"; - if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { - i++; - } - } - if (isLineStart && text.length > 0) { - lineOffsets.push(text.length); - } - this._lineOffsets = lineOffsets; - } - return this._lineOffsets; - }; - FullTextDocument4.prototype.positionAt = function(offset) { - offset = Math.max(Math.min(offset, this._content.length), 0); - var lineOffsets = this.getLineOffsets(); - var low = 0, high = lineOffsets.length; - if (high === 0) { - return Position3.create(0, offset); - } - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (lineOffsets[mid] > offset) { - high = mid; - } else { - low = mid + 1; - } - } - var line = low - 1; - return Position3.create(line, offset - lineOffsets[line]); - }; - FullTextDocument4.prototype.offsetAt = function(position) { - var lineOffsets = this.getLineOffsets(); - if (position.line >= lineOffsets.length) { - return this._content.length; - } else if (position.line < 0) { - return 0; - } - var lineOffset = lineOffsets[position.line]; - var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; - return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); - }; - Object.defineProperty(FullTextDocument4.prototype, "lineCount", { - get: function() { - return this.getLineOffsets().length; - }, - enumerable: false, - configurable: true - }); - return FullTextDocument4; - }() - ); - var Is2; - (function(Is3) { - var toString3 = Object.prototype.toString; - function defined(value) { - return typeof value !== "undefined"; - } - Is3.defined = defined; - function undefined2(value) { - return typeof value === "undefined"; - } - Is3.undefined = undefined2; - function boolean(value) { - return value === true || value === false; - } - Is3.boolean = boolean; - function string(value) { - return toString3.call(value) === "[object String]"; - } - Is3.string = string; - function number(value) { - return toString3.call(value) === "[object Number]"; - } - Is3.number = number; - function numberRange(value, min2, max) { - return toString3.call(value) === "[object Number]" && min2 <= value && value <= max; - } - Is3.numberRange = numberRange; - function integer3(value) { - return toString3.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; - } - Is3.integer = integer3; - function uinteger3(value) { - return toString3.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; - } - Is3.uinteger = uinteger3; - function func(value) { - return toString3.call(value) === "[object Function]"; - } - Is3.func = func; - function objectLiteral(value) { - return value !== null && typeof value === "object"; - } - Is3.objectLiteral = objectLiteral; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - Is3.typedArray = typedArray; - })(Is2 || (Is2 = {})); - }); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/messages.js -var require_messages2 = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = exports2.MessageDirection = void 0; - var vscode_jsonrpc_1 = require_main(); - var MessageDirection; - (function(MessageDirection2) { - MessageDirection2["clientToServer"] = "clientToServer"; - MessageDirection2["serverToClient"] = "serverToClient"; - MessageDirection2["both"] = "both"; - })(MessageDirection || (exports2.MessageDirection = MessageDirection = {})); - var RegistrationType = class { - constructor(method) { - this.method = method; - } - }; - exports2.RegistrationType = RegistrationType; - var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { - constructor(method) { - super(method); - } - }; - exports2.ProtocolRequestType0 = ProtocolRequestType0; - var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { - constructor(method) { - super(method, vscode_jsonrpc_1.ParameterStructures.byName); - } - }; - exports2.ProtocolRequestType = ProtocolRequestType; - var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { - constructor(method) { - super(method); - } - }; - exports2.ProtocolNotificationType0 = ProtocolNotificationType0; - var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { - constructor(method) { - super(method, vscode_jsonrpc_1.ParameterStructures.byName); - } - }; - exports2.ProtocolNotificationType = ProtocolNotificationType; - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/utils/is.js -var require_is3 = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; - function boolean(value) { - return value === true || value === false; - } - exports2.boolean = boolean; - function string(value) { - return typeof value === "string" || value instanceof String; - } - exports2.string = string; - function number(value) { - return typeof value === "number" || value instanceof Number; - } - exports2.number = number; - function error(value) { - return value instanceof Error; - } - exports2.error = error; - function func(value) { - return typeof value === "function"; - } - exports2.func = func; - function array(value) { - return Array.isArray(value); - } - exports2.array = array; - function stringArray(value) { - return array(value) && value.every((elem) => string(elem)); - } - exports2.stringArray = stringArray; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - exports2.typedArray = typedArray; - function objectLiteral(value) { - return value !== null && typeof value === "object"; - } - exports2.objectLiteral = objectLiteral; - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js -var require_protocol_implementation = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ImplementationRequest = void 0; - var messages_1 = require_messages2(); - var ImplementationRequest; - (function(ImplementationRequest2) { - ImplementationRequest2.method = "textDocument/implementation"; - ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); - })(ImplementationRequest || (exports2.ImplementationRequest = ImplementationRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js -var require_protocol_typeDefinition = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TypeDefinitionRequest = void 0; - var messages_1 = require_messages2(); - var TypeDefinitionRequest; - (function(TypeDefinitionRequest2) { - TypeDefinitionRequest2.method = "textDocument/typeDefinition"; - TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); - })(TypeDefinitionRequest || (exports2.TypeDefinitionRequest = TypeDefinitionRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js -var require_protocol_workspaceFolder = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0; - var messages_1 = require_messages2(); - var WorkspaceFoldersRequest; - (function(WorkspaceFoldersRequest2) { - WorkspaceFoldersRequest2.method = "workspace/workspaceFolders"; - WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method); - })(WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {})); - var DidChangeWorkspaceFoldersNotification; - (function(DidChangeWorkspaceFoldersNotification2) { - DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders"; - DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method); - })(DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js -var require_protocol_configuration = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConfigurationRequest = void 0; - var messages_1 = require_messages2(); - var ConfigurationRequest; - (function(ConfigurationRequest2) { - ConfigurationRequest2.method = "workspace/configuration"; - ConfigurationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - ConfigurationRequest2.type = new messages_1.ProtocolRequestType(ConfigurationRequest2.method); - })(ConfigurationRequest || (exports2.ConfigurationRequest = ConfigurationRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js -var require_protocol_colorProvider = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0; - var messages_1 = require_messages2(); - var DocumentColorRequest; - (function(DocumentColorRequest2) { - DocumentColorRequest2.method = "textDocument/documentColor"; - DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); - })(DocumentColorRequest || (exports2.DocumentColorRequest = DocumentColorRequest = {})); - var ColorPresentationRequest; - (function(ColorPresentationRequest2) { - ColorPresentationRequest2.method = "textDocument/colorPresentation"; - ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method); - })(ColorPresentationRequest || (exports2.ColorPresentationRequest = ColorPresentationRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js -var require_protocol_foldingRange = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = void 0; - var messages_1 = require_messages2(); - var FoldingRangeRequest; - (function(FoldingRangeRequest2) { - FoldingRangeRequest2.method = "textDocument/foldingRange"; - FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); - })(FoldingRangeRequest || (exports2.FoldingRangeRequest = FoldingRangeRequest = {})); - var FoldingRangeRefreshRequest; - (function(FoldingRangeRefreshRequest2) { - FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`; - FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method); - })(FoldingRangeRefreshRequest || (exports2.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js -var require_protocol_declaration = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeclarationRequest = void 0; - var messages_1 = require_messages2(); - var DeclarationRequest; - (function(DeclarationRequest2) { - DeclarationRequest2.method = "textDocument/declaration"; - DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); - })(DeclarationRequest || (exports2.DeclarationRequest = DeclarationRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js -var require_protocol_selectionRange = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SelectionRangeRequest = void 0; - var messages_1 = require_messages2(); - var SelectionRangeRequest; - (function(SelectionRangeRequest2) { - SelectionRangeRequest2.method = "textDocument/selectionRange"; - SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); - })(SelectionRangeRequest || (exports2.SelectionRangeRequest = SelectionRangeRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js -var require_protocol_progress = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0; - var vscode_jsonrpc_1 = require_main(); - var messages_1 = require_messages2(); - var WorkDoneProgress; - (function(WorkDoneProgress2) { - WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); - function is(value) { - return value === WorkDoneProgress2.type; - } - WorkDoneProgress2.is = is; - })(WorkDoneProgress || (exports2.WorkDoneProgress = WorkDoneProgress = {})); - var WorkDoneProgressCreateRequest; - (function(WorkDoneProgressCreateRequest2) { - WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create"; - WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method); - })(WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {})); - var WorkDoneProgressCancelNotification; - (function(WorkDoneProgressCancelNotification2) { - WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel"; - WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method); - })(WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js -var require_protocol_callHierarchy = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0; - var messages_1 = require_messages2(); - var CallHierarchyPrepareRequest; - (function(CallHierarchyPrepareRequest2) { - CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; - CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); - })(CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {})); - var CallHierarchyIncomingCallsRequest; - (function(CallHierarchyIncomingCallsRequest2) { - CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; - CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); - })(CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {})); - var CallHierarchyOutgoingCallsRequest; - (function(CallHierarchyOutgoingCallsRequest2) { - CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; - CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); - })(CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js -var require_protocol_semanticTokens = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = void 0; - var messages_1 = require_messages2(); - var TokenFormat; - (function(TokenFormat2) { - TokenFormat2.Relative = "relative"; - })(TokenFormat || (exports2.TokenFormat = TokenFormat = {})); - var SemanticTokensRegistrationType; - (function(SemanticTokensRegistrationType2) { - SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; - SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); - })(SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {})); - var SemanticTokensRequest; - (function(SemanticTokensRequest2) { - SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; - SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); - SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method; - })(SemanticTokensRequest || (exports2.SemanticTokensRequest = SemanticTokensRequest = {})); - var SemanticTokensDeltaRequest; - (function(SemanticTokensDeltaRequest2) { - SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; - SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); - SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method; - })(SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {})); - var SemanticTokensRangeRequest; - (function(SemanticTokensRangeRequest2) { - SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; - SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); - SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method; - })(SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {})); - var SemanticTokensRefreshRequest; - (function(SemanticTokensRefreshRequest2) { - SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; - SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); - })(SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js -var require_protocol_showDocument = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ShowDocumentRequest = void 0; - var messages_1 = require_messages2(); - var ShowDocumentRequest; - (function(ShowDocumentRequest2) { - ShowDocumentRequest2.method = "window/showDocument"; - ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); - })(ShowDocumentRequest || (exports2.ShowDocumentRequest = ShowDocumentRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js -var require_protocol_linkedEditingRange = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LinkedEditingRangeRequest = void 0; - var messages_1 = require_messages2(); - var LinkedEditingRangeRequest; - (function(LinkedEditingRangeRequest2) { - LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; - LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); - })(LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js -var require_protocol_fileOperations = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0; - var messages_1 = require_messages2(); - var FileOperationPatternKind; - (function(FileOperationPatternKind2) { - FileOperationPatternKind2.file = "file"; - FileOperationPatternKind2.folder = "folder"; - })(FileOperationPatternKind || (exports2.FileOperationPatternKind = FileOperationPatternKind = {})); - var WillCreateFilesRequest; - (function(WillCreateFilesRequest2) { - WillCreateFilesRequest2.method = "workspace/willCreateFiles"; - WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); - })(WillCreateFilesRequest || (exports2.WillCreateFilesRequest = WillCreateFilesRequest = {})); - var DidCreateFilesNotification; - (function(DidCreateFilesNotification2) { - DidCreateFilesNotification2.method = "workspace/didCreateFiles"; - DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); - })(DidCreateFilesNotification || (exports2.DidCreateFilesNotification = DidCreateFilesNotification = {})); - var WillRenameFilesRequest; - (function(WillRenameFilesRequest2) { - WillRenameFilesRequest2.method = "workspace/willRenameFiles"; - WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); - })(WillRenameFilesRequest || (exports2.WillRenameFilesRequest = WillRenameFilesRequest = {})); - var DidRenameFilesNotification; - (function(DidRenameFilesNotification2) { - DidRenameFilesNotification2.method = "workspace/didRenameFiles"; - DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); - })(DidRenameFilesNotification || (exports2.DidRenameFilesNotification = DidRenameFilesNotification = {})); - var DidDeleteFilesNotification; - (function(DidDeleteFilesNotification2) { - DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; - DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); - })(DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = DidDeleteFilesNotification = {})); - var WillDeleteFilesRequest; - (function(WillDeleteFilesRequest2) { - WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; - WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); - })(WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = WillDeleteFilesRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js -var require_protocol_moniker = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0; - var messages_1 = require_messages2(); - var UniquenessLevel; - (function(UniquenessLevel2) { - UniquenessLevel2.document = "document"; - UniquenessLevel2.project = "project"; - UniquenessLevel2.group = "group"; - UniquenessLevel2.scheme = "scheme"; - UniquenessLevel2.global = "global"; - })(UniquenessLevel || (exports2.UniquenessLevel = UniquenessLevel = {})); - var MonikerKind; - (function(MonikerKind2) { - MonikerKind2.$import = "import"; - MonikerKind2.$export = "export"; - MonikerKind2.local = "local"; - })(MonikerKind || (exports2.MonikerKind = MonikerKind = {})); - var MonikerRequest; - (function(MonikerRequest2) { - MonikerRequest2.method = "textDocument/moniker"; - MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); - })(MonikerRequest || (exports2.MonikerRequest = MonikerRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js -var require_protocol_typeHierarchy = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchyPrepareRequest = void 0; - var messages_1 = require_messages2(); - var TypeHierarchyPrepareRequest; - (function(TypeHierarchyPrepareRequest2) { - TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy"; - TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method); - })(TypeHierarchyPrepareRequest || (exports2.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {})); - var TypeHierarchySupertypesRequest; - (function(TypeHierarchySupertypesRequest2) { - TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes"; - TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method); - })(TypeHierarchySupertypesRequest || (exports2.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {})); - var TypeHierarchySubtypesRequest; - (function(TypeHierarchySubtypesRequest2) { - TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes"; - TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method); - })(TypeHierarchySubtypesRequest || (exports2.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js -var require_protocol_inlineValue = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = void 0; - var messages_1 = require_messages2(); - var InlineValueRequest; - (function(InlineValueRequest2) { - InlineValueRequest2.method = "textDocument/inlineValue"; - InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method); - })(InlineValueRequest || (exports2.InlineValueRequest = InlineValueRequest = {})); - var InlineValueRefreshRequest; - (function(InlineValueRefreshRequest2) { - InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`; - InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method); - })(InlineValueRefreshRequest || (exports2.InlineValueRefreshRequest = InlineValueRefreshRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js -var require_protocol_inlayHint = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = void 0; - var messages_1 = require_messages2(); - var InlayHintRequest; - (function(InlayHintRequest2) { - InlayHintRequest2.method = "textDocument/inlayHint"; - InlayHintRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - InlayHintRequest2.type = new messages_1.ProtocolRequestType(InlayHintRequest2.method); - })(InlayHintRequest || (exports2.InlayHintRequest = InlayHintRequest = {})); - var InlayHintResolveRequest; - (function(InlayHintResolveRequest2) { - InlayHintResolveRequest2.method = "inlayHint/resolve"; - InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method); - })(InlayHintResolveRequest || (exports2.InlayHintResolveRequest = InlayHintResolveRequest = {})); - var InlayHintRefreshRequest; - (function(InlayHintRefreshRequest2) { - InlayHintRefreshRequest2.method = `workspace/inlayHint/refresh`; - InlayHintRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - InlayHintRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method); - })(InlayHintRefreshRequest || (exports2.InlayHintRefreshRequest = InlayHintRefreshRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js -var require_protocol_diagnostic = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = void 0; - var vscode_jsonrpc_1 = require_main(); - var Is2 = require_is3(); - var messages_1 = require_messages2(); - var DiagnosticServerCancellationData; - (function(DiagnosticServerCancellationData2) { - function is(value) { - const candidate = value; - return candidate && Is2.boolean(candidate.retriggerRequest); - } - DiagnosticServerCancellationData2.is = is; - })(DiagnosticServerCancellationData || (exports2.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {})); - var DocumentDiagnosticReportKind; - (function(DocumentDiagnosticReportKind2) { - DocumentDiagnosticReportKind2.Full = "full"; - DocumentDiagnosticReportKind2.Unchanged = "unchanged"; - })(DocumentDiagnosticReportKind || (exports2.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {})); - var DocumentDiagnosticRequest; - (function(DocumentDiagnosticRequest2) { - DocumentDiagnosticRequest2.method = "textDocument/diagnostic"; - DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method); - DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); - })(DocumentDiagnosticRequest || (exports2.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {})); - var WorkspaceDiagnosticRequest; - (function(WorkspaceDiagnosticRequest2) { - WorkspaceDiagnosticRequest2.method = "workspace/diagnostic"; - WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method); - WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); - })(WorkspaceDiagnosticRequest || (exports2.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {})); - var DiagnosticRefreshRequest; - (function(DiagnosticRefreshRequest2) { - DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`; - DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method); - })(DiagnosticRefreshRequest || (exports2.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js -var require_protocol_notebook = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = void 0; - var vscode_languageserver_types_1 = require_main2(); - var Is2 = require_is3(); - var messages_1 = require_messages2(); - var NotebookCellKind; - (function(NotebookCellKind2) { - NotebookCellKind2.Markup = 1; - NotebookCellKind2.Code = 2; - function is(value) { - return value === 1 || value === 2; - } - NotebookCellKind2.is = is; - })(NotebookCellKind || (exports2.NotebookCellKind = NotebookCellKind = {})); - var ExecutionSummary; - (function(ExecutionSummary2) { - function create(executionOrder, success) { - const result = { executionOrder }; - if (success === true || success === false) { - result.success = success; - } - return result; - } - ExecutionSummary2.create = create; - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success)); - } - ExecutionSummary2.is = is; - function equals(one, other) { - if (one === other) { - return true; - } - if (one === null || one === void 0 || other === null || other === void 0) { - return false; - } - return one.executionOrder === other.executionOrder && one.success === other.success; - } - ExecutionSummary2.equals = equals; - })(ExecutionSummary || (exports2.ExecutionSummary = ExecutionSummary = {})); - var NotebookCell; - (function(NotebookCell2) { - function create(kind, document) { - return { kind, document }; - } - NotebookCell2.create = create; - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata)); - } - NotebookCell2.is = is; - function diff(one, two) { - const result = /* @__PURE__ */ new Set(); - if (one.document !== two.document) { - result.add("document"); - } - if (one.kind !== two.kind) { - result.add("kind"); - } - if (one.executionSummary !== two.executionSummary) { - result.add("executionSummary"); - } - if ((one.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one.metadata, two.metadata)) { - result.add("metadata"); - } - if ((one.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one.executionSummary, two.executionSummary)) { - result.add("executionSummary"); - } - return result; - } - NotebookCell2.diff = diff; - function equalsMetadata(one, other) { - if (one === other) { - return true; - } - if (one === null || one === void 0 || other === null || other === void 0) { - return false; - } - if (typeof one !== typeof other) { - return false; - } - if (typeof one !== "object") { - return false; - } - const oneArray = Array.isArray(one); - const otherArray = Array.isArray(other); - if (oneArray !== otherArray) { - return false; - } - if (oneArray && otherArray) { - if (one.length !== other.length) { - return false; - } - for (let i = 0; i < one.length; i++) { - if (!equalsMetadata(one[i], other[i])) { - return false; - } - } - } - if (Is2.objectLiteral(one) && Is2.objectLiteral(other)) { - const oneKeys = Object.keys(one); - const otherKeys = Object.keys(other); - if (oneKeys.length !== otherKeys.length) { - return false; - } - oneKeys.sort(); - otherKeys.sort(); - if (!equalsMetadata(oneKeys, otherKeys)) { - return false; - } - for (let i = 0; i < oneKeys.length; i++) { - const prop = oneKeys[i]; - if (!equalsMetadata(one[prop], other[prop])) { - return false; - } - } - } - return true; - } - })(NotebookCell || (exports2.NotebookCell = NotebookCell = {})); - var NotebookDocument; - (function(NotebookDocument2) { - function create(uri, notebookType, version, cells) { - return { uri, notebookType, version, cells }; - } - NotebookDocument2.create = create; - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is); - } - NotebookDocument2.is = is; - })(NotebookDocument || (exports2.NotebookDocument = NotebookDocument = {})); - var NotebookDocumentSyncRegistrationType; - (function(NotebookDocumentSyncRegistrationType2) { - NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync"; - NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer; - NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method); - })(NotebookDocumentSyncRegistrationType || (exports2.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {})); - var DidOpenNotebookDocumentNotification; - (function(DidOpenNotebookDocumentNotification2) { - DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen"; - DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method); - DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; - })(DidOpenNotebookDocumentNotification || (exports2.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {})); - var NotebookCellArrayChange; - (function(NotebookCellArrayChange2) { - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is)); - } - NotebookCellArrayChange2.is = is; - function create(start, deleteCount, cells) { - const result = { start, deleteCount }; - if (cells !== void 0) { - result.cells = cells; - } - return result; - } - NotebookCellArrayChange2.create = create; - })(NotebookCellArrayChange || (exports2.NotebookCellArrayChange = NotebookCellArrayChange = {})); - var DidChangeNotebookDocumentNotification; - (function(DidChangeNotebookDocumentNotification2) { - DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange"; - DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method); - DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; - })(DidChangeNotebookDocumentNotification || (exports2.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {})); - var DidSaveNotebookDocumentNotification; - (function(DidSaveNotebookDocumentNotification2) { - DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave"; - DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method); - DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; - })(DidSaveNotebookDocumentNotification || (exports2.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {})); - var DidCloseNotebookDocumentNotification; - (function(DidCloseNotebookDocumentNotification2) { - DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose"; - DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method); - DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; - })(DidCloseNotebookDocumentNotification || (exports2.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js -var require_protocol_inlineCompletion = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineCompletionRequest = void 0; - var messages_1 = require_messages2(); - var InlineCompletionRequest; - (function(InlineCompletionRequest2) { - InlineCompletionRequest2.method = "textDocument/inlineCompletion"; - InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method); - })(InlineCompletionRequest || (exports2.InlineCompletionRequest = InlineCompletionRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/protocol.js -var require_protocol = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.RelativePattern = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeErrorCodes = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.PositionEncodingKind = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.NotebookCellTextDocumentFilter = exports2.NotebookDocumentFilter = exports2.TextDocumentFilter = void 0; - exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangesFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolResolveRequest = void 0; - exports2.InlineCompletionRequest = exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchyPrepareRequest = void 0; - var messages_1 = require_messages2(); - var vscode_languageserver_types_1 = require_main2(); - var Is2 = require_is3(); - var protocol_implementation_1 = require_protocol_implementation(); - Object.defineProperty(exports2, "ImplementationRequest", { enumerable: true, get: function() { - return protocol_implementation_1.ImplementationRequest; - } }); - var protocol_typeDefinition_1 = require_protocol_typeDefinition(); - Object.defineProperty(exports2, "TypeDefinitionRequest", { enumerable: true, get: function() { - return protocol_typeDefinition_1.TypeDefinitionRequest; - } }); - var protocol_workspaceFolder_1 = require_protocol_workspaceFolder(); - Object.defineProperty(exports2, "WorkspaceFoldersRequest", { enumerable: true, get: function() { - return protocol_workspaceFolder_1.WorkspaceFoldersRequest; - } }); - Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() { - return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; - } }); - var protocol_configuration_1 = require_protocol_configuration(); - Object.defineProperty(exports2, "ConfigurationRequest", { enumerable: true, get: function() { - return protocol_configuration_1.ConfigurationRequest; - } }); - var protocol_colorProvider_1 = require_protocol_colorProvider(); - Object.defineProperty(exports2, "DocumentColorRequest", { enumerable: true, get: function() { - return protocol_colorProvider_1.DocumentColorRequest; - } }); - Object.defineProperty(exports2, "ColorPresentationRequest", { enumerable: true, get: function() { - return protocol_colorProvider_1.ColorPresentationRequest; - } }); - var protocol_foldingRange_1 = require_protocol_foldingRange(); - Object.defineProperty(exports2, "FoldingRangeRequest", { enumerable: true, get: function() { - return protocol_foldingRange_1.FoldingRangeRequest; - } }); - Object.defineProperty(exports2, "FoldingRangeRefreshRequest", { enumerable: true, get: function() { - return protocol_foldingRange_1.FoldingRangeRefreshRequest; - } }); - var protocol_declaration_1 = require_protocol_declaration(); - Object.defineProperty(exports2, "DeclarationRequest", { enumerable: true, get: function() { - return protocol_declaration_1.DeclarationRequest; - } }); - var protocol_selectionRange_1 = require_protocol_selectionRange(); - Object.defineProperty(exports2, "SelectionRangeRequest", { enumerable: true, get: function() { - return protocol_selectionRange_1.SelectionRangeRequest; - } }); - var protocol_progress_1 = require_protocol_progress(); - Object.defineProperty(exports2, "WorkDoneProgress", { enumerable: true, get: function() { - return protocol_progress_1.WorkDoneProgress; - } }); - Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() { - return protocol_progress_1.WorkDoneProgressCreateRequest; - } }); - Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() { - return protocol_progress_1.WorkDoneProgressCancelNotification; - } }); - var protocol_callHierarchy_1 = require_protocol_callHierarchy(); - Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() { - return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; - } }); - Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() { - return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; - } }); - Object.defineProperty(exports2, "CallHierarchyPrepareRequest", { enumerable: true, get: function() { - return protocol_callHierarchy_1.CallHierarchyPrepareRequest; - } }); - var protocol_semanticTokens_1 = require_protocol_semanticTokens(); - Object.defineProperty(exports2, "TokenFormat", { enumerable: true, get: function() { - return protocol_semanticTokens_1.TokenFormat; - } }); - Object.defineProperty(exports2, "SemanticTokensRequest", { enumerable: true, get: function() { - return protocol_semanticTokens_1.SemanticTokensRequest; - } }); - Object.defineProperty(exports2, "SemanticTokensDeltaRequest", { enumerable: true, get: function() { - return protocol_semanticTokens_1.SemanticTokensDeltaRequest; - } }); - Object.defineProperty(exports2, "SemanticTokensRangeRequest", { enumerable: true, get: function() { - return protocol_semanticTokens_1.SemanticTokensRangeRequest; - } }); - Object.defineProperty(exports2, "SemanticTokensRefreshRequest", { enumerable: true, get: function() { - return protocol_semanticTokens_1.SemanticTokensRefreshRequest; - } }); - Object.defineProperty(exports2, "SemanticTokensRegistrationType", { enumerable: true, get: function() { - return protocol_semanticTokens_1.SemanticTokensRegistrationType; - } }); - var protocol_showDocument_1 = require_protocol_showDocument(); - Object.defineProperty(exports2, "ShowDocumentRequest", { enumerable: true, get: function() { - return protocol_showDocument_1.ShowDocumentRequest; - } }); - var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); - Object.defineProperty(exports2, "LinkedEditingRangeRequest", { enumerable: true, get: function() { - return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; - } }); - var protocol_fileOperations_1 = require_protocol_fileOperations(); - Object.defineProperty(exports2, "FileOperationPatternKind", { enumerable: true, get: function() { - return protocol_fileOperations_1.FileOperationPatternKind; - } }); - Object.defineProperty(exports2, "DidCreateFilesNotification", { enumerable: true, get: function() { - return protocol_fileOperations_1.DidCreateFilesNotification; - } }); - Object.defineProperty(exports2, "WillCreateFilesRequest", { enumerable: true, get: function() { - return protocol_fileOperations_1.WillCreateFilesRequest; - } }); - Object.defineProperty(exports2, "DidRenameFilesNotification", { enumerable: true, get: function() { - return protocol_fileOperations_1.DidRenameFilesNotification; - } }); - Object.defineProperty(exports2, "WillRenameFilesRequest", { enumerable: true, get: function() { - return protocol_fileOperations_1.WillRenameFilesRequest; - } }); - Object.defineProperty(exports2, "DidDeleteFilesNotification", { enumerable: true, get: function() { - return protocol_fileOperations_1.DidDeleteFilesNotification; - } }); - Object.defineProperty(exports2, "WillDeleteFilesRequest", { enumerable: true, get: function() { - return protocol_fileOperations_1.WillDeleteFilesRequest; - } }); - var protocol_moniker_1 = require_protocol_moniker(); - Object.defineProperty(exports2, "UniquenessLevel", { enumerable: true, get: function() { - return protocol_moniker_1.UniquenessLevel; - } }); - Object.defineProperty(exports2, "MonikerKind", { enumerable: true, get: function() { - return protocol_moniker_1.MonikerKind; - } }); - Object.defineProperty(exports2, "MonikerRequest", { enumerable: true, get: function() { - return protocol_moniker_1.MonikerRequest; - } }); - var protocol_typeHierarchy_1 = require_protocol_typeHierarchy(); - Object.defineProperty(exports2, "TypeHierarchyPrepareRequest", { enumerable: true, get: function() { - return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; - } }); - Object.defineProperty(exports2, "TypeHierarchySubtypesRequest", { enumerable: true, get: function() { - return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; - } }); - Object.defineProperty(exports2, "TypeHierarchySupertypesRequest", { enumerable: true, get: function() { - return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; - } }); - var protocol_inlineValue_1 = require_protocol_inlineValue(); - Object.defineProperty(exports2, "InlineValueRequest", { enumerable: true, get: function() { - return protocol_inlineValue_1.InlineValueRequest; - } }); - Object.defineProperty(exports2, "InlineValueRefreshRequest", { enumerable: true, get: function() { - return protocol_inlineValue_1.InlineValueRefreshRequest; - } }); - var protocol_inlayHint_1 = require_protocol_inlayHint(); - Object.defineProperty(exports2, "InlayHintRequest", { enumerable: true, get: function() { - return protocol_inlayHint_1.InlayHintRequest; - } }); - Object.defineProperty(exports2, "InlayHintResolveRequest", { enumerable: true, get: function() { - return protocol_inlayHint_1.InlayHintResolveRequest; - } }); - Object.defineProperty(exports2, "InlayHintRefreshRequest", { enumerable: true, get: function() { - return protocol_inlayHint_1.InlayHintRefreshRequest; - } }); - var protocol_diagnostic_1 = require_protocol_diagnostic(); - Object.defineProperty(exports2, "DiagnosticServerCancellationData", { enumerable: true, get: function() { - return protocol_diagnostic_1.DiagnosticServerCancellationData; - } }); - Object.defineProperty(exports2, "DocumentDiagnosticReportKind", { enumerable: true, get: function() { - return protocol_diagnostic_1.DocumentDiagnosticReportKind; - } }); - Object.defineProperty(exports2, "DocumentDiagnosticRequest", { enumerable: true, get: function() { - return protocol_diagnostic_1.DocumentDiagnosticRequest; - } }); - Object.defineProperty(exports2, "WorkspaceDiagnosticRequest", { enumerable: true, get: function() { - return protocol_diagnostic_1.WorkspaceDiagnosticRequest; - } }); - Object.defineProperty(exports2, "DiagnosticRefreshRequest", { enumerable: true, get: function() { - return protocol_diagnostic_1.DiagnosticRefreshRequest; - } }); - var protocol_notebook_1 = require_protocol_notebook(); - Object.defineProperty(exports2, "NotebookCellKind", { enumerable: true, get: function() { - return protocol_notebook_1.NotebookCellKind; - } }); - Object.defineProperty(exports2, "ExecutionSummary", { enumerable: true, get: function() { - return protocol_notebook_1.ExecutionSummary; - } }); - Object.defineProperty(exports2, "NotebookCell", { enumerable: true, get: function() { - return protocol_notebook_1.NotebookCell; - } }); - Object.defineProperty(exports2, "NotebookDocument", { enumerable: true, get: function() { - return protocol_notebook_1.NotebookDocument; - } }); - Object.defineProperty(exports2, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: function() { - return protocol_notebook_1.NotebookDocumentSyncRegistrationType; - } }); - Object.defineProperty(exports2, "DidOpenNotebookDocumentNotification", { enumerable: true, get: function() { - return protocol_notebook_1.DidOpenNotebookDocumentNotification; - } }); - Object.defineProperty(exports2, "NotebookCellArrayChange", { enumerable: true, get: function() { - return protocol_notebook_1.NotebookCellArrayChange; - } }); - Object.defineProperty(exports2, "DidChangeNotebookDocumentNotification", { enumerable: true, get: function() { - return protocol_notebook_1.DidChangeNotebookDocumentNotification; - } }); - Object.defineProperty(exports2, "DidSaveNotebookDocumentNotification", { enumerable: true, get: function() { - return protocol_notebook_1.DidSaveNotebookDocumentNotification; - } }); - Object.defineProperty(exports2, "DidCloseNotebookDocumentNotification", { enumerable: true, get: function() { - return protocol_notebook_1.DidCloseNotebookDocumentNotification; - } }); - var protocol_inlineCompletion_1 = require_protocol_inlineCompletion(); - Object.defineProperty(exports2, "InlineCompletionRequest", { enumerable: true, get: function() { - return protocol_inlineCompletion_1.InlineCompletionRequest; - } }); - var TextDocumentFilter; - (function(TextDocumentFilter2) { - function is(value) { - const candidate = value; - return Is2.string(candidate) || (Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); - } - TextDocumentFilter2.is = is; - })(TextDocumentFilter || (exports2.TextDocumentFilter = TextDocumentFilter = {})); - var NotebookDocumentFilter; - (function(NotebookDocumentFilter2) { - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); - } - NotebookDocumentFilter2.is = is; - })(NotebookDocumentFilter || (exports2.NotebookDocumentFilter = NotebookDocumentFilter = {})); - var NotebookCellTextDocumentFilter; - (function(NotebookCellTextDocumentFilter2) { - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language)); - } - NotebookCellTextDocumentFilter2.is = is; - })(NotebookCellTextDocumentFilter || (exports2.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {})); - var DocumentSelector; - (function(DocumentSelector2) { - function is(value) { - if (!Array.isArray(value)) { - return false; - } - for (let elem of value) { - if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) { - return false; - } - } - return true; - } - DocumentSelector2.is = is; - })(DocumentSelector || (exports2.DocumentSelector = DocumentSelector = {})); - var RegistrationRequest; - (function(RegistrationRequest2) { - RegistrationRequest2.method = "client/registerCapability"; - RegistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - RegistrationRequest2.type = new messages_1.ProtocolRequestType(RegistrationRequest2.method); - })(RegistrationRequest || (exports2.RegistrationRequest = RegistrationRequest = {})); - var UnregistrationRequest; - (function(UnregistrationRequest2) { - UnregistrationRequest2.method = "client/unregisterCapability"; - UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method); - })(UnregistrationRequest || (exports2.UnregistrationRequest = UnregistrationRequest = {})); - var ResourceOperationKind; - (function(ResourceOperationKind2) { - ResourceOperationKind2.Create = "create"; - ResourceOperationKind2.Rename = "rename"; - ResourceOperationKind2.Delete = "delete"; - })(ResourceOperationKind || (exports2.ResourceOperationKind = ResourceOperationKind = {})); - var FailureHandlingKind; - (function(FailureHandlingKind2) { - FailureHandlingKind2.Abort = "abort"; - FailureHandlingKind2.Transactional = "transactional"; - FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; - FailureHandlingKind2.Undo = "undo"; - })(FailureHandlingKind || (exports2.FailureHandlingKind = FailureHandlingKind = {})); - var PositionEncodingKind; - (function(PositionEncodingKind2) { - PositionEncodingKind2.UTF8 = "utf-8"; - PositionEncodingKind2.UTF16 = "utf-16"; - PositionEncodingKind2.UTF32 = "utf-32"; - })(PositionEncodingKind || (exports2.PositionEncodingKind = PositionEncodingKind = {})); - var StaticRegistrationOptions; - (function(StaticRegistrationOptions2) { - function hasId(value) { - const candidate = value; - return candidate && Is2.string(candidate.id) && candidate.id.length > 0; - } - StaticRegistrationOptions2.hasId = hasId; - })(StaticRegistrationOptions || (exports2.StaticRegistrationOptions = StaticRegistrationOptions = {})); - var TextDocumentRegistrationOptions; - (function(TextDocumentRegistrationOptions2) { - function is(value) { - const candidate = value; - return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); - } - TextDocumentRegistrationOptions2.is = is; - })(TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {})); - var WorkDoneProgressOptions; - (function(WorkDoneProgressOptions2) { - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress)); - } - WorkDoneProgressOptions2.is = is; - function hasWorkDoneProgress(value) { - const candidate = value; - return candidate && Is2.boolean(candidate.workDoneProgress); - } - WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; - })(WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = WorkDoneProgressOptions = {})); - var InitializeRequest; - (function(InitializeRequest2) { - InitializeRequest2.method = "initialize"; - InitializeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - InitializeRequest2.type = new messages_1.ProtocolRequestType(InitializeRequest2.method); - })(InitializeRequest || (exports2.InitializeRequest = InitializeRequest = {})); - var InitializeErrorCodes; - (function(InitializeErrorCodes2) { - InitializeErrorCodes2.unknownProtocolVersion = 1; - })(InitializeErrorCodes || (exports2.InitializeErrorCodes = InitializeErrorCodes = {})); - var InitializedNotification; - (function(InitializedNotification2) { - InitializedNotification2.method = "initialized"; - InitializedNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - InitializedNotification2.type = new messages_1.ProtocolNotificationType(InitializedNotification2.method); - })(InitializedNotification || (exports2.InitializedNotification = InitializedNotification = {})); - var ShutdownRequest; - (function(ShutdownRequest2) { - ShutdownRequest2.method = "shutdown"; - ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method); - })(ShutdownRequest || (exports2.ShutdownRequest = ShutdownRequest = {})); - var ExitNotification; - (function(ExitNotification2) { - ExitNotification2.method = "exit"; - ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method); - })(ExitNotification || (exports2.ExitNotification = ExitNotification = {})); - var DidChangeConfigurationNotification2; - (function(DidChangeConfigurationNotification3) { - DidChangeConfigurationNotification3.method = "workspace/didChangeConfiguration"; - DidChangeConfigurationNotification3.messageDirection = messages_1.MessageDirection.clientToServer; - DidChangeConfigurationNotification3.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification3.method); - })(DidChangeConfigurationNotification2 || (exports2.DidChangeConfigurationNotification = DidChangeConfigurationNotification2 = {})); - var MessageType; - (function(MessageType2) { - MessageType2.Error = 1; - MessageType2.Warning = 2; - MessageType2.Info = 3; - MessageType2.Log = 4; - MessageType2.Debug = 5; - })(MessageType || (exports2.MessageType = MessageType = {})); - var ShowMessageNotification; - (function(ShowMessageNotification2) { - ShowMessageNotification2.method = "window/showMessage"; - ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; - ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method); - })(ShowMessageNotification || (exports2.ShowMessageNotification = ShowMessageNotification = {})); - var ShowMessageRequest; - (function(ShowMessageRequest2) { - ShowMessageRequest2.method = "window/showMessageRequest"; - ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method); - })(ShowMessageRequest || (exports2.ShowMessageRequest = ShowMessageRequest = {})); - var LogMessageNotification; - (function(LogMessageNotification2) { - LogMessageNotification2.method = "window/logMessage"; - LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; - LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method); - })(LogMessageNotification || (exports2.LogMessageNotification = LogMessageNotification = {})); - var TelemetryEventNotification; - (function(TelemetryEventNotification2) { - TelemetryEventNotification2.method = "telemetry/event"; - TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient; - TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method); - })(TelemetryEventNotification || (exports2.TelemetryEventNotification = TelemetryEventNotification = {})); - var TextDocumentSyncKind2; - (function(TextDocumentSyncKind3) { - TextDocumentSyncKind3.None = 0; - TextDocumentSyncKind3.Full = 1; - TextDocumentSyncKind3.Incremental = 2; - })(TextDocumentSyncKind2 || (exports2.TextDocumentSyncKind = TextDocumentSyncKind2 = {})); - var DidOpenTextDocumentNotification; - (function(DidOpenTextDocumentNotification2) { - DidOpenTextDocumentNotification2.method = "textDocument/didOpen"; - DidOpenTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method); - })(DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification = {})); - var TextDocumentContentChangeEvent; - (function(TextDocumentContentChangeEvent2) { - function isIncremental(event) { - let candidate = event; - return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); - } - TextDocumentContentChangeEvent2.isIncremental = isIncremental; - function isFull(event) { - let candidate = event; - return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; - } - TextDocumentContentChangeEvent2.isFull = isFull; - })(TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {})); - var DidChangeTextDocumentNotification; - (function(DidChangeTextDocumentNotification2) { - DidChangeTextDocumentNotification2.method = "textDocument/didChange"; - DidChangeTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method); - })(DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification = {})); - var DidCloseTextDocumentNotification; - (function(DidCloseTextDocumentNotification2) { - DidCloseTextDocumentNotification2.method = "textDocument/didClose"; - DidCloseTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method); - })(DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification = {})); - var DidSaveTextDocumentNotification; - (function(DidSaveTextDocumentNotification2) { - DidSaveTextDocumentNotification2.method = "textDocument/didSave"; - DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); - })(DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {})); - var TextDocumentSaveReason; - (function(TextDocumentSaveReason2) { - TextDocumentSaveReason2.Manual = 1; - TextDocumentSaveReason2.AfterDelay = 2; - TextDocumentSaveReason2.FocusOut = 3; - })(TextDocumentSaveReason || (exports2.TextDocumentSaveReason = TextDocumentSaveReason = {})); - var WillSaveTextDocumentNotification; - (function(WillSaveTextDocumentNotification2) { - WillSaveTextDocumentNotification2.method = "textDocument/willSave"; - WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; - WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); - })(WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {})); - var WillSaveTextDocumentWaitUntilRequest; - (function(WillSaveTextDocumentWaitUntilRequest2) { - WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; - WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); - })(WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {})); - var DidChangeWatchedFilesNotification2; - (function(DidChangeWatchedFilesNotification3) { - DidChangeWatchedFilesNotification3.method = "workspace/didChangeWatchedFiles"; - DidChangeWatchedFilesNotification3.messageDirection = messages_1.MessageDirection.clientToServer; - DidChangeWatchedFilesNotification3.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification3.method); - })(DidChangeWatchedFilesNotification2 || (exports2.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification2 = {})); - var FileChangeType2; - (function(FileChangeType3) { - FileChangeType3.Created = 1; - FileChangeType3.Changed = 2; - FileChangeType3.Deleted = 3; - })(FileChangeType2 || (exports2.FileChangeType = FileChangeType2 = {})); - var RelativePattern; - (function(RelativePattern2) { - function is(value) { - const candidate = value; - return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern); - } - RelativePattern2.is = is; - })(RelativePattern || (exports2.RelativePattern = RelativePattern = {})); - var WatchKind; - (function(WatchKind2) { - WatchKind2.Create = 1; - WatchKind2.Change = 2; - WatchKind2.Delete = 4; - })(WatchKind || (exports2.WatchKind = WatchKind = {})); - var PublishDiagnosticsNotification; - (function(PublishDiagnosticsNotification2) { - PublishDiagnosticsNotification2.method = "textDocument/publishDiagnostics"; - PublishDiagnosticsNotification2.messageDirection = messages_1.MessageDirection.serverToClient; - PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method); - })(PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = PublishDiagnosticsNotification = {})); - var CompletionTriggerKind; - (function(CompletionTriggerKind2) { - CompletionTriggerKind2.Invoked = 1; - CompletionTriggerKind2.TriggerCharacter = 2; - CompletionTriggerKind2.TriggerForIncompleteCompletions = 3; - })(CompletionTriggerKind || (exports2.CompletionTriggerKind = CompletionTriggerKind = {})); - var CompletionRequest; - (function(CompletionRequest2) { - CompletionRequest2.method = "textDocument/completion"; - CompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method); - })(CompletionRequest || (exports2.CompletionRequest = CompletionRequest = {})); - var CompletionResolveRequest; - (function(CompletionResolveRequest2) { - CompletionResolveRequest2.method = "completionItem/resolve"; - CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); - })(CompletionResolveRequest || (exports2.CompletionResolveRequest = CompletionResolveRequest = {})); - var HoverRequest; - (function(HoverRequest2) { - HoverRequest2.method = "textDocument/hover"; - HoverRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method); - })(HoverRequest || (exports2.HoverRequest = HoverRequest = {})); - var SignatureHelpTriggerKind; - (function(SignatureHelpTriggerKind2) { - SignatureHelpTriggerKind2.Invoked = 1; - SignatureHelpTriggerKind2.TriggerCharacter = 2; - SignatureHelpTriggerKind2.ContentChange = 3; - })(SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {})); - var SignatureHelpRequest; - (function(SignatureHelpRequest2) { - SignatureHelpRequest2.method = "textDocument/signatureHelp"; - SignatureHelpRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method); - })(SignatureHelpRequest || (exports2.SignatureHelpRequest = SignatureHelpRequest = {})); - var DefinitionRequest; - (function(DefinitionRequest2) { - DefinitionRequest2.method = "textDocument/definition"; - DefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method); - })(DefinitionRequest || (exports2.DefinitionRequest = DefinitionRequest = {})); - var ReferencesRequest; - (function(ReferencesRequest2) { - ReferencesRequest2.method = "textDocument/references"; - ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); - })(ReferencesRequest || (exports2.ReferencesRequest = ReferencesRequest = {})); - var DocumentHighlightRequest; - (function(DocumentHighlightRequest2) { - DocumentHighlightRequest2.method = "textDocument/documentHighlight"; - DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); - })(DocumentHighlightRequest || (exports2.DocumentHighlightRequest = DocumentHighlightRequest = {})); - var DocumentSymbolRequest; - (function(DocumentSymbolRequest2) { - DocumentSymbolRequest2.method = "textDocument/documentSymbol"; - DocumentSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method); - })(DocumentSymbolRequest || (exports2.DocumentSymbolRequest = DocumentSymbolRequest = {})); - var CodeActionRequest; - (function(CodeActionRequest2) { - CodeActionRequest2.method = "textDocument/codeAction"; - CodeActionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method); - })(CodeActionRequest || (exports2.CodeActionRequest = CodeActionRequest = {})); - var CodeActionResolveRequest; - (function(CodeActionResolveRequest2) { - CodeActionResolveRequest2.method = "codeAction/resolve"; - CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); - })(CodeActionResolveRequest || (exports2.CodeActionResolveRequest = CodeActionResolveRequest = {})); - var WorkspaceSymbolRequest; - (function(WorkspaceSymbolRequest2) { - WorkspaceSymbolRequest2.method = "workspace/symbol"; - WorkspaceSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method); - })(WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {})); - var WorkspaceSymbolResolveRequest; - (function(WorkspaceSymbolResolveRequest2) { - WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve"; - WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method); - })(WorkspaceSymbolResolveRequest || (exports2.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {})); - var CodeLensRequest; - (function(CodeLensRequest2) { - CodeLensRequest2.method = "textDocument/codeLens"; - CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); - })(CodeLensRequest || (exports2.CodeLensRequest = CodeLensRequest = {})); - var CodeLensResolveRequest; - (function(CodeLensResolveRequest2) { - CodeLensResolveRequest2.method = "codeLens/resolve"; - CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); - })(CodeLensResolveRequest || (exports2.CodeLensResolveRequest = CodeLensResolveRequest = {})); - var CodeLensRefreshRequest; - (function(CodeLensRefreshRequest2) { - CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; - CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); - })(CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = CodeLensRefreshRequest = {})); - var DocumentLinkRequest; - (function(DocumentLinkRequest2) { - DocumentLinkRequest2.method = "textDocument/documentLink"; - DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); - })(DocumentLinkRequest || (exports2.DocumentLinkRequest = DocumentLinkRequest = {})); - var DocumentLinkResolveRequest; - (function(DocumentLinkResolveRequest2) { - DocumentLinkResolveRequest2.method = "documentLink/resolve"; - DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); - })(DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {})); - var DocumentFormattingRequest; - (function(DocumentFormattingRequest2) { - DocumentFormattingRequest2.method = "textDocument/formatting"; - DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); - })(DocumentFormattingRequest || (exports2.DocumentFormattingRequest = DocumentFormattingRequest = {})); - var DocumentRangeFormattingRequest; - (function(DocumentRangeFormattingRequest2) { - DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; - DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); - })(DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {})); - var DocumentRangesFormattingRequest; - (function(DocumentRangesFormattingRequest2) { - DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting"; - DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method); - })(DocumentRangesFormattingRequest || (exports2.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {})); - var DocumentOnTypeFormattingRequest; - (function(DocumentOnTypeFormattingRequest2) { - DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; - DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); - })(DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {})); - var PrepareSupportDefaultBehavior; - (function(PrepareSupportDefaultBehavior2) { - PrepareSupportDefaultBehavior2.Identifier = 1; - })(PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {})); - var RenameRequest; - (function(RenameRequest2) { - RenameRequest2.method = "textDocument/rename"; - RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); - })(RenameRequest || (exports2.RenameRequest = RenameRequest = {})); - var PrepareRenameRequest; - (function(PrepareRenameRequest2) { - PrepareRenameRequest2.method = "textDocument/prepareRename"; - PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); - })(PrepareRenameRequest || (exports2.PrepareRenameRequest = PrepareRenameRequest = {})); - var ExecuteCommandRequest; - (function(ExecuteCommandRequest2) { - ExecuteCommandRequest2.method = "workspace/executeCommand"; - ExecuteCommandRequest2.messageDirection = messages_1.MessageDirection.clientToServer; - ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method); - })(ExecuteCommandRequest || (exports2.ExecuteCommandRequest = ExecuteCommandRequest = {})); - var ApplyWorkspaceEditRequest; - (function(ApplyWorkspaceEditRequest2) { - ApplyWorkspaceEditRequest2.method = "workspace/applyEdit"; - ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient; - ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); - })(ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/connection.js -var require_connection2 = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createProtocolConnection = void 0; - var vscode_jsonrpc_1 = require_main(); - function createProtocolConnection(input, output, logger, options) { - if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) { - options = { connectionStrategy: options }; - } - return (0, vscode_jsonrpc_1.createMessageConnection)(input, output, logger, options); - } - exports2.createProtocolConnection = createProtocolConnection; - } -}); - -// node_modules/vscode-languageserver-protocol/lib/common/api.js -var require_api2 = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) - __createBinding(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0; - __exportStar(require_main(), exports2); - __exportStar(require_main2(), exports2); - __exportStar(require_messages2(), exports2); - __exportStar(require_protocol(), exports2); - var connection_1 = require_connection2(); - Object.defineProperty(exports2, "createProtocolConnection", { enumerable: true, get: function() { - return connection_1.createProtocolConnection; - } }); - var LSPErrorCodes2; - (function(LSPErrorCodes3) { - LSPErrorCodes3.lspReservedErrorRangeStart = -32899; - LSPErrorCodes3.RequestFailed = -32803; - LSPErrorCodes3.ServerCancelled = -32802; - LSPErrorCodes3.ContentModified = -32801; - LSPErrorCodes3.RequestCancelled = -32800; - LSPErrorCodes3.lspReservedErrorRangeEnd = -32800; - })(LSPErrorCodes2 || (exports2.LSPErrorCodes = LSPErrorCodes2 = {})); - } -}); - -// node_modules/vscode-languageserver-protocol/lib/node/main.js -var require_main3 = __commonJS({ - "node_modules/vscode-languageserver-protocol/lib/node/main.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) - __createBinding(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createProtocolConnection = void 0; - var node_1 = require_node(); - __exportStar(require_node(), exports2); - __exportStar(require_api2(), exports2); - function createProtocolConnection(input, output, logger, options) { - return (0, node_1.createMessageConnection)(input, output, logger, options); - } - exports2.createProtocolConnection = createProtocolConnection; - } -}); - -// node_modules/vscode-languageserver/lib/common/utils/uuid.js -var require_uuid = __commonJS({ - "node_modules/vscode-languageserver/lib/common/utils/uuid.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.generateUuid = exports2.parse = exports2.isUUID = exports2.v4 = exports2.empty = void 0; - var ValueUUID = class { - constructor(_value) { - this._value = _value; - } - asHex() { - return this._value; - } - equals(other) { - return this.asHex() === other.asHex(); - } - }; - var V4UUID = class _V4UUID extends ValueUUID { - static _oneOf(array) { - return array[Math.floor(array.length * Math.random())]; - } - static _randomHex() { - return _V4UUID._oneOf(_V4UUID._chars); - } - constructor() { - super([ - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - "-", - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - "-", - "4", - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - "-", - _V4UUID._oneOf(_V4UUID._timeHighBits), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - "-", - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex(), - _V4UUID._randomHex() - ].join("")); - } - }; - V4UUID._chars = ["0", "1", "2", "3", "4", "5", "6", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; - V4UUID._timeHighBits = ["8", "9", "a", "b"]; - exports2.empty = new ValueUUID("00000000-0000-0000-0000-000000000000"); - function v4() { - return new V4UUID(); - } - exports2.v4 = v4; - var _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; - function isUUID(value) { - return _UUIDPattern.test(value); - } - exports2.isUUID = isUUID; - function parse(value) { - if (!isUUID(value)) { - throw new Error("invalid uuid"); - } - return new ValueUUID(value); - } - exports2.parse = parse; - function generateUuid() { - return v4().asHex(); - } - exports2.generateUuid = generateUuid; - } -}); - -// node_modules/vscode-languageserver/lib/common/progress.js -var require_progress = __commonJS({ - "node_modules/vscode-languageserver/lib/common/progress.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.attachPartialResult = exports2.ProgressFeature = exports2.attachWorkDone = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var uuid_1 = require_uuid(); - var WorkDoneProgressReporterImpl = class _WorkDoneProgressReporterImpl { - constructor(_connection, _token) { - this._connection = _connection; - this._token = _token; - _WorkDoneProgressReporterImpl.Instances.set(this._token, this); - } - begin(title, percentage, message, cancellable) { - let param = { - kind: "begin", - title, - percentage, - message, - cancellable - }; - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param); - } - report(arg0, arg1) { - let param = { - kind: "report" - }; - if (typeof arg0 === "number") { - param.percentage = arg0; - if (arg1 !== void 0) { - param.message = arg1; - } - } else { - param.message = arg0; - } - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param); - } - done() { - _WorkDoneProgressReporterImpl.Instances.delete(this._token); - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: "end" }); - } - }; - WorkDoneProgressReporterImpl.Instances = /* @__PURE__ */ new Map(); - var WorkDoneProgressServerReporterImpl = class extends WorkDoneProgressReporterImpl { - constructor(connection2, token) { - super(connection2, token); - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - done() { - this._source.dispose(); - super.done(); - } - cancel() { - this._source.cancel(); - } - }; - var NullProgressReporter = class { - constructor() { - } - begin() { - } - report() { - } - done() { - } - }; - var NullProgressServerReporter = class extends NullProgressReporter { - constructor() { - super(); - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - done() { - this._source.dispose(); - } - cancel() { - this._source.cancel(); - } - }; - function attachWorkDone(connection2, params) { - if (params === void 0 || params.workDoneToken === void 0) { - return new NullProgressReporter(); - } - const token = params.workDoneToken; - delete params.workDoneToken; - return new WorkDoneProgressReporterImpl(connection2, token); - } - exports2.attachWorkDone = attachWorkDone; - var ProgressFeature = (Base) => { - return class extends Base { - constructor() { - super(); - this._progressSupported = false; - } - initialize(capabilities) { - var _a; - super.initialize(capabilities); - if (((_a = capabilities == null ? void 0 : capabilities.window) == null ? void 0 : _a.workDoneProgress) === true) { - this._progressSupported = true; - this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => { - let progress = WorkDoneProgressReporterImpl.Instances.get(params.token); - if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) { - progress.cancel(); - } - }); - } - } - attachWorkDoneProgress(token) { - if (token === void 0) { - return new NullProgressReporter(); - } else { - return new WorkDoneProgressReporterImpl(this.connection, token); - } - } - createWorkDoneProgress() { - if (this._progressSupported) { - const token = (0, uuid_1.generateUuid)(); - return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => { - const result = new WorkDoneProgressServerReporterImpl(this.connection, token); - return result; - }); - } else { - return Promise.resolve(new NullProgressServerReporter()); - } - } - }; - }; - exports2.ProgressFeature = ProgressFeature; - var ResultProgress; - (function(ResultProgress2) { - ResultProgress2.type = new vscode_languageserver_protocol_1.ProgressType(); - })(ResultProgress || (ResultProgress = {})); - var ResultProgressReporterImpl = class { - constructor(_connection, _token) { - this._connection = _connection; - this._token = _token; - } - report(data) { - this._connection.sendProgress(ResultProgress.type, this._token, data); - } - }; - function attachPartialResult(connection2, params) { - if (params === void 0 || params.partialResultToken === void 0) { - return void 0; - } - const token = params.partialResultToken; - delete params.partialResultToken; - return new ResultProgressReporterImpl(connection2, token); - } - exports2.attachPartialResult = attachPartialResult; - } -}); - -// node_modules/vscode-languageserver/lib/common/configuration.js -var require_configuration = __commonJS({ - "node_modules/vscode-languageserver/lib/common/configuration.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ConfigurationFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var Is2 = require_is(); - var ConfigurationFeature = (Base) => { - return class extends Base { - getConfiguration(arg) { - if (!arg) { - return this._getConfiguration({}); - } else if (Is2.string(arg)) { - return this._getConfiguration({ section: arg }); - } else { - return this._getConfiguration(arg); - } - } - _getConfiguration(arg) { - let params = { - items: Array.isArray(arg) ? arg : [arg] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => { - if (Array.isArray(result)) { - return Array.isArray(arg) ? result : result[0]; - } else { - return Array.isArray(arg) ? [] : null; - } - }); - } - }; - }; - exports2.ConfigurationFeature = ConfigurationFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/workspaceFolder.js -var require_workspaceFolder = __commonJS({ - "node_modules/vscode-languageserver/lib/common/workspaceFolder.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.WorkspaceFoldersFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var WorkspaceFoldersFeature = (Base) => { - return class extends Base { - constructor() { - super(); - this._notificationIsAutoRegistered = false; - } - initialize(capabilities) { - super.initialize(capabilities); - let workspaceCapabilities = capabilities.workspace; - if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) { - this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter(); - this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => { - this._onDidChangeWorkspaceFolders.fire(params.event); - }); - } - } - fillServerCapabilities(capabilities) { - var _a, _b; - super.fillServerCapabilities(capabilities); - const changeNotifications = (_b = (_a = capabilities.workspace) == null ? void 0 : _a.workspaceFolders) == null ? void 0 : _b.changeNotifications; - this._notificationIsAutoRegistered = changeNotifications === true || typeof changeNotifications === "string"; - } - getWorkspaceFolders() { - return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type); - } - get onDidChangeWorkspaceFolders() { - if (!this._onDidChangeWorkspaceFolders) { - throw new Error("Client doesn't support sending workspace folder change events."); - } - if (!this._notificationIsAutoRegistered && !this._unregistration) { - this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type); - } - return this._onDidChangeWorkspaceFolders.event; - } - }; - }; - exports2.WorkspaceFoldersFeature = WorkspaceFoldersFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/callHierarchy.js -var require_callHierarchy = __commonJS({ - "node_modules/vscode-languageserver/lib/common/callHierarchy.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CallHierarchyFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var CallHierarchyFeature = (Base) => { - return class extends Base { - get callHierarchy() { - return { - onPrepare: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), void 0); - }); - }, - onIncomingCalls: (handler) => { - const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onOutgoingCalls: (handler) => { - const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; - }; - exports2.CallHierarchyFeature = CallHierarchyFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/semanticTokens.js -var require_semanticTokens = __commonJS({ - "node_modules/vscode-languageserver/lib/common/semanticTokens.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SemanticTokensBuilder = exports2.SemanticTokensDiff = exports2.SemanticTokensFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var SemanticTokensFeature = (Base) => { - return class extends Base { - get semanticTokens() { - return { - refresh: () => { - return this.connection.sendRequest(vscode_languageserver_protocol_1.SemanticTokensRefreshRequest.type); - }, - on: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onDelta: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onRange: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; - }; - exports2.SemanticTokensFeature = SemanticTokensFeature; - var SemanticTokensDiff = class { - constructor(originalSequence, modifiedSequence) { - this.originalSequence = originalSequence; - this.modifiedSequence = modifiedSequence; - } - computeDiff() { - const originalLength = this.originalSequence.length; - const modifiedLength = this.modifiedSequence.length; - let startIndex = 0; - while (startIndex < modifiedLength && startIndex < originalLength && this.originalSequence[startIndex] === this.modifiedSequence[startIndex]) { - startIndex++; - } - if (startIndex < modifiedLength && startIndex < originalLength) { - let originalEndIndex = originalLength - 1; - let modifiedEndIndex = modifiedLength - 1; - while (originalEndIndex >= startIndex && modifiedEndIndex >= startIndex && this.originalSequence[originalEndIndex] === this.modifiedSequence[modifiedEndIndex]) { - originalEndIndex--; - modifiedEndIndex--; - } - if (originalEndIndex < startIndex || modifiedEndIndex < startIndex) { - originalEndIndex++; - modifiedEndIndex++; - } - const deleteCount = originalEndIndex - startIndex + 1; - const newData = this.modifiedSequence.slice(startIndex, modifiedEndIndex + 1); - if (newData.length === 1 && newData[0] === this.originalSequence[originalEndIndex]) { - return [ - { start: startIndex, deleteCount: deleteCount - 1 } - ]; - } else { - return [ - { start: startIndex, deleteCount, data: newData } - ]; - } - } else if (startIndex < modifiedLength) { - return [ - { start: startIndex, deleteCount: 0, data: this.modifiedSequence.slice(startIndex) } - ]; - } else if (startIndex < originalLength) { - return [ - { start: startIndex, deleteCount: originalLength - startIndex } - ]; - } else { - return []; - } - } - }; - exports2.SemanticTokensDiff = SemanticTokensDiff; - var SemanticTokensBuilder = class { - constructor() { - this._prevData = void 0; - this.initialize(); - } - initialize() { - this._id = Date.now(); - this._prevLine = 0; - this._prevChar = 0; - this._data = []; - this._dataLen = 0; - } - push(line, char, length, tokenType, tokenModifiers) { - let pushLine = line; - let pushChar = char; - if (this._dataLen > 0) { - pushLine -= this._prevLine; - if (pushLine === 0) { - pushChar -= this._prevChar; - } - } - this._data[this._dataLen++] = pushLine; - this._data[this._dataLen++] = pushChar; - this._data[this._dataLen++] = length; - this._data[this._dataLen++] = tokenType; - this._data[this._dataLen++] = tokenModifiers; - this._prevLine = line; - this._prevChar = char; - } - get id() { - return this._id.toString(); - } - previousResult(id) { - if (this.id === id) { - this._prevData = this._data; - } - this.initialize(); - } - build() { - this._prevData = void 0; - return { - resultId: this.id, - data: this._data - }; - } - canBuildEdits() { - return this._prevData !== void 0; - } - buildEdits() { - if (this._prevData !== void 0) { - return { - resultId: this.id, - edits: new SemanticTokensDiff(this._prevData, this._data).computeDiff() - }; - } else { - return this.build(); - } - } - }; - exports2.SemanticTokensBuilder = SemanticTokensBuilder; - } -}); - -// node_modules/vscode-languageserver/lib/common/showDocument.js -var require_showDocument = __commonJS({ - "node_modules/vscode-languageserver/lib/common/showDocument.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ShowDocumentFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var ShowDocumentFeature = (Base) => { - return class extends Base { - showDocument(params) { - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params); - } - }; - }; - exports2.ShowDocumentFeature = ShowDocumentFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/fileOperations.js -var require_fileOperations = __commonJS({ - "node_modules/vscode-languageserver/lib/common/fileOperations.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.FileOperationsFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var FileOperationsFeature = (Base) => { - return class extends Base { - onDidCreateFiles(handler) { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => { - handler(params); - }); - } - onDidRenameFiles(handler) { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => { - handler(params); - }); - } - onDidDeleteFiles(handler) { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => { - handler(params); - }); - } - onWillCreateFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - onWillRenameFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - onWillDeleteFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - }; - }; - exports2.FileOperationsFeature = FileOperationsFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/linkedEditingRange.js -var require_linkedEditingRange = __commonJS({ - "node_modules/vscode-languageserver/lib/common/linkedEditingRange.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LinkedEditingRangeFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var LinkedEditingRangeFeature = (Base) => { - return class extends Base { - onLinkedEditingRange(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), void 0); - }); - } - }; - }; - exports2.LinkedEditingRangeFeature = LinkedEditingRangeFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/typeHierarchy.js -var require_typeHierarchy = __commonJS({ - "node_modules/vscode-languageserver/lib/common/typeHierarchy.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TypeHierarchyFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var TypeHierarchyFeature = (Base) => { - return class extends Base { - get typeHierarchy() { - return { - onPrepare: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.TypeHierarchyPrepareRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), void 0); - }); - }, - onSupertypes: (handler) => { - const type = vscode_languageserver_protocol_1.TypeHierarchySupertypesRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onSubtypes: (handler) => { - const type = vscode_languageserver_protocol_1.TypeHierarchySubtypesRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; - }; - exports2.TypeHierarchyFeature = TypeHierarchyFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/inlineValue.js -var require_inlineValue = __commonJS({ - "node_modules/vscode-languageserver/lib/common/inlineValue.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineValueFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var InlineValueFeature = (Base) => { - return class extends Base { - get inlineValue() { - return { - refresh: () => { - return this.connection.sendRequest(vscode_languageserver_protocol_1.InlineValueRefreshRequest.type); - }, - on: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.InlineValueRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params)); - }); - } - }; - } - }; - }; - exports2.InlineValueFeature = InlineValueFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/foldingRange.js -var require_foldingRange = __commonJS({ - "node_modules/vscode-languageserver/lib/common/foldingRange.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.FoldingRangeFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var FoldingRangeFeature = (Base) => { - return class extends Base { - get foldingRange() { - return { - refresh: () => { - return this.connection.sendRequest(vscode_languageserver_protocol_1.FoldingRangeRefreshRequest.type); - }, - on: (handler) => { - const type = vscode_languageserver_protocol_1.FoldingRangeRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; - }; - exports2.FoldingRangeFeature = FoldingRangeFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/inlayHint.js -var require_inlayHint = __commonJS({ - "node_modules/vscode-languageserver/lib/common/inlayHint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlayHintFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var InlayHintFeature = (Base) => { - return class extends Base { - get inlayHint() { - return { - refresh: () => { - return this.connection.sendRequest(vscode_languageserver_protocol_1.InlayHintRefreshRequest.type); - }, - on: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.InlayHintRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params)); - }); - }, - resolve: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.InlayHintResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - }; - } - }; - }; - exports2.InlayHintFeature = InlayHintFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/diagnostic.js -var require_diagnostic = __commonJS({ - "node_modules/vscode-languageserver/lib/common/diagnostic.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DiagnosticFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var DiagnosticFeature = (Base) => { - return class extends Base { - get diagnostics() { - return { - refresh: () => { - return this.connection.sendRequest(vscode_languageserver_protocol_1.DiagnosticRefreshRequest.type); - }, - on: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.DocumentDiagnosticRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.DocumentDiagnosticRequest.partialResult, params)); - }); - }, - onWorkspace: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.WorkspaceDiagnosticRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.WorkspaceDiagnosticRequest.partialResult, params)); - }); - } - }; - } - }; - }; - exports2.DiagnosticFeature = DiagnosticFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/textDocuments.js -var require_textDocuments = __commonJS({ - "node_modules/vscode-languageserver/lib/common/textDocuments.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TextDocuments = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var TextDocuments2 = class { - /** - * Create a new text document manager. - */ - constructor(configuration) { - this._configuration = configuration; - this._syncedDocuments = /* @__PURE__ */ new Map(); - this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter(); - this._onDidOpen = new vscode_languageserver_protocol_1.Emitter(); - this._onDidClose = new vscode_languageserver_protocol_1.Emitter(); - this._onDidSave = new vscode_languageserver_protocol_1.Emitter(); - this._onWillSave = new vscode_languageserver_protocol_1.Emitter(); - } - /** - * An event that fires when a text document managed by this manager - * has been opened. - */ - get onDidOpen() { - return this._onDidOpen.event; - } - /** - * An event that fires when a text document managed by this manager - * has been opened or the content changes. - */ - get onDidChangeContent() { - return this._onDidChangeContent.event; - } - /** - * An event that fires when a text document managed by this manager - * will be saved. - */ - get onWillSave() { - return this._onWillSave.event; - } - /** - * Sets a handler that will be called if a participant wants to provide - * edits during a text document save. - */ - onWillSaveWaitUntil(handler) { - this._willSaveWaitUntil = handler; - } - /** - * An event that fires when a text document managed by this manager - * has been saved. - */ - get onDidSave() { - return this._onDidSave.event; - } - /** - * An event that fires when a text document managed by this manager - * has been closed. - */ - get onDidClose() { - return this._onDidClose.event; - } - /** - * Returns the document for the given URI. Returns undefined if - * the document is not managed by this instance. - * - * @param uri The text document's URI to retrieve. - * @return the text document or `undefined`. - */ - get(uri) { - return this._syncedDocuments.get(uri); - } - /** - * Returns all text documents managed by this instance. - * - * @return all text documents. - */ - all() { - return Array.from(this._syncedDocuments.values()); - } - /** - * Returns the URIs of all text documents managed by this instance. - * - * @return the URI's of all text documents. - */ - keys() { - return Array.from(this._syncedDocuments.keys()); - } - /** - * Listens for `low level` notification on the given connection to - * update the text documents managed by this instance. - * - * Please note that the connection only provides handlers not an event model. Therefore - * listening on a connection will overwrite the following handlers on a connection: - * `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`, - * `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`. - * - * Use the corresponding events on the TextDocuments instance instead. - * - * @param connection The connection to listen on. - */ - listen(connection2) { - connection2.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Incremental; - const disposables = []; - disposables.push(connection2.onDidOpenTextDocument((event) => { - const td = event.textDocument; - const document = this._configuration.create(td.uri, td.languageId, td.version, td.text); - this._syncedDocuments.set(td.uri, document); - const toFire = Object.freeze({ document }); - this._onDidOpen.fire(toFire); - this._onDidChangeContent.fire(toFire); - })); - disposables.push(connection2.onDidChangeTextDocument((event) => { - const td = event.textDocument; - const changes = event.contentChanges; - if (changes.length === 0) { - return; - } - const { version } = td; - if (version === null || version === void 0) { - throw new Error(`Received document change event for ${td.uri} without valid version identifier`); - } - let syncedDocument = this._syncedDocuments.get(td.uri); - if (syncedDocument !== void 0) { - syncedDocument = this._configuration.update(syncedDocument, changes, version); - this._syncedDocuments.set(td.uri, syncedDocument); - this._onDidChangeContent.fire(Object.freeze({ document: syncedDocument })); - } - })); - disposables.push(connection2.onDidCloseTextDocument((event) => { - let syncedDocument = this._syncedDocuments.get(event.textDocument.uri); - if (syncedDocument !== void 0) { - this._syncedDocuments.delete(event.textDocument.uri); - this._onDidClose.fire(Object.freeze({ document: syncedDocument })); - } - })); - disposables.push(connection2.onWillSaveTextDocument((event) => { - let syncedDocument = this._syncedDocuments.get(event.textDocument.uri); - if (syncedDocument !== void 0) { - this._onWillSave.fire(Object.freeze({ document: syncedDocument, reason: event.reason })); - } - })); - disposables.push(connection2.onWillSaveTextDocumentWaitUntil((event, token) => { - let syncedDocument = this._syncedDocuments.get(event.textDocument.uri); - if (syncedDocument !== void 0 && this._willSaveWaitUntil) { - return this._willSaveWaitUntil(Object.freeze({ document: syncedDocument, reason: event.reason }), token); - } else { - return []; - } - })); - disposables.push(connection2.onDidSaveTextDocument((event) => { - let syncedDocument = this._syncedDocuments.get(event.textDocument.uri); - if (syncedDocument !== void 0) { - this._onDidSave.fire(Object.freeze({ document: syncedDocument })); - } - })); - return vscode_languageserver_protocol_1.Disposable.create(() => { - disposables.forEach((disposable) => disposable.dispose()); - }); - } - }; - exports2.TextDocuments = TextDocuments2; - } -}); - -// node_modules/vscode-languageserver/lib/common/notebook.js -var require_notebook = __commonJS({ - "node_modules/vscode-languageserver/lib/common/notebook.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.NotebookDocuments = exports2.NotebookSyncFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var textDocuments_1 = require_textDocuments(); - var NotebookSyncFeature = (Base) => { - return class extends Base { - get synchronization() { - return { - onDidOpenNotebookDocument: (handler) => { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidOpenNotebookDocumentNotification.type, (params) => { - handler(params); - }); - }, - onDidChangeNotebookDocument: (handler) => { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeNotebookDocumentNotification.type, (params) => { - handler(params); - }); - }, - onDidSaveNotebookDocument: (handler) => { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidSaveNotebookDocumentNotification.type, (params) => { - handler(params); - }); - }, - onDidCloseNotebookDocument: (handler) => { - return this.connection.onNotification(vscode_languageserver_protocol_1.DidCloseNotebookDocumentNotification.type, (params) => { - handler(params); - }); - } - }; - } - }; - }; - exports2.NotebookSyncFeature = NotebookSyncFeature; - var CellTextDocumentConnection = class _CellTextDocumentConnection { - onDidOpenTextDocument(handler) { - this.openHandler = handler; - return vscode_languageserver_protocol_1.Disposable.create(() => { - this.openHandler = void 0; - }); - } - openTextDocument(params) { - this.openHandler && this.openHandler(params); - } - onDidChangeTextDocument(handler) { - this.changeHandler = handler; - return vscode_languageserver_protocol_1.Disposable.create(() => { - this.changeHandler = handler; - }); - } - changeTextDocument(params) { - this.changeHandler && this.changeHandler(params); - } - onDidCloseTextDocument(handler) { - this.closeHandler = handler; - return vscode_languageserver_protocol_1.Disposable.create(() => { - this.closeHandler = void 0; - }); - } - closeTextDocument(params) { - this.closeHandler && this.closeHandler(params); - } - onWillSaveTextDocument() { - return _CellTextDocumentConnection.NULL_DISPOSE; - } - onWillSaveTextDocumentWaitUntil() { - return _CellTextDocumentConnection.NULL_DISPOSE; - } - onDidSaveTextDocument() { - return _CellTextDocumentConnection.NULL_DISPOSE; - } - }; - CellTextDocumentConnection.NULL_DISPOSE = Object.freeze({ dispose: () => { - } }); - var NotebookDocuments = class { - constructor(configurationOrTextDocuments) { - if (configurationOrTextDocuments instanceof textDocuments_1.TextDocuments) { - this._cellTextDocuments = configurationOrTextDocuments; - } else { - this._cellTextDocuments = new textDocuments_1.TextDocuments(configurationOrTextDocuments); - } - this.notebookDocuments = /* @__PURE__ */ new Map(); - this.notebookCellMap = /* @__PURE__ */ new Map(); - this._onDidOpen = new vscode_languageserver_protocol_1.Emitter(); - this._onDidChange = new vscode_languageserver_protocol_1.Emitter(); - this._onDidSave = new vscode_languageserver_protocol_1.Emitter(); - this._onDidClose = new vscode_languageserver_protocol_1.Emitter(); - } - get cellTextDocuments() { - return this._cellTextDocuments; - } - getCellTextDocument(cell) { - return this._cellTextDocuments.get(cell.document); - } - getNotebookDocument(uri) { - return this.notebookDocuments.get(uri); - } - getNotebookCell(uri) { - const value = this.notebookCellMap.get(uri); - return value && value[0]; - } - findNotebookDocumentForCell(cell) { - const key = typeof cell === "string" ? cell : cell.document; - const value = this.notebookCellMap.get(key); - return value && value[1]; - } - get onDidOpen() { - return this._onDidOpen.event; - } - get onDidSave() { - return this._onDidSave.event; - } - get onDidChange() { - return this._onDidChange.event; - } - get onDidClose() { - return this._onDidClose.event; - } - /** - * Listens for `low level` notification on the given connection to - * update the notebook documents managed by this instance. - * - * Please note that the connection only provides handlers not an event model. Therefore - * listening on a connection will overwrite the following handlers on a connection: - * `onDidOpenNotebookDocument`, `onDidChangeNotebookDocument`, `onDidSaveNotebookDocument`, - * and `onDidCloseNotebookDocument`. - * - * @param connection The connection to listen on. - */ - listen(connection2) { - const cellTextDocumentConnection = new CellTextDocumentConnection(); - const disposables = []; - disposables.push(this.cellTextDocuments.listen(cellTextDocumentConnection)); - disposables.push(connection2.notebooks.synchronization.onDidOpenNotebookDocument((params) => { - this.notebookDocuments.set(params.notebookDocument.uri, params.notebookDocument); - for (const cellTextDocument of params.cellTextDocuments) { - cellTextDocumentConnection.openTextDocument({ textDocument: cellTextDocument }); - } - this.updateCellMap(params.notebookDocument); - this._onDidOpen.fire(params.notebookDocument); - })); - disposables.push(connection2.notebooks.synchronization.onDidChangeNotebookDocument((params) => { - const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri); - if (notebookDocument === void 0) { - return; - } - notebookDocument.version = params.notebookDocument.version; - const oldMetadata = notebookDocument.metadata; - let metadataChanged = false; - const change = params.change; - if (change.metadata !== void 0) { - metadataChanged = true; - notebookDocument.metadata = change.metadata; - } - const opened = []; - const closed = []; - const data = []; - const text = []; - if (change.cells !== void 0) { - const changedCells = change.cells; - if (changedCells.structure !== void 0) { - const array = changedCells.structure.array; - notebookDocument.cells.splice(array.start, array.deleteCount, ...array.cells !== void 0 ? array.cells : []); - if (changedCells.structure.didOpen !== void 0) { - for (const open of changedCells.structure.didOpen) { - cellTextDocumentConnection.openTextDocument({ textDocument: open }); - opened.push(open.uri); - } - } - if (changedCells.structure.didClose) { - for (const close of changedCells.structure.didClose) { - cellTextDocumentConnection.closeTextDocument({ textDocument: close }); - closed.push(close.uri); - } - } - } - if (changedCells.data !== void 0) { - const cellUpdates = new Map(changedCells.data.map((cell) => [cell.document, cell])); - for (let i = 0; i <= notebookDocument.cells.length; i++) { - const change2 = cellUpdates.get(notebookDocument.cells[i].document); - if (change2 !== void 0) { - const old = notebookDocument.cells.splice(i, 1, change2); - data.push({ old: old[0], new: change2 }); - cellUpdates.delete(change2.document); - if (cellUpdates.size === 0) { - break; - } - } - } - } - if (changedCells.textContent !== void 0) { - for (const cellTextDocument of changedCells.textContent) { - cellTextDocumentConnection.changeTextDocument({ textDocument: cellTextDocument.document, contentChanges: cellTextDocument.changes }); - text.push(cellTextDocument.document.uri); - } - } - } - this.updateCellMap(notebookDocument); - const changeEvent = { notebookDocument }; - if (metadataChanged) { - changeEvent.metadata = { old: oldMetadata, new: notebookDocument.metadata }; - } - const added = []; - for (const open of opened) { - added.push(this.getNotebookCell(open)); - } - const removed = []; - for (const close of closed) { - removed.push(this.getNotebookCell(close)); - } - const textContent = []; - for (const change2 of text) { - textContent.push(this.getNotebookCell(change2)); - } - if (added.length > 0 || removed.length > 0 || data.length > 0 || textContent.length > 0) { - changeEvent.cells = { added, removed, changed: { data, textContent } }; - } - if (changeEvent.metadata !== void 0 || changeEvent.cells !== void 0) { - this._onDidChange.fire(changeEvent); - } - })); - disposables.push(connection2.notebooks.synchronization.onDidSaveNotebookDocument((params) => { - const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri); - if (notebookDocument === void 0) { - return; - } - this._onDidSave.fire(notebookDocument); - })); - disposables.push(connection2.notebooks.synchronization.onDidCloseNotebookDocument((params) => { - const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri); - if (notebookDocument === void 0) { - return; - } - this._onDidClose.fire(notebookDocument); - for (const cellTextDocument of params.cellTextDocuments) { - cellTextDocumentConnection.closeTextDocument({ textDocument: cellTextDocument }); - } - this.notebookDocuments.delete(params.notebookDocument.uri); - for (const cell of notebookDocument.cells) { - this.notebookCellMap.delete(cell.document); - } - })); - return vscode_languageserver_protocol_1.Disposable.create(() => { - disposables.forEach((disposable) => disposable.dispose()); - }); - } - updateCellMap(notebookDocument) { - for (const cell of notebookDocument.cells) { - this.notebookCellMap.set(cell.document, [cell, notebookDocument]); - } - } - }; - exports2.NotebookDocuments = NotebookDocuments; - } -}); - -// node_modules/vscode-languageserver/lib/common/moniker.js -var require_moniker = __commonJS({ - "node_modules/vscode-languageserver/lib/common/moniker.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.MonikerFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var MonikerFeature = (Base) => { - return class extends Base { - get moniker() { - return { - on: (handler) => { - const type = vscode_languageserver_protocol_1.MonikerRequest.type; - return this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; - }; - exports2.MonikerFeature = MonikerFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/server.js -var require_server = __commonJS({ - "node_modules/vscode-languageserver/lib/common/server.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createConnection = exports2.combineFeatures = exports2.combineNotebooksFeatures = exports2.combineLanguagesFeatures = exports2.combineWorkspaceFeatures = exports2.combineWindowFeatures = exports2.combineClientFeatures = exports2.combineTracerFeatures = exports2.combineTelemetryFeatures = exports2.combineConsoleFeatures = exports2._NotebooksImpl = exports2._LanguagesImpl = exports2.BulkUnregistration = exports2.BulkRegistration = exports2.ErrorMessageTracker = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var Is2 = require_is(); - var UUID = require_uuid(); - var progress_1 = require_progress(); - var configuration_1 = require_configuration(); - var workspaceFolder_1 = require_workspaceFolder(); - var callHierarchy_1 = require_callHierarchy(); - var semanticTokens_1 = require_semanticTokens(); - var showDocument_1 = require_showDocument(); - var fileOperations_1 = require_fileOperations(); - var linkedEditingRange_1 = require_linkedEditingRange(); - var typeHierarchy_1 = require_typeHierarchy(); - var inlineValue_1 = require_inlineValue(); - var foldingRange_1 = require_foldingRange(); - var inlayHint_1 = require_inlayHint(); - var diagnostic_1 = require_diagnostic(); - var notebook_1 = require_notebook(); - var moniker_1 = require_moniker(); - function null2Undefined(value) { - if (value === null) { - return void 0; - } - return value; - } - var ErrorMessageTracker = class { - constructor() { - this._messages = /* @__PURE__ */ Object.create(null); - } - /** - * Add a message to the tracker. - * - * @param message The message to add. - */ - add(message) { - let count = this._messages[message]; - if (!count) { - count = 0; - } - count++; - this._messages[message] = count; - } - /** - * Send all tracked messages to the connection's window. - * - * @param connection The connection established between client and server. - */ - sendErrors(connection2) { - Object.keys(this._messages).forEach((message) => { - connection2.window.showErrorMessage(message); - }); - } - }; - exports2.ErrorMessageTracker = ErrorMessageTracker; - var RemoteConsoleImpl = class { - constructor() { - } - rawAttach(connection2) { - this._rawConnection = connection2; - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - fillServerCapabilities(_capabilities) { - } - initialize(_capabilities) { - } - error(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Error, message); - } - warn(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Warning, message); - } - info(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Info, message); - } - log(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Log, message); - } - debug(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Debug, message); - } - send(type, message) { - if (this._rawConnection) { - this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message }).catch(() => { - (0, vscode_languageserver_protocol_1.RAL)().console.error(`Sending log message failed`); - }); - } - } - }; - var _RemoteWindowImpl = class { - constructor() { - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - showErrorMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } - showWarningMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } - showInformationMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } - }; - var RemoteWindowImpl = (0, showDocument_1.ShowDocumentFeature)((0, progress_1.ProgressFeature)(_RemoteWindowImpl)); - var BulkRegistration; - (function(BulkRegistration2) { - function create() { - return new BulkRegistrationImpl(); - } - BulkRegistration2.create = create; - })(BulkRegistration || (exports2.BulkRegistration = BulkRegistration = {})); - var BulkRegistrationImpl = class { - constructor() { - this._registrations = []; - this._registered = /* @__PURE__ */ new Set(); - } - add(type, registerOptions) { - const method = Is2.string(type) ? type : type.method; - if (this._registered.has(method)) { - throw new Error(`${method} is already added to this registration`); - } - const id = UUID.generateUuid(); - this._registrations.push({ - id, - method, - registerOptions: registerOptions || {} - }); - this._registered.add(method); - } - asRegistrationParams() { - return { - registrations: this._registrations - }; - } - }; - var BulkUnregistration; - (function(BulkUnregistration2) { - function create() { - return new BulkUnregistrationImpl(void 0, []); - } - BulkUnregistration2.create = create; - })(BulkUnregistration || (exports2.BulkUnregistration = BulkUnregistration = {})); - var BulkUnregistrationImpl = class { - constructor(_connection, unregistrations) { - this._connection = _connection; - this._unregistrations = /* @__PURE__ */ new Map(); - unregistrations.forEach((unregistration) => { - this._unregistrations.set(unregistration.method, unregistration); - }); - } - get isAttached() { - return !!this._connection; - } - attach(connection2) { - this._connection = connection2; - } - add(unregistration) { - this._unregistrations.set(unregistration.method, unregistration); - } - dispose() { - let unregistrations = []; - for (let unregistration of this._unregistrations.values()) { - unregistrations.push(unregistration); - } - let params = { - unregisterations: unregistrations - }; - this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).catch(() => { - this._connection.console.info(`Bulk unregistration failed.`); - }); - } - disposeSingle(arg) { - const method = Is2.string(arg) ? arg : arg.method; - const unregistration = this._unregistrations.get(method); - if (!unregistration) { - return false; - } - let params = { - unregisterations: [unregistration] - }; - this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => { - this._unregistrations.delete(method); - }, (_error) => { - this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`); - }); - return true; - } - }; - var RemoteClientImpl = class { - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - register(typeOrRegistrations, registerOptionsOrType, registerOptions) { - if (typeOrRegistrations instanceof BulkRegistrationImpl) { - return this.registerMany(typeOrRegistrations); - } else if (typeOrRegistrations instanceof BulkUnregistrationImpl) { - return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions); - } else { - return this.registerSingle2(typeOrRegistrations, registerOptionsOrType); - } - } - registerSingle1(unregistration, type, registerOptions) { - const method = Is2.string(type) ? type : type.method; - const id = UUID.generateUuid(); - let params = { - registrations: [{ id, method, registerOptions: registerOptions || {} }] - }; - if (!unregistration.isAttached) { - unregistration.attach(this.connection); - } - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => { - unregistration.add({ id, method }); - return unregistration; - }, (_error) => { - this.connection.console.info(`Registering request handler for ${method} failed.`); - return Promise.reject(_error); - }); - } - registerSingle2(type, registerOptions) { - const method = Is2.string(type) ? type : type.method; - const id = UUID.generateUuid(); - let params = { - registrations: [{ id, method, registerOptions: registerOptions || {} }] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => { - return vscode_languageserver_protocol_1.Disposable.create(() => { - this.unregisterSingle(id, method).catch(() => { - this.connection.console.info(`Un-registering capability with id ${id} failed.`); - }); - }); - }, (_error) => { - this.connection.console.info(`Registering request handler for ${method} failed.`); - return Promise.reject(_error); - }); - } - unregisterSingle(id, method) { - let params = { - unregisterations: [{ id, method }] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).catch(() => { - this.connection.console.info(`Un-registering request handler for ${id} failed.`); - }); - } - registerMany(registrations) { - let params = registrations.asRegistrationParams(); - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => { - return new BulkUnregistrationImpl(this._connection, params.registrations.map((registration) => { - return { id: registration.id, method: registration.method }; - })); - }, (_error) => { - this.connection.console.info(`Bulk registration failed.`); - return Promise.reject(_error); - }); - } - }; - var _RemoteWorkspaceImpl = class { - constructor() { - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - applyEdit(paramOrEdit) { - function isApplyWorkspaceEditParams(value) { - return value && !!value.edit; - } - let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params); - } - }; - var RemoteWorkspaceImpl = (0, fileOperations_1.FileOperationsFeature)((0, workspaceFolder_1.WorkspaceFoldersFeature)((0, configuration_1.ConfigurationFeature)(_RemoteWorkspaceImpl))); - var TracerImpl = class { - constructor() { - this._trace = vscode_languageserver_protocol_1.Trace.Off; - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - set trace(value) { - this._trace = value; - } - log(message, verbose) { - if (this._trace === vscode_languageserver_protocol_1.Trace.Off) { - return; - } - this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, { - message, - verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : void 0 - }).catch(() => { - }); - } - }; - var TelemetryImpl = class { - constructor() { - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - logEvent(data) { - this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data).catch(() => { - this.connection.console.log(`Sending TelemetryEventNotification failed`); - }); - } - }; - var _LanguagesImpl = class { - constructor() { - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - attachWorkDoneProgress(params) { - return (0, progress_1.attachWorkDone)(this.connection, params); - } - attachPartialResultProgress(_type, params) { - return (0, progress_1.attachPartialResult)(this.connection, params); - } - }; - exports2._LanguagesImpl = _LanguagesImpl; - var LanguagesImpl = (0, foldingRange_1.FoldingRangeFeature)((0, moniker_1.MonikerFeature)((0, diagnostic_1.DiagnosticFeature)((0, inlayHint_1.InlayHintFeature)((0, inlineValue_1.InlineValueFeature)((0, typeHierarchy_1.TypeHierarchyFeature)((0, linkedEditingRange_1.LinkedEditingRangeFeature)((0, semanticTokens_1.SemanticTokensFeature)((0, callHierarchy_1.CallHierarchyFeature)(_LanguagesImpl))))))))); - var _NotebooksImpl = class { - constructor() { - } - attach(connection2) { - this._connection = connection2; - } - get connection() { - if (!this._connection) { - throw new Error("Remote is not attached to a connection yet."); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - attachWorkDoneProgress(params) { - return (0, progress_1.attachWorkDone)(this.connection, params); - } - attachPartialResultProgress(_type, params) { - return (0, progress_1.attachPartialResult)(this.connection, params); - } - }; - exports2._NotebooksImpl = _NotebooksImpl; - var NotebooksImpl = (0, notebook_1.NotebookSyncFeature)(_NotebooksImpl); - function combineConsoleFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineConsoleFeatures = combineConsoleFeatures; - function combineTelemetryFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineTelemetryFeatures = combineTelemetryFeatures; - function combineTracerFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineTracerFeatures = combineTracerFeatures; - function combineClientFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineClientFeatures = combineClientFeatures; - function combineWindowFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineWindowFeatures = combineWindowFeatures; - function combineWorkspaceFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineWorkspaceFeatures = combineWorkspaceFeatures; - function combineLanguagesFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineLanguagesFeatures = combineLanguagesFeatures; - function combineNotebooksFeatures(one, two) { - return function(Base) { - return two(one(Base)); - }; - } - exports2.combineNotebooksFeatures = combineNotebooksFeatures; - function combineFeatures(one, two) { - function combine(one2, two2, func) { - if (one2 && two2) { - return func(one2, two2); - } else if (one2) { - return one2; - } else { - return two2; - } - } - let result = { - __brand: "features", - console: combine(one.console, two.console, combineConsoleFeatures), - tracer: combine(one.tracer, two.tracer, combineTracerFeatures), - telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures), - client: combine(one.client, two.client, combineClientFeatures), - window: combine(one.window, two.window, combineWindowFeatures), - workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures), - languages: combine(one.languages, two.languages, combineLanguagesFeatures), - notebooks: combine(one.notebooks, two.notebooks, combineNotebooksFeatures) - }; - return result; - } - exports2.combineFeatures = combineFeatures; - function createConnection2(connectionFactory, watchDog, factories) { - const logger = factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl(); - const connection2 = connectionFactory(logger); - logger.rawAttach(connection2); - const tracer = factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl(); - const telemetry = factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl(); - const client = factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl(); - const remoteWindow = factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl(); - const workspace = factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl(); - const languages = factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl(); - const notebooks = factories && factories.notebooks ? new (factories.notebooks(NotebooksImpl))() : new NotebooksImpl(); - const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages, notebooks]; - function asPromise(value) { - if (value instanceof Promise) { - return value; - } else if (Is2.thenable(value)) { - return new Promise((resolve, reject2) => { - value.then((resolved) => resolve(resolved), (error) => reject2(error)); - }); - } else { - return Promise.resolve(value); - } - } - let shutdownHandler = void 0; - let initializeHandler = void 0; - let exitHandler = void 0; - let protocolConnection = { - listen: () => connection2.listen(), - sendRequest: (type, ...params) => connection2.sendRequest(Is2.string(type) ? type : type.method, ...params), - onRequest: (type, handler) => connection2.onRequest(type, handler), - sendNotification: (type, param) => { - const method = Is2.string(type) ? type : type.method; - return connection2.sendNotification(method, param); - }, - onNotification: (type, handler) => connection2.onNotification(type, handler), - onProgress: connection2.onProgress, - sendProgress: connection2.sendProgress, - onInitialize: (handler) => { - initializeHandler = handler; - return { - dispose: () => { - initializeHandler = void 0; - } - }; - }, - onInitialized: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler), - onShutdown: (handler) => { - shutdownHandler = handler; - return { - dispose: () => { - shutdownHandler = void 0; - } - }; - }, - onExit: (handler) => { - exitHandler = handler; - return { - dispose: () => { - exitHandler = void 0; - } - }; - }, - get console() { - return logger; - }, - get telemetry() { - return telemetry; - }, - get tracer() { - return tracer; - }, - get client() { - return client; - }, - get window() { - return remoteWindow; - }, - get workspace() { - return workspace; - }, - get languages() { - return languages; - }, - get notebooks() { - return notebooks; - }, - onDidChangeConfiguration: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler), - onDidChangeWatchedFiles: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler), - __textDocumentSync: void 0, - onDidOpenTextDocument: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler), - onDidChangeTextDocument: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler), - onDidCloseTextDocument: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler), - onWillSaveTextDocument: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler), - onWillSaveTextDocumentWaitUntil: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler), - onDidSaveTextDocument: (handler) => connection2.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler), - sendDiagnostics: (params) => connection2.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params), - onHover: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - onCompletion: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onCompletionResolve: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler), - onSignatureHelp: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - onDeclaration: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onDefinition: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onTypeDefinition: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onImplementation: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onReferences: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onDocumentHighlight: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onDocumentSymbol: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onWorkspaceSymbol: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onWorkspaceSymbolResolve: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolResolveRequest.type, handler), - onCodeAction: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onCodeActionResolve: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onCodeLens: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onCodeLensResolve: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentFormatting: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - onDocumentRangeFormatting: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - onDocumentOnTypeFormatting: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onRenameRequest: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - onPrepareRename: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentLinks: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onDocumentLinkResolve: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentColor: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onColorPresentation: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onFoldingRanges: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onSelectionRanges: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), (0, progress_1.attachPartialResult)(connection2, params)); - }), - onExecuteCommand: (handler) => connection2.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => { - return handler(params, cancel, (0, progress_1.attachWorkDone)(connection2, params), void 0); - }), - dispose: () => connection2.dispose() - }; - for (let remote of allRemotes) { - remote.attach(protocolConnection); - } - connection2.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => { - watchDog.initialize(params); - if (Is2.string(params.trace)) { - tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace); - } - for (let remote of allRemotes) { - remote.initialize(params.capabilities); - } - if (initializeHandler) { - let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, (0, progress_1.attachWorkDone)(connection2, params), void 0); - return asPromise(result).then((value) => { - if (value instanceof vscode_languageserver_protocol_1.ResponseError) { - return value; - } - let result2 = value; - if (!result2) { - result2 = { capabilities: {} }; - } - let capabilities = result2.capabilities; - if (!capabilities) { - capabilities = {}; - result2.capabilities = capabilities; - } - if (capabilities.textDocumentSync === void 0 || capabilities.textDocumentSync === null) { - capabilities.textDocumentSync = Is2.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None; - } else if (!Is2.number(capabilities.textDocumentSync) && !Is2.number(capabilities.textDocumentSync.change)) { - capabilities.textDocumentSync.change = Is2.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None; - } - for (let remote of allRemotes) { - remote.fillServerCapabilities(capabilities); - } - return result2; - }); - } else { - let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } }; - for (let remote of allRemotes) { - remote.fillServerCapabilities(result.capabilities); - } - return result; - } - }); - connection2.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => { - watchDog.shutdownReceived = true; - if (shutdownHandler) { - return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token); - } else { - return void 0; - } - }); - connection2.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => { - try { - if (exitHandler) { - exitHandler(); - } - } finally { - if (watchDog.shutdownReceived) { - watchDog.exit(0); - } else { - watchDog.exit(1); - } - } - }); - connection2.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => { - tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value); - }); - return protocolConnection; - } - exports2.createConnection = createConnection2; - } -}); - -// node_modules/vscode-languageserver/lib/node/files.js -var require_files = __commonJS({ - "node_modules/vscode-languageserver/lib/node/files.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveModulePath = exports2.FileSystem = exports2.resolveGlobalYarnPath = exports2.resolveGlobalNodePath = exports2.resolve = exports2.uriToFilePath = void 0; - var url = require("url"); - var path = require("path"); - var fs2 = require("fs"); - var child_process_1 = require("child_process"); - function uriToFilePath(uri) { - let parsed = url.parse(uri); - if (parsed.protocol !== "file:" || !parsed.path) { - return void 0; - } - let segments = parsed.path.split("/"); - for (var i = 0, len = segments.length; i < len; i++) { - segments[i] = decodeURIComponent(segments[i]); - } - if (process.platform === "win32" && segments.length > 1) { - let first2 = segments[0]; - let second = segments[1]; - if (first2.length === 0 && second.length > 1 && second[1] === ":") { - segments.shift(); - } - } - return path.normalize(segments.join("/")); - } - exports2.uriToFilePath = uriToFilePath; - function isWindows() { - return process.platform === "win32"; - } - function resolve(moduleName, nodePath, cwd, tracer) { - const nodePathKey = "NODE_PATH"; - const app = [ - "var p = process;", - "p.on('message',function(m){", - "if(m.c==='e'){", - "p.exit(0);", - "}", - "else if(m.c==='rs'){", - "try{", - "var r=require.resolve(m.a);", - "p.send({c:'r',s:true,r:r});", - "}", - "catch(err){", - "p.send({c:'r',s:false});", - "}", - "}", - "});" - ].join(""); - return new Promise((resolve2, reject2) => { - let env = process.env; - let newEnv = /* @__PURE__ */ Object.create(null); - Object.keys(env).forEach((key) => newEnv[key] = env[key]); - if (nodePath && fs2.existsSync(nodePath)) { - if (newEnv[nodePathKey]) { - newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey]; - } else { - newEnv[nodePathKey] = nodePath; - } - if (tracer) { - tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`); - } - } - newEnv["ELECTRON_RUN_AS_NODE"] = "1"; - try { - let cp = (0, child_process_1.fork)("", [], { - cwd, - env: newEnv, - execArgv: ["-e", app] - }); - if (cp.pid === void 0) { - reject2(new Error(`Starting process to resolve node module ${moduleName} failed`)); - return; - } - cp.on("error", (error) => { - reject2(error); - }); - cp.on("message", (message2) => { - if (message2.c === "r") { - cp.send({ c: "e" }); - if (message2.s) { - resolve2(message2.r); - } else { - reject2(new Error(`Failed to resolve module: ${moduleName}`)); - } - } - }); - let message = { - c: "rs", - a: moduleName - }; - cp.send(message); - } catch (error) { - reject2(error); - } - }); - } - exports2.resolve = resolve; - function resolveGlobalNodePath(tracer) { - let npmCommand = "npm"; - const env = /* @__PURE__ */ Object.create(null); - Object.keys(process.env).forEach((key) => env[key] = process.env[key]); - env["NO_UPDATE_NOTIFIER"] = "true"; - const options = { - encoding: "utf8", - env - }; - if (isWindows()) { - npmCommand = "npm.cmd"; - options.shell = true; - } - let handler = () => { - }; - try { - process.on("SIGPIPE", handler); - let stdout = (0, child_process_1.spawnSync)(npmCommand, ["config", "get", "prefix"], options).stdout; - if (!stdout) { - if (tracer) { - tracer(`'npm config get prefix' didn't return a value.`); - } - return void 0; - } - let prefix = stdout.trim(); - if (tracer) { - tracer(`'npm config get prefix' value is: ${prefix}`); - } - if (prefix.length > 0) { - if (isWindows()) { - return path.join(prefix, "node_modules"); - } else { - return path.join(prefix, "lib", "node_modules"); - } - } - return void 0; - } catch (err) { - return void 0; - } finally { - process.removeListener("SIGPIPE", handler); - } - } - exports2.resolveGlobalNodePath = resolveGlobalNodePath; - function resolveGlobalYarnPath(tracer) { - let yarnCommand = "yarn"; - let options = { - encoding: "utf8" - }; - if (isWindows()) { - yarnCommand = "yarn.cmd"; - options.shell = true; - } - let handler = () => { - }; - try { - process.on("SIGPIPE", handler); - let results = (0, child_process_1.spawnSync)(yarnCommand, ["global", "dir", "--json"], options); - let stdout = results.stdout; - if (!stdout) { - if (tracer) { - tracer(`'yarn global dir' didn't return a value.`); - if (results.stderr) { - tracer(results.stderr); - } - } - return void 0; - } - let lines = stdout.trim().split(/\r?\n/); - for (let line of lines) { - try { - let yarn = JSON.parse(line); - if (yarn.type === "log") { - return path.join(yarn.data, "node_modules"); - } - } catch (e) { - } - } - return void 0; - } catch (err) { - return void 0; - } finally { - process.removeListener("SIGPIPE", handler); - } - } - exports2.resolveGlobalYarnPath = resolveGlobalYarnPath; - var FileSystem; - (function(FileSystem2) { - let _isCaseSensitive = void 0; - function isCaseSensitive() { - if (_isCaseSensitive !== void 0) { - return _isCaseSensitive; - } - if (process.platform === "win32") { - _isCaseSensitive = false; - } else { - _isCaseSensitive = !fs2.existsSync(__filename.toUpperCase()) || !fs2.existsSync(__filename.toLowerCase()); - } - return _isCaseSensitive; - } - FileSystem2.isCaseSensitive = isCaseSensitive; - function isParent(parent, child) { - if (isCaseSensitive()) { - return path.normalize(child).indexOf(path.normalize(parent)) === 0; - } else { - return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0; - } - } - FileSystem2.isParent = isParent; - })(FileSystem || (exports2.FileSystem = FileSystem = {})); - function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) { - if (nodePath) { - if (!path.isAbsolute(nodePath)) { - nodePath = path.join(workspaceRoot, nodePath); - } - return resolve(moduleName, nodePath, nodePath, tracer).then((value) => { - if (FileSystem.isParent(nodePath, value)) { - return value; - } else { - return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`)); - } - }).then(void 0, (_error) => { - return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); - }); - } else { - return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); - } - } - exports2.resolveModulePath = resolveModulePath; - } -}); - -// node_modules/vscode-languageserver-protocol/node.js -var require_node2 = __commonJS({ - "node_modules/vscode-languageserver-protocol/node.js"(exports2, module2) { - "use strict"; - module2.exports = require_main3(); - } -}); - -// node_modules/vscode-languageserver/lib/common/inlineCompletion.proposed.js -var require_inlineCompletion_proposed = __commonJS({ - "node_modules/vscode-languageserver/lib/common/inlineCompletion.proposed.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.InlineCompletionFeature = void 0; - var vscode_languageserver_protocol_1 = require_main3(); - var InlineCompletionFeature = (Base) => { - return class extends Base { - get inlineCompletion() { - return { - on: (handler) => { - return this.connection.onRequest(vscode_languageserver_protocol_1.InlineCompletionRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params)); - }); - } - }; - } - }; - }; - exports2.InlineCompletionFeature = InlineCompletionFeature; - } -}); - -// node_modules/vscode-languageserver/lib/common/api.js -var require_api3 = __commonJS({ - "node_modules/vscode-languageserver/lib/common/api.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) - __createBinding(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ProposedFeatures = exports2.NotebookDocuments = exports2.TextDocuments = exports2.SemanticTokensBuilder = void 0; - var semanticTokens_1 = require_semanticTokens(); - Object.defineProperty(exports2, "SemanticTokensBuilder", { enumerable: true, get: function() { - return semanticTokens_1.SemanticTokensBuilder; - } }); - var ic = require_inlineCompletion_proposed(); - __exportStar(require_main3(), exports2); - var textDocuments_1 = require_textDocuments(); - Object.defineProperty(exports2, "TextDocuments", { enumerable: true, get: function() { - return textDocuments_1.TextDocuments; - } }); - var notebook_1 = require_notebook(); - Object.defineProperty(exports2, "NotebookDocuments", { enumerable: true, get: function() { - return notebook_1.NotebookDocuments; - } }); - __exportStar(require_server(), exports2); - var ProposedFeatures2; - (function(ProposedFeatures3) { - ProposedFeatures3.all = { - __brand: "features", - languages: ic.InlineCompletionFeature - }; - })(ProposedFeatures2 || (exports2.ProposedFeatures = ProposedFeatures2 = {})); - } -}); - -// node_modules/vscode-languageserver/lib/node/main.js -var require_main4 = __commonJS({ - "node_modules/vscode-languageserver/lib/node/main.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) - __createBinding(exports3, m, p); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.createConnection = exports2.Files = void 0; - var node_util_1 = require("util"); - var Is2 = require_is(); - var server_1 = require_server(); - var fm = require_files(); - var node_1 = require_node2(); - __exportStar(require_node2(), exports2); - __exportStar(require_api3(), exports2); - var Files; - (function(Files2) { - Files2.uriToFilePath = fm.uriToFilePath; - Files2.resolveGlobalNodePath = fm.resolveGlobalNodePath; - Files2.resolveGlobalYarnPath = fm.resolveGlobalYarnPath; - Files2.resolve = fm.resolve; - Files2.resolveModulePath = fm.resolveModulePath; - })(Files || (exports2.Files = Files = {})); - var _protocolConnection; - function endProtocolConnection() { - if (_protocolConnection === void 0) { - return; - } - try { - _protocolConnection.end(); - } catch (_err) { - } - } - var _shutdownReceived = false; - var exitTimer = void 0; - function setupExitTimer() { - const argName = "--clientProcessId"; - function runTimer(value) { - try { - let processId = parseInt(value); - if (!isNaN(processId)) { - exitTimer = setInterval(() => { - try { - process.kill(processId, 0); - } catch (ex) { - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - } - }, 3e3); - } - } catch (e) { - } - } - for (let i = 2; i < process.argv.length; i++) { - let arg = process.argv[i]; - if (arg === argName && i + 1 < process.argv.length) { - runTimer(process.argv[i + 1]); - return; - } else { - let args = arg.split("="); - if (args[0] === argName) { - runTimer(args[1]); - } - } - } - } - setupExitTimer(); - var watchDog = { - initialize: (params) => { - const processId = params.processId; - if (Is2.number(processId) && exitTimer === void 0) { - setInterval(() => { - try { - process.kill(processId, 0); - } catch (ex) { - process.exit(_shutdownReceived ? 0 : 1); - } - }, 3e3); - } - }, - get shutdownReceived() { - return _shutdownReceived; - }, - set shutdownReceived(value) { - _shutdownReceived = value; - }, - exit: (code) => { - endProtocolConnection(); - process.exit(code); - } - }; - function createConnection2(arg1, arg2, arg3, arg4) { - let factories; - let input; - let output; - let options; - if (arg1 !== void 0 && arg1.__brand === "features") { - factories = arg1; - arg1 = arg2; - arg2 = arg3; - arg3 = arg4; - } - if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) { - options = arg1; - } else { - input = arg1; - output = arg2; - options = arg3; - } - return _createConnection(input, output, options, factories); - } - exports2.createConnection = createConnection2; - function _createConnection(input, output, options, factories) { - let stdio = false; - if (!input && !output && process.argv.length > 2) { - let port = void 0; - let pipeName = void 0; - let argv = process.argv.slice(2); - for (let i = 0; i < argv.length; i++) { - let arg = argv[i]; - if (arg === "--node-ipc") { - input = new node_1.IPCMessageReader(process); - output = new node_1.IPCMessageWriter(process); - break; - } else if (arg === "--stdio") { - stdio = true; - input = process.stdin; - output = process.stdout; - break; - } else if (arg === "--socket") { - port = parseInt(argv[i + 1]); - break; - } else if (arg === "--pipe") { - pipeName = argv[i + 1]; - break; - } else { - var args = arg.split("="); - if (args[0] === "--socket") { - port = parseInt(args[1]); - break; - } else if (args[0] === "--pipe") { - pipeName = args[1]; - break; - } - } - } - if (port) { - let transport = (0, node_1.createServerSocketTransport)(port); - input = transport[0]; - output = transport[1]; - } else if (pipeName) { - let transport = (0, node_1.createServerPipeTransport)(pipeName); - input = transport[0]; - output = transport[1]; - } - } - var commandLineMessage = "Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'"; - if (!input) { - throw new Error("Connection input stream is not set. " + commandLineMessage); - } - if (!output) { - throw new Error("Connection output stream is not set. " + commandLineMessage); - } - if (Is2.func(input.read) && Is2.func(input.on)) { - let inputStream = input; - inputStream.on("end", () => { - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - }); - inputStream.on("close", () => { - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - }); - } - const connectionFactory = (logger) => { - const result = (0, node_1.createProtocolConnection)(input, output, logger, options); - if (stdio) { - patchConsole(logger); - } - return result; - }; - return (0, server_1.createConnection)(connectionFactory, watchDog, factories); - } - function patchConsole(logger) { - function serialize(args) { - return args.map((arg) => typeof arg === "string" ? arg : (0, node_util_1.inspect)(arg)).join(" "); - } - const counters = /* @__PURE__ */ new Map(); - console.assert = function assert(assertion, ...args) { - if (assertion) { - return; - } - if (args.length === 0) { - logger.error("Assertion failed"); - } else { - const [message, ...rest] = args; - logger.error(`Assertion failed: ${message} ${serialize(rest)}`); - } - }; - console.count = function count(label = "default") { - var _a; - const message = String(label); - let counter = (_a = counters.get(message)) != null ? _a : 0; - counter += 1; - counters.set(message, counter); - logger.log(`${message}: ${message}`); - }; - console.countReset = function countReset(label) { - if (label === void 0) { - counters.clear(); - } else { - counters.delete(String(label)); - } - }; - console.debug = function debug(...args) { - logger.log(serialize(args)); - }; - console.dir = function dir(arg, options) { - logger.log((0, node_util_1.inspect)(arg, options)); - }; - console.log = function log(...args) { - logger.log(serialize(args)); - }; - console.error = function error(...args) { - logger.error(serialize(args)); - }; - console.trace = function trace(...args) { - const stack = new Error().stack.replace(/(.+\n){2}/, ""); - let message = "Trace"; - if (args.length !== 0) { - message += `: ${serialize(args)}`; - } - logger.log(`${message} -${stack}`); - }; - console.warn = function warn(...args) { - logger.warn(serialize(args)); - }; - } - } -}); - -// node_modules/vscode-languageserver/node.js -var require_node3 = __commonJS({ - "node_modules/vscode-languageserver/node.js"(exports2, module2) { - "use strict"; - module2.exports = require_main4(); - } -}); - -// node_modules/langium/lib/lsp/completion/completion-provider.js -var import_vscode_languageserver = __toESM(require_main4(), 1); - -// node_modules/langium/lib/languages/generated/ast.js -var ast_exports = {}; -__export(ast_exports, { - AbstractElement: () => AbstractElement, - AbstractRule: () => AbstractRule, - AbstractType: () => AbstractType, - Action: () => Action, - Alternatives: () => Alternatives, - ArrayLiteral: () => ArrayLiteral, - ArrayType: () => ArrayType, - Assignment: () => Assignment, - BooleanLiteral: () => BooleanLiteral, - CharacterRange: () => CharacterRange, - Condition: () => Condition, - Conjunction: () => Conjunction, - CrossReference: () => CrossReference, - Disjunction: () => Disjunction, - EndOfFile: () => EndOfFile, - Grammar: () => Grammar, - GrammarImport: () => GrammarImport, - Group: () => Group, - InferredType: () => InferredType, - Interface: () => Interface, - Keyword: () => Keyword, - LangiumGrammarAstReflection: () => LangiumGrammarAstReflection, - LangiumGrammarTerminals: () => LangiumGrammarTerminals, - NamedArgument: () => NamedArgument, - NegatedToken: () => NegatedToken, - Negation: () => Negation, - NumberLiteral: () => NumberLiteral, - Parameter: () => Parameter, - ParameterReference: () => ParameterReference, - ParserRule: () => ParserRule, - ReferenceType: () => ReferenceType, - RegexToken: () => RegexToken, - ReturnType: () => ReturnType, - RuleCall: () => RuleCall, - SimpleType: () => SimpleType, - StringLiteral: () => StringLiteral, - TerminalAlternatives: () => TerminalAlternatives, - TerminalGroup: () => TerminalGroup, - TerminalRule: () => TerminalRule, - TerminalRuleCall: () => TerminalRuleCall, - Type: () => Type, - TypeAttribute: () => TypeAttribute, - TypeDefinition: () => TypeDefinition, - UnionType: () => UnionType, - UnorderedGroup: () => UnorderedGroup, - UntilToken: () => UntilToken, - ValueLiteral: () => ValueLiteral, - Wildcard: () => Wildcard, - isAbstractElement: () => isAbstractElement, - isAbstractRule: () => isAbstractRule, - isAbstractType: () => isAbstractType, - isAction: () => isAction, - isAlternatives: () => isAlternatives, - isArrayLiteral: () => isArrayLiteral, - isArrayType: () => isArrayType, - isAssignment: () => isAssignment, - isBooleanLiteral: () => isBooleanLiteral, - isCharacterRange: () => isCharacterRange, - isCondition: () => isCondition, - isConjunction: () => isConjunction, - isCrossReference: () => isCrossReference, - isDisjunction: () => isDisjunction, - isEndOfFile: () => isEndOfFile, - isFeatureName: () => isFeatureName, - isGrammar: () => isGrammar, - isGrammarImport: () => isGrammarImport, - isGroup: () => isGroup, - isInferredType: () => isInferredType, - isInterface: () => isInterface, - isKeyword: () => isKeyword, - isNamedArgument: () => isNamedArgument, - isNegatedToken: () => isNegatedToken, - isNegation: () => isNegation, - isNumberLiteral: () => isNumberLiteral, - isParameter: () => isParameter, - isParameterReference: () => isParameterReference, - isParserRule: () => isParserRule, - isPrimitiveType: () => isPrimitiveType, - isReferenceType: () => isReferenceType, - isRegexToken: () => isRegexToken, - isReturnType: () => isReturnType, - isRuleCall: () => isRuleCall, - isSimpleType: () => isSimpleType, - isStringLiteral: () => isStringLiteral, - isTerminalAlternatives: () => isTerminalAlternatives, - isTerminalGroup: () => isTerminalGroup, - isTerminalRule: () => isTerminalRule, - isTerminalRuleCall: () => isTerminalRuleCall, - isType: () => isType, - isTypeAttribute: () => isTypeAttribute, - isTypeDefinition: () => isTypeDefinition, - isUnionType: () => isUnionType, - isUnorderedGroup: () => isUnorderedGroup, - isUntilToken: () => isUntilToken, - isValueLiteral: () => isValueLiteral, - isWildcard: () => isWildcard, - reflection: () => reflection -}); - -// node_modules/langium/lib/syntax-tree.js -function isAstNode(obj) { - return typeof obj === "object" && obj !== null && typeof obj.$type === "string"; -} -function isReference(obj) { - return typeof obj === "object" && obj !== null && typeof obj.$refText === "string"; -} -function isAstNodeDescription(obj) { - return typeof obj === "object" && obj !== null && typeof obj.name === "string" && typeof obj.type === "string" && typeof obj.path === "string"; -} -function isLinkingError(obj) { - return typeof obj === "object" && obj !== null && isAstNode(obj.container) && isReference(obj.reference) && typeof obj.message === "string"; -} -var AbstractAstReflection = class { - constructor() { - this.subtypes = {}; - this.allSubtypes = {}; - } - isInstance(node, type) { - return isAstNode(node) && this.isSubtype(node.$type, type); - } - isSubtype(subtype, supertype) { - if (subtype === supertype) { - return true; - } - let nested = this.subtypes[subtype]; - if (!nested) { - nested = this.subtypes[subtype] = {}; - } - const existing = nested[supertype]; - if (existing !== void 0) { - return existing; - } else { - const result = this.computeIsSubtype(subtype, supertype); - nested[supertype] = result; - return result; - } - } - getAllSubTypes(type) { - const existing = this.allSubtypes[type]; - if (existing) { - return existing; - } else { - const allTypes = this.getAllTypes(); - const types = []; - for (const possibleSubType of allTypes) { - if (this.isSubtype(possibleSubType, type)) { - types.push(possibleSubType); - } - } - this.allSubtypes[type] = types; - return types; - } - } -}; -function isCompositeCstNode(node) { - return typeof node === "object" && node !== null && Array.isArray(node.content); -} -function isLeafCstNode(node) { - return typeof node === "object" && node !== null && typeof node.tokenType === "object"; -} -function isRootCstNode(node) { - return isCompositeCstNode(node) && typeof node.fullText === "string"; -} - -// node_modules/langium/lib/languages/generated/ast.js -var LangiumGrammarTerminals = { - ID: /\^?[_a-zA-Z][\w_]*/, - STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/, - NUMBER: /NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/, - RegexLiteral: /\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/, - WS: /\s+/, - ML_COMMENT: /\/\*[\s\S]*?\*\//, - SL_COMMENT: /\/\/[^\n\r]*/ -}; -var AbstractRule = "AbstractRule"; -function isAbstractRule(item) { - return reflection.isInstance(item, AbstractRule); -} -var AbstractType = "AbstractType"; -function isAbstractType(item) { - return reflection.isInstance(item, AbstractType); -} -var Condition = "Condition"; -function isCondition(item) { - return reflection.isInstance(item, Condition); -} -function isFeatureName(item) { - return isPrimitiveType(item) || item === "current" || item === "entry" || item === "extends" || item === "false" || item === "fragment" || item === "grammar" || item === "hidden" || item === "import" || item === "interface" || item === "returns" || item === "terminal" || item === "true" || item === "type" || item === "infer" || item === "infers" || item === "with" || typeof item === "string" && /\^?[_a-zA-Z][\w_]*/.test(item); -} -function isPrimitiveType(item) { - return item === "string" || item === "number" || item === "boolean" || item === "Date" || item === "bigint"; -} -var TypeDefinition = "TypeDefinition"; -function isTypeDefinition(item) { - return reflection.isInstance(item, TypeDefinition); -} -var ValueLiteral = "ValueLiteral"; -function isValueLiteral(item) { - return reflection.isInstance(item, ValueLiteral); -} -var AbstractElement = "AbstractElement"; -function isAbstractElement(item) { - return reflection.isInstance(item, AbstractElement); -} -var ArrayLiteral = "ArrayLiteral"; -function isArrayLiteral(item) { - return reflection.isInstance(item, ArrayLiteral); -} -var ArrayType = "ArrayType"; -function isArrayType(item) { - return reflection.isInstance(item, ArrayType); -} -var BooleanLiteral = "BooleanLiteral"; -function isBooleanLiteral(item) { - return reflection.isInstance(item, BooleanLiteral); -} -var Conjunction = "Conjunction"; -function isConjunction(item) { - return reflection.isInstance(item, Conjunction); -} -var Disjunction = "Disjunction"; -function isDisjunction(item) { - return reflection.isInstance(item, Disjunction); -} -var Grammar = "Grammar"; -function isGrammar(item) { - return reflection.isInstance(item, Grammar); -} -var GrammarImport = "GrammarImport"; -function isGrammarImport(item) { - return reflection.isInstance(item, GrammarImport); -} -var InferredType = "InferredType"; -function isInferredType(item) { - return reflection.isInstance(item, InferredType); -} -var Interface = "Interface"; -function isInterface(item) { - return reflection.isInstance(item, Interface); -} -var NamedArgument = "NamedArgument"; -function isNamedArgument(item) { - return reflection.isInstance(item, NamedArgument); -} -var Negation = "Negation"; -function isNegation(item) { - return reflection.isInstance(item, Negation); -} -var NumberLiteral = "NumberLiteral"; -function isNumberLiteral(item) { - return reflection.isInstance(item, NumberLiteral); -} -var Parameter = "Parameter"; -function isParameter(item) { - return reflection.isInstance(item, Parameter); -} -var ParameterReference = "ParameterReference"; -function isParameterReference(item) { - return reflection.isInstance(item, ParameterReference); -} -var ParserRule = "ParserRule"; -function isParserRule(item) { - return reflection.isInstance(item, ParserRule); -} -var ReferenceType = "ReferenceType"; -function isReferenceType(item) { - return reflection.isInstance(item, ReferenceType); -} -var ReturnType = "ReturnType"; -function isReturnType(item) { - return reflection.isInstance(item, ReturnType); -} -var SimpleType = "SimpleType"; -function isSimpleType(item) { - return reflection.isInstance(item, SimpleType); -} -var StringLiteral = "StringLiteral"; -function isStringLiteral(item) { - return reflection.isInstance(item, StringLiteral); -} -var TerminalRule = "TerminalRule"; -function isTerminalRule(item) { - return reflection.isInstance(item, TerminalRule); -} -var Type = "Type"; -function isType(item) { - return reflection.isInstance(item, Type); -} -var TypeAttribute = "TypeAttribute"; -function isTypeAttribute(item) { - return reflection.isInstance(item, TypeAttribute); -} -var UnionType = "UnionType"; -function isUnionType(item) { - return reflection.isInstance(item, UnionType); -} -var Action = "Action"; -function isAction(item) { - return reflection.isInstance(item, Action); -} -var Alternatives = "Alternatives"; -function isAlternatives(item) { - return reflection.isInstance(item, Alternatives); -} -var Assignment = "Assignment"; -function isAssignment(item) { - return reflection.isInstance(item, Assignment); -} -var CharacterRange = "CharacterRange"; -function isCharacterRange(item) { - return reflection.isInstance(item, CharacterRange); -} -var CrossReference = "CrossReference"; -function isCrossReference(item) { - return reflection.isInstance(item, CrossReference); -} -var EndOfFile = "EndOfFile"; -function isEndOfFile(item) { - return reflection.isInstance(item, EndOfFile); -} -var Group = "Group"; -function isGroup(item) { - return reflection.isInstance(item, Group); -} -var Keyword = "Keyword"; -function isKeyword(item) { - return reflection.isInstance(item, Keyword); -} -var NegatedToken = "NegatedToken"; -function isNegatedToken(item) { - return reflection.isInstance(item, NegatedToken); -} -var RegexToken = "RegexToken"; -function isRegexToken(item) { - return reflection.isInstance(item, RegexToken); -} -var RuleCall = "RuleCall"; -function isRuleCall(item) { - return reflection.isInstance(item, RuleCall); -} -var TerminalAlternatives = "TerminalAlternatives"; -function isTerminalAlternatives(item) { - return reflection.isInstance(item, TerminalAlternatives); -} -var TerminalGroup = "TerminalGroup"; -function isTerminalGroup(item) { - return reflection.isInstance(item, TerminalGroup); -} -var TerminalRuleCall = "TerminalRuleCall"; -function isTerminalRuleCall(item) { - return reflection.isInstance(item, TerminalRuleCall); -} -var UnorderedGroup = "UnorderedGroup"; -function isUnorderedGroup(item) { - return reflection.isInstance(item, UnorderedGroup); -} -var UntilToken = "UntilToken"; -function isUntilToken(item) { - return reflection.isInstance(item, UntilToken); -} -var Wildcard = "Wildcard"; -function isWildcard(item) { - return reflection.isInstance(item, Wildcard); -} -var LangiumGrammarAstReflection = class extends AbstractAstReflection { - getAllTypes() { - return ["AbstractElement", "AbstractRule", "AbstractType", "Action", "Alternatives", "ArrayLiteral", "ArrayType", "Assignment", "BooleanLiteral", "CharacterRange", "Condition", "Conjunction", "CrossReference", "Disjunction", "EndOfFile", "Grammar", "GrammarImport", "Group", "InferredType", "Interface", "Keyword", "NamedArgument", "NegatedToken", "Negation", "NumberLiteral", "Parameter", "ParameterReference", "ParserRule", "ReferenceType", "RegexToken", "ReturnType", "RuleCall", "SimpleType", "StringLiteral", "TerminalAlternatives", "TerminalGroup", "TerminalRule", "TerminalRuleCall", "Type", "TypeAttribute", "TypeDefinition", "UnionType", "UnorderedGroup", "UntilToken", "ValueLiteral", "Wildcard"]; - } - computeIsSubtype(subtype, supertype) { - switch (subtype) { - case Action: - case Alternatives: - case Assignment: - case CharacterRange: - case CrossReference: - case EndOfFile: - case Group: - case Keyword: - case NegatedToken: - case RegexToken: - case RuleCall: - case TerminalAlternatives: - case TerminalGroup: - case TerminalRuleCall: - case UnorderedGroup: - case UntilToken: - case Wildcard: { - return this.isSubtype(AbstractElement, supertype); - } - case ArrayLiteral: - case NumberLiteral: - case StringLiteral: { - return this.isSubtype(ValueLiteral, supertype); - } - case ArrayType: - case ReferenceType: - case SimpleType: - case UnionType: { - return this.isSubtype(TypeDefinition, supertype); - } - case BooleanLiteral: { - return this.isSubtype(Condition, supertype) || this.isSubtype(ValueLiteral, supertype); - } - case Conjunction: - case Disjunction: - case Negation: - case ParameterReference: { - return this.isSubtype(Condition, supertype); - } - case InferredType: - case Interface: - case Type: { - return this.isSubtype(AbstractType, supertype); - } - case ParserRule: { - return this.isSubtype(AbstractRule, supertype) || this.isSubtype(AbstractType, supertype); - } - case TerminalRule: { - return this.isSubtype(AbstractRule, supertype); - } - default: { - return false; - } - } - } - getReferenceType(refInfo) { - const referenceId = `${refInfo.container.$type}:${refInfo.property}`; - switch (referenceId) { - case "Action:type": - case "CrossReference:type": - case "Interface:superTypes": - case "ParserRule:returnType": - case "SimpleType:typeRef": { - return AbstractType; - } - case "Grammar:hiddenTokens": - case "ParserRule:hiddenTokens": - case "RuleCall:rule": { - return AbstractRule; - } - case "Grammar:usedGrammars": { - return Grammar; - } - case "NamedArgument:parameter": - case "ParameterReference:parameter": { - return Parameter; - } - case "TerminalRuleCall:rule": { - return TerminalRule; - } - default: { - throw new Error(`${referenceId} is not a valid reference id.`); - } - } - } - getTypeMetaData(type) { - switch (type) { - case "AbstractElement": { - return { - name: "AbstractElement", - properties: [ - { name: "cardinality" }, - { name: "lookahead" } - ] - }; - } - case "ArrayLiteral": { - return { - name: "ArrayLiteral", - properties: [ - { name: "elements", defaultValue: [] } - ] - }; - } - case "ArrayType": { - return { - name: "ArrayType", - properties: [ - { name: "elementType" } - ] - }; - } - case "BooleanLiteral": { - return { - name: "BooleanLiteral", - properties: [ - { name: "true", defaultValue: false } - ] - }; - } - case "Conjunction": { - return { - name: "Conjunction", - properties: [ - { name: "left" }, - { name: "right" } - ] - }; - } - case "Disjunction": { - return { - name: "Disjunction", - properties: [ - { name: "left" }, - { name: "right" } - ] - }; - } - case "Grammar": { - return { - name: "Grammar", - properties: [ - { name: "definesHiddenTokens", defaultValue: false }, - { name: "hiddenTokens", defaultValue: [] }, - { name: "imports", defaultValue: [] }, - { name: "interfaces", defaultValue: [] }, - { name: "isDeclared", defaultValue: false }, - { name: "name" }, - { name: "rules", defaultValue: [] }, - { name: "types", defaultValue: [] }, - { name: "usedGrammars", defaultValue: [] } - ] - }; - } - case "GrammarImport": { - return { - name: "GrammarImport", - properties: [ - { name: "path" } - ] - }; - } - case "InferredType": { - return { - name: "InferredType", - properties: [ - { name: "name" } - ] - }; - } - case "Interface": { - return { - name: "Interface", - properties: [ - { name: "attributes", defaultValue: [] }, - { name: "name" }, - { name: "superTypes", defaultValue: [] } - ] - }; - } - case "NamedArgument": { - return { - name: "NamedArgument", - properties: [ - { name: "calledByName", defaultValue: false }, - { name: "parameter" }, - { name: "value" } - ] - }; - } - case "Negation": { - return { - name: "Negation", - properties: [ - { name: "value" } - ] - }; - } - case "NumberLiteral": { - return { - name: "NumberLiteral", - properties: [ - { name: "value" } - ] - }; - } - case "Parameter": { - return { - name: "Parameter", - properties: [ - { name: "name" } - ] - }; - } - case "ParameterReference": { - return { - name: "ParameterReference", - properties: [ - { name: "parameter" } - ] - }; - } - case "ParserRule": { - return { - name: "ParserRule", - properties: [ - { name: "dataType" }, - { name: "definesHiddenTokens", defaultValue: false }, - { name: "definition" }, - { name: "entry", defaultValue: false }, - { name: "fragment", defaultValue: false }, - { name: "hiddenTokens", defaultValue: [] }, - { name: "inferredType" }, - { name: "name" }, - { name: "parameters", defaultValue: [] }, - { name: "returnType" }, - { name: "wildcard", defaultValue: false } - ] - }; - } - case "ReferenceType": { - return { - name: "ReferenceType", - properties: [ - { name: "referenceType" } - ] - }; - } - case "ReturnType": { - return { - name: "ReturnType", - properties: [ - { name: "name" } - ] - }; - } - case "SimpleType": { - return { - name: "SimpleType", - properties: [ - { name: "primitiveType" }, - { name: "stringType" }, - { name: "typeRef" } - ] - }; - } - case "StringLiteral": { - return { - name: "StringLiteral", - properties: [ - { name: "value" } - ] - }; - } - case "TerminalRule": { - return { - name: "TerminalRule", - properties: [ - { name: "definition" }, - { name: "fragment", defaultValue: false }, - { name: "hidden", defaultValue: false }, - { name: "name" }, - { name: "type" } - ] - }; - } - case "Type": { - return { - name: "Type", - properties: [ - { name: "name" }, - { name: "type" } - ] - }; - } - case "TypeAttribute": { - return { - name: "TypeAttribute", - properties: [ - { name: "defaultValue" }, - { name: "isOptional", defaultValue: false }, - { name: "name" }, - { name: "type" } - ] - }; - } - case "UnionType": { - return { - name: "UnionType", - properties: [ - { name: "types", defaultValue: [] } - ] - }; - } - case "Action": { - return { - name: "Action", - properties: [ - { name: "cardinality" }, - { name: "feature" }, - { name: "inferredType" }, - { name: "lookahead" }, - { name: "operator" }, - { name: "type" } - ] - }; - } - case "Alternatives": { - return { - name: "Alternatives", - properties: [ - { name: "cardinality" }, - { name: "elements", defaultValue: [] }, - { name: "lookahead" } - ] - }; - } - case "Assignment": { - return { - name: "Assignment", - properties: [ - { name: "cardinality" }, - { name: "feature" }, - { name: "lookahead" }, - { name: "operator" }, - { name: "terminal" } - ] - }; - } - case "CharacterRange": { - return { - name: "CharacterRange", - properties: [ - { name: "cardinality" }, - { name: "left" }, - { name: "lookahead" }, - { name: "right" } - ] - }; - } - case "CrossReference": { - return { - name: "CrossReference", - properties: [ - { name: "cardinality" }, - { name: "deprecatedSyntax", defaultValue: false }, - { name: "lookahead" }, - { name: "terminal" }, - { name: "type" } - ] - }; - } - case "EndOfFile": { - return { - name: "EndOfFile", - properties: [ - { name: "cardinality" }, - { name: "lookahead" } - ] - }; - } - case "Group": { - return { - name: "Group", - properties: [ - { name: "cardinality" }, - { name: "elements", defaultValue: [] }, - { name: "guardCondition" }, - { name: "lookahead" } - ] - }; - } - case "Keyword": { - return { - name: "Keyword", - properties: [ - { name: "cardinality" }, - { name: "lookahead" }, - { name: "value" } - ] - }; - } - case "NegatedToken": { - return { - name: "NegatedToken", - properties: [ - { name: "cardinality" }, - { name: "lookahead" }, - { name: "terminal" } - ] - }; - } - case "RegexToken": { - return { - name: "RegexToken", - properties: [ - { name: "cardinality" }, - { name: "lookahead" }, - { name: "regex" } - ] - }; - } - case "RuleCall": { - return { - name: "RuleCall", - properties: [ - { name: "arguments", defaultValue: [] }, - { name: "cardinality" }, - { name: "lookahead" }, - { name: "rule" } - ] - }; - } - case "TerminalAlternatives": { - return { - name: "TerminalAlternatives", - properties: [ - { name: "cardinality" }, - { name: "elements", defaultValue: [] }, - { name: "lookahead" } - ] - }; - } - case "TerminalGroup": { - return { - name: "TerminalGroup", - properties: [ - { name: "cardinality" }, - { name: "elements", defaultValue: [] }, - { name: "lookahead" } - ] - }; - } - case "TerminalRuleCall": { - return { - name: "TerminalRuleCall", - properties: [ - { name: "cardinality" }, - { name: "lookahead" }, - { name: "rule" } - ] - }; - } - case "UnorderedGroup": { - return { - name: "UnorderedGroup", - properties: [ - { name: "cardinality" }, - { name: "elements", defaultValue: [] }, - { name: "lookahead" } - ] - }; - } - case "UntilToken": { - return { - name: "UntilToken", - properties: [ - { name: "cardinality" }, - { name: "lookahead" }, - { name: "terminal" } - ] - }; - } - case "Wildcard": { - return { - name: "Wildcard", - properties: [ - { name: "cardinality" }, - { name: "lookahead" } - ] - }; - } - default: { - return { - name: type, - properties: [] - }; - } - } - } -}; -var reflection = new LangiumGrammarAstReflection(); - -// node_modules/langium/lib/utils/ast-utils.js -var ast_utils_exports = {}; -__export(ast_utils_exports, { - assignMandatoryProperties: () => assignMandatoryProperties, - copyAstNode: () => copyAstNode, - findLocalReferences: () => findLocalReferences, - findRootNode: () => findRootNode, - getContainerOfType: () => getContainerOfType, - getDocument: () => getDocument, - hasContainerOfType: () => hasContainerOfType, - linkContentToContainer: () => linkContentToContainer, - streamAllContents: () => streamAllContents, - streamAst: () => streamAst, - streamContents: () => streamContents, - streamReferences: () => streamReferences -}); - -// node_modules/langium/lib/utils/stream.js -var StreamImpl = class _StreamImpl { - constructor(startFn, nextFn) { - this.startFn = startFn; - this.nextFn = nextFn; - } - iterator() { - const iterator = { - state: this.startFn(), - next: () => this.nextFn(iterator.state), - [Symbol.iterator]: () => iterator - }; - return iterator; - } - [Symbol.iterator]() { - return this.iterator(); - } - isEmpty() { - const iterator = this.iterator(); - return Boolean(iterator.next().done); - } - count() { - const iterator = this.iterator(); - let count = 0; - let next = iterator.next(); - while (!next.done) { - count++; - next = iterator.next(); - } - return count; - } - toArray() { - const result = []; - const iterator = this.iterator(); - let next; - do { - next = iterator.next(); - if (next.value !== void 0) { - result.push(next.value); - } - } while (!next.done); - return result; - } - toSet() { - return new Set(this); - } - toMap(keyFn, valueFn) { - const entryStream = this.map((element) => [ - keyFn ? keyFn(element) : element, - valueFn ? valueFn(element) : element - ]); - return new Map(entryStream); - } - toString() { - return this.join(); - } - concat(other) { - const iterator = other[Symbol.iterator](); - return new _StreamImpl(() => ({ first: this.startFn(), firstDone: false }), (state) => { - let result; - if (!state.firstDone) { - do { - result = this.nextFn(state.first); - if (!result.done) { - return result; - } - } while (!result.done); - state.firstDone = true; - } - do { - result = iterator.next(); - if (!result.done) { - return result; - } - } while (!result.done); - return DONE_RESULT; - }); - } - join(separator = ",") { - const iterator = this.iterator(); - let value = ""; - let result; - let addSeparator = false; - do { - result = iterator.next(); - if (!result.done) { - if (addSeparator) { - value += separator; - } - value += toString(result.value); - } - addSeparator = true; - } while (!result.done); - return value; - } - indexOf(searchElement, fromIndex = 0) { - const iterator = this.iterator(); - let index = 0; - let next = iterator.next(); - while (!next.done) { - if (index >= fromIndex && next.value === searchElement) { - return index; - } - next = iterator.next(); - index++; - } - return -1; - } - every(predicate) { - const iterator = this.iterator(); - let next = iterator.next(); - while (!next.done) { - if (!predicate(next.value)) { - return false; - } - next = iterator.next(); - } - return true; - } - some(predicate) { - const iterator = this.iterator(); - let next = iterator.next(); - while (!next.done) { - if (predicate(next.value)) { - return true; - } - next = iterator.next(); - } - return false; - } - forEach(callbackfn) { - const iterator = this.iterator(); - let index = 0; - let next = iterator.next(); - while (!next.done) { - callbackfn(next.value, index); - next = iterator.next(); - index++; - } - } - map(callbackfn) { - return new _StreamImpl(this.startFn, (state) => { - const { done, value } = this.nextFn(state); - if (done) { - return DONE_RESULT; - } else { - return { done: false, value: callbackfn(value) }; - } - }); - } - filter(predicate) { - return new _StreamImpl(this.startFn, (state) => { - let result; - do { - result = this.nextFn(state); - if (!result.done && predicate(result.value)) { - return result; - } - } while (!result.done); - return DONE_RESULT; - }); - } - nonNullable() { - return this.filter((e) => e !== void 0 && e !== null); - } - reduce(callbackfn, initialValue) { - const iterator = this.iterator(); - let previousValue = initialValue; - let next = iterator.next(); - while (!next.done) { - if (previousValue === void 0) { - previousValue = next.value; - } else { - previousValue = callbackfn(previousValue, next.value); - } - next = iterator.next(); - } - return previousValue; - } - reduceRight(callbackfn, initialValue) { - return this.recursiveReduce(this.iterator(), callbackfn, initialValue); - } - recursiveReduce(iterator, callbackfn, initialValue) { - const next = iterator.next(); - if (next.done) { - return initialValue; - } - const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue); - if (previousValue === void 0) { - return next.value; - } - return callbackfn(previousValue, next.value); - } - find(predicate) { - const iterator = this.iterator(); - let next = iterator.next(); - while (!next.done) { - if (predicate(next.value)) { - return next.value; - } - next = iterator.next(); - } - return void 0; - } - findIndex(predicate) { - const iterator = this.iterator(); - let index = 0; - let next = iterator.next(); - while (!next.done) { - if (predicate(next.value)) { - return index; - } - next = iterator.next(); - index++; - } - return -1; - } - includes(searchElement) { - const iterator = this.iterator(); - let next = iterator.next(); - while (!next.done) { - if (next.value === searchElement) { - return true; - } - next = iterator.next(); - } - return false; - } - flatMap(callbackfn) { - return new _StreamImpl(() => ({ this: this.startFn() }), (state) => { - do { - if (state.iterator) { - const next = state.iterator.next(); - if (next.done) { - state.iterator = void 0; - } else { - return next; - } - } - const { done, value } = this.nextFn(state.this); - if (!done) { - const mapped = callbackfn(value); - if (isIterable(mapped)) { - state.iterator = mapped[Symbol.iterator](); - } else { - return { done: false, value: mapped }; - } - } - } while (state.iterator); - return DONE_RESULT; - }); - } - flat(depth) { - if (depth === void 0) { - depth = 1; - } - if (depth <= 0) { - return this; - } - const stream2 = depth > 1 ? this.flat(depth - 1) : this; - return new _StreamImpl(() => ({ this: stream2.startFn() }), (state) => { - do { - if (state.iterator) { - const next = state.iterator.next(); - if (next.done) { - state.iterator = void 0; - } else { - return next; - } - } - const { done, value } = stream2.nextFn(state.this); - if (!done) { - if (isIterable(value)) { - state.iterator = value[Symbol.iterator](); - } else { - return { done: false, value }; - } - } - } while (state.iterator); - return DONE_RESULT; - }); - } - head() { - const iterator = this.iterator(); - const result = iterator.next(); - if (result.done) { - return void 0; - } - return result.value; - } - tail(skipCount = 1) { - return new _StreamImpl(() => { - const state = this.startFn(); - for (let i = 0; i < skipCount; i++) { - const next = this.nextFn(state); - if (next.done) { - return state; - } - } - return state; - }, this.nextFn); - } - limit(maxSize) { - return new _StreamImpl(() => ({ size: 0, state: this.startFn() }), (state) => { - state.size++; - if (state.size > maxSize) { - return DONE_RESULT; - } - return this.nextFn(state.state); - }); - } - distinct(by) { - const set = /* @__PURE__ */ new Set(); - return this.filter((e) => { - const value = by ? by(e) : e; - if (set.has(value)) { - return false; - } else { - set.add(value); - return true; - } - }); - } - exclude(other, key) { - const otherKeySet = /* @__PURE__ */ new Set(); - for (const item of other) { - const value = key ? key(item) : item; - otherKeySet.add(value); - } - return this.filter((e) => { - const ownKey = key ? key(e) : e; - return !otherKeySet.has(ownKey); - }); - } -}; -function toString(item) { - if (typeof item === "string") { - return item; - } - if (typeof item === "undefined") { - return "undefined"; - } - if (typeof item.toString === "function") { - return item.toString(); - } - return Object.prototype.toString.call(item); -} -function isIterable(obj) { - return !!obj && typeof obj[Symbol.iterator] === "function"; -} -var EMPTY_STREAM = new StreamImpl(() => void 0, () => DONE_RESULT); -var DONE_RESULT = Object.freeze({ done: true, value: void 0 }); -function stream(...collections) { - if (collections.length === 1) { - const collection = collections[0]; - if (collection instanceof StreamImpl) { - return collection; - } - if (isIterable(collection)) { - return new StreamImpl(() => collection[Symbol.iterator](), (iterator) => iterator.next()); - } - if (typeof collection.length === "number") { - return new StreamImpl(() => ({ index: 0 }), (state) => { - if (state.index < collection.length) { - return { done: false, value: collection[state.index++] }; - } else { - return DONE_RESULT; - } - }); - } - } - if (collections.length > 1) { - return new StreamImpl(() => ({ collIndex: 0, arrIndex: 0 }), (state) => { - do { - if (state.iterator) { - const next = state.iterator.next(); - if (!next.done) { - return next; - } - state.iterator = void 0; - } - if (state.array) { - if (state.arrIndex < state.array.length) { - return { done: false, value: state.array[state.arrIndex++] }; - } - state.array = void 0; - state.arrIndex = 0; - } - if (state.collIndex < collections.length) { - const collection = collections[state.collIndex++]; - if (isIterable(collection)) { - state.iterator = collection[Symbol.iterator](); - } else if (collection && typeof collection.length === "number") { - state.array = collection; - } - } - } while (state.iterator || state.array || state.collIndex < collections.length); - return DONE_RESULT; - }); - } - return EMPTY_STREAM; -} -var TreeStreamImpl = class extends StreamImpl { - constructor(root2, children, options) { - super(() => ({ - iterators: (options === null || options === void 0 ? void 0 : options.includeRoot) ? [[root2][Symbol.iterator]()] : [children(root2)[Symbol.iterator]()], - pruned: false - }), (state) => { - if (state.pruned) { - state.iterators.pop(); - state.pruned = false; - } - while (state.iterators.length > 0) { - const iterator = state.iterators[state.iterators.length - 1]; - const next = iterator.next(); - if (next.done) { - state.iterators.pop(); - } else { - state.iterators.push(children(next.value)[Symbol.iterator]()); - return next; - } - } - return DONE_RESULT; - }); - } - iterator() { - const iterator = { - state: this.startFn(), - next: () => this.nextFn(iterator.state), - prune: () => { - iterator.state.pruned = true; - }, - [Symbol.iterator]: () => iterator - }; - return iterator; - } -}; -var Reduction; -(function(Reduction2) { - function sum(stream2) { - return stream2.reduce((a2, b) => a2 + b, 0); - } - Reduction2.sum = sum; - function product(stream2) { - return stream2.reduce((a2, b) => a2 * b, 0); - } - Reduction2.product = product; - function min2(stream2) { - return stream2.reduce((a2, b) => Math.min(a2, b)); - } - Reduction2.min = min2; - function max(stream2) { - return stream2.reduce((a2, b) => Math.max(a2, b)); - } - Reduction2.max = max; -})(Reduction || (Reduction = {})); - -// node_modules/langium/lib/utils/cst-utils.js -var cst_utils_exports = {}; -__export(cst_utils_exports, { - DefaultNameRegexp: () => DefaultNameRegexp, - RangeComparison: () => RangeComparison, - compareRange: () => compareRange, - findCommentNode: () => findCommentNode, - findDeclarationNodeAtOffset: () => findDeclarationNodeAtOffset, - findLeafNodeAtOffset: () => findLeafNodeAtOffset, - findLeafNodeBeforeOffset: () => findLeafNodeBeforeOffset, - flattenCst: () => flattenCst, - getInteriorNodes: () => getInteriorNodes, - getNextNode: () => getNextNode, - getPreviousNode: () => getPreviousNode, - getStartlineNode: () => getStartlineNode, - inRange: () => inRange, - isChildNode: () => isChildNode, - isCommentNode: () => isCommentNode, - streamCst: () => streamCst, - toDocumentSegment: () => toDocumentSegment, - tokenToRange: () => tokenToRange -}); -function streamCst(node) { - return new TreeStreamImpl(node, (element) => { - if (isCompositeCstNode(element)) { - return element.content; - } else { - return []; - } - }, { includeRoot: true }); -} -function flattenCst(node) { - return streamCst(node).filter(isLeafCstNode); -} -function isChildNode(child, parent) { - while (child.container) { - child = child.container; - if (child === parent) { - return true; - } - } - return false; -} -function tokenToRange(token) { - return { - start: { - character: token.startColumn - 1, - line: token.startLine - 1 - }, - end: { - character: token.endColumn, - line: token.endLine - 1 - } - }; -} -function toDocumentSegment(node) { - if (!node) { - return void 0; - } - const { offset, end, range } = node; - return { - range, - offset, - end, - length: end - offset - }; -} -var RangeComparison; -(function(RangeComparison2) { - RangeComparison2[RangeComparison2["Before"] = 0] = "Before"; - RangeComparison2[RangeComparison2["After"] = 1] = "After"; - RangeComparison2[RangeComparison2["OverlapFront"] = 2] = "OverlapFront"; - RangeComparison2[RangeComparison2["OverlapBack"] = 3] = "OverlapBack"; - RangeComparison2[RangeComparison2["Inside"] = 4] = "Inside"; -})(RangeComparison || (RangeComparison = {})); -function compareRange(range, to) { - if (range.end.line < to.start.line || range.end.line === to.start.line && range.end.character < range.start.character) { - return RangeComparison.Before; - } else if (range.start.line > to.end.line || range.start.line === to.end.line && range.start.character > to.end.character) { - return RangeComparison.After; - } - const startInside = range.start.line > to.start.line || range.start.line === to.start.line && range.start.character >= to.start.character; - const endInside = range.end.line < to.end.line || range.end.line === to.end.line && range.end.character <= to.end.character; - if (startInside && endInside) { - return RangeComparison.Inside; - } else if (startInside) { - return RangeComparison.OverlapBack; - } else { - return RangeComparison.OverlapFront; - } -} -function inRange(range, to) { - const comparison = compareRange(range, to); - return comparison > RangeComparison.After; -} -var DefaultNameRegexp = /^[\w\p{L}]$/u; -function findDeclarationNodeAtOffset(cstNode, offset, nameRegexp = DefaultNameRegexp) { - if (cstNode) { - if (offset > 0) { - const localOffset = offset - cstNode.offset; - const textAtOffset = cstNode.text.charAt(localOffset); - if (!nameRegexp.test(textAtOffset)) { - offset--; - } - } - return findLeafNodeAtOffset(cstNode, offset); - } - return void 0; -} -function findCommentNode(cstNode, commentNames) { - if (cstNode) { - const previous = getPreviousNode(cstNode, true); - if (previous && isCommentNode(previous, commentNames)) { - return previous; - } - if (isRootCstNode(cstNode)) { - const endIndex = cstNode.content.findIndex((e) => !e.hidden); - for (let i = endIndex - 1; i >= 0; i--) { - const child = cstNode.content[i]; - if (isCommentNode(child, commentNames)) { - return child; - } - } - } - } - return void 0; -} -function isCommentNode(cstNode, commentNames) { - return isLeafCstNode(cstNode) && commentNames.includes(cstNode.tokenType.name); -} -function findLeafNodeAtOffset(node, offset) { - if (isLeafCstNode(node)) { - return node; - } else if (isCompositeCstNode(node)) { - const searchResult = binarySearch(node, offset, false); - if (searchResult) { - return findLeafNodeAtOffset(searchResult, offset); - } - } - return void 0; -} -function findLeafNodeBeforeOffset(node, offset) { - if (isLeafCstNode(node)) { - return node; - } else if (isCompositeCstNode(node)) { - const searchResult = binarySearch(node, offset, true); - if (searchResult) { - return findLeafNodeBeforeOffset(searchResult, offset); - } - } - return void 0; -} -function binarySearch(node, offset, closest) { - let left = 0; - let right = node.content.length - 1; - let closestNode = void 0; - while (left <= right) { - const middle = Math.floor((left + right) / 2); - const middleNode = node.content[middle]; - if (middleNode.offset <= offset && middleNode.end > offset) { - return middleNode; - } - if (middleNode.end <= offset) { - closestNode = closest ? middleNode : void 0; - left = middle + 1; - } else { - right = middle - 1; - } - } - return closestNode; -} -function getPreviousNode(node, hidden = true) { - while (node.container) { - const parent = node.container; - let index = parent.content.indexOf(node); - while (index > 0) { - index--; - const previous = parent.content[index]; - if (hidden || !previous.hidden) { - return previous; - } - } - node = parent; - } - return void 0; -} -function getNextNode(node, hidden = true) { - while (node.container) { - const parent = node.container; - let index = parent.content.indexOf(node); - const last2 = parent.content.length - 1; - while (index < last2) { - index++; - const next = parent.content[index]; - if (hidden || !next.hidden) { - return next; - } - } - node = parent; - } - return void 0; -} -function getStartlineNode(node) { - if (node.range.start.character === 0) { - return node; - } - const line = node.range.start.line; - let last2 = node; - let index; - while (node.container) { - const parent = node.container; - const selfIndex = index !== null && index !== void 0 ? index : parent.content.indexOf(node); - if (selfIndex === 0) { - node = parent; - index = void 0; - } else { - index = selfIndex - 1; - node = parent.content[index]; - } - if (node.range.start.line !== line) { - break; - } - last2 = node; - } - return last2; -} -function getInteriorNodes(start, end) { - const commonParent = getCommonParent(start, end); - if (!commonParent) { - return []; - } - return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b); -} -function getCommonParent(a2, b) { - const aParents = getParentChain(a2); - const bParents = getParentChain(b); - let current; - for (let i = 0; i < aParents.length && i < bParents.length; i++) { - const aParent = aParents[i]; - const bParent = bParents[i]; - if (aParent.parent === bParent.parent) { - current = { - parent: aParent.parent, - a: aParent.index, - b: bParent.index - }; - } else { - break; - } - } - return current; -} -function getParentChain(node) { - const chain = []; - while (node.container) { - const parent = node.container; - const index = parent.content.indexOf(node); - chain.push({ - parent, - index - }); - node = parent; - } - return chain.reverse(); -} - -// node_modules/langium/lib/utils/ast-utils.js -function linkContentToContainer(node) { - for (const [name, value] of Object.entries(node)) { - if (!name.startsWith("$")) { - if (Array.isArray(value)) { - value.forEach((item, index) => { - if (isAstNode(item)) { - item.$container = node; - item.$containerProperty = name; - item.$containerIndex = index; - } - }); - } else if (isAstNode(value)) { - value.$container = node; - value.$containerProperty = name; - } - } - } -} -function getContainerOfType(node, typePredicate) { - let item = node; - while (item) { - if (typePredicate(item)) { - return item; - } - item = item.$container; - } - return void 0; -} -function hasContainerOfType(node, predicate) { - let item = node; - while (item) { - if (predicate(item)) { - return true; - } - item = item.$container; - } - return false; -} -function getDocument(node) { - const rootNode = findRootNode(node); - const result = rootNode.$document; - if (!result) { - throw new Error("AST node has no document."); - } - return result; -} -function findRootNode(node) { - while (node.$container) { - node = node.$container; - } - return node; -} -function streamContents(node, options) { - if (!node) { - throw new Error("Node must be an AstNode."); - } - const range = options === null || options === void 0 ? void 0 : options.range; - return new StreamImpl(() => ({ - keys: Object.keys(node), - keyIndex: 0, - arrayIndex: 0 - }), (state) => { - while (state.keyIndex < state.keys.length) { - const property2 = state.keys[state.keyIndex]; - if (!property2.startsWith("$")) { - const value = node[property2]; - if (isAstNode(value)) { - state.keyIndex++; - if (isAstNodeInRange(value, range)) { - return { done: false, value }; - } - } else if (Array.isArray(value)) { - while (state.arrayIndex < value.length) { - const index = state.arrayIndex++; - const element = value[index]; - if (isAstNode(element) && isAstNodeInRange(element, range)) { - return { done: false, value: element }; - } - } - state.arrayIndex = 0; - } - } - state.keyIndex++; - } - return DONE_RESULT; - }); -} -function streamAllContents(root2, options) { - if (!root2) { - throw new Error("Root node must be an AstNode."); - } - return new TreeStreamImpl(root2, (node) => streamContents(node, options)); -} -function streamAst(root2, options) { - if (!root2) { - throw new Error("Root node must be an AstNode."); - } else if ((options === null || options === void 0 ? void 0 : options.range) && !isAstNodeInRange(root2, options.range)) { - return new TreeStreamImpl(root2, () => []); - } - return new TreeStreamImpl(root2, (node) => streamContents(node, options), { includeRoot: true }); -} -function isAstNodeInRange(astNode, range) { - var _a; - if (!range) { - return true; - } - const nodeRange = (_a = astNode.$cstNode) === null || _a === void 0 ? void 0 : _a.range; - if (!nodeRange) { - return false; - } - return inRange(nodeRange, range); -} -function streamReferences(node) { - return new StreamImpl(() => ({ - keys: Object.keys(node), - keyIndex: 0, - arrayIndex: 0 - }), (state) => { - while (state.keyIndex < state.keys.length) { - const property2 = state.keys[state.keyIndex]; - if (!property2.startsWith("$")) { - const value = node[property2]; - if (isReference(value)) { - state.keyIndex++; - return { done: false, value: { reference: value, container: node, property: property2 } }; - } else if (Array.isArray(value)) { - while (state.arrayIndex < value.length) { - const index = state.arrayIndex++; - const element = value[index]; - if (isReference(element)) { - return { done: false, value: { reference: element, container: node, property: property2, index } }; - } - } - state.arrayIndex = 0; - } - } - state.keyIndex++; - } - return DONE_RESULT; - }); -} -function findLocalReferences(targetNode, lookup = getDocument(targetNode).parseResult.value) { - const refs = []; - streamAst(lookup).forEach((node) => { - streamReferences(node).forEach((refInfo) => { - if (refInfo.reference.ref === targetNode) { - refs.push(refInfo.reference); - } - }); - }); - return stream(refs); -} -function assignMandatoryProperties(reflection3, node) { - const typeMetaData = reflection3.getTypeMetaData(node.$type); - const genericNode = node; - for (const property2 of typeMetaData.properties) { - if (property2.defaultValue !== void 0 && genericNode[property2.name] === void 0) { - genericNode[property2.name] = copyDefaultValue(property2.defaultValue); - } - } -} -function copyDefaultValue(propertyType) { - if (Array.isArray(propertyType)) { - return [...propertyType.map(copyDefaultValue)]; - } else { - return propertyType; - } -} -function copyAstNode(node, buildReference) { - const copy = { $type: node.$type }; - for (const [name, value] of Object.entries(node)) { - if (!name.startsWith("$")) { - if (isAstNode(value)) { - copy[name] = copyAstNode(value, buildReference); - } else if (isReference(value)) { - copy[name] = buildReference(copy, name, value.$refNode, value.$refText); - } else if (Array.isArray(value)) { - const copiedArray = []; - for (const element of value) { - if (isAstNode(element)) { - copiedArray.push(copyAstNode(element, buildReference)); - } else if (isReference(element)) { - copiedArray.push(buildReference(copy, name, element.$refNode, element.$refText)); - } else { - copiedArray.push(element); - } - } - copy[name] = copiedArray; - } else { - copy[name] = value; - } - } - } - linkContentToContainer(copy); - return copy; -} - -// node_modules/langium/lib/utils/grammar-utils.js -var grammar_utils_exports = {}; -__export(grammar_utils_exports, { - findAssignment: () => findAssignment, - findNameAssignment: () => findNameAssignment, - findNodeForKeyword: () => findNodeForKeyword, - findNodeForProperty: () => findNodeForProperty, - findNodesForKeyword: () => findNodesForKeyword, - findNodesForKeywordInternal: () => findNodesForKeywordInternal, - findNodesForProperty: () => findNodesForProperty, - getActionAtElement: () => getActionAtElement, - getActionType: () => getActionType, - getAllReachableRules: () => getAllReachableRules, - getCrossReferenceTerminal: () => getCrossReferenceTerminal, - getEntryRule: () => getEntryRule, - getExplicitRuleType: () => getExplicitRuleType, - getHiddenRules: () => getHiddenRules, - getRuleType: () => getRuleType, - getTypeName: () => getTypeName, - isArrayCardinality: () => isArrayCardinality, - isArrayOperator: () => isArrayOperator, - isCommentTerminal: () => isCommentTerminal, - isDataType: () => isDataType, - isDataTypeRule: () => isDataTypeRule, - isOptionalCardinality: () => isOptionalCardinality, - terminalRegex: () => terminalRegex -}); - -// node_modules/langium/lib/utils/errors.js -var ErrorWithLocation = class extends Error { - constructor(node, message) { - super(node ? `${message} at ${node.range.start.line}:${node.range.start.character}` : message); - } -}; -function assertUnreachable(_2) { - throw new Error("Error! The input value was not handled."); -} - -// node_modules/langium/lib/utils/regexp-utils.js -var regexp_utils_exports = {}; -__export(regexp_utils_exports, { - NEWLINE_REGEXP: () => NEWLINE_REGEXP, - escapeRegExp: () => escapeRegExp, - getCaseInsensitivePattern: () => getCaseInsensitivePattern, - getTerminalParts: () => getTerminalParts, - isMultilineComment: () => isMultilineComment, - isWhitespace: () => isWhitespace, - partialMatches: () => partialMatches, - partialRegExp: () => partialRegExp -}); - -// node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js -function cc(char) { - return char.charCodeAt(0); -} -function insertToSet(item, set) { - if (Array.isArray(item)) { - item.forEach(function(subItem) { - set.push(subItem); - }); - } else { - set.push(item); - } -} -function addFlag(flagObj, flagKey) { - if (flagObj[flagKey] === true) { - throw "duplicate flag " + flagKey; - } - const x = flagObj[flagKey]; - flagObj[flagKey] = true; -} -function ASSERT_EXISTS(obj) { - if (obj === void 0) { - throw Error("Internal Error - Should never get here!"); - } - return true; -} -function ASSERT_NEVER_REACH_HERE() { - throw Error("Internal Error - Should never get here!"); -} -function isCharacter(obj) { - return obj["type"] === "Character"; -} - -// node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js -var digitsCharCodes = []; -for (let i = cc("0"); i <= cc("9"); i++) { - digitsCharCodes.push(i); -} -var wordCharCodes = [cc("_")].concat(digitsCharCodes); -for (let i = cc("a"); i <= cc("z"); i++) { - wordCharCodes.push(i); -} -for (let i = cc("A"); i <= cc("Z"); i++) { - wordCharCodes.push(i); -} -var whitespaceCodes = [ - cc(" "), - cc("\f"), - cc("\n"), - cc("\r"), - cc(" "), - cc("\v"), - cc(" "), - cc("\xA0"), - cc("\u1680"), - cc("\u2000"), - cc("\u2001"), - cc("\u2002"), - cc("\u2003"), - cc("\u2004"), - cc("\u2005"), - cc("\u2006"), - cc("\u2007"), - cc("\u2008"), - cc("\u2009"), - cc("\u200A"), - cc("\u2028"), - cc("\u2029"), - cc("\u202F"), - cc("\u205F"), - cc("\u3000"), - cc("\uFEFF") -]; - -// node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js -var hexDigitPattern = /[0-9a-fA-F]/; -var decimalPattern = /[0-9]/; -var decimalPatternNoZero = /[1-9]/; -var RegExpParser = class { - constructor() { - this.idx = 0; - this.input = ""; - this.groupIdx = 0; - } - saveState() { - return { - idx: this.idx, - input: this.input, - groupIdx: this.groupIdx - }; - } - restoreState(newState2) { - this.idx = newState2.idx; - this.input = newState2.input; - this.groupIdx = newState2.groupIdx; - } - pattern(input) { - this.idx = 0; - this.input = input; - this.groupIdx = 0; - this.consumeChar("/"); - const value = this.disjunction(); - this.consumeChar("/"); - const flags = { - type: "Flags", - loc: { begin: this.idx, end: input.length }, - global: false, - ignoreCase: false, - multiLine: false, - unicode: false, - sticky: false - }; - while (this.isRegExpFlag()) { - switch (this.popChar()) { - case "g": - addFlag(flags, "global"); - break; - case "i": - addFlag(flags, "ignoreCase"); - break; - case "m": - addFlag(flags, "multiLine"); - break; - case "u": - addFlag(flags, "unicode"); - break; - case "y": - addFlag(flags, "sticky"); - break; - } - } - if (this.idx !== this.input.length) { - throw Error("Redundant input: " + this.input.substring(this.idx)); - } - return { - type: "Pattern", - flags, - value, - loc: this.loc(0) - }; - } - disjunction() { - const alts = []; - const begin = this.idx; - alts.push(this.alternative()); - while (this.peekChar() === "|") { - this.consumeChar("|"); - alts.push(this.alternative()); - } - return { type: "Disjunction", value: alts, loc: this.loc(begin) }; - } - alternative() { - const terms = []; - const begin = this.idx; - while (this.isTerm()) { - terms.push(this.term()); - } - return { type: "Alternative", value: terms, loc: this.loc(begin) }; - } - term() { - if (this.isAssertion()) { - return this.assertion(); - } else { - return this.atom(); - } - } - assertion() { - const begin = this.idx; - switch (this.popChar()) { - case "^": - return { - type: "StartAnchor", - loc: this.loc(begin) - }; - case "$": - return { type: "EndAnchor", loc: this.loc(begin) }; - case "\\": - switch (this.popChar()) { - case "b": - return { - type: "WordBoundary", - loc: this.loc(begin) - }; - case "B": - return { - type: "NonWordBoundary", - loc: this.loc(begin) - }; - } - throw Error("Invalid Assertion Escape"); - case "(": - this.consumeChar("?"); - let type; - switch (this.popChar()) { - case "=": - type = "Lookahead"; - break; - case "!": - type = "NegativeLookahead"; - break; - } - ASSERT_EXISTS(type); - const disjunction = this.disjunction(); - this.consumeChar(")"); - return { - type, - value: disjunction, - loc: this.loc(begin) - }; - } - return ASSERT_NEVER_REACH_HERE(); - } - quantifier(isBacktracking = false) { - let range = void 0; - const begin = this.idx; - switch (this.popChar()) { - case "*": - range = { - atLeast: 0, - atMost: Infinity - }; - break; - case "+": - range = { - atLeast: 1, - atMost: Infinity - }; - break; - case "?": - range = { - atLeast: 0, - atMost: 1 - }; - break; - case "{": - const atLeast = this.integerIncludingZero(); - switch (this.popChar()) { - case "}": - range = { - atLeast, - atMost: atLeast - }; - break; - case ",": - let atMost; - if (this.isDigit()) { - atMost = this.integerIncludingZero(); - range = { - atLeast, - atMost - }; - } else { - range = { - atLeast, - atMost: Infinity - }; - } - this.consumeChar("}"); - break; - } - if (isBacktracking === true && range === void 0) { - return void 0; - } - ASSERT_EXISTS(range); - break; - } - if (isBacktracking === true && range === void 0) { - return void 0; - } - if (ASSERT_EXISTS(range)) { - if (this.peekChar(0) === "?") { - this.consumeChar("?"); - range.greedy = false; - } else { - range.greedy = true; - } - range.type = "Quantifier"; - range.loc = this.loc(begin); - return range; - } - } - atom() { - let atom2; - const begin = this.idx; - switch (this.peekChar()) { - case ".": - atom2 = this.dotAll(); - break; - case "\\": - atom2 = this.atomEscape(); - break; - case "[": - atom2 = this.characterClass(); - break; - case "(": - atom2 = this.group(); - break; - } - if (atom2 === void 0 && this.isPatternCharacter()) { - atom2 = this.patternCharacter(); - } - if (ASSERT_EXISTS(atom2)) { - atom2.loc = this.loc(begin); - if (this.isQuantifier()) { - atom2.quantifier = this.quantifier(); - } - return atom2; - } - return ASSERT_NEVER_REACH_HERE(); - } - dotAll() { - this.consumeChar("."); - return { - type: "Set", - complement: true, - value: [cc("\n"), cc("\r"), cc("\u2028"), cc("\u2029")] - }; - } - atomEscape() { - this.consumeChar("\\"); - switch (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() { - const value = this.positiveInteger(); - return { type: "GroupBackReference", value }; - } - characterClassEscape() { - let set; - let complement = false; - switch (this.popChar()) { - case "d": - set = digitsCharCodes; - break; - case "D": - set = digitsCharCodes; - complement = true; - break; - case "s": - set = whitespaceCodes; - break; - case "S": - set = whitespaceCodes; - complement = true; - break; - case "w": - set = wordCharCodes; - break; - case "W": - set = wordCharCodes; - complement = true; - break; - } - if (ASSERT_EXISTS(set)) { - return { type: "Set", value: set, complement }; - } - return ASSERT_NEVER_REACH_HERE(); - } - controlEscapeAtom() { - let escapeCode; - switch (this.popChar()) { - case "f": - escapeCode = cc("\f"); - break; - case "n": - escapeCode = cc("\n"); - break; - case "r": - escapeCode = cc("\r"); - break; - case "t": - escapeCode = cc(" "); - break; - case "v": - escapeCode = cc("\v"); - break; - } - if (ASSERT_EXISTS(escapeCode)) { - return { type: "Character", value: escapeCode }; - } - return ASSERT_NEVER_REACH_HERE(); - } - controlLetterEscapeAtom() { - this.consumeChar("c"); - const letter = this.popChar(); - if (/[a-zA-Z]/.test(letter) === false) { - throw Error("Invalid "); - } - const letterCode = letter.toUpperCase().charCodeAt(0) - 64; - return { type: "Character", value: letterCode }; - } - nulCharacterAtom() { - this.consumeChar("0"); - return { type: "Character", value: cc("\0") }; - } - hexEscapeSequenceAtom() { - this.consumeChar("x"); - return this.parseHexDigits(2); - } - regExpUnicodeEscapeSequenceAtom() { - this.consumeChar("u"); - return this.parseHexDigits(4); - } - identityEscapeAtom() { - const escapedChar = this.popChar(); - return { type: "Character", value: cc(escapedChar) }; - } - classPatternCharacterAtom() { - switch (this.peekChar()) { - case "\n": - case "\r": - case "\u2028": - case "\u2029": - case "\\": - case "]": - throw Error("TBD"); - default: - const nextChar = this.popChar(); - return { type: "Character", value: cc(nextChar) }; - } - } - characterClass() { - const set = []; - let complement = false; - this.consumeChar("["); - if (this.peekChar(0) === "^") { - this.consumeChar("^"); - complement = true; - } - while (this.isClassAtom()) { - const from = this.classAtom(); - const isFromSingleChar = from.type === "Character"; - if (isCharacter(from) && this.isRangeDash()) { - this.consumeChar("-"); - const to = this.classAtom(); - const isToSingleChar = to.type === "Character"; - if (isCharacter(to)) { - if (to.value < from.value) { - throw Error("Range out of order in character class"); - } - set.push({ from: from.value, to: to.value }); - } else { - insertToSet(from.value, set); - set.push(cc("-")); - insertToSet(to.value, set); - } - } else { - insertToSet(from.value, set); - } - } - this.consumeChar("]"); - return { type: "Set", complement, value: set }; - } - classAtom() { - switch (this.peekChar()) { - case "]": - case "\n": - case "\r": - case "\u2028": - case "\u2029": - throw Error("TBD"); - case "\\": - return this.classEscape(); - default: - return this.classPatternCharacterAtom(); - } - } - classEscape() { - this.consumeChar("\\"); - switch (this.peekChar()) { - case "b": - this.consumeChar("b"); - return { type: "Character", value: cc("\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 capturing = true; - this.consumeChar("("); - switch (this.peekChar(0)) { - case "?": - this.consumeChar("?"); - this.consumeChar(":"); - capturing = false; - break; - default: - this.groupIdx++; - break; - } - const value = this.disjunction(); - this.consumeChar(")"); - const groupAst = { - type: "Group", - capturing, - value - }; - if (capturing) { - groupAst["idx"] = this.groupIdx; - } - return groupAst; - } - positiveInteger() { - let number = this.popChar(); - if (decimalPatternNoZero.test(number) === false) { - throw Error("Expecting a positive integer"); - } - while (decimalPattern.test(this.peekChar(0))) { - number += this.popChar(); - } - return parseInt(number, 10); - } - integerIncludingZero() { - let number = this.popChar(); - if (decimalPattern.test(number) === false) { - throw Error("Expecting an integer"); - } - while (decimalPattern.test(this.peekChar(0))) { - number += this.popChar(); - } - return parseInt(number, 10); - } - patternCharacter() { - const nextChar = this.popChar(); - switch (nextChar) { - case "\n": - case "\r": - case "\u2028": - case "\u2029": - case "^": - case "$": - case "\\": - case ".": - case "*": - case "+": - case "?": - case "(": - case ")": - case "[": - case "|": - throw Error("TBD"); - default: - return { type: "Character", value: cc(nextChar) }; - } - } - isRegExpFlag() { - switch (this.peekChar(0)) { - case "g": - case "i": - case "m": - case "u": - case "y": - return true; - default: - return false; - } - } - isRangeDash() { - return this.peekChar() === "-" && this.isClassAtom(1); - } - isDigit() { - return decimalPattern.test(this.peekChar(0)); - } - isClassAtom(howMuch = 0) { - switch (this.peekChar(howMuch)) { - case "]": - case "\n": - case "\r": - case "\u2028": - case "\u2029": - return false; - default: - return true; - } - } - isTerm() { - return this.isAtom() || this.isAssertion(); - } - isAtom() { - if (this.isPatternCharacter()) { - return true; - } - switch (this.peekChar(0)) { - case ".": - case "\\": - case "[": - case "(": - return true; - default: - return false; - } - } - isAssertion() { - switch (this.peekChar(0)) { - case "^": - case "$": - return true; - case "\\": - switch (this.peekChar(1)) { - case "b": - case "B": - return true; - default: - return false; - } - case "(": - return this.peekChar(1) === "?" && (this.peekChar(2) === "=" || this.peekChar(2) === "!"); - default: - return false; - } - } - isQuantifier() { - const prevState = this.saveState(); - try { - return this.quantifier(true) !== void 0; - } catch (e) { - return false; - } finally { - this.restoreState(prevState); - } - } - isPatternCharacter() { - switch (this.peekChar()) { - case "^": - case "$": - case "\\": - case ".": - case "*": - case "+": - case "?": - case "(": - case ")": - case "[": - case "|": - case "/": - case "\n": - case "\r": - case "\u2028": - case "\u2029": - return false; - default: - return true; - } - } - parseHexDigits(howMany) { - let hexString = ""; - for (let i = 0; i < howMany; i++) { - const hexChar = this.popChar(); - if (hexDigitPattern.test(hexChar) === false) { - throw Error("Expecting a HexDecimal digits"); - } - hexString += hexChar; - } - const charCode = parseInt(hexString, 16); - return { type: "Character", value: charCode }; - } - peekChar(howMuch = 0) { - return this.input[this.idx + howMuch]; - } - popChar() { - const nextChar = this.peekChar(0); - this.consumeChar(void 0); - return nextChar; - } - consumeChar(char) { - if (char !== void 0 && this.input[this.idx] !== char) { - throw Error("Expected: '" + char + "' 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(begin) { - return { begin, end: this.idx }; - } -}; - -// node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js -var BaseRegExpVisitor = class { - visitChildren(node) { - for (const key in node) { - const child = node[key]; - if (node.hasOwnProperty(key)) { - if (child.type !== void 0) { - this.visit(child); - } else if (Array.isArray(child)) { - child.forEach((subChild) => { - this.visit(subChild); - }, this); - } - } - } - } - visit(node) { - switch (node.type) { - case "Pattern": - this.visitPattern(node); - break; - case "Flags": - this.visitFlags(node); - break; - case "Disjunction": - this.visitDisjunction(node); - break; - case "Alternative": - this.visitAlternative(node); - break; - case "StartAnchor": - this.visitStartAnchor(node); - break; - case "EndAnchor": - this.visitEndAnchor(node); - break; - case "WordBoundary": - this.visitWordBoundary(node); - break; - case "NonWordBoundary": - this.visitNonWordBoundary(node); - break; - case "Lookahead": - this.visitLookahead(node); - break; - case "NegativeLookahead": - this.visitNegativeLookahead(node); - break; - case "Character": - this.visitCharacter(node); - break; - case "Set": - this.visitSet(node); - break; - case "Group": - this.visitGroup(node); - break; - case "GroupBackReference": - this.visitGroupBackReference(node); - break; - case "Quantifier": - this.visitQuantifier(node); - break; - } - this.visitChildren(node); - } - visitPattern(node) { - } - visitFlags(node) { - } - visitDisjunction(node) { - } - visitAlternative(node) { - } - // Assertion - visitStartAnchor(node) { - } - visitEndAnchor(node) { - } - visitWordBoundary(node) { - } - visitNonWordBoundary(node) { - } - visitLookahead(node) { - } - visitNegativeLookahead(node) { - } - // atoms - visitCharacter(node) { - } - visitSet(node) { - } - visitGroup(node) { - } - visitGroupBackReference(node) { - } - visitQuantifier(node) { - } -}; - -// node_modules/langium/lib/utils/regexp-utils.js -var NEWLINE_REGEXP = /\r?\n/gm; -var regexpParser = new RegExpParser(); -var TerminalRegExpVisitor = class extends BaseRegExpVisitor { - constructor() { - super(...arguments); - this.isStarting = true; - this.endRegexpStack = []; - this.multiline = false; - } - get endRegex() { - return this.endRegexpStack.join(""); - } - reset(regex) { - this.multiline = false; - this.regex = regex; - this.startRegexp = ""; - this.isStarting = true; - this.endRegexpStack = []; - } - visitGroup(node) { - if (node.quantifier) { - this.isStarting = false; - this.endRegexpStack = []; - } - } - visitCharacter(node) { - const char = String.fromCharCode(node.value); - if (!this.multiline && char === "\n") { - this.multiline = true; - } - if (node.quantifier) { - this.isStarting = false; - this.endRegexpStack = []; - } else { - const escapedChar = escapeRegExp(char); - this.endRegexpStack.push(escapedChar); - if (this.isStarting) { - this.startRegexp += escapedChar; - } - } - } - visitSet(node) { - if (!this.multiline) { - const set = this.regex.substring(node.loc.begin, node.loc.end); - const regex = new RegExp(set); - this.multiline = Boolean("\n".match(regex)); - } - if (node.quantifier) { - this.isStarting = false; - this.endRegexpStack = []; - } else { - const set = this.regex.substring(node.loc.begin, node.loc.end); - this.endRegexpStack.push(set); - if (this.isStarting) { - this.startRegexp += set; - } - } - } - visitChildren(node) { - if (node.type === "Group") { - const group = node; - if (group.quantifier) { - return; - } - } - super.visitChildren(node); - } -}; -var visitor = new TerminalRegExpVisitor(); -function getTerminalParts(regexp) { - try { - if (typeof regexp !== "string") { - regexp = regexp.source; - } - regexp = `/${regexp}/`; - const pattern = regexpParser.pattern(regexp); - const parts = []; - for (const alternative of pattern.value.value) { - visitor.reset(regexp); - visitor.visit(alternative); - parts.push({ - start: visitor.startRegexp, - end: visitor.endRegex - }); - } - return parts; - } catch (_a) { - return []; - } -} -function isMultilineComment(regexp) { - try { - if (typeof regexp === "string") { - regexp = new RegExp(regexp); - } - regexp = regexp.toString(); - visitor.reset(regexp); - visitor.visit(regexpParser.pattern(regexp)); - return visitor.multiline; - } catch (_a) { - return false; - } -} -function isWhitespace(value) { - const regexp = typeof value === "string" ? new RegExp(value) : value; - return regexp.test(" "); -} -function escapeRegExp(value) { - return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); -} -function getCaseInsensitivePattern(keyword) { - return Array.prototype.map.call(keyword, (letter) => /\w/.test(letter) ? `[${letter.toLowerCase()}${letter.toUpperCase()}]` : escapeRegExp(letter)).join(""); -} -function partialMatches(regex, input) { - const partial = partialRegExp(regex); - const match = input.match(partial); - return !!match && match[0].length > 0; -} -function partialRegExp(regex) { - if (typeof regex === "string") { - regex = new RegExp(regex); - } - const re = regex, source = regex.source; - let i = 0; - function process2() { - let result = "", tmp; - function appendRaw(nbChars) { - result += source.substr(i, nbChars); - i += nbChars; - } - function appendOptional(nbChars) { - result += "(?:" + source.substr(i, nbChars) + "|$)"; - i += nbChars; - } - while (i < source.length) { - switch (source[i]) { - case "\\": - switch (source[i + 1]) { - case "c": - appendOptional(3); - break; - case "x": - appendOptional(4); - break; - case "u": - if (re.unicode) { - if (source[i + 2] === "{") { - appendOptional(source.indexOf("}", i) - i + 1); - } else { - appendOptional(6); - } - } else { - appendOptional(2); - } - break; - case "p": - case "P": - if (re.unicode) { - appendOptional(source.indexOf("}", i) - i + 1); - } else { - appendOptional(2); - } - break; - case "k": - appendOptional(source.indexOf(">", i) - i + 1); - break; - default: - appendOptional(2); - break; - } - break; - case "[": - tmp = /\[(?:\\.|.)*?\]/g; - tmp.lastIndex = i; - tmp = tmp.exec(source) || []; - appendOptional(tmp[0].length); - break; - case "|": - case "^": - case "$": - case "*": - case "+": - case "?": - appendRaw(1); - break; - case "{": - tmp = /\{\d+,?\d*\}/g; - tmp.lastIndex = i; - tmp = tmp.exec(source); - if (tmp) { - appendRaw(tmp[0].length); - } else { - appendOptional(1); - } - break; - case "(": - if (source[i + 1] === "?") { - switch (source[i + 2]) { - case ":": - result += "(?:"; - i += 3; - result += process2() + "|$)"; - break; - case "=": - result += "(?="; - i += 3; - result += process2() + ")"; - break; - case "!": - tmp = i; - i += 3; - process2(); - result += source.substr(tmp, i - tmp); - break; - case "<": - switch (source[i + 3]) { - case "=": - case "!": - tmp = i; - i += 4; - process2(); - result += source.substr(tmp, i - tmp); - break; - default: - appendRaw(source.indexOf(">", i) - i + 1); - result += process2() + "|$)"; - break; - } - break; - } - } else { - appendRaw(1); - result += process2() + "|$)"; - } - break; - case ")": - ++i; - return result; - default: - appendOptional(1); - break; - } - } - return result; - } - return new RegExp(process2(), regex.flags); -} - -// node_modules/langium/lib/utils/grammar-utils.js -function getEntryRule(grammar) { - return grammar.rules.find((e) => isParserRule(e) && e.entry); -} -function getHiddenRules(grammar) { - return grammar.rules.filter((e) => isTerminalRule(e) && e.hidden); -} -function getAllReachableRules(grammar, allTerminals) { - const ruleNames = /* @__PURE__ */ new Set(); - const entryRule = getEntryRule(grammar); - if (!entryRule) { - return new Set(grammar.rules); - } - const topMostRules = [entryRule].concat(getHiddenRules(grammar)); - for (const rule of topMostRules) { - ruleDfs(rule, ruleNames, allTerminals); - } - const rules = /* @__PURE__ */ new Set(); - for (const rule of grammar.rules) { - if (ruleNames.has(rule.name) || isTerminalRule(rule) && rule.hidden) { - rules.add(rule); - } - } - return rules; -} -function ruleDfs(rule, visitedSet, allTerminals) { - visitedSet.add(rule.name); - streamAllContents(rule).forEach((node) => { - if (isRuleCall(node) || allTerminals && isTerminalRuleCall(node)) { - const refRule = node.rule.ref; - if (refRule && !visitedSet.has(refRule.name)) { - ruleDfs(refRule, visitedSet, allTerminals); - } - } - }); -} -function getCrossReferenceTerminal(crossRef) { - if (crossRef.terminal) { - return crossRef.terminal; - } else if (crossRef.type.ref) { - const nameAssigment = findNameAssignment(crossRef.type.ref); - return nameAssigment === null || nameAssigment === void 0 ? void 0 : nameAssigment.terminal; - } - return void 0; -} -function isCommentTerminal(terminalRule) { - return terminalRule.hidden && !terminalRegex(terminalRule).test(" "); -} -function findNodesForProperty(node, property2) { - if (!node || !property2) { - return []; - } - return findNodesForPropertyInternal(node, property2, node.astNode, true); -} -function findNodeForProperty(node, property2, index) { - if (!node || !property2) { - return void 0; - } - const nodes = findNodesForPropertyInternal(node, property2, node.astNode, true); - if (nodes.length === 0) { - return void 0; - } - if (index !== void 0) { - index = Math.max(0, Math.min(index, nodes.length - 1)); - } else { - index = 0; - } - return nodes[index]; -} -function findNodesForPropertyInternal(node, property2, element, first2) { - if (!first2) { - const nodeFeature = getContainerOfType(node.grammarSource, isAssignment); - if (nodeFeature && nodeFeature.feature === property2) { - return [node]; - } - } - if (isCompositeCstNode(node) && node.astNode === element) { - return node.content.flatMap((e) => findNodesForPropertyInternal(e, property2, element, false)); - } - return []; -} -function findNodesForKeyword(node, keyword) { - if (!node) { - return []; - } - return findNodesForKeywordInternal(node, keyword, node === null || node === void 0 ? void 0 : node.astNode); -} -function findNodeForKeyword(node, keyword, index) { - if (!node) { - return void 0; - } - const nodes = findNodesForKeywordInternal(node, keyword, node === null || node === void 0 ? void 0 : node.astNode); - if (nodes.length === 0) { - return void 0; - } - if (index !== void 0) { - index = Math.max(0, Math.min(index, nodes.length - 1)); - } else { - index = 0; - } - return nodes[index]; -} -function findNodesForKeywordInternal(node, keyword, element) { - if (node.astNode !== element) { - return []; - } - if (isKeyword(node.grammarSource) && node.grammarSource.value === keyword) { - return [node]; - } - const treeIterator = streamCst(node).iterator(); - let result; - const keywordNodes = []; - do { - result = treeIterator.next(); - if (!result.done) { - const childNode = result.value; - if (childNode.astNode === element) { - if (isKeyword(childNode.grammarSource) && childNode.grammarSource.value === keyword) { - keywordNodes.push(childNode); - } - } else { - treeIterator.prune(); - } - } - } while (!result.done); - return keywordNodes; -} -function findAssignment(cstNode) { - var _a; - const astNode = cstNode.astNode; - while (astNode === ((_a = cstNode.container) === null || _a === void 0 ? void 0 : _a.astNode)) { - const assignment = getContainerOfType(cstNode.grammarSource, isAssignment); - if (assignment) { - return assignment; - } - cstNode = cstNode.container; - } - return void 0; -} -function findNameAssignment(type) { - let startNode = type; - if (isInferredType(startNode)) { - if (isAction(startNode.$container)) { - startNode = startNode.$container.$container; - } else if (isParserRule(startNode.$container)) { - startNode = startNode.$container; - } else { - assertUnreachable(startNode.$container); - } - } - return findNameAssignmentInternal(type, startNode, /* @__PURE__ */ new Map()); -} -function findNameAssignmentInternal(type, startNode, cache) { - var _a; - function go(node, refType) { - let childAssignment = void 0; - const parentAssignment = getContainerOfType(node, isAssignment); - if (!parentAssignment) { - childAssignment = findNameAssignmentInternal(refType, refType, cache); - } - cache.set(type, childAssignment); - return childAssignment; - } - if (cache.has(type)) { - return cache.get(type); - } - cache.set(type, void 0); - for (const node of streamAllContents(startNode)) { - if (isAssignment(node) && node.feature.toLowerCase() === "name") { - cache.set(type, node); - return node; - } else if (isRuleCall(node) && isParserRule(node.rule.ref)) { - return go(node, node.rule.ref); - } else if (isSimpleType(node) && ((_a = node.typeRef) === null || _a === void 0 ? void 0 : _a.ref)) { - return go(node, node.typeRef.ref); - } - } - return void 0; -} -function getActionAtElement(element) { - const parent = element.$container; - if (isGroup(parent)) { - const elements = parent.elements; - const index = elements.indexOf(element); - for (let i = index - 1; i >= 0; i--) { - const item = elements[i]; - if (isAction(item)) { - return item; - } else { - const action = streamAllContents(elements[i]).find(isAction); - if (action) { - return action; - } - } - } - } - if (isAbstractElement(parent)) { - return getActionAtElement(parent); - } else { - return void 0; - } -} -function isOptionalCardinality(cardinality, element) { - return cardinality === "?" || cardinality === "*" || isGroup(element) && Boolean(element.guardCondition); -} -function isArrayCardinality(cardinality) { - return cardinality === "*" || cardinality === "+"; -} -function isArrayOperator(operator) { - return operator === "+="; -} -function isDataTypeRule(rule) { - return isDataTypeRuleInternal(rule, /* @__PURE__ */ new Set()); -} -function isDataTypeRuleInternal(rule, visited) { - if (visited.has(rule)) { - return true; - } else { - visited.add(rule); - } - for (const node of streamAllContents(rule)) { - if (isRuleCall(node)) { - if (!node.rule.ref) { - return false; - } - if (isParserRule(node.rule.ref) && !isDataTypeRuleInternal(node.rule.ref, visited)) { - return false; - } - } else if (isAssignment(node)) { - return false; - } else if (isAction(node)) { - return false; - } - } - return Boolean(rule.definition); -} -function isDataType(type) { - return isDataTypeInternal(type.type, /* @__PURE__ */ new Set()); -} -function isDataTypeInternal(type, visited) { - if (visited.has(type)) { - return true; - } else { - visited.add(type); - } - if (isArrayType(type)) { - return false; - } else if (isReferenceType(type)) { - return false; - } else if (isUnionType(type)) { - return type.types.every((e) => isDataTypeInternal(e, visited)); - } else if (isSimpleType(type)) { - if (type.primitiveType !== void 0) { - return true; - } else if (type.stringType !== void 0) { - return true; - } else if (type.typeRef !== void 0) { - const ref = type.typeRef.ref; - if (isType(ref)) { - return isDataTypeInternal(ref.type, visited); - } else { - return false; - } - } else { - return false; - } - } else { - return false; - } -} -function getExplicitRuleType(rule) { - if (rule.inferredType) { - return rule.inferredType.name; - } else if (rule.dataType) { - return rule.dataType; - } else if (rule.returnType) { - const refType = rule.returnType.ref; - if (refType) { - if (isParserRule(refType)) { - return refType.name; - } else if (isInterface(refType) || isType(refType)) { - return refType.name; - } - } - } - return void 0; -} -function getTypeName(type) { - var _a; - if (isParserRule(type)) { - return isDataTypeRule(type) ? type.name : (_a = getExplicitRuleType(type)) !== null && _a !== void 0 ? _a : type.name; - } else if (isInterface(type) || isType(type) || isReturnType(type)) { - return type.name; - } else if (isAction(type)) { - const actionType = getActionType(type); - if (actionType) { - return actionType; - } - } else if (isInferredType(type)) { - return type.name; - } - throw new Error("Cannot get name of Unknown Type"); -} -function getActionType(action) { - var _a; - if (action.inferredType) { - return action.inferredType.name; - } else if ((_a = action.type) === null || _a === void 0 ? void 0 : _a.ref) { - return getTypeName(action.type.ref); - } - return void 0; -} -function getRuleType(rule) { - var _a, _b, _c; - if (isTerminalRule(rule)) { - return (_b = (_a = rule.type) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "string"; - } else { - return isDataTypeRule(rule) ? rule.name : (_c = getExplicitRuleType(rule)) !== null && _c !== void 0 ? _c : rule.name; - } -} -function terminalRegex(terminalRule) { - const flags = { - s: false, - i: false, - u: false - }; - const source = abstractElementToRegex(terminalRule.definition, flags); - const flagText = Object.entries(flags).filter(([, value]) => value).map(([name]) => name).join(""); - return new RegExp(source, flagText); -} -var WILDCARD = /[\s\S]/.source; -function abstractElementToRegex(element, flags) { - if (isTerminalAlternatives(element)) { - return terminalAlternativesToRegex(element); - } else if (isTerminalGroup(element)) { - return terminalGroupToRegex(element); - } else if (isCharacterRange(element)) { - return characterRangeToRegex(element); - } else if (isTerminalRuleCall(element)) { - const rule = element.rule.ref; - if (!rule) { - throw new Error("Missing rule reference."); - } - return withCardinality(abstractElementToRegex(rule.definition), { - cardinality: element.cardinality, - lookahead: element.lookahead - }); - } else if (isNegatedToken(element)) { - return negateTokenToRegex(element); - } else if (isUntilToken(element)) { - return untilTokenToRegex(element); - } else if (isRegexToken(element)) { - const lastSlash = element.regex.lastIndexOf("/"); - const source = element.regex.substring(1, lastSlash); - const regexFlags = element.regex.substring(lastSlash + 1); - if (flags) { - flags.i = regexFlags.includes("i"); - flags.s = regexFlags.includes("s"); - flags.u = regexFlags.includes("u"); - } - return withCardinality(source, { - cardinality: element.cardinality, - lookahead: element.lookahead, - wrap: false - }); - } else if (isWildcard(element)) { - return withCardinality(WILDCARD, { - cardinality: element.cardinality, - lookahead: element.lookahead - }); - } else { - throw new Error(`Invalid terminal element: ${element === null || element === void 0 ? void 0 : element.$type}`); - } -} -function terminalAlternativesToRegex(alternatives) { - return withCardinality(alternatives.elements.map((e) => abstractElementToRegex(e)).join("|"), { - cardinality: alternatives.cardinality, - lookahead: alternatives.lookahead - }); -} -function terminalGroupToRegex(group) { - return withCardinality(group.elements.map((e) => abstractElementToRegex(e)).join(""), { - cardinality: group.cardinality, - lookahead: group.lookahead - }); -} -function untilTokenToRegex(until) { - return withCardinality(`${WILDCARD}*?${abstractElementToRegex(until.terminal)}`, { - cardinality: until.cardinality, - lookahead: until.lookahead - }); -} -function negateTokenToRegex(negate2) { - return withCardinality(`(?!${abstractElementToRegex(negate2.terminal)})${WILDCARD}*?`, { - cardinality: negate2.cardinality, - lookahead: negate2.lookahead - }); -} -function characterRangeToRegex(range) { - if (range.right) { - return withCardinality(`[${keywordToRegex(range.left)}-${keywordToRegex(range.right)}]`, { - cardinality: range.cardinality, - lookahead: range.lookahead, - wrap: false - }); - } - return withCardinality(keywordToRegex(range.left), { - cardinality: range.cardinality, - lookahead: range.lookahead, - wrap: false - }); -} -function keywordToRegex(keyword) { - return escapeRegExp(keyword.value); -} -function withCardinality(regex, options) { - var _a; - if (options.wrap !== false || options.lookahead) { - regex = `(${(_a = options.lookahead) !== null && _a !== void 0 ? _a : ""}${regex})`; - } - if (options.cardinality) { - return `${regex}${options.cardinality}`; - } - return regex; -} - -// node_modules/langium/lib/lsp/completion/follow-element-computation.js -function findNextFeatures(featureStack, unparsedTokens) { - const context = { - stacks: featureStack, - tokens: unparsedTokens - }; - interpretTokens(context); - context.stacks.flat().forEach((feature) => { - feature.property = void 0; - }); - const nextStacks = findNextFeatureStacks(context.stacks); - return nextStacks.map((e) => e[e.length - 1]); -} -function findNextFeaturesInternal(options) { - const { next, cardinalities, visited, plus: plus2 } = options; - const features = []; - const feature = next.feature; - if (visited.has(feature)) { - return []; - } else { - visited.add(feature); - } - let parent; - let item = feature; - while (item.$container) { - if (isGroup(item.$container)) { - parent = item.$container; - break; - } else if (isAbstractElement(item.$container)) { - item = item.$container; - } else { - break; - } - } - if (isArrayCardinality(item.cardinality)) { - const repeatingFeatures = findFirstFeaturesInternal({ - next: { - feature: item, - type: next.type - }, - cardinalities, - visited, - plus: plus2 - }); - for (const repeatingFeature of repeatingFeatures) { - plus2.add(repeatingFeature.feature); - } - features.push(...repeatingFeatures); - } - if (parent) { - const ownIndex = parent.elements.indexOf(item); - if (ownIndex !== void 0 && ownIndex < parent.elements.length - 1) { - features.push(...findNextFeaturesInGroup({ - feature: parent, - type: next.type - }, ownIndex + 1, cardinalities, visited, plus2)); - } - if (features.every((e) => isOptionalCardinality(e.feature.cardinality, e.feature) || isOptionalCardinality(cardinalities.get(e.feature)) || plus2.has(e.feature))) { - features.push(...findNextFeaturesInternal({ - next: { - feature: parent, - type: next.type - }, - cardinalities, - visited, - plus: plus2 - })); - } - } - return features; -} -function findFirstFeatures(next) { - if (isAstNode(next)) { - next = { feature: next }; - } - return findFirstFeaturesInternal({ next, cardinalities: /* @__PURE__ */ new Map(), visited: /* @__PURE__ */ new Set(), plus: /* @__PURE__ */ new Set() }); -} -function findFirstFeaturesInternal(options) { - var _a, _b, _c; - const { next, cardinalities, visited, plus: plus2 } = options; - if (next === void 0) { - return []; - } - const { feature, type } = next; - if (isGroup(feature)) { - if (visited.has(feature)) { - return []; - } else { - visited.add(feature); - } - } - if (isGroup(feature)) { - return findNextFeaturesInGroup(next, 0, cardinalities, visited, plus2).map((e) => modifyCardinality(e, feature.cardinality, cardinalities)); - } else if (isAlternatives(feature) || isUnorderedGroup(feature)) { - return feature.elements.flatMap((e) => findFirstFeaturesInternal({ - next: { - feature: e, - type, - property: next.property - }, - cardinalities, - visited, - plus: plus2 - })).map((e) => modifyCardinality(e, feature.cardinality, cardinalities)); - } else if (isAssignment(feature)) { - const assignmentNext = { - feature: feature.terminal, - type, - property: (_a = next.property) !== null && _a !== void 0 ? _a : feature.feature - }; - return findFirstFeaturesInternal({ next: assignmentNext, cardinalities, visited, plus: plus2 }).map((e) => modifyCardinality(e, feature.cardinality, cardinalities)); - } else if (isAction(feature)) { - return findNextFeaturesInternal({ - next: { - feature, - type: getTypeName(feature), - property: (_b = next.property) !== null && _b !== void 0 ? _b : feature.feature - }, - cardinalities, - visited, - plus: plus2 - }); - } else if (isRuleCall(feature) && isParserRule(feature.rule.ref)) { - const rule = feature.rule.ref; - const ruleCallNext = { - feature: rule.definition, - type: rule.fragment || rule.dataType ? void 0 : (_c = getExplicitRuleType(rule)) !== null && _c !== void 0 ? _c : rule.name, - property: next.property - }; - return findFirstFeaturesInternal({ next: ruleCallNext, cardinalities, visited, plus: plus2 }).map((e) => modifyCardinality(e, feature.cardinality, cardinalities)); - } else { - return [next]; - } -} -function modifyCardinality(next, cardinality, cardinalities) { - cardinalities.set(next.feature, cardinality); - return next; -} -function findNextFeaturesInGroup(next, index, cardinalities, visited, plus2) { - var _a; - const features = []; - let firstFeature; - while (index < next.feature.elements.length) { - const feature = next.feature.elements[index++]; - firstFeature = { - feature, - type: next.type - }; - features.push(...findFirstFeaturesInternal({ - next: firstFeature, - cardinalities, - visited, - plus: plus2 - })); - if (!isOptionalCardinality((_a = firstFeature.feature.cardinality) !== null && _a !== void 0 ? _a : cardinalities.get(firstFeature.feature), firstFeature.feature)) { - break; - } - } - return features; -} -function interpretTokens(context) { - for (const token of context.tokens) { - const nextFeatureStacks = findNextFeatureStacks(context.stacks, token); - context.stacks = nextFeatureStacks; - } -} -function findNextFeatureStacks(stacks, token) { - const newStacks = []; - for (const stack of stacks) { - newStacks.push(...interpretStackToken(stack, token)); - } - return newStacks; -} -function interpretStackToken(stack, token) { - const cardinalities = /* @__PURE__ */ new Map(); - const plus2 = new Set(stack.map((e) => e.feature).filter(isPlusFeature)); - const newStacks = []; - while (stack.length > 0) { - const top = stack.pop(); - const allNextFeatures = findNextFeaturesInternal({ - next: top, - cardinalities, - plus: plus2, - visited: /* @__PURE__ */ new Set() - }).filter((next) => token ? featureMatches(next.feature, token) : true); - for (const nextFeature of allNextFeatures) { - newStacks.push([...stack, nextFeature]); - } - if (!allNextFeatures.every((e) => isOptionalCardinality(e.feature.cardinality, e.feature) || isOptionalCardinality(cardinalities.get(e.feature)))) { - break; - } - } - return newStacks; -} -function isPlusFeature(feature) { - if (feature.cardinality === "+") { - return true; - } - const assignment = getContainerOfType(feature, isAssignment); - if (assignment && assignment.cardinality === "+") { - return true; - } - return false; -} -function featureMatches(feature, token) { - if (isKeyword(feature)) { - const content = feature.value; - return content === token.image; - } else if (isRuleCall(feature)) { - return ruleMatches(feature.rule.ref, token); - } else if (isCrossReference(feature)) { - const crossRefTerminal = getCrossReferenceTerminal(feature); - if (crossRefTerminal) { - return featureMatches(crossRefTerminal, token); - } - } - return false; -} -function ruleMatches(rule, token) { - if (isParserRule(rule)) { - const ruleFeatures = findFirstFeatures(rule.definition); - return ruleFeatures.some((e) => featureMatches(e.feature, token)); - } else if (isTerminalRule(rule)) { - return terminalRegex(rule).test(token.image); - } else { - return false; - } -} - -// node_modules/langium/lib/lsp/completion/completion-provider.js -function mergeCompletionProviderOptions(options) { - const triggerCharacters = Array.from(new Set(options.flatMap((option2) => { - var _a; - return (_a = option2 === null || option2 === void 0 ? void 0 : option2.triggerCharacters) !== null && _a !== void 0 ? _a : []; - }))); - const allCommitCharacters = Array.from(new Set(options.flatMap((option2) => { - var _a; - return (_a = option2 === null || option2 === void 0 ? void 0 : option2.allCommitCharacters) !== null && _a !== void 0 ? _a : []; - }))); - return { - triggerCharacters: triggerCharacters.length > 0 ? triggerCharacters : void 0, - allCommitCharacters: allCommitCharacters.length > 0 ? allCommitCharacters : void 0 - }; -} -var DefaultCompletionProvider = class { - constructor(services) { - this.scopeProvider = services.references.ScopeProvider; - this.grammar = services.Grammar; - this.completionParser = services.parser.CompletionParser; - this.nameProvider = services.references.NameProvider; - this.lexer = services.parser.Lexer; - this.nodeKindProvider = services.shared.lsp.NodeKindProvider; - this.fuzzyMatcher = services.shared.lsp.FuzzyMatcher; - this.grammarConfig = services.parser.GrammarConfig; - this.astReflection = services.shared.AstReflection; - } - async getCompletion(document, params) { - const items = []; - const contexts = this.buildContexts(document, params.position); - const acceptor = (context, value) => { - const completionItem = this.fillCompletionItem(context, value); - if (completionItem) { - items.push(completionItem); - } - }; - const distinctionFunction = (element) => { - if (isKeyword(element.feature)) { - return element.feature.value; - } else { - return element.feature; - } - }; - const completedFeatures = []; - for (const context of contexts) { - await Promise.all(stream(context.features).distinct(distinctionFunction).exclude(completedFeatures).map((e) => this.completionFor(context, e, acceptor))); - completedFeatures.push(...context.features); - if (!this.continueCompletion(items)) { - break; - } - } - return import_vscode_languageserver.CompletionList.create(this.deduplicateItems(items), true); - } - /** - * The completion algorithm could yield the same reference/keyword multiple times. - * - * This methods deduplicates these items afterwards before returning to the client. - * Unique items are identified as a combination of `kind`, `label` and `detail`. - */ - deduplicateItems(items) { - return stream(items).distinct((item) => `${item.kind}_${item.label}_${item.detail}`).toArray(); - } - findFeaturesAt(document, offset) { - const text = document.getText({ - start: import_vscode_languageserver.Position.create(0, 0), - end: document.positionAt(offset) - }); - const parserResult = this.completionParser.parse(text); - const tokens = parserResult.tokens; - if (parserResult.tokenIndex === 0) { - const parserRule = getEntryRule(this.grammar); - const firstFeatures = findFirstFeatures({ - feature: parserRule.definition, - type: getExplicitRuleType(parserRule) - }); - if (tokens.length > 0) { - tokens.shift(); - return findNextFeatures(firstFeatures.map((e) => [e]), tokens); - } else { - return firstFeatures; - } - } - const leftoverTokens = [...tokens].splice(parserResult.tokenIndex); - const features = findNextFeatures([parserResult.elementStack.map((feature) => ({ feature }))], leftoverTokens); - return features; - } - *buildContexts(document, position) { - var _a, _b; - const cst = document.parseResult.value.$cstNode; - if (!cst) { - return; - } - const textDocument = document.textDocument; - const text = textDocument.getText(); - const offset = textDocument.offsetAt(position); - const partialContext = { - document, - textDocument, - offset, - position - }; - const dataTypeRuleOffsets = this.findDataTypeRuleStart(cst, offset); - if (dataTypeRuleOffsets) { - const [ruleStart, ruleEnd] = dataTypeRuleOffsets; - const parentNode = (_a = findLeafNodeBeforeOffset(cst, ruleStart)) === null || _a === void 0 ? void 0 : _a.astNode; - yield Object.assign(Object.assign({}, partialContext), { node: parentNode, tokenOffset: ruleStart, tokenEndOffset: ruleEnd, features: this.findFeaturesAt(textDocument, ruleStart) }); - } - const { nextTokenStart, nextTokenEnd, previousTokenStart, previousTokenEnd } = this.backtrackToAnyToken(text, offset); - let astNodeOffset = nextTokenStart; - if (offset <= nextTokenStart && previousTokenStart !== void 0) { - astNodeOffset = previousTokenStart; - } - const astNode = (_b = findLeafNodeBeforeOffset(cst, astNodeOffset)) === null || _b === void 0 ? void 0 : _b.astNode; - let performNextCompletion = true; - if (previousTokenStart !== void 0 && previousTokenEnd !== void 0 && previousTokenEnd === offset) { - yield Object.assign(Object.assign({}, partialContext), { node: astNode, tokenOffset: previousTokenStart, tokenEndOffset: previousTokenEnd, features: this.findFeaturesAt(textDocument, previousTokenStart) }); - performNextCompletion = this.performNextTokenCompletion(document, text.substring(previousTokenStart, previousTokenEnd), previousTokenStart, previousTokenEnd); - if (performNextCompletion) { - yield Object.assign(Object.assign({}, partialContext), { node: astNode, tokenOffset: previousTokenEnd, tokenEndOffset: previousTokenEnd, features: this.findFeaturesAt(textDocument, previousTokenEnd) }); - } - } - if (!astNode) { - const parserRule = getEntryRule(this.grammar); - if (!parserRule) { - throw new Error("Missing entry parser rule"); - } - yield Object.assign(Object.assign({}, partialContext), { tokenOffset: nextTokenStart, tokenEndOffset: nextTokenEnd, features: findFirstFeatures(parserRule.definition) }); - } else if (performNextCompletion) { - yield Object.assign(Object.assign({}, partialContext), { node: astNode, tokenOffset: nextTokenStart, tokenEndOffset: nextTokenEnd, features: this.findFeaturesAt(textDocument, nextTokenStart) }); - } - } - performNextTokenCompletion(document, text, _offset, _end) { - return new RegExp("\\P{L}$", "u").test(text); - } - findDataTypeRuleStart(cst, offset) { - var _a, _b; - let containerNode = findDeclarationNodeAtOffset(cst, offset, this.grammarConfig.nameRegexp); - let isDataTypeNode2 = Boolean((_a = getContainerOfType(containerNode === null || containerNode === void 0 ? void 0 : containerNode.grammarSource, isParserRule)) === null || _a === void 0 ? void 0 : _a.dataType); - if (isDataTypeNode2) { - while (isDataTypeNode2) { - containerNode = containerNode === null || containerNode === void 0 ? void 0 : containerNode.container; - isDataTypeNode2 = Boolean((_b = getContainerOfType(containerNode === null || containerNode === void 0 ? void 0 : containerNode.grammarSource, isParserRule)) === null || _b === void 0 ? void 0 : _b.dataType); - } - if (containerNode) { - return [containerNode.offset, containerNode.end]; - } - } - return void 0; - } - /** - * Indicates whether the completion should continue to process the next completion context. - * - * The default implementation continues the completion only if there are currently no proposed completion items. - */ - continueCompletion(items) { - return items.length === 0; - } - /** - * This method returns two sets of token offset information. - * - * The `nextToken*` offsets are related to the token at the cursor position. - * If there is none, both offsets are simply set to `offset`. - * - * The `previousToken*` offsets are related to the last token before the current token at the cursor position. - * They are `undefined`, if there is no token before the cursor position. - */ - backtrackToAnyToken(text, offset) { - const tokens = this.lexer.tokenize(text).tokens; - if (tokens.length === 0) { - return { - nextTokenStart: offset, - nextTokenEnd: offset - }; - } - let previousToken; - for (const token of tokens) { - if (token.startOffset >= offset) { - return { - nextTokenStart: offset, - nextTokenEnd: offset, - previousTokenStart: previousToken ? previousToken.startOffset : void 0, - previousTokenEnd: previousToken ? previousToken.endOffset + 1 : void 0 - }; - } - if (token.endOffset >= offset) { - return { - nextTokenStart: token.startOffset, - nextTokenEnd: token.endOffset + 1, - previousTokenStart: previousToken ? previousToken.startOffset : void 0, - previousTokenEnd: previousToken ? previousToken.endOffset + 1 : void 0 - }; - } - previousToken = token; - } - return { - nextTokenStart: offset, - nextTokenEnd: offset, - previousTokenStart: previousToken ? previousToken.startOffset : void 0, - previousTokenEnd: previousToken ? previousToken.endOffset + 1 : void 0 - }; - } - completionFor(context, next, acceptor) { - if (isKeyword(next.feature)) { - return this.completionForKeyword(context, next.feature, acceptor); - } else if (isCrossReference(next.feature) && context.node) { - return this.completionForCrossReference(context, next, acceptor); - } - } - completionForCrossReference(context, next, acceptor) { - const assignment = getContainerOfType(next.feature, isAssignment); - let node = context.node; - if (assignment && node) { - if (next.type) { - node = { - $type: next.type, - $container: node, - $containerProperty: next.property - }; - assignMandatoryProperties(this.astReflection, node); - } - const refInfo = { - reference: { - $refText: "" - }, - container: node, - property: assignment.feature - }; - try { - this.getReferenceCandidates(refInfo, context).forEach((c) => acceptor(context, this.createReferenceCompletionItem(c))); - } catch (err) { - console.error(err); - } - } - } - /** - * Override this method to change how the stream of candidates is determined for a reference. - * This way completion-specific modifications and refinements can be added to the proposals computation - * beyond the rules being implemented in the scope provider, e.g. filtering. - * - * @param refInfo Information about the reference for which the candidates are requested. - * @param _context Information about the completion request including document, cursor position, token under cursor, etc. - * @returns A stream of all elements being valid for the given reference. - */ - getReferenceCandidates(refInfo, _context) { - return this.scopeProvider.getScope(refInfo).getAllElements(); - } - /** - * Override this method to change how reference completion items are created. - * To change the `kind` of a completion item, override the `NodeKindProvider` service instead. - * - * @param nodeDescription The description of a reference candidate - * @returns A partial completion item - */ - createReferenceCompletionItem(nodeDescription) { - return { - nodeDescription, - kind: this.nodeKindProvider.getCompletionItemKind(nodeDescription), - detail: nodeDescription.type, - sortText: "0" - }; - } - completionForKeyword(context, keyword, acceptor) { - if (!this.filterKeyword(context, keyword)) { - return; - } - acceptor(context, { - label: keyword.value, - kind: import_vscode_languageserver.CompletionItemKind.Keyword, - detail: "Keyword", - sortText: "1" - }); - } - filterKeyword(context, keyword) { - return new RegExp("\\p{L}", "u").test(keyword.value); - } - fillCompletionItem(context, item) { - var _a, _b; - let label; - if (typeof item.label === "string") { - label = item.label; - } else if ("node" in item) { - const name = this.nameProvider.getName(item.node); - if (!name) { - return void 0; - } - label = name; - } else if ("nodeDescription" in item) { - label = item.nodeDescription.name; - } else { - return void 0; - } - let insertText; - if (typeof ((_a = item.textEdit) === null || _a === void 0 ? void 0 : _a.newText) === "string") { - insertText = item.textEdit.newText; - } else if (typeof item.insertText === "string") { - insertText = item.insertText; - } else { - insertText = label; - } - const textEdit = (_b = item.textEdit) !== null && _b !== void 0 ? _b : this.buildCompletionTextEdit(context, label, insertText); - if (!textEdit) { - return void 0; - } - const completionItem = { - additionalTextEdits: item.additionalTextEdits, - command: item.command, - commitCharacters: item.commitCharacters, - data: item.data, - detail: item.detail, - documentation: item.documentation, - filterText: item.filterText, - insertText: item.insertText, - insertTextFormat: item.insertTextFormat, - insertTextMode: item.insertTextMode, - kind: item.kind, - labelDetails: item.labelDetails, - preselect: item.preselect, - sortText: item.sortText, - tags: item.tags, - textEditText: item.textEditText, - textEdit, - label - }; - return completionItem; - } - buildCompletionTextEdit(context, label, newText) { - const content = context.textDocument.getText(); - const identifier = content.substring(context.tokenOffset, context.offset); - if (this.fuzzyMatcher.match(identifier, label)) { - const start = context.textDocument.positionAt(context.tokenOffset); - const end = context.position; - return { - newText, - range: { - start, - end - } - }; - } else { - return void 0; - } - } -}; - -// node_modules/langium/lib/lsp/call-hierarchy-provider.js -var import_vscode_languageserver2 = __toESM(require_main4(), 1); - -// node_modules/vscode-uri/lib/esm/index.mjs -var LIB; -(() => { - "use strict"; - var t = { 470: (t2) => { - function e2(t3) { - if ("string" != typeof t3) - throw new TypeError("Path must be a string. Received " + JSON.stringify(t3)); - } - function r2(t3, e3) { - for (var r3, n3 = "", i = 0, o = -1, s = 0, h = 0; h <= t3.length; ++h) { - if (h < t3.length) - r3 = t3.charCodeAt(h); - else { - if (47 === r3) - break; - r3 = 47; - } - if (47 === r3) { - if (o === h - 1 || 1 === s) - ; - else if (o !== h - 1 && 2 === s) { - if (n3.length < 2 || 2 !== i || 46 !== n3.charCodeAt(n3.length - 1) || 46 !== n3.charCodeAt(n3.length - 2)) { - if (n3.length > 2) { - var a2 = n3.lastIndexOf("/"); - if (a2 !== n3.length - 1) { - -1 === a2 ? (n3 = "", i = 0) : i = (n3 = n3.slice(0, a2)).length - 1 - n3.lastIndexOf("/"), o = h, s = 0; - continue; - } - } else if (2 === n3.length || 1 === n3.length) { - n3 = "", i = 0, o = h, s = 0; - continue; - } - } - e3 && (n3.length > 0 ? n3 += "/.." : n3 = "..", i = 2); - } else - n3.length > 0 ? n3 += "/" + t3.slice(o + 1, h) : n3 = t3.slice(o + 1, h), i = h - o - 1; - o = h, s = 0; - } else - 46 === r3 && -1 !== s ? ++s : s = -1; - } - return n3; - } - var n2 = { resolve: function() { - for (var t3, n3 = "", i = false, o = arguments.length - 1; o >= -1 && !i; o--) { - var s; - o >= 0 ? s = arguments[o] : (void 0 === t3 && (t3 = process.cwd()), s = t3), e2(s), 0 !== s.length && (n3 = s + "/" + n3, i = 47 === s.charCodeAt(0)); - } - return n3 = r2(n3, !i), i ? n3.length > 0 ? "/" + n3 : "/" : n3.length > 0 ? n3 : "."; - }, normalize: function(t3) { - if (e2(t3), 0 === t3.length) - return "."; - var n3 = 47 === t3.charCodeAt(0), i = 47 === t3.charCodeAt(t3.length - 1); - return 0 !== (t3 = r2(t3, !n3)).length || n3 || (t3 = "."), t3.length > 0 && i && (t3 += "/"), n3 ? "/" + t3 : t3; - }, isAbsolute: function(t3) { - return e2(t3), t3.length > 0 && 47 === t3.charCodeAt(0); - }, join: function() { - if (0 === arguments.length) - return "."; - for (var t3, r3 = 0; r3 < arguments.length; ++r3) { - var i = arguments[r3]; - e2(i), i.length > 0 && (void 0 === t3 ? t3 = i : t3 += "/" + i); - } - return void 0 === t3 ? "." : n2.normalize(t3); - }, relative: function(t3, r3) { - if (e2(t3), e2(r3), t3 === r3) - return ""; - if ((t3 = n2.resolve(t3)) === (r3 = n2.resolve(r3))) - return ""; - for (var i = 1; i < t3.length && 47 === t3.charCodeAt(i); ++i) - ; - for (var o = t3.length, s = o - i, h = 1; h < r3.length && 47 === r3.charCodeAt(h); ++h) - ; - for (var a2 = r3.length - h, c = s < a2 ? s : a2, f = -1, u = 0; u <= c; ++u) { - if (u === c) { - if (a2 > c) { - if (47 === r3.charCodeAt(h + u)) - return r3.slice(h + u + 1); - if (0 === u) - return r3.slice(h + u); - } else - s > c && (47 === t3.charCodeAt(i + u) ? f = u : 0 === u && (f = 0)); - break; - } - var l = t3.charCodeAt(i + u); - if (l !== r3.charCodeAt(h + u)) - break; - 47 === l && (f = u); - } - var g = ""; - for (u = i + f + 1; u <= o; ++u) - u !== o && 47 !== t3.charCodeAt(u) || (0 === g.length ? g += ".." : g += "/.."); - return g.length > 0 ? g + r3.slice(h + f) : (h += f, 47 === r3.charCodeAt(h) && ++h, r3.slice(h)); - }, _makeLong: function(t3) { - return t3; - }, dirname: function(t3) { - if (e2(t3), 0 === t3.length) - return "."; - for (var r3 = t3.charCodeAt(0), n3 = 47 === r3, i = -1, o = true, s = t3.length - 1; s >= 1; --s) - if (47 === (r3 = t3.charCodeAt(s))) { - if (!o) { - i = s; - break; - } - } else - o = false; - return -1 === i ? n3 ? "/" : "." : n3 && 1 === i ? "//" : t3.slice(0, i); - }, basename: function(t3, r3) { - if (void 0 !== r3 && "string" != typeof r3) - throw new TypeError('"ext" argument must be a string'); - e2(t3); - var n3, i = 0, o = -1, s = true; - if (void 0 !== r3 && r3.length > 0 && r3.length <= t3.length) { - if (r3.length === t3.length && r3 === t3) - return ""; - var h = r3.length - 1, a2 = -1; - for (n3 = t3.length - 1; n3 >= 0; --n3) { - var c = t3.charCodeAt(n3); - if (47 === c) { - if (!s) { - i = n3 + 1; - break; - } - } else - -1 === a2 && (s = false, a2 = n3 + 1), h >= 0 && (c === r3.charCodeAt(h) ? -1 == --h && (o = n3) : (h = -1, o = a2)); - } - return i === o ? o = a2 : -1 === o && (o = t3.length), t3.slice(i, o); - } - for (n3 = t3.length - 1; n3 >= 0; --n3) - if (47 === t3.charCodeAt(n3)) { - if (!s) { - i = n3 + 1; - break; - } - } else - -1 === o && (s = false, o = n3 + 1); - return -1 === o ? "" : t3.slice(i, o); - }, extname: function(t3) { - e2(t3); - for (var r3 = -1, n3 = 0, i = -1, o = true, s = 0, h = t3.length - 1; h >= 0; --h) { - var a2 = t3.charCodeAt(h); - if (47 !== a2) - -1 === i && (o = false, i = h + 1), 46 === a2 ? -1 === r3 ? r3 = h : 1 !== s && (s = 1) : -1 !== r3 && (s = -1); - else if (!o) { - n3 = h + 1; - break; - } - } - return -1 === r3 || -1 === i || 0 === s || 1 === s && r3 === i - 1 && r3 === n3 + 1 ? "" : t3.slice(r3, i); - }, format: function(t3) { - if (null === t3 || "object" != typeof t3) - throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t3); - return function(t4, e3) { - var r3 = e3.dir || e3.root, n3 = e3.base || (e3.name || "") + (e3.ext || ""); - return r3 ? r3 === e3.root ? r3 + n3 : r3 + "/" + n3 : n3; - }(0, t3); - }, parse: function(t3) { - e2(t3); - var r3 = { root: "", dir: "", base: "", ext: "", name: "" }; - if (0 === t3.length) - return r3; - var n3, i = t3.charCodeAt(0), o = 47 === i; - o ? (r3.root = "/", n3 = 1) : n3 = 0; - for (var s = -1, h = 0, a2 = -1, c = true, f = t3.length - 1, u = 0; f >= n3; --f) - if (47 !== (i = t3.charCodeAt(f))) - -1 === a2 && (c = false, a2 = f + 1), 46 === i ? -1 === s ? s = f : 1 !== u && (u = 1) : -1 !== s && (u = -1); - else if (!c) { - h = f + 1; - break; - } - return -1 === s || -1 === a2 || 0 === u || 1 === u && s === a2 - 1 && s === h + 1 ? -1 !== a2 && (r3.base = r3.name = 0 === h && o ? t3.slice(1, a2) : t3.slice(h, a2)) : (0 === h && o ? (r3.name = t3.slice(1, s), r3.base = t3.slice(1, a2)) : (r3.name = t3.slice(h, s), r3.base = t3.slice(h, a2)), r3.ext = t3.slice(s, a2)), h > 0 ? r3.dir = t3.slice(0, h - 1) : o && (r3.dir = "/"), r3; - }, sep: "/", delimiter: ":", win32: null, posix: null }; - n2.posix = n2, t2.exports = n2; - } }, e = {}; - function r(n2) { - var i = e[n2]; - if (void 0 !== i) - return i.exports; - var o = e[n2] = { exports: {} }; - return t[n2](o, o.exports, r), o.exports; - } - r.d = (t2, e2) => { - for (var n2 in e2) - r.o(e2, n2) && !r.o(t2, n2) && Object.defineProperty(t2, n2, { enumerable: true, get: e2[n2] }); - }, r.o = (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r.r = (t2) => { - "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); - }; - var n = {}; - (() => { - let t2; - if (r.r(n), r.d(n, { URI: () => f, Utils: () => P }), "object" == typeof process) - t2 = "win32" === process.platform; - else if ("object" == typeof navigator) { - let e3 = navigator.userAgent; - t2 = e3.indexOf("Windows") >= 0; - } - const e2 = /^\w[\w\d+.-]*$/, i = /^\//, o = /^\/\//; - function s(t3, r2) { - if (!t3.scheme && r2) - throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t3.authority}", path: "${t3.path}", query: "${t3.query}", fragment: "${t3.fragment}"}`); - if (t3.scheme && !e2.test(t3.scheme)) - throw new Error("[UriError]: Scheme contains illegal characters."); - if (t3.path) { - if (t3.authority) { - if (!i.test(t3.path)) - throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); - } else if (o.test(t3.path)) - throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); - } - } - const h = "", a2 = "/", c = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; - class f { - constructor(t3, e3, r2, n2, i2, o2 = false) { - __publicField(this, "scheme"); - __publicField(this, "authority"); - __publicField(this, "path"); - __publicField(this, "query"); - __publicField(this, "fragment"); - "object" == typeof t3 ? (this.scheme = t3.scheme || h, this.authority = t3.authority || h, this.path = t3.path || h, this.query = t3.query || h, this.fragment = t3.fragment || h) : (this.scheme = /* @__PURE__ */ function(t4, e4) { - return t4 || e4 ? t4 : "file"; - }(t3, o2), this.authority = e3 || h, this.path = function(t4, e4) { - switch (t4) { - case "https": - case "http": - case "file": - e4 ? e4[0] !== a2 && (e4 = a2 + e4) : e4 = a2; - } - return e4; - }(this.scheme, r2 || h), this.query = n2 || h, this.fragment = i2 || h, s(this, o2)); - } - static isUri(t3) { - return t3 instanceof f || !!t3 && "string" == typeof t3.authority && "string" == typeof t3.fragment && "string" == typeof t3.path && "string" == typeof t3.query && "string" == typeof t3.scheme && "string" == typeof t3.fsPath && "function" == typeof t3.with && "function" == typeof t3.toString; - } - get fsPath() { - return m(this, false); - } - with(t3) { - if (!t3) - return this; - let { scheme: e3, authority: r2, path: n2, query: i2, fragment: o2 } = t3; - return void 0 === e3 ? e3 = this.scheme : null === e3 && (e3 = h), void 0 === r2 ? r2 = this.authority : null === r2 && (r2 = h), void 0 === n2 ? n2 = this.path : null === n2 && (n2 = h), void 0 === i2 ? i2 = this.query : null === i2 && (i2 = h), void 0 === o2 ? o2 = this.fragment : null === o2 && (o2 = h), e3 === this.scheme && r2 === this.authority && n2 === this.path && i2 === this.query && o2 === this.fragment ? this : new l(e3, r2, n2, i2, o2); - } - static parse(t3, e3 = false) { - const r2 = c.exec(t3); - return r2 ? new l(r2[2] || h, C(r2[4] || h), C(r2[5] || h), C(r2[7] || h), C(r2[9] || h), e3) : new l(h, h, h, h, h); - } - static file(e3) { - let r2 = h; - if (t2 && (e3 = e3.replace(/\\/g, a2)), e3[0] === a2 && e3[1] === a2) { - const t3 = e3.indexOf(a2, 2); - -1 === t3 ? (r2 = e3.substring(2), e3 = a2) : (r2 = e3.substring(2, t3), e3 = e3.substring(t3) || a2); - } - return new l("file", r2, e3, h, h); - } - static from(t3) { - const e3 = new l(t3.scheme, t3.authority, t3.path, t3.query, t3.fragment); - return s(e3, true), e3; - } - toString(t3 = false) { - return y(this, t3); - } - toJSON() { - return this; - } - static revive(t3) { - if (t3) { - if (t3 instanceof f) - return t3; - { - const e3 = new l(t3); - return e3._formatted = t3.external, e3._fsPath = t3._sep === u ? t3.fsPath : null, e3; - } - } - return t3; - } - } - const u = t2 ? 1 : void 0; - class l extends f { - constructor() { - super(...arguments); - __publicField(this, "_formatted", null); - __publicField(this, "_fsPath", null); - } - get fsPath() { - return this._fsPath || (this._fsPath = m(this, false)), this._fsPath; - } - toString(t3 = false) { - return t3 ? y(this, true) : (this._formatted || (this._formatted = y(this, false)), this._formatted); - } - toJSON() { - const t3 = { $mid: 1 }; - return this._fsPath && (t3.fsPath = this._fsPath, t3._sep = u), this._formatted && (t3.external = this._formatted), this.path && (t3.path = this.path), this.scheme && (t3.scheme = this.scheme), this.authority && (t3.authority = this.authority), this.query && (t3.query = this.query), this.fragment && (t3.fragment = this.fragment), t3; - } - } - const g = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" }; - function d(t3, e3, r2) { - let n2, i2 = -1; - for (let o2 = 0; o2 < t3.length; o2++) { - const s2 = t3.charCodeAt(o2); - if (s2 >= 97 && s2 <= 122 || s2 >= 65 && s2 <= 90 || s2 >= 48 && s2 <= 57 || 45 === s2 || 46 === s2 || 95 === s2 || 126 === s2 || e3 && 47 === s2 || r2 && 91 === s2 || r2 && 93 === s2 || r2 && 58 === s2) - -1 !== i2 && (n2 += encodeURIComponent(t3.substring(i2, o2)), i2 = -1), void 0 !== n2 && (n2 += t3.charAt(o2)); - else { - void 0 === n2 && (n2 = t3.substr(0, o2)); - const e4 = g[s2]; - void 0 !== e4 ? (-1 !== i2 && (n2 += encodeURIComponent(t3.substring(i2, o2)), i2 = -1), n2 += e4) : -1 === i2 && (i2 = o2); - } - } - return -1 !== i2 && (n2 += encodeURIComponent(t3.substring(i2))), void 0 !== n2 ? n2 : t3; - } - function p(t3) { - let e3; - for (let r2 = 0; r2 < t3.length; r2++) { - const n2 = t3.charCodeAt(r2); - 35 === n2 || 63 === n2 ? (void 0 === e3 && (e3 = t3.substr(0, r2)), e3 += g[n2]) : void 0 !== e3 && (e3 += t3[r2]); - } - return void 0 !== e3 ? e3 : t3; - } - function m(e3, r2) { - let n2; - return n2 = e3.authority && e3.path.length > 1 && "file" === e3.scheme ? `//${e3.authority}${e3.path}` : 47 === e3.path.charCodeAt(0) && (e3.path.charCodeAt(1) >= 65 && e3.path.charCodeAt(1) <= 90 || e3.path.charCodeAt(1) >= 97 && e3.path.charCodeAt(1) <= 122) && 58 === e3.path.charCodeAt(2) ? r2 ? e3.path.substr(1) : e3.path[1].toLowerCase() + e3.path.substr(2) : e3.path, t2 && (n2 = n2.replace(/\//g, "\\")), n2; - } - function y(t3, e3) { - const r2 = e3 ? p : d; - let n2 = "", { scheme: i2, authority: o2, path: s2, query: h2, fragment: c2 } = t3; - if (i2 && (n2 += i2, n2 += ":"), (o2 || "file" === i2) && (n2 += a2, n2 += a2), o2) { - let t4 = o2.indexOf("@"); - if (-1 !== t4) { - const e4 = o2.substr(0, t4); - o2 = o2.substr(t4 + 1), t4 = e4.lastIndexOf(":"), -1 === t4 ? n2 += r2(e4, false, false) : (n2 += r2(e4.substr(0, t4), false, false), n2 += ":", n2 += r2(e4.substr(t4 + 1), false, true)), n2 += "@"; - } - o2 = o2.toLowerCase(), t4 = o2.lastIndexOf(":"), -1 === t4 ? n2 += r2(o2, false, true) : (n2 += r2(o2.substr(0, t4), false, true), n2 += o2.substr(t4)); - } - if (s2) { - if (s2.length >= 3 && 47 === s2.charCodeAt(0) && 58 === s2.charCodeAt(2)) { - const t4 = s2.charCodeAt(1); - t4 >= 65 && t4 <= 90 && (s2 = `/${String.fromCharCode(t4 + 32)}:${s2.substr(3)}`); - } else if (s2.length >= 2 && 58 === s2.charCodeAt(1)) { - const t4 = s2.charCodeAt(0); - t4 >= 65 && t4 <= 90 && (s2 = `${String.fromCharCode(t4 + 32)}:${s2.substr(2)}`); - } - n2 += r2(s2, true, false); - } - return h2 && (n2 += "?", n2 += r2(h2, false, false)), c2 && (n2 += "#", n2 += e3 ? c2 : d(c2, false, false)), n2; - } - function v(t3) { - try { - return decodeURIComponent(t3); - } catch (e3) { - return t3.length > 3 ? t3.substr(0, 3) + v(t3.substr(3)) : t3; - } - } - const b = /(%[0-9A-Za-z][0-9A-Za-z])+/g; - function C(t3) { - return t3.match(b) ? t3.replace(b, (t4) => v(t4)) : t3; - } - var A2 = r(470); - const w = A2.posix || A2, x = "/"; - var P; - !function(t3) { - t3.joinPath = function(t4, ...e3) { - return t4.with({ path: w.join(t4.path, ...e3) }); - }, t3.resolvePath = function(t4, ...e3) { - let r2 = t4.path, n2 = false; - r2[0] !== x && (r2 = x + r2, n2 = true); - let i2 = w.resolve(r2, ...e3); - return n2 && i2[0] === x && !t4.authority && (i2 = i2.substring(1)), t4.with({ path: i2 }); - }, t3.dirname = function(t4) { - if (0 === t4.path.length || t4.path === x) - return t4; - let e3 = w.dirname(t4.path); - return 1 === e3.length && 46 === e3.charCodeAt(0) && (e3 = ""), t4.with({ path: e3 }); - }, t3.basename = function(t4) { - return w.basename(t4.path); - }, t3.extname = function(t4) { - return w.extname(t4.path); - }; - }(P || (P = {})); - })(), LIB = n; -})(); -var { URI, Utils } = LIB; - -// node_modules/langium/lib/utils/uri-utils.js -var UriUtils; -(function(UriUtils2) { - UriUtils2.basename = Utils.basename; - UriUtils2.dirname = Utils.dirname; - UriUtils2.extname = Utils.extname; - UriUtils2.joinPath = Utils.joinPath; - UriUtils2.resolvePath = Utils.resolvePath; - function equals(a2, b) { - return (a2 === null || a2 === void 0 ? void 0 : a2.toString()) === (b === null || b === void 0 ? void 0 : b.toString()); - } - UriUtils2.equals = equals; - function relative(from, to) { - const fromPath = typeof from === "string" ? from : from.path; - const toPath = typeof to === "string" ? to : to.path; - const fromParts = fromPath.split("/").filter((e) => e.length > 0); - const toParts = toPath.split("/").filter((e) => e.length > 0); - let i = 0; - for (; i < fromParts.length; i++) { - if (fromParts[i] !== toParts[i]) { - break; - } - } - const backPart = "../".repeat(fromParts.length - i); - const toPart = toParts.slice(i).join("/"); - return backPart + toPart; - } - UriUtils2.relative = relative; -})(UriUtils || (UriUtils = {})); - -// node_modules/langium/lib/lsp/definition-provider.js -var import_vscode_languageserver3 = __toESM(require_main4(), 1); -var DefaultDefinitionProvider = class { - constructor(services) { - this.nameProvider = services.references.NameProvider; - this.references = services.references.References; - this.grammarConfig = services.parser.GrammarConfig; - } - getDefinition(document, params) { - const rootNode = document.parseResult.value; - if (rootNode.$cstNode) { - const cst = rootNode.$cstNode; - const sourceCstNode = findDeclarationNodeAtOffset(cst, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp); - if (sourceCstNode) { - return this.collectLocationLinks(sourceCstNode, params); - } - } - return void 0; - } - collectLocationLinks(sourceCstNode, _params) { - var _a; - const goToLink = this.findLink(sourceCstNode); - if (goToLink) { - return [import_vscode_languageserver3.LocationLink.create(goToLink.targetDocument.textDocument.uri, ((_a = goToLink.target.astNode.$cstNode) !== null && _a !== void 0 ? _a : goToLink.target).range, goToLink.target.range, goToLink.source.range)]; - } - return void 0; - } - findLink(source) { - const target = this.references.findDeclarationNode(source); - if (target === null || target === void 0 ? void 0 : target.astNode) { - const targetDocument = getDocument(target.astNode); - if (target && targetDocument) { - return { source, target, targetDocument }; - } - } - return void 0; - } -}; - -// node_modules/langium/lib/lsp/default-lsp-module.js -var import_vscode_languageserver10 = __toESM(require_main4(), 1); - -// node_modules/langium/lib/languages/grammar-config.js -function createGrammarConfig(services) { - const rules = []; - const grammar = services.Grammar; - for (const rule of grammar.rules) { - if (isTerminalRule(rule) && isCommentTerminal(rule) && isMultilineComment(terminalRegex(rule))) { - rules.push(rule.name); - } - } - return { - multilineCommentRules: rules, - nameRegexp: DefaultNameRegexp - }; -} - -// node_modules/lodash-es/_freeGlobal.js -var freeGlobal = typeof global == "object" && global && global.Object === Object && global; -var freeGlobal_default = freeGlobal; - -// node_modules/lodash-es/_root.js -var freeSelf = typeof self == "object" && self && self.Object === Object && self; -var root = freeGlobal_default || freeSelf || Function("return this")(); -var root_default = root; - -// node_modules/lodash-es/_Symbol.js -var Symbol2 = root_default.Symbol; -var Symbol_default = Symbol2; - -// node_modules/lodash-es/_getRawTag.js -var objectProto = Object.prototype; -var hasOwnProperty = objectProto.hasOwnProperty; -var nativeObjectToString = objectProto.toString; -var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0; -function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; - try { - value[symToStringTag] = void 0; - var unmasked = true; - } catch (e) { - } - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; -} -var getRawTag_default = getRawTag; - -// node_modules/lodash-es/_objectToString.js -var objectProto2 = Object.prototype; -var nativeObjectToString2 = objectProto2.toString; -function objectToString(value) { - return nativeObjectToString2.call(value); -} -var objectToString_default = objectToString; - -// node_modules/lodash-es/_baseGetTag.js -var nullTag = "[object Null]"; -var undefinedTag = "[object Undefined]"; -var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0; -function baseGetTag(value) { - if (value == null) { - return value === void 0 ? undefinedTag : nullTag; - } - return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value); -} -var baseGetTag_default = baseGetTag; - -// node_modules/lodash-es/isObjectLike.js -function isObjectLike(value) { - return value != null && typeof value == "object"; -} -var isObjectLike_default = isObjectLike; - -// node_modules/lodash-es/isSymbol.js -var symbolTag = "[object Symbol]"; -function isSymbol(value) { - return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag; -} -var isSymbol_default = isSymbol; - -// node_modules/lodash-es/_arrayMap.js -function arrayMap(array, iteratee) { - var index = -1, length = array == null ? 0 : array.length, result = Array(length); - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; -} -var arrayMap_default = arrayMap; - -// node_modules/lodash-es/isArray.js -var isArray = Array.isArray; -var isArray_default = isArray; - -// node_modules/lodash-es/_baseToString.js -var INFINITY = 1 / 0; -var symbolProto = Symbol_default ? Symbol_default.prototype : void 0; -var symbolToString = symbolProto ? symbolProto.toString : void 0; -function baseToString(value) { - if (typeof value == "string") { - return value; - } - if (isArray_default(value)) { - return arrayMap_default(value, baseToString) + ""; - } - if (isSymbol_default(value)) { - return symbolToString ? symbolToString.call(value) : ""; - } - var result = value + ""; - return result == "0" && 1 / value == -INFINITY ? "-0" : result; -} -var baseToString_default = baseToString; - -// node_modules/lodash-es/_trimmedEndIndex.js -var reWhitespace = /\s/; -function trimmedEndIndex(string) { - var index = string.length; - while (index-- && reWhitespace.test(string.charAt(index))) { - } - return index; -} -var trimmedEndIndex_default = trimmedEndIndex; - -// node_modules/lodash-es/_baseTrim.js -var reTrimStart = /^\s+/; -function baseTrim(string) { - return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string; -} -var baseTrim_default = baseTrim; - -// node_modules/lodash-es/isObject.js -function isObject(value) { - var type = typeof value; - return value != null && (type == "object" || type == "function"); -} -var isObject_default = isObject; - -// node_modules/lodash-es/toNumber.js -var NAN = 0 / 0; -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; -var reIsBinary = /^0b[01]+$/i; -var reIsOctal = /^0o[0-7]+$/i; -var freeParseInt = parseInt; -function toNumber(value) { - if (typeof value == "number") { - return value; - } - if (isSymbol_default(value)) { - return NAN; - } - if (isObject_default(value)) { - var other = typeof value.valueOf == "function" ? value.valueOf() : value; - value = isObject_default(other) ? other + "" : other; - } - if (typeof value != "string") { - return value === 0 ? value : +value; - } - value = baseTrim_default(value); - var isBinary = reIsBinary.test(value); - return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; -} -var toNumber_default = toNumber; - -// node_modules/lodash-es/toFinite.js -var INFINITY2 = 1 / 0; -var MAX_INTEGER = 17976931348623157e292; -function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber_default(value); - if (value === INFINITY2 || value === -INFINITY2) { - var sign = value < 0 ? -1 : 1; - return sign * MAX_INTEGER; - } - return value === value ? value : 0; -} -var toFinite_default = toFinite; - -// node_modules/lodash-es/toInteger.js -function toInteger(value) { - var result = toFinite_default(value), remainder = result % 1; - return result === result ? remainder ? result - remainder : result : 0; -} -var toInteger_default = toInteger; - -// node_modules/lodash-es/identity.js -function identity(value) { - return value; -} -var identity_default = identity; - -// node_modules/lodash-es/isFunction.js -var asyncTag = "[object AsyncFunction]"; -var funcTag = "[object Function]"; -var genTag = "[object GeneratorFunction]"; -var proxyTag = "[object Proxy]"; -function isFunction(value) { - if (!isObject_default(value)) { - return false; - } - var tag = baseGetTag_default(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; -} -var isFunction_default = isFunction; - -// node_modules/lodash-es/_coreJsData.js -var coreJsData = root_default["__core-js_shared__"]; -var coreJsData_default = coreJsData; - -// node_modules/lodash-es/_isMasked.js -var maskSrcKey = function() { - var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || ""); - return uid ? "Symbol(src)_1." + uid : ""; -}(); -function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; -} -var isMasked_default = isMasked; - -// node_modules/lodash-es/_toSource.js -var funcProto = Function.prototype; -var funcToString = funcProto.toString; -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) { - } - try { - return func + ""; - } catch (e) { - } - } - return ""; -} -var toSource_default = toSource; - -// node_modules/lodash-es/_baseIsNative.js -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; -var reIsHostCtor = /^\[object .+?Constructor\]$/; -var funcProto2 = Function.prototype; -var objectProto3 = Object.prototype; -var funcToString2 = funcProto2.toString; -var hasOwnProperty2 = objectProto3.hasOwnProperty; -var reIsNative = RegExp( - "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" -); -function baseIsNative(value) { - if (!isObject_default(value) || isMasked_default(value)) { - return false; - } - var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource_default(value)); -} -var baseIsNative_default = baseIsNative; - -// node_modules/lodash-es/_getValue.js -function getValue(object, key) { - return object == null ? void 0 : object[key]; -} -var getValue_default = getValue; - -// node_modules/lodash-es/_getNative.js -function getNative(object, key) { - var value = getValue_default(object, key); - return baseIsNative_default(value) ? value : void 0; -} -var getNative_default = getNative; - -// node_modules/lodash-es/_WeakMap.js -var WeakMap = getNative_default(root_default, "WeakMap"); -var WeakMap_default = WeakMap; - -// node_modules/lodash-es/_baseCreate.js -var objectCreate = Object.create; -var baseCreate = /* @__PURE__ */ function() { - function object() { - } - return function(proto) { - if (!isObject_default(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object(); - object.prototype = void 0; - return result; - }; -}(); -var baseCreate_default = baseCreate; - -// node_modules/lodash-es/_apply.js -function apply(func, thisArg, args) { - switch (args.length) { - case 0: - return func.call(thisArg); - case 1: - return func.call(thisArg, args[0]); - case 2: - return func.call(thisArg, args[0], args[1]); - case 3: - return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); -} -var apply_default = apply; - -// node_modules/lodash-es/noop.js -function noop() { -} -var noop_default = noop; - -// node_modules/lodash-es/_copyArray.js -function copyArray(source, array) { - var index = -1, length = source.length; - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} -var copyArray_default = copyArray; - -// node_modules/lodash-es/_shortOut.js -var HOT_COUNT = 800; -var HOT_SPAN = 16; -var nativeNow = Date.now; -function shortOut(func) { - var count = 0, lastCalled = 0; - return function() { - var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(void 0, arguments); - }; -} -var shortOut_default = shortOut; - -// node_modules/lodash-es/constant.js -function constant(value) { - return function() { - return value; - }; -} -var constant_default = constant; - -// node_modules/lodash-es/_defineProperty.js -var defineProperty = function() { - try { - var func = getNative_default(Object, "defineProperty"); - func({}, "", {}); - return func; - } catch (e) { - } -}(); -var defineProperty_default = defineProperty; - -// node_modules/lodash-es/_baseSetToString.js -var baseSetToString = !defineProperty_default ? identity_default : function(func, string) { - return defineProperty_default(func, "toString", { - "configurable": true, - "enumerable": false, - "value": constant_default(string), - "writable": true - }); -}; -var baseSetToString_default = baseSetToString; - -// node_modules/lodash-es/_setToString.js -var setToString = shortOut_default(baseSetToString_default); -var setToString_default = setToString; - -// node_modules/lodash-es/_arrayEach.js -function arrayEach(array, iteratee) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} -var arrayEach_default = arrayEach; - -// node_modules/lodash-es/_baseFindIndex.js -function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, index = fromIndex + (fromRight ? 1 : -1); - while (fromRight ? index-- : ++index < length) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; -} -var baseFindIndex_default = baseFindIndex; - -// node_modules/lodash-es/_baseIsNaN.js -function baseIsNaN(value) { - return value !== value; -} -var baseIsNaN_default = baseIsNaN; - -// node_modules/lodash-es/_strictIndexOf.js -function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, length = array.length; - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; -} -var strictIndexOf_default = strictIndexOf; - -// node_modules/lodash-es/_baseIndexOf.js -function baseIndexOf(array, value, fromIndex) { - return value === value ? strictIndexOf_default(array, value, fromIndex) : baseFindIndex_default(array, baseIsNaN_default, fromIndex); -} -var baseIndexOf_default = baseIndexOf; - -// node_modules/lodash-es/_arrayIncludes.js -function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf_default(array, value, 0) > -1; -} -var arrayIncludes_default = arrayIncludes; - -// node_modules/lodash-es/_isIndex.js -var MAX_SAFE_INTEGER = 9007199254740991; -var reIsUint = /^(?:0|[1-9]\d*)$/; -function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); -} -var isIndex_default = isIndex; - -// node_modules/lodash-es/_baseAssignValue.js -function baseAssignValue(object, key, value) { - if (key == "__proto__" && defineProperty_default) { - defineProperty_default(object, key, { - "configurable": true, - "enumerable": true, - "value": value, - "writable": true - }); - } else { - object[key] = value; - } -} -var baseAssignValue_default = baseAssignValue; - -// node_modules/lodash-es/eq.js -function eq(value, other) { - return value === other || value !== value && other !== other; -} -var eq_default = eq; - -// node_modules/lodash-es/_assignValue.js -var objectProto4 = Object.prototype; -var hasOwnProperty3 = objectProto4.hasOwnProperty; -function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) { - baseAssignValue_default(object, key, value); - } -} -var assignValue_default = assignValue; - -// node_modules/lodash-es/_copyObject.js -function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - var index = -1, length = props.length; - while (++index < length) { - var key = props[index]; - var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; - if (newValue === void 0) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue_default(object, key, newValue); - } else { - assignValue_default(object, key, newValue); - } - } - return object; -} -var copyObject_default = copyObject; - -// node_modules/lodash-es/_overRest.js -var nativeMax = Math.max; -function overRest(func, start, transform) { - start = nativeMax(start === void 0 ? func.length - 1 : start, 0); - return function() { - var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply_default(func, this, otherArgs); - }; -} -var overRest_default = overRest; - -// node_modules/lodash-es/_baseRest.js -function baseRest(func, start) { - return setToString_default(overRest_default(func, start, identity_default), func + ""); -} -var baseRest_default = baseRest; - -// node_modules/lodash-es/isLength.js -var MAX_SAFE_INTEGER2 = 9007199254740991; -function isLength(value) { - return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2; -} -var isLength_default = isLength; - -// node_modules/lodash-es/isArrayLike.js -function isArrayLike(value) { - return value != null && isLength_default(value.length) && !isFunction_default(value); -} -var isArrayLike_default = isArrayLike; - -// node_modules/lodash-es/_isIterateeCall.js -function isIterateeCall(value, index, object) { - if (!isObject_default(object)) { - return false; - } - var type = typeof index; - if (type == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type == "string" && index in object) { - return eq_default(object[index], value); - } - return false; -} -var isIterateeCall_default = isIterateeCall; - -// node_modules/lodash-es/_createAssigner.js -function createAssigner(assigner) { - return baseRest_default(function(object, sources) { - var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; - customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; - if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { - customizer = length < 3 ? void 0 : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); -} -var createAssigner_default = createAssigner; - -// node_modules/lodash-es/_isPrototype.js -var objectProto5 = Object.prototype; -function isPrototype(value) { - var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5; - return value === proto; -} -var isPrototype_default = isPrototype; - -// node_modules/lodash-es/_baseTimes.js -function baseTimes(n, iteratee) { - var index = -1, result = Array(n); - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} -var baseTimes_default = baseTimes; - -// node_modules/lodash-es/_baseIsArguments.js -var argsTag = "[object Arguments]"; -function baseIsArguments(value) { - return isObjectLike_default(value) && baseGetTag_default(value) == argsTag; -} -var baseIsArguments_default = baseIsArguments; - -// node_modules/lodash-es/isArguments.js -var objectProto6 = Object.prototype; -var hasOwnProperty4 = objectProto6.hasOwnProperty; -var propertyIsEnumerable = objectProto6.propertyIsEnumerable; -var isArguments = baseIsArguments_default(/* @__PURE__ */ function() { - return arguments; -}()) ? baseIsArguments_default : function(value) { - return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); -}; -var isArguments_default = isArguments; - -// node_modules/lodash-es/stubFalse.js -function stubFalse() { - return false; -} -var stubFalse_default = stubFalse; - -// node_modules/lodash-es/isBuffer.js -var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; -var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; -var moduleExports = freeModule && freeModule.exports === freeExports; -var Buffer2 = moduleExports ? root_default.Buffer : void 0; -var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; -var isBuffer = nativeIsBuffer || stubFalse_default; -var isBuffer_default = isBuffer; - -// node_modules/lodash-es/_baseIsTypedArray.js -var argsTag2 = "[object Arguments]"; -var arrayTag = "[object Array]"; -var boolTag = "[object Boolean]"; -var dateTag = "[object Date]"; -var errorTag = "[object Error]"; -var funcTag2 = "[object Function]"; -var mapTag = "[object Map]"; -var numberTag = "[object Number]"; -var objectTag = "[object Object]"; -var regexpTag = "[object RegExp]"; -var setTag = "[object Set]"; -var stringTag = "[object String]"; -var weakMapTag = "[object WeakMap]"; -var arrayBufferTag = "[object ArrayBuffer]"; -var dataViewTag = "[object DataView]"; -var float32Tag = "[object Float32Array]"; -var float64Tag = "[object Float64Array]"; -var int8Tag = "[object Int8Array]"; -var int16Tag = "[object Int16Array]"; -var int32Tag = "[object Int32Array]"; -var uint8Tag = "[object Uint8Array]"; -var uint8ClampedTag = "[object Uint8ClampedArray]"; -var uint16Tag = "[object Uint16Array]"; -var uint32Tag = "[object Uint32Array]"; -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; -function baseIsTypedArray(value) { - return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)]; -} -var baseIsTypedArray_default = baseIsTypedArray; - -// node_modules/lodash-es/_baseUnary.js -function baseUnary(func) { - return function(value) { - return func(value); - }; -} -var baseUnary_default = baseUnary; - -// node_modules/lodash-es/_nodeUtil.js -var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports; -var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module; -var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2; -var freeProcess = moduleExports2 && freeGlobal_default.process; -var nodeUtil = function() { - try { - var types = freeModule2 && freeModule2.require && freeModule2.require("util").types; - if (types) { - return types; - } - return freeProcess && freeProcess.binding && freeProcess.binding("util"); - } catch (e) { - } -}(); -var nodeUtil_default = nodeUtil; - -// node_modules/lodash-es/isTypedArray.js -var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray; -var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default; -var isTypedArray_default = isTypedArray; - -// node_modules/lodash-es/_arrayLikeKeys.js -var objectProto7 = Object.prototype; -var hasOwnProperty5 = objectProto7.hasOwnProperty; -function arrayLikeKeys(value, inherited) { - var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType2 = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length; - for (var key in value) { - if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. - (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. - isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. - isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. - isIndex_default(key, length)))) { - result.push(key); - } - } - return result; -} -var arrayLikeKeys_default = arrayLikeKeys; - -// node_modules/lodash-es/_overArg.js -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} -var overArg_default = overArg; - -// node_modules/lodash-es/_nativeKeys.js -var nativeKeys = overArg_default(Object.keys, Object); -var nativeKeys_default = nativeKeys; - -// node_modules/lodash-es/_baseKeys.js -var objectProto8 = Object.prototype; -var hasOwnProperty6 = objectProto8.hasOwnProperty; -function baseKeys(object) { - if (!isPrototype_default(object)) { - return nativeKeys_default(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty6.call(object, key) && key != "constructor") { - result.push(key); - } - } - return result; -} -var baseKeys_default = baseKeys; - -// node_modules/lodash-es/keys.js -function keys(object) { - return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object); -} -var keys_default = keys; - -// node_modules/lodash-es/assign.js -var objectProto9 = Object.prototype; -var hasOwnProperty7 = objectProto9.hasOwnProperty; -var assign = createAssigner_default(function(object, source) { - if (isPrototype_default(source) || isArrayLike_default(source)) { - copyObject_default(source, keys_default(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty7.call(source, key)) { - assignValue_default(object, key, source[key]); - } - } -}); -var assign_default = assign; - -// node_modules/lodash-es/_nativeKeysIn.js -function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; -} -var nativeKeysIn_default = nativeKeysIn; - -// node_modules/lodash-es/_baseKeysIn.js -var objectProto10 = Object.prototype; -var hasOwnProperty8 = objectProto10.hasOwnProperty; -function baseKeysIn(object) { - if (!isObject_default(object)) { - return nativeKeysIn_default(object); - } - var isProto = isPrototype_default(object), result = []; - for (var key in object) { - if (!(key == "constructor" && (isProto || !hasOwnProperty8.call(object, key)))) { - result.push(key); - } - } - return result; -} -var baseKeysIn_default = baseKeysIn; - -// node_modules/lodash-es/keysIn.js -function keysIn(object) { - return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object); -} -var keysIn_default = keysIn; - -// node_modules/lodash-es/_isKey.js -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; -var reIsPlainProp = /^\w*$/; -function isKey(value, object) { - if (isArray_default(value)) { - return false; - } - var type = typeof value; - if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); -} -var isKey_default = isKey; - -// node_modules/lodash-es/_nativeCreate.js -var nativeCreate = getNative_default(Object, "create"); -var nativeCreate_default = nativeCreate; - -// node_modules/lodash-es/_hashClear.js -function hashClear() { - this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {}; - this.size = 0; -} -var hashClear_default = hashClear; - -// node_modules/lodash-es/_hashDelete.js -function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; -} -var hashDelete_default = hashDelete; - -// node_modules/lodash-es/_hashGet.js -var HASH_UNDEFINED = "__lodash_hash_undefined__"; -var objectProto11 = Object.prototype; -var hasOwnProperty9 = objectProto11.hasOwnProperty; -function hashGet(key) { - var data = this.__data__; - if (nativeCreate_default) { - var result = data[key]; - return result === HASH_UNDEFINED ? void 0 : result; - } - return hasOwnProperty9.call(data, key) ? data[key] : void 0; -} -var hashGet_default = hashGet; - -// node_modules/lodash-es/_hashHas.js -var objectProto12 = Object.prototype; -var hasOwnProperty10 = objectProto12.hasOwnProperty; -function hashHas(key) { - var data = this.__data__; - return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty10.call(data, key); -} -var hashHas_default = hashHas; - -// node_modules/lodash-es/_hashSet.js -var HASH_UNDEFINED2 = "__lodash_hash_undefined__"; -function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value; - return this; -} -var hashSet_default = hashSet; - -// node_modules/lodash-es/_Hash.js -function Hash(entries) { - var index = -1, length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} -Hash.prototype.clear = hashClear_default; -Hash.prototype["delete"] = hashDelete_default; -Hash.prototype.get = hashGet_default; -Hash.prototype.has = hashHas_default; -Hash.prototype.set = hashSet_default; -var Hash_default = Hash; - -// node_modules/lodash-es/_listCacheClear.js -function listCacheClear() { - this.__data__ = []; - this.size = 0; -} -var listCacheClear_default = listCacheClear; - -// node_modules/lodash-es/_assocIndexOf.js -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq_default(array[length][0], key)) { - return length; - } - } - return -1; -} -var assocIndexOf_default = assocIndexOf; - -// node_modules/lodash-es/_listCacheDelete.js -var arrayProto = Array.prototype; -var splice = arrayProto.splice; -function listCacheDelete(key) { - var data = this.__data__, index = assocIndexOf_default(data, key); - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; -} -var listCacheDelete_default = listCacheDelete; - -// node_modules/lodash-es/_listCacheGet.js -function listCacheGet(key) { - var data = this.__data__, index = assocIndexOf_default(data, key); - return index < 0 ? void 0 : data[index][1]; -} -var listCacheGet_default = listCacheGet; - -// node_modules/lodash-es/_listCacheHas.js -function listCacheHas(key) { - return assocIndexOf_default(this.__data__, key) > -1; -} -var listCacheHas_default = listCacheHas; - -// node_modules/lodash-es/_listCacheSet.js -function listCacheSet(key, value) { - var data = this.__data__, index = assocIndexOf_default(data, key); - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} -var listCacheSet_default = listCacheSet; - -// node_modules/lodash-es/_ListCache.js -function ListCache(entries) { - var index = -1, length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} -ListCache.prototype.clear = listCacheClear_default; -ListCache.prototype["delete"] = listCacheDelete_default; -ListCache.prototype.get = listCacheGet_default; -ListCache.prototype.has = listCacheHas_default; -ListCache.prototype.set = listCacheSet_default; -var ListCache_default = ListCache; - -// node_modules/lodash-es/_Map.js -var Map2 = getNative_default(root_default, "Map"); -var Map_default = Map2; - -// node_modules/lodash-es/_mapCacheClear.js -function mapCacheClear() { - this.size = 0; - this.__data__ = { - "hash": new Hash_default(), - "map": new (Map_default || ListCache_default)(), - "string": new Hash_default() - }; -} -var mapCacheClear_default = mapCacheClear; - -// node_modules/lodash-es/_isKeyable.js -function isKeyable(value) { - var type = typeof value; - return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; -} -var isKeyable_default = isKeyable; - -// node_modules/lodash-es/_getMapData.js -function getMapData(map2, key) { - var data = map2.__data__; - return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; -} -var getMapData_default = getMapData; - -// node_modules/lodash-es/_mapCacheDelete.js -function mapCacheDelete(key) { - var result = getMapData_default(this, key)["delete"](key); - this.size -= result ? 1 : 0; - return result; -} -var mapCacheDelete_default = mapCacheDelete; - -// node_modules/lodash-es/_mapCacheGet.js -function mapCacheGet(key) { - return getMapData_default(this, key).get(key); -} -var mapCacheGet_default = mapCacheGet; - -// node_modules/lodash-es/_mapCacheHas.js -function mapCacheHas(key) { - return getMapData_default(this, key).has(key); -} -var mapCacheHas_default = mapCacheHas; - -// node_modules/lodash-es/_mapCacheSet.js -function mapCacheSet(key, value) { - var data = getMapData_default(this, key), size = data.size; - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; -} -var mapCacheSet_default = mapCacheSet; - -// node_modules/lodash-es/_MapCache.js -function MapCache(entries) { - var index = -1, length = entries == null ? 0 : entries.length; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} -MapCache.prototype.clear = mapCacheClear_default; -MapCache.prototype["delete"] = mapCacheDelete_default; -MapCache.prototype.get = mapCacheGet_default; -MapCache.prototype.has = mapCacheHas_default; -MapCache.prototype.set = mapCacheSet_default; -var MapCache_default = MapCache; - -// node_modules/lodash-es/memoize.js -var FUNC_ERROR_TEXT = "Expected a function"; -function memoize(func, resolver) { - if (typeof func != "function" || resolver != null && typeof resolver != "function") { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache_default)(); - return memoized; -} -memoize.Cache = MapCache_default; -var memoize_default = memoize; - -// node_modules/lodash-es/_memoizeCapped.js -var MAX_MEMOIZE_SIZE = 500; -function memoizeCapped(func) { - var result = memoize_default(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - var cache = result.cache; - return result; -} -var memoizeCapped_default = memoizeCapped; - -// node_modules/lodash-es/_stringToPath.js -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; -var reEscapeChar = /\\(\\)?/g; -var stringToPath = memoizeCapped_default(function(string) { - var result = []; - if (string.charCodeAt(0) === 46) { - result.push(""); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); - }); - return result; -}); -var stringToPath_default = stringToPath; - -// node_modules/lodash-es/toString.js -function toString2(value) { - return value == null ? "" : baseToString_default(value); -} -var toString_default = toString2; - -// node_modules/lodash-es/_castPath.js -function castPath(value, object) { - if (isArray_default(value)) { - return value; - } - return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value)); -} -var castPath_default = castPath; - -// node_modules/lodash-es/_toKey.js -var INFINITY3 = 1 / 0; -function toKey(value) { - if (typeof value == "string" || isSymbol_default(value)) { - return value; - } - var result = value + ""; - return result == "0" && 1 / value == -INFINITY3 ? "-0" : result; -} -var toKey_default = toKey; - -// node_modules/lodash-es/_baseGet.js -function baseGet(object, path) { - path = castPath_default(path, object); - var index = 0, length = path.length; - while (object != null && index < length) { - object = object[toKey_default(path[index++])]; - } - return index && index == length ? object : void 0; -} -var baseGet_default = baseGet; - -// node_modules/lodash-es/get.js -function get(object, path, defaultValue) { - var result = object == null ? void 0 : baseGet_default(object, path); - return result === void 0 ? defaultValue : result; -} -var get_default = get; - -// node_modules/lodash-es/_arrayPush.js -function arrayPush(array, values2) { - var index = -1, length = values2.length, offset = array.length; - while (++index < length) { - array[offset + index] = values2[index]; - } - return array; -} -var arrayPush_default = arrayPush; - -// node_modules/lodash-es/_isFlattenable.js -var spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0; -function isFlattenable(value) { - return isArray_default(value) || isArguments_default(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); -} -var isFlattenable_default = isFlattenable; - -// node_modules/lodash-es/_baseFlatten.js -function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, length = array.length; - predicate || (predicate = isFlattenable_default); - result || (result = []); - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush_default(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; -} -var baseFlatten_default = baseFlatten; - -// node_modules/lodash-es/flatten.js -function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten_default(array, 1) : []; -} -var flatten_default = flatten; - -// node_modules/lodash-es/_getPrototype.js -var getPrototype = overArg_default(Object.getPrototypeOf, Object); -var getPrototype_default = getPrototype; - -// node_modules/lodash-es/_baseSlice.js -function baseSlice(array, start, end) { - var index = -1, length = array.length; - if (start < 0) { - start = -start > length ? 0 : length + start; - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : end - start >>> 0; - start >>>= 0; - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} -var baseSlice_default = baseSlice; - -// node_modules/lodash-es/_arrayReduce.js -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} -var arrayReduce_default = arrayReduce; - -// node_modules/lodash-es/_stackClear.js -function stackClear() { - this.__data__ = new ListCache_default(); - this.size = 0; -} -var stackClear_default = stackClear; - -// node_modules/lodash-es/_stackDelete.js -function stackDelete(key) { - var data = this.__data__, result = data["delete"](key); - this.size = data.size; - return result; -} -var stackDelete_default = stackDelete; - -// node_modules/lodash-es/_stackGet.js -function stackGet(key) { - return this.__data__.get(key); -} -var stackGet_default = stackGet; - -// node_modules/lodash-es/_stackHas.js -function stackHas(key) { - return this.__data__.has(key); -} -var stackHas_default = stackHas; - -// node_modules/lodash-es/_stackSet.js -var LARGE_ARRAY_SIZE = 200; -function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache_default) { - var pairs = data.__data__; - if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache_default(pairs); - } - data.set(key, value); - this.size = data.size; - return this; -} -var stackSet_default = stackSet; - -// node_modules/lodash-es/_Stack.js -function Stack(entries) { - var data = this.__data__ = new ListCache_default(entries); - this.size = data.size; -} -Stack.prototype.clear = stackClear_default; -Stack.prototype["delete"] = stackDelete_default; -Stack.prototype.get = stackGet_default; -Stack.prototype.has = stackHas_default; -Stack.prototype.set = stackSet_default; -var Stack_default = Stack; - -// node_modules/lodash-es/_baseAssign.js -function baseAssign(object, source) { - return object && copyObject_default(source, keys_default(source), object); -} -var baseAssign_default = baseAssign; - -// node_modules/lodash-es/_baseAssignIn.js -function baseAssignIn(object, source) { - return object && copyObject_default(source, keysIn_default(source), object); -} -var baseAssignIn_default = baseAssignIn; - -// node_modules/lodash-es/_cloneBuffer.js -var freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports; -var freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module; -var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3; -var Buffer3 = moduleExports3 ? root_default.Buffer : void 0; -var allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0; -function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - buffer.copy(result); - return result; -} -var cloneBuffer_default = cloneBuffer; - -// node_modules/lodash-es/_arrayFilter.js -function arrayFilter(array, predicate) { - var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; -} -var arrayFilter_default = arrayFilter; - -// node_modules/lodash-es/stubArray.js -function stubArray() { - return []; -} -var stubArray_default = stubArray; - -// node_modules/lodash-es/_getSymbols.js -var objectProto13 = Object.prototype; -var propertyIsEnumerable2 = objectProto13.propertyIsEnumerable; -var nativeGetSymbols = Object.getOwnPropertySymbols; -var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter_default(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable2.call(object, symbol); - }); -}; -var getSymbols_default = getSymbols; - -// node_modules/lodash-es/_copySymbols.js -function copySymbols(source, object) { - return copyObject_default(source, getSymbols_default(source), object); -} -var copySymbols_default = copySymbols; - -// node_modules/lodash-es/_getSymbolsIn.js -var nativeGetSymbols2 = Object.getOwnPropertySymbols; -var getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) { - var result = []; - while (object) { - arrayPush_default(result, getSymbols_default(object)); - object = getPrototype_default(object); - } - return result; -}; -var getSymbolsIn_default = getSymbolsIn; - -// node_modules/lodash-es/_copySymbolsIn.js -function copySymbolsIn(source, object) { - return copyObject_default(source, getSymbolsIn_default(source), object); -} -var copySymbolsIn_default = copySymbolsIn; - -// node_modules/lodash-es/_baseGetAllKeys.js -function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object)); -} -var baseGetAllKeys_default = baseGetAllKeys; - -// node_modules/lodash-es/_getAllKeys.js -function getAllKeys(object) { - return baseGetAllKeys_default(object, keys_default, getSymbols_default); -} -var getAllKeys_default = getAllKeys; - -// node_modules/lodash-es/_getAllKeysIn.js -function getAllKeysIn(object) { - return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default); -} -var getAllKeysIn_default = getAllKeysIn; - -// node_modules/lodash-es/_DataView.js -var DataView = getNative_default(root_default, "DataView"); -var DataView_default = DataView; - -// node_modules/lodash-es/_Promise.js -var Promise2 = getNative_default(root_default, "Promise"); -var Promise_default = Promise2; - -// node_modules/lodash-es/_Set.js -var Set2 = getNative_default(root_default, "Set"); -var Set_default = Set2; - -// node_modules/lodash-es/_getTag.js -var mapTag2 = "[object Map]"; -var objectTag2 = "[object Object]"; -var promiseTag = "[object Promise]"; -var setTag2 = "[object Set]"; -var weakMapTag2 = "[object WeakMap]"; -var dataViewTag2 = "[object DataView]"; -var dataViewCtorString = toSource_default(DataView_default); -var mapCtorString = toSource_default(Map_default); -var promiseCtorString = toSource_default(Promise_default); -var setCtorString = toSource_default(Set_default); -var weakMapCtorString = toSource_default(WeakMap_default); -var getTag = baseGetTag_default; -if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) { - getTag = function(value) { - var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : ""; - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: - return dataViewTag2; - case mapCtorString: - return mapTag2; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag2; - case weakMapCtorString: - return weakMapTag2; - } - } - return result; - }; -} -var getTag_default = getTag; - -// node_modules/lodash-es/_initCloneArray.js -var objectProto14 = Object.prototype; -var hasOwnProperty11 = objectProto14.hasOwnProperty; -function initCloneArray(array) { - var length = array.length, result = new array.constructor(length); - if (length && typeof array[0] == "string" && hasOwnProperty11.call(array, "index")) { - result.index = array.index; - result.input = array.input; - } - return result; -} -var initCloneArray_default = initCloneArray; - -// node_modules/lodash-es/_Uint8Array.js -var Uint8Array2 = root_default.Uint8Array; -var Uint8Array_default = Uint8Array2; - -// node_modules/lodash-es/_cloneArrayBuffer.js -function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer)); - return result; -} -var cloneArrayBuffer_default = cloneArrayBuffer; - -// node_modules/lodash-es/_cloneDataView.js -function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); -} -var cloneDataView_default = cloneDataView; - -// node_modules/lodash-es/_cloneRegExp.js -var reFlags = /\w*$/; -function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; -} -var cloneRegExp_default = cloneRegExp; - -// node_modules/lodash-es/_cloneSymbol.js -var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0; -var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0; -function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; -} -var cloneSymbol_default = cloneSymbol; - -// node_modules/lodash-es/_cloneTypedArray.js -function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); -} -var cloneTypedArray_default = cloneTypedArray; - -// node_modules/lodash-es/_initCloneByTag.js -var boolTag2 = "[object Boolean]"; -var dateTag2 = "[object Date]"; -var mapTag3 = "[object Map]"; -var numberTag2 = "[object Number]"; -var regexpTag2 = "[object RegExp]"; -var setTag3 = "[object Set]"; -var stringTag2 = "[object String]"; -var symbolTag2 = "[object Symbol]"; -var arrayBufferTag2 = "[object ArrayBuffer]"; -var dataViewTag3 = "[object DataView]"; -var float32Tag2 = "[object Float32Array]"; -var float64Tag2 = "[object Float64Array]"; -var int8Tag2 = "[object Int8Array]"; -var int16Tag2 = "[object Int16Array]"; -var int32Tag2 = "[object Int32Array]"; -var uint8Tag2 = "[object Uint8Array]"; -var uint8ClampedTag2 = "[object Uint8ClampedArray]"; -var uint16Tag2 = "[object Uint16Array]"; -var uint32Tag2 = "[object Uint32Array]"; -function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag2: - return cloneArrayBuffer_default(object); - case boolTag2: - case dateTag2: - return new Ctor(+object); - case dataViewTag3: - return cloneDataView_default(object, isDeep); - case float32Tag2: - case float64Tag2: - case int8Tag2: - case int16Tag2: - case int32Tag2: - case uint8Tag2: - case uint8ClampedTag2: - case uint16Tag2: - case uint32Tag2: - return cloneTypedArray_default(object, isDeep); - case mapTag3: - return new Ctor(); - case numberTag2: - case stringTag2: - return new Ctor(object); - case regexpTag2: - return cloneRegExp_default(object); - case setTag3: - return new Ctor(); - case symbolTag2: - return cloneSymbol_default(object); - } -} -var initCloneByTag_default = initCloneByTag; - -// node_modules/lodash-es/_initCloneObject.js -function initCloneObject(object) { - return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {}; -} -var initCloneObject_default = initCloneObject; - -// node_modules/lodash-es/_baseIsMap.js -var mapTag4 = "[object Map]"; -function baseIsMap(value) { - return isObjectLike_default(value) && getTag_default(value) == mapTag4; -} -var baseIsMap_default = baseIsMap; - -// node_modules/lodash-es/isMap.js -var nodeIsMap = nodeUtil_default && nodeUtil_default.isMap; -var isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default; -var isMap_default = isMap; - -// node_modules/lodash-es/_baseIsSet.js -var setTag4 = "[object Set]"; -function baseIsSet(value) { - return isObjectLike_default(value) && getTag_default(value) == setTag4; -} -var baseIsSet_default = baseIsSet; - -// node_modules/lodash-es/isSet.js -var nodeIsSet = nodeUtil_default && nodeUtil_default.isSet; -var isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default; -var isSet_default = isSet; - -// node_modules/lodash-es/_baseClone.js -var CLONE_DEEP_FLAG = 1; -var CLONE_FLAT_FLAG = 2; -var CLONE_SYMBOLS_FLAG = 4; -var argsTag3 = "[object Arguments]"; -var arrayTag2 = "[object Array]"; -var boolTag3 = "[object Boolean]"; -var dateTag3 = "[object Date]"; -var errorTag2 = "[object Error]"; -var funcTag3 = "[object Function]"; -var genTag2 = "[object GeneratorFunction]"; -var mapTag5 = "[object Map]"; -var numberTag3 = "[object Number]"; -var objectTag3 = "[object Object]"; -var regexpTag3 = "[object RegExp]"; -var setTag5 = "[object Set]"; -var stringTag3 = "[object String]"; -var symbolTag3 = "[object Symbol]"; -var weakMapTag3 = "[object WeakMap]"; -var arrayBufferTag3 = "[object ArrayBuffer]"; -var dataViewTag4 = "[object DataView]"; -var float32Tag3 = "[object Float32Array]"; -var float64Tag3 = "[object Float64Array]"; -var int8Tag3 = "[object Int8Array]"; -var int16Tag3 = "[object Int16Array]"; -var int32Tag3 = "[object Int32Array]"; -var uint8Tag3 = "[object Uint8Array]"; -var uint8ClampedTag3 = "[object Uint8ClampedArray]"; -var uint16Tag3 = "[object Uint16Array]"; -var uint32Tag3 = "[object Uint32Array]"; -var cloneableTags = {}; -cloneableTags[argsTag3] = cloneableTags[arrayTag2] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag5] = cloneableTags[numberTag3] = cloneableTags[objectTag3] = cloneableTags[regexpTag3] = cloneableTags[setTag5] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true; -cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false; -function baseClone(value, bitmask, customizer, key, object, stack) { - var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== void 0) { - return result; - } - if (!isObject_default(value)) { - return value; - } - var isArr = isArray_default(value); - if (isArr) { - result = initCloneArray_default(value); - if (!isDeep) { - return copyArray_default(value, result); - } - } else { - var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2; - if (isBuffer_default(value)) { - return cloneBuffer_default(value, isDeep); - } - if (tag == objectTag3 || tag == argsTag3 || isFunc && !object) { - result = isFlat || isFunc ? {} : initCloneObject_default(value); - if (!isDeep) { - return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag_default(value, tag, isDeep); - } - } - stack || (stack = new Stack_default()); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - if (isSet_default(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap_default(value)) { - value.forEach(function(subValue, key2) { - result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); - }); - } - var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default; - var props = isArr ? void 0 : keysFunc(value); - arrayEach_default(props || value, function(subValue, key2) { - if (props) { - key2 = subValue; - subValue = value[key2]; - } - assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); - }); - return result; -} -var baseClone_default = baseClone; - -// node_modules/lodash-es/clone.js -var CLONE_SYMBOLS_FLAG2 = 4; -function clone(value) { - return baseClone_default(value, CLONE_SYMBOLS_FLAG2); -} -var clone_default = clone; - -// node_modules/lodash-es/compact.js -function compact(array) { - var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; -} -var compact_default = compact; - -// node_modules/lodash-es/_setCacheAdd.js -var HASH_UNDEFINED3 = "__lodash_hash_undefined__"; -function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED3); - return this; -} -var setCacheAdd_default = setCacheAdd; - -// node_modules/lodash-es/_setCacheHas.js -function setCacheHas(value) { - return this.__data__.has(value); -} -var setCacheHas_default = setCacheHas; - -// node_modules/lodash-es/_SetCache.js -function SetCache(values2) { - var index = -1, length = values2 == null ? 0 : values2.length; - this.__data__ = new MapCache_default(); - while (++index < length) { - this.add(values2[index]); - } -} -SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default; -SetCache.prototype.has = setCacheHas_default; -var SetCache_default = SetCache; - -// node_modules/lodash-es/_arraySome.js -function arraySome(array, predicate) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} -var arraySome_default = arraySome; - -// node_modules/lodash-es/_cacheHas.js -function cacheHas(cache, key) { - return cache.has(key); -} -var cacheHas_default = cacheHas; - -// node_modules/lodash-es/_equalArrays.js -var COMPARE_PARTIAL_FLAG = 1; -var COMPARE_UNORDERED_FLAG = 2; -function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0; - stack.set(array, other); - stack.set(other, array); - while (++index < arrLength) { - var arrValue = array[index], othValue = other[index]; - if (customizer) { - var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== void 0) { - if (compared) { - continue; - } - result = false; - break; - } - if (seen) { - if (!arraySome_default(other, function(othValue2, othIndex) { - if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - result = false; - break; - } - } - stack["delete"](array); - stack["delete"](other); - return result; -} -var equalArrays_default = equalArrays; - -// node_modules/lodash-es/_mapToArray.js -function mapToArray(map2) { - var index = -1, result = Array(map2.size); - map2.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} -var mapToArray_default = mapToArray; - -// node_modules/lodash-es/_setToArray.js -function setToArray(set) { - var index = -1, result = Array(set.size); - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} -var setToArray_default = setToArray; - -// node_modules/lodash-es/_equalByTag.js -var COMPARE_PARTIAL_FLAG2 = 1; -var COMPARE_UNORDERED_FLAG2 = 2; -var boolTag4 = "[object Boolean]"; -var dateTag4 = "[object Date]"; -var errorTag3 = "[object Error]"; -var mapTag6 = "[object Map]"; -var numberTag4 = "[object Number]"; -var regexpTag4 = "[object RegExp]"; -var setTag6 = "[object Set]"; -var stringTag4 = "[object String]"; -var symbolTag4 = "[object Symbol]"; -var arrayBufferTag4 = "[object ArrayBuffer]"; -var dataViewTag5 = "[object DataView]"; -var symbolProto3 = Symbol_default ? Symbol_default.prototype : void 0; -var symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : void 0; -function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag5: - if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { - return false; - } - object = object.buffer; - other = other.buffer; - case arrayBufferTag4: - if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) { - return false; - } - return true; - case boolTag4: - case dateTag4: - case numberTag4: - return eq_default(+object, +other); - case errorTag3: - return object.name == other.name && object.message == other.message; - case regexpTag4: - case stringTag4: - return object == other + ""; - case mapTag6: - var convert = mapToArray_default; - case setTag6: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG2; - convert || (convert = setToArray_default); - if (object.size != other.size && !isPartial) { - return false; - } - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG2; - stack.set(object, other); - var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack["delete"](object); - return result; - case symbolTag4: - if (symbolValueOf2) { - return symbolValueOf2.call(object) == symbolValueOf2.call(other); - } - } - return false; -} -var equalByTag_default = equalByTag; - -// node_modules/lodash-es/_equalObjects.js -var COMPARE_PARTIAL_FLAG3 = 1; -var objectProto15 = Object.prototype; -var hasOwnProperty12 = objectProto15.hasOwnProperty; -function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length; - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty12.call(other, key))) { - return false; - } - } - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], othValue = other[key]; - if (customizer) { - var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); - } - if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { - result = false; - break; - } - skipCtor || (skipCtor = key == "constructor"); - } - if (result && !skipCtor) { - var objCtor = object.constructor, othCtor = other.constructor; - if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { - result = false; - } - } - stack["delete"](object); - stack["delete"](other); - return result; -} -var equalObjects_default = equalObjects; - -// node_modules/lodash-es/_baseIsEqualDeep.js -var COMPARE_PARTIAL_FLAG4 = 1; -var argsTag4 = "[object Arguments]"; -var arrayTag3 = "[object Array]"; -var objectTag4 = "[object Object]"; -var objectProto16 = Object.prototype; -var hasOwnProperty13 = objectProto16.hasOwnProperty; -function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag3 : getTag_default(object), othTag = othIsArr ? arrayTag3 : getTag_default(other); - objTag = objTag == argsTag4 ? objectTag4 : objTag; - othTag = othTag == argsTag4 ? objectTag4 : othTag; - var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag; - if (isSameTag && isBuffer_default(object)) { - if (!isBuffer_default(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack_default()); - return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG4)) { - var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other, "__wrapped__"); - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - stack || (stack = new Stack_default()); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack_default()); - return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack); -} -var baseIsEqualDeep_default = baseIsEqualDeep; - -// node_modules/lodash-es/_baseIsEqual.js -function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) { - return value !== value && other !== other; - } - return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack); -} -var baseIsEqual_default = baseIsEqual; - -// node_modules/lodash-es/_baseIsMatch.js -var COMPARE_PARTIAL_FLAG5 = 1; -var COMPARE_UNORDERED_FLAG3 = 2; -function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, length = index, noCustomizer = !customizer; - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], objValue = object[key], srcValue = data[1]; - if (noCustomizer && data[2]) { - if (objValue === void 0 && !(key in object)) { - return false; - } - } else { - var stack = new Stack_default(); - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === void 0 ? baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result)) { - return false; - } - } - } - return true; -} -var baseIsMatch_default = baseIsMatch; - -// node_modules/lodash-es/_isStrictComparable.js -function isStrictComparable(value) { - return value === value && !isObject_default(value); -} -var isStrictComparable_default = isStrictComparable; - -// node_modules/lodash-es/_getMatchData.js -function getMatchData(object) { - var result = keys_default(object), length = result.length; - while (length--) { - var key = result[length], value = object[key]; - result[length] = [key, value, isStrictComparable_default(value)]; - } - return result; -} -var getMatchData_default = getMatchData; - -// node_modules/lodash-es/_matchesStrictComparable.js -function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && (srcValue !== void 0 || key in Object(object)); - }; -} -var matchesStrictComparable_default = matchesStrictComparable; - -// node_modules/lodash-es/_baseMatches.js -function baseMatches(source) { - var matchData = getMatchData_default(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable_default(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch_default(object, source, matchData); - }; -} -var baseMatches_default = baseMatches; - -// node_modules/lodash-es/_baseHasIn.js -function baseHasIn(object, key) { - return object != null && key in Object(object); -} -var baseHasIn_default = baseHasIn; - -// node_modules/lodash-es/_hasPath.js -function hasPath(object, path, hasFunc) { - path = castPath_default(path, object); - var index = -1, length = path.length, result = false; - while (++index < length) { - var key = toKey_default(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength_default(length) && isIndex_default(key, length) && (isArray_default(object) || isArguments_default(object)); -} -var hasPath_default = hasPath; - -// node_modules/lodash-es/hasIn.js -function hasIn(object, path) { - return object != null && hasPath_default(object, path, baseHasIn_default); -} -var hasIn_default = hasIn; - -// node_modules/lodash-es/_baseMatchesProperty.js -var COMPARE_PARTIAL_FLAG6 = 1; -var COMPARE_UNORDERED_FLAG4 = 2; -function baseMatchesProperty(path, srcValue) { - if (isKey_default(path) && isStrictComparable_default(srcValue)) { - return matchesStrictComparable_default(toKey_default(path), srcValue); - } - return function(object) { - var objValue = get_default(object, path); - return objValue === void 0 && objValue === srcValue ? hasIn_default(object, path) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4); - }; -} -var baseMatchesProperty_default = baseMatchesProperty; - -// node_modules/lodash-es/_baseProperty.js -function baseProperty(key) { - return function(object) { - return object == null ? void 0 : object[key]; - }; -} -var baseProperty_default = baseProperty; - -// node_modules/lodash-es/_basePropertyDeep.js -function basePropertyDeep(path) { - return function(object) { - return baseGet_default(object, path); - }; -} -var basePropertyDeep_default = basePropertyDeep; - -// node_modules/lodash-es/property.js -function property(path) { - return isKey_default(path) ? baseProperty_default(toKey_default(path)) : basePropertyDeep_default(path); -} -var property_default = property; - -// node_modules/lodash-es/_baseIteratee.js -function baseIteratee(value) { - if (typeof value == "function") { - return value; - } - if (value == null) { - return identity_default; - } - if (typeof value == "object") { - return isArray_default(value) ? baseMatchesProperty_default(value[0], value[1]) : baseMatches_default(value); - } - return property_default(value); -} -var baseIteratee_default = baseIteratee; - -// node_modules/lodash-es/_arrayAggregator.js -function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; -} -var arrayAggregator_default = arrayAggregator; - -// node_modules/lodash-es/_createBaseFor.js -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} -var createBaseFor_default = createBaseFor; - -// node_modules/lodash-es/_baseFor.js -var baseFor = createBaseFor_default(); -var baseFor_default = baseFor; - -// node_modules/lodash-es/_baseForOwn.js -function baseForOwn(object, iteratee) { - return object && baseFor_default(object, iteratee, keys_default); -} -var baseForOwn_default = baseForOwn; - -// node_modules/lodash-es/_createBaseEach.js -function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike_default(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); - while (fromRight ? index-- : ++index < length) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; -} -var createBaseEach_default = createBaseEach; - -// node_modules/lodash-es/_baseEach.js -var baseEach = createBaseEach_default(baseForOwn_default); -var baseEach_default = baseEach; - -// node_modules/lodash-es/_baseAggregator.js -function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach_default(collection, function(value, key, collection2) { - setter(accumulator, value, iteratee(value), collection2); - }); - return accumulator; -} -var baseAggregator_default = baseAggregator; - -// node_modules/lodash-es/_createAggregator.js -function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray_default(collection) ? arrayAggregator_default : baseAggregator_default, accumulator = initializer ? initializer() : {}; - return func(collection, setter, baseIteratee_default(iteratee, 2), accumulator); - }; -} -var createAggregator_default = createAggregator; - -// node_modules/lodash-es/defaults.js -var objectProto17 = Object.prototype; -var hasOwnProperty14 = objectProto17.hasOwnProperty; -var defaults = baseRest_default(function(object, sources) { - object = Object(object); - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : void 0; - if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { - length = 1; - } - while (++index < length) { - var source = sources[index]; - var props = keysIn_default(source); - var propsIndex = -1; - var propsLength = props.length; - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - if (value === void 0 || eq_default(value, objectProto17[key]) && !hasOwnProperty14.call(object, key)) { - object[key] = source[key]; - } - } - } - return object; -}); -var defaults_default = defaults; - -// node_modules/lodash-es/isArrayLikeObject.js -function isArrayLikeObject(value) { - return isObjectLike_default(value) && isArrayLike_default(value); -} -var isArrayLikeObject_default = isArrayLikeObject; - -// node_modules/lodash-es/_arrayIncludesWith.js -function arrayIncludesWith(array, value, comparator) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; -} -var arrayIncludesWith_default = arrayIncludesWith; - -// node_modules/lodash-es/_baseDifference.js -var LARGE_ARRAY_SIZE2 = 200; -function baseDifference(array, values2, iteratee, comparator) { - var index = -1, includes2 = arrayIncludes_default, isCommon = true, length = array.length, result = [], valuesLength = values2.length; - if (!length) { - return result; - } - if (iteratee) { - values2 = arrayMap_default(values2, baseUnary_default(iteratee)); - } - if (comparator) { - includes2 = arrayIncludesWith_default; - isCommon = false; - } else if (values2.length >= LARGE_ARRAY_SIZE2) { - includes2 = cacheHas_default; - isCommon = false; - values2 = new SetCache_default(values2); - } - outer: - while (++index < length) { - var value = array[index], computed = iteratee == null ? value : iteratee(value); - value = comparator || value !== 0 ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values2[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } else if (!includes2(values2, computed, comparator)) { - result.push(value); - } - } - return result; -} -var baseDifference_default = baseDifference; - -// node_modules/lodash-es/difference.js -var difference = baseRest_default(function(array, values2) { - return isArrayLikeObject_default(array) ? baseDifference_default(array, baseFlatten_default(values2, 1, isArrayLikeObject_default, true)) : []; -}); -var difference_default = difference; - -// node_modules/lodash-es/last.js -function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : void 0; -} -var last_default = last; - -// node_modules/lodash-es/drop.js -function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = guard || n === void 0 ? 1 : toInteger_default(n); - return baseSlice_default(array, n < 0 ? 0 : n, length); -} -var drop_default = drop; - -// node_modules/lodash-es/dropRight.js -function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = guard || n === void 0 ? 1 : toInteger_default(n); - n = length - n; - return baseSlice_default(array, 0, n < 0 ? 0 : n); -} -var dropRight_default = dropRight; - -// node_modules/lodash-es/_castFunction.js -function castFunction(value) { - return typeof value == "function" ? value : identity_default; -} -var castFunction_default = castFunction; - -// node_modules/lodash-es/forEach.js -function forEach(collection, iteratee) { - var func = isArray_default(collection) ? arrayEach_default : baseEach_default; - return func(collection, castFunction_default(iteratee)); -} -var forEach_default = forEach; - -// node_modules/lodash-es/_arrayEvery.js -function arrayEvery(array, predicate) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; -} -var arrayEvery_default = arrayEvery; - -// node_modules/lodash-es/_baseEvery.js -function baseEvery(collection, predicate) { - var result = true; - baseEach_default(collection, function(value, index, collection2) { - result = !!predicate(value, index, collection2); - return result; - }); - return result; -} -var baseEvery_default = baseEvery; - -// node_modules/lodash-es/every.js -function every(collection, predicate, guard) { - var func = isArray_default(collection) ? arrayEvery_default : baseEvery_default; - if (guard && isIterateeCall_default(collection, predicate, guard)) { - predicate = void 0; - } - return func(collection, baseIteratee_default(predicate, 3)); -} -var every_default = every; - -// node_modules/lodash-es/_baseFilter.js -function baseFilter(collection, predicate) { - var result = []; - baseEach_default(collection, function(value, index, collection2) { - if (predicate(value, index, collection2)) { - result.push(value); - } - }); - return result; -} -var baseFilter_default = baseFilter; - -// node_modules/lodash-es/filter.js -function filter(collection, predicate) { - var func = isArray_default(collection) ? arrayFilter_default : baseFilter_default; - return func(collection, baseIteratee_default(predicate, 3)); -} -var filter_default = filter; - -// node_modules/lodash-es/_createFind.js -function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike_default(collection)) { - var iteratee = baseIteratee_default(predicate, 3); - collection = keys_default(collection); - predicate = function(key) { - return iteratee(iterable[key], key, iterable); - }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0; - }; -} -var createFind_default = createFind; - -// node_modules/lodash-es/findIndex.js -var nativeMax2 = Math.max; -function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger_default(fromIndex); - if (index < 0) { - index = nativeMax2(length + index, 0); - } - return baseFindIndex_default(array, baseIteratee_default(predicate, 3), index); -} -var findIndex_default = findIndex; - -// node_modules/lodash-es/find.js -var find = createFind_default(findIndex_default); -var find_default = find; - -// node_modules/lodash-es/head.js -function head(array) { - return array && array.length ? array[0] : void 0; -} -var head_default = head; - -// node_modules/lodash-es/_baseMap.js -function baseMap(collection, iteratee) { - var index = -1, result = isArrayLike_default(collection) ? Array(collection.length) : []; - baseEach_default(collection, function(value, key, collection2) { - result[++index] = iteratee(value, key, collection2); - }); - return result; -} -var baseMap_default = baseMap; - -// node_modules/lodash-es/map.js -function map(collection, iteratee) { - var func = isArray_default(collection) ? arrayMap_default : baseMap_default; - return func(collection, baseIteratee_default(iteratee, 3)); -} -var map_default = map; - -// node_modules/lodash-es/flatMap.js -function flatMap(collection, iteratee) { - return baseFlatten_default(map_default(collection, iteratee), 1); -} -var flatMap_default = flatMap; - -// node_modules/lodash-es/groupBy.js -var objectProto18 = Object.prototype; -var hasOwnProperty15 = objectProto18.hasOwnProperty; -var groupBy = createAggregator_default(function(result, value, key) { - if (hasOwnProperty15.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue_default(result, key, [value]); - } -}); -var groupBy_default = groupBy; - -// node_modules/lodash-es/_baseHas.js -var objectProto19 = Object.prototype; -var hasOwnProperty16 = objectProto19.hasOwnProperty; -function baseHas(object, key) { - return object != null && hasOwnProperty16.call(object, key); -} -var baseHas_default = baseHas; - -// node_modules/lodash-es/has.js -function has(object, path) { - return object != null && hasPath_default(object, path, baseHas_default); -} -var has_default = has; - -// node_modules/lodash-es/isString.js -var stringTag5 = "[object String]"; -function isString(value) { - return typeof value == "string" || !isArray_default(value) && isObjectLike_default(value) && baseGetTag_default(value) == stringTag5; -} -var isString_default = isString; - -// node_modules/lodash-es/_baseValues.js -function baseValues(object, props) { - return arrayMap_default(props, function(key) { - return object[key]; - }); -} -var baseValues_default = baseValues; - -// node_modules/lodash-es/values.js -function values(object) { - return object == null ? [] : baseValues_default(object, keys_default(object)); -} -var values_default = values; - -// node_modules/lodash-es/includes.js -var nativeMax3 = Math.max; -function includes(collection, value, fromIndex, guard) { - collection = isArrayLike_default(collection) ? collection : values_default(collection); - fromIndex = fromIndex && !guard ? toInteger_default(fromIndex) : 0; - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax3(length + fromIndex, 0); - } - return isString_default(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf_default(collection, value, fromIndex) > -1; -} -var includes_default = includes; - -// node_modules/lodash-es/indexOf.js -var nativeMax4 = Math.max; -function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger_default(fromIndex); - if (index < 0) { - index = nativeMax4(length + index, 0); - } - return baseIndexOf_default(array, value, index); -} -var indexOf_default = indexOf; - -// node_modules/lodash-es/isEmpty.js -var mapTag7 = "[object Map]"; -var setTag7 = "[object Set]"; -var objectProto20 = Object.prototype; -var hasOwnProperty17 = objectProto20.hasOwnProperty; -function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike_default(value) && (isArray_default(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer_default(value) || isTypedArray_default(value) || isArguments_default(value))) { - return !value.length; - } - var tag = getTag_default(value); - if (tag == mapTag7 || tag == setTag7) { - return !value.size; - } - if (isPrototype_default(value)) { - return !baseKeys_default(value).length; - } - for (var key in value) { - if (hasOwnProperty17.call(value, key)) { - return false; - } - } - return true; -} -var isEmpty_default = isEmpty; - -// node_modules/lodash-es/_baseIsRegExp.js -var regexpTag5 = "[object RegExp]"; -function baseIsRegExp(value) { - return isObjectLike_default(value) && baseGetTag_default(value) == regexpTag5; -} -var baseIsRegExp_default = baseIsRegExp; - -// node_modules/lodash-es/isRegExp.js -var nodeIsRegExp = nodeUtil_default && nodeUtil_default.isRegExp; -var isRegExp = nodeIsRegExp ? baseUnary_default(nodeIsRegExp) : baseIsRegExp_default; -var isRegExp_default = isRegExp; - -// node_modules/lodash-es/isUndefined.js -function isUndefined(value) { - return value === void 0; -} -var isUndefined_default = isUndefined; - -// node_modules/lodash-es/_baseLt.js -function baseLt(value, other) { - return value < other; -} -var baseLt_default = baseLt; - -// node_modules/lodash-es/_baseExtremum.js -function baseExtremum(array, iteratee, comparator) { - var index = -1, length = array.length; - while (++index < length) { - var value = array[index], current = iteratee(value); - if (current != null && (computed === void 0 ? current === current && !isSymbol_default(current) : comparator(current, computed))) { - var computed = current, result = value; - } - } - return result; -} -var baseExtremum_default = baseExtremum; - -// node_modules/lodash-es/min.js -function min(array) { - return array && array.length ? baseExtremum_default(array, identity_default, baseLt_default) : void 0; -} -var min_default = min; - -// node_modules/lodash-es/negate.js -var FUNC_ERROR_TEXT2 = "Expected a function"; -function negate(predicate) { - if (typeof predicate != "function") { - throw new TypeError(FUNC_ERROR_TEXT2); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: - return !predicate.call(this); - case 1: - return !predicate.call(this, args[0]); - case 2: - return !predicate.call(this, args[0], args[1]); - case 3: - return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; -} -var negate_default = negate; - -// node_modules/lodash-es/_baseSet.js -function baseSet(object, path, value, customizer) { - if (!isObject_default(object)) { - return object; - } - path = castPath_default(path, object); - var index = -1, length = path.length, lastIndex = length - 1, nested = object; - while (nested != null && ++index < length) { - var key = toKey_default(path[index]), newValue = value; - if (key === "__proto__" || key === "constructor" || key === "prototype") { - return object; - } - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : void 0; - if (newValue === void 0) { - newValue = isObject_default(objValue) ? objValue : isIndex_default(path[index + 1]) ? [] : {}; - } - } - assignValue_default(nested, key, newValue); - nested = nested[key]; - } - return object; -} -var baseSet_default = baseSet; - -// node_modules/lodash-es/_basePickBy.js -function basePickBy(object, paths, predicate) { - var index = -1, length = paths.length, result = {}; - while (++index < length) { - var path = paths[index], value = baseGet_default(object, path); - if (predicate(value, path)) { - baseSet_default(result, castPath_default(path, object), value); - } - } - return result; -} -var basePickBy_default = basePickBy; - -// node_modules/lodash-es/pickBy.js -function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap_default(getAllKeysIn_default(object), function(prop) { - return [prop]; - }); - predicate = baseIteratee_default(predicate); - return basePickBy_default(object, props, function(value, path) { - return predicate(value, path[0]); - }); -} -var pickBy_default = pickBy; - -// node_modules/lodash-es/_baseReduce.js -function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection2) { - accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); - }); - return accumulator; -} -var baseReduce_default = baseReduce; - -// node_modules/lodash-es/reduce.js -function reduce(collection, iteratee, accumulator) { - var func = isArray_default(collection) ? arrayReduce_default : baseReduce_default, initAccum = arguments.length < 3; - return func(collection, baseIteratee_default(iteratee, 4), accumulator, initAccum, baseEach_default); -} -var reduce_default = reduce; - -// node_modules/lodash-es/reject.js -function reject(collection, predicate) { - var func = isArray_default(collection) ? arrayFilter_default : baseFilter_default; - return func(collection, negate_default(baseIteratee_default(predicate, 3))); -} -var reject_default = reject; - -// node_modules/lodash-es/_baseSome.js -function baseSome(collection, predicate) { - var result; - baseEach_default(collection, function(value, index, collection2) { - result = predicate(value, index, collection2); - return !result; - }); - return !!result; -} -var baseSome_default = baseSome; - -// node_modules/lodash-es/some.js -function some(collection, predicate, guard) { - var func = isArray_default(collection) ? arraySome_default : baseSome_default; - if (guard && isIterateeCall_default(collection, predicate, guard)) { - predicate = void 0; - } - return func(collection, baseIteratee_default(predicate, 3)); -} -var some_default = some; - -// node_modules/lodash-es/_createSet.js -var INFINITY4 = 1 / 0; -var createSet = !(Set_default && 1 / setToArray_default(new Set_default([, -0]))[1] == INFINITY4) ? noop_default : function(values2) { - return new Set_default(values2); -}; -var createSet_default = createSet; - -// node_modules/lodash-es/_baseUniq.js -var LARGE_ARRAY_SIZE3 = 200; -function baseUniq(array, iteratee, comparator) { - var index = -1, includes2 = arrayIncludes_default, length = array.length, isCommon = true, result = [], seen = result; - if (comparator) { - isCommon = false; - includes2 = arrayIncludesWith_default; - } else if (length >= LARGE_ARRAY_SIZE3) { - var set = iteratee ? null : createSet_default(array); - if (set) { - return setToArray_default(set); - } - isCommon = false; - includes2 = cacheHas_default; - seen = new SetCache_default(); - } else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], computed = iteratee ? iteratee(value) : value; - value = comparator || value !== 0 ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } else if (!includes2(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} -var baseUniq_default = baseUniq; - -// node_modules/lodash-es/uniq.js -function uniq(array) { - return array && array.length ? baseUniq_default(array) : []; -} -var uniq_default = uniq; - -// node_modules/lodash-es/uniqBy.js -function uniqBy(array, iteratee) { - return array && array.length ? baseUniq_default(array, baseIteratee_default(iteratee, 2)) : []; -} -var uniqBy_default = uniqBy; - -// node_modules/@chevrotain/utils/lib/src/print.js -function PRINT_ERROR(msg) { - if (console && console.error) { - console.error(`Error: ${msg}`); - } -} -function PRINT_WARNING(msg) { - if (console && console.warn) { - console.warn(`Warning: ${msg}`); - } -} - -// node_modules/@chevrotain/utils/lib/src/timer.js -function timer(func) { - const start = (/* @__PURE__ */ new Date()).getTime(); - const val = func(); - const end = (/* @__PURE__ */ new Date()).getTime(); - const total = end - start; - return { time: total, value: val }; -} - -// node_modules/@chevrotain/utils/lib/src/to-fast-properties.js -function toFastProperties(toBecomeFast) { - function FakeConstructor() { - } - FakeConstructor.prototype = toBecomeFast; - const fakeInstance = new FakeConstructor(); - function fakeAccess() { - return typeof fakeInstance.bar; - } - fakeAccess(); - fakeAccess(); - if (1) - return toBecomeFast; - (0, eval)(toBecomeFast); -} - -// node_modules/@chevrotain/gast/lib/src/model.js -function tokenLabel(tokType) { - if (hasTokenLabel(tokType)) { - return tokType.LABEL; - } else { - return tokType.name; - } -} -function hasTokenLabel(obj) { - return isString_default(obj.LABEL) && obj.LABEL !== ""; -} -var AbstractProduction = class { - get definition() { - return this._definition; - } - set definition(value) { - this._definition = value; - } - constructor(_definition) { - this._definition = _definition; - } - accept(visitor2) { - visitor2.visit(this); - forEach_default(this.definition, (prod) => { - prod.accept(visitor2); - }); - } -}; -var NonTerminal = class extends AbstractProduction { - constructor(options) { - super([]); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } - set definition(definition) { - } - get definition() { - if (this.referencedRule !== void 0) { - return this.referencedRule.definition; - } - return []; - } - accept(visitor2) { - visitor2.visit(this); - } -}; -var Rule = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.orgText = ""; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var Alternative = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.ignoreAmbiguities = false; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var Option = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var RepetitionMandatory = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var RepetitionMandatoryWithSeparator = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var Repetition = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var RepetitionWithSeparator = class extends AbstractProduction { - constructor(options) { - super(options.definition); - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var Alternation = class extends AbstractProduction { - get definition() { - return this._definition; - } - set definition(value) { - this._definition = value; - } - constructor(options) { - super(options.definition); - this.idx = 1; - this.ignoreAmbiguities = false; - this.hasPredicates = false; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } -}; -var Terminal = class { - constructor(options) { - this.idx = 1; - assign_default(this, pickBy_default(options, (v) => v !== void 0)); - } - accept(visitor2) { - visitor2.visit(this); - } -}; -function serializeGrammar(topRules) { - return map_default(topRules, serializeProduction); -} -function serializeProduction(node) { - function convertDefinition(definition) { - return map_default(definition, serializeProduction); - } - if (node instanceof NonTerminal) { - const serializedNonTerminal = { - type: "NonTerminal", - name: node.nonTerminalName, - idx: node.idx - }; - if (isString_default(node.label)) { - serializedNonTerminal.label = node.label; - } - return serializedNonTerminal; - } else if (node instanceof Alternative) { - return { - type: "Alternative", - definition: convertDefinition(node.definition) - }; - } else if (node instanceof Option) { - return { - type: "Option", - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } else if (node instanceof RepetitionMandatory) { - return { - type: "RepetitionMandatory", - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } else if (node instanceof RepetitionMandatoryWithSeparator) { - return { - type: "RepetitionMandatoryWithSeparator", - idx: node.idx, - separator: serializeProduction(new Terminal({ terminalType: node.separator })), - definition: convertDefinition(node.definition) - }; - } else if (node instanceof RepetitionWithSeparator) { - return { - type: "RepetitionWithSeparator", - idx: node.idx, - separator: serializeProduction(new Terminal({ terminalType: node.separator })), - definition: convertDefinition(node.definition) - }; - } else if (node instanceof Repetition) { - return { - type: "Repetition", - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } else if (node instanceof Alternation) { - return { - type: "Alternation", - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } else if (node instanceof Terminal) { - const serializedTerminal = { - type: "Terminal", - name: node.terminalType.name, - label: tokenLabel(node.terminalType), - idx: node.idx - }; - if (isString_default(node.label)) { - serializedTerminal.terminalLabel = node.label; - } - const pattern = node.terminalType.PATTERN; - if (node.terminalType.PATTERN) { - serializedTerminal.pattern = isRegExp_default(pattern) ? pattern.source : pattern; - } - return serializedTerminal; - } else if (node instanceof Rule) { - return { - type: "Rule", - name: node.name, - orgText: node.orgText, - definition: convertDefinition(node.definition) - }; - } else { - throw Error("non exhaustive match"); - } -} - -// node_modules/@chevrotain/gast/lib/src/visitor.js -var GAstVisitor = class { - visit(node) { - const nodeAny = node; - switch (nodeAny.constructor) { - case NonTerminal: - return this.visitNonTerminal(nodeAny); - case Alternative: - return this.visitAlternative(nodeAny); - case Option: - return this.visitOption(nodeAny); - case RepetitionMandatory: - return this.visitRepetitionMandatory(nodeAny); - case RepetitionMandatoryWithSeparator: - return this.visitRepetitionMandatoryWithSeparator(nodeAny); - case RepetitionWithSeparator: - return this.visitRepetitionWithSeparator(nodeAny); - case Repetition: - return this.visitRepetition(nodeAny); - case Alternation: - return this.visitAlternation(nodeAny); - case Terminal: - return this.visitTerminal(nodeAny); - case Rule: - return this.visitRule(nodeAny); - default: - throw Error("non exhaustive match"); - } - } - /* c8 ignore next */ - visitNonTerminal(node) { - } - /* c8 ignore next */ - visitAlternative(node) { - } - /* c8 ignore next */ - visitOption(node) { - } - /* c8 ignore next */ - visitRepetition(node) { - } - /* c8 ignore next */ - visitRepetitionMandatory(node) { - } - /* c8 ignore next 3 */ - visitRepetitionMandatoryWithSeparator(node) { - } - /* c8 ignore next */ - visitRepetitionWithSeparator(node) { - } - /* c8 ignore next */ - visitAlternation(node) { - } - /* c8 ignore next */ - visitTerminal(node) { - } - /* c8 ignore next */ - visitRule(node) { - } -}; - -// node_modules/@chevrotain/gast/lib/src/helpers.js -function isSequenceProd(prod) { - return prod instanceof Alternative || prod instanceof Option || prod instanceof Repetition || prod instanceof RepetitionMandatory || prod instanceof RepetitionMandatoryWithSeparator || prod instanceof RepetitionWithSeparator || prod instanceof Terminal || prod instanceof Rule; -} -function isOptionalProd(prod, alreadyVisited = []) { - const isDirectlyOptional = prod instanceof Option || prod instanceof Repetition || prod instanceof RepetitionWithSeparator; - if (isDirectlyOptional) { - return true; - } - if (prod instanceof Alternation) { - return some_default(prod.definition, (subProd) => { - return isOptionalProd(subProd, alreadyVisited); - }); - } else if (prod instanceof NonTerminal && includes_default(alreadyVisited, prod)) { - return false; - } else if (prod instanceof AbstractProduction) { - if (prod instanceof NonTerminal) { - alreadyVisited.push(prod); - } - return every_default(prod.definition, (subProd) => { - return isOptionalProd(subProd, alreadyVisited); - }); - } else { - return false; - } -} -function isBranchingProd(prod) { - return prod instanceof Alternation; -} -function getProductionDslName(prod) { - if (prod instanceof NonTerminal) { - return "SUBRULE"; - } else if (prod instanceof Option) { - return "OPTION"; - } else if (prod instanceof Alternation) { - return "OR"; - } else if (prod instanceof RepetitionMandatory) { - return "AT_LEAST_ONE"; - } else if (prod instanceof RepetitionMandatoryWithSeparator) { - return "AT_LEAST_ONE_SEP"; - } else if (prod instanceof RepetitionWithSeparator) { - return "MANY_SEP"; - } else if (prod instanceof Repetition) { - return "MANY"; - } else if (prod instanceof Terminal) { - return "CONSUME"; - } else { - throw Error("non exhaustive match"); - } -} - -// node_modules/chevrotain/lib/src/parse/grammar/rest.js -var RestWalker = class { - walk(prod, prevRest = []) { - forEach_default(prod.definition, (subProd, index) => { - const currRest = drop_default(prod.definition, index + 1); - if (subProd instanceof NonTerminal) { - this.walkProdRef(subProd, currRest, prevRest); - } else if (subProd instanceof Terminal) { - this.walkTerminal(subProd, currRest, prevRest); - } else if (subProd instanceof Alternative) { - this.walkFlat(subProd, currRest, prevRest); - } else if (subProd instanceof Option) { - this.walkOption(subProd, currRest, prevRest); - } else if (subProd instanceof RepetitionMandatory) { - this.walkAtLeastOne(subProd, currRest, prevRest); - } else if (subProd instanceof RepetitionMandatoryWithSeparator) { - this.walkAtLeastOneSep(subProd, currRest, prevRest); - } else if (subProd instanceof RepetitionWithSeparator) { - this.walkManySep(subProd, currRest, prevRest); - } else if (subProd instanceof Repetition) { - this.walkMany(subProd, currRest, prevRest); - } else if (subProd instanceof Alternation) { - this.walkOr(subProd, currRest, prevRest); - } else { - throw Error("non exhaustive match"); - } - }); - } - walkTerminal(terminal, currRest, prevRest) { - } - walkProdRef(refProd, currRest, prevRest) { - } - walkFlat(flatProd, currRest, prevRest) { - const fullOrRest = currRest.concat(prevRest); - this.walk(flatProd, fullOrRest); - } - walkOption(optionProd, currRest, prevRest) { - const fullOrRest = currRest.concat(prevRest); - this.walk(optionProd, fullOrRest); - } - walkAtLeastOne(atLeastOneProd, currRest, prevRest) { - const fullAtLeastOneRest = [ - new Option({ definition: atLeastOneProd.definition }) - ].concat(currRest, prevRest); - this.walk(atLeastOneProd, fullAtLeastOneRest); - } - walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) { - const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest); - this.walk(atLeastOneSepProd, fullAtLeastOneSepRest); - } - walkMany(manyProd, currRest, prevRest) { - const fullManyRest = [ - new Option({ definition: manyProd.definition }) - ].concat(currRest, prevRest); - this.walk(manyProd, fullManyRest); - } - walkManySep(manySepProd, currRest, prevRest) { - const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest); - this.walk(manySepProd, fullManySepRest); - } - walkOr(orProd, currRest, prevRest) { - const fullOrRest = currRest.concat(prevRest); - forEach_default(orProd.definition, (alt) => { - const prodWrapper = new Alternative({ definition: [alt] }); - this.walk(prodWrapper, fullOrRest); - }); - } -}; -function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) { - const repSepRest = [ - new Option({ - definition: [ - new Terminal({ terminalType: repSepProd.separator }) - ].concat(repSepProd.definition) - }) - ]; - const fullRepSepRest = repSepRest.concat(currRest, prevRest); - return fullRepSepRest; -} - -// node_modules/chevrotain/lib/src/parse/grammar/first.js -function first(prod) { - if (prod instanceof NonTerminal) { - return first(prod.referencedRule); - } else if (prod instanceof Terminal) { - return firstForTerminal(prod); - } else if (isSequenceProd(prod)) { - return firstForSequence(prod); - } else if (isBranchingProd(prod)) { - return firstForBranching(prod); - } else { - throw Error("non exhaustive match"); - } -} -function firstForSequence(prod) { - let firstSet = []; - const seq = prod.definition; - let nextSubProdIdx = 0; - let hasInnerProdsRemaining = seq.length > nextSubProdIdx; - let currSubProd; - let isLastInnerProdOptional = true; - while (hasInnerProdsRemaining && isLastInnerProdOptional) { - currSubProd = seq[nextSubProdIdx]; - isLastInnerProdOptional = isOptionalProd(currSubProd); - firstSet = firstSet.concat(first(currSubProd)); - nextSubProdIdx = nextSubProdIdx + 1; - hasInnerProdsRemaining = seq.length > nextSubProdIdx; - } - return uniq_default(firstSet); -} -function firstForBranching(prod) { - const allAlternativesFirsts = map_default(prod.definition, (innerProd) => { - return first(innerProd); - }); - return uniq_default(flatten_default(allAlternativesFirsts)); -} -function firstForTerminal(terminal) { - return [terminal.terminalType]; -} - -// node_modules/chevrotain/lib/src/parse/constants.js -var IN = "_~IN~_"; - -// node_modules/chevrotain/lib/src/parse/grammar/follow.js -var ResyncFollowsWalker = class extends RestWalker { - constructor(topProd) { - super(); - this.topProd = topProd; - this.follows = {}; - } - startWalking() { - this.walk(this.topProd); - return this.follows; - } - walkTerminal(terminal, currRest, prevRest) { - } - walkProdRef(refProd, currRest, prevRest) { - const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name; - const fullRest = currRest.concat(prevRest); - const restProd = new Alternative({ definition: fullRest }); - const t_in_topProd_follows = first(restProd); - this.follows[followName] = t_in_topProd_follows; - } -}; -function computeAllProdsFollows(topProductions) { - const reSyncFollows = {}; - forEach_default(topProductions, (topProd) => { - const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking(); - assign_default(reSyncFollows, currRefsFollow); - }); - return reSyncFollows; -} -function buildBetweenProdsFollowPrefix(inner, occurenceInParent) { - return inner.name + occurenceInParent + IN; -} - -// node_modules/chevrotain/lib/src/scan/reg_exp_parser.js -var regExpAstCache = {}; -var regExpParser = new RegExpParser(); -function getRegExpAst(regExp) { - const regExpStr = regExp.toString(); - if (regExpAstCache.hasOwnProperty(regExpStr)) { - return regExpAstCache[regExpStr]; - } else { - const regExpAst = regExpParser.pattern(regExpStr); - regExpAstCache[regExpStr] = regExpAst; - return regExpAst; - } -} -function clearRegExpParserCache() { - regExpAstCache = {}; -} - -// node_modules/chevrotain/lib/src/scan/reg_exp.js -var complementErrorMessage = "Complement Sets are not supported for first char optimization"; -var failedOptimizationPrefixMsg = 'Unable to use "first char" lexer optimizations:\n'; -function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) { - try { - const ast = getRegExpAst(regExp); - const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase); - return firstChars; - } catch (e) { - if (e.message === complementErrorMessage) { - if (ensureOptimizations) { - PRINT_WARNING(`${failedOptimizationPrefixMsg} Unable to optimize: < ${regExp.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 msgSuffix = ""; - if (ensureOptimizations) { - msgSuffix = "\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."; - } - PRINT_ERROR(`${failedOptimizationPrefixMsg} - Failed parsing: < ${regExp.toString()} > - Using the @chevrotain/regexp-to-ast library - Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + msgSuffix); - } - } - return []; -} -function firstCharOptimizedIndices(ast, result, ignoreCase) { - switch (ast.type) { - case "Disjunction": - for (let i = 0; i < ast.value.length; i++) { - firstCharOptimizedIndices(ast.value[i], result, ignoreCase); - } - break; - case "Alternative": - const terms = ast.value; - for (let i = 0; i < terms.length; i++) { - const term = terms[i]; - switch (term.type) { - case "EndAnchor": - case "GroupBackReference": - case "Lookahead": - case "NegativeLookahead": - case "StartAnchor": - case "WordBoundary": - case "NonWordBoundary": - continue; - } - const atom2 = term; - switch (atom2.type) { - case "Character": - addOptimizedIdxToResult(atom2.value, result, ignoreCase); - break; - case "Set": - if (atom2.complement === true) { - throw Error(complementErrorMessage); - } - forEach_default(atom2.value, (code) => { - if (typeof code === "number") { - addOptimizedIdxToResult(code, result, ignoreCase); - } else { - const range = code; - if (ignoreCase === true) { - for (let rangeCode = range.from; rangeCode <= range.to; rangeCode++) { - addOptimizedIdxToResult(rangeCode, result, ignoreCase); - } - } else { - for (let rangeCode = range.from; rangeCode <= range.to && rangeCode < minOptimizationVal; rangeCode++) { - addOptimizedIdxToResult(rangeCode, result, ignoreCase); - } - if (range.to >= minOptimizationVal) { - const minUnOptVal = range.from >= minOptimizationVal ? range.from : minOptimizationVal; - const maxUnOptVal = range.to; - const minOptIdx = charCodeToOptimizedIndex(minUnOptVal); - const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal); - for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) { - result[currOptIdx] = currOptIdx; - } - } - } - } - }); - break; - case "Group": - firstCharOptimizedIndices(atom2.value, result, ignoreCase); - break; - default: - throw Error("Non Exhaustive Match"); - } - const isOptionalQuantifier = atom2.quantifier !== void 0 && atom2.quantifier.atLeast === 0; - if ( - // A group may be optional due to empty contents /(?:)/ - // or if everything inside it is optional /((a)?)/ - atom2.type === "Group" && isWholeOptional(atom2) === false || // If this term is not a group it may only be optional if it has an optional quantifier - atom2.type !== "Group" && isOptionalQuantifier === false - ) { - break; - } - } - break; - default: - throw Error("non exhaustive match!"); - } - return values_default(result); -} -function addOptimizedIdxToResult(code, result, ignoreCase) { - const optimizedCharIdx = charCodeToOptimizedIndex(code); - result[optimizedCharIdx] = optimizedCharIdx; - if (ignoreCase === true) { - handleIgnoreCase(code, result); - } -} -function handleIgnoreCase(code, result) { - const char = String.fromCharCode(code); - const upperChar = char.toUpperCase(); - if (upperChar !== char) { - const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0)); - result[optimizedCharIdx] = optimizedCharIdx; - } else { - const lowerChar = char.toLowerCase(); - if (lowerChar !== char) { - const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0)); - result[optimizedCharIdx] = optimizedCharIdx; - } - } -} -function findCode(setNode, targetCharCodes) { - return find_default(setNode.value, (codeOrRange) => { - if (typeof codeOrRange === "number") { - return includes_default(targetCharCodes, codeOrRange); - } else { - const range = codeOrRange; - return find_default(targetCharCodes, (targetCode) => range.from <= targetCode && targetCode <= range.to) !== void 0; - } - }); -} -function isWholeOptional(ast) { - const quantifier = ast.quantifier; - if (quantifier && quantifier.atLeast === 0) { - return true; - } - if (!ast.value) { - return false; - } - return isArray_default(ast.value) ? every_default(ast.value, isWholeOptional) : isWholeOptional(ast.value); -} -var CharCodeFinder = class extends BaseRegExpVisitor { - constructor(targetCharCodes) { - super(); - this.targetCharCodes = targetCharCodes; - this.found = false; - } - visitChildren(node) { - if (this.found === true) { - return; - } - switch (node.type) { - case "Lookahead": - this.visitLookahead(node); - return; - case "NegativeLookahead": - this.visitNegativeLookahead(node); - return; - } - super.visitChildren(node); - } - visitCharacter(node) { - if (includes_default(this.targetCharCodes, node.value)) { - this.found = true; - } - } - visitSet(node) { - if (node.complement) { - if (findCode(node, this.targetCharCodes) === void 0) { - this.found = true; - } - } else { - if (findCode(node, this.targetCharCodes) !== void 0) { - this.found = true; - } - } - } -}; -function canMatchCharCode(charCodes, pattern) { - if (pattern instanceof RegExp) { - const ast = getRegExpAst(pattern); - const charCodeFinder = new CharCodeFinder(charCodes); - charCodeFinder.visit(ast); - return charCodeFinder.found; - } else { - return find_default(pattern, (char) => { - return includes_default(charCodes, char.charCodeAt(0)); - }) !== void 0; - } -} - -// node_modules/chevrotain/lib/src/scan/lexer.js -var PATTERN = "PATTERN"; -var DEFAULT_MODE = "defaultMode"; -var MODES = "modes"; -var SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean"; -function analyzeTokenTypes(tokenTypes, options) { - options = defaults_default(options, { - useSticky: SUPPORT_STICKY, - debug: false, - safeMode: false, - positionTracking: "full", - lineTerminatorCharacters: ["\r", "\n"], - tracer: (msg, action) => action() - }); - const tracer = options.tracer; - tracer("initCharCodeToOptimizedIndexMap", () => { - initCharCodeToOptimizedIndexMap(); - }); - let onlyRelevantTypes; - tracer("Reject Lexer.NA", () => { - onlyRelevantTypes = reject_default(tokenTypes, (currType) => { - return currType[PATTERN] === Lexer.NA; - }); - }); - let hasCustom = false; - let allTransformedPatterns; - tracer("Transform Patterns", () => { - hasCustom = false; - allTransformedPatterns = map_default(onlyRelevantTypes, (currType) => { - const currPattern = currType[PATTERN]; - if (isRegExp_default(currPattern)) { - const regExpSource = currPattern.source; - if (regExpSource.length === 1 && // only these regExp meta characters which can appear in a length one regExp - regExpSource !== "^" && regExpSource !== "$" && regExpSource !== "." && !currPattern.ignoreCase) { - return regExpSource; - } else if (regExpSource.length === 2 && regExpSource[0] === "\\" && // not a meta character - !includes_default([ - "d", - "D", - "s", - "S", - "t", - "r", - "n", - "t", - "0", - "c", - "b", - "B", - "f", - "v", - "w", - "W" - ], regExpSource[1])) { - return regExpSource[1]; - } else { - return options.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern); - } - } else if (isFunction_default(currPattern)) { - hasCustom = true; - return { exec: currPattern }; - } else if (typeof currPattern === "object") { - hasCustom = true; - return currPattern; - } else if (typeof currPattern === "string") { - if (currPattern.length === 1) { - return currPattern; - } else { - const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&"); - const wrappedRegExp = new RegExp(escapedRegExpString); - return options.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp); - } - } else { - throw Error("non exhaustive match"); - } - }); - }); - let patternIdxToType; - let patternIdxToGroup; - let patternIdxToLongerAltIdxArr; - let patternIdxToPushMode; - let patternIdxToPopMode; - tracer("misc mapping", () => { - patternIdxToType = map_default(onlyRelevantTypes, (currType) => currType.tokenTypeIdx); - patternIdxToGroup = map_default(onlyRelevantTypes, (clazz) => { - const groupName = clazz.GROUP; - if (groupName === Lexer.SKIPPED) { - return void 0; - } else if (isString_default(groupName)) { - return groupName; - } else if (isUndefined_default(groupName)) { - return false; - } else { - throw Error("non exhaustive match"); - } - }); - patternIdxToLongerAltIdxArr = map_default(onlyRelevantTypes, (clazz) => { - const longerAltType = clazz.LONGER_ALT; - if (longerAltType) { - const longerAltIdxArr = isArray_default(longerAltType) ? map_default(longerAltType, (type) => indexOf_default(onlyRelevantTypes, type)) : [indexOf_default(onlyRelevantTypes, longerAltType)]; - return longerAltIdxArr; - } - }); - patternIdxToPushMode = map_default(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE); - patternIdxToPopMode = map_default(onlyRelevantTypes, (clazz) => has_default(clazz, "POP_MODE")); - }); - let patternIdxToCanLineTerminator; - tracer("Line Terminator Handling", () => { - const lineTerminatorCharCodes = getCharCodes(options.lineTerminatorCharacters); - patternIdxToCanLineTerminator = map_default(onlyRelevantTypes, (tokType) => false); - if (options.positionTracking !== "onlyOffset") { - patternIdxToCanLineTerminator = map_default(onlyRelevantTypes, (tokType) => { - if (has_default(tokType, "LINE_BREAKS")) { - return !!tokType.LINE_BREAKS; - } else { - return checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false && canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN); - } - }); - } - }); - let patternIdxToIsCustom; - let patternIdxToShort; - let emptyGroups; - let patternIdxToConfig; - tracer("Misc Mapping #2", () => { - patternIdxToIsCustom = map_default(onlyRelevantTypes, isCustomPattern); - patternIdxToShort = map_default(allTransformedPatterns, isShortPattern); - emptyGroups = reduce_default(onlyRelevantTypes, (acc, clazz) => { - const groupName = clazz.GROUP; - if (isString_default(groupName) && !(groupName === Lexer.SKIPPED)) { - acc[groupName] = []; - } - return acc; - }, {}); - patternIdxToConfig = map_default(allTransformedPatterns, (x, idx) => { - return { - pattern: allTransformedPatterns[idx], - longerAlt: patternIdxToLongerAltIdxArr[idx], - canLineTerminator: patternIdxToCanLineTerminator[idx], - isCustom: patternIdxToIsCustom[idx], - short: patternIdxToShort[idx], - group: patternIdxToGroup[idx], - push: patternIdxToPushMode[idx], - pop: patternIdxToPopMode[idx], - tokenTypeIdx: patternIdxToType[idx], - tokenType: onlyRelevantTypes[idx] - }; - }); - }); - let canBeOptimized = true; - let charCodeToPatternIdxToConfig = []; - if (!options.safeMode) { - tracer("First Char Optimization", () => { - charCodeToPatternIdxToConfig = reduce_default(onlyRelevantTypes, (result, currTokType, idx) => { - if (typeof currTokType.PATTERN === "string") { - const charCode = currTokType.PATTERN.charCodeAt(0); - const optimizedIdx = charCodeToOptimizedIndex(charCode); - addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]); - } else if (isArray_default(currTokType.START_CHARS_HINT)) { - let lastOptimizedIdx; - forEach_default(currTokType.START_CHARS_HINT, (charOrInt) => { - const charCode = typeof charOrInt === "string" ? charOrInt.charCodeAt(0) : charOrInt; - const currOptimizedIdx = charCodeToOptimizedIndex(charCode); - if (lastOptimizedIdx !== currOptimizedIdx) { - lastOptimizedIdx = currOptimizedIdx; - addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx]); - } - }); - } else if (isRegExp_default(currTokType.PATTERN)) { - if (currTokType.PATTERN.unicode) { - canBeOptimized = false; - if (options.ensureOptimizations) { - PRINT_ERROR(`${failedOptimizationPrefixMsg} Unable to analyze < ${currTokType.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 { - const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options.ensureOptimizations); - if (isEmpty_default(optimizedCodes)) { - canBeOptimized = false; - } - forEach_default(optimizedCodes, (code) => { - addToMapOfArrays(result, code, patternIdxToConfig[idx]); - }); - } - } else { - if (options.ensureOptimizations) { - PRINT_ERROR(`${failedOptimizationPrefixMsg} TokenType: <${currTokType.name}> is using a custom token pattern without providing parameter. - This will disable the lexer's first char optimizations. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`); - } - canBeOptimized = false; - } - return result; - }, []); - }); - } - return { - emptyGroups, - patternIdxToConfig, - charCodeToPatternIdxToConfig, - hasCustom, - canBeOptimized - }; -} -function validatePatterns(tokenTypes, validModesNames) { - let errors = []; - const missingResult = findMissingPatterns(tokenTypes); - errors = errors.concat(missingResult.errors); - const invalidResult = findInvalidPatterns(missingResult.valid); - const validTokenTypes = invalidResult.valid; - errors = errors.concat(invalidResult.errors); - errors = errors.concat(validateRegExpPattern(validTokenTypes)); - errors = errors.concat(findInvalidGroupType(validTokenTypes)); - errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames)); - errors = errors.concat(findUnreachablePatterns(validTokenTypes)); - return errors; -} -function validateRegExpPattern(tokenTypes) { - let errors = []; - const withRegExpPatterns = filter_default(tokenTypes, (currTokType) => isRegExp_default(currTokType[PATTERN])); - errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns)); - errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns)); - errors = errors.concat(findUnsupportedFlags(withRegExpPatterns)); - errors = errors.concat(findDuplicatePatterns(withRegExpPatterns)); - errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns)); - return errors; -} -function findMissingPatterns(tokenTypes) { - const tokenTypesWithMissingPattern = filter_default(tokenTypes, (currType) => { - return !has_default(currType, PATTERN); - }); - const errors = map_default(tokenTypesWithMissingPattern, (currType) => { - return { - message: "Token Type: ->" + currType.name + "<- missing static 'PATTERN' property", - type: LexerDefinitionErrorType.MISSING_PATTERN, - tokenTypes: [currType] - }; - }); - const valid = difference_default(tokenTypes, tokenTypesWithMissingPattern); - return { errors, valid }; -} -function findInvalidPatterns(tokenTypes) { - const tokenTypesWithInvalidPattern = filter_default(tokenTypes, (currType) => { - const pattern = currType[PATTERN]; - return !isRegExp_default(pattern) && !isFunction_default(pattern) && !has_default(pattern, "exec") && !isString_default(pattern); - }); - const errors = map_default(tokenTypesWithInvalidPattern, (currType) => { - return { - message: "Token Type: ->" + currType.name + "<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.", - type: LexerDefinitionErrorType.INVALID_PATTERN, - tokenTypes: [currType] - }; - }); - const valid = difference_default(tokenTypes, tokenTypesWithInvalidPattern); - return { errors, valid }; -} -var end_of_input = /[^\\][$]/; -function findEndOfInputAnchor(tokenTypes) { - class EndAnchorFinder extends BaseRegExpVisitor { - constructor() { - super(...arguments); - this.found = false; - } - visitEndAnchor(node) { - this.found = true; - } - } - const invalidRegex = filter_default(tokenTypes, (currType) => { - const pattern = currType.PATTERN; - try { - const regexpAst = getRegExpAst(pattern); - const endAnchorVisitor = new EndAnchorFinder(); - endAnchorVisitor.visit(regexpAst); - return endAnchorVisitor.found; - } catch (e) { - return end_of_input.test(pattern.source); - } - }); - const errors = map_default(invalidRegex, (currType) => { - return { - message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.", - type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND, - tokenTypes: [currType] - }; - }); - return errors; -} -function findEmptyMatchRegExps(tokenTypes) { - const matchesEmptyString = filter_default(tokenTypes, (currType) => { - const pattern = currType.PATTERN; - return pattern.test(""); - }); - const errors = map_default(matchesEmptyString, (currType) => { - return { - message: "Token Type: ->" + currType.name + "<- static 'PATTERN' must not match an empty string", - type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN, - tokenTypes: [currType] - }; - }); - return errors; -} -var start_of_input = /[^\\[][\^]|^\^/; -function findStartOfInputAnchor(tokenTypes) { - class StartAnchorFinder extends BaseRegExpVisitor { - constructor() { - super(...arguments); - this.found = false; - } - visitStartAnchor(node) { - this.found = true; - } - } - const invalidRegex = filter_default(tokenTypes, (currType) => { - const pattern = currType.PATTERN; - try { - const regexpAst = getRegExpAst(pattern); - const startAnchorVisitor = new StartAnchorFinder(); - startAnchorVisitor.visit(regexpAst); - return startAnchorVisitor.found; - } catch (e) { - return start_of_input.test(pattern.source); - } - }); - const errors = map_default(invalidRegex, (currType) => { - return { - message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.", - type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND, - tokenTypes: [currType] - }; - }); - return errors; -} -function findUnsupportedFlags(tokenTypes) { - const invalidFlags = filter_default(tokenTypes, (currType) => { - const pattern = currType[PATTERN]; - return pattern instanceof RegExp && (pattern.multiline || pattern.global); - }); - const errors = map_default(invalidFlags, (currType) => { - return { - message: "Token Type: ->" + currType.name + "<- static 'PATTERN' may NOT contain global('g') or multiline('m')", - type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND, - tokenTypes: [currType] - }; - }); - return errors; -} -function findDuplicatePatterns(tokenTypes) { - const found = []; - let identicalPatterns = map_default(tokenTypes, (outerType) => { - return reduce_default(tokenTypes, (result, innerType) => { - if (outerType.PATTERN.source === innerType.PATTERN.source && !includes_default(found, innerType) && innerType.PATTERN !== Lexer.NA) { - found.push(innerType); - result.push(innerType); - return result; - } - return result; - }, []); - }); - identicalPatterns = compact_default(identicalPatterns); - const duplicatePatterns = filter_default(identicalPatterns, (currIdenticalSet) => { - return currIdenticalSet.length > 1; - }); - const errors = map_default(duplicatePatterns, (setOfIdentical) => { - const tokenTypeNames = map_default(setOfIdentical, (currType) => { - return currType.name; - }); - const dupPatternSrc = head_default(setOfIdentical).PATTERN; - return { - message: `The same RegExp pattern ->${dupPatternSrc}<-has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`, - type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND, - tokenTypes: setOfIdentical - }; - }); - return errors; -} -function findInvalidGroupType(tokenTypes) { - const invalidTypes = filter_default(tokenTypes, (clazz) => { - if (!has_default(clazz, "GROUP")) { - return false; - } - const group = clazz.GROUP; - return group !== Lexer.SKIPPED && group !== Lexer.NA && !isString_default(group); - }); - const errors = map_default(invalidTypes, (currType) => { - return { - message: "Token Type: ->" + currType.name + "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String", - type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND, - tokenTypes: [currType] - }; - }); - return errors; -} -function findModesThatDoNotExist(tokenTypes, validModes) { - const invalidModes = filter_default(tokenTypes, (clazz) => { - return clazz.PUSH_MODE !== void 0 && !includes_default(validModes, clazz.PUSH_MODE); - }); - const errors = map_default(invalidModes, (tokType) => { - const msg = `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-which does not exist`; - return { - message: msg, - type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST, - tokenTypes: [tokType] - }; - }); - return errors; -} -function findUnreachablePatterns(tokenTypes) { - const errors = []; - const canBeTested = reduce_default(tokenTypes, (result, tokType, idx) => { - const pattern = tokType.PATTERN; - if (pattern === Lexer.NA) { - return result; - } - if (isString_default(pattern)) { - result.push({ str: pattern, idx, tokenType: tokType }); - } else if (isRegExp_default(pattern) && noMetaChar(pattern)) { - result.push({ str: pattern.source, idx, tokenType: tokType }); - } - return result; - }, []); - forEach_default(tokenTypes, (tokType, testIdx) => { - forEach_default(canBeTested, ({ str, idx, tokenType }) => { - if (testIdx < idx && testTokenType(str, tokType.PATTERN)) { - const msg = `Token: ->${tokenType.name}<- can never be matched. -Because it appears AFTER the Token Type ->${tokType.name}<-in the lexer's definition. -See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`; - errors.push({ - message: msg, - type: LexerDefinitionErrorType.UNREACHABLE_PATTERN, - tokenTypes: [tokType, tokenType] - }); - } - }); - }); - return errors; -} -function testTokenType(str, pattern) { - if (isRegExp_default(pattern)) { - const regExpArray = pattern.exec(str); - return regExpArray !== null && regExpArray.index === 0; - } else if (isFunction_default(pattern)) { - return pattern(str, 0, [], {}); - } else if (has_default(pattern, "exec")) { - return pattern.exec(str, 0, [], {}); - } else if (typeof pattern === "string") { - return pattern === str; - } else { - throw Error("non exhaustive match"); - } -} -function noMetaChar(regExp) { - const metaChars = [ - ".", - "\\", - "[", - "]", - "|", - "^", - "$", - "(", - ")", - "?", - "*", - "+", - "{" - ]; - return find_default(metaChars, (char) => regExp.source.indexOf(char) !== -1) === void 0; -} -function addStartOfInput(pattern) { - const flags = pattern.ignoreCase ? "i" : ""; - return new RegExp(`^(?:${pattern.source})`, flags); -} -function addStickyFlag(pattern) { - const flags = pattern.ignoreCase ? "iy" : "y"; - return new RegExp(`${pattern.source}`, flags); -} -function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) { - const errors = []; - if (!has_default(lexerDefinition, DEFAULT_MODE)) { - errors.push({ - message: "A MultiMode Lexer cannot be initialized without a <" + DEFAULT_MODE + "> property in its definition\n", - type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE - }); - } - if (!has_default(lexerDefinition, MODES)) { - errors.push({ - message: "A MultiMode Lexer cannot be initialized without a <" + MODES + "> property in its definition\n", - type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY - }); - } - if (has_default(lexerDefinition, MODES) && has_default(lexerDefinition, DEFAULT_MODE) && !has_default(lexerDefinition.modes, lexerDefinition.defaultMode)) { - errors.push({ - message: `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>which does not exist -`, - type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST - }); - } - if (has_default(lexerDefinition, MODES)) { - forEach_default(lexerDefinition.modes, (currModeValue, currModeName) => { - forEach_default(currModeValue, (currTokType, currIdx) => { - if (isUndefined_default(currTokType)) { - errors.push({ - message: `A Lexer cannot be initialized using an undefined Token Type. Mode:<${currModeName}> at index: <${currIdx}> -`, - type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED - }); - } else if (has_default(currTokType, "LONGER_ALT")) { - const longerAlt = isArray_default(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT]; - forEach_default(longerAlt, (currLongerAlt) => { - if (!isUndefined_default(currLongerAlt) && !includes_default(currModeValue, currLongerAlt)) { - errors.push({ - message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}> -`, - type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE - }); - } - }); - } - }); - }); - } - return errors; -} -function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) { - const warnings = []; - let hasAnyLineBreak = false; - const allTokenTypes = compact_default(flatten_default(values_default(lexerDefinition.modes))); - const concreteTokenTypes = reject_default(allTokenTypes, (currType) => currType[PATTERN] === Lexer.NA); - const terminatorCharCodes = getCharCodes(lineTerminatorCharacters); - if (trackLines) { - forEach_default(concreteTokenTypes, (tokType) => { - const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes); - if (currIssue !== false) { - const message = buildLineBreakIssueMessage(tokType, currIssue); - const warningDescriptor = { - message, - type: currIssue.issue, - tokenType: tokType - }; - warnings.push(warningDescriptor); - } else { - if (has_default(tokType, "LINE_BREAKS")) { - if (tokType.LINE_BREAKS === true) { - hasAnyLineBreak = true; - } - } else { - if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) { - hasAnyLineBreak = true; - } - } - } - }); - } - if (trackLines && !hasAnyLineBreak) { - warnings.push({ - message: "Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.", - type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS - }); - } - return warnings; -} -function cloneEmptyGroups(emptyGroups) { - const clonedResult = {}; - const groupKeys = keys_default(emptyGroups); - forEach_default(groupKeys, (currKey) => { - const currGroupValue = emptyGroups[currKey]; - if (isArray_default(currGroupValue)) { - clonedResult[currKey] = []; - } else { - throw Error("non exhaustive match"); - } - }); - return clonedResult; -} -function isCustomPattern(tokenType) { - const pattern = tokenType.PATTERN; - if (isRegExp_default(pattern)) { - return false; - } else if (isFunction_default(pattern)) { - return true; - } else if (has_default(pattern, "exec")) { - return true; - } else if (isString_default(pattern)) { - return false; - } else { - throw Error("non exhaustive match"); - } -} -function isShortPattern(pattern) { - if (isString_default(pattern) && pattern.length === 1) { - return pattern.charCodeAt(0); - } else { - return false; - } -} -var LineTerminatorOptimizedTester = { - // implements /\n|\r\n?/g.test - test: function(text) { - const len = text.length; - for (let i = this.lastIndex; i < len; i++) { - const c = text.charCodeAt(i); - if (c === 10) { - this.lastIndex = i + 1; - return true; - } else if (c === 13) { - if (text.charCodeAt(i + 1) === 10) { - this.lastIndex = i + 2; - } else { - this.lastIndex = i + 1; - } - return true; - } - } - return false; - }, - lastIndex: 0 -}; -function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) { - if (has_default(tokType, "LINE_BREAKS")) { - return false; - } else { - if (isRegExp_default(tokType.PATTERN)) { - try { - canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN); - } catch (e) { - return { - issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR, - errMsg: e.message - }; - } - return false; - } else if (isString_default(tokType.PATTERN)) { - return false; - } else if (isCustomPattern(tokType)) { - return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK }; - } else { - throw Error("non exhaustive match"); - } - } -} -function buildLineBreakIssueMessage(tokType, details) { - if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) { - return `Warning: unable to identify line terminator usage in pattern. - The problem is in the <${tokType.name}> Token Type - Root cause: ${details.errMsg}. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`; - } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) { - return `Warning: A Custom Token Pattern should specify the option. - The problem is in the <${tokType.name}> Token Type - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`; - } else { - throw Error("non exhaustive match"); - } -} -function getCharCodes(charsOrCodes) { - const charCodes = map_default(charsOrCodes, (numOrString) => { - if (isString_default(numOrString)) { - return numOrString.charCodeAt(0); - } else { - return numOrString; - } - }); - return charCodes; -} -function addToMapOfArrays(map2, key, value) { - if (map2[key] === void 0) { - map2[key] = [value]; - } else { - map2[key].push(value); - } -} -var minOptimizationVal = 256; -var charCodeToOptimizedIdxMap = []; -function charCodeToOptimizedIndex(charCode) { - return charCode < minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode]; -} -function initCharCodeToOptimizedIndexMap() { - if (isEmpty_default(charCodeToOptimizedIdxMap)) { - charCodeToOptimizedIdxMap = new Array(65536); - for (let i = 0; i < 65536; i++) { - charCodeToOptimizedIdxMap[i] = i > 255 ? 255 + ~~(i / 255) : i; - } - } -} - -// node_modules/chevrotain/lib/src/scan/tokens.js -function tokenStructuredMatcher(tokInstance, tokConstructor) { - const instanceType = tokInstance.tokenTypeIdx; - if (instanceType === tokConstructor.tokenTypeIdx) { - return true; - } else { - return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true; - } -} -function tokenStructuredMatcherNoCategories(token, tokType) { - return token.tokenTypeIdx === tokType.tokenTypeIdx; -} -var tokenShortNameIdx = 1; -var tokenIdxToClass = {}; -function augmentTokenTypes(tokenTypes) { - const tokenTypesAndParents = expandCategories(tokenTypes); - assignTokenDefaultProps(tokenTypesAndParents); - assignCategoriesMapProp(tokenTypesAndParents); - assignCategoriesTokensProp(tokenTypesAndParents); - forEach_default(tokenTypesAndParents, (tokType) => { - tokType.isParent = tokType.categoryMatches.length > 0; - }); -} -function expandCategories(tokenTypes) { - let result = clone_default(tokenTypes); - let categories = tokenTypes; - let searching = true; - while (searching) { - categories = compact_default(flatten_default(map_default(categories, (currTokType) => currTokType.CATEGORIES))); - const newCategories = difference_default(categories, result); - result = result.concat(newCategories); - if (isEmpty_default(newCategories)) { - searching = false; - } else { - categories = newCategories; - } - } - return result; -} -function assignTokenDefaultProps(tokenTypes) { - forEach_default(tokenTypes, (currTokType) => { - if (!hasShortKeyProperty(currTokType)) { - tokenIdxToClass[tokenShortNameIdx] = currTokType; - currTokType.tokenTypeIdx = tokenShortNameIdx++; - } - if (hasCategoriesProperty(currTokType) && !isArray_default(currTokType.CATEGORIES)) { - currTokType.CATEGORIES = [currTokType.CATEGORIES]; - } - if (!hasCategoriesProperty(currTokType)) { - currTokType.CATEGORIES = []; - } - if (!hasExtendingTokensTypesProperty(currTokType)) { - currTokType.categoryMatches = []; - } - if (!hasExtendingTokensTypesMapProperty(currTokType)) { - currTokType.categoryMatchesMap = {}; - } - }); -} -function assignCategoriesTokensProp(tokenTypes) { - forEach_default(tokenTypes, (currTokType) => { - currTokType.categoryMatches = []; - forEach_default(currTokType.categoryMatchesMap, (val, key) => { - currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx); - }); - }); -} -function assignCategoriesMapProp(tokenTypes) { - forEach_default(tokenTypes, (currTokType) => { - singleAssignCategoriesToksMap([], currTokType); - }); -} -function singleAssignCategoriesToksMap(path, nextNode) { - forEach_default(path, (pathNode) => { - nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true; - }); - forEach_default(nextNode.CATEGORIES, (nextCategory) => { - const newPath = path.concat(nextNode); - if (!includes_default(newPath, nextCategory)) { - singleAssignCategoriesToksMap(newPath, nextCategory); - } - }); -} -function hasShortKeyProperty(tokType) { - return has_default(tokType, "tokenTypeIdx"); -} -function hasCategoriesProperty(tokType) { - return has_default(tokType, "CATEGORIES"); -} -function hasExtendingTokensTypesProperty(tokType) { - return has_default(tokType, "categoryMatches"); -} -function hasExtendingTokensTypesMapProperty(tokType) { - return has_default(tokType, "categoryMatchesMap"); -} -function isTokenType(tokType) { - return has_default(tokType, "tokenTypeIdx"); -} - -// node_modules/chevrotain/lib/src/scan/lexer_errors_public.js -var defaultLexerErrorProvider = { - buildUnableToPopLexerModeMessage(token) { - return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`; - }, - buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column) { - return `unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset}, skipped ${length} characters.`; - } -}; - -// node_modules/chevrotain/lib/src/scan/lexer_public.js -var LexerDefinitionErrorType; -(function(LexerDefinitionErrorType2) { - LexerDefinitionErrorType2[LexerDefinitionErrorType2["MISSING_PATTERN"] = 0] = "MISSING_PATTERN"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_PATTERN"] = 1] = "INVALID_PATTERN"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["EOI_ANCHOR_FOUND"] = 2] = "EOI_ANCHOR_FOUND"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNSUPPORTED_FLAGS_FOUND"] = 3] = "UNSUPPORTED_FLAGS_FOUND"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["DUPLICATE_PATTERNS_FOUND"] = 4] = "DUPLICATE_PATTERNS_FOUND"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_GROUP_TYPE_FOUND"] = 5] = "INVALID_GROUP_TYPE_FOUND"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["PUSH_MODE_DOES_NOT_EXIST"] = 6] = "PUSH_MODE_DOES_NOT_EXIST"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"] = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"] = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"] = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"] = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["SOI_ANCHOR_FOUND"] = 11] = "SOI_ANCHOR_FOUND"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["EMPTY_MATCH_PATTERN"] = 12] = "EMPTY_MATCH_PATTERN"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["NO_LINE_BREAKS_FLAGS"] = 13] = "NO_LINE_BREAKS_FLAGS"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNREACHABLE_PATTERN"] = 14] = "UNREACHABLE_PATTERN"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["IDENTIFY_TERMINATOR"] = 15] = "IDENTIFY_TERMINATOR"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["CUSTOM_LINE_BREAK"] = 16] = "CUSTOM_LINE_BREAK"; - LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"] = 17] = "MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"; -})(LexerDefinitionErrorType || (LexerDefinitionErrorType = {})); -var DEFAULT_LEXER_CONFIG = { - deferDefinitionErrorsHandling: false, - positionTracking: "full", - lineTerminatorsPattern: /\n|\r\n?/g, - lineTerminatorCharacters: ["\n", "\r"], - ensureOptimizations: false, - safeMode: false, - errorMessageProvider: defaultLexerErrorProvider, - traceInitPerf: false, - skipValidations: false, - recoveryEnabled: true -}; -Object.freeze(DEFAULT_LEXER_CONFIG); -var Lexer = class { - constructor(lexerDefinition, config = DEFAULT_LEXER_CONFIG) { - this.lexerDefinition = lexerDefinition; - this.lexerDefinitionErrors = []; - this.lexerDefinitionWarning = []; - this.patternIdxToConfig = {}; - this.charCodeToPatternIdxToConfig = {}; - this.modes = []; - this.emptyGroups = {}; - this.trackStartLines = true; - this.trackEndLines = true; - this.hasCustom = false; - this.canModeBeOptimized = {}; - this.TRACE_INIT = (phaseDesc, phaseImpl) => { - if (this.traceInitPerf === true) { - this.traceInitIndent++; - const indent = new Array(this.traceInitIndent + 1).join(" "); - if (this.traceInitIndent < this.traceInitMaxIdent) { - console.log(`${indent}--> <${phaseDesc}>`); - } - const { time, value } = timer(phaseImpl); - const traceMethod = time > 10 ? console.warn : console.log; - if (this.traceInitIndent < this.traceInitMaxIdent) { - traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`); - } - this.traceInitIndent--; - return value; - } else { - return phaseImpl(); - } - }; - if (typeof config === "boolean") { - throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported"); - } - this.config = assign_default({}, DEFAULT_LEXER_CONFIG, config); - const traceInitVal = this.config.traceInitPerf; - if (traceInitVal === true) { - this.traceInitMaxIdent = Infinity; - this.traceInitPerf = true; - } else if (typeof traceInitVal === "number") { - this.traceInitMaxIdent = traceInitVal; - this.traceInitPerf = true; - } - this.traceInitIndent = -1; - this.TRACE_INIT("Lexer Constructor", () => { - let actualDefinition; - let hasOnlySingleMode = true; - this.TRACE_INIT("Lexer Config handling", () => { - if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) { - this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester; - } else { - if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) { - throw Error("Error: Missing property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS"); - } - } - if (config.safeMode && config.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); - if (isArray_default(lexerDefinition)) { - actualDefinition = { - modes: { defaultMode: clone_default(lexerDefinition) }, - defaultMode: DEFAULT_MODE - }; - } else { - hasOnlySingleMode = false; - actualDefinition = clone_default(lexerDefinition); - } - }); - if (this.config.skipValidations === false) { - this.TRACE_INIT("performRuntimeChecks", () => { - this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters)); - }); - this.TRACE_INIT("performWarningRuntimeChecks", () => { - this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters)); - }); - } - actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {}; - forEach_default(actualDefinition.modes, (currModeValue, currModeName) => { - actualDefinition.modes[currModeName] = reject_default(currModeValue, (currTokType) => isUndefined_default(currTokType)); - }); - const allModeNames = keys_default(actualDefinition.modes); - forEach_default(actualDefinition.modes, (currModDef, currModName) => { - this.TRACE_INIT(`Mode: <${currModName}> processing`, () => { - this.modes.push(currModName); - if (this.config.skipValidations === false) { - this.TRACE_INIT(`validatePatterns`, () => { - this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(currModDef, allModeNames)); - }); - } - if (isEmpty_default(this.lexerDefinitionErrors)) { - augmentTokenTypes(currModDef); - let currAnalyzeResult; - this.TRACE_INIT(`analyzeTokenTypes`, () => { - currAnalyzeResult = analyzeTokenTypes(currModDef, { - lineTerminatorCharacters: this.config.lineTerminatorCharacters, - positionTracking: config.positionTracking, - ensureOptimizations: config.ensureOptimizations, - safeMode: config.safeMode, - tracer: this.TRACE_INIT - }); - }); - this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig; - this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult.charCodeToPatternIdxToConfig; - this.emptyGroups = assign_default({}, this.emptyGroups, currAnalyzeResult.emptyGroups); - this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom; - this.canModeBeOptimized[currModName] = currAnalyzeResult.canBeOptimized; - } - }); - }); - this.defaultMode = actualDefinition.defaultMode; - if (!isEmpty_default(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) { - const allErrMessages = map_default(this.lexerDefinitionErrors, (error) => { - return error.message; - }); - const allErrMessagesString = allErrMessages.join("-----------------------\n"); - throw new Error("Errors detected in definition of Lexer:\n" + allErrMessagesString); - } - forEach_default(this.lexerDefinitionWarning, (warningDescriptor) => { - PRINT_WARNING(warningDescriptor.message); - }); - this.TRACE_INIT("Choosing sub-methods implementations", () => { - if (SUPPORT_STICKY) { - this.chopInput = identity_default; - this.match = this.matchWithTest; - } else { - this.updateLastIndex = noop_default; - this.match = this.matchWithExec; - } - if (hasOnlySingleMode) { - this.handleModes = noop_default; - } - if (this.trackStartLines === false) { - this.computeNewColumn = identity_default; - } - if (this.trackEndLines === false) { - this.updateTokenEndLineColumnLocation = noop_default; - } - if (/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 config option: "${this.config.positionTracking}"`); - } - if (this.hasCustom) { - this.addToken = this.addTokenUsingPush; - this.handlePayload = this.handlePayloadWithCustom; - } else { - this.addToken = this.addTokenUsingMemberAccess; - this.handlePayload = this.handlePayloadNoCustom; - } - }); - this.TRACE_INIT("Failed Optimization Warnings", () => { - const unOptimizedModes = reduce_default(this.canModeBeOptimized, (cannotBeOptimized, canBeOptimized, modeName) => { - if (canBeOptimized === false) { - cannotBeOptimized.push(modeName); - } - return cannotBeOptimized; - }, []); - if (config.ensureOptimizations && !isEmpty_default(unOptimizedModes)) { - throw Error(`Lexer Modes: < ${unOptimizedModes.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", () => { - clearRegExpParserCache(); - }); - this.TRACE_INIT("toFastProperties", () => { - toFastProperties(this); - }); - }); - } - tokenize(text, initialMode = this.defaultMode) { - if (!isEmpty_default(this.lexerDefinitionErrors)) { - const allErrMessages = map_default(this.lexerDefinitionErrors, (error) => { - return error.message; - }); - const allErrMessagesString = allErrMessages.join("-----------------------\n"); - throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n" + allErrMessagesString); - } - return this.tokenizeInternal(text, initialMode); - } - // There is quite a bit of duplication between this and "tokenizeInternalLazy" - // This is intentional due to performance considerations. - // this method also used quite a bit of `!` none null assertions because it is too optimized - // for `tsc` to always understand it is "safe" - tokenizeInternal(text, initialMode) { - let i, j, k, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group, tokType, newToken, errLength, droppedChar, msg, match; - const orgText = text; - const orgLength = orgText.length; - let offset = 0; - let matchedTokensIndex = 0; - const guessedNumberOfTokens = this.hasCustom ? 0 : Math.floor(text.length / 10); - const matchedTokens = new Array(guessedNumberOfTokens); - const errors = []; - let line = this.trackStartLines ? 1 : void 0; - let column = this.trackStartLines ? 1 : void 0; - const groups = cloneEmptyGroups(this.emptyGroups); - const trackLines = this.trackStartLines; - const lineTerminatorPattern = this.config.lineTerminatorsPattern; - let currModePatternsLength = 0; - let patternIdxToConfig = []; - let currCharCodeToPatternIdxToConfig = []; - const modeStack = []; - const emptyArray = []; - Object.freeze(emptyArray); - let getPossiblePatterns; - function getPossiblePatternsSlow() { - return patternIdxToConfig; - } - function getPossiblePatternsOptimized(charCode) { - const optimizedCharIdx = charCodeToOptimizedIndex(charCode); - const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx]; - if (possiblePatterns === void 0) { - return emptyArray; - } else { - return possiblePatterns; - } - } - const pop_mode = (popToken) => { - if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition" - // So no error should occur. - popToken.tokenType.PUSH_MODE === void 0) { - const msg2 = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken); - errors.push({ - offset: popToken.startOffset, - line: popToken.startLine, - column: popToken.startColumn, - length: popToken.image.length, - message: msg2 - }); - } else { - modeStack.pop(); - const newMode = last_default(modeStack); - patternIdxToConfig = this.patternIdxToConfig[newMode]; - currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]; - currModePatternsLength = patternIdxToConfig.length; - const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false; - if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) { - getPossiblePatterns = getPossiblePatternsOptimized; - } else { - getPossiblePatterns = getPossiblePatternsSlow; - } - } - }; - function push_mode(newMode) { - modeStack.push(newMode); - currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]; - patternIdxToConfig = this.patternIdxToConfig[newMode]; - currModePatternsLength = patternIdxToConfig.length; - currModePatternsLength = patternIdxToConfig.length; - const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false; - if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) { - getPossiblePatterns = getPossiblePatternsOptimized; - } else { - getPossiblePatterns = getPossiblePatternsSlow; - } - } - push_mode.call(this, initialMode); - let currConfig; - const recoveryEnabled = this.config.recoveryEnabled; - while (offset < orgLength) { - matchedImage = null; - const nextCharCode = orgText.charCodeAt(offset); - const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode); - const chosenPatternsLength = chosenPatternIdxToConfig.length; - for (i = 0; i < chosenPatternsLength; i++) { - currConfig = chosenPatternIdxToConfig[i]; - const currPattern = currConfig.pattern; - payload = null; - const singleCharCode = currConfig.short; - if (singleCharCode !== false) { - if (nextCharCode === singleCharCode) { - matchedImage = currPattern; - } - } else if (currConfig.isCustom === true) { - match = currPattern.exec(orgText, offset, matchedTokens, groups); - if (match !== null) { - matchedImage = match[0]; - if (match.payload !== void 0) { - payload = match.payload; - } - } else { - matchedImage = null; - } - } else { - this.updateLastIndex(currPattern, offset); - matchedImage = this.match(currPattern, text, offset); - } - if (matchedImage !== null) { - longerAlt = currConfig.longerAlt; - if (longerAlt !== void 0) { - const longerAltLength = longerAlt.length; - for (k = 0; k < longerAltLength; k++) { - const longerAltConfig = patternIdxToConfig[longerAlt[k]]; - const longerAltPattern = longerAltConfig.pattern; - altPayload = null; - if (longerAltConfig.isCustom === true) { - match = longerAltPattern.exec(orgText, offset, matchedTokens, groups); - if (match !== null) { - matchAltImage = match[0]; - if (match.payload !== void 0) { - altPayload = match.payload; - } - } else { - matchAltImage = null; - } - } else { - this.updateLastIndex(longerAltPattern, offset); - matchAltImage = this.match(longerAltPattern, text, offset); - } - if (matchAltImage && matchAltImage.length > matchedImage.length) { - matchedImage = matchAltImage; - payload = altPayload; - currConfig = longerAltConfig; - break; - } - } - } - break; - } - } - if (matchedImage !== null) { - imageLength = matchedImage.length; - group = currConfig.group; - if (group !== void 0) { - tokType = currConfig.tokenTypeIdx; - newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line, column, imageLength); - this.handlePayload(newToken, payload); - if (group === false) { - matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken); - } else { - groups[group].push(newToken); - } - } - text = this.chopInput(text, imageLength); - offset = offset + imageLength; - column = this.computeNewColumn(column, imageLength); - if (trackLines === true && currConfig.canLineTerminator === true) { - let numOfLTsInMatch = 0; - let foundTerminator; - let lastLTEndOffset; - lineTerminatorPattern.lastIndex = 0; - do { - foundTerminator = lineTerminatorPattern.test(matchedImage); - if (foundTerminator === true) { - lastLTEndOffset = lineTerminatorPattern.lastIndex - 1; - numOfLTsInMatch++; - } - } while (foundTerminator === true); - if (numOfLTsInMatch !== 0) { - line = line + numOfLTsInMatch; - column = imageLength - lastLTEndOffset; - this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength); - } - } - this.handleModes(currConfig, pop_mode, push_mode, newToken); - } else { - const errorStartOffset = offset; - const errorLine = line; - const errorColumn = column; - let foundResyncPoint = recoveryEnabled === false; - while (foundResyncPoint === false && offset < orgLength) { - text = this.chopInput(text, 1); - offset++; - for (j = 0; j < currModePatternsLength; j++) { - const currConfig2 = patternIdxToConfig[j]; - const currPattern = currConfig2.pattern; - const singleCharCode = currConfig2.short; - if (singleCharCode !== false) { - if (orgText.charCodeAt(offset) === singleCharCode) { - foundResyncPoint = true; - } - } else if (currConfig2.isCustom === true) { - foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null; - } else { - this.updateLastIndex(currPattern, offset); - foundResyncPoint = currPattern.exec(text) !== null; - } - if (foundResyncPoint === true) { - break; - } - } - } - errLength = offset - errorStartOffset; - column = this.computeNewColumn(column, errLength); - msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText, errorStartOffset, errLength, errorLine, errorColumn); - errors.push({ - offset: errorStartOffset, - line: errorLine, - column: errorColumn, - length: errLength, - message: msg - }); - if (recoveryEnabled === false) { - break; - } - } - } - if (!this.hasCustom) { - matchedTokens.length = matchedTokensIndex; - } - return { - tokens: matchedTokens, - groups, - errors - }; - } - handleModes(config, pop_mode, push_mode, newToken) { - if (config.pop === true) { - const pushMode = config.push; - pop_mode(newToken); - if (pushMode !== void 0) { - push_mode.call(this, pushMode); - } - } else if (config.push !== void 0) { - push_mode.call(this, config.push); - } - } - chopInput(text, length) { - return text.substring(length); - } - updateLastIndex(regExp, newLastIndex) { - regExp.lastIndex = newLastIndex; - } - // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler - updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) { - let lastCharIsLT, fixForEndingInLT; - if (group !== void 0) { - lastCharIsLT = lastLTIdx === imageLength - 1; - fixForEndingInLT = lastCharIsLT ? -1 : 0; - if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) { - newToken.endLine = line + fixForEndingInLT; - newToken.endColumn = column - 1 + -fixForEndingInLT; - } - } - } - computeNewColumn(oldColumn, imageLength) { - return oldColumn + imageLength; - } - createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) { - return { - image, - startOffset, - tokenTypeIdx, - tokenType - }; - } - createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) { - return { - image, - startOffset, - startLine, - startColumn, - tokenTypeIdx, - tokenType - }; - } - createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) { - return { - image, - startOffset, - endOffset: startOffset + imageLength - 1, - startLine, - endLine: startLine, - startColumn, - endColumn: startColumn + imageLength - 1, - tokenTypeIdx, - tokenType - }; - } - addTokenUsingPush(tokenVector, index, tokenToAdd) { - tokenVector.push(tokenToAdd); - return index; - } - addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) { - tokenVector[index] = tokenToAdd; - index++; - return index; - } - handlePayloadNoCustom(token, payload) { - } - handlePayloadWithCustom(token, payload) { - if (payload !== null) { - token.payload = payload; - } - } - matchWithTest(pattern, text, offset) { - const found = pattern.test(text); - if (found === true) { - return text.substring(offset, pattern.lastIndex); - } - return null; - } - matchWithExec(pattern, text) { - const regExpArray = pattern.exec(text); - return regExpArray !== null ? regExpArray[0] : null; - } -}; -Lexer.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace."; -Lexer.NA = /NOT_APPLICABLE/; - -// node_modules/chevrotain/lib/src/scan/tokens_public.js -function tokenLabel2(tokType) { - if (hasTokenLabel2(tokType)) { - return tokType.LABEL; - } else { - return tokType.name; - } -} -function hasTokenLabel2(obj) { - return isString_default(obj.LABEL) && obj.LABEL !== ""; -} -var PARENT = "parent"; -var CATEGORIES = "categories"; -var LABEL = "label"; -var GROUP = "group"; -var PUSH_MODE = "push_mode"; -var POP_MODE = "pop_mode"; -var LONGER_ALT = "longer_alt"; -var LINE_BREAKS = "line_breaks"; -var START_CHARS_HINT = "start_chars_hint"; -function createToken(config) { - return createTokenInternal(config); -} -function createTokenInternal(config) { - const pattern = config.pattern; - const tokenType = {}; - tokenType.name = config.name; - if (!isUndefined_default(pattern)) { - tokenType.PATTERN = pattern; - } - if (has_default(config, PARENT)) { - throw "The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details."; - } - if (has_default(config, CATEGORIES)) { - tokenType.CATEGORIES = config[CATEGORIES]; - } - augmentTokenTypes([tokenType]); - if (has_default(config, LABEL)) { - tokenType.LABEL = config[LABEL]; - } - if (has_default(config, GROUP)) { - tokenType.GROUP = config[GROUP]; - } - if (has_default(config, POP_MODE)) { - tokenType.POP_MODE = config[POP_MODE]; - } - if (has_default(config, PUSH_MODE)) { - tokenType.PUSH_MODE = config[PUSH_MODE]; - } - if (has_default(config, LONGER_ALT)) { - tokenType.LONGER_ALT = config[LONGER_ALT]; - } - if (has_default(config, LINE_BREAKS)) { - tokenType.LINE_BREAKS = config[LINE_BREAKS]; - } - if (has_default(config, START_CHARS_HINT)) { - tokenType.START_CHARS_HINT = config[START_CHARS_HINT]; - } - return tokenType; -} -var EOF = createToken({ name: "EOF", pattern: Lexer.NA }); -augmentTokenTypes([EOF]); -function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) { - return { - image, - startOffset, - endOffset, - startLine, - endLine, - startColumn, - endColumn, - tokenTypeIdx: tokType.tokenTypeIdx, - tokenType: tokType - }; -} -function tokenMatcher(token, tokType) { - return tokenStructuredMatcher(token, tokType); -} - -// node_modules/chevrotain/lib/src/parse/errors_public.js -var defaultParserErrorProvider = { - buildMismatchTokenMessage({ expected, actual, previous, ruleName }) { - const hasLabel = hasTokenLabel2(expected); - const expectedMsg = hasLabel ? `--> ${tokenLabel2(expected)} <--` : `token of type --> ${expected.name} <--`; - const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`; - return msg; - }, - buildNotAllInputParsedMessage({ firstRedundant, ruleName }) { - return "Redundant input, expecting EOF but found: " + firstRedundant.image; - }, - buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName }) { - const errPrefix = "Expecting: "; - const actualText = head_default(actual).image; - const errSuffix = "\nbut found: '" + actualText + "'"; - if (customUserDescription) { - return errPrefix + customUserDescription + errSuffix; - } else { - const allLookAheadPaths = reduce_default(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), []); - const nextValidTokenSequences = map_default(allLookAheadPaths, (currPath) => `[${map_default(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(", ")}]`); - const nextValidSequenceItems = map_default(nextValidTokenSequences, (itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`); - const calculatedDescription = `one of these possible Token sequences: -${nextValidSequenceItems.join("\n")}`; - return errPrefix + calculatedDescription + errSuffix; - } - }, - buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName }) { - const errPrefix = "Expecting: "; - const actualText = head_default(actual).image; - const errSuffix = "\nbut found: '" + actualText + "'"; - if (customUserDescription) { - return errPrefix + customUserDescription + errSuffix; - } else { - const nextValidTokenSequences = map_default(expectedIterationPaths, (currPath) => `[${map_default(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(",")}]`); - const calculatedDescription = `expecting at least one iteration which starts with one of these possible Token sequences:: - <${nextValidTokenSequences.join(" ,")}>`; - return errPrefix + calculatedDescription + errSuffix; - } - } -}; -Object.freeze(defaultParserErrorProvider); -var defaultGrammarResolverErrorProvider = { - buildRuleNotFoundError(topLevelRule, undefinedRule) { - const msg = "Invalid grammar, reference to a rule which is not defined: ->" + undefinedRule.nonTerminalName + "<-\ninside top level rule: ->" + topLevelRule.name + "<-"; - return msg; - } -}; -var defaultGrammarValidatorErrorProvider = { - buildDuplicateFoundError(topLevelRule, duplicateProds) { - function getExtraProductionArgument2(prod) { - if (prod instanceof Terminal) { - return prod.terminalType.name; - } else if (prod instanceof NonTerminal) { - return prod.nonTerminalName; - } else { - return ""; - } - } - const topLevelName = topLevelRule.name; - const duplicateProd = head_default(duplicateProds); - const index = duplicateProd.idx; - const dslName = getProductionDslName(duplicateProd); - const extraArgument = getExtraProductionArgument2(duplicateProd); - const hasExplicitIndex = index > 0; - let msg = `->${dslName}${hasExplicitIndex ? index : ""}<- ${extraArgument ? `with argument: ->${extraArgument}<-` : ""} - appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-. - For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES - `; - msg = msg.replace(/[ \t]+/g, " "); - msg = msg.replace(/\s\s+/g, "\n"); - return msg; - }, - buildNamespaceConflictError(rule) { - const errMsg = `Namespace conflict found in grammar. -The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.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.`; - return errMsg; - }, - buildAlternationPrefixAmbiguityError(options) { - const pathMsg = map_default(options.prefixPath, (currTok) => tokenLabel2(currTok)).join(", "); - const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx; - const errMsg = `Ambiguous alternatives: <${options.ambiguityIndices.join(" ,")}> due to common lookahead prefix -in inside <${options.topLevelRule.name}> Rule, -<${pathMsg}> 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.`; - return errMsg; - }, - buildAlternationAmbiguityError(options) { - const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", "); - const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx; - let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in inside <${options.topLevelRule.name}> Rule, -<${pathMsg}> may appears as a prefix path in all these alternatives. -`; - currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES -For Further details.`; - return currMessage; - }, - buildEmptyRepetitionError(options) { - let dslName = getProductionDslName(options.repetition); - if (options.repetition.idx !== 0) { - dslName += options.repetition.idx; - } - const errMsg = `The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens. -This could lead to an infinite loop.`; - return errMsg; - }, - // TODO: remove - `errors_public` from nyc.config.js exclude - // once this method is fully removed from this file - buildTokenNameError(options) { - return "deprecated"; - }, - buildEmptyAlternationError(options) { - const errMsg = `Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}> in inside <${options.topLevelRule.name}> Rule. -Only the last alternative may be an empty alternative.`; - return errMsg; - }, - buildTooManyAlternativesError(options) { - const errMsg = `An Alternation cannot have more than 256 alternatives: - inside <${options.topLevelRule.name}> Rule. - has ${options.alternation.definition.length + 1} alternatives.`; - return errMsg; - }, - buildLeftRecursionError(options) { - const ruleName = options.topLevelRule.name; - const pathNames = map_default(options.leftRecursionPath, (currRule) => currRule.name); - const leftRecursivePath = `${ruleName} --> ${pathNames.concat([ruleName]).join(" --> ")}`; - const errMsg = `Left Recursion found in grammar. -rule: <${ruleName}> can be invoked from itself (directly or indirectly) -without consuming any Tokens. The grammar path that causes this is: - ${leftRecursivePath} - To fix this refactor your grammar to remove the left recursion. -see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`; - return errMsg; - }, - // TODO: remove - `errors_public` from nyc.config.js exclude - // once this method is fully removed from this file - buildInvalidRuleNameError(options) { - return "deprecated"; - }, - buildDuplicateRuleNameError(options) { - let ruleName; - if (options.topLevelRule instanceof Rule) { - ruleName = options.topLevelRule.name; - } else { - ruleName = options.topLevelRule; - } - const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`; - return errMsg; - } -}; - -// node_modules/chevrotain/lib/src/parse/grammar/resolver.js -function resolveGrammar(topLevels, errMsgProvider) { - const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider); - refResolver.resolveRefs(); - return refResolver.errors; -} -var GastRefResolverVisitor = class extends GAstVisitor { - constructor(nameToTopRule, errMsgProvider) { - super(); - this.nameToTopRule = nameToTopRule; - this.errMsgProvider = errMsgProvider; - this.errors = []; - } - resolveRefs() { - forEach_default(values_default(this.nameToTopRule), (prod) => { - this.currTopLevel = prod; - prod.accept(this); - }); - } - visitNonTerminal(node) { - const ref = this.nameToTopRule[node.nonTerminalName]; - if (!ref) { - const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node); - this.errors.push({ - message: msg, - type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF, - ruleName: this.currTopLevel.name, - unresolvedRefName: node.nonTerminalName - }); - } else { - node.referencedRule = ref; - } - } -}; - -// node_modules/chevrotain/lib/src/parse/grammar/interpreter.js -var AbstractNextPossibleTokensWalker = class extends RestWalker { - constructor(topProd, path) { - super(); - this.topProd = topProd; - this.path = path; - this.possibleTokTypes = []; - this.nextProductionName = ""; - this.nextProductionOccurrence = 0; - this.found = false; - this.isAtEndOfPath = false; - } - startWalking() { - this.found = false; - if (this.path.ruleStack[0] !== this.topProd.name) { - throw Error("The path does not start with the walker's top Rule!"); - } - this.ruleStack = clone_default(this.path.ruleStack).reverse(); - this.occurrenceStack = clone_default(this.path.occurrenceStack).reverse(); - this.ruleStack.pop(); - this.occurrenceStack.pop(); - this.updateExpectedNext(); - this.walk(this.topProd); - return this.possibleTokTypes; - } - walk(prod, prevRest = []) { - if (!this.found) { - super.walk(prod, prevRest); - } - } - walkProdRef(refProd, currRest, prevRest) { - if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) { - const fullRest = currRest.concat(prevRest); - this.updateExpectedNext(); - this.walk(refProd.referencedRule, fullRest); - } - } - updateExpectedNext() { - if (isEmpty_default(this.ruleStack)) { - this.nextProductionName = ""; - this.nextProductionOccurrence = 0; - this.isAtEndOfPath = true; - } else { - this.nextProductionName = this.ruleStack.pop(); - this.nextProductionOccurrence = this.occurrenceStack.pop(); - } - } -}; -var NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker { - constructor(topProd, path) { - super(topProd, path); - this.path = path; - this.nextTerminalName = ""; - this.nextTerminalOccurrence = 0; - this.nextTerminalName = this.path.lastTok.name; - this.nextTerminalOccurrence = this.path.lastTokOccurrence; - } - walkTerminal(terminal, currRest, prevRest) { - if (this.isAtEndOfPath && terminal.terminalType.name === this.nextTerminalName && terminal.idx === this.nextTerminalOccurrence && !this.found) { - const fullRest = currRest.concat(prevRest); - const restProd = new Alternative({ definition: fullRest }); - this.possibleTokTypes = first(restProd); - this.found = true; - } - } -}; -var AbstractNextTerminalAfterProductionWalker = class extends RestWalker { - constructor(topRule, occurrence) { - super(); - this.topRule = topRule; - this.occurrence = occurrence; - this.result = { - token: void 0, - occurrence: void 0, - isEndOfRule: void 0 - }; - } - startWalking() { - this.walk(this.topRule); - return this.result; - } -}; -var NextTerminalAfterManyWalker = class extends AbstractNextTerminalAfterProductionWalker { - walkMany(manyProd, currRest, prevRest) { - if (manyProd.idx === this.occurrence) { - const firstAfterMany = head_default(currRest.concat(prevRest)); - this.result.isEndOfRule = firstAfterMany === void 0; - if (firstAfterMany instanceof Terminal) { - this.result.token = firstAfterMany.terminalType; - this.result.occurrence = firstAfterMany.idx; - } - } else { - super.walkMany(manyProd, currRest, prevRest); - } - } -}; -var NextTerminalAfterManySepWalker = class extends AbstractNextTerminalAfterProductionWalker { - walkManySep(manySepProd, currRest, prevRest) { - if (manySepProd.idx === this.occurrence) { - const firstAfterManySep = head_default(currRest.concat(prevRest)); - this.result.isEndOfRule = firstAfterManySep === void 0; - if (firstAfterManySep instanceof Terminal) { - this.result.token = firstAfterManySep.terminalType; - this.result.occurrence = firstAfterManySep.idx; - } - } else { - super.walkManySep(manySepProd, currRest, prevRest); - } - } -}; -var NextTerminalAfterAtLeastOneWalker = class extends AbstractNextTerminalAfterProductionWalker { - walkAtLeastOne(atLeastOneProd, currRest, prevRest) { - if (atLeastOneProd.idx === this.occurrence) { - const firstAfterAtLeastOne = head_default(currRest.concat(prevRest)); - this.result.isEndOfRule = firstAfterAtLeastOne === void 0; - if (firstAfterAtLeastOne instanceof Terminal) { - this.result.token = firstAfterAtLeastOne.terminalType; - this.result.occurrence = firstAfterAtLeastOne.idx; - } - } else { - super.walkAtLeastOne(atLeastOneProd, currRest, prevRest); - } - } -}; -var NextTerminalAfterAtLeastOneSepWalker = class extends AbstractNextTerminalAfterProductionWalker { - walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) { - if (atleastOneSepProd.idx === this.occurrence) { - const firstAfterfirstAfterAtLeastOneSep = head_default(currRest.concat(prevRest)); - this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === void 0; - if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) { - this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType; - this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx; - } - } else { - super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest); - } - } -}; -function possiblePathsFrom(targetDef, maxLength, currPath = []) { - currPath = clone_default(currPath); - let result = []; - let i = 0; - function remainingPathWith(nextDef) { - return nextDef.concat(drop_default(targetDef, i + 1)); - } - function getAlternativesForProd(definition) { - const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath); - return result.concat(alternatives); - } - while (currPath.length < maxLength && i < targetDef.length) { - const prod = targetDef[i]; - if (prod instanceof Alternative) { - return getAlternativesForProd(prod.definition); - } else if (prod instanceof NonTerminal) { - return getAlternativesForProd(prod.definition); - } else if (prod instanceof Option) { - result = getAlternativesForProd(prod.definition); - } else if (prod instanceof RepetitionMandatory) { - const newDef = prod.definition.concat([ - new Repetition({ - definition: prod.definition - }) - ]); - return getAlternativesForProd(newDef); - } else if (prod instanceof RepetitionMandatoryWithSeparator) { - const newDef = [ - new Alternative({ definition: prod.definition }), - new Repetition({ - definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition) - }) - ]; - return getAlternativesForProd(newDef); - } else if (prod instanceof RepetitionWithSeparator) { - const newDef = prod.definition.concat([ - new Repetition({ - definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition) - }) - ]); - result = getAlternativesForProd(newDef); - } else if (prod instanceof Repetition) { - const newDef = prod.definition.concat([ - new Repetition({ - definition: prod.definition - }) - ]); - result = getAlternativesForProd(newDef); - } else if (prod instanceof Alternation) { - forEach_default(prod.definition, (currAlt) => { - if (isEmpty_default(currAlt.definition) === false) { - result = getAlternativesForProd(currAlt.definition); - } - }); - return result; - } else if (prod instanceof Terminal) { - currPath.push(prod.terminalType); - } else { - throw Error("non exhaustive match"); - } - i++; - } - result.push({ - partialPath: currPath, - suffixDef: drop_default(targetDef, i) - }); - return result; -} -function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) { - const EXIT_NON_TERMINAL = "EXIT_NONE_TERMINAL"; - const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL]; - const EXIT_ALTERNATIVE = "EXIT_ALTERNATIVE"; - let foundCompletePath = false; - const tokenVectorLength = tokenVector.length; - const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1; - const result = []; - const possiblePaths = []; - possiblePaths.push({ - idx: -1, - def: initialDef, - ruleStack: [], - occurrenceStack: [] - }); - while (!isEmpty_default(possiblePaths)) { - const currPath = possiblePaths.pop(); - if (currPath === EXIT_ALTERNATIVE) { - if (foundCompletePath && last_default(possiblePaths).idx <= minimalAlternativesIndex) { - possiblePaths.pop(); - } - continue; - } - const currDef = currPath.def; - const currIdx = currPath.idx; - const currRuleStack = currPath.ruleStack; - const currOccurrenceStack = currPath.occurrenceStack; - if (isEmpty_default(currDef)) { - continue; - } - const prod = currDef[0]; - if (prod === EXIT_NON_TERMINAL) { - const nextPath = { - idx: currIdx, - def: drop_default(currDef), - ruleStack: dropRight_default(currRuleStack), - occurrenceStack: dropRight_default(currOccurrenceStack) - }; - possiblePaths.push(nextPath); - } else if (prod instanceof Terminal) { - if (currIdx < tokenVectorLength - 1) { - const nextIdx = currIdx + 1; - const actualToken = tokenVector[nextIdx]; - if (tokMatcher(actualToken, prod.terminalType)) { - const nextPath = { - idx: nextIdx, - def: drop_default(currDef), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPath); - } - } else if (currIdx === tokenVectorLength - 1) { - result.push({ - nextTokenType: prod.terminalType, - nextTokenOccurrence: prod.idx, - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }); - foundCompletePath = true; - } else { - throw Error("non exhaustive match"); - } - } else if (prod instanceof NonTerminal) { - const newRuleStack = clone_default(currRuleStack); - newRuleStack.push(prod.nonTerminalName); - const newOccurrenceStack = clone_default(currOccurrenceStack); - newOccurrenceStack.push(prod.idx); - const nextPath = { - idx: currIdx, - def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop_default(currDef)), - ruleStack: newRuleStack, - occurrenceStack: newOccurrenceStack - }; - possiblePaths.push(nextPath); - } else if (prod instanceof Option) { - const nextPathWithout = { - idx: currIdx, - def: drop_default(currDef), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWithout); - possiblePaths.push(EXIT_ALTERNATIVE); - const nextPathWith = { - idx: currIdx, - def: prod.definition.concat(drop_default(currDef)), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWith); - } else if (prod instanceof RepetitionMandatory) { - const secondIteration = new Repetition({ - definition: prod.definition, - idx: prod.idx - }); - const nextDef = prod.definition.concat([secondIteration], drop_default(currDef)); - const nextPath = { - idx: currIdx, - def: nextDef, - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPath); - } else if (prod instanceof RepetitionMandatoryWithSeparator) { - const separatorGast = new Terminal({ - terminalType: prod.separator - }); - const secondIteration = new Repetition({ - definition: [separatorGast].concat(prod.definition), - idx: prod.idx - }); - const nextDef = prod.definition.concat([secondIteration], drop_default(currDef)); - const nextPath = { - idx: currIdx, - def: nextDef, - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPath); - } else if (prod instanceof RepetitionWithSeparator) { - const nextPathWithout = { - idx: currIdx, - def: drop_default(currDef), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWithout); - possiblePaths.push(EXIT_ALTERNATIVE); - const separatorGast = new Terminal({ - terminalType: prod.separator - }); - const nthRepetition = new Repetition({ - definition: [separatorGast].concat(prod.definition), - idx: prod.idx - }); - const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef)); - const nextPathWith = { - idx: currIdx, - def: nextDef, - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWith); - } else if (prod instanceof Repetition) { - const nextPathWithout = { - idx: currIdx, - def: drop_default(currDef), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWithout); - possiblePaths.push(EXIT_ALTERNATIVE); - const nthRepetition = new Repetition({ - definition: prod.definition, - idx: prod.idx - }); - const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef)); - const nextPathWith = { - idx: currIdx, - def: nextDef, - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(nextPathWith); - } else if (prod instanceof Alternation) { - for (let i = prod.definition.length - 1; i >= 0; i--) { - const currAlt = prod.definition[i]; - const currAltPath = { - idx: currIdx, - def: currAlt.definition.concat(drop_default(currDef)), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }; - possiblePaths.push(currAltPath); - possiblePaths.push(EXIT_ALTERNATIVE); - } - } else if (prod instanceof Alternative) { - possiblePaths.push({ - idx: currIdx, - def: prod.definition.concat(drop_default(currDef)), - ruleStack: currRuleStack, - occurrenceStack: currOccurrenceStack - }); - } else if (prod instanceof Rule) { - possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack)); - } else { - throw Error("non exhaustive match"); - } - } - return result; -} -function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) { - const newRuleStack = clone_default(currRuleStack); - newRuleStack.push(topRule.name); - const newCurrOccurrenceStack = clone_default(currOccurrenceStack); - newCurrOccurrenceStack.push(1); - return { - idx: currIdx, - def: topRule.definition, - ruleStack: newRuleStack, - occurrenceStack: newCurrOccurrenceStack - }; -} - -// node_modules/chevrotain/lib/src/parse/grammar/lookahead.js -var PROD_TYPE; -(function(PROD_TYPE2) { - PROD_TYPE2[PROD_TYPE2["OPTION"] = 0] = "OPTION"; - PROD_TYPE2[PROD_TYPE2["REPETITION"] = 1] = "REPETITION"; - PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY"] = 2] = "REPETITION_MANDATORY"; - PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY_WITH_SEPARATOR"] = 3] = "REPETITION_MANDATORY_WITH_SEPARATOR"; - PROD_TYPE2[PROD_TYPE2["REPETITION_WITH_SEPARATOR"] = 4] = "REPETITION_WITH_SEPARATOR"; - PROD_TYPE2[PROD_TYPE2["ALTERNATION"] = 5] = "ALTERNATION"; -})(PROD_TYPE || (PROD_TYPE = {})); -function getProdType(prod) { - if (prod instanceof Option || prod === "Option") { - return PROD_TYPE.OPTION; - } else if (prod instanceof Repetition || prod === "Repetition") { - return PROD_TYPE.REPETITION; - } else if (prod instanceof RepetitionMandatory || prod === "RepetitionMandatory") { - return PROD_TYPE.REPETITION_MANDATORY; - } else if (prod instanceof RepetitionMandatoryWithSeparator || prod === "RepetitionMandatoryWithSeparator") { - return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR; - } else if (prod instanceof RepetitionWithSeparator || prod === "RepetitionWithSeparator") { - return PROD_TYPE.REPETITION_WITH_SEPARATOR; - } else if (prod instanceof Alternation || prod === "Alternation") { - return PROD_TYPE.ALTERNATION; - } else { - throw Error("non exhaustive match"); - } -} -function getLookaheadPaths(options) { - const { occurrence, rule, prodType, maxLookahead } = options; - const type = getProdType(prodType); - if (type === PROD_TYPE.ALTERNATION) { - return getLookaheadPathsForOr(occurrence, rule, maxLookahead); - } else { - return getLookaheadPathsForOptionalProd(occurrence, rule, type, maxLookahead); - } -} -function buildLookaheadFuncForOr(occurrence, ruleGrammar, maxLookahead, hasPredicates, dynamicTokensEnabled, laFuncBuilder) { - const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead); - const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; - return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher2, dynamicTokensEnabled); -} -function buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, k, dynamicTokensEnabled, prodType, lookaheadBuilder) { - const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k); - const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; - return lookaheadBuilder(lookAheadPaths[0], tokenMatcher2, dynamicTokensEnabled); -} -function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher2, dynamicTokensEnabled) { - const numOfAlts = alts.length; - const areAllOneTokenLookahead = every_default(alts, (currAlt) => { - return every_default(currAlt, (currPath) => { - return currPath.length === 1; - }); - }); - if (hasPredicates) { - return function(orAlts) { - const predicates = map_default(orAlts, (currAlt) => currAlt.GATE); - for (let t = 0; t < numOfAlts; t++) { - const currAlt = alts[t]; - const currNumOfPaths = currAlt.length; - const currPredicate = predicates[t]; - if (currPredicate !== void 0 && currPredicate.call(this) === false) { - continue; - } - nextPath: - for (let j = 0; j < currNumOfPaths; j++) { - const currPath = currAlt[j]; - const currPathLength = currPath.length; - for (let i = 0; i < currPathLength; i++) { - const nextToken = this.LA(i + 1); - if (tokenMatcher2(nextToken, currPath[i]) === false) { - continue nextPath; - } - } - return t; - } - } - return void 0; - }; - } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) { - const singleTokenAlts = map_default(alts, (currAlt) => { - return flatten_default(currAlt); - }); - const choiceToAlt = reduce_default(singleTokenAlts, (result, currAlt, idx) => { - forEach_default(currAlt, (currTokType) => { - if (!has_default(result, currTokType.tokenTypeIdx)) { - result[currTokType.tokenTypeIdx] = idx; - } - forEach_default(currTokType.categoryMatches, (currExtendingType) => { - if (!has_default(result, currExtendingType)) { - result[currExtendingType] = idx; - } - }); - }); - return result; - }, {}); - return function() { - const nextToken = this.LA(1); - return choiceToAlt[nextToken.tokenTypeIdx]; - }; - } else { - return function() { - for (let t = 0; t < numOfAlts; t++) { - const currAlt = alts[t]; - const currNumOfPaths = currAlt.length; - nextPath: - for (let j = 0; j < currNumOfPaths; j++) { - const currPath = currAlt[j]; - const currPathLength = currPath.length; - for (let i = 0; i < currPathLength; i++) { - const nextToken = this.LA(i + 1); - if (tokenMatcher2(nextToken, currPath[i]) === false) { - continue nextPath; - } - } - return t; - } - } - return void 0; - }; - } -} -function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher2, dynamicTokensEnabled) { - const areAllOneTokenLookahead = every_default(alt, (currPath) => { - return currPath.length === 1; - }); - const numOfPaths = alt.length; - if (areAllOneTokenLookahead && !dynamicTokensEnabled) { - const singleTokensTypes = flatten_default(alt); - if (singleTokensTypes.length === 1 && isEmpty_default(singleTokensTypes[0].categoryMatches)) { - const expectedTokenType = singleTokensTypes[0]; - const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx; - return function() { - return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey; - }; - } else { - const choiceToAlt = reduce_default(singleTokensTypes, (result, currTokType, idx) => { - result[currTokType.tokenTypeIdx] = true; - forEach_default(currTokType.categoryMatches, (currExtendingType) => { - result[currExtendingType] = true; - }); - return result; - }, []); - return function() { - const nextToken = this.LA(1); - return choiceToAlt[nextToken.tokenTypeIdx] === true; - }; - } - } else { - return function() { - nextPath: - for (let j = 0; j < numOfPaths; j++) { - const currPath = alt[j]; - const currPathLength = currPath.length; - for (let i = 0; i < currPathLength; i++) { - const nextToken = this.LA(i + 1); - if (tokenMatcher2(nextToken, currPath[i]) === false) { - continue nextPath; - } - } - return true; - } - return false; - }; - } -} -var RestDefinitionFinderWalker = class extends RestWalker { - constructor(topProd, targetOccurrence, targetProdType) { - super(); - this.topProd = topProd; - this.targetOccurrence = targetOccurrence; - this.targetProdType = targetProdType; - } - startWalking() { - this.walk(this.topProd); - return this.restDef; - } - checkIsTarget(node, expectedProdType, currRest, prevRest) { - if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdType) { - this.restDef = currRest.concat(prevRest); - return true; - } - return false; - } - walkOption(optionProd, currRest, prevRest) { - if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) { - super.walkOption(optionProd, currRest, prevRest); - } - } - walkAtLeastOne(atLeastOneProd, currRest, prevRest) { - if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) { - super.walkOption(atLeastOneProd, currRest, prevRest); - } - } - walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) { - if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) { - super.walkOption(atLeastOneSepProd, currRest, prevRest); - } - } - walkMany(manyProd, currRest, prevRest) { - if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) { - super.walkOption(manyProd, currRest, prevRest); - } - } - walkManySep(manySepProd, currRest, prevRest) { - if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) { - super.walkOption(manySepProd, currRest, prevRest); - } - } -}; -var InsideDefinitionFinderVisitor = class extends GAstVisitor { - constructor(targetOccurrence, targetProdType, targetRef) { - super(); - this.targetOccurrence = targetOccurrence; - this.targetProdType = targetProdType; - this.targetRef = targetRef; - this.result = []; - } - checkIsTarget(node, expectedProdName) { - if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdName && (this.targetRef === void 0 || node === this.targetRef)) { - this.result = node.definition; - } - } - visitOption(node) { - this.checkIsTarget(node, PROD_TYPE.OPTION); - } - visitRepetition(node) { - this.checkIsTarget(node, PROD_TYPE.REPETITION); - } - visitRepetitionMandatory(node) { - this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY); - } - visitRepetitionMandatoryWithSeparator(node) { - this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR); - } - visitRepetitionWithSeparator(node) { - this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR); - } - visitAlternation(node) { - this.checkIsTarget(node, PROD_TYPE.ALTERNATION); - } -}; -function initializeArrayOfArrays(size) { - const result = new Array(size); - for (let i = 0; i < size; i++) { - result[i] = []; - } - return result; -} -function pathToHashKeys(path) { - let keys2 = [""]; - for (let i = 0; i < path.length; i++) { - const tokType = path[i]; - const longerKeys = []; - for (let j = 0; j < keys2.length; j++) { - const currShorterKey = keys2[j]; - longerKeys.push(currShorterKey + "_" + tokType.tokenTypeIdx); - for (let t = 0; t < tokType.categoryMatches.length; t++) { - const categoriesKeySuffix = "_" + tokType.categoryMatches[t]; - longerKeys.push(currShorterKey + categoriesKeySuffix); - } - } - keys2 = longerKeys; - } - return keys2; -} -function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) { - for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) { - if (currAltIdx === idx) { - continue; - } - const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx]; - for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) { - const searchKey = searchPathKeys[searchIdx]; - if (otherAltKnownPathsKeys[searchKey] === true) { - return false; - } - } - } - return true; -} -function lookAheadSequenceFromAlternatives(altsDefs, k) { - const partialAlts = map_default(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1)); - const finalResult = initializeArrayOfArrays(partialAlts.length); - const altsHashes = map_default(partialAlts, (currAltPaths) => { - const dict = {}; - forEach_default(currAltPaths, (item) => { - const keys2 = pathToHashKeys(item.partialPath); - forEach_default(keys2, (currKey) => { - dict[currKey] = true; - }); - }); - return dict; - }); - let newData = partialAlts; - for (let pathLength = 1; pathLength <= k; pathLength++) { - const currDataset = newData; - newData = initializeArrayOfArrays(currDataset.length); - for (let altIdx = 0; altIdx < currDataset.length; altIdx++) { - const currAltPathsAndSuffixes = currDataset[altIdx]; - for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) { - const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath; - const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef; - const prefixKeys = pathToHashKeys(currPathPrefix); - const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx); - if (isUnique || isEmpty_default(suffixDef) || currPathPrefix.length === k) { - const currAltResult = finalResult[altIdx]; - if (containsPath(currAltResult, currPathPrefix) === false) { - currAltResult.push(currPathPrefix); - for (let j = 0; j < prefixKeys.length; j++) { - const currKey = prefixKeys[j]; - altsHashes[altIdx][currKey] = true; - } - } - } else { - const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix); - newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes); - forEach_default(newPartialPathsAndSuffixes, (item) => { - const prefixKeys2 = pathToHashKeys(item.partialPath); - forEach_default(prefixKeys2, (key) => { - altsHashes[altIdx][key] = true; - }); - }); - } - } - } - } - return finalResult; -} -function getLookaheadPathsForOr(occurrence, ruleGrammar, k, orProd) { - const visitor2 = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd); - ruleGrammar.accept(visitor2); - return lookAheadSequenceFromAlternatives(visitor2.result, k); -} -function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) { - const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType); - ruleGrammar.accept(insideDefVisitor); - const insideDef = insideDefVisitor.result; - const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType); - const afterDef = afterDefWalker.startWalking(); - const insideFlat = new Alternative({ definition: insideDef }); - const afterFlat = new Alternative({ definition: afterDef }); - return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k); -} -function containsPath(alternative, searchPath) { - compareOtherPath: - for (let i = 0; i < alternative.length; i++) { - const otherPath = alternative[i]; - if (otherPath.length !== searchPath.length) { - continue; - } - for (let j = 0; j < otherPath.length; j++) { - const searchTok = searchPath[j]; - const otherTok = otherPath[j]; - const matchingTokens = searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== void 0; - if (matchingTokens === false) { - continue compareOtherPath; - } - } - return true; - } - return false; -} -function isStrictPrefixOfPath(prefix, other) { - return prefix.length < other.length && every_default(prefix, (tokType, idx) => { - const otherTokType = other[idx]; - return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]; - }); -} -function areTokenCategoriesNotUsed(lookAheadPaths) { - return every_default(lookAheadPaths, (singleAltPaths) => every_default(singleAltPaths, (singlePath) => every_default(singlePath, (token) => isEmpty_default(token.categoryMatches)))); -} - -// node_modules/chevrotain/lib/src/parse/grammar/checks.js -function validateLookahead(options) { - const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({ - rules: options.rules, - tokenTypes: options.tokenTypes, - grammarName: options.grammarName - }); - return map_default(lookaheadValidationErrorMessages, (errorMessage) => Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage)); -} -function validateGrammar(topLevels, tokenTypes, errMsgProvider, grammarName) { - const duplicateErrors = flatMap_default(topLevels, (currTopLevel) => validateDuplicateProductions(currTopLevel, errMsgProvider)); - const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider); - const tooManyAltsErrors = flatMap_default(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider)); - const duplicateRulesError = flatMap_default(topLevels, (curRule) => validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider)); - return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError); -} -function validateDuplicateProductions(topLevelRule, errMsgProvider) { - const collectorVisitor2 = new OccurrenceValidationCollector(); - topLevelRule.accept(collectorVisitor2); - const allRuleProductions = collectorVisitor2.allProductions; - const productionGroups = groupBy_default(allRuleProductions, identifyProductionForDuplicates); - const duplicates = pickBy_default(productionGroups, (currGroup) => { - return currGroup.length > 1; - }); - const errors = map_default(values_default(duplicates), (currDuplicates) => { - const firstProd = head_default(currDuplicates); - const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates); - const dslName = getProductionDslName(firstProd); - const defError = { - message: msg, - type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS, - ruleName: topLevelRule.name, - dslName, - occurrence: firstProd.idx - }; - const param = getExtraProductionArgument(firstProd); - if (param) { - defError.parameter = param; - } - return defError; - }); - return errors; -} -function identifyProductionForDuplicates(prod) { - return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`; -} -function getExtraProductionArgument(prod) { - if (prod instanceof Terminal) { - return prod.terminalType.name; - } else if (prod instanceof NonTerminal) { - return prod.nonTerminalName; - } else { - return ""; - } -} -var OccurrenceValidationCollector = class extends GAstVisitor { - constructor() { - super(...arguments); - this.allProductions = []; - } - visitNonTerminal(subrule) { - this.allProductions.push(subrule); - } - visitOption(option2) { - this.allProductions.push(option2); - } - visitRepetitionWithSeparator(manySep) { - this.allProductions.push(manySep); - } - visitRepetitionMandatory(atLeastOne) { - this.allProductions.push(atLeastOne); - } - visitRepetitionMandatoryWithSeparator(atLeastOneSep) { - this.allProductions.push(atLeastOneSep); - } - visitRepetition(many) { - this.allProductions.push(many); - } - visitAlternation(or) { - this.allProductions.push(or); - } - visitTerminal(terminal) { - this.allProductions.push(terminal); - } -}; -function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) { - const errors = []; - const occurrences = reduce_default(allRules, (result, curRule) => { - if (curRule.name === rule.name) { - return result + 1; - } - return result; - }, 0); - if (occurrences > 1) { - const errMsg = errMsgProvider.buildDuplicateRuleNameError({ - topLevelRule: rule, - grammarName: className - }); - errors.push({ - message: errMsg, - type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME, - ruleName: rule.name - }); - } - return errors; -} -function validateRuleIsOverridden(ruleName, definedRulesNames, className) { - const errors = []; - let errMsg; - if (!includes_default(definedRulesNames, ruleName)) { - errMsg = `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-as it is not defined in any of the super grammars `; - errors.push({ - message: errMsg, - type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE, - ruleName - }); - } - return errors; -} -function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path = []) { - const errors = []; - const nextNonTerminals = getFirstNoneTerminal(currRule.definition); - if (isEmpty_default(nextNonTerminals)) { - return []; - } else { - const ruleName = topRule.name; - const foundLeftRecursion = includes_default(nextNonTerminals, topRule); - if (foundLeftRecursion) { - errors.push({ - message: errMsgProvider.buildLeftRecursionError({ - topLevelRule: topRule, - leftRecursionPath: path - }), - type: ParserDefinitionErrorType.LEFT_RECURSION, - ruleName - }); - } - const validNextSteps = difference_default(nextNonTerminals, path.concat([topRule])); - const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => { - const newPath = clone_default(path); - newPath.push(currRefRule); - return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath); - }); - return errors.concat(errorsFromNextSteps); - } -} -function getFirstNoneTerminal(definition) { - let result = []; - if (isEmpty_default(definition)) { - return result; - } - const firstProd = head_default(definition); - if (firstProd instanceof NonTerminal) { - result.push(firstProd.referencedRule); - } else if (firstProd instanceof Alternative || firstProd instanceof Option || firstProd instanceof RepetitionMandatory || firstProd instanceof RepetitionMandatoryWithSeparator || firstProd instanceof RepetitionWithSeparator || firstProd instanceof Repetition) { - result = result.concat(getFirstNoneTerminal(firstProd.definition)); - } else if (firstProd instanceof Alternation) { - result = flatten_default(map_default(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition))); - } else if (firstProd instanceof Terminal) { - } else { - throw Error("non exhaustive match"); - } - const isFirstOptional = isOptionalProd(firstProd); - const hasMore = definition.length > 1; - if (isFirstOptional && hasMore) { - const rest = drop_default(definition); - return result.concat(getFirstNoneTerminal(rest)); - } else { - return result; - } -} -var OrCollector = class extends GAstVisitor { - constructor() { - super(...arguments); - this.alternations = []; - } - visitAlternation(node) { - this.alternations.push(node); - } -}; -function validateEmptyOrAlternative(topLevelRule, errMsgProvider) { - const orCollector = new OrCollector(); - topLevelRule.accept(orCollector); - const ors = orCollector.alternations; - const errors = flatMap_default(ors, (currOr) => { - const exceptLast = dropRight_default(currOr.definition); - return flatMap_default(exceptLast, (currAlternative, currAltIdx) => { - const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1); - if (isEmpty_default(possibleFirstInAlt)) { - return [ - { - message: errMsgProvider.buildEmptyAlternationError({ - topLevelRule, - alternation: currOr, - emptyChoiceIdx: currAltIdx - }), - type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT, - ruleName: topLevelRule.name, - occurrence: currOr.idx, - alternative: currAltIdx + 1 - } - ]; - } else { - return []; - } - }); - }); - return errors; -} -function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) { - const orCollector = new OrCollector(); - topLevelRule.accept(orCollector); - let ors = orCollector.alternations; - ors = reject_default(ors, (currOr) => currOr.ignoreAmbiguities === true); - const errors = flatMap_default(ors, (currOr) => { - const currOccurrence = currOr.idx; - const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead; - const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr); - const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider); - const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider); - return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors); - }); - return errors; -} -var RepetitionCollector = class extends GAstVisitor { - constructor() { - super(...arguments); - this.allProductions = []; - } - visitRepetitionWithSeparator(manySep) { - this.allProductions.push(manySep); - } - visitRepetitionMandatory(atLeastOne) { - this.allProductions.push(atLeastOne); - } - visitRepetitionMandatoryWithSeparator(atLeastOneSep) { - this.allProductions.push(atLeastOneSep); - } - visitRepetition(many) { - this.allProductions.push(many); - } -}; -function validateTooManyAlts(topLevelRule, errMsgProvider) { - const orCollector = new OrCollector(); - topLevelRule.accept(orCollector); - const ors = orCollector.alternations; - const errors = flatMap_default(ors, (currOr) => { - if (currOr.definition.length > 255) { - return [ - { - message: errMsgProvider.buildTooManyAlternativesError({ - topLevelRule, - alternation: currOr - }), - type: ParserDefinitionErrorType.TOO_MANY_ALTS, - ruleName: topLevelRule.name, - occurrence: currOr.idx - } - ]; - } else { - return []; - } - }); - return errors; -} -function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) { - const errors = []; - forEach_default(topLevelRules, (currTopRule) => { - const collectorVisitor2 = new RepetitionCollector(); - currTopRule.accept(collectorVisitor2); - const allRuleProductions = collectorVisitor2.allProductions; - forEach_default(allRuleProductions, (currProd) => { - const prodType = getProdType(currProd); - const actualMaxLookahead = currProd.maxLookahead || maxLookahead; - const currOccurrence = currProd.idx; - const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead); - const pathsInsideProduction = paths[0]; - if (isEmpty_default(flatten_default(pathsInsideProduction))) { - const errMsg = errMsgProvider.buildEmptyRepetitionError({ - topLevelRule: currTopRule, - repetition: currProd - }); - errors.push({ - message: errMsg, - type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD, - ruleName: currTopRule.name - }); - } - }); - }); - return errors; -} -function checkAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) { - const foundAmbiguousPaths = []; - const identicalAmbiguities = reduce_default(alternatives, (result, currAlt, currAltIdx) => { - if (alternation2.definition[currAltIdx].ignoreAmbiguities === true) { - return result; - } - forEach_default(currAlt, (currPath) => { - const altsCurrPathAppearsIn = [currAltIdx]; - forEach_default(alternatives, (currOtherAlt, currOtherAltIdx) => { - if (currAltIdx !== currOtherAltIdx && containsPath(currOtherAlt, currPath) && // ignore (skip) ambiguities with this "other" alternative - alternation2.definition[currOtherAltIdx].ignoreAmbiguities !== true) { - altsCurrPathAppearsIn.push(currOtherAltIdx); - } - }); - if (altsCurrPathAppearsIn.length > 1 && !containsPath(foundAmbiguousPaths, currPath)) { - foundAmbiguousPaths.push(currPath); - result.push({ - alts: altsCurrPathAppearsIn, - path: currPath - }); - } - }); - return result; - }, []); - const currErrors = map_default(identicalAmbiguities, (currAmbDescriptor) => { - const ambgIndices = map_default(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1); - const currMessage = errMsgProvider.buildAlternationAmbiguityError({ - topLevelRule: rule, - alternation: alternation2, - ambiguityIndices: ambgIndices, - prefixPath: currAmbDescriptor.path - }); - return { - message: currMessage, - type: ParserDefinitionErrorType.AMBIGUOUS_ALTS, - ruleName: rule.name, - occurrence: alternation2.idx, - alternatives: currAmbDescriptor.alts - }; - }); - return currErrors; -} -function checkPrefixAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) { - const pathsAndIndices = reduce_default(alternatives, (result, currAlt, idx) => { - const currPathsAndIdx = map_default(currAlt, (currPath) => { - return { idx, path: currPath }; - }); - return result.concat(currPathsAndIdx); - }, []); - const errors = compact_default(flatMap_default(pathsAndIndices, (currPathAndIdx) => { - const alternativeGast = alternation2.definition[currPathAndIdx.idx]; - if (alternativeGast.ignoreAmbiguities === true) { - return []; - } - const targetIdx = currPathAndIdx.idx; - const targetPath = currPathAndIdx.path; - const prefixAmbiguitiesPathsAndIndices = filter_default(pathsAndIndices, (searchPathAndIdx) => { - return ( - // ignore (skip) ambiguities with this "other" alternative - alternation2.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true && searchPathAndIdx.idx < targetIdx && // checking for strict prefix because identical lookaheads - // will be be detected using a different validation. - isStrictPrefixOfPath(searchPathAndIdx.path, targetPath) - ); - }); - const currPathPrefixErrors = map_default(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => { - const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1]; - const occurrence = alternation2.idx === 0 ? "" : alternation2.idx; - const message = errMsgProvider.buildAlternationPrefixAmbiguityError({ - topLevelRule: rule, - alternation: alternation2, - ambiguityIndices: ambgIndices, - prefixPath: currAmbPathAndIdx.path - }); - return { - message, - type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS, - ruleName: rule.name, - occurrence, - alternatives: ambgIndices - }; - }); - return currPathPrefixErrors; - })); - return errors; -} -function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) { - const errors = []; - const tokenNames = map_default(tokenTypes, (currToken) => currToken.name); - forEach_default(topLevels, (currRule) => { - const currRuleName = currRule.name; - if (includes_default(tokenNames, currRuleName)) { - const errMsg = errMsgProvider.buildNamespaceConflictError(currRule); - errors.push({ - message: errMsg, - type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE, - ruleName: currRuleName - }); - } - }); - return errors; -} - -// node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js -function resolveGrammar2(options) { - const actualOptions = defaults_default(options, { - errMsgProvider: defaultGrammarResolverErrorProvider - }); - const topRulesTable = {}; - forEach_default(options.rules, (rule) => { - topRulesTable[rule.name] = rule; - }); - return resolveGrammar(topRulesTable, actualOptions.errMsgProvider); -} -function validateGrammar2(options) { - options = defaults_default(options, { - errMsgProvider: defaultGrammarValidatorErrorProvider - }); - return validateGrammar(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName); -} - -// node_modules/chevrotain/lib/src/parse/exceptions_public.js -var MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException"; -var NO_VIABLE_ALT_EXCEPTION = "NoViableAltException"; -var EARLY_EXIT_EXCEPTION = "EarlyExitException"; -var NOT_ALL_INPUT_PARSED_EXCEPTION = "NotAllInputParsedException"; -var RECOGNITION_EXCEPTION_NAMES = [ - MISMATCHED_TOKEN_EXCEPTION, - NO_VIABLE_ALT_EXCEPTION, - EARLY_EXIT_EXCEPTION, - NOT_ALL_INPUT_PARSED_EXCEPTION -]; -Object.freeze(RECOGNITION_EXCEPTION_NAMES); -function isRecognitionException(error) { - return includes_default(RECOGNITION_EXCEPTION_NAMES, error.name); -} -var RecognitionException = class extends Error { - constructor(message, token) { - super(message); - this.token = token; - this.resyncedTokens = []; - Object.setPrototypeOf(this, new.target.prototype); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - } -}; -var MismatchedTokenException = class extends RecognitionException { - constructor(message, token, previousToken) { - super(message, token); - this.previousToken = previousToken; - this.name = MISMATCHED_TOKEN_EXCEPTION; - } -}; -var NoViableAltException = class extends RecognitionException { - constructor(message, token, previousToken) { - super(message, token); - this.previousToken = previousToken; - this.name = NO_VIABLE_ALT_EXCEPTION; - } -}; -var NotAllInputParsedException = class extends RecognitionException { - constructor(message, token) { - super(message, token); - this.name = NOT_ALL_INPUT_PARSED_EXCEPTION; - } -}; -var EarlyExitException = class extends RecognitionException { - constructor(message, token, previousToken) { - super(message, token); - this.previousToken = previousToken; - this.name = EARLY_EXIT_EXCEPTION; - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js -var EOF_FOLLOW_KEY = {}; -var IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException"; -var InRuleRecoveryException = class extends Error { - constructor(message) { - super(message); - this.name = IN_RULE_RECOVERY_EXCEPTION; - } -}; -var Recoverable = class { - initRecoverable(config) { - this.firstAfterRepMap = {}; - this.resyncFollows = {}; - this.recoveryEnabled = has_default(config, "recoveryEnabled") ? config.recoveryEnabled : DEFAULT_PARSER_CONFIG.recoveryEnabled; - if (this.recoveryEnabled) { - this.attemptInRepetitionRecovery = attemptInRepetitionRecovery; - } - } - getTokenToInsert(tokType) { - const tokToInsert = createTokenInstance(tokType, "", NaN, NaN, NaN, NaN, NaN, NaN); - tokToInsert.isInsertedInRecovery = true; - return tokToInsert; - } - canTokenTypeBeInsertedInRecovery(tokType) { - return true; - } - canTokenTypeBeDeletedInRecovery(tokType) { - return true; - } - tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) { - const reSyncTokType = this.findReSyncTokenType(); - const savedLexerState = this.exportLexerState(); - const resyncedTokens = []; - let passedResyncPoint = false; - const nextTokenWithoutResync = this.LA(1); - let currToken = this.LA(1); - const generateErrorMessage = () => { - const previousToken = this.LA(0); - const msg = this.errorMessageProvider.buildMismatchTokenMessage({ - expected: expectedTokType, - actual: nextTokenWithoutResync, - previous: previousToken, - ruleName: this.getCurrRuleFullName() - }); - const error = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0)); - error.resyncedTokens = dropRight_default(resyncedTokens); - this.SAVE_ERROR(error); - }; - while (!passedResyncPoint) { - if (this.tokenMatcher(currToken, expectedTokType)) { - generateErrorMessage(); - return; - } else if (lookAheadFunc.call(this)) { - generateErrorMessage(); - grammarRule.apply(this, grammarRuleArgs); - return; - } else if (this.tokenMatcher(currToken, reSyncTokType)) { - passedResyncPoint = true; - } else { - currToken = this.SKIP_TOKEN(); - this.addToResyncTokens(currToken, resyncedTokens); - } - } - this.importLexerState(savedLexerState); - } - shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) { - if (notStuck === false) { - return false; - } - if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) { - return false; - } - if (this.isBackTracking()) { - return false; - } - if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) { - return false; - } - return true; - } - // Error Recovery functionality - getFollowsForInRuleRecovery(tokType, tokIdxInRule) { - const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule); - const follows = this.getNextPossibleTokenTypes(grammarPath); - return follows; - } - tryInRuleRecovery(expectedTokType, follows) { - if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) { - const tokToInsert = this.getTokenToInsert(expectedTokType); - return tokToInsert; - } - if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) { - const nextTok = this.SKIP_TOKEN(); - this.consumeToken(); - return nextTok; - } - throw new InRuleRecoveryException("sad sad panda"); - } - canPerformInRuleRecovery(expectedToken, follows) { - return this.canRecoverWithSingleTokenInsertion(expectedToken, follows) || this.canRecoverWithSingleTokenDeletion(expectedToken); - } - canRecoverWithSingleTokenInsertion(expectedTokType, follows) { - if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) { - return false; - } - if (isEmpty_default(follows)) { - return false; - } - const mismatchedTok = this.LA(1); - const isMisMatchedTokInFollows = find_default(follows, (possibleFollowsTokType) => { - return this.tokenMatcher(mismatchedTok, possibleFollowsTokType); - }) !== void 0; - return isMisMatchedTokInFollows; - } - canRecoverWithSingleTokenDeletion(expectedTokType) { - if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) { - return false; - } - const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType); - return isNextTokenWhatIsExpected; - } - isInCurrentRuleReSyncSet(tokenTypeIdx) { - const followKey = this.getCurrFollowKey(); - const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey); - return includes_default(currentRuleReSyncSet, tokenTypeIdx); - } - findReSyncTokenType() { - const allPossibleReSyncTokTypes = this.flattenFollowSet(); - let nextToken = this.LA(1); - let k = 2; - while (true) { - const foundMatch = find_default(allPossibleReSyncTokTypes, (resyncTokType) => { - const canMatch = tokenMatcher(nextToken, resyncTokType); - return canMatch; - }); - if (foundMatch !== void 0) { - return foundMatch; - } - nextToken = this.LA(k); - k++; - } - } - getCurrFollowKey() { - if (this.RULE_STACK.length === 1) { - return EOF_FOLLOW_KEY; - } - const currRuleShortName = this.getLastExplicitRuleShortName(); - const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex(); - const prevRuleShortName = this.getPreviousExplicitRuleShortName(); - return { - ruleName: this.shortRuleNameToFullName(currRuleShortName), - idxInCallingRule: currRuleIdx, - inRule: this.shortRuleNameToFullName(prevRuleShortName) - }; - } - buildFullFollowKeyStack() { - const explicitRuleStack = this.RULE_STACK; - const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK; - return map_default(explicitRuleStack, (ruleName, idx) => { - if (idx === 0) { - return EOF_FOLLOW_KEY; - } - return { - ruleName: this.shortRuleNameToFullName(ruleName), - idxInCallingRule: explicitOccurrenceStack[idx], - inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]) - }; - }); - } - flattenFollowSet() { - const followStack = map_default(this.buildFullFollowKeyStack(), (currKey) => { - return this.getFollowSetFromFollowKey(currKey); - }); - return flatten_default(followStack); - } - getFollowSetFromFollowKey(followKey) { - if (followKey === EOF_FOLLOW_KEY) { - return [EOF]; - } - const followName = followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule; - return this.resyncFollows[followName]; - } - // It does not make any sense to include a virtual EOF token in the list of resynced tokens - // as EOF does not really exist and thus does not contain any useful information (line/column numbers) - addToResyncTokens(token, resyncTokens) { - if (!this.tokenMatcher(token, EOF)) { - resyncTokens.push(token); - } - return resyncTokens; - } - reSyncTo(tokType) { - const resyncedTokens = []; - let nextTok = this.LA(1); - while (this.tokenMatcher(nextTok, tokType) === false) { - nextTok = this.SKIP_TOKEN(); - this.addToResyncTokens(nextTok, resyncedTokens); - } - return dropRight_default(resyncedTokens); - } - attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) { - } - getCurrentGrammarPath(tokType, tokIdxInRule) { - const pathRuleStack = this.getHumanReadableRuleStack(); - const pathOccurrenceStack = clone_default(this.RULE_OCCURRENCE_STACK); - const grammarPath = { - ruleStack: pathRuleStack, - occurrenceStack: pathOccurrenceStack, - lastTok: tokType, - lastTokOccurrence: tokIdxInRule - }; - return grammarPath; - } - getHumanReadableRuleStack() { - return map_default(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName)); - } -}; -function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) { - const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence); - let firstAfterRepInfo = this.firstAfterRepMap[key]; - if (firstAfterRepInfo === void 0) { - const currRuleName = this.getCurrRuleFullName(); - const ruleGrammar = this.getGAstProductions()[currRuleName]; - const walker = new nextToksWalker(ruleGrammar, prodOccurrence); - firstAfterRepInfo = walker.startWalking(); - this.firstAfterRepMap[key] = firstAfterRepInfo; - } - let expectTokAfterLastMatch = firstAfterRepInfo.token; - let nextTokIdx = firstAfterRepInfo.occurrence; - const isEndOfRule = firstAfterRepInfo.isEndOfRule; - if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === void 0) { - expectTokAfterLastMatch = EOF; - nextTokIdx = 1; - } - if (expectTokAfterLastMatch === void 0 || nextTokIdx === void 0) { - return; - } - if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) { - this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch); - } -} - -// node_modules/chevrotain/lib/src/parse/grammar/keys.js -var BITS_FOR_METHOD_TYPE = 4; -var BITS_FOR_OCCURRENCE_IDX = 8; -var BITS_FOR_ALT_IDX = 8; -var OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX; -var OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX; -var MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX; -var AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX; -var MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX; -var AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX; -function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) { - return occurrence | dslMethodIdx | ruleIdx; -} -var BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX; - -// node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js -var LLkLookaheadStrategy = class { - constructor(options) { - var _a; - this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead; - } - validate(options) { - const leftRecursionErrors = this.validateNoLeftRecursion(options.rules); - if (isEmpty_default(leftRecursionErrors)) { - const emptyAltErrors = this.validateEmptyOrAlternatives(options.rules); - const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options.rules, this.maxLookahead); - const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options.rules, this.maxLookahead); - const allErrors = [ - ...leftRecursionErrors, - ...emptyAltErrors, - ...ambiguousAltsErrors, - ...emptyRepetitionErrors - ]; - return allErrors; - } - return leftRecursionErrors; - } - validateNoLeftRecursion(rules) { - return flatMap_default(rules, (currTopRule) => validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider)); - } - validateEmptyOrAlternatives(rules) { - return flatMap_default(rules, (currTopRule) => validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider)); - } - validateAmbiguousAlternationAlternatives(rules, maxLookahead) { - return flatMap_default(rules, (currTopRule) => validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider)); - } - validateSomeNonEmptyLookaheadPath(rules, maxLookahead) { - return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider); - } - buildLookaheadForAlternation(options) { - return buildLookaheadFuncForOr(options.prodOccurrence, options.rule, options.maxLookahead, options.hasPredicates, options.dynamicTokensEnabled, buildAlternativesLookAheadFunc); - } - buildLookaheadForOptional(options) { - return buildLookaheadFuncForOptionalProd(options.prodOccurrence, options.rule, options.maxLookahead, options.dynamicTokensEnabled, getProdType(options.prodType), buildSingleAlternativeLookaheadFunction); - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js -var LooksAhead = class { - initLooksAhead(config) { - this.dynamicTokensEnabled = has_default(config, "dynamicTokensEnabled") ? config.dynamicTokensEnabled : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled; - this.maxLookahead = has_default(config, "maxLookahead") ? config.maxLookahead : DEFAULT_PARSER_CONFIG.maxLookahead; - this.lookaheadStrategy = has_default(config, "lookaheadStrategy") ? config.lookaheadStrategy : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead }); - this.lookAheadFuncsCache = /* @__PURE__ */ new Map(); - } - preComputeLookaheadFunctions(rules) { - forEach_default(rules, (currRule) => { - this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => { - const { alternation: alternation2, repetition: repetition2, option: option2, repetitionMandatory: repetitionMandatory2, repetitionMandatoryWithSeparator, repetitionWithSeparator } = collectMethods(currRule); - forEach_default(alternation2, (currProd) => { - const prodIdx = currProd.idx === 0 ? "" : currProd.idx; - this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => { - const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({ - prodOccurrence: currProd.idx, - rule: currRule, - maxLookahead: currProd.maxLookahead || this.maxLookahead, - hasPredicates: currProd.hasPredicates, - dynamicTokensEnabled: this.dynamicTokensEnabled - }); - const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx); - this.setLaFuncCache(key, laFunc); - }); - }); - forEach_default(repetition2, (currProd) => { - this.computeLookaheadFunc(currRule, currProd.idx, MANY_IDX, "Repetition", currProd.maxLookahead, getProductionDslName(currProd)); - }); - forEach_default(option2, (currProd) => { - this.computeLookaheadFunc(currRule, currProd.idx, OPTION_IDX, "Option", currProd.maxLookahead, getProductionDslName(currProd)); - }); - forEach_default(repetitionMandatory2, (currProd) => { - this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_IDX, "RepetitionMandatory", currProd.maxLookahead, getProductionDslName(currProd)); - }); - forEach_default(repetitionMandatoryWithSeparator, (currProd) => { - this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_SEP_IDX, "RepetitionMandatoryWithSeparator", currProd.maxLookahead, getProductionDslName(currProd)); - }); - forEach_default(repetitionWithSeparator, (currProd) => { - this.computeLookaheadFunc(currRule, currProd.idx, MANY_SEP_IDX, "RepetitionWithSeparator", currProd.maxLookahead, getProductionDslName(currProd)); - }); - }); - }); - } - computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) { - this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? "" : prodOccurrence}`, () => { - const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({ - prodOccurrence, - rule, - maxLookahead: prodMaxLookahead || this.maxLookahead, - dynamicTokensEnabled: this.dynamicTokensEnabled, - prodType - }); - const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence); - this.setLaFuncCache(key, laFunc); - }); - } - // this actually returns a number, but it is always used as a string (object prop key) - getKeyForAutomaticLookahead(dslMethodIdx, occurrence) { - const currRuleShortName = this.getLastExplicitRuleShortName(); - return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence); - } - getLaFuncFromCache(key) { - return this.lookAheadFuncsCache.get(key); - } - /* istanbul ignore next */ - setLaFuncCache(key, value) { - this.lookAheadFuncsCache.set(key, value); - } -}; -var DslMethodsCollectorVisitor = class extends GAstVisitor { - constructor() { - super(...arguments); - this.dslMethods = { - option: [], - alternation: [], - repetition: [], - repetitionWithSeparator: [], - repetitionMandatory: [], - repetitionMandatoryWithSeparator: [] - }; - } - reset() { - this.dslMethods = { - option: [], - alternation: [], - repetition: [], - repetitionWithSeparator: [], - repetitionMandatory: [], - repetitionMandatoryWithSeparator: [] - }; - } - visitOption(option2) { - this.dslMethods.option.push(option2); - } - visitRepetitionWithSeparator(manySep) { - this.dslMethods.repetitionWithSeparator.push(manySep); - } - visitRepetitionMandatory(atLeastOne) { - this.dslMethods.repetitionMandatory.push(atLeastOne); - } - visitRepetitionMandatoryWithSeparator(atLeastOneSep) { - this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep); - } - visitRepetition(many) { - this.dslMethods.repetition.push(many); - } - visitAlternation(or) { - this.dslMethods.alternation.push(or); - } -}; -var collectorVisitor = new DslMethodsCollectorVisitor(); -function collectMethods(rule) { - collectorVisitor.reset(); - rule.accept(collectorVisitor); - const dslMethods = collectorVisitor.dslMethods; - collectorVisitor.reset(); - return dslMethods; -} - -// node_modules/chevrotain/lib/src/parse/cst/cst.js -function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) { - if (isNaN(currNodeLocation.startOffset) === true) { - currNodeLocation.startOffset = newLocationInfo.startOffset; - currNodeLocation.endOffset = newLocationInfo.endOffset; - } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) { - currNodeLocation.endOffset = newLocationInfo.endOffset; - } -} -function setNodeLocationFull(currNodeLocation, newLocationInfo) { - if (isNaN(currNodeLocation.startOffset) === true) { - currNodeLocation.startOffset = newLocationInfo.startOffset; - currNodeLocation.startColumn = newLocationInfo.startColumn; - currNodeLocation.startLine = newLocationInfo.startLine; - currNodeLocation.endOffset = newLocationInfo.endOffset; - currNodeLocation.endColumn = newLocationInfo.endColumn; - currNodeLocation.endLine = newLocationInfo.endLine; - } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) { - currNodeLocation.endOffset = newLocationInfo.endOffset; - currNodeLocation.endColumn = newLocationInfo.endColumn; - currNodeLocation.endLine = newLocationInfo.endLine; - } -} -function addTerminalToCst(node, token, tokenTypeName) { - if (node.children[tokenTypeName] === void 0) { - node.children[tokenTypeName] = [token]; - } else { - node.children[tokenTypeName].push(token); - } -} -function addNoneTerminalToCst(node, ruleName, ruleResult) { - if (node.children[ruleName] === void 0) { - node.children[ruleName] = [ruleResult]; - } else { - node.children[ruleName].push(ruleResult); - } -} - -// node_modules/chevrotain/lib/src/lang/lang_extensions.js -var NAME = "name"; -function defineNameProp(obj, nameValue) { - Object.defineProperty(obj, NAME, { - enumerable: false, - configurable: true, - writable: false, - value: nameValue - }); -} - -// node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js -function defaultVisit(ctx, param) { - const childrenNames = keys_default(ctx); - const childrenNamesLength = childrenNames.length; - for (let i = 0; i < childrenNamesLength; i++) { - const currChildName = childrenNames[i]; - const currChildArray = ctx[currChildName]; - const currChildArrayLength = currChildArray.length; - for (let j = 0; j < currChildArrayLength; j++) { - const currChild = currChildArray[j]; - if (currChild.tokenTypeIdx === void 0) { - this[currChild.name](currChild.children, param); - } - } - } -} -function createBaseSemanticVisitorConstructor(grammarName, ruleNames) { - const derivedConstructor = function() { - }; - defineNameProp(derivedConstructor, grammarName + "BaseSemantics"); - const semanticProto = { - visit: function(cstNode, param) { - if (isArray_default(cstNode)) { - cstNode = cstNode[0]; - } - if (isUndefined_default(cstNode)) { - return void 0; - } - return this[cstNode.name](cstNode.children, param); - }, - validateVisitor: function() { - const semanticDefinitionErrors = validateVisitor(this, ruleNames); - if (!isEmpty_default(semanticDefinitionErrors)) { - const errorMessages = map_default(semanticDefinitionErrors, (currDefError) => currDefError.msg); - throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: - ${errorMessages.join("\n\n").replace(/\n/g, "\n ")}`); - } - } - }; - derivedConstructor.prototype = semanticProto; - derivedConstructor.prototype.constructor = derivedConstructor; - derivedConstructor._RULE_NAMES = ruleNames; - return derivedConstructor; -} -function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) { - const derivedConstructor = function() { - }; - defineNameProp(derivedConstructor, grammarName + "BaseSemanticsWithDefaults"); - const withDefaultsProto = Object.create(baseConstructor.prototype); - forEach_default(ruleNames, (ruleName) => { - withDefaultsProto[ruleName] = defaultVisit; - }); - derivedConstructor.prototype = withDefaultsProto; - derivedConstructor.prototype.constructor = derivedConstructor; - return derivedConstructor; -} -var CstVisitorDefinitionError; -(function(CstVisitorDefinitionError2) { - CstVisitorDefinitionError2[CstVisitorDefinitionError2["REDUNDANT_METHOD"] = 0] = "REDUNDANT_METHOD"; - CstVisitorDefinitionError2[CstVisitorDefinitionError2["MISSING_METHOD"] = 1] = "MISSING_METHOD"; -})(CstVisitorDefinitionError || (CstVisitorDefinitionError = {})); -function validateVisitor(visitorInstance, ruleNames) { - const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames); - return missingErrors; -} -function validateMissingCstMethods(visitorInstance, ruleNames) { - const missingRuleNames = filter_default(ruleNames, (currRuleName) => { - return isFunction_default(visitorInstance[currRuleName]) === false; - }); - const errors = map_default(missingRuleNames, (currRuleName) => { - return { - msg: `Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`, - type: CstVisitorDefinitionError.MISSING_METHOD, - methodName: currRuleName - }; - }); - return compact_default(errors); -} - -// node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js -var TreeBuilder = class { - initTreeBuilder(config) { - this.CST_STACK = []; - this.outputCst = config.outputCst; - this.nodeLocationTracking = has_default(config, "nodeLocationTracking") ? config.nodeLocationTracking : DEFAULT_PARSER_CONFIG.nodeLocationTracking; - if (!this.outputCst) { - this.cstInvocationStateUpdate = noop_default; - this.cstFinallyStateUpdate = noop_default; - this.cstPostTerminal = noop_default; - this.cstPostNonTerminal = noop_default; - this.cstPostRule = noop_default; - } else { - if (/full/i.test(this.nodeLocationTracking)) { - if (this.recoveryEnabled) { - this.setNodeLocationFromToken = setNodeLocationFull; - this.setNodeLocationFromNode = setNodeLocationFull; - this.cstPostRule = noop_default; - this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery; - } else { - this.setNodeLocationFromToken = noop_default; - this.setNodeLocationFromNode = noop_default; - this.cstPostRule = this.cstPostRuleFull; - this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular; - } - } else if (/onlyOffset/i.test(this.nodeLocationTracking)) { - if (this.recoveryEnabled) { - this.setNodeLocationFromToken = setNodeLocationOnlyOffset; - this.setNodeLocationFromNode = setNodeLocationOnlyOffset; - this.cstPostRule = noop_default; - this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery; - } else { - this.setNodeLocationFromToken = noop_default; - this.setNodeLocationFromNode = noop_default; - this.cstPostRule = this.cstPostRuleOnlyOffset; - this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular; - } - } else if (/none/i.test(this.nodeLocationTracking)) { - this.setNodeLocationFromToken = noop_default; - this.setNodeLocationFromNode = noop_default; - this.cstPostRule = noop_default; - this.setInitialNodeLocation = noop_default; - } else { - throw Error(`Invalid config option: "${config.nodeLocationTracking}"`); - } - } - } - setInitialNodeLocationOnlyOffsetRecovery(cstNode) { - cstNode.location = { - startOffset: NaN, - endOffset: NaN - }; - } - setInitialNodeLocationOnlyOffsetRegular(cstNode) { - cstNode.location = { - // without error recovery the starting Location of a new CstNode is guaranteed - // To be the next Token's startOffset (for valid inputs). - // For invalid inputs there won't be any CSTOutput so this potential - // inaccuracy does not matter - startOffset: this.LA(1).startOffset, - endOffset: NaN - }; - } - setInitialNodeLocationFullRecovery(cstNode) { - cstNode.location = { - startOffset: NaN, - startLine: NaN, - startColumn: NaN, - endOffset: NaN, - endLine: NaN, - endColumn: NaN - }; - } - /** - * @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work - - * @param cstNode - */ - setInitialNodeLocationFullRegular(cstNode) { - const nextToken = this.LA(1); - cstNode.location = { - startOffset: nextToken.startOffset, - startLine: nextToken.startLine, - startColumn: nextToken.startColumn, - endOffset: NaN, - endLine: NaN, - endColumn: NaN - }; - } - cstInvocationStateUpdate(fullRuleName) { - const cstNode = { - name: fullRuleName, - children: /* @__PURE__ */ Object.create(null) - }; - this.setInitialNodeLocation(cstNode); - this.CST_STACK.push(cstNode); - } - cstFinallyStateUpdate() { - this.CST_STACK.pop(); - } - cstPostRuleFull(ruleCstNode) { - const prevToken = this.LA(0); - const loc = ruleCstNode.location; - if (loc.startOffset <= prevToken.startOffset === true) { - loc.endOffset = prevToken.endOffset; - loc.endLine = prevToken.endLine; - loc.endColumn = prevToken.endColumn; - } else { - loc.startOffset = NaN; - loc.startLine = NaN; - loc.startColumn = NaN; - } - } - cstPostRuleOnlyOffset(ruleCstNode) { - const prevToken = this.LA(0); - const loc = ruleCstNode.location; - if (loc.startOffset <= prevToken.startOffset === true) { - loc.endOffset = prevToken.endOffset; - } else { - loc.startOffset = NaN; - } - } - cstPostTerminal(key, consumedToken) { - const rootCst = this.CST_STACK[this.CST_STACK.length - 1]; - addTerminalToCst(rootCst, consumedToken, key); - this.setNodeLocationFromToken(rootCst.location, consumedToken); - } - cstPostNonTerminal(ruleCstResult, ruleName) { - const preCstNode = this.CST_STACK[this.CST_STACK.length - 1]; - addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult); - this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location); - } - getBaseCstVisitorConstructor() { - if (isUndefined_default(this.baseCstVisitorConstructor)) { - const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(this.className, keys_default(this.gastProductionsCache)); - this.baseCstVisitorConstructor = newBaseCstVisitorConstructor; - return newBaseCstVisitorConstructor; - } - return this.baseCstVisitorConstructor; - } - getBaseCstVisitorConstructorWithDefaults() { - if (isUndefined_default(this.baseCstVisitorWithDefaultsConstructor)) { - const newConstructor = createBaseVisitorConstructorWithDefaults(this.className, keys_default(this.gastProductionsCache), this.getBaseCstVisitorConstructor()); - this.baseCstVisitorWithDefaultsConstructor = newConstructor; - return newConstructor; - } - return this.baseCstVisitorWithDefaultsConstructor; - } - getLastExplicitRuleShortName() { - const ruleStack = this.RULE_STACK; - return ruleStack[ruleStack.length - 1]; - } - getPreviousExplicitRuleShortName() { - const ruleStack = this.RULE_STACK; - return ruleStack[ruleStack.length - 2]; - } - getLastExplicitRuleOccurrenceIndex() { - const occurrenceStack = this.RULE_OCCURRENCE_STACK; - return occurrenceStack[occurrenceStack.length - 1]; - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js -var LexerAdapter = class { - initLexerAdapter() { - this.tokVector = []; - this.tokVectorLength = 0; - this.currIdx = -1; - } - set input(newInput) { - if (this.selfAnalysisDone !== true) { - throw Error(`Missing invocation at the end of the Parser's constructor.`); - } - this.reset(); - this.tokVector = newInput; - this.tokVectorLength = newInput.length; - } - get input() { - return this.tokVector; - } - // skips a token and returns the next token - SKIP_TOKEN() { - if (this.currIdx <= this.tokVector.length - 2) { - this.consumeToken(); - return this.LA(1); - } else { - return END_OF_FILE; - } - } - // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers - // or lexers dependent on parser context. - LA(howMuch) { - const soughtIdx = this.currIdx + howMuch; - if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) { - return END_OF_FILE; - } else { - return this.tokVector[soughtIdx]; - } - } - consumeToken() { - this.currIdx++; - } - exportLexerState() { - return this.currIdx; - } - importLexerState(newState2) { - this.currIdx = newState2; - } - resetLexerState() { - this.currIdx = -1; - } - moveToTerminatedState() { - this.currIdx = this.tokVector.length - 1; - } - getLexerPosition() { - return this.exportLexerState(); - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js -var RecognizerApi = class { - ACTION(impl) { - return impl.call(this); - } - consume(idx, tokType, options) { - return this.consumeInternal(tokType, idx, options); - } - subrule(idx, ruleToCall, options) { - return this.subruleInternal(ruleToCall, idx, options); - } - option(idx, actionORMethodDef) { - return this.optionInternal(actionORMethodDef, idx); - } - or(idx, altsOrOpts) { - return this.orInternal(altsOrOpts, idx); - } - many(idx, actionORMethodDef) { - return this.manyInternal(idx, actionORMethodDef); - } - atLeastOne(idx, actionORMethodDef) { - return this.atLeastOneInternal(idx, actionORMethodDef); - } - CONSUME(tokType, options) { - return this.consumeInternal(tokType, 0, options); - } - CONSUME1(tokType, options) { - return this.consumeInternal(tokType, 1, options); - } - CONSUME2(tokType, options) { - return this.consumeInternal(tokType, 2, options); - } - CONSUME3(tokType, options) { - return this.consumeInternal(tokType, 3, options); - } - CONSUME4(tokType, options) { - return this.consumeInternal(tokType, 4, options); - } - CONSUME5(tokType, options) { - return this.consumeInternal(tokType, 5, options); - } - CONSUME6(tokType, options) { - return this.consumeInternal(tokType, 6, options); - } - CONSUME7(tokType, options) { - return this.consumeInternal(tokType, 7, options); - } - CONSUME8(tokType, options) { - return this.consumeInternal(tokType, 8, options); - } - CONSUME9(tokType, options) { - return this.consumeInternal(tokType, 9, options); - } - SUBRULE(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 0, options); - } - SUBRULE1(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 1, options); - } - SUBRULE2(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 2, options); - } - SUBRULE3(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 3, options); - } - SUBRULE4(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 4, options); - } - SUBRULE5(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 5, options); - } - SUBRULE6(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 6, options); - } - SUBRULE7(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 7, options); - } - SUBRULE8(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 8, options); - } - SUBRULE9(ruleToCall, options) { - return this.subruleInternal(ruleToCall, 9, options); - } - OPTION(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 0); - } - OPTION1(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 1); - } - OPTION2(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 2); - } - OPTION3(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 3); - } - OPTION4(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 4); - } - OPTION5(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 5); - } - OPTION6(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 6); - } - OPTION7(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 7); - } - OPTION8(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 8); - } - OPTION9(actionORMethodDef) { - return this.optionInternal(actionORMethodDef, 9); - } - OR(altsOrOpts) { - return this.orInternal(altsOrOpts, 0); - } - OR1(altsOrOpts) { - return this.orInternal(altsOrOpts, 1); - } - OR2(altsOrOpts) { - return this.orInternal(altsOrOpts, 2); - } - OR3(altsOrOpts) { - return this.orInternal(altsOrOpts, 3); - } - OR4(altsOrOpts) { - return this.orInternal(altsOrOpts, 4); - } - OR5(altsOrOpts) { - return this.orInternal(altsOrOpts, 5); - } - OR6(altsOrOpts) { - return this.orInternal(altsOrOpts, 6); - } - OR7(altsOrOpts) { - return this.orInternal(altsOrOpts, 7); - } - OR8(altsOrOpts) { - return this.orInternal(altsOrOpts, 8); - } - OR9(altsOrOpts) { - return this.orInternal(altsOrOpts, 9); - } - MANY(actionORMethodDef) { - this.manyInternal(0, actionORMethodDef); - } - MANY1(actionORMethodDef) { - this.manyInternal(1, actionORMethodDef); - } - MANY2(actionORMethodDef) { - this.manyInternal(2, actionORMethodDef); - } - MANY3(actionORMethodDef) { - this.manyInternal(3, actionORMethodDef); - } - MANY4(actionORMethodDef) { - this.manyInternal(4, actionORMethodDef); - } - MANY5(actionORMethodDef) { - this.manyInternal(5, actionORMethodDef); - } - MANY6(actionORMethodDef) { - this.manyInternal(6, actionORMethodDef); - } - MANY7(actionORMethodDef) { - this.manyInternal(7, actionORMethodDef); - } - MANY8(actionORMethodDef) { - this.manyInternal(8, actionORMethodDef); - } - MANY9(actionORMethodDef) { - this.manyInternal(9, actionORMethodDef); - } - MANY_SEP(options) { - this.manySepFirstInternal(0, options); - } - MANY_SEP1(options) { - this.manySepFirstInternal(1, options); - } - MANY_SEP2(options) { - this.manySepFirstInternal(2, options); - } - MANY_SEP3(options) { - this.manySepFirstInternal(3, options); - } - MANY_SEP4(options) { - this.manySepFirstInternal(4, options); - } - MANY_SEP5(options) { - this.manySepFirstInternal(5, options); - } - MANY_SEP6(options) { - this.manySepFirstInternal(6, options); - } - MANY_SEP7(options) { - this.manySepFirstInternal(7, options); - } - MANY_SEP8(options) { - this.manySepFirstInternal(8, options); - } - MANY_SEP9(options) { - this.manySepFirstInternal(9, options); - } - AT_LEAST_ONE(actionORMethodDef) { - this.atLeastOneInternal(0, actionORMethodDef); - } - AT_LEAST_ONE1(actionORMethodDef) { - return this.atLeastOneInternal(1, actionORMethodDef); - } - AT_LEAST_ONE2(actionORMethodDef) { - this.atLeastOneInternal(2, actionORMethodDef); - } - AT_LEAST_ONE3(actionORMethodDef) { - this.atLeastOneInternal(3, actionORMethodDef); - } - AT_LEAST_ONE4(actionORMethodDef) { - this.atLeastOneInternal(4, actionORMethodDef); - } - AT_LEAST_ONE5(actionORMethodDef) { - this.atLeastOneInternal(5, actionORMethodDef); - } - AT_LEAST_ONE6(actionORMethodDef) { - this.atLeastOneInternal(6, actionORMethodDef); - } - AT_LEAST_ONE7(actionORMethodDef) { - this.atLeastOneInternal(7, actionORMethodDef); - } - AT_LEAST_ONE8(actionORMethodDef) { - this.atLeastOneInternal(8, actionORMethodDef); - } - AT_LEAST_ONE9(actionORMethodDef) { - this.atLeastOneInternal(9, actionORMethodDef); - } - AT_LEAST_ONE_SEP(options) { - this.atLeastOneSepFirstInternal(0, options); - } - AT_LEAST_ONE_SEP1(options) { - this.atLeastOneSepFirstInternal(1, options); - } - AT_LEAST_ONE_SEP2(options) { - this.atLeastOneSepFirstInternal(2, options); - } - AT_LEAST_ONE_SEP3(options) { - this.atLeastOneSepFirstInternal(3, options); - } - AT_LEAST_ONE_SEP4(options) { - this.atLeastOneSepFirstInternal(4, options); - } - AT_LEAST_ONE_SEP5(options) { - this.atLeastOneSepFirstInternal(5, options); - } - AT_LEAST_ONE_SEP6(options) { - this.atLeastOneSepFirstInternal(6, options); - } - AT_LEAST_ONE_SEP7(options) { - this.atLeastOneSepFirstInternal(7, options); - } - AT_LEAST_ONE_SEP8(options) { - this.atLeastOneSepFirstInternal(8, options); - } - AT_LEAST_ONE_SEP9(options) { - this.atLeastOneSepFirstInternal(9, options); - } - RULE(name, implementation, config = DEFAULT_RULE_CONFIG) { - if (includes_default(this.definedRulesNames, name)) { - const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({ - topLevelRule: name, - grammarName: this.className - }); - const error = { - message: errMsg, - type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME, - ruleName: name - }; - this.definitionErrors.push(error); - } - this.definedRulesNames.push(name); - const ruleImplementation = this.defineRule(name, implementation, config); - this[name] = ruleImplementation; - return ruleImplementation; - } - OVERRIDE_RULE(name, impl, config = DEFAULT_RULE_CONFIG) { - const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className); - this.definitionErrors = this.definitionErrors.concat(ruleErrors); - const ruleImplementation = this.defineRule(name, impl, config); - this[name] = ruleImplementation; - return ruleImplementation; - } - BACKTRACK(grammarRule, args) { - return function() { - this.isBackTrackingStack.push(1); - const orgState = this.saveRecogState(); - try { - grammarRule.apply(this, args); - return true; - } catch (e) { - if (isRecognitionException(e)) { - return false; - } else { - throw e; - } - } finally { - this.reloadRecogState(orgState); - this.isBackTrackingStack.pop(); - } - }; - } - // GAST export APIs - getGAstProductions() { - return this.gastProductionsCache; - } - getSerializedGastProductions() { - return serializeGrammar(values_default(this.gastProductionsCache)); - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js -var RecognizerEngine = class { - initRecognizerEngine(tokenVocabulary, config) { - this.className = this.constructor.name; - this.shortRuleNameToFull = {}; - this.fullRuleNameToShort = {}; - this.ruleShortNameIdx = 256; - this.tokenMatcher = tokenStructuredMatcherNoCategories; - this.subruleIdx = 0; - this.definedRulesNames = []; - this.tokensMap = {}; - this.isBackTrackingStack = []; - this.RULE_STACK = []; - this.RULE_OCCURRENCE_STACK = []; - this.gastProductionsCache = {}; - if (has_default(config, "serializedGrammar")) { - throw Error("The Parser's configuration can no longer contain a property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details."); - } - if (isArray_default(tokenVocabulary)) { - if (isEmpty_default(tokenVocabulary)) { - throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0)."); - } - if (typeof tokenVocabulary[0].startOffset === "number") { - throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details."); - } - } - if (isArray_default(tokenVocabulary)) { - this.tokensMap = reduce_default(tokenVocabulary, (acc, tokType) => { - acc[tokType.name] = tokType; - return acc; - }, {}); - } else if (has_default(tokenVocabulary, "modes") && every_default(flatten_default(values_default(tokenVocabulary.modes)), isTokenType)) { - const allTokenTypes2 = flatten_default(values_default(tokenVocabulary.modes)); - const uniqueTokens = uniq_default(allTokenTypes2); - this.tokensMap = reduce_default(uniqueTokens, (acc, tokType) => { - acc[tokType.name] = tokType; - return acc; - }, {}); - } else if (isObject_default(tokenVocabulary)) { - this.tokensMap = clone_default(tokenVocabulary); - } else { - throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition"); - } - this.tokensMap["EOF"] = EOF; - const allTokenTypes = has_default(tokenVocabulary, "modes") ? flatten_default(values_default(tokenVocabulary.modes)) : values_default(tokenVocabulary); - const noTokenCategoriesUsed = every_default(allTokenTypes, (tokenConstructor) => isEmpty_default(tokenConstructor.categoryMatches)); - this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; - augmentTokenTypes(values_default(this.tokensMap)); - } - defineRule(ruleName, impl, config) { - if (this.selfAnalysisDone) { - throw Error(`Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called' -Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`); - } - const resyncEnabled = has_default(config, "resyncEnabled") ? config.resyncEnabled : DEFAULT_RULE_CONFIG.resyncEnabled; - const recoveryValueFunc = has_default(config, "recoveryValueFunc") ? config.recoveryValueFunc : DEFAULT_RULE_CONFIG.recoveryValueFunc; - const shortName = this.ruleShortNameIdx << BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX; - this.ruleShortNameIdx++; - this.shortRuleNameToFull[shortName] = ruleName; - this.fullRuleNameToShort[ruleName] = shortName; - let invokeRuleWithTry; - if (this.outputCst === true) { - invokeRuleWithTry = function invokeRuleWithTry2(...args) { - try { - this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx); - impl.apply(this, args); - const cst = this.CST_STACK[this.CST_STACK.length - 1]; - this.cstPostRule(cst); - return cst; - } catch (e) { - return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc); - } finally { - this.ruleFinallyStateUpdate(); - } - }; - } else { - invokeRuleWithTry = function invokeRuleWithTryCst(...args) { - try { - this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx); - return impl.apply(this, args); - } catch (e) { - return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc); - } finally { - this.ruleFinallyStateUpdate(); - } - }; - } - const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl }); - return wrappedGrammarRule; - } - invokeRuleCatch(e, resyncEnabledConfig, recoveryValueFunc) { - const isFirstInvokedRule = this.RULE_STACK.length === 1; - const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled; - if (isRecognitionException(e)) { - const recogError = e; - if (reSyncEnabled) { - const reSyncTokType = this.findReSyncTokenType(); - if (this.isInCurrentRuleReSyncSet(reSyncTokType)) { - recogError.resyncedTokens = this.reSyncTo(reSyncTokType); - if (this.outputCst) { - const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]; - partialCstResult.recoveredNode = true; - return partialCstResult; - } else { - return recoveryValueFunc(e); - } - } else { - if (this.outputCst) { - const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]; - partialCstResult.recoveredNode = true; - recogError.partialCstResult = partialCstResult; - } - throw recogError; - } - } else if (isFirstInvokedRule) { - this.moveToTerminatedState(); - return recoveryValueFunc(e); - } else { - throw recogError; - } - } else { - throw e; - } - } - // Implementation of parsing DSL - optionInternal(actionORMethodDef, occurrence) { - const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence); - return this.optionInternalLogic(actionORMethodDef, occurrence, key); - } - optionInternalLogic(actionORMethodDef, occurrence, key) { - let lookAheadFunc = this.getLaFuncFromCache(key); - let action; - if (typeof actionORMethodDef !== "function") { - action = actionORMethodDef.DEF; - const predicate = actionORMethodDef.GATE; - if (predicate !== void 0) { - const orgLookaheadFunction = lookAheadFunc; - lookAheadFunc = () => { - return predicate.call(this) && orgLookaheadFunction.call(this); - }; - } - } else { - action = actionORMethodDef; - } - if (lookAheadFunc.call(this) === true) { - return action.call(this); - } - return void 0; - } - atLeastOneInternal(prodOccurrence, actionORMethodDef) { - const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence); - return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey); - } - atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) { - let lookAheadFunc = this.getLaFuncFromCache(key); - let action; - if (typeof actionORMethodDef !== "function") { - action = actionORMethodDef.DEF; - const predicate = actionORMethodDef.GATE; - if (predicate !== void 0) { - const orgLookaheadFunction = lookAheadFunc; - lookAheadFunc = () => { - return predicate.call(this) && orgLookaheadFunction.call(this); - }; - } - } else { - action = actionORMethodDef; - } - if (lookAheadFunc.call(this) === true) { - let notStuck = this.doSingleRepetition(action); - while (lookAheadFunc.call(this) === true && notStuck === true) { - notStuck = this.doSingleRepetition(action); - } - } else { - throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG); - } - this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef], lookAheadFunc, AT_LEAST_ONE_IDX, prodOccurrence, NextTerminalAfterAtLeastOneWalker); - } - atLeastOneSepFirstInternal(prodOccurrence, options) { - const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence); - this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey); - } - atLeastOneSepFirstInternalLogic(prodOccurrence, options, key) { - const action = options.DEF; - const separator = options.SEP; - const firstIterationLookaheadFunc = this.getLaFuncFromCache(key); - if (firstIterationLookaheadFunc.call(this) === true) { - action.call(this); - const separatorLookAheadFunc = () => { - return this.tokenMatcher(this.LA(1), separator); - }; - while (this.tokenMatcher(this.LA(1), separator) === true) { - this.CONSUME(separator); - action.call(this); - } - this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ - prodOccurrence, - separator, - separatorLookAheadFunc, - action, - NextTerminalAfterAtLeastOneSepWalker - ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, NextTerminalAfterAtLeastOneSepWalker); - } else { - throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options.ERR_MSG); - } - } - manyInternal(prodOccurrence, actionORMethodDef) { - const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence); - return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey); - } - manyInternalLogic(prodOccurrence, actionORMethodDef, key) { - let lookaheadFunction = this.getLaFuncFromCache(key); - let action; - if (typeof actionORMethodDef !== "function") { - action = actionORMethodDef.DEF; - const predicate = actionORMethodDef.GATE; - if (predicate !== void 0) { - const orgLookaheadFunction = lookaheadFunction; - lookaheadFunction = () => { - return predicate.call(this) && orgLookaheadFunction.call(this); - }; - } - } else { - action = actionORMethodDef; - } - let notStuck = true; - while (lookaheadFunction.call(this) === true && notStuck === true) { - notStuck = this.doSingleRepetition(action); - } - this.attemptInRepetitionRecovery( - this.manyInternal, - [prodOccurrence, actionORMethodDef], - lookaheadFunction, - MANY_IDX, - prodOccurrence, - NextTerminalAfterManyWalker, - // The notStuck parameter is only relevant when "attemptInRepetitionRecovery" - // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP] - // An infinite loop cannot occur as: - // - Either the lookahead is guaranteed to consume something (Single Token Separator) - // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out). - notStuck - ); - } - manySepFirstInternal(prodOccurrence, options) { - const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence); - this.manySepFirstInternalLogic(prodOccurrence, options, laKey); - } - manySepFirstInternalLogic(prodOccurrence, options, key) { - const action = options.DEF; - const separator = options.SEP; - const firstIterationLaFunc = this.getLaFuncFromCache(key); - if (firstIterationLaFunc.call(this) === true) { - action.call(this); - const separatorLookAheadFunc = () => { - return this.tokenMatcher(this.LA(1), separator); - }; - while (this.tokenMatcher(this.LA(1), separator) === true) { - this.CONSUME(separator); - action.call(this); - } - this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ - prodOccurrence, - separator, - separatorLookAheadFunc, - action, - NextTerminalAfterManySepWalker - ], separatorLookAheadFunc, MANY_SEP_IDX, prodOccurrence, NextTerminalAfterManySepWalker); - } - } - repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) { - while (separatorLookAheadFunc()) { - this.CONSUME(separator); - action.call(this); - } - this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ - prodOccurrence, - separator, - separatorLookAheadFunc, - action, - nextTerminalAfterWalker - ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker); - } - doSingleRepetition(action) { - const beforeIteration = this.getLexerPosition(); - action.call(this); - const afterIteration = this.getLexerPosition(); - return afterIteration > beforeIteration; - } - orInternal(altsOrOpts, occurrence) { - const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence); - const alts = isArray_default(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF; - const laFunc = this.getLaFuncFromCache(laKey); - const altIdxToTake = laFunc.call(this, alts); - if (altIdxToTake !== void 0) { - const chosenAlternative = alts[altIdxToTake]; - return chosenAlternative.ALT.call(this); - } - this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG); - } - ruleFinallyStateUpdate() { - this.RULE_STACK.pop(); - this.RULE_OCCURRENCE_STACK.pop(); - this.cstFinallyStateUpdate(); - if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) { - const firstRedundantTok = this.LA(1); - const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({ - firstRedundant: firstRedundantTok, - ruleName: this.getCurrRuleFullName() - }); - this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok)); - } - } - subruleInternal(ruleToCall, idx, options) { - let ruleResult; - try { - const args = options !== void 0 ? options.ARGS : void 0; - this.subruleIdx = idx; - ruleResult = ruleToCall.apply(this, args); - this.cstPostNonTerminal(ruleResult, options !== void 0 && options.LABEL !== void 0 ? options.LABEL : ruleToCall.ruleName); - return ruleResult; - } catch (e) { - throw this.subruleInternalError(e, options, ruleToCall.ruleName); - } - } - subruleInternalError(e, options, ruleName) { - if (isRecognitionException(e) && e.partialCstResult !== void 0) { - this.cstPostNonTerminal(e.partialCstResult, options !== void 0 && options.LABEL !== void 0 ? options.LABEL : ruleName); - delete e.partialCstResult; - } - throw e; - } - consumeInternal(tokType, idx, options) { - let consumedToken; - try { - const nextToken = this.LA(1); - if (this.tokenMatcher(nextToken, tokType) === true) { - this.consumeToken(); - consumedToken = nextToken; - } else { - this.consumeInternalError(tokType, nextToken, options); - } - } catch (eFromConsumption) { - consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption); - } - this.cstPostTerminal(options !== void 0 && options.LABEL !== void 0 ? options.LABEL : tokType.name, consumedToken); - return consumedToken; - } - consumeInternalError(tokType, nextToken, options) { - let msg; - const previousToken = this.LA(0); - if (options !== void 0 && options.ERR_MSG) { - msg = options.ERR_MSG; - } else { - msg = this.errorMessageProvider.buildMismatchTokenMessage({ - expected: tokType, - actual: nextToken, - previous: previousToken, - ruleName: this.getCurrRuleFullName() - }); - } - throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken)); - } - consumeInternalRecovery(tokType, idx, eFromConsumption) { - if (this.recoveryEnabled && // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions? - eFromConsumption.name === "MismatchedTokenException" && !this.isBackTracking()) { - const follows = this.getFollowsForInRuleRecovery(tokType, idx); - try { - return this.tryInRuleRecovery(tokType, follows); - } catch (eFromInRuleRecovery) { - if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) { - throw eFromConsumption; - } else { - throw eFromInRuleRecovery; - } - } - } else { - throw eFromConsumption; - } - } - saveRecogState() { - const savedErrors = this.errors; - const savedRuleStack = clone_default(this.RULE_STACK); - return { - errors: savedErrors, - lexerState: this.exportLexerState(), - RULE_STACK: savedRuleStack, - CST_STACK: this.CST_STACK - }; - } - reloadRecogState(newState2) { - this.errors = newState2.errors; - this.importLexerState(newState2.lexerState); - this.RULE_STACK = newState2.RULE_STACK; - } - ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) { - this.RULE_OCCURRENCE_STACK.push(idxInCallingRule); - this.RULE_STACK.push(shortName); - this.cstInvocationStateUpdate(fullName); - } - isBackTracking() { - return this.isBackTrackingStack.length !== 0; - } - getCurrRuleFullName() { - const shortName = this.getLastExplicitRuleShortName(); - return this.shortRuleNameToFull[shortName]; - } - shortRuleNameToFullName(shortName) { - return this.shortRuleNameToFull[shortName]; - } - isAtEndOfInput() { - return this.tokenMatcher(this.LA(1), EOF); - } - reset() { - this.resetLexerState(); - this.subruleIdx = 0; - this.isBackTrackingStack = []; - this.errors = []; - this.RULE_STACK = []; - this.CST_STACK = []; - this.RULE_OCCURRENCE_STACK = []; - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js -var ErrorHandler = class { - initErrorHandler(config) { - this._errors = []; - this.errorMessageProvider = has_default(config, "errorMessageProvider") ? config.errorMessageProvider : DEFAULT_PARSER_CONFIG.errorMessageProvider; - } - SAVE_ERROR(error) { - if (isRecognitionException(error)) { - error.context = { - ruleStack: this.getHumanReadableRuleStack(), - ruleOccurrenceStack: clone_default(this.RULE_OCCURRENCE_STACK) - }; - this._errors.push(error); - return error; - } else { - throw Error("Trying to save an Error which is not a RecognitionException"); - } - } - get errors() { - return clone_default(this._errors); - } - set errors(newErrors) { - this._errors = newErrors; - } - // TODO: consider caching the error message computed information - raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) { - const ruleName = this.getCurrRuleFullName(); - const ruleGrammar = this.getGAstProductions()[ruleName]; - const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, this.maxLookahead); - const insideProdPaths = lookAheadPathsPerAlternative[0]; - const actualTokens = []; - for (let i = 1; i <= this.maxLookahead; i++) { - actualTokens.push(this.LA(i)); - } - const msg = this.errorMessageProvider.buildEarlyExitMessage({ - expectedIterationPaths: insideProdPaths, - actual: actualTokens, - previous: this.LA(0), - customUserDescription: userDefinedErrMsg, - ruleName - }); - throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0))); - } - // TODO: consider caching the error message computed information - raiseNoAltException(occurrence, errMsgTypes) { - const ruleName = this.getCurrRuleFullName(); - const ruleGrammar = this.getGAstProductions()[ruleName]; - const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead); - const actualTokens = []; - for (let i = 1; i <= this.maxLookahead; i++) { - actualTokens.push(this.LA(i)); - } - const previousToken = this.LA(0); - const errMsg = this.errorMessageProvider.buildNoViableAltMessage({ - expectedPathsPerAlt: lookAheadPathsPerAlternative, - actual: actualTokens, - previous: previousToken, - customUserDescription: errMsgTypes, - ruleName: this.getCurrRuleFullName() - }); - throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken)); - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js -var ContentAssist = class { - initContentAssist() { - } - computeContentAssist(startRuleName, precedingInput) { - const startRuleGast = this.gastProductionsCache[startRuleName]; - if (isUndefined_default(startRuleGast)) { - throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`); - } - return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead); - } - // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'... - // TODO: should this be more explicitly part of the public API? - getNextPossibleTokenTypes(grammarPath) { - const topRuleName = head_default(grammarPath.ruleStack); - const gastProductions = this.getGAstProductions(); - const topProduction = gastProductions[topRuleName]; - const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking(); - return nextPossibleTokenTypes; - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js -var RECORDING_NULL_OBJECT = { - description: "This Object indicates the Parser is during Recording Phase" -}; -Object.freeze(RECORDING_NULL_OBJECT); -var HANDLE_SEPARATOR = true; -var MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1; -var RFT = createToken({ name: "RECORDING_PHASE_TOKEN", pattern: Lexer.NA }); -augmentTokenTypes([RFT]); -var RECORDING_PHASE_TOKEN = createTokenInstance( - RFT, - "This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details", - // Using "-1" instead of NaN (as in EOF) because an actual number is less likely to - // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase. - -1, - -1, - -1, - -1, - -1, - -1 -); -Object.freeze(RECORDING_PHASE_TOKEN); -var RECORDING_PHASE_CSTNODE = { - name: "This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details", - children: {} -}; -var GastRecorder = class { - initGastRecorder(config) { - this.recordingProdStack = []; - this.RECORDING_PHASE = false; - } - enableRecording() { - this.RECORDING_PHASE = true; - this.TRACE_INIT("Enable Recording", () => { - for (let i = 0; i < 10; i++) { - const idx = i > 0 ? i : ""; - this[`CONSUME${idx}`] = function(arg1, arg2) { - return this.consumeInternalRecord(arg1, i, arg2); - }; - this[`SUBRULE${idx}`] = function(arg1, arg2) { - return this.subruleInternalRecord(arg1, i, arg2); - }; - this[`OPTION${idx}`] = function(arg1) { - return this.optionInternalRecord(arg1, i); - }; - this[`OR${idx}`] = function(arg1) { - return this.orInternalRecord(arg1, i); - }; - this[`MANY${idx}`] = function(arg1) { - this.manyInternalRecord(i, arg1); - }; - this[`MANY_SEP${idx}`] = function(arg1) { - this.manySepFirstInternalRecord(i, arg1); - }; - this[`AT_LEAST_ONE${idx}`] = function(arg1) { - this.atLeastOneInternalRecord(i, arg1); - }; - this[`AT_LEAST_ONE_SEP${idx}`] = function(arg1) { - this.atLeastOneSepFirstInternalRecord(i, arg1); - }; - } - this[`consume`] = function(idx, arg1, arg2) { - return this.consumeInternalRecord(arg1, idx, arg2); - }; - this[`subrule`] = function(idx, arg1, arg2) { - return this.subruleInternalRecord(arg1, idx, arg2); - }; - this[`option`] = function(idx, arg1) { - return this.optionInternalRecord(arg1, idx); - }; - this[`or`] = function(idx, arg1) { - return this.orInternalRecord(arg1, idx); - }; - this[`many`] = function(idx, arg1) { - this.manyInternalRecord(idx, arg1); - }; - this[`atLeastOne`] = function(idx, arg1) { - this.atLeastOneInternalRecord(idx, arg1); - }; - this.ACTION = this.ACTION_RECORD; - this.BACKTRACK = this.BACKTRACK_RECORD; - this.LA = this.LA_RECORD; - }); - } - disableRecording() { - this.RECORDING_PHASE = false; - this.TRACE_INIT("Deleting Recording methods", () => { - const that = this; - for (let i = 0; i < 10; i++) { - const idx = i > 0 ? i : ""; - delete that[`CONSUME${idx}`]; - delete that[`SUBRULE${idx}`]; - delete that[`OPTION${idx}`]; - delete that[`OR${idx}`]; - delete that[`MANY${idx}`]; - delete that[`MANY_SEP${idx}`]; - delete that[`AT_LEAST_ONE${idx}`]; - delete that[`AT_LEAST_ONE_SEP${idx}`]; - } - delete that[`consume`]; - delete that[`subrule`]; - delete that[`option`]; - delete that[`or`]; - delete that[`many`]; - delete that[`atLeastOne`]; - delete that.ACTION; - delete that.BACKTRACK; - delete that.LA; - }); - } - // Parser methods are called inside an ACTION? - // Maybe try/catch/finally on ACTIONS while disabling the recorders state changes? - // @ts-expect-error -- noop place holder - ACTION_RECORD(impl) { - } - // Executing backtracking logic will break our recording logic assumptions - BACKTRACK_RECORD(grammarRule, args) { - return () => true; - } - // LA is part of the official API and may be used for custom lookahead logic - // by end users who may forget to wrap it in ACTION or inside a GATE - LA_RECORD(howMuch) { - return END_OF_FILE; - } - topLevelRuleRecord(name, def) { - try { - const newTopLevelRule = new Rule({ definition: [], name }); - newTopLevelRule.name = name; - this.recordingProdStack.push(newTopLevelRule); - def.call(this); - this.recordingProdStack.pop(); - return newTopLevelRule; - } catch (originalError) { - if (originalError.KNOWN_RECORDER_ERROR !== true) { - try { - originalError.message = originalError.message + '\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'; - } catch (mutabilityError) { - throw originalError; - } - } - throw originalError; - } - } - // Implementation of parsing DSL - optionInternalRecord(actionORMethodDef, occurrence) { - return recordProd.call(this, Option, actionORMethodDef, occurrence); - } - atLeastOneInternalRecord(occurrence, actionORMethodDef) { - recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence); - } - atLeastOneSepFirstInternalRecord(occurrence, options) { - recordProd.call(this, RepetitionMandatoryWithSeparator, options, occurrence, HANDLE_SEPARATOR); - } - manyInternalRecord(occurrence, actionORMethodDef) { - recordProd.call(this, Repetition, actionORMethodDef, occurrence); - } - manySepFirstInternalRecord(occurrence, options) { - recordProd.call(this, RepetitionWithSeparator, options, occurrence, HANDLE_SEPARATOR); - } - orInternalRecord(altsOrOpts, occurrence) { - return recordOrProd.call(this, altsOrOpts, occurrence); - } - subruleInternalRecord(ruleToCall, occurrence, options) { - assertMethodIdxIsValid(occurrence); - if (!ruleToCall || has_default(ruleToCall, "ruleName") === false) { - const error = new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}> - inside top level rule: <${this.recordingProdStack[0].name}>`); - error.KNOWN_RECORDER_ERROR = true; - throw error; - } - const prevProd = last_default(this.recordingProdStack); - const ruleName = ruleToCall.ruleName; - const newNoneTerminal = new NonTerminal({ - idx: occurrence, - nonTerminalName: ruleName, - label: options === null || options === void 0 ? void 0 : options.LABEL, - // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created - referencedRule: void 0 - }); - prevProd.definition.push(newNoneTerminal); - return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT; - } - consumeInternalRecord(tokType, occurrence, options) { - assertMethodIdxIsValid(occurrence); - if (!hasShortKeyProperty(tokType)) { - const error = new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(tokType)}> - inside top level rule: <${this.recordingProdStack[0].name}>`); - error.KNOWN_RECORDER_ERROR = true; - throw error; - } - const prevProd = last_default(this.recordingProdStack); - const newNoneTerminal = new Terminal({ - idx: occurrence, - terminalType: tokType, - label: options === null || options === void 0 ? void 0 : options.LABEL - }); - prevProd.definition.push(newNoneTerminal); - return RECORDING_PHASE_TOKEN; - } -}; -function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) { - assertMethodIdxIsValid(occurrence); - const prevProd = last_default(this.recordingProdStack); - const grammarAction = isFunction_default(mainProdArg) ? mainProdArg : mainProdArg.DEF; - const newProd = new prodConstructor({ definition: [], idx: occurrence }); - if (handleSep) { - newProd.separator = mainProdArg.SEP; - } - if (has_default(mainProdArg, "MAX_LOOKAHEAD")) { - newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD; - } - this.recordingProdStack.push(newProd); - grammarAction.call(this); - prevProd.definition.push(newProd); - this.recordingProdStack.pop(); - return RECORDING_NULL_OBJECT; -} -function recordOrProd(mainProdArg, occurrence) { - assertMethodIdxIsValid(occurrence); - const prevProd = last_default(this.recordingProdStack); - const hasOptions = isArray_default(mainProdArg) === false; - const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF; - const newOrProd = new Alternation({ - definition: [], - idx: occurrence, - ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true - }); - if (has_default(mainProdArg, "MAX_LOOKAHEAD")) { - newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD; - } - const hasPredicates = some_default(alts, (currAlt) => isFunction_default(currAlt.GATE)); - newOrProd.hasPredicates = hasPredicates; - prevProd.definition.push(newOrProd); - forEach_default(alts, (currAlt) => { - const currAltFlat = new Alternative({ definition: [] }); - newOrProd.definition.push(currAltFlat); - if (has_default(currAlt, "IGNORE_AMBIGUITIES")) { - currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES; - } else if (has_default(currAlt, "GATE")) { - currAltFlat.ignoreAmbiguities = true; - } - this.recordingProdStack.push(currAltFlat); - currAlt.ALT.call(this); - this.recordingProdStack.pop(); - }); - return RECORDING_NULL_OBJECT; -} -function getIdxSuffix(idx) { - return idx === 0 ? "" : `${idx}`; -} -function assertMethodIdxIsValid(idx) { - if (idx < 0 || idx > MAX_METHOD_IDX) { - const error = new Error( - // The stack trace will contain all the needed details - `Invalid DSL Method idx value: <${idx}> - Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}` - ); - error.KNOWN_RECORDER_ERROR = true; - throw error; - } -} - -// node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js -var PerformanceTracer = class { - initPerformanceTracer(config) { - if (has_default(config, "traceInitPerf")) { - const userTraceInitPerf = config.traceInitPerf; - const traceIsNumber = typeof userTraceInitPerf === "number"; - this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity; - this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf; - } else { - this.traceInitMaxIdent = 0; - this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf; - } - this.traceInitIndent = -1; - } - TRACE_INIT(phaseDesc, phaseImpl) { - if (this.traceInitPerf === true) { - this.traceInitIndent++; - const indent = new Array(this.traceInitIndent + 1).join(" "); - if (this.traceInitIndent < this.traceInitMaxIdent) { - console.log(`${indent}--> <${phaseDesc}>`); - } - const { time, value } = timer(phaseImpl); - const traceMethod = time > 10 ? console.warn : console.log; - if (this.traceInitIndent < this.traceInitMaxIdent) { - traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`); - } - this.traceInitIndent--; - return value; - } else { - return phaseImpl(); - } - } -}; - -// node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js -function applyMixins(derivedCtor, baseCtors) { - baseCtors.forEach((baseCtor) => { - const baseProto = baseCtor.prototype; - Object.getOwnPropertyNames(baseProto).forEach((propName) => { - if (propName === "constructor") { - return; - } - const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName); - if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) { - Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor); - } else { - derivedCtor.prototype[propName] = baseCtor.prototype[propName]; - } - }); - }); -} - -// node_modules/chevrotain/lib/src/parse/parser/parser.js -var END_OF_FILE = createTokenInstance(EOF, "", NaN, NaN, NaN, NaN, NaN, NaN); -Object.freeze(END_OF_FILE); -var DEFAULT_PARSER_CONFIG = Object.freeze({ - recoveryEnabled: false, - maxLookahead: 3, - dynamicTokensEnabled: false, - outputCst: true, - errorMessageProvider: defaultParserErrorProvider, - nodeLocationTracking: "none", - traceInitPerf: false, - skipValidations: false -}); -var DEFAULT_RULE_CONFIG = Object.freeze({ - recoveryValueFunc: () => void 0, - resyncEnabled: true -}); -var ParserDefinitionErrorType; -(function(ParserDefinitionErrorType2) { - ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["LEFT_RECURSION"] = 5] = "LEFT_RECURSION"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["NO_NON_EMPTY_LOOKAHEAD"] = 10] = "NO_NON_EMPTY_LOOKAHEAD"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_PREFIX_ALTS"] = 11] = "AMBIGUOUS_PREFIX_ALTS"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["TOO_MANY_ALTS"] = 12] = "TOO_MANY_ALTS"; - ParserDefinitionErrorType2[ParserDefinitionErrorType2["CUSTOM_LOOKAHEAD_VALIDATION"] = 13] = "CUSTOM_LOOKAHEAD_VALIDATION"; -})(ParserDefinitionErrorType || (ParserDefinitionErrorType = {})); -function EMPTY_ALT(value = void 0) { - return function() { - return value; - }; -} -var Parser = class _Parser { - /** - * @deprecated use the **instance** method with the same name instead - */ - static performSelfAnalysis(parserInstance) { - throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead."); - } - performSelfAnalysis() { - this.TRACE_INIT("performSelfAnalysis", () => { - let defErrorsMsgs; - this.selfAnalysisDone = true; - const className = this.className; - this.TRACE_INIT("toFastProps", () => { - toFastProperties(this); - }); - this.TRACE_INIT("Grammar Recording", () => { - try { - this.enableRecording(); - forEach_default(this.definedRulesNames, (currRuleName) => { - const wrappedRule = this[currRuleName]; - const originalGrammarAction = wrappedRule["originalGrammarAction"]; - let recordedRuleGast; - this.TRACE_INIT(`${currRuleName} Rule`, () => { - recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction); - }); - this.gastProductionsCache[currRuleName] = recordedRuleGast; - }); - } finally { - this.disableRecording(); - } - }); - let resolverErrors = []; - this.TRACE_INIT("Grammar Resolving", () => { - resolverErrors = resolveGrammar2({ - rules: values_default(this.gastProductionsCache) - }); - this.definitionErrors = this.definitionErrors.concat(resolverErrors); - }); - this.TRACE_INIT("Grammar Validations", () => { - if (isEmpty_default(resolverErrors) && this.skipValidations === false) { - const validationErrors = validateGrammar2({ - rules: values_default(this.gastProductionsCache), - tokenTypes: values_default(this.tokensMap), - errMsgProvider: defaultGrammarValidatorErrorProvider, - grammarName: className - }); - const lookaheadValidationErrors = validateLookahead({ - lookaheadStrategy: this.lookaheadStrategy, - rules: values_default(this.gastProductionsCache), - tokenTypes: values_default(this.tokensMap), - grammarName: className - }); - this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors); - } - }); - if (isEmpty_default(this.definitionErrors)) { - if (this.recoveryEnabled) { - this.TRACE_INIT("computeAllProdsFollows", () => { - const allFollows = computeAllProdsFollows(values_default(this.gastProductionsCache)); - this.resyncFollows = allFollows; - }); - } - this.TRACE_INIT("ComputeLookaheadFunctions", () => { - var _a, _b; - (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, { - rules: values_default(this.gastProductionsCache) - }); - this.preComputeLookaheadFunctions(values_default(this.gastProductionsCache)); - }); - } - if (!_Parser.DEFER_DEFINITION_ERRORS_HANDLING && !isEmpty_default(this.definitionErrors)) { - defErrorsMsgs = map_default(this.definitionErrors, (defError) => defError.message); - throw new Error(`Parser Definition Errors detected: - ${defErrorsMsgs.join("\n-------------------------------\n")}`); - } - }); - } - constructor(tokenVocabulary, config) { - this.definitionErrors = []; - this.selfAnalysisDone = false; - const that = this; - that.initErrorHandler(config); - that.initLexerAdapter(); - that.initLooksAhead(config); - that.initRecognizerEngine(tokenVocabulary, config); - that.initRecoverable(config); - that.initTreeBuilder(config); - that.initContentAssist(); - that.initGastRecorder(config); - that.initPerformanceTracer(config); - if (has_default(config, "ignoredIssues")) { - throw new Error("The IParserConfig property has been deprecated.\n Please use the flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details."); - } - this.skipValidations = has_default(config, "skipValidations") ? config.skipValidations : DEFAULT_PARSER_CONFIG.skipValidations; - } -}; -Parser.DEFER_DEFINITION_ERRORS_HANDLING = false; -applyMixins(Parser, [ - Recoverable, - LooksAhead, - TreeBuilder, - LexerAdapter, - RecognizerEngine, - RecognizerApi, - ErrorHandler, - ContentAssist, - GastRecorder, - PerformanceTracer -]); -var EmbeddedActionsParser = class extends Parser { - constructor(tokenVocabulary, config = DEFAULT_PARSER_CONFIG) { - const configClone = clone_default(config); - configClone.outputCst = false; - super(tokenVocabulary, configClone); - } -}; - -// node_modules/chevrotain-allstar/lib/atn.js -function buildATNKey(rule, type, occurrence) { - return `${rule.name}_${type}_${occurrence}`; -} -var ATN_BASIC = 1; -var ATN_RULE_START = 2; -var ATN_PLUS_BLOCK_START = 4; -var ATN_STAR_BLOCK_START = 5; -var ATN_RULE_STOP = 7; -var ATN_BLOCK_END = 8; -var ATN_STAR_LOOP_BACK = 9; -var ATN_STAR_LOOP_ENTRY = 10; -var ATN_PLUS_LOOP_BACK = 11; -var ATN_LOOP_END = 12; -var AbstractTransition = class { - constructor(target) { - this.target = target; - } - isEpsilon() { - return false; - } -}; -var AtomTransition = class extends AbstractTransition { - constructor(target, tokenType) { - super(target); - this.tokenType = tokenType; - } -}; -var EpsilonTransition = class extends AbstractTransition { - constructor(target) { - super(target); - } - isEpsilon() { - return true; - } -}; -var RuleTransition = class extends AbstractTransition { - constructor(ruleStart, rule, followState) { - super(ruleStart); - this.rule = rule; - this.followState = followState; - } - isEpsilon() { - return true; - } -}; -function createATN(rules) { - const atn = { - decisionMap: {}, - decisionStates: [], - ruleToStartState: /* @__PURE__ */ new Map(), - ruleToStopState: /* @__PURE__ */ new Map(), - states: [] - }; - createRuleStartAndStopATNStates(atn, rules); - const ruleLength = rules.length; - for (let i = 0; i < ruleLength; i++) { - const rule = rules[i]; - const ruleBlock = block(atn, rule, rule); - if (ruleBlock === void 0) { - continue; - } - buildRuleHandle(atn, rule, ruleBlock); - } - return atn; -} -function createRuleStartAndStopATNStates(atn, rules) { - const ruleLength = rules.length; - for (let i = 0; i < ruleLength; i++) { - const rule = rules[i]; - const start = newState(atn, rule, void 0, { - type: ATN_RULE_START - }); - const stop = newState(atn, rule, void 0, { - type: ATN_RULE_STOP - }); - start.stop = stop; - atn.ruleToStartState.set(rule, start); - atn.ruleToStopState.set(rule, stop); - } -} -function atom(atn, rule, production) { - if (production instanceof Terminal) { - return tokenRef(atn, rule, production.terminalType, production); - } else if (production instanceof NonTerminal) { - return ruleRef(atn, rule, production); - } else if (production instanceof Alternation) { - return alternation(atn, rule, production); - } else if (production instanceof Option) { - return option(atn, rule, production); - } else if (production instanceof Repetition) { - return repetition(atn, rule, production); - } else if (production instanceof RepetitionWithSeparator) { - return repetitionSep(atn, rule, production); - } else if (production instanceof RepetitionMandatory) { - return repetitionMandatory(atn, rule, production); - } else if (production instanceof RepetitionMandatoryWithSeparator) { - return repetitionMandatorySep(atn, rule, production); - } else { - return block(atn, rule, production); - } -} -function repetition(atn, rule, repetition2) { - const starState = newState(atn, rule, repetition2, { - type: ATN_STAR_BLOCK_START - }); - defineDecisionState(atn, starState); - const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2)); - return star(atn, rule, repetition2, handle); -} -function repetitionSep(atn, rule, repetition2) { - const starState = newState(atn, rule, repetition2, { - type: ATN_STAR_BLOCK_START - }); - defineDecisionState(atn, starState); - const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2)); - const sep = tokenRef(atn, rule, repetition2.separator, repetition2); - return star(atn, rule, repetition2, handle, sep); -} -function repetitionMandatory(atn, rule, repetition2) { - const plusState = newState(atn, rule, repetition2, { - type: ATN_PLUS_BLOCK_START - }); - defineDecisionState(atn, plusState); - const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2)); - return plus(atn, rule, repetition2, handle); -} -function repetitionMandatorySep(atn, rule, repetition2) { - const plusState = newState(atn, rule, repetition2, { - type: ATN_PLUS_BLOCK_START - }); - defineDecisionState(atn, plusState); - const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2)); - const sep = tokenRef(atn, rule, repetition2.separator, repetition2); - return plus(atn, rule, repetition2, handle, sep); -} -function alternation(atn, rule, alternation2) { - const start = newState(atn, rule, alternation2, { - type: ATN_BASIC - }); - defineDecisionState(atn, start); - const alts = map_default(alternation2.definition, (e) => atom(atn, rule, e)); - const handle = makeAlts(atn, rule, start, alternation2, ...alts); - return handle; -} -function option(atn, rule, option2) { - const start = newState(atn, rule, option2, { - type: ATN_BASIC - }); - defineDecisionState(atn, start); - const handle = makeAlts(atn, rule, start, option2, block(atn, rule, option2)); - return optional(atn, rule, option2, handle); -} -function block(atn, rule, block2) { - const handles = filter_default(map_default(block2.definition, (e) => atom(atn, rule, e)), (e) => e !== void 0); - if (handles.length === 1) { - return handles[0]; - } else if (handles.length === 0) { - return void 0; - } else { - return makeBlock(atn, handles); - } -} -function plus(atn, rule, plus2, handle, sep) { - const blkStart = handle.left; - const blkEnd = handle.right; - const loop = newState(atn, rule, plus2, { - type: ATN_PLUS_LOOP_BACK - }); - defineDecisionState(atn, loop); - const end = newState(atn, rule, plus2, { - type: ATN_LOOP_END - }); - blkStart.loopback = loop; - end.loopback = loop; - atn.decisionMap[buildATNKey(rule, sep ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop; - epsilon(blkEnd, loop); - if (sep === void 0) { - epsilon(loop, blkStart); - epsilon(loop, end); - } else { - epsilon(loop, end); - epsilon(loop, sep.left); - epsilon(sep.right, blkStart); - } - return { - left: blkStart, - right: end - }; -} -function star(atn, rule, star2, handle, sep) { - const start = handle.left; - const end = handle.right; - const entry = newState(atn, rule, star2, { - type: ATN_STAR_LOOP_ENTRY - }); - defineDecisionState(atn, entry); - const loopEnd = newState(atn, rule, star2, { - type: ATN_LOOP_END - }); - const loop = newState(atn, rule, star2, { - type: ATN_STAR_LOOP_BACK - }); - entry.loopback = loop; - loopEnd.loopback = loop; - epsilon(entry, start); - epsilon(entry, loopEnd); - epsilon(end, loop); - if (sep !== void 0) { - epsilon(loop, loopEnd); - epsilon(loop, sep.left); - epsilon(sep.right, start); - } else { - epsilon(loop, entry); - } - atn.decisionMap[buildATNKey(rule, sep ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry; - return { - left: entry, - right: loopEnd - }; -} -function optional(atn, rule, optional2, handle) { - const start = handle.left; - const end = handle.right; - epsilon(start, end); - atn.decisionMap[buildATNKey(rule, "Option", optional2.idx)] = start; - return handle; -} -function defineDecisionState(atn, state) { - atn.decisionStates.push(state); - state.decision = atn.decisionStates.length - 1; - return state.decision; -} -function makeAlts(atn, rule, start, production, ...alts) { - const end = newState(atn, rule, production, { - type: ATN_BLOCK_END, - start - }); - start.end = end; - for (const alt of alts) { - if (alt !== void 0) { - epsilon(start, alt.left); - epsilon(alt.right, end); - } else { - epsilon(start, end); - } - } - const handle = { - left: start, - right: end - }; - atn.decisionMap[buildATNKey(rule, getProdType2(production), production.idx)] = start; - return handle; -} -function getProdType2(production) { - if (production instanceof Alternation) { - return "Alternation"; - } else if (production instanceof Option) { - return "Option"; - } else if (production instanceof Repetition) { - return "Repetition"; - } else if (production instanceof RepetitionWithSeparator) { - return "RepetitionWithSeparator"; - } else if (production instanceof RepetitionMandatory) { - return "RepetitionMandatory"; - } else if (production instanceof RepetitionMandatoryWithSeparator) { - return "RepetitionMandatoryWithSeparator"; - } else { - throw new Error("Invalid production type encountered"); - } -} -function makeBlock(atn, alts) { - const altsLength = alts.length; - for (let i = 0; i < altsLength - 1; i++) { - const handle = alts[i]; - let transition; - if (handle.left.transitions.length === 1) { - transition = handle.left.transitions[0]; - } - const isRuleTransition = transition instanceof RuleTransition; - const ruleTransition = transition; - const next = alts[i + 1].left; - if (handle.left.type === ATN_BASIC && handle.right.type === ATN_BASIC && transition !== void 0 && (isRuleTransition && ruleTransition.followState === handle.right || transition.target === handle.right)) { - if (isRuleTransition) { - ruleTransition.followState = next; - } else { - transition.target = next; - } - removeState(atn, handle.right); - } else { - epsilon(handle.right, next); - } - } - const first2 = alts[0]; - const last2 = alts[altsLength - 1]; - return { - left: first2.left, - right: last2.right - }; -} -function tokenRef(atn, rule, tokenType, production) { - const left = newState(atn, rule, production, { - type: ATN_BASIC - }); - const right = newState(atn, rule, production, { - type: ATN_BASIC - }); - addTransition(left, new AtomTransition(right, tokenType)); - return { - left, - right - }; -} -function ruleRef(atn, currentRule, nonTerminal) { - const rule = nonTerminal.referencedRule; - const start = atn.ruleToStartState.get(rule); - const left = newState(atn, currentRule, nonTerminal, { - type: ATN_BASIC - }); - const right = newState(atn, currentRule, nonTerminal, { - type: ATN_BASIC - }); - const call = new RuleTransition(start, rule, right); - addTransition(left, call); - return { - left, - right - }; -} -function buildRuleHandle(atn, rule, block2) { - const start = atn.ruleToStartState.get(rule); - epsilon(start, block2.left); - const stop = atn.ruleToStopState.get(rule); - epsilon(block2.right, stop); - const handle = { - left: start, - right: stop - }; - return handle; -} -function epsilon(a2, b) { - const transition = new EpsilonTransition(b); - addTransition(a2, transition); -} -function newState(atn, rule, production, partial) { - const t = Object.assign({ - atn, - production, - epsilonOnlyTransitions: false, - rule, - transitions: [], - nextTokenWithinRule: [], - stateNumber: atn.states.length - }, partial); - atn.states.push(t); - return t; -} -function addTransition(state, transition) { - if (state.transitions.length === 0) { - state.epsilonOnlyTransitions = transition.isEpsilon(); - } - state.transitions.push(transition); -} -function removeState(atn, state) { - atn.states.splice(atn.states.indexOf(state), 1); -} - -// node_modules/chevrotain-allstar/lib/dfa.js -var DFA_ERROR = {}; -var ATNConfigSet = class { - constructor() { - this.map = {}; - this.configs = []; - } - get size() { - return this.configs.length; - } - finalize() { - this.map = {}; - } - add(config) { - const key = getATNConfigKey(config); - if (!(key in this.map)) { - this.map[key] = this.configs.length; - this.configs.push(config); - } - } - get elements() { - return this.configs; - } - get alts() { - return map_default(this.configs, (e) => e.alt); - } - get key() { - let value = ""; - for (const k in this.map) { - value += k + ":"; - } - return value; - } -}; -function getATNConfigKey(config, alt = true) { - return `${alt ? `a${config.alt}` : ""}s${config.state.stateNumber}:${config.stack.map((e) => e.stateNumber.toString()).join("_")}`; -} - -// node_modules/chevrotain-allstar/lib/all-star-lookahead.js -function createDFACache(startState, decision) { - const map2 = {}; - return (predicateSet) => { - const key = predicateSet.toString(); - let existing = map2[key]; - if (existing !== void 0) { - return existing; - } else { - existing = { - atnStartState: startState, - decision, - states: {} - }; - map2[key] = existing; - return existing; - } - }; -} -var PredicateSet = class { - constructor() { - this.predicates = []; - } - is(index) { - return index >= this.predicates.length || this.predicates[index]; - } - set(index, value) { - this.predicates[index] = value; - } - toString() { - let value = ""; - const size = this.predicates.length; - for (let i = 0; i < size; i++) { - value += this.predicates[i] === true ? "1" : "0"; - } - return value; - } -}; -var EMPTY_PREDICATES = new PredicateSet(); -var LLStarLookaheadStrategy = class extends LLkLookaheadStrategy { - constructor(options) { - var _a; - super(); - this.logging = (_a = options === null || options === void 0 ? void 0 : options.logging) !== null && _a !== void 0 ? _a : (message) => console.log(message); - } - initialize(options) { - this.atn = createATN(options.rules); - this.dfas = initATNSimulator(this.atn); - } - validateAmbiguousAlternationAlternatives() { - return []; - } - validateEmptyOrAlternatives() { - return []; - } - buildLookaheadForAlternation(options) { - const { prodOccurrence, rule, hasPredicates, dynamicTokensEnabled } = options; - const dfas = this.dfas; - const logging = this.logging; - const key = buildATNKey(rule, "Alternation", prodOccurrence); - const decisionState = this.atn.decisionMap[key]; - const decisionIndex = decisionState.decision; - const partialAlts = map_default(getLookaheadPaths({ - maxLookahead: 1, - occurrence: prodOccurrence, - prodType: "Alternation", - rule - }), (currAlt) => map_default(currAlt, (path) => path[0])); - if (isLL1Sequence(partialAlts, false) && !dynamicTokensEnabled) { - const choiceToAlt = reduce_default(partialAlts, (result, currAlt, idx) => { - forEach_default(currAlt, (currTokType) => { - if (currTokType) { - result[currTokType.tokenTypeIdx] = idx; - forEach_default(currTokType.categoryMatches, (currExtendingType) => { - result[currExtendingType] = idx; - }); - } - }); - return result; - }, {}); - if (hasPredicates) { - return function(orAlts) { - var _a; - const nextToken = this.LA(1); - const prediction = choiceToAlt[nextToken.tokenTypeIdx]; - if (orAlts !== void 0 && prediction !== void 0) { - const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE; - if (gate !== void 0 && gate.call(this) === false) { - return void 0; - } - } - return prediction; - }; - } else { - return function() { - const nextToken = this.LA(1); - return choiceToAlt[nextToken.tokenTypeIdx]; - }; - } - } else if (hasPredicates) { - return function(orAlts) { - const predicates = new PredicateSet(); - const length = orAlts === void 0 ? 0 : orAlts.length; - for (let i = 0; i < length; i++) { - const gate = orAlts === null || orAlts === void 0 ? void 0 : orAlts[i].GATE; - predicates.set(i, gate === void 0 || gate.call(this)); - } - const result = adaptivePredict.call(this, dfas, decisionIndex, predicates, logging); - return typeof result === "number" ? result : void 0; - }; - } else { - return function() { - const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging); - return typeof result === "number" ? result : void 0; - }; - } - } - buildLookaheadForOptional(options) { - const { prodOccurrence, rule, prodType, dynamicTokensEnabled } = options; - const dfas = this.dfas; - const logging = this.logging; - const key = buildATNKey(rule, prodType, prodOccurrence); - const decisionState = this.atn.decisionMap[key]; - const decisionIndex = decisionState.decision; - const alts = map_default(getLookaheadPaths({ - maxLookahead: 1, - occurrence: prodOccurrence, - prodType, - rule - }), (e) => { - return map_default(e, (g) => g[0]); - }); - if (isLL1Sequence(alts) && alts[0][0] && !dynamicTokensEnabled) { - const alt = alts[0]; - const singleTokensTypes = flatten_default(alt); - if (singleTokensTypes.length === 1 && isEmpty_default(singleTokensTypes[0].categoryMatches)) { - const expectedTokenType = singleTokensTypes[0]; - const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx; - return function() { - return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey; - }; - } else { - const choiceToAlt = reduce_default(singleTokensTypes, (result, currTokType) => { - if (currTokType !== void 0) { - result[currTokType.tokenTypeIdx] = true; - forEach_default(currTokType.categoryMatches, (currExtendingType) => { - result[currExtendingType] = true; - }); - } - return result; - }, {}); - return function() { - const nextToken = this.LA(1); - return choiceToAlt[nextToken.tokenTypeIdx] === true; - }; - } - } - return function() { - const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging); - return typeof result === "object" ? false : result === 0; - }; - } -}; -function isLL1Sequence(sequences, allowEmpty = true) { - const fullSet = /* @__PURE__ */ new Set(); - for (const alt of sequences) { - const altSet = /* @__PURE__ */ new Set(); - for (const tokType of alt) { - if (tokType === void 0) { - if (allowEmpty) { - break; - } else { - return false; - } - } - const indices = [tokType.tokenTypeIdx].concat(tokType.categoryMatches); - for (const index of indices) { - if (fullSet.has(index)) { - if (!altSet.has(index)) { - return false; - } - } else { - fullSet.add(index); - altSet.add(index); - } - } - } - } - return true; -} -function initATNSimulator(atn) { - const decisionLength = atn.decisionStates.length; - const decisionToDFA = Array(decisionLength); - for (let i = 0; i < decisionLength; i++) { - decisionToDFA[i] = createDFACache(atn.decisionStates[i], i); - } - return decisionToDFA; -} -function adaptivePredict(dfaCaches, decision, predicateSet, logging) { - const dfa = dfaCaches[decision](predicateSet); - let start = dfa.start; - if (start === void 0) { - const closure2 = computeStartState(dfa.atnStartState); - start = addDFAState(dfa, newDFAState(closure2)); - dfa.start = start; - } - const alt = performLookahead.apply(this, [dfa, start, predicateSet, logging]); - return alt; -} -function performLookahead(dfa, s0, predicateSet, logging) { - let previousD = s0; - let i = 1; - const path = []; - let t = this.LA(i++); - while (true) { - let d = getExistingTargetState(previousD, t); - if (d === void 0) { - d = computeLookaheadTarget.apply(this, [dfa, previousD, t, i, predicateSet, logging]); - } - if (d === DFA_ERROR) { - return buildAdaptivePredictError(path, previousD, t); - } - if (d.isAcceptState === true) { - return d.prediction; - } - previousD = d; - path.push(t); - t = this.LA(i++); - } -} -function computeLookaheadTarget(dfa, previousD, token, lookahead, predicateSet, logging) { - const reach = computeReachSet(previousD.configs, token, predicateSet); - if (reach.size === 0) { - addDFAEdge(dfa, previousD, token, DFA_ERROR); - return DFA_ERROR; - } - let newState2 = newDFAState(reach); - const predictedAlt = getUniqueAlt(reach, predicateSet); - if (predictedAlt !== void 0) { - newState2.isAcceptState = true; - newState2.prediction = predictedAlt; - newState2.configs.uniqueAlt = predictedAlt; - } else if (hasConflictTerminatingPrediction(reach)) { - const prediction = min_default(reach.alts); - newState2.isAcceptState = true; - newState2.prediction = prediction; - newState2.configs.uniqueAlt = prediction; - reportLookaheadAmbiguity.apply(this, [dfa, lookahead, reach.alts, logging]); - } - newState2 = addDFAEdge(dfa, previousD, token, newState2); - return newState2; -} -function reportLookaheadAmbiguity(dfa, lookahead, ambiguityIndices, logging) { - const prefixPath = []; - for (let i = 1; i <= lookahead; i++) { - prefixPath.push(this.LA(i).tokenType); - } - const atnState = dfa.atnStartState; - const topLevelRule = atnState.rule; - const production = atnState.production; - const message = buildAmbiguityError({ - topLevelRule, - ambiguityIndices, - production, - prefixPath - }); - logging(message); -} -function buildAmbiguityError(options) { - const pathMsg = map_default(options.prefixPath, (currtok) => tokenLabel2(currtok)).join(", "); - const occurrence = options.production.idx === 0 ? "" : options.production.idx; - let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(", ")}> in <${getProductionDslName2(options.production)}${occurrence}> inside <${options.topLevelRule.name}> Rule, -<${pathMsg}> may appears as a prefix path in all these alternatives. -`; - currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES -For Further details.`; - return currMessage; -} -function getProductionDslName2(prod) { - if (prod instanceof NonTerminal) { - return "SUBRULE"; - } else if (prod instanceof Option) { - return "OPTION"; - } else if (prod instanceof Alternation) { - return "OR"; - } else if (prod instanceof RepetitionMandatory) { - return "AT_LEAST_ONE"; - } else if (prod instanceof RepetitionMandatoryWithSeparator) { - return "AT_LEAST_ONE_SEP"; - } else if (prod instanceof RepetitionWithSeparator) { - return "MANY_SEP"; - } else if (prod instanceof Repetition) { - return "MANY"; - } else if (prod instanceof Terminal) { - return "CONSUME"; - } else { - throw Error("non exhaustive match"); - } -} -function buildAdaptivePredictError(path, previous, current) { - const nextTransitions = flatMap_default(previous.configs.elements, (e) => e.state.transitions); - const nextTokenTypes = uniqBy_default(nextTransitions.filter((e) => e instanceof AtomTransition).map((e) => e.tokenType), (e) => e.tokenTypeIdx); - return { - actualToken: current, - possibleTokenTypes: nextTokenTypes, - tokenPath: path - }; -} -function getExistingTargetState(state, token) { - return state.edges[token.tokenTypeIdx]; -} -function computeReachSet(configs, token, predicateSet) { - const intermediate = new ATNConfigSet(); - const skippedStopStates = []; - for (const c of configs.elements) { - if (predicateSet.is(c.alt) === false) { - continue; - } - if (c.state.type === ATN_RULE_STOP) { - skippedStopStates.push(c); - continue; - } - const transitionLength = c.state.transitions.length; - for (let i = 0; i < transitionLength; i++) { - const transition = c.state.transitions[i]; - const target = getReachableTarget(transition, token); - if (target !== void 0) { - intermediate.add({ - state: target, - alt: c.alt, - stack: c.stack - }); - } - } - } - let reach; - if (skippedStopStates.length === 0 && intermediate.size === 1) { - reach = intermediate; - } - if (reach === void 0) { - reach = new ATNConfigSet(); - for (const c of intermediate.elements) { - closure(c, reach); - } - } - if (skippedStopStates.length > 0 && !hasConfigInRuleStopState(reach)) { - for (const c of skippedStopStates) { - reach.add(c); - } - } - return reach; -} -function getReachableTarget(transition, token) { - if (transition instanceof AtomTransition && tokenMatcher(token, transition.tokenType)) { - return transition.target; - } - return void 0; -} -function getUniqueAlt(configs, predicateSet) { - let alt; - for (const c of configs.elements) { - if (predicateSet.is(c.alt) === true) { - if (alt === void 0) { - alt = c.alt; - } else if (alt !== c.alt) { - return void 0; - } - } - } - return alt; -} -function newDFAState(closure2) { - return { - configs: closure2, - edges: {}, - isAcceptState: false, - prediction: -1 - }; -} -function addDFAEdge(dfa, from, token, to) { - to = addDFAState(dfa, to); - from.edges[token.tokenTypeIdx] = to; - return to; -} -function addDFAState(dfa, state) { - if (state === DFA_ERROR) { - return state; - } - const mapKey = state.configs.key; - const existing = dfa.states[mapKey]; - if (existing !== void 0) { - return existing; - } - state.configs.finalize(); - dfa.states[mapKey] = state; - return state; -} -function computeStartState(atnState) { - const configs = new ATNConfigSet(); - const numberOfTransitions = atnState.transitions.length; - for (let i = 0; i < numberOfTransitions; i++) { - const target = atnState.transitions[i].target; - const config = { - state: target, - alt: i, - stack: [] - }; - closure(config, configs); - } - return configs; -} -function closure(config, configs) { - const p = config.state; - if (p.type === ATN_RULE_STOP) { - if (config.stack.length > 0) { - const atnStack = [...config.stack]; - const followState = atnStack.pop(); - const followConfig = { - state: followState, - alt: config.alt, - stack: atnStack - }; - closure(followConfig, configs); - } else { - configs.add(config); - } - return; - } - if (!p.epsilonOnlyTransitions) { - configs.add(config); - } - const transitionLength = p.transitions.length; - for (let i = 0; i < transitionLength; i++) { - const transition = p.transitions[i]; - const c = getEpsilonTarget(config, transition); - if (c !== void 0) { - closure(c, configs); - } - } -} -function getEpsilonTarget(config, transition) { - if (transition instanceof EpsilonTransition) { - return { - state: transition.target, - alt: config.alt, - stack: config.stack - }; - } else if (transition instanceof RuleTransition) { - const stack = [...config.stack, transition.followState]; - return { - state: transition.target, - alt: config.alt, - stack - }; - } - return void 0; -} -function hasConfigInRuleStopState(configs) { - for (const c of configs.elements) { - if (c.state.type === ATN_RULE_STOP) { - return true; - } - } - return false; -} -function allConfigsInRuleStopStates(configs) { - for (const c of configs.elements) { - if (c.state.type !== ATN_RULE_STOP) { - return false; - } - } - return true; -} -function hasConflictTerminatingPrediction(configs) { - if (allConfigsInRuleStopStates(configs)) { - return true; - } - const altSets = getConflictingAltSets(configs.elements); - const heuristic = hasConflictingAltSet(altSets) && !hasStateAssociatedWithOneAlt(altSets); - return heuristic; -} -function getConflictingAltSets(configs) { - const configToAlts = /* @__PURE__ */ new Map(); - for (const c of configs) { - const key = getATNConfigKey(c, false); - let alts = configToAlts.get(key); - if (alts === void 0) { - alts = {}; - configToAlts.set(key, alts); - } - alts[c.alt] = true; - } - return configToAlts; -} -function hasConflictingAltSet(altSets) { - for (const value of Array.from(altSets.values())) { - if (Object.keys(value).length > 1) { - return true; - } - } - return false; -} -function hasStateAssociatedWithOneAlt(altSets) { - for (const value of Array.from(altSets.values())) { - if (Object.keys(value).length === 1) { - return true; - } - } - return false; -} - -// node_modules/vscode-languageserver-types/lib/esm/main.js -var DocumentUri; -(function(DocumentUri2) { - function is(value) { - return typeof value === "string"; - } - DocumentUri2.is = is; -})(DocumentUri || (DocumentUri = {})); -var URI2; -(function(URI3) { - function is(value) { - return typeof value === "string"; - } - URI3.is = is; -})(URI2 || (URI2 = {})); -var integer; -(function(integer2) { - integer2.MIN_VALUE = -2147483648; - integer2.MAX_VALUE = 2147483647; - function is(value) { - return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; - } - integer2.is = is; -})(integer || (integer = {})); -var uinteger; -(function(uinteger2) { - uinteger2.MIN_VALUE = 0; - uinteger2.MAX_VALUE = 2147483647; - function is(value) { - return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; - } - uinteger2.is = is; -})(uinteger || (uinteger = {})); -var Position2; -(function(Position3) { - function create(line, character) { - if (line === Number.MAX_VALUE) { - line = uinteger.MAX_VALUE; - } - if (character === Number.MAX_VALUE) { - character = uinteger.MAX_VALUE; - } - return { line, character }; - } - Position3.create = create; - function is(value) { - let candidate = value; - return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); - } - Position3.is = is; -})(Position2 || (Position2 = {})); -var Range; -(function(Range2) { - function create(one, two, three, four) { - if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { - return { start: Position2.create(one, two), end: Position2.create(three, four) }; - } else if (Position2.is(one) && Position2.is(two)) { - return { start: one, end: two }; - } else { - throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`); - } - } - Range2.create = create; - function is(value) { - let candidate = value; - return Is.objectLiteral(candidate) && Position2.is(candidate.start) && Position2.is(candidate.end); - } - Range2.is = is; -})(Range || (Range = {})); -var Location; -(function(Location3) { - function create(uri, range) { - return { uri, range }; - } - Location3.create = create; - function is(value) { - let candidate = value; - return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); - } - Location3.is = is; -})(Location || (Location = {})); -var LocationLink2; -(function(LocationLink3) { - function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { - return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; - } - LocationLink3.create = create; - function is(value) { - let candidate = value; - return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); - } - LocationLink3.is = is; -})(LocationLink2 || (LocationLink2 = {})); -var Color; -(function(Color2) { - function create(red, green, blue, alpha) { - return { - red, - green, - blue, - alpha - }; - } - Color2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); - } - Color2.is = is; -})(Color || (Color = {})); -var ColorInformation; -(function(ColorInformation2) { - function create(range, color) { - return { - range, - color - }; - } - ColorInformation2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color); - } - ColorInformation2.is = is; -})(ColorInformation || (ColorInformation = {})); -var ColorPresentation; -(function(ColorPresentation2) { - function create(label, textEdit, additionalTextEdits) { - return { - label, - textEdit, - additionalTextEdits - }; - } - ColorPresentation2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); - } - ColorPresentation2.is = is; -})(ColorPresentation || (ColorPresentation = {})); -var FoldingRangeKind; -(function(FoldingRangeKind3) { - FoldingRangeKind3.Comment = "comment"; - FoldingRangeKind3.Imports = "imports"; - FoldingRangeKind3.Region = "region"; -})(FoldingRangeKind || (FoldingRangeKind = {})); -var FoldingRange; -(function(FoldingRange3) { - function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { - const result = { - startLine, - endLine - }; - if (Is.defined(startCharacter)) { - result.startCharacter = startCharacter; - } - if (Is.defined(endCharacter)) { - result.endCharacter = endCharacter; - } - if (Is.defined(kind)) { - result.kind = kind; - } - if (Is.defined(collapsedText)) { - result.collapsedText = collapsedText; - } - return result; - } - FoldingRange3.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); - } - FoldingRange3.is = is; -})(FoldingRange || (FoldingRange = {})); -var DiagnosticRelatedInformation; -(function(DiagnosticRelatedInformation2) { - function create(location, message) { - return { - location, - message - }; - } - DiagnosticRelatedInformation2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); - } - DiagnosticRelatedInformation2.is = is; -})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); -var DiagnosticSeverity; -(function(DiagnosticSeverity2) { - DiagnosticSeverity2.Error = 1; - DiagnosticSeverity2.Warning = 2; - DiagnosticSeverity2.Information = 3; - DiagnosticSeverity2.Hint = 4; -})(DiagnosticSeverity || (DiagnosticSeverity = {})); -var DiagnosticTag; -(function(DiagnosticTag2) { - DiagnosticTag2.Unnecessary = 1; - DiagnosticTag2.Deprecated = 2; -})(DiagnosticTag || (DiagnosticTag = {})); -var CodeDescription; -(function(CodeDescription2) { - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.string(candidate.href); - } - CodeDescription2.is = is; -})(CodeDescription || (CodeDescription = {})); -var Diagnostic; -(function(Diagnostic2) { - function create(range, message, severity, code, source, relatedInformation) { - let result = { range, message }; - if (Is.defined(severity)) { - result.severity = severity; - } - if (Is.defined(code)) { - result.code = code; - } - if (Is.defined(source)) { - result.source = source; - } - if (Is.defined(relatedInformation)) { - result.relatedInformation = relatedInformation; - } - return result; - } - Diagnostic2.create = create; - function is(value) { - var _a; - let candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); - } - Diagnostic2.is = is; -})(Diagnostic || (Diagnostic = {})); -var Command; -(function(Command2) { - function create(title, command, ...args) { - let result = { title, command }; - if (Is.defined(args) && args.length > 0) { - result.arguments = args; - } - return result; - } - Command2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); - } - Command2.is = is; -})(Command || (Command = {})); -var TextEdit; -(function(TextEdit2) { - function replace(range, newText) { - return { range, newText }; - } - TextEdit2.replace = replace; - function insert(position, newText) { - return { range: { start: position, end: position }, newText }; - } - TextEdit2.insert = insert; - function del(range) { - return { range, newText: "" }; - } - TextEdit2.del = del; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); - } - TextEdit2.is = is; -})(TextEdit || (TextEdit = {})); -var ChangeAnnotation; -(function(ChangeAnnotation2) { - function create(label, needsConfirmation, description) { - const result = { label }; - if (needsConfirmation !== void 0) { - result.needsConfirmation = needsConfirmation; - } - if (description !== void 0) { - result.description = description; - } - return result; - } - ChangeAnnotation2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); - } - ChangeAnnotation2.is = is; -})(ChangeAnnotation || (ChangeAnnotation = {})); -var ChangeAnnotationIdentifier; -(function(ChangeAnnotationIdentifier2) { - function is(value) { - const candidate = value; - return Is.string(candidate); - } - ChangeAnnotationIdentifier2.is = is; -})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); -var AnnotatedTextEdit; -(function(AnnotatedTextEdit2) { - function replace(range, newText, annotation) { - return { range, newText, annotationId: annotation }; - } - AnnotatedTextEdit2.replace = replace; - function insert(position, newText, annotation) { - return { range: { start: position, end: position }, newText, annotationId: annotation }; - } - AnnotatedTextEdit2.insert = insert; - function del(range, annotation) { - return { range, newText: "", annotationId: annotation }; - } - AnnotatedTextEdit2.del = del; - function is(value) { - const candidate = value; - return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - AnnotatedTextEdit2.is = is; -})(AnnotatedTextEdit || (AnnotatedTextEdit = {})); -var TextDocumentEdit; -(function(TextDocumentEdit2) { - function create(textDocument, edits) { - return { textDocument, edits }; - } - TextDocumentEdit2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); - } - TextDocumentEdit2.is = is; -})(TextDocumentEdit || (TextDocumentEdit = {})); -var CreateFile; -(function(CreateFile2) { - function create(uri, options, annotation) { - let result = { - kind: "create", - uri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - CreateFile2.create = create; - function is(value) { - let candidate = value; - return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - CreateFile2.is = is; -})(CreateFile || (CreateFile = {})); -var RenameFile; -(function(RenameFile2) { - function create(oldUri, newUri, options, annotation) { - let result = { - kind: "rename", - oldUri, - newUri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - RenameFile2.create = create; - function is(value) { - let candidate = value; - return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - RenameFile2.is = is; -})(RenameFile || (RenameFile = {})); -var DeleteFile; -(function(DeleteFile2) { - function create(uri, options, annotation) { - let result = { - kind: "delete", - uri - }; - if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { - result.options = options; - } - if (annotation !== void 0) { - result.annotationId = annotation; - } - return result; - } - DeleteFile2.create = create; - function is(value) { - let candidate = value; - return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - DeleteFile2.is = is; -})(DeleteFile || (DeleteFile = {})); -var WorkspaceEdit; -(function(WorkspaceEdit2) { - function is(value) { - let candidate = value; - return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => { - if (Is.string(change.kind)) { - return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); - } else { - return TextDocumentEdit.is(change); - } - })); - } - WorkspaceEdit2.is = is; -})(WorkspaceEdit || (WorkspaceEdit = {})); -var TextDocumentIdentifier; -(function(TextDocumentIdentifier2) { - function create(uri) { - return { uri }; - } - TextDocumentIdentifier2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri); - } - TextDocumentIdentifier2.is = is; -})(TextDocumentIdentifier || (TextDocumentIdentifier = {})); -var VersionedTextDocumentIdentifier; -(function(VersionedTextDocumentIdentifier2) { - function create(uri, version) { - return { uri, version }; - } - VersionedTextDocumentIdentifier2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); - } - VersionedTextDocumentIdentifier2.is = is; -})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); -var OptionalVersionedTextDocumentIdentifier; -(function(OptionalVersionedTextDocumentIdentifier2) { - function create(uri, version) { - return { uri, version }; - } - OptionalVersionedTextDocumentIdentifier2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); - } - OptionalVersionedTextDocumentIdentifier2.is = is; -})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); -var TextDocumentItem; -(function(TextDocumentItem2) { - function create(uri, languageId, version, text) { - return { uri, languageId, version, text }; - } - TextDocumentItem2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); - } - TextDocumentItem2.is = is; -})(TextDocumentItem || (TextDocumentItem = {})); -var MarkupKind; -(function(MarkupKind2) { - MarkupKind2.PlainText = "plaintext"; - MarkupKind2.Markdown = "markdown"; - function is(value) { - const candidate = value; - return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; - } - MarkupKind2.is = is; -})(MarkupKind || (MarkupKind = {})); -var MarkupContent; -(function(MarkupContent2) { - function is(value) { - const candidate = value; - return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); - } - MarkupContent2.is = is; -})(MarkupContent || (MarkupContent = {})); -var CompletionItemKind2; -(function(CompletionItemKind4) { - CompletionItemKind4.Text = 1; - CompletionItemKind4.Method = 2; - CompletionItemKind4.Function = 3; - CompletionItemKind4.Constructor = 4; - CompletionItemKind4.Field = 5; - CompletionItemKind4.Variable = 6; - CompletionItemKind4.Class = 7; - CompletionItemKind4.Interface = 8; - CompletionItemKind4.Module = 9; - CompletionItemKind4.Property = 10; - CompletionItemKind4.Unit = 11; - CompletionItemKind4.Value = 12; - CompletionItemKind4.Enum = 13; - CompletionItemKind4.Keyword = 14; - CompletionItemKind4.Snippet = 15; - CompletionItemKind4.Color = 16; - CompletionItemKind4.File = 17; - CompletionItemKind4.Reference = 18; - CompletionItemKind4.Folder = 19; - CompletionItemKind4.EnumMember = 20; - CompletionItemKind4.Constant = 21; - CompletionItemKind4.Struct = 22; - CompletionItemKind4.Event = 23; - CompletionItemKind4.Operator = 24; - CompletionItemKind4.TypeParameter = 25; -})(CompletionItemKind2 || (CompletionItemKind2 = {})); -var InsertTextFormat; -(function(InsertTextFormat2) { - InsertTextFormat2.PlainText = 1; - InsertTextFormat2.Snippet = 2; -})(InsertTextFormat || (InsertTextFormat = {})); -var CompletionItemTag; -(function(CompletionItemTag2) { - CompletionItemTag2.Deprecated = 1; -})(CompletionItemTag || (CompletionItemTag = {})); -var InsertReplaceEdit; -(function(InsertReplaceEdit2) { - function create(newText, insert, replace) { - return { newText, insert, replace }; - } - InsertReplaceEdit2.create = create; - function is(value) { - const candidate = value; - return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); - } - InsertReplaceEdit2.is = is; -})(InsertReplaceEdit || (InsertReplaceEdit = {})); -var InsertTextMode; -(function(InsertTextMode2) { - InsertTextMode2.asIs = 1; - InsertTextMode2.adjustIndentation = 2; -})(InsertTextMode || (InsertTextMode = {})); -var CompletionItemLabelDetails; -(function(CompletionItemLabelDetails2) { - function is(value) { - const candidate = value; - return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); - } - CompletionItemLabelDetails2.is = is; -})(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); -var CompletionItem; -(function(CompletionItem2) { - function create(label) { - return { label }; - } - CompletionItem2.create = create; -})(CompletionItem || (CompletionItem = {})); -var CompletionList2; -(function(CompletionList3) { - function create(items, isIncomplete) { - return { items: items ? items : [], isIncomplete: !!isIncomplete }; - } - CompletionList3.create = create; -})(CompletionList2 || (CompletionList2 = {})); -var MarkedString; -(function(MarkedString2) { - function fromPlainText(plainText) { - return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); - } - MarkedString2.fromPlainText = fromPlainText; - function is(value) { - const candidate = value; - return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); - } - MarkedString2.is = is; -})(MarkedString || (MarkedString = {})); -var Hover; -(function(Hover2) { - function is(value) { - let candidate = value; - return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); - } - Hover2.is = is; -})(Hover || (Hover = {})); -var ParameterInformation; -(function(ParameterInformation2) { - function create(label, documentation) { - return documentation ? { label, documentation } : { label }; - } - ParameterInformation2.create = create; -})(ParameterInformation || (ParameterInformation = {})); -var SignatureInformation; -(function(SignatureInformation2) { - function create(label, documentation, ...parameters) { - let result = { label }; - if (Is.defined(documentation)) { - result.documentation = documentation; - } - if (Is.defined(parameters)) { - result.parameters = parameters; - } else { - result.parameters = []; - } - return result; - } - SignatureInformation2.create = create; -})(SignatureInformation || (SignatureInformation = {})); -var DocumentHighlightKind; -(function(DocumentHighlightKind2) { - DocumentHighlightKind2.Text = 1; - DocumentHighlightKind2.Read = 2; - DocumentHighlightKind2.Write = 3; -})(DocumentHighlightKind || (DocumentHighlightKind = {})); -var DocumentHighlight; -(function(DocumentHighlight3) { - function create(range, kind) { - let result = { range }; - if (Is.number(kind)) { - result.kind = kind; - } - return result; - } - DocumentHighlight3.create = create; -})(DocumentHighlight || (DocumentHighlight = {})); -var SymbolKind2; -(function(SymbolKind5) { - SymbolKind5.File = 1; - SymbolKind5.Module = 2; - SymbolKind5.Namespace = 3; - SymbolKind5.Package = 4; - SymbolKind5.Class = 5; - SymbolKind5.Method = 6; - SymbolKind5.Property = 7; - SymbolKind5.Field = 8; - SymbolKind5.Constructor = 9; - SymbolKind5.Enum = 10; - SymbolKind5.Interface = 11; - SymbolKind5.Function = 12; - SymbolKind5.Variable = 13; - SymbolKind5.Constant = 14; - SymbolKind5.String = 15; - SymbolKind5.Number = 16; - SymbolKind5.Boolean = 17; - SymbolKind5.Array = 18; - SymbolKind5.Object = 19; - SymbolKind5.Key = 20; - SymbolKind5.Null = 21; - SymbolKind5.EnumMember = 22; - SymbolKind5.Struct = 23; - SymbolKind5.Event = 24; - SymbolKind5.Operator = 25; - SymbolKind5.TypeParameter = 26; -})(SymbolKind2 || (SymbolKind2 = {})); -var SymbolTag; -(function(SymbolTag2) { - SymbolTag2.Deprecated = 1; -})(SymbolTag || (SymbolTag = {})); -var SymbolInformation; -(function(SymbolInformation2) { - function create(name, kind, range, uri, containerName) { - let result = { - name, - kind, - location: { uri, range } - }; - if (containerName) { - result.containerName = containerName; - } - return result; - } - SymbolInformation2.create = create; -})(SymbolInformation || (SymbolInformation = {})); -var WorkspaceSymbol; -(function(WorkspaceSymbol2) { - function create(name, kind, uri, range) { - return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } }; - } - WorkspaceSymbol2.create = create; -})(WorkspaceSymbol || (WorkspaceSymbol = {})); -var DocumentSymbol; -(function(DocumentSymbol2) { - function create(name, detail, kind, range, selectionRange, children) { - let result = { - name, - detail, - kind, - range, - selectionRange - }; - if (children !== void 0) { - result.children = children; - } - return result; - } - DocumentSymbol2.create = create; - function is(value) { - let candidate = value; - return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); - } - DocumentSymbol2.is = is; -})(DocumentSymbol || (DocumentSymbol = {})); -var CodeActionKind; -(function(CodeActionKind2) { - CodeActionKind2.Empty = ""; - CodeActionKind2.QuickFix = "quickfix"; - CodeActionKind2.Refactor = "refactor"; - CodeActionKind2.RefactorExtract = "refactor.extract"; - CodeActionKind2.RefactorInline = "refactor.inline"; - CodeActionKind2.RefactorRewrite = "refactor.rewrite"; - CodeActionKind2.Source = "source"; - CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; - CodeActionKind2.SourceFixAll = "source.fixAll"; -})(CodeActionKind || (CodeActionKind = {})); -var CodeActionTriggerKind; -(function(CodeActionTriggerKind2) { - CodeActionTriggerKind2.Invoked = 1; - CodeActionTriggerKind2.Automatic = 2; -})(CodeActionTriggerKind || (CodeActionTriggerKind = {})); -var CodeActionContext; -(function(CodeActionContext2) { - function create(diagnostics, only, triggerKind) { - let result = { diagnostics }; - if (only !== void 0 && only !== null) { - result.only = only; - } - if (triggerKind !== void 0 && triggerKind !== null) { - result.triggerKind = triggerKind; - } - return result; - } - CodeActionContext2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); - } - CodeActionContext2.is = is; -})(CodeActionContext || (CodeActionContext = {})); -var CodeAction; -(function(CodeAction2) { - function create(title, kindOrCommandOrEdit, kind) { - let result = { title }; - let checkKind = true; - if (typeof kindOrCommandOrEdit === "string") { - checkKind = false; - result.kind = kindOrCommandOrEdit; - } else if (Command.is(kindOrCommandOrEdit)) { - result.command = kindOrCommandOrEdit; - } else { - result.edit = kindOrCommandOrEdit; - } - if (checkKind && kind !== void 0) { - result.kind = kind; - } - return result; - } - CodeAction2.create = create; - function is(value) { - let candidate = value; - return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); - } - CodeAction2.is = is; -})(CodeAction || (CodeAction = {})); -var CodeLens; -(function(CodeLens2) { - function create(range, data) { - let result = { range }; - if (Is.defined(data)) { - result.data = data; - } - return result; - } - CodeLens2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); - } - CodeLens2.is = is; -})(CodeLens || (CodeLens = {})); -var FormattingOptions; -(function(FormattingOptions2) { - function create(tabSize, insertSpaces) { - return { tabSize, insertSpaces }; - } - FormattingOptions2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); - } - FormattingOptions2.is = is; -})(FormattingOptions || (FormattingOptions = {})); -var DocumentLink; -(function(DocumentLink2) { - function create(range, target, data) { - return { range, target, data }; - } - DocumentLink2.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); - } - DocumentLink2.is = is; -})(DocumentLink || (DocumentLink = {})); -var SelectionRange; -(function(SelectionRange2) { - function create(range, parent) { - return { range, parent }; - } - SelectionRange2.create = create; - function is(value) { - let candidate = value; - return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); - } - SelectionRange2.is = is; -})(SelectionRange || (SelectionRange = {})); -var SemanticTokenTypes; -(function(SemanticTokenTypes3) { - SemanticTokenTypes3["namespace"] = "namespace"; - SemanticTokenTypes3["type"] = "type"; - SemanticTokenTypes3["class"] = "class"; - SemanticTokenTypes3["enum"] = "enum"; - SemanticTokenTypes3["interface"] = "interface"; - SemanticTokenTypes3["struct"] = "struct"; - SemanticTokenTypes3["typeParameter"] = "typeParameter"; - SemanticTokenTypes3["parameter"] = "parameter"; - SemanticTokenTypes3["variable"] = "variable"; - SemanticTokenTypes3["property"] = "property"; - SemanticTokenTypes3["enumMember"] = "enumMember"; - SemanticTokenTypes3["event"] = "event"; - SemanticTokenTypes3["function"] = "function"; - SemanticTokenTypes3["method"] = "method"; - SemanticTokenTypes3["macro"] = "macro"; - SemanticTokenTypes3["keyword"] = "keyword"; - SemanticTokenTypes3["modifier"] = "modifier"; - SemanticTokenTypes3["comment"] = "comment"; - SemanticTokenTypes3["string"] = "string"; - SemanticTokenTypes3["number"] = "number"; - SemanticTokenTypes3["regexp"] = "regexp"; - SemanticTokenTypes3["operator"] = "operator"; - SemanticTokenTypes3["decorator"] = "decorator"; -})(SemanticTokenTypes || (SemanticTokenTypes = {})); -var SemanticTokenModifiers; -(function(SemanticTokenModifiers3) { - SemanticTokenModifiers3["declaration"] = "declaration"; - SemanticTokenModifiers3["definition"] = "definition"; - SemanticTokenModifiers3["readonly"] = "readonly"; - SemanticTokenModifiers3["static"] = "static"; - SemanticTokenModifiers3["deprecated"] = "deprecated"; - SemanticTokenModifiers3["abstract"] = "abstract"; - SemanticTokenModifiers3["async"] = "async"; - SemanticTokenModifiers3["modification"] = "modification"; - SemanticTokenModifiers3["documentation"] = "documentation"; - SemanticTokenModifiers3["defaultLibrary"] = "defaultLibrary"; -})(SemanticTokenModifiers || (SemanticTokenModifiers = {})); -var SemanticTokens; -(function(SemanticTokens2) { - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); - } - SemanticTokens2.is = is; -})(SemanticTokens || (SemanticTokens = {})); -var InlineValueText; -(function(InlineValueText2) { - function create(range, text) { - return { range, text }; - } - InlineValueText2.create = create; - function is(value) { - const candidate = value; - return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text); - } - InlineValueText2.is = is; -})(InlineValueText || (InlineValueText = {})); -var InlineValueVariableLookup; -(function(InlineValueVariableLookup2) { - function create(range, variableName, caseSensitiveLookup) { - return { range, variableName, caseSensitiveLookup }; - } - InlineValueVariableLookup2.create = create; - function is(value) { - const candidate = value; - return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); - } - InlineValueVariableLookup2.is = is; -})(InlineValueVariableLookup || (InlineValueVariableLookup = {})); -var InlineValueEvaluatableExpression; -(function(InlineValueEvaluatableExpression2) { - function create(range, expression) { - return { range, expression }; - } - InlineValueEvaluatableExpression2.create = create; - function is(value) { - const candidate = value; - return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); - } - InlineValueEvaluatableExpression2.is = is; -})(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); -var InlineValueContext; -(function(InlineValueContext2) { - function create(frameId, stoppedLocation) { - return { frameId, stoppedLocation }; - } - InlineValueContext2.create = create; - function is(value) { - const candidate = value; - return Is.defined(candidate) && Range.is(value.stoppedLocation); - } - InlineValueContext2.is = is; -})(InlineValueContext || (InlineValueContext = {})); -var InlayHintKind; -(function(InlayHintKind2) { - InlayHintKind2.Type = 1; - InlayHintKind2.Parameter = 2; - function is(value) { - return value === 1 || value === 2; - } - InlayHintKind2.is = is; -})(InlayHintKind || (InlayHintKind = {})); -var InlayHintLabelPart; -(function(InlayHintLabelPart2) { - function create(value) { - return { value }; - } - InlayHintLabelPart2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); - } - InlayHintLabelPart2.is = is; -})(InlayHintLabelPart || (InlayHintLabelPart = {})); -var InlayHint; -(function(InlayHint2) { - function create(position, label, kind) { - const result = { position, label }; - if (kind !== void 0) { - result.kind = kind; - } - return result; - } - InlayHint2.create = create; - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && Position2.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); - } - InlayHint2.is = is; -})(InlayHint || (InlayHint = {})); -var StringValue; -(function(StringValue2) { - function createSnippet(value) { - return { kind: "snippet", value }; - } - StringValue2.createSnippet = createSnippet; -})(StringValue || (StringValue = {})); -var InlineCompletionItem; -(function(InlineCompletionItem2) { - function create(insertText, filterText, range, command) { - return { insertText, filterText, range, command }; - } - InlineCompletionItem2.create = create; -})(InlineCompletionItem || (InlineCompletionItem = {})); -var InlineCompletionList; -(function(InlineCompletionList2) { - function create(items) { - return { items }; - } - InlineCompletionList2.create = create; -})(InlineCompletionList || (InlineCompletionList = {})); -var InlineCompletionTriggerKind; -(function(InlineCompletionTriggerKind2) { - InlineCompletionTriggerKind2.Invoked = 0; - InlineCompletionTriggerKind2.Automatic = 1; -})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {})); -var SelectedCompletionInfo; -(function(SelectedCompletionInfo2) { - function create(range, text) { - return { range, text }; - } - SelectedCompletionInfo2.create = create; -})(SelectedCompletionInfo || (SelectedCompletionInfo = {})); -var InlineCompletionContext; -(function(InlineCompletionContext2) { - function create(triggerKind, selectedCompletionInfo) { - return { triggerKind, selectedCompletionInfo }; - } - InlineCompletionContext2.create = create; -})(InlineCompletionContext || (InlineCompletionContext = {})); -var WorkspaceFolder; -(function(WorkspaceFolder2) { - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && URI2.is(candidate.uri) && Is.string(candidate.name); - } - WorkspaceFolder2.is = is; -})(WorkspaceFolder || (WorkspaceFolder = {})); -var TextDocument; -(function(TextDocument3) { - function create(uri, languageId, version, content) { - return new FullTextDocument(uri, languageId, version, content); - } - TextDocument3.create = create; - function is(value) { - let candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; - } - TextDocument3.is = is; - function applyEdits(document, edits) { - let text = document.getText(); - let sortedEdits = mergeSort2(edits, (a2, b) => { - let diff = a2.range.start.line - b.range.start.line; - if (diff === 0) { - return a2.range.start.character - b.range.start.character; - } - return diff; - }); - let lastModifiedOffset = text.length; - for (let i = sortedEdits.length - 1; i >= 0; i--) { - let e = sortedEdits[i]; - let startOffset = document.offsetAt(e.range.start); - let endOffset = document.offsetAt(e.range.end); - if (endOffset <= lastModifiedOffset) { - text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); - } else { - throw new Error("Overlapping edit"); - } - lastModifiedOffset = startOffset; - } - return text; - } - TextDocument3.applyEdits = applyEdits; - function mergeSort2(data, compare) { - if (data.length <= 1) { - return data; - } - const p = data.length / 2 | 0; - const left = data.slice(0, p); - const right = data.slice(p); - mergeSort2(left, compare); - mergeSort2(right, compare); - let leftIdx = 0; - let rightIdx = 0; - let i = 0; - while (leftIdx < left.length && rightIdx < right.length) { - let ret = compare(left[leftIdx], right[rightIdx]); - if (ret <= 0) { - data[i++] = left[leftIdx++]; - } else { - data[i++] = right[rightIdx++]; - } - } - while (leftIdx < left.length) { - data[i++] = left[leftIdx++]; - } - while (rightIdx < right.length) { - data[i++] = right[rightIdx++]; - } - return data; - } -})(TextDocument || (TextDocument = {})); -var FullTextDocument = class { - constructor(uri, languageId, version, content) { - this._uri = uri; - this._languageId = languageId; - this._version = version; - this._content = content; - this._lineOffsets = void 0; - } - get uri() { - return this._uri; - } - get languageId() { - return this._languageId; - } - get version() { - return this._version; - } - getText(range) { - if (range) { - let start = this.offsetAt(range.start); - let end = this.offsetAt(range.end); - return this._content.substring(start, end); - } - return this._content; - } - update(event, version) { - this._content = event.text; - this._version = version; - this._lineOffsets = void 0; - } - getLineOffsets() { - if (this._lineOffsets === void 0) { - let lineOffsets = []; - let text = this._content; - let isLineStart = true; - for (let i = 0; i < text.length; i++) { - if (isLineStart) { - lineOffsets.push(i); - isLineStart = false; - } - let ch = text.charAt(i); - isLineStart = ch === "\r" || ch === "\n"; - if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { - i++; - } - } - if (isLineStart && text.length > 0) { - lineOffsets.push(text.length); - } - this._lineOffsets = lineOffsets; - } - return this._lineOffsets; - } - positionAt(offset) { - offset = Math.max(Math.min(offset, this._content.length), 0); - let lineOffsets = this.getLineOffsets(); - let low = 0, high = lineOffsets.length; - if (high === 0) { - return Position2.create(0, offset); - } - while (low < high) { - let mid = Math.floor((low + high) / 2); - if (lineOffsets[mid] > offset) { - high = mid; - } else { - low = mid + 1; - } - } - let line = low - 1; - return Position2.create(line, offset - lineOffsets[line]); - } - offsetAt(position) { - let lineOffsets = this.getLineOffsets(); - if (position.line >= lineOffsets.length) { - return this._content.length; - } else if (position.line < 0) { - return 0; - } - let lineOffset = lineOffsets[position.line]; - let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; - return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); - } - get lineCount() { - return this.getLineOffsets().length; - } -}; -var Is; -(function(Is2) { - const toString3 = Object.prototype.toString; - function defined(value) { - return typeof value !== "undefined"; - } - Is2.defined = defined; - function undefined2(value) { - return typeof value === "undefined"; - } - Is2.undefined = undefined2; - function boolean(value) { - return value === true || value === false; - } - Is2.boolean = boolean; - function string(value) { - return toString3.call(value) === "[object String]"; - } - Is2.string = string; - function number(value) { - return toString3.call(value) === "[object Number]"; - } - Is2.number = number; - function numberRange(value, min2, max) { - return toString3.call(value) === "[object Number]" && min2 <= value && value <= max; - } - Is2.numberRange = numberRange; - function integer2(value) { - return toString3.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; - } - Is2.integer = integer2; - function uinteger2(value) { - return toString3.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; - } - Is2.uinteger = uinteger2; - function func(value) { - return toString3.call(value) === "[object Function]"; - } - Is2.func = func; - function objectLiteral(value) { - return value !== null && typeof value === "object"; - } - Is2.objectLiteral = objectLiteral; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - Is2.typedArray = typedArray; -})(Is || (Is = {})); - -// node_modules/langium/lib/parser/cst-node-builder.js -var CstNodeBuilder = class { - constructor() { - this.nodeStack = []; - } - get current() { - return this.nodeStack[this.nodeStack.length - 1]; - } - buildRootNode(input) { - this.rootNode = new RootCstNodeImpl(input); - this.rootNode.root = this.rootNode; - this.nodeStack = [this.rootNode]; - return this.rootNode; - } - buildCompositeNode(feature) { - const compositeNode = new CompositeCstNodeImpl(); - compositeNode.grammarSource = feature; - compositeNode.root = this.rootNode; - this.current.content.push(compositeNode); - this.nodeStack.push(compositeNode); - return compositeNode; - } - buildLeafNode(token, feature) { - const leafNode = new LeafCstNodeImpl(token.startOffset, token.image.length, tokenToRange(token), token.tokenType, false); - leafNode.grammarSource = feature; - leafNode.root = this.rootNode; - this.current.content.push(leafNode); - return leafNode; - } - removeNode(node) { - const parent = node.container; - if (parent) { - const index = parent.content.indexOf(node); - if (index >= 0) { - parent.content.splice(index, 1); - } - } - } - construct(item) { - const current = this.current; - if (typeof item.$type === "string") { - this.current.astNode = item; - } - item.$cstNode = current; - const node = this.nodeStack.pop(); - if ((node === null || node === void 0 ? void 0 : node.content.length) === 0) { - this.removeNode(node); - } - } - addHiddenTokens(hiddenTokens) { - for (const token of hiddenTokens) { - const hiddenNode = new LeafCstNodeImpl(token.startOffset, token.image.length, tokenToRange(token), token.tokenType, true); - hiddenNode.root = this.rootNode; - this.addHiddenToken(this.rootNode, hiddenNode); - } - } - addHiddenToken(node, token) { - const { offset: tokenStart, end: tokenEnd } = token; - for (let i = 0; i < node.content.length; i++) { - const child = node.content[i]; - const { offset: childStart, end: childEnd } = child; - if (isCompositeCstNode(child) && tokenStart > childStart && tokenEnd < childEnd) { - this.addHiddenToken(child, token); - return; - } else if (tokenEnd <= childStart) { - node.content.splice(i, 0, token); - return; - } - } - node.content.push(token); - } -}; -var AbstractCstNode = class { - /** @deprecated use `container` instead. */ - get parent() { - return this.container; - } - /** @deprecated use `grammarSource` instead. */ - get feature() { - return this.grammarSource; - } - get hidden() { - return false; - } - get astNode() { - var _a, _b; - const node = typeof ((_a = this._astNode) === null || _a === void 0 ? void 0 : _a.$type) === "string" ? this._astNode : (_b = this.container) === null || _b === void 0 ? void 0 : _b.astNode; - if (!node) { - throw new Error("This node has no associated AST element"); - } - return node; - } - set astNode(value) { - this._astNode = value; - } - /** @deprecated use `astNode` instead. */ - get element() { - return this.astNode; - } - get text() { - return this.root.fullText.substring(this.offset, this.end); - } -}; -var LeafCstNodeImpl = class extends AbstractCstNode { - get offset() { - return this._offset; - } - get length() { - return this._length; - } - get end() { - return this._offset + this._length; - } - get hidden() { - return this._hidden; - } - get tokenType() { - return this._tokenType; - } - get range() { - return this._range; - } - constructor(offset, length, range, tokenType, hidden = false) { - super(); - this._hidden = hidden; - this._offset = offset; - this._tokenType = tokenType; - this._length = length; - this._range = range; - } -}; -var CompositeCstNodeImpl = class extends AbstractCstNode { - constructor() { - super(...arguments); - this.content = new CstNodeContainer(this); - } - /** @deprecated use `content` instead. */ - get children() { - return this.content; - } - get offset() { - var _a, _b; - return (_b = (_a = this.firstNonHiddenNode) === null || _a === void 0 ? void 0 : _a.offset) !== null && _b !== void 0 ? _b : 0; - } - get length() { - return this.end - this.offset; - } - get end() { - var _a, _b; - return (_b = (_a = this.lastNonHiddenNode) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : 0; - } - get range() { - const firstNode = this.firstNonHiddenNode; - const lastNode = this.lastNonHiddenNode; - if (firstNode && lastNode) { - if (this._rangeCache === void 0) { - const { range: firstRange } = firstNode; - const { range: lastRange } = lastNode; - this._rangeCache = { start: firstRange.start, end: lastRange.end.line < firstRange.start.line ? firstRange.start : lastRange.end }; - } - return this._rangeCache; - } else { - return { start: Position2.create(0, 0), end: Position2.create(0, 0) }; - } - } - get firstNonHiddenNode() { - for (const child of this.content) { - if (!child.hidden) { - return child; - } - } - return this.content[0]; - } - get lastNonHiddenNode() { - for (let i = this.content.length - 1; i >= 0; i--) { - const child = this.content[i]; - if (!child.hidden) { - return child; - } - } - return this.content[this.content.length - 1]; - } -}; -var CstNodeContainer = class _CstNodeContainer extends Array { - constructor(parent) { - super(); - this.parent = parent; - Object.setPrototypeOf(this, _CstNodeContainer.prototype); - } - push(...items) { - this.addParents(items); - return super.push(...items); - } - unshift(...items) { - this.addParents(items); - return super.unshift(...items); - } - splice(start, count, ...items) { - this.addParents(items); - return super.splice(start, count, ...items); - } - addParents(items) { - for (const item of items) { - item.container = this.parent; - } - } -}; -var RootCstNodeImpl = class extends CompositeCstNodeImpl { - get text() { - return this._text.substring(this.offset, this.end); - } - get fullText() { - return this._text; - } - constructor(input) { - super(); - this._text = ""; - this._text = input !== null && input !== void 0 ? input : ""; - } -}; - -// node_modules/langium/lib/parser/langium-parser.js -var DatatypeSymbol = Symbol("Datatype"); -function isDataTypeNode(node) { - return node.$type === DatatypeSymbol; -} -var ruleSuffix = "\u200B"; -var withRuleSuffix = (name) => name.endsWith(ruleSuffix) ? name : name + ruleSuffix; -var AbstractLangiumParser = class { - constructor(services) { - this._unorderedGroups = /* @__PURE__ */ new Map(); - this.lexer = services.parser.Lexer; - const tokens = this.lexer.definition; - this.wrapper = new ChevrotainWrapper(tokens, Object.assign(Object.assign({}, services.parser.ParserConfig), { errorMessageProvider: services.parser.ParserErrorMessageProvider })); - } - alternatives(idx, choices) { - this.wrapper.wrapOr(idx, choices); - } - optional(idx, callback) { - this.wrapper.wrapOption(idx, callback); - } - many(idx, callback) { - this.wrapper.wrapMany(idx, callback); - } - atLeastOne(idx, callback) { - this.wrapper.wrapAtLeastOne(idx, callback); - } - isRecording() { - return this.wrapper.IS_RECORDING; - } - get unorderedGroups() { - return this._unorderedGroups; - } - getRuleStack() { - return this.wrapper.RULE_STACK; - } - finalize() { - this.wrapper.wrapSelfAnalysis(); - } -}; -var LangiumParser = class extends AbstractLangiumParser { - get current() { - return this.stack[this.stack.length - 1]; - } - constructor(services) { - super(services); - this.nodeBuilder = new CstNodeBuilder(); - this.stack = []; - this.assignmentMap = /* @__PURE__ */ new Map(); - this.linker = services.references.Linker; - this.converter = services.parser.ValueConverter; - this.astReflection = services.shared.AstReflection; - } - rule(rule, impl) { - const type = rule.fragment ? void 0 : isDataTypeRule(rule) ? DatatypeSymbol : getTypeName(rule); - const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(type, impl).bind(this)); - if (rule.entry) { - this.mainRule = ruleMethod; - } - return ruleMethod; - } - parse(input) { - this.nodeBuilder.buildRootNode(input); - const lexerResult = this.lexer.tokenize(input); - this.wrapper.input = lexerResult.tokens; - const result = this.mainRule.call(this.wrapper, {}); - this.nodeBuilder.addHiddenTokens(lexerResult.hidden); - this.unorderedGroups.clear(); - return { - value: result, - lexerErrors: lexerResult.errors, - parserErrors: this.wrapper.errors - }; - } - startImplementation($type, implementation) { - return (args) => { - if (!this.isRecording()) { - const node = { $type }; - this.stack.push(node); - if ($type === DatatypeSymbol) { - node.value = ""; - } - } - let result; - try { - result = implementation(args); - } catch (err) { - result = void 0; - } - if (!this.isRecording() && result === void 0) { - result = this.construct(); - } - return result; - }; - } - consume(idx, tokenType, feature) { - const token = this.wrapper.wrapConsume(idx, tokenType); - if (!this.isRecording() && this.isValidToken(token)) { - const leafNode = this.nodeBuilder.buildLeafNode(token, feature); - const { assignment, isCrossRef } = this.getAssignment(feature); - const current = this.current; - if (assignment) { - const convertedValue = isKeyword(feature) ? token.image : this.converter.convert(token.image, leafNode); - this.assign(assignment.operator, assignment.feature, convertedValue, leafNode, isCrossRef); - } else if (isDataTypeNode(current)) { - let text = token.image; - if (!isKeyword(feature)) { - text = this.converter.convert(text, leafNode).toString(); - } - current.value += text; - } - } - } - /** - * Most consumed parser tokens are valid. However there are two cases in which they are not valid: - * - * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed - * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders. - */ - isValidToken(token) { - return !token.isInsertedInRecovery && !isNaN(token.startOffset) && typeof token.endOffset === "number" && !isNaN(token.endOffset); - } - subrule(idx, rule, feature, args) { - let cstNode; - if (!this.isRecording()) { - cstNode = this.nodeBuilder.buildCompositeNode(feature); - } - const subruleResult = this.wrapper.wrapSubrule(idx, rule, args); - if (!this.isRecording() && cstNode && cstNode.length > 0) { - this.performSubruleAssignment(subruleResult, feature, cstNode); - } - } - performSubruleAssignment(result, feature, cstNode) { - const { assignment, isCrossRef } = this.getAssignment(feature); - if (assignment) { - this.assign(assignment.operator, assignment.feature, result, cstNode, isCrossRef); - } else if (!assignment) { - const current = this.current; - if (isDataTypeNode(current)) { - current.value += result.toString(); - } else if (typeof result === "object" && result) { - const resultKind = result.$type; - const object = this.assignWithoutOverride(result, current); - if (resultKind) { - object.$type = resultKind; - } - const newItem = object; - this.stack.pop(); - this.stack.push(newItem); - } - } - } - action($type, action) { - if (!this.isRecording()) { - let last2 = this.current; - if (!last2.$cstNode && action.feature && action.operator) { - last2 = this.construct(false); - const feature = last2.$cstNode.feature; - this.nodeBuilder.buildCompositeNode(feature); - } - const newItem = { $type }; - this.stack.pop(); - this.stack.push(newItem); - if (action.feature && action.operator) { - this.assign(action.operator, action.feature, last2, last2.$cstNode, false); - } - } - } - construct(pop = true) { - if (this.isRecording()) { - return void 0; - } - const obj = this.current; - linkContentToContainer(obj); - this.nodeBuilder.construct(obj); - if (pop) { - this.stack.pop(); - } - if (isDataTypeNode(obj)) { - return this.converter.convert(obj.value, obj.$cstNode); - } else { - assignMandatoryProperties(this.astReflection, obj); - } - return obj; - } - getAssignment(feature) { - if (!this.assignmentMap.has(feature)) { - const assignment = getContainerOfType(feature, isAssignment); - this.assignmentMap.set(feature, { - assignment, - isCrossRef: assignment ? isCrossReference(assignment.terminal) : false - }); - } - return this.assignmentMap.get(feature); - } - assign(operator, feature, value, cstNode, isCrossRef) { - const obj = this.current; - let item; - if (isCrossRef && typeof value === "string") { - item = this.linker.buildReference(obj, feature, cstNode, value); - } else { - item = value; - } - switch (operator) { - case "=": { - obj[feature] = item; - break; - } - case "?=": { - obj[feature] = true; - break; - } - case "+=": { - if (!Array.isArray(obj[feature])) { - obj[feature] = []; - } - obj[feature].push(item); - } - } - } - assignWithoutOverride(target, source) { - for (const [name, existingValue] of Object.entries(source)) { - const newValue = target[name]; - if (newValue === void 0) { - target[name] = existingValue; - } else if (Array.isArray(newValue) && Array.isArray(existingValue)) { - existingValue.push(...newValue); - target[name] = existingValue; - } - } - return target; - } - get definitionErrors() { - return this.wrapper.definitionErrors; - } -}; -var AbstractParserErrorMessageProvider = class { - buildMismatchTokenMessage(options) { - return defaultParserErrorProvider.buildMismatchTokenMessage(options); - } - buildNotAllInputParsedMessage(options) { - return defaultParserErrorProvider.buildNotAllInputParsedMessage(options); - } - buildNoViableAltMessage(options) { - return defaultParserErrorProvider.buildNoViableAltMessage(options); - } - buildEarlyExitMessage(options) { - return defaultParserErrorProvider.buildEarlyExitMessage(options); - } -}; -var LangiumParserErrorMessageProvider = class extends AbstractParserErrorMessageProvider { - buildMismatchTokenMessage({ expected, actual }) { - const expectedMsg = expected.LABEL ? "`" + expected.LABEL + "`" : expected.name.endsWith(":KW") ? `keyword '${expected.name.substring(0, expected.name.length - 3)}'` : `token of type '${expected.name}'`; - return `Expecting ${expectedMsg} but found \`${actual.image}\`.`; - } - buildNotAllInputParsedMessage({ firstRedundant }) { - return `Expecting end of file but found \`${firstRedundant.image}\`.`; - } -}; -var LangiumCompletionParser = class extends AbstractLangiumParser { - constructor() { - super(...arguments); - this.tokens = []; - this.elementStack = []; - this.lastElementStack = []; - this.nextTokenIndex = 0; - this.stackSize = 0; - } - action() { - } - construct() { - return void 0; - } - parse(input) { - this.resetState(); - const tokens = this.lexer.tokenize(input); - this.tokens = tokens.tokens; - this.wrapper.input = [...this.tokens]; - this.mainRule.call(this.wrapper, {}); - this.unorderedGroups.clear(); - return { - tokens: this.tokens, - elementStack: [...this.lastElementStack], - tokenIndex: this.nextTokenIndex - }; - } - rule(rule, impl) { - const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(impl).bind(this)); - if (rule.entry) { - this.mainRule = ruleMethod; - } - return ruleMethod; - } - resetState() { - this.elementStack = []; - this.lastElementStack = []; - this.nextTokenIndex = 0; - this.stackSize = 0; - } - startImplementation(implementation) { - return (args) => { - const size = this.keepStackSize(); - try { - implementation(args); - } finally { - this.resetStackSize(size); - } - }; - } - removeUnexpectedElements() { - this.elementStack.splice(this.stackSize); - } - keepStackSize() { - const size = this.elementStack.length; - this.stackSize = size; - return size; - } - resetStackSize(size) { - this.removeUnexpectedElements(); - this.stackSize = size; - } - consume(idx, tokenType, feature) { - this.wrapper.wrapConsume(idx, tokenType); - if (!this.isRecording()) { - this.lastElementStack = [...this.elementStack, feature]; - this.nextTokenIndex = this.currIdx + 1; - } - } - subrule(idx, rule, feature, args) { - this.before(feature); - this.wrapper.wrapSubrule(idx, rule, args); - this.after(feature); - } - before(element) { - if (!this.isRecording()) { - this.elementStack.push(element); - } - } - after(element) { - if (!this.isRecording()) { - const index = this.elementStack.lastIndexOf(element); - if (index >= 0) { - this.elementStack.splice(index); - } - } - } - get currIdx() { - return this.wrapper.currIdx; - } -}; -var defaultConfig = { - recoveryEnabled: true, - nodeLocationTracking: "full", - skipValidations: true, - errorMessageProvider: new LangiumParserErrorMessageProvider() -}; -var ChevrotainWrapper = class extends EmbeddedActionsParser { - constructor(tokens, config) { - const useDefaultLookahead = config && "maxLookahead" in config; - super(tokens, Object.assign(Object.assign(Object.assign({}, defaultConfig), { lookaheadStrategy: useDefaultLookahead ? new LLkLookaheadStrategy({ maxLookahead: config.maxLookahead }) : new LLStarLookaheadStrategy() }), config)); - } - get IS_RECORDING() { - return this.RECORDING_PHASE; - } - DEFINE_RULE(name, impl) { - return this.RULE(name, impl); - } - wrapSelfAnalysis() { - this.performSelfAnalysis(); - } - wrapConsume(idx, tokenType) { - return this.consume(idx, tokenType); - } - wrapSubrule(idx, rule, args) { - return this.subrule(idx, rule, { - ARGS: [args] - }); - } - wrapOr(idx, choices) { - this.or(idx, choices); - } - wrapOption(idx, callback) { - this.option(idx, callback); - } - wrapMany(idx, callback) { - this.many(idx, callback); - } - wrapAtLeastOne(idx, callback) { - this.atLeastOne(idx, callback); - } -}; - -// node_modules/langium/lib/parser/parser-builder-base.js -function createParser(grammar, parser, tokens) { - const rules = /* @__PURE__ */ new Map(); - const parserContext = { - parser, - tokens, - rules, - ruleNames: /* @__PURE__ */ new Map() - }; - buildRules(parserContext, grammar); - return parser; -} -function buildRules(parserContext, grammar) { - const reachable = getAllReachableRules(grammar, false); - const parserRules = stream(grammar.rules).filter(isParserRule).filter((rule) => reachable.has(rule)); - for (const rule of parserRules) { - const ctx = Object.assign(Object.assign({}, parserContext), { consume: 1, optional: 1, subrule: 1, many: 1, or: 1 }); - ctx.rules.set(rule.name, parserContext.parser.rule(rule, buildElement(ctx, rule.definition))); - } -} -function buildElement(ctx, element, ignoreGuard = false) { - let method; - if (isKeyword(element)) { - method = buildKeyword(ctx, element); - } else if (isAction(element)) { - method = buildAction(ctx, element); - } else if (isAssignment(element)) { - method = buildElement(ctx, element.terminal); - } else if (isCrossReference(element)) { - method = buildCrossReference(ctx, element); - } else if (isRuleCall(element)) { - method = buildRuleCall(ctx, element); - } else if (isAlternatives(element)) { - method = buildAlternatives(ctx, element); - } else if (isUnorderedGroup(element)) { - method = buildUnorderedGroup(ctx, element); - } else if (isGroup(element)) { - method = buildGroup(ctx, element); - } else if (isEndOfFile(element)) { - const idx = ctx.consume++; - method = () => ctx.parser.consume(idx, EOF, element); - } else { - throw new ErrorWithLocation(element.$cstNode, `Unexpected element type: ${element.$type}`); - } - return wrap(ctx, ignoreGuard ? void 0 : getGuardCondition(element), method, element.cardinality); -} -function buildAction(ctx, action) { - const actionType = getTypeName(action); - return () => ctx.parser.action(actionType, action); -} -function buildRuleCall(ctx, ruleCall) { - const rule = ruleCall.rule.ref; - if (isParserRule(rule)) { - const idx = ctx.subrule++; - const predicate = ruleCall.arguments.length > 0 ? buildRuleCallPredicate(rule, ruleCall.arguments) : () => ({}); - return (args) => ctx.parser.subrule(idx, getRule(ctx, rule), ruleCall, predicate(args)); - } else if (isTerminalRule(rule)) { - const idx = ctx.consume++; - const method = getToken(ctx, rule.name); - return () => ctx.parser.consume(idx, method, ruleCall); - } else if (!rule) { - throw new ErrorWithLocation(ruleCall.$cstNode, `Undefined rule type: ${ruleCall.$type}`); - } else { - assertUnreachable(rule); - } -} -function buildRuleCallPredicate(rule, namedArgs) { - const predicates = namedArgs.map((e) => buildPredicate(e.value)); - return (args) => { - const ruleArgs = {}; - for (let i = 0; i < predicates.length; i++) { - const ruleTarget = rule.parameters[i]; - const predicate = predicates[i]; - ruleArgs[ruleTarget.name] = predicate(args); - } - return ruleArgs; - }; -} -function buildPredicate(condition) { - if (isDisjunction(condition)) { - const left = buildPredicate(condition.left); - const right = buildPredicate(condition.right); - return (args) => left(args) || right(args); - } else if (isConjunction(condition)) { - const left = buildPredicate(condition.left); - const right = buildPredicate(condition.right); - return (args) => left(args) && right(args); - } else if (isNegation(condition)) { - const value = buildPredicate(condition.value); - return (args) => !value(args); - } else if (isParameterReference(condition)) { - const name = condition.parameter.ref.name; - return (args) => args !== void 0 && args[name] === true; - } else if (isBooleanLiteral(condition)) { - const value = Boolean(condition.true); - return () => value; - } - assertUnreachable(condition); -} -function buildAlternatives(ctx, alternatives) { - if (alternatives.elements.length === 1) { - return buildElement(ctx, alternatives.elements[0]); - } else { - const methods = []; - for (const element of alternatives.elements) { - const predicatedMethod = { - // Since we handle the guard condition in the alternative already - // We can ignore the group guard condition inside - ALT: buildElement(ctx, element, true) - }; - const guard = getGuardCondition(element); - if (guard) { - predicatedMethod.GATE = buildPredicate(guard); - } - methods.push(predicatedMethod); - } - const idx = ctx.or++; - return (args) => ctx.parser.alternatives(idx, methods.map((method) => { - const alt = { - ALT: () => method.ALT(args) - }; - const gate = method.GATE; - if (gate) { - alt.GATE = () => gate(args); - } - return alt; - })); - } -} -function buildUnorderedGroup(ctx, group) { - if (group.elements.length === 1) { - return buildElement(ctx, group.elements[0]); - } - const methods = []; - for (const element of group.elements) { - const predicatedMethod = { - // Since we handle the guard condition in the alternative already - // We can ignore the group guard condition inside - ALT: buildElement(ctx, element, true) - }; - const guard = getGuardCondition(element); - if (guard) { - predicatedMethod.GATE = buildPredicate(guard); - } - methods.push(predicatedMethod); - } - const orIdx = ctx.or++; - const idFunc = (groupIdx, lParser) => { - const stackId = lParser.getRuleStack().join("-"); - return `uGroup_${groupIdx}_${stackId}`; - }; - const alternatives = (args) => ctx.parser.alternatives(orIdx, methods.map((method, idx) => { - const alt = { ALT: () => true }; - const parser = ctx.parser; - alt.ALT = () => { - method.ALT(args); - if (!parser.isRecording()) { - const key = idFunc(orIdx, parser); - if (!parser.unorderedGroups.get(key)) { - parser.unorderedGroups.set(key, []); - } - const groupState = parser.unorderedGroups.get(key); - if (typeof (groupState === null || groupState === void 0 ? void 0 : groupState[idx]) === "undefined") { - groupState[idx] = true; - } - } - }; - const gate = method.GATE; - if (gate) { - alt.GATE = () => gate(args); - } else { - alt.GATE = () => { - const trackedAlternatives = parser.unorderedGroups.get(idFunc(orIdx, parser)); - const allow = !(trackedAlternatives === null || trackedAlternatives === void 0 ? void 0 : trackedAlternatives[idx]); - return allow; - }; - } - return alt; - })); - const wrapped = wrap(ctx, getGuardCondition(group), alternatives, "*"); - return (args) => { - wrapped(args); - if (!ctx.parser.isRecording()) { - ctx.parser.unorderedGroups.delete(idFunc(orIdx, ctx.parser)); - } - }; -} -function buildGroup(ctx, group) { - const methods = group.elements.map((e) => buildElement(ctx, e)); - return (args) => methods.forEach((method) => method(args)); -} -function getGuardCondition(element) { - if (isGroup(element)) { - return element.guardCondition; - } - return void 0; -} -function buildCrossReference(ctx, crossRef, terminal = crossRef.terminal) { - if (!terminal) { - if (!crossRef.type.ref) { - throw new Error("Could not resolve reference to type: " + crossRef.type.$refText); - } - const assignment = findNameAssignment(crossRef.type.ref); - const assignTerminal = assignment === null || assignment === void 0 ? void 0 : assignment.terminal; - if (!assignTerminal) { - throw new Error("Could not find name assignment for type: " + getTypeName(crossRef.type.ref)); - } - return buildCrossReference(ctx, crossRef, assignTerminal); - } else if (isRuleCall(terminal) && isParserRule(terminal.rule.ref)) { - const idx = ctx.subrule++; - return (args) => ctx.parser.subrule(idx, getRule(ctx, terminal.rule.ref), crossRef, args); - } else if (isRuleCall(terminal) && isTerminalRule(terminal.rule.ref)) { - const idx = ctx.consume++; - const terminalRule = getToken(ctx, terminal.rule.ref.name); - return () => ctx.parser.consume(idx, terminalRule, crossRef); - } else if (isKeyword(terminal)) { - const idx = ctx.consume++; - const keyword = getToken(ctx, terminal.value); - return () => ctx.parser.consume(idx, keyword, crossRef); - } else { - throw new Error("Could not build cross reference parser"); - } -} -function buildKeyword(ctx, keyword) { - const idx = ctx.consume++; - const token = ctx.tokens[keyword.value]; - if (!token) { - throw new Error("Could not find token for keyword: " + keyword.value); - } - return () => ctx.parser.consume(idx, token, keyword); -} -function wrap(ctx, guard, method, cardinality) { - const gate = guard && buildPredicate(guard); - if (!cardinality) { - if (gate) { - const idx = ctx.or++; - return (args) => ctx.parser.alternatives(idx, [ - { - ALT: () => method(args), - GATE: () => gate(args) - }, - { - ALT: EMPTY_ALT(), - GATE: () => !gate(args) - } - ]); - } else { - return method; - } - } - if (cardinality === "*") { - const idx = ctx.many++; - return (args) => ctx.parser.many(idx, { - DEF: () => method(args), - GATE: gate ? () => gate(args) : void 0 - }); - } else if (cardinality === "+") { - const idx = ctx.many++; - if (gate) { - const orIdx = ctx.or++; - return (args) => ctx.parser.alternatives(orIdx, [ - { - ALT: () => ctx.parser.atLeastOne(idx, { - DEF: () => method(args) - }), - GATE: () => gate(args) - }, - { - ALT: EMPTY_ALT(), - GATE: () => !gate(args) - } - ]); - } else { - return (args) => ctx.parser.atLeastOne(idx, { - DEF: () => method(args) - }); - } - } else if (cardinality === "?") { - const idx = ctx.optional++; - return (args) => ctx.parser.optional(idx, { - DEF: () => method(args), - GATE: gate ? () => gate(args) : void 0 - }); - } else { - assertUnreachable(cardinality); - } -} -function getRule(ctx, element) { - const name = getRuleName(ctx, element); - const rule = ctx.rules.get(name); - if (!rule) - throw new Error(`Rule "${name}" not found."`); - return rule; -} -function getRuleName(ctx, element) { - if (isParserRule(element)) { - return element.name; - } else if (ctx.ruleNames.has(element)) { - return ctx.ruleNames.get(element); - } else { - let item = element; - let parent = item.$container; - let ruleName = element.$type; - while (!isParserRule(parent)) { - if (isGroup(parent) || isAlternatives(parent) || isUnorderedGroup(parent)) { - const index = parent.elements.indexOf(item); - ruleName = index.toString() + ":" + ruleName; - } - item = parent; - parent = parent.$container; - } - const rule = parent; - ruleName = rule.name + ":" + ruleName; - ctx.ruleNames.set(element, ruleName); - return ruleName; - } -} -function getToken(ctx, name) { - const token = ctx.tokens[name]; - if (!token) - throw new Error(`Token "${name}" not found."`); - return token; -} - -// node_modules/langium/lib/parser/completion-parser-builder.js -function createCompletionParser(services) { - const grammar = services.Grammar; - const lexer = services.parser.Lexer; - const parser = new LangiumCompletionParser(services); - createParser(grammar, parser, lexer.definition); - parser.finalize(); - return parser; -} - -// node_modules/langium/lib/parser/langium-parser-builder.js -function createLangiumParser(services) { - const parser = prepareLangiumParser(services); - parser.finalize(); - return parser; -} -function prepareLangiumParser(services) { - const grammar = services.Grammar; - const lexer = services.parser.Lexer; - const parser = new LangiumParser(services); - return createParser(grammar, parser, lexer.definition); -} - -// node_modules/langium/lib/parser/token-builder.js -var DefaultTokenBuilder = class { - buildTokens(grammar, options) { - const reachableRules = stream(getAllReachableRules(grammar, false)); - const terminalTokens = this.buildTerminalTokens(reachableRules); - const tokens = this.buildKeywordTokens(reachableRules, terminalTokens, options); - terminalTokens.forEach((terminalToken) => { - const pattern = terminalToken.PATTERN; - if (typeof pattern === "object" && pattern && "test" in pattern && isWhitespace(pattern)) { - tokens.unshift(terminalToken); - } else { - tokens.push(terminalToken); - } - }); - return tokens; - } - buildTerminalTokens(rules) { - return rules.filter(isTerminalRule).filter((e) => !e.fragment).map((terminal) => this.buildTerminalToken(terminal)).toArray(); - } - buildTerminalToken(terminal) { - const regex = terminalRegex(terminal); - const pattern = this.requiresCustomPattern(regex) ? this.regexPatternFunction(regex) : regex; - const tokenType = { - name: terminal.name, - PATTERN: pattern, - LINE_BREAKS: true - }; - if (terminal.hidden) { - tokenType.GROUP = isWhitespace(regex) ? Lexer.SKIPPED : "hidden"; - } - return tokenType; - } - requiresCustomPattern(regex) { - if (regex.flags.includes("u")) { - return true; - } else if (regex.source.includes("?<=") || regex.source.includes("? { - stickyRegex.lastIndex = offset; - const execResult = stickyRegex.exec(text); - return execResult; - }; - } - buildKeywordTokens(rules, terminalTokens, options) { - return rules.filter(isParserRule).flatMap((rule) => streamAllContents(rule).filter(isKeyword)).distinct((e) => e.value).toArray().sort((a2, b) => b.value.length - a2.value.length).map((keyword) => this.buildKeywordToken(keyword, terminalTokens, Boolean(options === null || options === void 0 ? void 0 : options.caseInsensitive))); - } - buildKeywordToken(keyword, terminalTokens, caseInsensitive) { - return { - name: keyword.value, - PATTERN: this.buildKeywordPattern(keyword, caseInsensitive), - LONGER_ALT: this.findLongerAlt(keyword, terminalTokens) - }; - } - buildKeywordPattern(keyword, caseInsensitive) { - return caseInsensitive ? new RegExp(getCaseInsensitivePattern(keyword.value)) : keyword.value; - } - findLongerAlt(keyword, terminalTokens) { - return terminalTokens.reduce((longerAlts, token) => { - const pattern = token === null || token === void 0 ? void 0 : token.PATTERN; - if ((pattern === null || pattern === void 0 ? void 0 : pattern.source) && partialMatches("^" + pattern.source + "$", keyword.value)) { - longerAlts.push(token); - } - return longerAlts; - }, []); - } -}; - -// node_modules/langium/lib/parser/value-converter.js -var DefaultValueConverter = class { - convert(input, cstNode) { - let feature = cstNode.grammarSource; - if (isCrossReference(feature)) { - feature = getCrossReferenceTerminal(feature); - } - if (isRuleCall(feature)) { - const rule = feature.rule.ref; - if (!rule) { - throw new Error("This cst node was not parsed by a rule."); - } - return this.runConverter(rule, input, cstNode); - } - return input; - } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - runConverter(rule, input, cstNode) { - var _a; - switch (rule.name.toUpperCase()) { - case "INT": - return ValueConverter.convertInt(input); - case "STRING": - return ValueConverter.convertString(input); - case "ID": - return ValueConverter.convertID(input); - } - switch ((_a = getRuleType(rule)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) { - case "number": - return ValueConverter.convertNumber(input); - case "boolean": - return ValueConverter.convertBoolean(input); - case "bigint": - return ValueConverter.convertBigint(input); - case "date": - return ValueConverter.convertDate(input); - default: - return input; - } - } -}; -var ValueConverter; -(function(ValueConverter2) { - function convertString(input) { - let result = ""; - for (let i = 1; i < input.length - 1; i++) { - const c = input.charAt(i); - if (c === "\\") { - const c1 = input.charAt(++i); - result += convertEscapeCharacter(c1); - } else { - result += c; - } - } - return result; - } - ValueConverter2.convertString = convertString; - function convertEscapeCharacter(char) { - switch (char) { - case "b": - return "\b"; - case "f": - return "\f"; - case "n": - return "\n"; - case "r": - return "\r"; - case "t": - return " "; - case "v": - return "\v"; - case "0": - return "\0"; - default: - return char; - } - } - function convertID(input) { - if (input.charAt(0) === "^") { - return input.substring(1); - } else { - return input; - } - } - ValueConverter2.convertID = convertID; - function convertInt(input) { - return parseInt(input); - } - ValueConverter2.convertInt = convertInt; - function convertBigint(input) { - return BigInt(input); - } - ValueConverter2.convertBigint = convertBigint; - function convertDate(input) { - return new Date(input); - } - ValueConverter2.convertDate = convertDate; - function convertNumber(input) { - return Number(input); - } - ValueConverter2.convertNumber = convertNumber; - function convertBoolean(input) { - return input.toLowerCase() === "true"; - } - ValueConverter2.convertBoolean = convertBoolean; -})(ValueConverter || (ValueConverter = {})); - -// node_modules/langium/lib/utils/cancellation.js -var cancellation_exports = {}; -__reExport(cancellation_exports, __toESM(require_cancellation(), 1)); - -// node_modules/langium/lib/utils/promise-utils.js -function delayNextTick() { - return new Promise((resolve) => { - if (typeof setImmediate === "undefined") { - setTimeout(resolve, 0); - } else { - setImmediate(resolve); - } - }); -} -var lastTick = 0; -var globalInterruptionPeriod = 10; -function startCancelableOperation() { - lastTick = Date.now(); - return new cancellation_exports.CancellationTokenSource(); -} -function setInterruptionPeriod(period) { - globalInterruptionPeriod = period; -} -var OperationCancelled = Symbol("OperationCancelled"); -function isOperationCancelled(err) { - return err === OperationCancelled; -} -async function interruptAndCheck(token) { - if (token === cancellation_exports.CancellationToken.None) { - return; - } - const current = Date.now(); - if (current - lastTick >= globalInterruptionPeriod) { - lastTick = current; - await delayNextTick(); - } - if (token.isCancellationRequested) { - throw OperationCancelled; - } -} -var Deferred = class { - constructor() { - this.promise = new Promise((resolve, reject2) => { - this.resolve = (arg) => { - resolve(arg); - return this; - }; - this.reject = (err) => { - reject2(err); - return this; - }; - }); - } -}; - -// node_modules/vscode-languageserver-textdocument/lib/esm/main.js -var FullTextDocument2 = class _FullTextDocument { - constructor(uri, languageId, version, content) { - this._uri = uri; - this._languageId = languageId; - this._version = version; - this._content = content; - this._lineOffsets = void 0; - } - get uri() { - return this._uri; - } - get languageId() { - return this._languageId; - } - get version() { - return this._version; - } - getText(range) { - if (range) { - const start = this.offsetAt(range.start); - const end = this.offsetAt(range.end); - return this._content.substring(start, end); - } - return this._content; - } - update(changes, version) { - for (let change of changes) { - if (_FullTextDocument.isIncremental(change)) { - const range = getWellformedRange(change.range); - const startOffset = this.offsetAt(range.start); - const endOffset = this.offsetAt(range.end); - this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); - const startLine = Math.max(range.start.line, 0); - const endLine = Math.max(range.end.line, 0); - let lineOffsets = this._lineOffsets; - const addedLineOffsets = computeLineOffsets(change.text, false, startOffset); - if (endLine - startLine === addedLineOffsets.length) { - for (let i = 0, len = addedLineOffsets.length; i < len; i++) { - lineOffsets[i + startLine + 1] = addedLineOffsets[i]; - } - } else { - if (addedLineOffsets.length < 1e4) { - lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets); - } else { - this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); - } - } - const diff = change.text.length - (endOffset - startOffset); - if (diff !== 0) { - for (let i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { - lineOffsets[i] = lineOffsets[i] + diff; - } - } - } else if (_FullTextDocument.isFull(change)) { - this._content = change.text; - this._lineOffsets = void 0; - } else { - throw new Error("Unknown change event received"); - } - } - this._version = version; - } - getLineOffsets() { - if (this._lineOffsets === void 0) { - this._lineOffsets = computeLineOffsets(this._content, true); - } - return this._lineOffsets; - } - positionAt(offset) { - offset = Math.max(Math.min(offset, this._content.length), 0); - let lineOffsets = this.getLineOffsets(); - let low = 0, high = lineOffsets.length; - if (high === 0) { - return { line: 0, character: offset }; - } - while (low < high) { - let mid = Math.floor((low + high) / 2); - if (lineOffsets[mid] > offset) { - high = mid; - } else { - low = mid + 1; - } - } - let line = low - 1; - return { line, character: offset - lineOffsets[line] }; - } - offsetAt(position) { - let lineOffsets = this.getLineOffsets(); - if (position.line >= lineOffsets.length) { - return this._content.length; - } else if (position.line < 0) { - return 0; - } - let lineOffset = lineOffsets[position.line]; - let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; - return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); - } - get lineCount() { - return this.getLineOffsets().length; - } - static isIncremental(event) { - let candidate = event; - return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); - } - static isFull(event) { - let candidate = event; - return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; - } -}; -var TextDocument2; -(function(TextDocument3) { - function create(uri, languageId, version, content) { - return new FullTextDocument2(uri, languageId, version, content); - } - TextDocument3.create = create; - function update(document, changes, version) { - if (document instanceof FullTextDocument2) { - document.update(changes, version); - return document; - } else { - throw new Error("TextDocument.update: document must be created by TextDocument.create"); - } - } - TextDocument3.update = update; - function applyEdits(document, edits) { - let text = document.getText(); - let sortedEdits = mergeSort(edits.map(getWellformedEdit), (a2, b) => { - let diff = a2.range.start.line - b.range.start.line; - if (diff === 0) { - return a2.range.start.character - b.range.start.character; - } - return diff; - }); - let lastModifiedOffset = 0; - const spans = []; - for (const e of sortedEdits) { - let startOffset = document.offsetAt(e.range.start); - if (startOffset < lastModifiedOffset) { - throw new Error("Overlapping edit"); - } else if (startOffset > lastModifiedOffset) { - spans.push(text.substring(lastModifiedOffset, startOffset)); - } - if (e.newText.length) { - spans.push(e.newText); - } - lastModifiedOffset = document.offsetAt(e.range.end); - } - spans.push(text.substr(lastModifiedOffset)); - return spans.join(""); - } - TextDocument3.applyEdits = applyEdits; -})(TextDocument2 || (TextDocument2 = {})); -function mergeSort(data, compare) { - if (data.length <= 1) { - return data; - } - const p = data.length / 2 | 0; - const left = data.slice(0, p); - const right = data.slice(p); - mergeSort(left, compare); - mergeSort(right, compare); - let leftIdx = 0; - let rightIdx = 0; - let i = 0; - while (leftIdx < left.length && rightIdx < right.length) { - let ret = compare(left[leftIdx], right[rightIdx]); - if (ret <= 0) { - data[i++] = left[leftIdx++]; - } else { - data[i++] = right[rightIdx++]; - } - } - while (leftIdx < left.length) { - data[i++] = left[leftIdx++]; - } - while (rightIdx < right.length) { - data[i++] = right[rightIdx++]; - } - return data; -} -function computeLineOffsets(text, isAtLineStart, textOffset = 0) { - const result = isAtLineStart ? [textOffset] : []; - for (let i = 0; i < text.length; i++) { - let ch = text.charCodeAt(i); - if (ch === 13 || ch === 10) { - if (ch === 13 && i + 1 < text.length && text.charCodeAt(i + 1) === 10) { - i++; - } - result.push(textOffset + i + 1); - } - } - return result; -} -function getWellformedRange(range) { - const start = range.start; - const end = range.end; - if (start.line > end.line || start.line === end.line && start.character > end.character) { - return { start: end, end: start }; - } - return range; -} -function getWellformedEdit(textEdit) { - const range = getWellformedRange(textEdit.range); - if (range !== textEdit.range) { - return { newText: textEdit.newText, range }; - } - return textEdit; -} - -// node_modules/langium/lib/workspace/documents.js -var DocumentState; -(function(DocumentState2) { - DocumentState2[DocumentState2["Changed"] = 0] = "Changed"; - DocumentState2[DocumentState2["Parsed"] = 1] = "Parsed"; - DocumentState2[DocumentState2["IndexedContent"] = 2] = "IndexedContent"; - DocumentState2[DocumentState2["ComputedScopes"] = 3] = "ComputedScopes"; - DocumentState2[DocumentState2["Linked"] = 4] = "Linked"; - DocumentState2[DocumentState2["IndexedReferences"] = 5] = "IndexedReferences"; - DocumentState2[DocumentState2["Validated"] = 6] = "Validated"; -})(DocumentState || (DocumentState = {})); -var DefaultLangiumDocumentFactory = class { - constructor(services) { - this.serviceRegistry = services.ServiceRegistry; - this.textDocuments = services.workspace.TextDocuments; - this.fileSystemProvider = services.workspace.FileSystemProvider; - } - async fromUri(uri, cancellationToken = cancellation_exports.CancellationToken.None) { - const content = await this.fileSystemProvider.readFile(uri); - return this.createAsync(uri, content, cancellationToken); - } - fromTextDocument(textDocument, uri, cancellationToken) { - uri = uri !== null && uri !== void 0 ? uri : URI.parse(textDocument.uri); - if (cancellationToken) { - return this.createAsync(uri, textDocument, cancellationToken); - } else { - return this.create(uri, textDocument); - } - } - fromString(text, uri, cancellationToken) { - if (cancellationToken) { - return this.createAsync(uri, text, cancellationToken); - } else { - return this.create(uri, text); - } - } - fromModel(model, uri) { - return this.create(uri, { $model: model }); - } - create(uri, content) { - if (typeof content === "string") { - const parseResult = this.parse(uri, content); - return this.createLangiumDocument(parseResult, uri, void 0, content); - } else if ("$model" in content) { - const parseResult = { value: content.$model, parserErrors: [], lexerErrors: [] }; - return this.createLangiumDocument(parseResult, uri); - } else { - const parseResult = this.parse(uri, content.getText()); - return this.createLangiumDocument(parseResult, uri, content); - } - } - async createAsync(uri, content, cancelToken) { - if (typeof content === "string") { - const parseResult = await this.parseAsync(uri, content, cancelToken); - return this.createLangiumDocument(parseResult, uri, void 0, content); - } else { - const parseResult = await this.parseAsync(uri, content.getText(), cancelToken); - return this.createLangiumDocument(parseResult, uri, content); - } - } - /** - * Create a LangiumDocument from a given parse result. - * - * A TextDocument is created on demand if it is not provided as argument here. Usually this - * should not be necessary because the main purpose of the TextDocument is to convert between - * text ranges and offsets, which is done solely in LSP request handling. - * - * With the introduction of {@link update} below this method is supposed to be mainly called - * during workspace initialization and on addition/recognition of new files, while changes in - * existing documents are processed via {@link update}. - */ - createLangiumDocument(parseResult, uri, textDocument, text) { - let document; - if (textDocument) { - document = { - parseResult, - uri, - state: DocumentState.Parsed, - references: [], - textDocument - }; - } else { - const textDocumentGetter = this.createTextDocumentGetter(uri, text); - document = { - parseResult, - uri, - state: DocumentState.Parsed, - references: [], - get textDocument() { - return textDocumentGetter(); - } - }; - } - parseResult.value.$document = document; - return document; - } - async update(document, cancellationToken) { - var _a, _b; - const oldText = (_a = document.parseResult.value.$cstNode) === null || _a === void 0 ? void 0 : _a.root.fullText; - const textDocument = (_b = this.textDocuments) === null || _b === void 0 ? void 0 : _b.get(document.uri.toString()); - const text = textDocument ? textDocument.getText() : await this.fileSystemProvider.readFile(document.uri); - if (textDocument) { - Object.defineProperty(document, "textDocument", { - value: textDocument - }); - } else { - const textDocumentGetter = this.createTextDocumentGetter(document.uri, text); - Object.defineProperty(document, "textDocument", { - get: textDocumentGetter - }); - } - if (oldText !== text) { - document.parseResult = await this.parseAsync(document.uri, text, cancellationToken); - document.parseResult.value.$document = document; - } - document.state = DocumentState.Parsed; - return document; - } - parse(uri, text) { - const services = this.serviceRegistry.getServices(uri); - return services.parser.LangiumParser.parse(text); - } - parseAsync(uri, text, cancellationToken) { - const services = this.serviceRegistry.getServices(uri); - return services.parser.AsyncParser.parse(text, cancellationToken); - } - createTextDocumentGetter(uri, text) { - const serviceRegistry = this.serviceRegistry; - let textDoc = void 0; - return () => { - return textDoc !== null && textDoc !== void 0 ? textDoc : textDoc = TextDocument2.create(uri.toString(), serviceRegistry.getServices(uri).LanguageMetaData.languageId, 0, text !== null && text !== void 0 ? text : ""); - }; - } -}; -var DefaultLangiumDocuments = class { - constructor(services) { - this.documentMap = /* @__PURE__ */ new Map(); - this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory; - } - get all() { - return stream(this.documentMap.values()); - } - addDocument(document) { - const uriString = document.uri.toString(); - if (this.documentMap.has(uriString)) { - throw new Error(`A document with the URI '${uriString}' is already present.`); - } - this.documentMap.set(uriString, document); - } - getDocument(uri) { - const uriString = uri.toString(); - return this.documentMap.get(uriString); - } - async getOrCreateDocument(uri, cancellationToken) { - let document = this.getDocument(uri); - if (document) { - return document; - } - document = await this.langiumDocumentFactory.fromUri(uri, cancellationToken); - this.addDocument(document); - return document; - } - createDocument(uri, text, cancellationToken) { - if (cancellationToken) { - return this.langiumDocumentFactory.fromString(text, uri, cancellationToken).then((document) => { - this.addDocument(document); - return document; - }); - } else { - const document = this.langiumDocumentFactory.fromString(text, uri); - this.addDocument(document); - return document; - } - } - hasDocument(uri) { - return this.documentMap.has(uri.toString()); - } - invalidateDocument(uri) { - const uriString = uri.toString(); - const langiumDoc = this.documentMap.get(uriString); - if (langiumDoc) { - langiumDoc.state = DocumentState.Changed; - langiumDoc.precomputedScopes = void 0; - langiumDoc.references = []; - langiumDoc.diagnostics = void 0; - } - return langiumDoc; - } - deleteDocument(uri) { - const uriString = uri.toString(); - const langiumDoc = this.documentMap.get(uriString); - if (langiumDoc) { - langiumDoc.state = DocumentState.Changed; - this.documentMap.delete(uriString); - } - return langiumDoc; - } -}; - -// node_modules/langium/lib/references/linker.js -var DefaultLinker = class { - constructor(services) { - this.reflection = services.shared.AstReflection; - this.langiumDocuments = () => services.shared.workspace.LangiumDocuments; - this.scopeProvider = services.references.ScopeProvider; - this.astNodeLocator = services.workspace.AstNodeLocator; - } - async link(document, cancelToken = cancellation_exports.CancellationToken.None) { - for (const node of streamAst(document.parseResult.value)) { - await interruptAndCheck(cancelToken); - streamReferences(node).forEach((ref) => this.doLink(ref, document)); - } - } - doLink(refInfo, document) { - const ref = refInfo.reference; - if (ref._ref === void 0) { - try { - const description = this.getCandidate(refInfo); - if (isLinkingError(description)) { - ref._ref = description; - } else { - ref._nodeDescription = description; - if (this.langiumDocuments().hasDocument(description.documentUri)) { - const linkedNode = this.loadAstNode(description); - ref._ref = linkedNode !== null && linkedNode !== void 0 ? linkedNode : this.createLinkingError(refInfo, description); - } - } - } catch (err) { - ref._ref = Object.assign(Object.assign({}, refInfo), { message: `An error occurred while resolving reference to '${ref.$refText}': ${err}` }); - } - } - document.references.push(ref); - } - unlink(document) { - for (const ref of document.references) { - delete ref._ref; - delete ref._nodeDescription; - } - document.references = []; - } - getCandidate(refInfo) { - const scope = this.scopeProvider.getScope(refInfo); - const description = scope.getElement(refInfo.reference.$refText); - return description !== null && description !== void 0 ? description : this.createLinkingError(refInfo); - } - buildReference(node, property2, refNode, refText) { - const linker = this; - const reference = { - $refNode: refNode, - $refText: refText, - get ref() { - var _a; - if (isAstNode(this._ref)) { - return this._ref; - } else if (isAstNodeDescription(this._nodeDescription)) { - const linkedNode = linker.loadAstNode(this._nodeDescription); - this._ref = linkedNode !== null && linkedNode !== void 0 ? linkedNode : linker.createLinkingError({ reference, container: node, property: property2 }, this._nodeDescription); - } else if (this._ref === void 0) { - const refData = linker.getLinkedNode({ reference, container: node, property: property2 }); - if (refData.error && getDocument(node).state < DocumentState.ComputedScopes) { - return void 0; - } - this._ref = (_a = refData.node) !== null && _a !== void 0 ? _a : refData.error; - this._nodeDescription = refData.descr; - } - return isAstNode(this._ref) ? this._ref : void 0; - }, - get $nodeDescription() { - return this._nodeDescription; - }, - get error() { - return isLinkingError(this._ref) ? this._ref : void 0; - } - }; - return reference; - } - getLinkedNode(refInfo) { - try { - const description = this.getCandidate(refInfo); - if (isLinkingError(description)) { - return { error: description }; - } - const linkedNode = this.loadAstNode(description); - if (linkedNode) { - return { node: linkedNode, descr: description }; - } else { - return { - descr: description, - error: this.createLinkingError(refInfo, description) - }; - } - } catch (err) { - return { - error: Object.assign(Object.assign({}, refInfo), { message: `An error occurred while resolving reference to '${refInfo.reference.$refText}': ${err}` }) - }; - } - } - loadAstNode(nodeDescription) { - if (nodeDescription.node) { - return nodeDescription.node; - } - const doc = this.langiumDocuments().getDocument(nodeDescription.documentUri); - if (!doc) { - return void 0; - } - return this.astNodeLocator.getAstNode(doc.parseResult.value, nodeDescription.path); - } - createLinkingError(refInfo, targetDescription) { - const document = getDocument(refInfo.container); - if (document.state < DocumentState.ComputedScopes) { - console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document.uri}).`); - } - const referenceType = this.reflection.getReferenceType(refInfo); - return Object.assign(Object.assign({}, refInfo), { message: `Could not resolve reference to ${referenceType} named '${refInfo.reference.$refText}'.`, targetDescription }); - } -}; - -// node_modules/langium/lib/references/name-provider.js -function isNamed(node) { - return typeof node.name === "string"; -} -var DefaultNameProvider = class { - getName(node) { - if (isNamed(node)) { - return node.name; - } - return void 0; - } - getNameNode(node) { - return findNodeForProperty(node.$cstNode, "name"); - } -}; - -// node_modules/langium/lib/references/references.js -var DefaultReferences = class { - constructor(services) { - this.nameProvider = services.references.NameProvider; - this.index = services.shared.workspace.IndexManager; - this.nodeLocator = services.workspace.AstNodeLocator; - } - findDeclaration(sourceCstNode) { - if (sourceCstNode) { - const assignment = findAssignment(sourceCstNode); - const nodeElem = sourceCstNode.astNode; - if (assignment && nodeElem) { - const reference = nodeElem[assignment.feature]; - if (isReference(reference)) { - return reference.ref; - } else if (Array.isArray(reference)) { - for (const ref of reference) { - if (isReference(ref) && ref.$refNode && ref.$refNode.offset <= sourceCstNode.offset && ref.$refNode.end >= sourceCstNode.end) { - return ref.ref; - } - } - } - } - if (nodeElem) { - const nameNode = this.nameProvider.getNameNode(nodeElem); - if (nameNode && (nameNode === sourceCstNode || isChildNode(sourceCstNode, nameNode))) { - return nodeElem; - } - } - } - return void 0; - } - findDeclarationNode(sourceCstNode) { - const astNode = this.findDeclaration(sourceCstNode); - if (astNode === null || astNode === void 0 ? void 0 : astNode.$cstNode) { - const targetNode = this.nameProvider.getNameNode(astNode); - return targetNode !== null && targetNode !== void 0 ? targetNode : astNode.$cstNode; - } - return void 0; - } - findReferences(targetNode, options) { - const refs = []; - if (options.includeDeclaration) { - const ref = this.getReferenceToSelf(targetNode); - if (ref) { - refs.push(ref); - } - } - let indexReferences = this.index.findAllReferences(targetNode, this.nodeLocator.getAstNodePath(targetNode)); - if (options.documentUri) { - indexReferences = indexReferences.filter((ref) => UriUtils.equals(ref.sourceUri, options.documentUri)); - } - refs.push(...indexReferences); - return stream(refs); - } - getReferenceToSelf(targetNode) { - const nameNode = this.nameProvider.getNameNode(targetNode); - if (nameNode) { - const doc = getDocument(targetNode); - const path = this.nodeLocator.getAstNodePath(targetNode); - return { - sourceUri: doc.uri, - sourcePath: path, - targetUri: doc.uri, - targetPath: path, - segment: toDocumentSegment(nameNode), - local: true - }; - } - return void 0; - } -}; - -// node_modules/langium/lib/utils/collections.js -var MultiMap = class { - constructor(elements) { - this.map = /* @__PURE__ */ new Map(); - if (elements) { - for (const [key, value] of elements) { - this.add(key, value); - } - } - } - /** - * The total number of values in the multimap. - */ - get size() { - return Reduction.sum(stream(this.map.values()).map((a2) => a2.length)); - } - /** - * Clear all entries in the multimap. - */ - clear() { - this.map.clear(); - } - /** - * Operates differently depending on whether a `value` is given: - * * With a value, this method deletes the specific key / value pair from the multimap. - * * Without a value, all values associated with the given key are deleted. - * - * @returns `true` if a value existed and has been removed, or `false` if the specified - * key / value does not exist. - */ - delete(key, value) { - if (value === void 0) { - return this.map.delete(key); - } else { - const values2 = this.map.get(key); - if (values2) { - const index = values2.indexOf(value); - if (index >= 0) { - if (values2.length === 1) { - this.map.delete(key); - } else { - values2.splice(index, 1); - } - return true; - } - } - return false; - } - } - /** - * Returns an array of all values associated with the given key. If no value exists, - * an empty array is returned. - * - * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a - * value and `delete` to remove a value from the multimap. - */ - get(key) { - var _a; - return (_a = this.map.get(key)) !== null && _a !== void 0 ? _a : []; - } - /** - * Operates differently depending on whether a `value` is given: - * * With a value, this method returns `true` if the specific key / value pair is present in the multimap. - * * Without a value, this method returns `true` if the given key is present in the multimap. - */ - has(key, value) { - if (value === void 0) { - return this.map.has(key); - } else { - const values2 = this.map.get(key); - if (values2) { - return values2.indexOf(value) >= 0; - } - return false; - } - } - /** - * Add the given key / value pair to the multimap. - */ - add(key, value) { - if (this.map.has(key)) { - this.map.get(key).push(value); - } else { - this.map.set(key, [value]); - } - return this; - } - /** - * Add the given set of key / value pairs to the multimap. - */ - addAll(key, values2) { - if (this.map.has(key)) { - this.map.get(key).push(...values2); - } else { - this.map.set(key, Array.from(values2)); - } - return this; - } - /** - * Invokes the given callback function for every key / value pair in the multimap. - */ - forEach(callbackfn) { - this.map.forEach((array, key) => array.forEach((value) => callbackfn(value, key, this))); - } - /** - * Returns an iterator of key, value pairs for every entry in the map. - */ - [Symbol.iterator]() { - return this.entries().iterator(); - } - /** - * Returns a stream of key, value pairs for every entry in the map. - */ - entries() { - return stream(this.map.entries()).flatMap(([key, array]) => array.map((value) => [key, value])); - } - /** - * Returns a stream of keys in the map. - */ - keys() { - return stream(this.map.keys()); - } - /** - * Returns a stream of values in the map. - */ - values() { - return stream(this.map.values()).flat(); - } - /** - * Returns a stream of key, value set pairs for every key in the map. - */ - entriesGroupedByKey() { - return stream(this.map.entries()); - } -}; -var BiMap = class { - get size() { - return this.map.size; - } - constructor(elements) { - this.map = /* @__PURE__ */ new Map(); - this.inverse = /* @__PURE__ */ new Map(); - if (elements) { - for (const [key, value] of elements) { - this.set(key, value); - } - } - } - clear() { - this.map.clear(); - this.inverse.clear(); - } - set(key, value) { - this.map.set(key, value); - this.inverse.set(value, key); - return this; - } - get(key) { - return this.map.get(key); - } - getKey(value) { - return this.inverse.get(value); - } - delete(key) { - const value = this.map.get(key); - if (value !== void 0) { - this.map.delete(key); - this.inverse.delete(value); - return true; - } - return false; - } -}; - -// node_modules/langium/lib/references/scope-computation.js -var DefaultScopeComputation = class { - constructor(services) { - this.nameProvider = services.references.NameProvider; - this.descriptions = services.workspace.AstNodeDescriptionProvider; - } - async computeExports(document, cancelToken = cancellation_exports.CancellationToken.None) { - return this.computeExportsForNode(document.parseResult.value, document, void 0, cancelToken); - } - /** - * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children. - * The list of children to be considered is determined by the function parameter {@link children}. - * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported. - * - * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list. - * @param document The document containing the AST node to be exported. - * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}. - * @param cancelToken Indicates when to cancel the current operation. - * @throws `OperationCanceled` if a user action occurs during execution. - * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index. - */ - async computeExportsForNode(parentNode, document, children = streamContents, cancelToken = cancellation_exports.CancellationToken.None) { - const exports2 = []; - this.exportNode(parentNode, exports2, document); - for (const node of children(parentNode)) { - await interruptAndCheck(cancelToken); - this.exportNode(node, exports2, document); - } - return exports2; - } - /** - * Add a single node to the list of exports if it has a name. Override this method to change how - * symbols are exported, e.g. by modifying their exported name. - */ - exportNode(node, exports2, document) { - const name = this.nameProvider.getName(node); - if (name) { - exports2.push(this.descriptions.createDescription(node, name, document)); - } - } - async computeLocalScopes(document, cancelToken = cancellation_exports.CancellationToken.None) { - const rootNode = document.parseResult.value; - const scopes = new MultiMap(); - for (const node of streamAllContents(rootNode)) { - await interruptAndCheck(cancelToken); - this.processNode(node, document, scopes); - } - return scopes; - } - /** - * Process a single node during scopes computation. The default implementation makes the node visible - * in the subtree of its container (if the node has a name). Override this method to change this, - * e.g. by increasing the visibility to a higher level in the AST. - */ - processNode(node, document, scopes) { - const container = node.$container; - if (container) { - const name = this.nameProvider.getName(node); - if (name) { - scopes.add(container, this.descriptions.createDescription(node, name, document)); - } - } - } -}; - -// node_modules/langium/lib/references/scope.js -var StreamScope = class { - constructor(elements, outerScope, options) { - var _a; - this.elements = elements; - this.outerScope = outerScope; - this.caseInsensitive = (_a = options === null || options === void 0 ? void 0 : options.caseInsensitive) !== null && _a !== void 0 ? _a : false; - } - getAllElements() { - if (this.outerScope) { - return this.elements.concat(this.outerScope.getAllElements()); - } else { - return this.elements; - } - } - getElement(name) { - const local = this.caseInsensitive ? this.elements.find((e) => e.name.toLowerCase() === name.toLowerCase()) : this.elements.find((e) => e.name === name); - if (local) { - return local; - } - if (this.outerScope) { - return this.outerScope.getElement(name); - } - return void 0; - } -}; -var MapScope = class { - constructor(elements, outerScope, options) { - var _a; - this.elements = /* @__PURE__ */ new Map(); - this.caseInsensitive = (_a = options === null || options === void 0 ? void 0 : options.caseInsensitive) !== null && _a !== void 0 ? _a : false; - for (const element of elements) { - const name = this.caseInsensitive ? element.name.toLowerCase() : element.name; - this.elements.set(name, element); - } - this.outerScope = outerScope; - } - getElement(name) { - const localName = this.caseInsensitive ? name.toLowerCase() : name; - const local = this.elements.get(localName); - if (local) { - return local; - } - if (this.outerScope) { - return this.outerScope.getElement(name); - } - return void 0; - } - getAllElements() { - let elementStream = stream(this.elements.values()); - if (this.outerScope) { - elementStream = elementStream.concat(this.outerScope.getAllElements()); - } - return elementStream; - } -}; -var EMPTY_SCOPE = { - getElement() { - return void 0; - }, - getAllElements() { - return EMPTY_STREAM; - } -}; - -// node_modules/langium/lib/utils/caching.js -var DisposableCache = class { - constructor() { - this.toDispose = []; - this.isDisposed = false; - } - onDispose(disposable) { - this.toDispose.push(disposable); - } - dispose() { - this.throwIfDisposed(); - this.clear(); - this.isDisposed = true; - this.toDispose.forEach((disposable) => disposable.dispose()); - } - throwIfDisposed() { - if (this.isDisposed) { - throw new Error("This cache has already been disposed"); - } - } -}; -var SimpleCache = class extends DisposableCache { - constructor() { - super(...arguments); - this.cache = /* @__PURE__ */ new Map(); - } - has(key) { - this.throwIfDisposed(); - return this.cache.has(key); - } - set(key, value) { - this.throwIfDisposed(); - this.cache.set(key, value); - } - get(key, provider) { - this.throwIfDisposed(); - if (this.cache.has(key)) { - return this.cache.get(key); - } else if (provider) { - const value = provider(); - this.cache.set(key, value); - return value; - } else { - return void 0; - } - } - delete(key) { - this.throwIfDisposed(); - return this.cache.delete(key); - } - clear() { - this.throwIfDisposed(); - this.cache.clear(); - } -}; -var ContextCache = class extends DisposableCache { - constructor(converter) { - super(); - this.cache = /* @__PURE__ */ new Map(); - this.converter = converter !== null && converter !== void 0 ? converter : (value) => value; - } - has(contextKey, key) { - this.throwIfDisposed(); - return this.cacheForContext(contextKey).has(key); - } - set(contextKey, key, value) { - this.throwIfDisposed(); - this.cacheForContext(contextKey).set(key, value); - } - get(contextKey, key, provider) { - this.throwIfDisposed(); - const contextCache = this.cacheForContext(contextKey); - if (contextCache.has(key)) { - return contextCache.get(key); - } else if (provider) { - const value = provider(); - contextCache.set(key, value); - return value; - } else { - return void 0; - } - } - delete(contextKey, key) { - this.throwIfDisposed(); - return this.cacheForContext(contextKey).delete(key); - } - clear(contextKey) { - this.throwIfDisposed(); - if (contextKey) { - const mapKey = this.converter(contextKey); - this.cache.delete(mapKey); - } else { - this.cache.clear(); - } - } - cacheForContext(contextKey) { - const mapKey = this.converter(contextKey); - let documentCache = this.cache.get(mapKey); - if (!documentCache) { - documentCache = /* @__PURE__ */ new Map(); - this.cache.set(mapKey, documentCache); - } - return documentCache; - } -}; -var DocumentCache = class extends ContextCache { - constructor(sharedServices) { - super((uri) => uri.toString()); - this.onDispose(sharedServices.workspace.DocumentBuilder.onUpdate((changed, deleted) => { - const allUris = changed.concat(deleted); - for (const uri of allUris) { - this.clear(uri); - } - })); - } -}; -var WorkspaceCache = class extends SimpleCache { - constructor(sharedServices) { - super(); - this.onDispose(sharedServices.workspace.DocumentBuilder.onUpdate(() => { - this.clear(); - })); - } -}; - -// node_modules/langium/lib/references/scope-provider.js -var DefaultScopeProvider = class { - constructor(services) { - this.reflection = services.shared.AstReflection; - this.nameProvider = services.references.NameProvider; - this.descriptions = services.workspace.AstNodeDescriptionProvider; - this.indexManager = services.shared.workspace.IndexManager; - this.globalScopeCache = new WorkspaceCache(services.shared); - } - getScope(context) { - const scopes = []; - const referenceType = this.reflection.getReferenceType(context); - const precomputed = getDocument(context.container).precomputedScopes; - if (precomputed) { - let currentNode = context.container; - do { - const allDescriptions = precomputed.get(currentNode); - if (allDescriptions.length > 0) { - scopes.push(stream(allDescriptions).filter((desc) => this.reflection.isSubtype(desc.type, referenceType))); - } - currentNode = currentNode.$container; - } while (currentNode); - } - let result = this.getGlobalScope(referenceType, context); - for (let i = scopes.length - 1; i >= 0; i--) { - result = this.createScope(scopes[i], result); - } - return result; - } - /** - * Create a scope for the given collection of AST node descriptions. - */ - createScope(elements, outerScope, options) { - return new StreamScope(stream(elements), outerScope, options); - } - /** - * Create a scope for the given collection of AST nodes, which need to be transformed into respective - * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services. - */ - createScopeForNodes(elements, outerScope, options) { - const s = stream(elements).map((e) => { - const name = this.nameProvider.getName(e); - if (name) { - return this.descriptions.createDescription(e, name); - } - return void 0; - }).nonNullable(); - return new StreamScope(s, outerScope, options); - } - /** - * Create a global scope filtered for the given reference type. - */ - getGlobalScope(referenceType, _context) { - return this.globalScopeCache.get(referenceType, () => new MapScope(this.indexManager.allElements(referenceType))); - } -}; - -// node_modules/langium/lib/serializer/json-serializer.js -function isAstNodeWithComment(node) { - return typeof node.$comment === "string"; -} -function isIntermediateReference(obj) { - return typeof obj === "object" && !!obj && ("$ref" in obj || "$error" in obj); -} -var DefaultJsonSerializer = class { - constructor(services) { - this.ignoreProperties = /* @__PURE__ */ new Set(["$container", "$containerProperty", "$containerIndex", "$document", "$cstNode"]); - this.langiumDocuments = services.shared.workspace.LangiumDocuments; - this.astNodeLocator = services.workspace.AstNodeLocator; - this.nameProvider = services.references.NameProvider; - this.commentProvider = services.documentation.CommentProvider; - } - serialize(node, options = {}) { - const specificReplacer = options === null || options === void 0 ? void 0 : options.replacer; - const defaultReplacer = (key, value) => this.replacer(key, value, options); - const replacer = specificReplacer ? (key, value) => specificReplacer(key, value, defaultReplacer) : defaultReplacer; - try { - this.currentDocument = getDocument(node); - return JSON.stringify(node, replacer, options === null || options === void 0 ? void 0 : options.space); - } finally { - this.currentDocument = void 0; - } - } - deserialize(content, options = {}) { - const root2 = JSON.parse(content); - this.linkNode(root2, root2, options); - return root2; - } - replacer(key, value, { refText, sourceText, textRegions, comments, uriConverter }) { - var _a, _b, _c, _d; - if (this.ignoreProperties.has(key)) { - return void 0; - } else if (isReference(value)) { - const refValue = value.ref; - const $refText = refText ? value.$refText : void 0; - if (refValue) { - const targetDocument = getDocument(refValue); - let targetUri = ""; - if (this.currentDocument && this.currentDocument !== targetDocument) { - if (uriConverter) { - targetUri = uriConverter(targetDocument.uri, value); - } else { - targetUri = targetDocument.uri.toString(); - } - } - const targetPath = this.astNodeLocator.getAstNodePath(refValue); - return { - $ref: `${targetUri}#${targetPath}`, - $refText - }; - } else { - return { - $error: (_b = (_a = value.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Could not resolve reference", - $refText - }; - } - } else if (isAstNode(value)) { - let astNode = void 0; - if (textRegions) { - astNode = this.addAstNodeRegionWithAssignmentsTo(Object.assign({}, value)); - if ((!key || value.$document) && (astNode === null || astNode === void 0 ? void 0 : astNode.$textRegion)) { - astNode.$textRegion.documentURI = (_c = this.currentDocument) === null || _c === void 0 ? void 0 : _c.uri.toString(); - } - } - if (sourceText && !key) { - astNode !== null && astNode !== void 0 ? astNode : astNode = Object.assign({}, value); - astNode.$sourceText = (_d = value.$cstNode) === null || _d === void 0 ? void 0 : _d.text; - } - if (comments) { - astNode !== null && astNode !== void 0 ? astNode : astNode = Object.assign({}, value); - const comment = this.commentProvider.getComment(value); - if (comment) { - astNode.$comment = comment.replace(/\r/g, ""); - } - } - return astNode !== null && astNode !== void 0 ? astNode : value; - } else { - return value; - } - } - addAstNodeRegionWithAssignmentsTo(node) { - const createDocumentSegment = (cstNode) => ({ - offset: cstNode.offset, - end: cstNode.end, - length: cstNode.length, - range: cstNode.range - }); - if (node.$cstNode) { - const textRegion = node.$textRegion = createDocumentSegment(node.$cstNode); - const assignments = textRegion.assignments = {}; - Object.keys(node).filter((key) => !key.startsWith("$")).forEach((key) => { - const propertyAssignments = findNodesForProperty(node.$cstNode, key).map(createDocumentSegment); - if (propertyAssignments.length !== 0) { - assignments[key] = propertyAssignments; - } - }); - return node; - } - return void 0; - } - linkNode(node, root2, options, container, containerProperty, containerIndex) { - for (const [propertyName, item] of Object.entries(node)) { - if (Array.isArray(item)) { - for (let index = 0; index < item.length; index++) { - const element = item[index]; - if (isIntermediateReference(element)) { - item[index] = this.reviveReference(node, propertyName, root2, element, options); - } else if (isAstNode(element)) { - this.linkNode(element, root2, options, node, propertyName, index); - } - } - } else if (isIntermediateReference(item)) { - node[propertyName] = this.reviveReference(node, propertyName, root2, item, options); - } else if (isAstNode(item)) { - this.linkNode(item, root2, options, node, propertyName); - } - } - const mutable = node; - mutable.$container = container; - mutable.$containerProperty = containerProperty; - mutable.$containerIndex = containerIndex; - } - reviveReference(container, property2, root2, reference, options) { - let refText = reference.$refText; - let error = reference.$error; - if (reference.$ref) { - const ref = this.getRefNode(root2, reference.$ref, options.uriConverter); - if (isAstNode(ref)) { - if (!refText) { - refText = this.nameProvider.getName(ref); - } - return { - $refText: refText !== null && refText !== void 0 ? refText : "", - ref - }; - } else { - error = ref; - } - } - if (error) { - const ref = { - $refText: refText !== null && refText !== void 0 ? refText : "" - }; - ref.error = { - container, - property: property2, - message: error, - reference: ref - }; - return ref; - } else { - return void 0; - } - } - getRefNode(root2, uri, uriConverter) { - try { - const fragmentIndex = uri.indexOf("#"); - if (fragmentIndex === 0) { - const node2 = this.astNodeLocator.getAstNode(root2, uri.substring(1)); - if (!node2) { - return "Could not resolve path: " + uri; - } - return node2; - } - if (fragmentIndex < 0) { - const documentUri2 = uriConverter ? uriConverter(uri) : URI.parse(uri); - const document2 = this.langiumDocuments.getDocument(documentUri2); - if (!document2) { - return "Could not find document for URI: " + uri; - } - return document2.parseResult.value; - } - const documentUri = uriConverter ? uriConverter(uri.substring(0, fragmentIndex)) : URI.parse(uri.substring(0, fragmentIndex)); - const document = this.langiumDocuments.getDocument(documentUri); - if (!document) { - return "Could not find document for URI: " + uri; - } - if (fragmentIndex === uri.length - 1) { - return document.parseResult.value; - } - const node = this.astNodeLocator.getAstNode(document.parseResult.value, uri.substring(fragmentIndex + 1)); - if (!node) { - return "Could not resolve URI: " + uri; - } - return node; - } catch (err) { - return String(err); - } - } -}; - -// node_modules/langium/lib/service-registry.js -var DefaultServiceRegistry = class { - register(language) { - if (!this.singleton && !this.map) { - this.singleton = language; - return; - } - if (!this.map) { - this.map = {}; - if (this.singleton) { - for (const ext of this.singleton.LanguageMetaData.fileExtensions) { - this.map[ext] = this.singleton; - } - this.singleton = void 0; - } - } - for (const ext of language.LanguageMetaData.fileExtensions) { - if (this.map[ext] !== void 0 && this.map[ext] !== language) { - console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${language.LanguageMetaData.languageId}'.`); - } - this.map[ext] = language; - } - } - getServices(uri) { - if (this.singleton !== void 0) { - return this.singleton; - } - if (this.map === void 0) { - throw new Error("The service registry is empty. Use `register` to register the services of a language."); - } - const ext = UriUtils.extname(uri); - const services = this.map[ext]; - if (!services) { - throw new Error(`The service registry contains no services for the extension '${ext}'.`); - } - return services; - } - get all() { - if (this.singleton !== void 0) { - return [this.singleton]; - } - if (this.map !== void 0) { - return Object.values(this.map); - } - return []; - } -}; - -// node_modules/langium/lib/validation/validation-registry.js -function diagnosticData(code) { - return { code }; -} -var ValidationCategory; -(function(ValidationCategory2) { - ValidationCategory2.all = ["fast", "slow", "built-in"]; -})(ValidationCategory || (ValidationCategory = {})); -var ValidationRegistry = class { - constructor(services) { - this.entries = new MultiMap(); - this.reflection = services.shared.AstReflection; - } - /** - * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function) - * or an array of validation checks. - * - * @param checksRecord Set of validation checks to register. - * @param category Optional category for the validation checks (defaults to `'fast'`). - * @param thisObj Optional object to be used as `this` when calling the validation check functions. - */ - register(checksRecord, thisObj = this, category = "fast") { - if (category === "built-in") { - throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors."); - } - for (const [type, ch] of Object.entries(checksRecord)) { - const callbacks = ch; - if (Array.isArray(callbacks)) { - for (const check of callbacks) { - const entry = { - check: this.wrapValidationException(check, thisObj), - category - }; - this.addEntry(type, entry); - } - } else if (typeof callbacks === "function") { - const entry = { - check: this.wrapValidationException(callbacks, thisObj), - category - }; - this.addEntry(type, entry); - } - } - } - wrapValidationException(check, thisObj) { - return async (node, accept, cancelToken) => { - try { - await check.call(thisObj, node, accept, cancelToken); - } catch (err) { - if (isOperationCancelled(err)) { - throw err; - } - console.error("An error occurred during validation:", err); - const message = err instanceof Error ? err.message : String(err); - if (err instanceof Error && err.stack) { - console.error(err.stack); - } - accept("error", "An error occurred during validation: " + message, { node }); - } - }; - } - addEntry(type, entry) { - if (type === "AstNode") { - this.entries.add("AstNode", entry); - return; - } - for (const subtype of this.reflection.getAllSubTypes(type)) { - this.entries.add(subtype, entry); - } - } - getChecks(type, categories) { - let checks = stream(this.entries.get(type)).concat(this.entries.get("AstNode")); - if (categories) { - checks = checks.filter((entry) => categories.includes(entry.category)); - } - return checks.map((entry) => entry.check); - } -}; - -// node_modules/langium/lib/validation/document-validator.js -var DefaultDocumentValidator = class { - constructor(services) { - this.validationRegistry = services.validation.ValidationRegistry; - this.metadata = services.LanguageMetaData; - } - async validateDocument(document, options = {}, cancelToken = cancellation_exports.CancellationToken.None) { - const parseResult = document.parseResult; - const diagnostics = []; - await interruptAndCheck(cancelToken); - if (!options.categories || options.categories.includes("built-in")) { - this.processLexingErrors(parseResult, diagnostics, options); - if (options.stopAfterLexingErrors && diagnostics.some((d) => { - var _a; - return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.LexingError; - })) { - return diagnostics; - } - this.processParsingErrors(parseResult, diagnostics, options); - if (options.stopAfterParsingErrors && diagnostics.some((d) => { - var _a; - return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.ParsingError; - })) { - return diagnostics; - } - this.processLinkingErrors(document, diagnostics, options); - if (options.stopAfterLinkingErrors && diagnostics.some((d) => { - var _a; - return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.LinkingError; - })) { - return diagnostics; - } - } - try { - diagnostics.push(...await this.validateAst(parseResult.value, options, cancelToken)); - } catch (err) { - if (isOperationCancelled(err)) { - throw err; - } - console.error("An error occurred during validation:", err); - } - await interruptAndCheck(cancelToken); - return diagnostics; - } - processLexingErrors(parseResult, diagnostics, _options) { - for (const lexerError of parseResult.lexerErrors) { - const diagnostic = { - severity: toDiagnosticSeverity("error"), - range: { - start: { - line: lexerError.line - 1, - character: lexerError.column - 1 - }, - end: { - line: lexerError.line - 1, - character: lexerError.column + lexerError.length - 1 - } - }, - message: lexerError.message, - data: diagnosticData(DocumentValidator.LexingError), - source: this.getSource() - }; - diagnostics.push(diagnostic); - } - } - processParsingErrors(parseResult, diagnostics, _options) { - for (const parserError of parseResult.parserErrors) { - let range = void 0; - if (isNaN(parserError.token.startOffset)) { - if ("previousToken" in parserError) { - const token = parserError.previousToken; - if (!isNaN(token.startOffset)) { - const position = { line: token.endLine - 1, character: token.endColumn }; - range = { start: position, end: position }; - } else { - const position = { line: 0, character: 0 }; - range = { start: position, end: position }; - } - } - } else { - range = tokenToRange(parserError.token); - } - if (range) { - const diagnostic = { - severity: toDiagnosticSeverity("error"), - range, - message: parserError.message, - data: diagnosticData(DocumentValidator.ParsingError), - source: this.getSource() - }; - diagnostics.push(diagnostic); - } - } - } - processLinkingErrors(document, diagnostics, _options) { - for (const reference of document.references) { - const linkingError = reference.error; - if (linkingError) { - const info = { - node: linkingError.container, - property: linkingError.property, - index: linkingError.index, - data: { - code: DocumentValidator.LinkingError, - containerType: linkingError.container.$type, - property: linkingError.property, - refText: linkingError.reference.$refText - } - }; - diagnostics.push(this.toDiagnostic("error", linkingError.message, info)); - } - } - } - async validateAst(rootNode, options, cancelToken = cancellation_exports.CancellationToken.None) { - const validationItems = []; - const acceptor = (severity, message, info) => { - validationItems.push(this.toDiagnostic(severity, message, info)); - }; - await Promise.all(streamAst(rootNode).map(async (node) => { - await interruptAndCheck(cancelToken); - const checks = this.validationRegistry.getChecks(node.$type, options.categories); - for (const check of checks) { - await check(node, acceptor, cancelToken); - } - })); - return validationItems; - } - toDiagnostic(severity, message, info) { - return { - message, - range: getDiagnosticRange(info), - severity: toDiagnosticSeverity(severity), - code: info.code, - codeDescription: info.codeDescription, - tags: info.tags, - relatedInformation: info.relatedInformation, - data: info.data, - source: this.getSource() - }; - } - getSource() { - return this.metadata.languageId; - } -}; -function getDiagnosticRange(info) { - if (info.range) { - return info.range; - } - let cstNode; - if (typeof info.property === "string") { - cstNode = findNodeForProperty(info.node.$cstNode, info.property, info.index); - } else if (typeof info.keyword === "string") { - cstNode = findNodeForKeyword(info.node.$cstNode, info.keyword, info.index); - } - cstNode !== null && cstNode !== void 0 ? cstNode : cstNode = info.node.$cstNode; - if (!cstNode) { - return { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 } - }; - } - return cstNode.range; -} -function toDiagnosticSeverity(severity) { - switch (severity) { - case "error": - return 1; - case "warning": - return 2; - case "info": - return 3; - case "hint": - return 4; - default: - throw new Error("Invalid diagnostic severity: " + severity); - } -} -var DocumentValidator; -(function(DocumentValidator2) { - DocumentValidator2.LexingError = "lexing-error"; - DocumentValidator2.ParsingError = "parsing-error"; - DocumentValidator2.LinkingError = "linking-error"; -})(DocumentValidator || (DocumentValidator = {})); - -// node_modules/langium/lib/workspace/ast-descriptions.js -var DefaultAstNodeDescriptionProvider = class { - constructor(services) { - this.astNodeLocator = services.workspace.AstNodeLocator; - this.nameProvider = services.references.NameProvider; - } - createDescription(node, name, document = getDocument(node)) { - name !== null && name !== void 0 ? name : name = this.nameProvider.getName(node); - const path = this.astNodeLocator.getAstNodePath(node); - if (!name) { - throw new Error(`Node at path ${path} has no name.`); - } - let nameNodeSegment; - const nameSegmentGetter = () => { - var _a; - return nameNodeSegment !== null && nameNodeSegment !== void 0 ? nameNodeSegment : nameNodeSegment = toDocumentSegment((_a = this.nameProvider.getNameNode(node)) !== null && _a !== void 0 ? _a : node.$cstNode); - }; - return { - node, - name, - get nameSegment() { - return nameSegmentGetter(); - }, - selectionSegment: toDocumentSegment(node.$cstNode), - type: node.$type, - documentUri: document.uri, - path - }; - } -}; -var DefaultReferenceDescriptionProvider = class { - constructor(services) { - this.nodeLocator = services.workspace.AstNodeLocator; - } - async createDescriptions(document, cancelToken = cancellation_exports.CancellationToken.None) { - const descr = []; - const rootNode = document.parseResult.value; - for (const astNode of streamAst(rootNode)) { - await interruptAndCheck(cancelToken); - streamReferences(astNode).filter((refInfo) => !isLinkingError(refInfo)).forEach((refInfo) => { - const description = this.createDescription(refInfo); - if (description) { - descr.push(description); - } - }); - } - return descr; - } - createDescription(refInfo) { - const targetNodeDescr = refInfo.reference.$nodeDescription; - const refCstNode = refInfo.reference.$refNode; - if (!targetNodeDescr || !refCstNode) { - return void 0; - } - const docUri = getDocument(refInfo.container).uri; - return { - sourceUri: docUri, - sourcePath: this.nodeLocator.getAstNodePath(refInfo.container), - targetUri: targetNodeDescr.documentUri, - targetPath: targetNodeDescr.path, - segment: toDocumentSegment(refCstNode), - local: UriUtils.equals(targetNodeDescr.documentUri, docUri) - }; - } -}; - -// node_modules/langium/lib/workspace/ast-node-locator.js -var DefaultAstNodeLocator = class { - constructor() { - this.segmentSeparator = "/"; - this.indexSeparator = "@"; - } - getAstNodePath(node) { - if (node.$container) { - const containerPath = this.getAstNodePath(node.$container); - const newSegment = this.getPathSegment(node); - const nodePath = containerPath + this.segmentSeparator + newSegment; - return nodePath; - } - return ""; - } - getPathSegment({ $containerProperty, $containerIndex }) { - if (!$containerProperty) { - throw new Error("Missing '$containerProperty' in AST node."); - } - if ($containerIndex !== void 0) { - return $containerProperty + this.indexSeparator + $containerIndex; - } - return $containerProperty; - } - getAstNode(node, path) { - const segments = path.split(this.segmentSeparator); - return segments.reduce((previousValue, currentValue) => { - if (!previousValue || currentValue.length === 0) { - return previousValue; - } - const propertyIndex = currentValue.indexOf(this.indexSeparator); - if (propertyIndex > 0) { - const property2 = currentValue.substring(0, propertyIndex); - const arrayIndex = parseInt(currentValue.substring(propertyIndex + 1)); - const array = previousValue[property2]; - return array === null || array === void 0 ? void 0 : array[arrayIndex]; - } - return previousValue[currentValue]; - }, node); - } -}; - -// node_modules/langium/lib/workspace/configuration.js -var DefaultConfigurationProvider = class { - constructor(services) { - this._ready = new Deferred(); - this.settings = {}; - this.workspaceConfig = false; - this.serviceRegistry = services.ServiceRegistry; - } - get ready() { - return this._ready.promise; - } - initialize(params) { - var _a, _b; - this.workspaceConfig = (_b = (_a = params.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.configuration) !== null && _b !== void 0 ? _b : false; - } - async initialized(params) { - if (this.workspaceConfig) { - if (params.register) { - const languages = this.serviceRegistry.all; - params.register({ - // Listen to configuration changes for all languages - section: languages.map((lang) => this.toSectionName(lang.LanguageMetaData.languageId)) - }); - } - if (params.fetchConfiguration) { - const configToUpdate = this.serviceRegistry.all.map((lang) => ({ - // Fetch the configuration changes for all languages - section: this.toSectionName(lang.LanguageMetaData.languageId) - })); - const configs = await params.fetchConfiguration(configToUpdate); - configToUpdate.forEach((conf, idx) => { - this.updateSectionConfiguration(conf.section, configs[idx]); - }); - } - } - this._ready.resolve(); - } - /** - * Updates the cached configurations using the `change` notification parameters. - * - * @param change The parameters of a change configuration notification. - * `settings` property of the change object could be expressed as `Record>` - */ - updateConfiguration(change) { - if (!change.settings) { - return; - } - Object.keys(change.settings).forEach((section) => { - this.updateSectionConfiguration(section, change.settings[section]); - }); - } - updateSectionConfiguration(section, configuration) { - this.settings[section] = configuration; - } - /** - * Returns a configuration value stored for the given language. - * - * @param language The language id - * @param configuration Configuration name - */ - async getConfiguration(language, configuration) { - await this.ready; - const sectionName = this.toSectionName(language); - if (this.settings[sectionName]) { - return this.settings[sectionName][configuration]; - } - } - toSectionName(languageId) { - return `${languageId}`; - } -}; - -// node_modules/langium/lib/utils/disposable.js -var Disposable; -(function(Disposable2) { - function create(callback) { - return { - dispose: async () => await callback() - }; - } - Disposable2.create = create; -})(Disposable || (Disposable = {})); - -// node_modules/langium/lib/workspace/document-builder.js -var DefaultDocumentBuilder = class { - constructor(services) { - this.updateBuildOptions = { - // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category) - validation: { - categories: ["built-in", "fast"] - } - }; - this.updateListeners = []; - this.buildPhaseListeners = new MultiMap(); - this.buildState = /* @__PURE__ */ new Map(); - this.documentBuildWaiters = /* @__PURE__ */ new Map(); - this.currentState = DocumentState.Changed; - this.langiumDocuments = services.workspace.LangiumDocuments; - this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory; - this.indexManager = services.workspace.IndexManager; - this.serviceRegistry = services.ServiceRegistry; - } - async build(documents, options = {}, cancelToken = cancellation_exports.CancellationToken.None) { - var _a, _b; - for (const document of documents) { - const key = document.uri.toString(); - if (document.state === DocumentState.Validated) { - if (typeof options.validation === "boolean" && options.validation) { - document.state = DocumentState.IndexedReferences; - document.diagnostics = void 0; - this.buildState.delete(key); - } else if (typeof options.validation === "object") { - const buildState = this.buildState.get(key); - const previousCategories = (_a = buildState === null || buildState === void 0 ? void 0 : buildState.result) === null || _a === void 0 ? void 0 : _a.validationChecks; - if (previousCategories) { - const newCategories = (_b = options.validation.categories) !== null && _b !== void 0 ? _b : ValidationCategory.all; - const categories = newCategories.filter((c) => !previousCategories.includes(c)); - if (categories.length > 0) { - this.buildState.set(key, { - completed: false, - options: { - validation: Object.assign(Object.assign({}, options.validation), { categories }) - }, - result: buildState.result - }); - document.state = DocumentState.IndexedReferences; - } - } - } - } else { - this.buildState.delete(key); - } - } - this.currentState = DocumentState.Changed; - await this.emitUpdate(documents.map((e) => e.uri), []); - await this.buildDocuments(documents, options, cancelToken); - } - async update(changed, deleted, cancelToken = cancellation_exports.CancellationToken.None) { - this.currentState = DocumentState.Changed; - for (const deletedUri of deleted) { - this.langiumDocuments.deleteDocument(deletedUri); - this.buildState.delete(deletedUri.toString()); - this.indexManager.remove(deletedUri); - } - for (const changedUri of changed) { - const invalidated = this.langiumDocuments.invalidateDocument(changedUri); - if (!invalidated) { - const newDocument = this.langiumDocumentFactory.fromModel({ $type: "INVALID" }, changedUri); - newDocument.state = DocumentState.Changed; - this.langiumDocuments.addDocument(newDocument); - } - this.buildState.delete(changedUri.toString()); - } - const allChangedUris = stream(changed).concat(deleted).map((uri) => uri.toString()).toSet(); - this.langiumDocuments.all.filter((doc) => !allChangedUris.has(doc.uri.toString()) && this.shouldRelink(doc, allChangedUris)).forEach((doc) => { - const linker = this.serviceRegistry.getServices(doc.uri).references.Linker; - linker.unlink(doc); - doc.state = Math.min(doc.state, DocumentState.ComputedScopes); - doc.diagnostics = void 0; - }); - await this.emitUpdate(changed, deleted); - await interruptAndCheck(cancelToken); - const rebuildDocuments = this.langiumDocuments.all.filter((doc) => { - var _a; - return doc.state < DocumentState.Linked || !((_a = this.buildState.get(doc.uri.toString())) === null || _a === void 0 ? void 0 : _a.completed); - }).toArray(); - await this.buildDocuments(rebuildDocuments, this.updateBuildOptions, cancelToken); - } - async emitUpdate(changed, deleted) { - await Promise.all(this.updateListeners.map((listener) => listener(changed, deleted))); - } - /** - * Check whether the given document should be relinked after changes were found in the given URIs. - */ - shouldRelink(document, changedUris) { - if (document.references.some((ref) => ref.error !== void 0)) { - return true; - } - return this.indexManager.isAffected(document, changedUris); - } - onUpdate(callback) { - this.updateListeners.push(callback); - return Disposable.create(() => { - const index = this.updateListeners.indexOf(callback); - if (index >= 0) { - this.updateListeners.splice(index, 1); - } - }); - } - /** - * Build the given documents by stepping through all build phases. If a document's state indicates - * that a certain build phase is already done, the phase is skipped for that document. - */ - async buildDocuments(documents, options, cancelToken) { - this.prepareBuild(documents, options); - await this.runCancelable(documents, DocumentState.Parsed, cancelToken, (doc) => this.langiumDocumentFactory.update(doc, cancelToken)); - await this.runCancelable(documents, DocumentState.IndexedContent, cancelToken, (doc) => this.indexManager.updateContent(doc, cancelToken)); - await this.runCancelable(documents, DocumentState.ComputedScopes, cancelToken, async (doc) => { - const scopeComputation = this.serviceRegistry.getServices(doc.uri).references.ScopeComputation; - doc.precomputedScopes = await scopeComputation.computeLocalScopes(doc, cancelToken); - }); - await this.runCancelable(documents, DocumentState.Linked, cancelToken, (doc) => { - const linker = this.serviceRegistry.getServices(doc.uri).references.Linker; - return linker.link(doc, cancelToken); - }); - await this.runCancelable(documents, DocumentState.IndexedReferences, cancelToken, (doc) => this.indexManager.updateReferences(doc, cancelToken)); - const toBeValidated = documents.filter((doc) => this.shouldValidate(doc)); - await this.runCancelable(toBeValidated, DocumentState.Validated, cancelToken, (doc) => this.validate(doc, cancelToken)); - for (const doc of documents) { - const state = this.buildState.get(doc.uri.toString()); - if (state) { - state.completed = true; - } - } - } - prepareBuild(documents, options) { - for (const doc of documents) { - const key = doc.uri.toString(); - const state = this.buildState.get(key); - if (!state || state.completed) { - this.buildState.set(key, { - completed: false, - options, - result: state === null || state === void 0 ? void 0 : state.result - }); - } - } - } - async runCancelable(documents, targetState, cancelToken, callback) { - const filtered = documents.filter((e) => e.state < targetState); - for (const document of filtered) { - await interruptAndCheck(cancelToken); - await callback(document); - document.state = targetState; - } - await this.notifyBuildPhase(filtered, targetState, cancelToken); - this.currentState = targetState; - } - onBuildPhase(targetState, callback) { - this.buildPhaseListeners.add(targetState, callback); - return Disposable.create(() => { - this.buildPhaseListeners.delete(targetState, callback); - }); - } - waitUntil(state, uriOrToken, cancelToken) { - let uri = void 0; - if (uriOrToken && "path" in uriOrToken) { - uri = uriOrToken; - } else { - cancelToken = uriOrToken; - } - cancelToken !== null && cancelToken !== void 0 ? cancelToken : cancelToken = cancellation_exports.CancellationToken.None; - if (uri) { - const document = this.langiumDocuments.getDocument(uri); - if (document && document.state > state) { - return Promise.resolve(uri); - } - } - if (this.currentState >= state) { - return Promise.resolve(void 0); - } else if (cancelToken.isCancellationRequested) { - return Promise.reject(OperationCancelled); - } - return new Promise((resolve, reject2) => { - const buildDisposable = this.onBuildPhase(state, () => { - buildDisposable.dispose(); - cancelDisposable.dispose(); - if (uri) { - const document = this.langiumDocuments.getDocument(uri); - resolve(document === null || document === void 0 ? void 0 : document.uri); - } else { - resolve(void 0); - } - }); - const cancelDisposable = cancelToken.onCancellationRequested(() => { - buildDisposable.dispose(); - cancelDisposable.dispose(); - reject2(OperationCancelled); - }); - }); - } - async notifyBuildPhase(documents, state, cancelToken) { - if (documents.length === 0) { - return; - } - const listeners = this.buildPhaseListeners.get(state); - for (const listener of listeners) { - await interruptAndCheck(cancelToken); - await listener(documents, cancelToken); - } - } - /** - * Determine whether the given document should be validated during a build. The default - * implementation checks the `validation` property of the build options. If it's set to `true` - * or a `ValidationOptions` object, the document is included in the validation phase. - */ - shouldValidate(document) { - return Boolean(this.getBuildOptions(document).validation); - } - /** - * Run validation checks on the given document and store the resulting diagnostics in the document. - * If the document already contains diagnostics, the new ones are added to the list. - */ - async validate(document, cancelToken) { - var _a, _b; - const validator = this.serviceRegistry.getServices(document.uri).validation.DocumentValidator; - const validationSetting = this.getBuildOptions(document).validation; - const options = typeof validationSetting === "object" ? validationSetting : void 0; - const diagnostics = await validator.validateDocument(document, options, cancelToken); - if (document.diagnostics) { - document.diagnostics.push(...diagnostics); - } else { - document.diagnostics = diagnostics; - } - const state = this.buildState.get(document.uri.toString()); - if (state) { - (_a = state.result) !== null && _a !== void 0 ? _a : state.result = {}; - const newCategories = (_b = options === null || options === void 0 ? void 0 : options.categories) !== null && _b !== void 0 ? _b : ValidationCategory.all; - if (state.result.validationChecks) { - state.result.validationChecks.push(...newCategories); - } else { - state.result.validationChecks = [...newCategories]; - } - } - } - getBuildOptions(document) { - var _a, _b; - return (_b = (_a = this.buildState.get(document.uri.toString())) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {}; - } -}; - -// node_modules/langium/lib/workspace/index-manager.js -var DefaultIndexManager = class { - constructor(services) { - this.symbolIndex = /* @__PURE__ */ new Map(); - this.symbolByTypeIndex = new ContextCache(); - this.referenceIndex = /* @__PURE__ */ new Map(); - this.documents = services.workspace.LangiumDocuments; - this.serviceRegistry = services.ServiceRegistry; - this.astReflection = services.AstReflection; - } - findAllReferences(targetNode, astNodePath) { - const targetDocUri = getDocument(targetNode).uri; - const result = []; - this.referenceIndex.forEach((docRefs) => { - docRefs.forEach((refDescr) => { - if (UriUtils.equals(refDescr.targetUri, targetDocUri) && refDescr.targetPath === astNodePath) { - result.push(refDescr); - } - }); - }); - return stream(result); - } - allElements(nodeType, uris) { - let documentUris = stream(this.symbolIndex.keys()); - if (uris) { - documentUris = documentUris.filter((uri) => !uris || uris.has(uri)); - } - return documentUris.map((uri) => this.getFileDescriptions(uri, nodeType)).flat(); - } - getFileDescriptions(uri, nodeType) { - var _a; - if (!nodeType) { - return (_a = this.symbolIndex.get(uri)) !== null && _a !== void 0 ? _a : []; - } - const descriptions = this.symbolByTypeIndex.get(uri, nodeType, () => { - var _a2; - const allFileDescriptions = (_a2 = this.symbolIndex.get(uri)) !== null && _a2 !== void 0 ? _a2 : []; - return allFileDescriptions.filter((e) => this.astReflection.isSubtype(e.type, nodeType)); - }); - return descriptions; - } - remove(uri) { - const uriString = uri.toString(); - this.symbolIndex.delete(uriString); - this.symbolByTypeIndex.clear(uriString); - this.referenceIndex.delete(uriString); - } - async updateContent(document, cancelToken = cancellation_exports.CancellationToken.None) { - const services = this.serviceRegistry.getServices(document.uri); - const exports2 = await services.references.ScopeComputation.computeExports(document, cancelToken); - const uri = document.uri.toString(); - this.symbolIndex.set(uri, exports2); - this.symbolByTypeIndex.clear(uri); - } - async updateReferences(document, cancelToken = cancellation_exports.CancellationToken.None) { - const services = this.serviceRegistry.getServices(document.uri); - const indexData = await services.workspace.ReferenceDescriptionProvider.createDescriptions(document, cancelToken); - this.referenceIndex.set(document.uri.toString(), indexData); - } - isAffected(document, changedUris) { - const references = this.referenceIndex.get(document.uri.toString()); - if (!references) { - return false; - } - return references.some((ref) => !ref.local && changedUris.has(ref.targetUri.toString())); - } -}; - -// node_modules/langium/lib/workspace/workspace-manager.js -var DefaultWorkspaceManager = class { - constructor(services) { - this.initialBuildOptions = {}; - this._ready = new Deferred(); - this.serviceRegistry = services.ServiceRegistry; - this.langiumDocuments = services.workspace.LangiumDocuments; - this.documentBuilder = services.workspace.DocumentBuilder; - this.fileSystemProvider = services.workspace.FileSystemProvider; - this.mutex = services.workspace.WorkspaceLock; - } - get ready() { - return this._ready.promise; - } - initialize(params) { - var _a; - this.folders = (_a = params.workspaceFolders) !== null && _a !== void 0 ? _a : void 0; - } - initialized(_params) { - return this.mutex.write((token) => { - var _a; - return this.initializeWorkspace((_a = this.folders) !== null && _a !== void 0 ? _a : [], token); - }); - } - async initializeWorkspace(folders, cancelToken = cancellation_exports.CancellationToken.None) { - const documents = await this.performStartup(folders); - await interruptAndCheck(cancelToken); - await this.documentBuilder.build(documents, this.initialBuildOptions, cancelToken); - } - /** - * Performs the uninterruptable startup sequence of the workspace manager. - * This methods loads all documents in the workspace and other documents and returns them. - */ - async performStartup(folders) { - const fileExtensions = this.serviceRegistry.all.flatMap((e) => e.LanguageMetaData.fileExtensions); - const documents = []; - const collector = (document) => { - documents.push(document); - if (!this.langiumDocuments.hasDocument(document.uri)) { - this.langiumDocuments.addDocument(document); - } - }; - await this.loadAdditionalDocuments(folders, collector); - await Promise.all(folders.map((wf) => [wf, this.getRootFolder(wf)]).map(async (entry) => this.traverseFolder(...entry, fileExtensions, collector))); - this._ready.resolve(); - return documents; - } - /** - * Load all additional documents that shall be visible in the context of the given workspace - * folders and add them to the collector. This can be used to include built-in libraries of - * your language, which can be either loaded from provided files or constructed in memory. - */ - loadAdditionalDocuments(_folders, _collector) { - return Promise.resolve(); - } - /** - * Determine the root folder of the source documents in the given workspace folder. - * The default implementation returns the URI of the workspace folder, but you can override - * this to return a subfolder like `src` instead. - */ - getRootFolder(workspaceFolder) { - return URI.parse(workspaceFolder.uri); - } - /** - * Traverse the file system folder identified by the given URI and its subfolders. All - * contained files that match the file extensions are added to the collector. - */ - async traverseFolder(workspaceFolder, folderPath, fileExtensions, collector) { - const content = await this.fileSystemProvider.readDirectory(folderPath); - await Promise.all(content.map(async (entry) => { - if (this.includeEntry(workspaceFolder, entry, fileExtensions)) { - if (entry.isDirectory) { - await this.traverseFolder(workspaceFolder, entry.uri, fileExtensions, collector); - } else if (entry.isFile) { - const document = await this.langiumDocuments.getOrCreateDocument(entry.uri); - collector(document); - } - } - })); - } - /** - * Determine whether the given folder entry shall be included while indexing the workspace. - */ - includeEntry(_workspaceFolder, entry, fileExtensions) { - const name = UriUtils.basename(entry.uri); - if (name.startsWith(".")) { - return false; - } - if (entry.isDirectory) { - return name !== "node_modules" && name !== "out"; - } else if (entry.isFile) { - const extname = UriUtils.extname(entry.uri); - return fileExtensions.includes(extname); - } - return false; - } -}; - -// node_modules/langium/lib/parser/lexer.js -var DefaultLexer = class { - constructor(services) { - const tokens = services.parser.TokenBuilder.buildTokens(services.Grammar, { - caseInsensitive: services.LanguageMetaData.caseInsensitive - }); - this.tokenTypes = this.toTokenTypeDictionary(tokens); - const lexerTokens = isTokenTypeDictionary(tokens) ? Object.values(tokens) : tokens; - this.chevrotainLexer = new Lexer(lexerTokens, { - positionTracking: "full" - }); - } - get definition() { - return this.tokenTypes; - } - tokenize(text) { - var _a; - const chevrotainResult = this.chevrotainLexer.tokenize(text); - return { - tokens: chevrotainResult.tokens, - errors: chevrotainResult.errors, - hidden: (_a = chevrotainResult.groups.hidden) !== null && _a !== void 0 ? _a : [] - }; - } - toTokenTypeDictionary(buildTokens) { - if (isTokenTypeDictionary(buildTokens)) - return buildTokens; - const tokens = isIMultiModeLexerDefinition(buildTokens) ? Object.values(buildTokens.modes).flat() : buildTokens; - const res = {}; - tokens.forEach((token) => res[token.name] = token); - return res; - } -}; -function isTokenTypeArray(tokenVocabulary) { - return Array.isArray(tokenVocabulary) && (tokenVocabulary.length === 0 || "name" in tokenVocabulary[0]); -} -function isIMultiModeLexerDefinition(tokenVocabulary) { - return tokenVocabulary && "modes" in tokenVocabulary && "defaultMode" in tokenVocabulary; -} -function isTokenTypeDictionary(tokenVocabulary) { - return !isTokenTypeArray(tokenVocabulary) && !isIMultiModeLexerDefinition(tokenVocabulary); -} - -// node_modules/langium/lib/documentation/jsdoc.js -function parseJSDoc(node, start, options) { - let opts; - let position; - if (typeof node === "string") { - position = start; - opts = options; - } else { - position = node.range.start; - opts = start; - } - if (!position) { - position = Position2.create(0, 0); - } - const lines = getLines(node); - const normalizedOptions = normalizeOptions(opts); - const tokens = tokenize({ - lines, - position, - options: normalizedOptions - }); - return parseJSDocComment({ - index: 0, - tokens, - position - }); -} -function isJSDoc(node, options) { - const normalizedOptions = normalizeOptions(options); - const lines = getLines(node); - if (lines.length === 0) { - return false; - } - const first2 = lines[0]; - const last2 = lines[lines.length - 1]; - const firstRegex = normalizedOptions.start; - const lastRegex = normalizedOptions.end; - return Boolean(firstRegex === null || firstRegex === void 0 ? void 0 : firstRegex.exec(first2)) && Boolean(lastRegex === null || lastRegex === void 0 ? void 0 : lastRegex.exec(last2)); -} -function getLines(node) { - let content = ""; - if (typeof node === "string") { - content = node; - } else { - content = node.text; - } - const lines = content.split(NEWLINE_REGEXP); - return lines; -} -var tagRegex = /\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy; -var inlineTagRegex = /\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu; -function tokenize(context) { - var _a, _b, _c; - const tokens = []; - let currentLine = context.position.line; - let currentCharacter = context.position.character; - for (let i = 0; i < context.lines.length; i++) { - const first2 = i === 0; - const last2 = i === context.lines.length - 1; - let line = context.lines[i]; - let index = 0; - if (first2 && context.options.start) { - const match = (_a = context.options.start) === null || _a === void 0 ? void 0 : _a.exec(line); - if (match) { - index = match.index + match[0].length; - } - } else { - const match = (_b = context.options.line) === null || _b === void 0 ? void 0 : _b.exec(line); - if (match) { - index = match.index + match[0].length; - } - } - if (last2) { - const match = (_c = context.options.end) === null || _c === void 0 ? void 0 : _c.exec(line); - if (match) { - line = line.substring(0, match.index); - } - } - line = line.substring(0, lastCharacter(line)); - const whitespaceEnd = skipWhitespace(line, index); - if (whitespaceEnd >= line.length) { - if (tokens.length > 0) { - const position = Position2.create(currentLine, currentCharacter); - tokens.push({ - type: "break", - content: "", - range: Range.create(position, position) - }); - } - } else { - tagRegex.lastIndex = index; - const tagMatch = tagRegex.exec(line); - if (tagMatch) { - const fullMatch = tagMatch[0]; - const value = tagMatch[1]; - const start = Position2.create(currentLine, currentCharacter + index); - const end = Position2.create(currentLine, currentCharacter + index + fullMatch.length); - tokens.push({ - type: "tag", - content: value, - range: Range.create(start, end) - }); - index += fullMatch.length; - index = skipWhitespace(line, index); - } - if (index < line.length) { - const rest = line.substring(index); - const inlineTagMatches = Array.from(rest.matchAll(inlineTagRegex)); - tokens.push(...buildInlineTokens(inlineTagMatches, rest, currentLine, currentCharacter + index)); - } - } - currentLine++; - currentCharacter = 0; - } - if (tokens.length > 0 && tokens[tokens.length - 1].type === "break") { - return tokens.slice(0, -1); - } - return tokens; -} -function buildInlineTokens(tags, line, lineIndex, characterIndex) { - const tokens = []; - if (tags.length === 0) { - const start = Position2.create(lineIndex, characterIndex); - const end = Position2.create(lineIndex, characterIndex + line.length); - tokens.push({ - type: "text", - content: line, - range: Range.create(start, end) - }); - } else { - let lastIndex = 0; - for (const match of tags) { - const matchIndex = match.index; - const startContent = line.substring(lastIndex, matchIndex); - if (startContent.length > 0) { - tokens.push({ - type: "text", - content: line.substring(lastIndex, matchIndex), - range: Range.create(Position2.create(lineIndex, lastIndex + characterIndex), Position2.create(lineIndex, matchIndex + characterIndex)) - }); - } - let offset = startContent.length + 1; - const tagName = match[1]; - tokens.push({ - type: "inline-tag", - content: tagName, - range: Range.create(Position2.create(lineIndex, lastIndex + offset + characterIndex), Position2.create(lineIndex, lastIndex + offset + tagName.length + characterIndex)) - }); - offset += tagName.length; - if (match.length === 4) { - offset += match[2].length; - const value = match[3]; - tokens.push({ - type: "text", - content: value, - range: Range.create(Position2.create(lineIndex, lastIndex + offset + characterIndex), Position2.create(lineIndex, lastIndex + offset + value.length + characterIndex)) - }); - } else { - tokens.push({ - type: "text", - content: "", - range: Range.create(Position2.create(lineIndex, lastIndex + offset + characterIndex), Position2.create(lineIndex, lastIndex + offset + characterIndex)) - }); - } - lastIndex = matchIndex + match[0].length; - } - const endContent = line.substring(lastIndex); - if (endContent.length > 0) { - tokens.push({ - type: "text", - content: endContent, - range: Range.create(Position2.create(lineIndex, lastIndex + characterIndex), Position2.create(lineIndex, lastIndex + characterIndex + endContent.length)) - }); - } - } - return tokens; -} -var nonWhitespaceRegex = /\S/; -var whitespaceEndRegex = /\s*$/; -function skipWhitespace(line, index) { - const match = line.substring(index).match(nonWhitespaceRegex); - if (match) { - return index + match.index; - } else { - return line.length; - } -} -function lastCharacter(line) { - const match = line.match(whitespaceEndRegex); - if (match && typeof match.index === "number") { - return match.index; - } - return void 0; -} -function parseJSDocComment(context) { - var _a, _b, _c, _d; - const startPosition = Position2.create(context.position.line, context.position.character); - if (context.tokens.length === 0) { - return new JSDocCommentImpl([], Range.create(startPosition, startPosition)); - } - const elements = []; - while (context.index < context.tokens.length) { - const element = parseJSDocElement(context, elements[elements.length - 1]); - if (element) { - elements.push(element); - } - } - const start = (_b = (_a = elements[0]) === null || _a === void 0 ? void 0 : _a.range.start) !== null && _b !== void 0 ? _b : startPosition; - const end = (_d = (_c = elements[elements.length - 1]) === null || _c === void 0 ? void 0 : _c.range.end) !== null && _d !== void 0 ? _d : startPosition; - return new JSDocCommentImpl(elements, Range.create(start, end)); -} -function parseJSDocElement(context, last2) { - const next = context.tokens[context.index]; - if (next.type === "tag") { - return parseJSDocTag(context, false); - } else if (next.type === "text" || next.type === "inline-tag") { - return parseJSDocText(context); - } else { - appendEmptyLine(next, last2); - context.index++; - return void 0; - } -} -function appendEmptyLine(token, element) { - if (element) { - const line = new JSDocLineImpl("", token.range); - if ("inlines" in element) { - element.inlines.push(line); - } else { - element.content.inlines.push(line); - } - } -} -function parseJSDocText(context) { - let token = context.tokens[context.index]; - const firstToken = token; - let lastToken = token; - const lines = []; - while (token && token.type !== "break" && token.type !== "tag") { - lines.push(parseJSDocInline(context)); - lastToken = token; - token = context.tokens[context.index]; - } - return new JSDocTextImpl(lines, Range.create(firstToken.range.start, lastToken.range.end)); -} -function parseJSDocInline(context) { - const token = context.tokens[context.index]; - if (token.type === "inline-tag") { - return parseJSDocTag(context, true); - } else { - return parseJSDocLine(context); - } -} -function parseJSDocTag(context, inline) { - const tagToken = context.tokens[context.index++]; - const name = tagToken.content.substring(1); - const nextToken = context.tokens[context.index]; - if ((nextToken === null || nextToken === void 0 ? void 0 : nextToken.type) === "text") { - if (inline) { - const docLine = parseJSDocLine(context); - return new JSDocTagImpl(name, new JSDocTextImpl([docLine], docLine.range), inline, Range.create(tagToken.range.start, docLine.range.end)); - } else { - const textDoc = parseJSDocText(context); - return new JSDocTagImpl(name, textDoc, inline, Range.create(tagToken.range.start, textDoc.range.end)); - } - } else { - const range = tagToken.range; - return new JSDocTagImpl(name, new JSDocTextImpl([], range), inline, range); - } -} -function parseJSDocLine(context) { - const token = context.tokens[context.index++]; - return new JSDocLineImpl(token.content, token.range); -} -function normalizeOptions(options) { - if (!options) { - return normalizeOptions({ - start: "/**", - end: "*/", - line: "*" - }); - } - const { start, end, line } = options; - return { - start: normalizeOption(start, true), - end: normalizeOption(end, false), - line: normalizeOption(line, true) - }; -} -function normalizeOption(option2, start) { - if (typeof option2 === "string" || typeof option2 === "object") { - const escaped = typeof option2 === "string" ? escapeRegExp(option2) : option2.source; - if (start) { - return new RegExp(`^\\s*${escaped}`); - } else { - return new RegExp(`\\s*${escaped}\\s*$`); - } - } else { - return option2; - } -} -var JSDocCommentImpl = class { - constructor(elements, range) { - this.elements = elements; - this.range = range; - } - getTag(name) { - return this.getAllTags().find((e) => e.name === name); - } - getTags(name) { - return this.getAllTags().filter((e) => e.name === name); - } - getAllTags() { - return this.elements.filter((e) => "name" in e); - } - toString() { - let value = ""; - for (const element of this.elements) { - if (value.length === 0) { - value = element.toString(); - } else { - const text = element.toString(); - value += fillNewlines(value) + text; - } - } - return value.trim(); - } - toMarkdown(options) { - let value = ""; - for (const element of this.elements) { - if (value.length === 0) { - value = element.toMarkdown(options); - } else { - const text = element.toMarkdown(options); - value += fillNewlines(value) + text; - } - } - return value.trim(); - } -}; -var JSDocTagImpl = class { - constructor(name, content, inline, range) { - this.name = name; - this.content = content; - this.inline = inline; - this.range = range; - } - toString() { - let text = `@${this.name}`; - const content = this.content.toString(); - if (this.content.inlines.length === 1) { - text = `${text} ${content}`; - } else if (this.content.inlines.length > 1) { - text = `${text} -${content}`; - } - if (this.inline) { - return `{${text}}`; - } else { - return text; - } - } - toMarkdown(options) { - var _a, _b; - return (_b = (_a = options === null || options === void 0 ? void 0 : options.renderTag) === null || _a === void 0 ? void 0 : _a.call(options, this)) !== null && _b !== void 0 ? _b : this.toMarkdownDefault(options); - } - toMarkdownDefault(options) { - const content = this.content.toMarkdown(options); - if (this.inline) { - const rendered = renderInlineTag(this.name, content, options !== null && options !== void 0 ? options : {}); - if (typeof rendered === "string") { - return rendered; - } - } - let marker = ""; - if ((options === null || options === void 0 ? void 0 : options.tag) === "italic" || (options === null || options === void 0 ? void 0 : options.tag) === void 0) { - marker = "*"; - } else if ((options === null || options === void 0 ? void 0 : options.tag) === "bold") { - marker = "**"; - } else if ((options === null || options === void 0 ? void 0 : options.tag) === "bold-italic") { - marker = "***"; - } - let text = `${marker}@${this.name}${marker}`; - if (this.content.inlines.length === 1) { - text = `${text} \u2014 ${content}`; - } else if (this.content.inlines.length > 1) { - text = `${text} -${content}`; - } - if (this.inline) { - return `{${text}}`; - } else { - return text; - } - } -}; -function renderInlineTag(tag, content, options) { - var _a, _b; - if (tag === "linkplain" || tag === "linkcode" || tag === "link") { - const index = content.indexOf(" "); - let display = content; - if (index > 0) { - const displayStart = skipWhitespace(content, index); - display = content.substring(displayStart); - content = content.substring(0, index); - } - if (tag === "linkcode" || tag === "link" && options.link === "code") { - display = `\`${display}\``; - } - const renderedLink = (_b = (_a = options.renderLink) === null || _a === void 0 ? void 0 : _a.call(options, content, display)) !== null && _b !== void 0 ? _b : renderLinkDefault(content, display); - return renderedLink; - } - return void 0; -} -function renderLinkDefault(content, display) { - try { - URI.parse(content, true); - return `[${display}](${content})`; - } catch (_a) { - return content; - } -} -var JSDocTextImpl = class { - constructor(lines, range) { - this.inlines = lines; - this.range = range; - } - toString() { - let text = ""; - for (let i = 0; i < this.inlines.length; i++) { - const inline = this.inlines[i]; - const next = this.inlines[i + 1]; - text += inline.toString(); - if (next && next.range.start.line > inline.range.start.line) { - text += "\n"; - } - } - return text; - } - toMarkdown(options) { - let text = ""; - for (let i = 0; i < this.inlines.length; i++) { - const inline = this.inlines[i]; - const next = this.inlines[i + 1]; - text += inline.toMarkdown(options); - if (next && next.range.start.line > inline.range.start.line) { - text += "\n"; - } - } - return text; - } -}; -var JSDocLineImpl = class { - constructor(text, range) { - this.text = text; - this.range = range; - } - toString() { - return this.text; - } - toMarkdown() { - return this.text; - } -}; -function fillNewlines(text) { - if (text.endsWith("\n")) { - return "\n"; - } else { - return "\n\n"; - } -} - -// node_modules/langium/lib/documentation/documentation-provider.js -var JSDocDocumentationProvider = class { - constructor(services) { - this.indexManager = services.shared.workspace.IndexManager; - this.commentProvider = services.documentation.CommentProvider; - } - getDocumentation(node) { - const comment = this.commentProvider.getComment(node); - if (comment && isJSDoc(comment)) { - const parsedJSDoc = parseJSDoc(comment); - return parsedJSDoc.toMarkdown({ - renderLink: (link, display) => { - return this.documentationLinkRenderer(node, link, display); - }, - renderTag: (tag) => { - return this.documentationTagRenderer(node, tag); - } - }); - } - return void 0; - } - documentationLinkRenderer(node, name, display) { - var _a; - const description = (_a = this.findNameInPrecomputedScopes(node, name)) !== null && _a !== void 0 ? _a : this.findNameInGlobalScope(node, name); - if (description && description.nameSegment) { - const line = description.nameSegment.range.start.line + 1; - const character = description.nameSegment.range.start.character + 1; - const uri = description.documentUri.with({ fragment: `L${line},${character}` }); - return `[${display}](${uri.toString()})`; - } else { - return void 0; - } - } - documentationTagRenderer(_node, _tag) { - return void 0; - } - findNameInPrecomputedScopes(node, name) { - const document = getDocument(node); - const precomputed = document.precomputedScopes; - if (!precomputed) { - return void 0; - } - let currentNode = node; - do { - const allDescriptions = precomputed.get(currentNode); - const description = allDescriptions.find((e) => e.name === name); - if (description) { - return description; - } - currentNode = currentNode.$container; - } while (currentNode); - return void 0; - } - findNameInGlobalScope(node, name) { - const description = this.indexManager.allElements().find((e) => e.name === name); - return description; - } -}; - -// node_modules/langium/lib/documentation/comment-provider.js -var DefaultCommentProvider = class { - constructor(services) { - this.grammarConfig = () => services.parser.GrammarConfig; - } - getComment(node) { - var _a; - if (isAstNodeWithComment(node)) { - return node.$comment; - } - return (_a = findCommentNode(node.$cstNode, this.grammarConfig().multilineCommentRules)) === null || _a === void 0 ? void 0 : _a.text; - } -}; - -// node_modules/langium/lib/utils/event.js -var event_exports = {}; -__reExport(event_exports, __toESM(require_events(), 1)); - -// node_modules/langium/lib/parser/async-parser.js -var DefaultAsyncParser = class { - constructor(services) { - this.syncParser = services.parser.LangiumParser; - } - parse(text) { - return Promise.resolve(this.syncParser.parse(text)); - } -}; -var AbstractThreadedAsyncParser = class { - constructor(services) { - this.threadCount = 8; - this.terminationDelay = 200; - this.workerPool = []; - this.queue = []; - this.hydrator = services.serializer.Hydrator; - } - initializeWorkers() { - while (this.workerPool.length < this.threadCount) { - const worker = this.createWorker(); - worker.onReady(() => { - if (this.queue.length > 0) { - const deferred = this.queue.shift(); - if (deferred) { - worker.lock(); - deferred.resolve(worker); - } - } - }); - this.workerPool.push(worker); - } - } - async parse(text, cancelToken) { - const worker = await this.acquireParserWorker(cancelToken); - const deferred = new Deferred(); - let timeout; - const cancellation = cancelToken.onCancellationRequested(() => { - timeout = setTimeout(() => { - this.terminateWorker(worker); - }, this.terminationDelay); - }); - worker.parse(text).then((result) => { - const hydrated = this.hydrator.hydrate(result); - deferred.resolve(hydrated); - }).catch((err) => { - deferred.reject(err); - }).finally(() => { - cancellation.dispose(); - clearTimeout(timeout); - }); - return deferred.promise; - } - terminateWorker(worker) { - worker.terminate(); - const index = this.workerPool.indexOf(worker); - if (index >= 0) { - this.workerPool.splice(index, 1); - } - } - async acquireParserWorker(cancelToken) { - this.initializeWorkers(); - for (const worker of this.workerPool) { - if (worker.ready) { - worker.lock(); - return worker; - } - } - const deferred = new Deferred(); - cancelToken.onCancellationRequested(() => { - const index = this.queue.indexOf(deferred); - if (index >= 0) { - this.queue.splice(index, 1); - } - deferred.reject(OperationCancelled); - }); - this.queue.push(deferred); - return deferred.promise; - } -}; -var ParserWorker = class { - get ready() { - return this._ready; - } - get onReady() { - return this.onReadyEmitter.event; - } - constructor(sendMessage, onMessage, onError, terminate) { - this.onReadyEmitter = new event_exports.Emitter(); - this.deferred = new Deferred(); - this._ready = true; - this._parsing = false; - this.sendMessage = sendMessage; - this._terminate = terminate; - onMessage((result) => { - const parseResult = result; - this.deferred.resolve(parseResult); - this.unlock(); - }); - onError((error) => { - this.deferred.reject(error); - this.unlock(); - }); - } - terminate() { - this.deferred.reject(OperationCancelled); - this._terminate(); - } - lock() { - this._ready = false; - } - unlock() { - this._parsing = false; - this._ready = true; - this.onReadyEmitter.fire(); - } - parse(text) { - if (this._parsing) { - throw new Error("Parser worker is busy"); - } - this._parsing = true; - this.deferred = new Deferred(); - this.sendMessage(text); - return this.deferred.promise; - } -}; - -// node_modules/langium/lib/workspace/workspace-lock.js -var DefaultWorkspaceLock = class { - constructor() { - this.previousTokenSource = new cancellation_exports.CancellationTokenSource(); - this.writeQueue = []; - this.readQueue = []; - this.done = true; - } - write(action) { - this.cancelWrite(); - const tokenSource = new cancellation_exports.CancellationTokenSource(); - this.previousTokenSource = tokenSource; - return this.enqueue(this.writeQueue, action, tokenSource.token); - } - read(action) { - return this.enqueue(this.readQueue, action); - } - enqueue(queue, action, cancellationToken) { - const deferred = new Deferred(); - const entry = { - action, - deferred, - cancellationToken: cancellationToken !== null && cancellationToken !== void 0 ? cancellationToken : cancellation_exports.CancellationToken.None - }; - queue.push(entry); - this.performNextOperation(); - return deferred.promise; - } - async performNextOperation() { - if (!this.done) { - return; - } - const entries = []; - if (this.writeQueue.length > 0) { - entries.push(this.writeQueue.shift()); - } else if (this.readQueue.length > 0) { - entries.push(...this.readQueue.splice(0, this.readQueue.length)); - } else { - return; - } - this.done = false; - await Promise.all(entries.map(async ({ action, deferred, cancellationToken }) => { - try { - const result = await Promise.resolve().then(() => action(cancellationToken)); - deferred.resolve(result); - } catch (err) { - if (isOperationCancelled(err)) { - deferred.resolve(void 0); - } else { - deferred.reject(err); - } - } - })); - this.done = true; - this.performNextOperation(); - } - cancelWrite() { - this.previousTokenSource.cancel(); - } -}; - -// node_modules/langium/lib/serializer/hydrator.js -var DefaultHydrator = class { - constructor(services) { - this.grammarElementIdMap = new BiMap(); - this.tokenTypeIdMap = new BiMap(); - this.grammar = services.Grammar; - this.lexer = services.parser.Lexer; - this.linker = services.references.Linker; - } - dehydrate(result) { - return { - // We need to create shallow copies of the errors - // The original errors inherit from the `Error` class, which is not transferable across worker threads - lexerErrors: result.lexerErrors.map((e) => Object.assign({}, e)), - parserErrors: result.parserErrors.map((e) => Object.assign({}, e)), - value: this.dehydrateAstNode(result.value, this.createDehyrationContext(result.value)) - }; - } - createDehyrationContext(node) { - const astNodes = /* @__PURE__ */ new Map(); - const cstNodes = /* @__PURE__ */ new Map(); - for (const astNode of streamAst(node)) { - astNodes.set(astNode, {}); - } - if (node.$cstNode) { - for (const cstNode of streamCst(node.$cstNode)) { - cstNodes.set(cstNode, {}); - } - } - return { - astNodes, - cstNodes - }; - } - dehydrateAstNode(node, context) { - const obj = context.astNodes.get(node); - obj.$type = node.$type; - obj.$containerIndex = node.$containerIndex; - obj.$containerProperty = node.$containerProperty; - if (node.$cstNode !== void 0) { - obj.$cstNode = this.dehydrateCstNode(node.$cstNode, context); - } - for (const [name, value] of Object.entries(node)) { - if (name.startsWith("$")) { - continue; - } - if (Array.isArray(value)) { - const arr = []; - obj[name] = arr; - for (const item of value) { - if (isAstNode(item)) { - arr.push(this.dehydrateAstNode(item, context)); - } else if (isReference(item)) { - arr.push(this.dehydrateReference(item, context)); - } else { - arr.push(item); - } - } - } else if (isAstNode(value)) { - obj[name] = this.dehydrateAstNode(value, context); - } else if (isReference(value)) { - obj[name] = this.dehydrateReference(value, context); - } else if (value !== void 0) { - obj[name] = value; - } - } - return obj; - } - dehydrateReference(reference, context) { - const obj = {}; - obj.$refText = reference.$refText; - if (reference.$refNode) { - obj.$refNode = context.cstNodes.get(reference.$refNode); - } - return obj; - } - dehydrateCstNode(node, context) { - const cstNode = context.cstNodes.get(node); - if (isRootCstNode(node)) { - cstNode.fullText = node.fullText; - } else { - cstNode.grammarSource = this.getGrammarElementId(node.grammarSource); - } - cstNode.hidden = node.hidden; - cstNode.astNode = context.astNodes.get(node.astNode); - if (isCompositeCstNode(node)) { - cstNode.content = node.content.map((child) => this.dehydrateCstNode(child, context)); - } else if (isLeafCstNode(node)) { - cstNode.tokenType = node.tokenType.name; - cstNode.offset = node.offset; - cstNode.length = node.length; - cstNode.startLine = node.range.start.line; - cstNode.startColumn = node.range.start.character; - cstNode.endLine = node.range.end.line; - cstNode.endColumn = node.range.end.character; - } - return cstNode; - } - hydrate(result) { - const node = result.value; - const context = this.createHydrationContext(node); - if ("$cstNode" in node) { - this.hydrateCstNode(node.$cstNode, context); - } - return { - lexerErrors: result.lexerErrors, - parserErrors: result.parserErrors, - value: this.hydrateAstNode(node, context) - }; - } - createHydrationContext(node) { - const astNodes = /* @__PURE__ */ new Map(); - const cstNodes = /* @__PURE__ */ new Map(); - for (const astNode of streamAst(node)) { - astNodes.set(astNode, {}); - } - let root2; - if (node.$cstNode) { - for (const cstNode of streamCst(node.$cstNode)) { - let cst; - if ("fullText" in cstNode) { - cst = new RootCstNodeImpl(cstNode.fullText); - root2 = cst; - } else if ("content" in cstNode) { - cst = new CompositeCstNodeImpl(); - } else if ("tokenType" in cstNode) { - cst = this.hydrateCstLeafNode(cstNode); - } - if (cst) { - cstNodes.set(cstNode, cst); - cst.root = root2; - } - } - } - return { - astNodes, - cstNodes - }; - } - hydrateAstNode(node, context) { - const astNode = context.astNodes.get(node); - astNode.$type = node.$type; - astNode.$containerIndex = node.$containerIndex; - astNode.$containerProperty = node.$containerProperty; - if (node.$cstNode) { - astNode.$cstNode = context.cstNodes.get(node.$cstNode); - } - for (const [name, value] of Object.entries(node)) { - if (name.startsWith("$")) { - continue; - } - if (Array.isArray(value)) { - const arr = []; - astNode[name] = arr; - for (const item of value) { - if (isAstNode(item)) { - arr.push(this.setParent(this.hydrateAstNode(item, context), astNode)); - } else if (isReference(item)) { - arr.push(this.hydrateReference(item, astNode, name, context)); - } else { - arr.push(item); - } - } - } else if (isAstNode(value)) { - astNode[name] = this.setParent(this.hydrateAstNode(value, context), astNode); - } else if (isReference(value)) { - astNode[name] = this.hydrateReference(value, astNode, name, context); - } else if (value !== void 0) { - astNode[name] = value; - } - } - return astNode; - } - setParent(node, parent) { - node.$container = parent; - return node; - } - hydrateReference(reference, node, name, context) { - return this.linker.buildReference(node, name, context.cstNodes.get(reference.$refNode), reference.$refText); - } - hydrateCstNode(cstNode, context, num = 0) { - const cstNodeObj = context.cstNodes.get(cstNode); - if (typeof cstNode.grammarSource === "number") { - cstNodeObj.grammarSource = this.getGrammarElement(cstNode.grammarSource); - } - cstNodeObj.astNode = context.astNodes.get(cstNode.astNode); - if (isCompositeCstNode(cstNodeObj)) { - for (const child of cstNode.content) { - const hydrated = this.hydrateCstNode(child, context, num++); - cstNodeObj.content.push(hydrated); - } - } - return cstNodeObj; - } - hydrateCstLeafNode(cstNode) { - const tokenType = this.getTokenType(cstNode.tokenType); - const offset = cstNode.offset; - const length = cstNode.length; - const startLine = cstNode.startLine; - const startColumn = cstNode.startColumn; - const endLine = cstNode.endLine; - const endColumn = cstNode.endColumn; - const hidden = cstNode.hidden; - const node = new LeafCstNodeImpl(offset, length, { - start: { - line: startLine, - character: startColumn - }, - end: { - line: endLine, - character: endColumn - } - }, tokenType, hidden); - return node; - } - getTokenType(name) { - return this.lexer.definition[name]; - } - getGrammarElementId(node) { - if (this.grammarElementIdMap.size === 0) { - this.createGrammarElementIdMap(); - } - return this.grammarElementIdMap.get(node); - } - getGrammarElement(id) { - if (this.grammarElementIdMap.size === 0) { - this.createGrammarElementIdMap(); - } - const element = this.grammarElementIdMap.getKey(id); - if (element) { - return element; - } else { - throw new Error("Invalid grammar element id: " + id); - } - } - createGrammarElementIdMap() { - let id = 0; - for (const element of streamAst(this.grammar)) { - if (isAbstractElement(element)) { - this.grammarElementIdMap.set(element, id++); - } - } - } -}; - -// node_modules/langium/lib/default-module.js -function createDefaultCoreModule(context) { - return { - documentation: { - CommentProvider: (services) => new DefaultCommentProvider(services), - DocumentationProvider: (services) => new JSDocDocumentationProvider(services) - }, - parser: { - AsyncParser: (services) => new DefaultAsyncParser(services), - GrammarConfig: (services) => createGrammarConfig(services), - LangiumParser: (services) => createLangiumParser(services), - CompletionParser: (services) => createCompletionParser(services), - ValueConverter: () => new DefaultValueConverter(), - TokenBuilder: () => new DefaultTokenBuilder(), - Lexer: (services) => new DefaultLexer(services), - ParserErrorMessageProvider: () => new LangiumParserErrorMessageProvider() - }, - workspace: { - AstNodeLocator: () => new DefaultAstNodeLocator(), - AstNodeDescriptionProvider: (services) => new DefaultAstNodeDescriptionProvider(services), - ReferenceDescriptionProvider: (services) => new DefaultReferenceDescriptionProvider(services) - }, - references: { - Linker: (services) => new DefaultLinker(services), - NameProvider: () => new DefaultNameProvider(), - ScopeProvider: (services) => new DefaultScopeProvider(services), - ScopeComputation: (services) => new DefaultScopeComputation(services), - References: (services) => new DefaultReferences(services) - }, - serializer: { - Hydrator: (services) => new DefaultHydrator(services), - JsonSerializer: (services) => new DefaultJsonSerializer(services) - }, - validation: { - DocumentValidator: (services) => new DefaultDocumentValidator(services), - ValidationRegistry: (services) => new ValidationRegistry(services) - }, - shared: () => context.shared - }; -} -function createDefaultSharedCoreModule(context) { - return { - ServiceRegistry: () => new DefaultServiceRegistry(), - workspace: { - LangiumDocuments: (services) => new DefaultLangiumDocuments(services), - LangiumDocumentFactory: (services) => new DefaultLangiumDocumentFactory(services), - DocumentBuilder: (services) => new DefaultDocumentBuilder(services), - IndexManager: (services) => new DefaultIndexManager(services), - WorkspaceManager: (services) => new DefaultWorkspaceManager(services), - FileSystemProvider: (services) => context.fileSystemProvider(services), - WorkspaceLock: () => new DefaultWorkspaceLock(), - ConfigurationProvider: (services) => new DefaultConfigurationProvider(services) - } - }; -} - -// node_modules/langium/lib/dependency-injection.js -var Module; -(function(Module2) { - Module2.merge = (m1, m2) => _merge(_merge({}, m1), m2); -})(Module || (Module = {})); -function inject(module1, module2, module3, module4, module5, module6, module7, module8, module9) { - const module10 = [module1, module2, module3, module4, module5, module6, module7, module8, module9].reduce(_merge, {}); - return _inject(module10); -} -var isProxy = Symbol("isProxy"); -function eagerLoad(item) { - if (item && item[isProxy]) { - for (const value of Object.values(item)) { - eagerLoad(value); - } - } - return item; -} -function _inject(module2, injector) { - const proxy = new Proxy({}, { - deleteProperty: () => false, - get: (obj, prop) => _resolve(obj, prop, module2, injector || proxy), - getOwnPropertyDescriptor: (obj, prop) => (_resolve(obj, prop, module2, injector || proxy), Object.getOwnPropertyDescriptor(obj, prop)), - has: (_2, prop) => prop in module2, - ownKeys: () => [...Reflect.ownKeys(module2), isProxy] - // used by for..in - }); - proxy[isProxy] = true; - return proxy; -} -var __requested__ = Symbol(); -function _resolve(obj, prop, module2, injector) { - if (prop in obj) { - if (obj[prop] instanceof Error) { - throw new Error("Construction failure. Please make sure that your dependencies are constructable.", { cause: obj[prop] }); - } - if (obj[prop] === __requested__) { - throw new Error('Cycle detected. Please make "' + String(prop) + '" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies'); - } - return obj[prop]; - } else if (prop in module2) { - const value = module2[prop]; - obj[prop] = __requested__; - try { - obj[prop] = typeof value === "function" ? value(injector) : _inject(value, injector); - } catch (error) { - obj[prop] = error instanceof Error ? error : void 0; - throw error; - } - return obj[prop]; - } else { - return void 0; - } -} -function _merge(target, source) { - if (source) { - for (const [key, value2] of Object.entries(source)) { - if (value2 !== void 0) { - const value1 = target[key]; - if (value1 !== null && value2 !== null && typeof value1 === "object" && typeof value2 === "object") { - target[key] = _merge(value1, value2); - } else { - target[key] = value2; - } - } - } - } - return target; -} - -// node_modules/langium/lib/lsp/document-highlight-provider.js -var import_vscode_languageserver4 = __toESM(require_main4(), 1); -var DefaultDocumentHighlightProvider = class { - constructor(services) { - this.references = services.references.References; - this.nameProvider = services.references.NameProvider; - this.grammarConfig = services.parser.GrammarConfig; - } - getDocumentHighlight(document, params) { - const rootNode = document.parseResult.value.$cstNode; - if (!rootNode) { - return void 0; - } - const selectedNode = findDeclarationNodeAtOffset(rootNode, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp); - if (!selectedNode) { - return void 0; - } - const targetAstNode = this.references.findDeclaration(selectedNode); - if (targetAstNode) { - const includeDeclaration = UriUtils.equals(getDocument(targetAstNode).uri, document.uri); - const options = { documentUri: document.uri, includeDeclaration }; - const references = this.references.findReferences(targetAstNode, options); - return references.map((ref) => this.createDocumentHighlight(ref)).toArray(); - } - return void 0; - } - /** - * Override this method to determine the highlight kind of the given reference. - */ - createDocumentHighlight(reference) { - return import_vscode_languageserver4.DocumentHighlight.create(reference.segment.range); - } -}; - -// node_modules/langium/lib/lsp/document-symbol-provider.js -var DefaultDocumentSymbolProvider = class { - constructor(services) { - this.nameProvider = services.references.NameProvider; - this.nodeKindProvider = services.shared.lsp.NodeKindProvider; - } - getSymbols(document) { - return this.getSymbol(document, document.parseResult.value); - } - getSymbol(document, astNode) { - const node = astNode.$cstNode; - const nameNode = this.nameProvider.getNameNode(astNode); - if (nameNode && node) { - const name = this.nameProvider.getName(astNode); - return [{ - kind: this.nodeKindProvider.getSymbolKind(astNode), - name: name !== null && name !== void 0 ? name : nameNode.text, - range: node.range, - selectionRange: nameNode.range, - children: this.getChildSymbols(document, astNode) - }]; - } else { - return this.getChildSymbols(document, astNode) || []; - } - } - getChildSymbols(document, astNode) { - const children = []; - for (const child of streamContents(astNode)) { - const result = this.getSymbol(document, child); - children.push(...result); - } - if (children.length > 0) { - return children; - } - return void 0; - } -}; - -// node_modules/langium/lib/lsp/document-update-handler.js -var import_vscode_languageserver5 = __toESM(require_main4(), 1); -var DefaultDocumentUpdateHandler = class { - constructor(services) { - this.workspaceManager = services.workspace.WorkspaceManager; - this.documentBuilder = services.workspace.DocumentBuilder; - this.workspaceLock = services.workspace.WorkspaceLock; - let canRegisterFileWatcher = false; - services.lsp.LanguageServer.onInitialize((params) => { - var _a, _b; - canRegisterFileWatcher = Boolean((_b = (_a = params.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.didChangeWatchedFiles) === null || _b === void 0 ? void 0 : _b.dynamicRegistration); - }); - services.lsp.LanguageServer.onInitialized((_params) => { - if (canRegisterFileWatcher) { - this.registerFileWatcher(services); - } - }); - } - registerFileWatcher(services) { - const fileExtensions = stream(services.ServiceRegistry.all).flatMap((language) => language.LanguageMetaData.fileExtensions).map((ext) => ext.startsWith(".") ? ext.substring(1) : ext).distinct().toArray(); - if (fileExtensions.length > 0) { - const connection2 = services.lsp.Connection; - const options = { - watchers: [{ - globPattern: fileExtensions.length === 1 ? `**/*.${fileExtensions[0]}` : `**/*.{${fileExtensions.join(",")}}` - }] - }; - connection2 === null || connection2 === void 0 ? void 0 : connection2.client.register(import_vscode_languageserver5.DidChangeWatchedFilesNotification.type, options); - } - } - fireDocumentUpdate(changed, deleted) { - this.workspaceManager.ready.then(() => { - this.workspaceLock.write((token) => this.documentBuilder.update(changed, deleted, token)); - }).catch((err) => { - console.error("Workspace initialization failed. Could not perform document update.", err); - }); - } - didChangeContent(change) { - this.fireDocumentUpdate([URI.parse(change.document.uri)], []); - } - didChangeWatchedFiles(params) { - const changedUris = stream(params.changes).filter((c) => c.type !== import_vscode_languageserver5.FileChangeType.Deleted).distinct((c) => c.uri).map((c) => URI.parse(c.uri)).toArray(); - const deletedUris = stream(params.changes).filter((c) => c.type === import_vscode_languageserver5.FileChangeType.Deleted).distinct((c) => c.uri).map((c) => URI.parse(c.uri)).toArray(); - this.fireDocumentUpdate(changedUris, deletedUris); - } -}; - -// node_modules/langium/lib/lsp/folding-range-provider.js -var import_vscode_languageserver6 = __toESM(require_main4(), 1); -var DefaultFoldingRangeProvider = class { - constructor(services) { - this.commentNames = services.parser.GrammarConfig.multilineCommentRules; - } - getFoldingRanges(document) { - const foldings = []; - const acceptor = (foldingRange) => foldings.push(foldingRange); - this.collectFolding(document, acceptor); - return foldings; - } - collectFolding(document, acceptor) { - var _a; - const root2 = (_a = document.parseResult) === null || _a === void 0 ? void 0 : _a.value; - if (root2) { - if (this.shouldProcessContent(root2)) { - const treeIterator = streamAllContents(root2).iterator(); - let result; - do { - result = treeIterator.next(); - if (!result.done) { - const node = result.value; - if (this.shouldProcess(node)) { - this.collectObjectFolding(document, node, acceptor); - } - if (!this.shouldProcessContent(node)) { - treeIterator.prune(); - } - } - } while (!result.done); - } - this.collectCommentFolding(document, root2, acceptor); - } - } - /** - * Template method to determine whether the specified `AstNode` should be handled by the folding range provider. - * Returns true by default for all nodes. Returning false only ignores the specified node and not its content. - * To ignore the content of a node use `shouldProcessContent`. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - shouldProcess(node) { - return true; - } - /** - * Template method to determine whether the content/children of the specified `AstNode` should be handled by the folding range provider. - * Returns true by default for all nodes. Returning false ignores _all_ content of this node, even transitive ones. - * For more precise control over foldings use the `shouldProcess` method. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - shouldProcessContent(node) { - return true; - } - collectObjectFolding(document, node, acceptor) { - const cstNode = node.$cstNode; - if (cstNode) { - const foldingRange = this.toFoldingRange(document, cstNode); - if (foldingRange) { - acceptor(foldingRange); - } - } - } - collectCommentFolding(document, node, acceptor) { - const cstNode = node.$cstNode; - if (cstNode) { - for (const node2 of flattenCst(cstNode)) { - if (this.commentNames.includes(node2.tokenType.name)) { - const foldingRange = this.toFoldingRange(document, node2, import_vscode_languageserver6.FoldingRangeKind.Comment); - if (foldingRange) { - acceptor(foldingRange); - } - } - } - } - } - toFoldingRange(document, node, kind) { - const range = node.range; - const start = range.start; - let end = range.end; - if (end.line - start.line < 2) { - return void 0; - } - if (!this.includeLastFoldingLine(node, kind)) { - end = document.textDocument.positionAt(document.textDocument.offsetAt({ line: end.line, character: 0 }) - 1); - } - return import_vscode_languageserver6.FoldingRange.create(start.line, end.line, start.character, end.character, kind); - } - /** - * Template method to determine whether the folding range for this cst node should include its last line. - * Returns false by default for ast nodes which end in braces and for comments. - */ - includeLastFoldingLine(node, kind) { - if (kind === import_vscode_languageserver6.FoldingRangeKind.Comment) { - return false; - } - const nodeText = node.text; - const endChar = nodeText.charAt(nodeText.length - 1); - if (endChar === "}" || endChar === ")" || endChar === "]") { - return false; - } - return true; - } -}; - -// node_modules/langium/lib/lsp/fuzzy-matcher.js -var DefaultFuzzyMatcher = class { - match(query, text) { - if (query.length === 0) { - return true; - } - text = text.toLowerCase(); - let matchedFirstCharacter = false; - let previous; - let character = 0; - const len = text.length; - for (let i = 0; i < len; i++) { - const strChar = text.charCodeAt(i); - const testChar = query.charCodeAt(character); - if (strChar === testChar || this.toUpperCharCode(strChar) === this.toUpperCharCode(testChar)) { - matchedFirstCharacter || (matchedFirstCharacter = previous === void 0 || // Beginning of word - this.isWordTransition(previous, strChar)); - if (matchedFirstCharacter) { - character++; - } - if (character === query.length) { - return true; - } - } - previous = strChar; - } - return false; - } - isWordTransition(previous, current) { - return a <= previous && previous <= z && A <= current && current <= Z || // camelCase transition - previous === _ && current !== _; - } - toUpperCharCode(charCode) { - if (a <= charCode && charCode <= z) { - return charCode - 32; - } - return charCode; - } -}; -var a = "a".charCodeAt(0); -var z = "z".charCodeAt(0); -var A = "A".charCodeAt(0); -var Z = "Z".charCodeAt(0); -var _ = "_".charCodeAt(0); - -// node_modules/langium/lib/lsp/hover-provider.js -var AstNodeHoverProvider = class { - constructor(services) { - this.references = services.references.References; - this.grammarConfig = services.parser.GrammarConfig; - } - getHoverContent(document, params) { - var _a, _b; - const rootNode = (_b = (_a = document.parseResult) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.$cstNode; - if (rootNode) { - const offset = document.textDocument.offsetAt(params.position); - const cstNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp); - if (cstNode && cstNode.offset + cstNode.length > offset) { - const targetNode = this.references.findDeclaration(cstNode); - if (targetNode) { - return this.getAstNodeHoverContent(targetNode); - } - } - } - return void 0; - } -}; -var MultilineCommentHoverProvider = class extends AstNodeHoverProvider { - constructor(services) { - super(services); - this.documentationProvider = services.documentation.DocumentationProvider; - } - getAstNodeHoverContent(node) { - const content = this.documentationProvider.getDocumentation(node); - if (content) { - return { - contents: { - kind: "markdown", - value: content - } - }; - } - return void 0; - } -}; - -// node_modules/langium/lib/lsp/language-server.js -var import_vscode_languageserver_protocol = __toESM(require_main3(), 1); - -// node_modules/langium/lib/lsp/semantic-token-provider.js -var import_vscode_languageserver7 = __toESM(require_main4(), 1); -var AllSemanticTokenTypes = { - [import_vscode_languageserver7.SemanticTokenTypes.class]: 0, - [import_vscode_languageserver7.SemanticTokenTypes.comment]: 1, - [import_vscode_languageserver7.SemanticTokenTypes.enum]: 2, - [import_vscode_languageserver7.SemanticTokenTypes.enumMember]: 3, - [import_vscode_languageserver7.SemanticTokenTypes.event]: 4, - [import_vscode_languageserver7.SemanticTokenTypes.function]: 5, - [import_vscode_languageserver7.SemanticTokenTypes.interface]: 6, - [import_vscode_languageserver7.SemanticTokenTypes.keyword]: 7, - [import_vscode_languageserver7.SemanticTokenTypes.macro]: 8, - [import_vscode_languageserver7.SemanticTokenTypes.method]: 9, - [import_vscode_languageserver7.SemanticTokenTypes.modifier]: 10, - [import_vscode_languageserver7.SemanticTokenTypes.namespace]: 11, - [import_vscode_languageserver7.SemanticTokenTypes.number]: 12, - [import_vscode_languageserver7.SemanticTokenTypes.operator]: 13, - [import_vscode_languageserver7.SemanticTokenTypes.parameter]: 14, - [import_vscode_languageserver7.SemanticTokenTypes.property]: 15, - [import_vscode_languageserver7.SemanticTokenTypes.regexp]: 16, - [import_vscode_languageserver7.SemanticTokenTypes.string]: 17, - [import_vscode_languageserver7.SemanticTokenTypes.struct]: 18, - [import_vscode_languageserver7.SemanticTokenTypes.type]: 19, - [import_vscode_languageserver7.SemanticTokenTypes.typeParameter]: 20, - [import_vscode_languageserver7.SemanticTokenTypes.variable]: 21, - [import_vscode_languageserver7.SemanticTokenTypes.decorator]: 22 -}; -var AllSemanticTokenModifiers = { - [import_vscode_languageserver7.SemanticTokenModifiers.abstract]: 1 << 0, - [import_vscode_languageserver7.SemanticTokenModifiers.async]: 1 << 1, - [import_vscode_languageserver7.SemanticTokenModifiers.declaration]: 1 << 2, - [import_vscode_languageserver7.SemanticTokenModifiers.defaultLibrary]: 1 << 3, - [import_vscode_languageserver7.SemanticTokenModifiers.definition]: 1 << 4, - [import_vscode_languageserver7.SemanticTokenModifiers.deprecated]: 1 << 5, - [import_vscode_languageserver7.SemanticTokenModifiers.documentation]: 1 << 6, - [import_vscode_languageserver7.SemanticTokenModifiers.modification]: 1 << 7, - [import_vscode_languageserver7.SemanticTokenModifiers.readonly]: 1 << 8, - [import_vscode_languageserver7.SemanticTokenModifiers.static]: 1 << 9 -}; -var DefaultSemanticTokenOptions = { - legend: { - tokenTypes: Object.keys(AllSemanticTokenTypes), - tokenModifiers: Object.keys(AllSemanticTokenModifiers) - }, - full: { - delta: true - }, - range: true -}; -var SemanticTokensDecoder; -(function(SemanticTokensDecoder2) { - function decode(tokens, document) { - const typeMap = /* @__PURE__ */ new Map(); - Object.entries(AllSemanticTokenTypes).forEach(([type, index]) => typeMap.set(index, type)); - let line = 0; - let character = 0; - return sliceIntoChunks(tokens.data, 5).map((t) => { - line += t[0]; - if (t[0] !== 0) { - character = 0; - } - character += t[1]; - const length = t[2]; - const offset = document.textDocument.offsetAt({ line, character }); - return { - offset, - tokenType: typeMap.get(t[3]), - tokenModifiers: t[4], - text: document.textDocument.getText({ start: { line, character }, end: { line, character: character + length } }) - }; - }); - } - SemanticTokensDecoder2.decode = decode; - function sliceIntoChunks(arr, chunkSize) { - const res = []; - for (let i = 0; i < arr.length; i += chunkSize) { - const chunk = arr.slice(i, i + chunkSize); - res.push(chunk); - } - return res; - } -})(SemanticTokensDecoder || (SemanticTokensDecoder = {})); - -// node_modules/langium/lib/lsp/signature-help-provider.js -function mergeSignatureHelpOptions(options) { - const triggerCharacters = []; - const retriggerCharacters = []; - options.forEach((option2) => { - if (option2 === null || option2 === void 0 ? void 0 : option2.triggerCharacters) { - triggerCharacters.push(...option2.triggerCharacters); - } - if (option2 === null || option2 === void 0 ? void 0 : option2.retriggerCharacters) { - retriggerCharacters.push(...option2.retriggerCharacters); - } - }); - const mergedOptions = { - triggerCharacters: triggerCharacters.length > 0 ? Array.from(new Set(triggerCharacters)).sort() : void 0, - retriggerCharacters: retriggerCharacters.length > 0 ? Array.from(new Set(retriggerCharacters)).sort() : void 0 - }; - return mergedOptions.triggerCharacters ? mergedOptions : void 0; -} - -// node_modules/langium/lib/lsp/language-server.js -var DefaultLanguageServer = class { - constructor(services) { - this.onInitializeEmitter = new import_vscode_languageserver_protocol.Emitter(); - this.onInitializedEmitter = new import_vscode_languageserver_protocol.Emitter(); - this.services = services; - } - get onInitialize() { - return this.onInitializeEmitter.event; - } - get onInitialized() { - return this.onInitializedEmitter.event; - } - async initialize(params) { - this.eagerLoadServices(); - this.fireInitializeOnDefaultServices(params); - this.onInitializeEmitter.fire(params); - this.onInitializeEmitter.dispose(); - return this.buildInitializeResult(params); - } - /** - * Eagerly loads all services before emitting the `onInitialize` event. - * Ensures that all services are able to catch the event. - */ - eagerLoadServices() { - eagerLoad(this.services); - this.services.ServiceRegistry.all.forEach((language) => eagerLoad(language)); - } - hasService(callback) { - const allServices = this.services.ServiceRegistry.all; - return allServices.some((services) => callback(services) !== void 0); - } - buildInitializeResult(_params) { - var _a, _b, _c, _d; - const fileOperationOptions = (_a = this.services.lsp.FileOperationHandler) === null || _a === void 0 ? void 0 : _a.fileOperationOptions; - const allServices = this.services.ServiceRegistry.all; - const hasFormattingService = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.Formatter; - }); - const formattingOnTypeOptions = allServices.map((e) => { - var _a2, _b2; - return (_b2 = (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.Formatter) === null || _b2 === void 0 ? void 0 : _b2.formatOnTypeOptions; - }).find((e) => Boolean(e)); - const hasCodeActionProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.CodeActionProvider; - }); - const hasSemanticTokensProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.SemanticTokenProvider; - }); - const commandNames = (_c = (_b = this.services.lsp) === null || _b === void 0 ? void 0 : _b.ExecuteCommandHandler) === null || _c === void 0 ? void 0 : _c.commands; - const hasDocumentLinkProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.DocumentLinkProvider; - }); - const signatureHelpOptions = mergeSignatureHelpOptions(allServices.map((e) => { - var _a2, _b2; - return (_b2 = (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.SignatureHelp) === null || _b2 === void 0 ? void 0 : _b2.signatureHelpOptions; - })); - const hasGoToTypeProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.TypeProvider; - }); - const hasGoToImplementationProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.ImplementationProvider; - }); - const hasCompletionProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.CompletionProvider; - }); - const completionOptions = mergeCompletionProviderOptions(allServices.map((e) => { - var _a2, _b2; - return (_b2 = (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.CompletionProvider) === null || _b2 === void 0 ? void 0 : _b2.completionOptions; - })); - const hasReferencesProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.ReferencesProvider; - }); - const hasDocumentSymbolProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.DocumentSymbolProvider; - }); - const hasDefinitionProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.DefinitionProvider; - }); - const hasDocumentHighlightProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.DocumentHighlightProvider; - }); - const hasFoldingRangeProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.FoldingRangeProvider; - }); - const hasHoverProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.HoverProvider; - }); - const hasRenameProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.RenameProvider; - }); - const hasCallHierarchyProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.CallHierarchyProvider; - }); - const hasTypeHierarchyProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.TypeHierarchyProvider; - }); - const hasCodeLensProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.CodeLensProvider; - }); - const hasDeclarationProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.DeclarationProvider; - }); - const hasInlayHintProvider = this.hasService((e) => { - var _a2; - return (_a2 = e.lsp) === null || _a2 === void 0 ? void 0 : _a2.InlayHintProvider; - }); - const workspaceSymbolProvider = (_d = this.services.lsp) === null || _d === void 0 ? void 0 : _d.WorkspaceSymbolProvider; - const result = { - capabilities: { - workspace: { - workspaceFolders: { - supported: true - }, - fileOperations: fileOperationOptions - }, - executeCommandProvider: commandNames && { - commands: commandNames - }, - textDocumentSync: import_vscode_languageserver_protocol.TextDocumentSyncKind.Incremental, - completionProvider: hasCompletionProvider ? completionOptions : void 0, - referencesProvider: hasReferencesProvider, - documentSymbolProvider: hasDocumentSymbolProvider, - definitionProvider: hasDefinitionProvider, - typeDefinitionProvider: hasGoToTypeProvider, - documentHighlightProvider: hasDocumentHighlightProvider, - codeActionProvider: hasCodeActionProvider, - documentFormattingProvider: hasFormattingService, - documentRangeFormattingProvider: hasFormattingService, - documentOnTypeFormattingProvider: formattingOnTypeOptions, - foldingRangeProvider: hasFoldingRangeProvider, - hoverProvider: hasHoverProvider, - renameProvider: hasRenameProvider ? { - prepareProvider: true - } : void 0, - semanticTokensProvider: hasSemanticTokensProvider ? DefaultSemanticTokenOptions : void 0, - signatureHelpProvider: signatureHelpOptions, - implementationProvider: hasGoToImplementationProvider, - callHierarchyProvider: hasCallHierarchyProvider ? {} : void 0, - typeHierarchyProvider: hasTypeHierarchyProvider ? {} : void 0, - documentLinkProvider: hasDocumentLinkProvider ? { resolveProvider: false } : void 0, - codeLensProvider: hasCodeLensProvider ? { resolveProvider: false } : void 0, - declarationProvider: hasDeclarationProvider, - inlayHintProvider: hasInlayHintProvider ? { resolveProvider: false } : void 0, - workspaceSymbolProvider: workspaceSymbolProvider ? { resolveProvider: Boolean(workspaceSymbolProvider.resolveSymbol) } : void 0 - } - }; - return result; - } - initialized(params) { - this.fireInitializedOnDefaultServices(params); - this.onInitializedEmitter.fire(params); - this.onInitializedEmitter.dispose(); - } - fireInitializeOnDefaultServices(params) { - this.services.workspace.ConfigurationProvider.initialize(params); - this.services.workspace.WorkspaceManager.initialize(params); - } - fireInitializedOnDefaultServices(params) { - const connection2 = this.services.lsp.Connection; - const configurationParams = connection2 ? Object.assign(Object.assign({}, params), { register: (params2) => connection2.client.register(import_vscode_languageserver_protocol.DidChangeConfigurationNotification.type, params2), fetchConfiguration: (params2) => connection2.workspace.getConfiguration(params2) }) : params; - this.services.workspace.ConfigurationProvider.initialized(configurationParams).catch((err) => console.error("Error in ConfigurationProvider initialization:", err)); - this.services.workspace.WorkspaceManager.initialized(params).catch((err) => console.error("Error in WorkspaceManager initialization:", err)); - } -}; -function startLanguageServer(services) { - const connection2 = services.lsp.Connection; - if (!connection2) { - throw new Error("Starting a language server requires the languageServer.Connection service to be set."); - } - addDocumentUpdateHandler(connection2, services); - addFileOperationHandler(connection2, services); - addDiagnosticsHandler(connection2, services); - addCompletionHandler(connection2, services); - addFindReferencesHandler(connection2, services); - addDocumentSymbolHandler(connection2, services); - addGotoDefinitionHandler(connection2, services); - addGoToTypeDefinitionHandler(connection2, services); - addGoToImplementationHandler(connection2, services); - addDocumentHighlightsHandler(connection2, services); - addFoldingRangeHandler(connection2, services); - addFormattingHandler(connection2, services); - addCodeActionHandler(connection2, services); - addRenameHandler(connection2, services); - addHoverHandler(connection2, services); - addInlayHintHandler(connection2, services); - addSemanticTokenHandler(connection2, services); - addExecuteCommandHandler(connection2, services); - addSignatureHelpHandler(connection2, services); - addCallHierarchyHandler(connection2, services); - addTypeHierarchyHandler(connection2, services); - addCodeLensHandler(connection2, services); - addDocumentLinkHandler(connection2, services); - addConfigurationChangeHandler(connection2, services); - addGoToDeclarationHandler(connection2, services); - addWorkspaceSymbolHandler(connection2, services); - connection2.onInitialize((params) => { - return services.lsp.LanguageServer.initialize(params); - }); - connection2.onInitialized((params) => { - services.lsp.LanguageServer.initialized(params); - }); - const documents = services.workspace.TextDocuments; - documents.listen(connection2); - connection2.listen(); -} -function addDocumentUpdateHandler(connection2, services) { - const handler = services.lsp.DocumentUpdateHandler; - const documents = services.workspace.TextDocuments; - documents.onDidChangeContent((change) => handler.didChangeContent(change)); - connection2.onDidChangeWatchedFiles((params) => handler.didChangeWatchedFiles(params)); -} -function addFileOperationHandler(connection2, services) { - const handler = services.lsp.FileOperationHandler; - if (!handler) { - return; - } - if (handler.didCreateFiles) { - connection2.workspace.onDidCreateFiles((params) => handler.didCreateFiles(params)); - } - if (handler.didRenameFiles) { - connection2.workspace.onDidRenameFiles((params) => handler.didRenameFiles(params)); - } - if (handler.didDeleteFiles) { - connection2.workspace.onDidDeleteFiles((params) => handler.didDeleteFiles(params)); - } - if (handler.willCreateFiles) { - connection2.workspace.onWillCreateFiles((params) => handler.willCreateFiles(params)); - } - if (handler.willRenameFiles) { - connection2.workspace.onWillRenameFiles((params) => handler.willRenameFiles(params)); - } - if (handler.willDeleteFiles) { - connection2.workspace.onWillDeleteFiles((params) => handler.willDeleteFiles(params)); - } -} -function addDiagnosticsHandler(connection2, services) { - const documentBuilder = services.workspace.DocumentBuilder; - documentBuilder.onBuildPhase(DocumentState.Validated, async (documents, cancelToken) => { - for (const document of documents) { - if (document.diagnostics) { - connection2.sendDiagnostics({ - uri: document.uri.toString(), - diagnostics: document.diagnostics - }); - } - if (cancelToken.isCancellationRequested) { - return; - } - } - }); -} -function addCompletionHandler(connection2, services) { - connection2.onCompletion(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CompletionProvider) === null || _b === void 0 ? void 0 : _b.getCompletion(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addFindReferencesHandler(connection2, services) { - connection2.onReferences(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.ReferencesProvider) === null || _b === void 0 ? void 0 : _b.findReferences(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addCodeActionHandler(connection2, services) { - connection2.onCodeAction(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CodeActionProvider) === null || _b === void 0 ? void 0 : _b.getCodeActions(document, params, cancelToken); - }, services, DocumentState.Validated)); -} -function addDocumentSymbolHandler(connection2, services) { - connection2.onDocumentSymbol(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.DocumentSymbolProvider) === null || _b === void 0 ? void 0 : _b.getSymbols(document, params, cancelToken); - }, services, DocumentState.Parsed)); -} -function addGotoDefinitionHandler(connection2, services) { - connection2.onDefinition(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.DefinitionProvider) === null || _b === void 0 ? void 0 : _b.getDefinition(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addGoToTypeDefinitionHandler(connection2, services) { - connection2.onTypeDefinition(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.TypeProvider) === null || _b === void 0 ? void 0 : _b.getTypeDefinition(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addGoToImplementationHandler(connection2, services) { - connection2.onImplementation(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.ImplementationProvider) === null || _b === void 0 ? void 0 : _b.getImplementation(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addGoToDeclarationHandler(connection2, services) { - connection2.onDeclaration(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.DeclarationProvider) === null || _b === void 0 ? void 0 : _b.getDeclaration(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addDocumentHighlightsHandler(connection2, services) { - connection2.onDocumentHighlight(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.DocumentHighlightProvider) === null || _b === void 0 ? void 0 : _b.getDocumentHighlight(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addHoverHandler(connection2, services) { - connection2.onHover(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.HoverProvider) === null || _b === void 0 ? void 0 : _b.getHoverContent(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addFoldingRangeHandler(connection2, services) { - connection2.onFoldingRanges(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.FoldingRangeProvider) === null || _b === void 0 ? void 0 : _b.getFoldingRanges(document, params, cancelToken); - }, services, DocumentState.Parsed)); -} -function addFormattingHandler(connection2, services) { - connection2.onDocumentFormatting(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.Formatter) === null || _b === void 0 ? void 0 : _b.formatDocument(document, params, cancelToken); - }, services, DocumentState.Parsed)); - connection2.onDocumentRangeFormatting(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.Formatter) === null || _b === void 0 ? void 0 : _b.formatDocumentRange(document, params, cancelToken); - }, services, DocumentState.Parsed)); - connection2.onDocumentOnTypeFormatting(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.Formatter) === null || _b === void 0 ? void 0 : _b.formatDocumentOnType(document, params, cancelToken); - }, services, DocumentState.Parsed)); -} -function addRenameHandler(connection2, services) { - connection2.onRenameRequest(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.RenameProvider) === null || _b === void 0 ? void 0 : _b.rename(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); - connection2.onPrepareRename(createRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.RenameProvider) === null || _b === void 0 ? void 0 : _b.prepareRename(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addInlayHintHandler(connection2, services) { - connection2.languages.inlayHint.on(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.InlayHintProvider) === null || _b === void 0 ? void 0 : _b.getInlayHints(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addSemanticTokenHandler(connection2, services) { - const emptyResult = { data: [] }; - connection2.languages.semanticTokens.on(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.SemanticTokenProvider) { - return services2.lsp.SemanticTokenProvider.semanticHighlight(document, params, cancelToken); - } - return emptyResult; - }, services, DocumentState.IndexedReferences)); - connection2.languages.semanticTokens.onDelta(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.SemanticTokenProvider) { - return services2.lsp.SemanticTokenProvider.semanticHighlightDelta(document, params, cancelToken); - } - return emptyResult; - }, services, DocumentState.IndexedReferences)); - connection2.languages.semanticTokens.onRange(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.SemanticTokenProvider) { - return services2.lsp.SemanticTokenProvider.semanticHighlightRange(document, params, cancelToken); - } - return emptyResult; - }, services, DocumentState.IndexedReferences)); -} -function addConfigurationChangeHandler(connection2, services) { - connection2.onDidChangeConfiguration((change) => { - if (change.settings) { - services.workspace.ConfigurationProvider.updateConfiguration(change); - } - }); -} -function addExecuteCommandHandler(connection2, services) { - const commandHandler = services.lsp.ExecuteCommandHandler; - if (commandHandler) { - connection2.onExecuteCommand(async (params, token) => { - var _a; - try { - return await commandHandler.executeCommand(params.command, (_a = params.arguments) !== null && _a !== void 0 ? _a : [], token); - } catch (err) { - return responseError(err); - } - }); - } -} -function addDocumentLinkHandler(connection2, services) { - connection2.onDocumentLinks(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.DocumentLinkProvider) === null || _b === void 0 ? void 0 : _b.getDocumentLinks(document, params, cancelToken); - }, services, DocumentState.Parsed)); -} -function addSignatureHelpHandler(connection2, services) { - connection2.onSignatureHelp(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.SignatureHelp) === null || _b === void 0 ? void 0 : _b.provideSignatureHelp(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addCodeLensHandler(connection2, services) { - connection2.onCodeLens(createServerRequestHandler((services2, document, params, cancelToken) => { - var _a, _b; - return (_b = (_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CodeLensProvider) === null || _b === void 0 ? void 0 : _b.provideCodeLens(document, params, cancelToken); - }, services, DocumentState.IndexedReferences)); -} -function addWorkspaceSymbolHandler(connection2, services) { - var _a; - const workspaceSymbolProvider = services.lsp.WorkspaceSymbolProvider; - if (workspaceSymbolProvider) { - const documentBuilder = services.workspace.DocumentBuilder; - connection2.onWorkspaceSymbol(async (params, token) => { - try { - await documentBuilder.waitUntil(DocumentState.IndexedContent, token); - return await workspaceSymbolProvider.getSymbols(params, token); - } catch (err) { - return responseError(err); - } - }); - const resolveWorkspaceSymbol = (_a = workspaceSymbolProvider.resolveSymbol) === null || _a === void 0 ? void 0 : _a.bind(workspaceSymbolProvider); - if (resolveWorkspaceSymbol) { - connection2.onWorkspaceSymbolResolve(async (workspaceSymbol, token) => { - try { - await documentBuilder.waitUntil(DocumentState.IndexedContent, token); - return await resolveWorkspaceSymbol(workspaceSymbol, token); - } catch (err) { - return responseError(err); - } - }); - } - } -} -function addCallHierarchyHandler(connection2, services) { - connection2.languages.callHierarchy.onPrepare(createServerRequestHandler(async (services2, document, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CallHierarchyProvider) { - const result = await services2.lsp.CallHierarchyProvider.prepareCallHierarchy(document, params, cancelToken); - return result !== null && result !== void 0 ? result : null; - } - return null; - }, services, DocumentState.IndexedReferences)); - connection2.languages.callHierarchy.onIncomingCalls(createHierarchyRequestHandler(async (services2, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CallHierarchyProvider) { - const result = await services2.lsp.CallHierarchyProvider.incomingCalls(params, cancelToken); - return result !== null && result !== void 0 ? result : null; - } - return null; - }, services)); - connection2.languages.callHierarchy.onOutgoingCalls(createHierarchyRequestHandler(async (services2, params, cancelToken) => { - var _a; - if ((_a = services2.lsp) === null || _a === void 0 ? void 0 : _a.CallHierarchyProvider) { - const result = await services2.lsp.CallHierarchyProvider.outgoingCalls(params, cancelToken); - return result !== null && result !== void 0 ? result : null; - } - return null; - }, services)); -} -function addTypeHierarchyHandler(connection2, sharedServices) { - if (!sharedServices.ServiceRegistry.all.some((services) => { - var _a; - return (_a = services.lsp) === null || _a === void 0 ? void 0 : _a.TypeHierarchyProvider; - })) { - return; - } - connection2.languages.typeHierarchy.onPrepare(createServerRequestHandler(async (services, document, params, cancelToken) => { - var _a, _b; - const result = await ((_b = (_a = services.lsp) === null || _a === void 0 ? void 0 : _a.TypeHierarchyProvider) === null || _b === void 0 ? void 0 : _b.prepareTypeHierarchy(document, params, cancelToken)); - return result !== null && result !== void 0 ? result : null; - }, sharedServices, DocumentState.IndexedReferences)); - connection2.languages.typeHierarchy.onSupertypes(createHierarchyRequestHandler(async (services, params, cancelToken) => { - var _a, _b; - const result = await ((_b = (_a = services.lsp) === null || _a === void 0 ? void 0 : _a.TypeHierarchyProvider) === null || _b === void 0 ? void 0 : _b.supertypes(params, cancelToken)); - return result !== null && result !== void 0 ? result : null; - }, sharedServices)); - connection2.languages.typeHierarchy.onSubtypes(createHierarchyRequestHandler(async (services, params, cancelToken) => { - var _a, _b; - const result = await ((_b = (_a = services.lsp) === null || _a === void 0 ? void 0 : _a.TypeHierarchyProvider) === null || _b === void 0 ? void 0 : _b.subtypes(params, cancelToken)); - return result !== null && result !== void 0 ? result : null; - }, sharedServices)); -} -function createHierarchyRequestHandler(serviceCall, sharedServices) { - const serviceRegistry = sharedServices.ServiceRegistry; - return async (params, cancelToken) => { - const uri = URI.parse(params.item.uri); - const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, DocumentState.IndexedReferences); - if (cancellationError) { - return cancellationError; - } - const language = serviceRegistry.getServices(uri); - if (!language) { - const message = `Could not find service instance for uri: '${uri.toString()}'`; - console.error(message); - throw new Error(message); - } - try { - return await serviceCall(language, params, cancelToken); - } catch (err) { - return responseError(err); - } - }; -} -function createServerRequestHandler(serviceCall, sharedServices, targetState) { - const documents = sharedServices.workspace.LangiumDocuments; - const serviceRegistry = sharedServices.ServiceRegistry; - return async (params, cancelToken) => { - const uri = URI.parse(params.textDocument.uri); - const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, targetState); - if (cancellationError) { - return cancellationError; - } - const language = serviceRegistry.getServices(uri); - if (!language) { - const errorText = `Could not find service instance for uri: '${uri}'`; - console.error(errorText); - throw new Error(errorText); - } - const document = await documents.getOrCreateDocument(uri); - try { - return await serviceCall(language, document, params, cancelToken); - } catch (err) { - return responseError(err); - } - }; -} -function createRequestHandler(serviceCall, sharedServices, targetState) { - const documents = sharedServices.workspace.LangiumDocuments; - const serviceRegistry = sharedServices.ServiceRegistry; - return async (params, cancelToken) => { - const uri = URI.parse(params.textDocument.uri); - const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, targetState); - if (cancellationError) { - return cancellationError; - } - const language = serviceRegistry.getServices(uri); - if (!language) { - console.error(`Could not find service instance for uri: '${uri.toString()}'`); - return null; - } - const document = documents.getDocument(uri); - if (!document) { - return null; - } - try { - return await serviceCall(language, document, params, cancelToken); - } catch (err) { - return responseError(err); - } - }; -} -async function waitUntilPhase(services, cancelToken, uri, targetState) { - if (targetState !== void 0) { - const documentBuilder = services.workspace.DocumentBuilder; - try { - await documentBuilder.waitUntil(targetState, uri, cancelToken); - } catch (err) { - return responseError(err); - } - } - return void 0; -} -function responseError(err) { - if (isOperationCancelled(err)) { - return new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.RequestCancelled, "The request has been cancelled."); - } - if (err instanceof import_vscode_languageserver_protocol.ResponseError) { - return err; - } - throw err; -} - -// node_modules/langium/lib/lsp/node-kind-provider.js -var import_vscode_languageserver8 = __toESM(require_main4(), 1); -var DefaultNodeKindProvider = class { - getSymbolKind() { - return import_vscode_languageserver8.SymbolKind.Field; - } - getCompletionItemKind() { - return import_vscode_languageserver8.CompletionItemKind.Reference; - } -}; - -// node_modules/langium/lib/lsp/references-provider.js -var import_vscode_languageserver9 = __toESM(require_main4(), 1); -var DefaultReferencesProvider = class { - constructor(services) { - this.nameProvider = services.references.NameProvider; - this.references = services.references.References; - this.grammarConfig = services.parser.GrammarConfig; - } - findReferences(document, params) { - const rootNode = document.parseResult.value.$cstNode; - if (!rootNode) { - return []; - } - const selectedNode = findDeclarationNodeAtOffset(rootNode, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp); - if (!selectedNode) { - return []; - } - return this.getReferences(selectedNode, params, document); - } - getReferences(selectedNode, params, _document) { - const locations = []; - const targetAstNode = this.references.findDeclaration(selectedNode); - if (targetAstNode) { - const options = { includeDeclaration: params.context.includeDeclaration }; - this.references.findReferences(targetAstNode, options).forEach((reference) => { - locations.push(import_vscode_languageserver9.Location.create(reference.sourceUri.toString(), reference.segment.range)); - }); - } - return locations; - } -}; - -// node_modules/langium/lib/lsp/rename-provider.js -var DefaultRenameProvider = class { - constructor(services) { - this.references = services.references.References; - this.nameProvider = services.references.NameProvider; - this.grammarConfig = services.parser.GrammarConfig; - } - async rename(document, params) { - const changes = {}; - const rootNode = document.parseResult.value.$cstNode; - if (!rootNode) - return void 0; - const offset = document.textDocument.offsetAt(params.position); - const leafNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp); - if (!leafNode) - return void 0; - const targetNode = this.references.findDeclaration(leafNode); - if (!targetNode) - return void 0; - const options = { onlyLocal: false, includeDeclaration: true }; - const references = this.references.findReferences(targetNode, options); - references.forEach((ref) => { - const change = TextEdit.replace(ref.segment.range, params.newName); - const uri = ref.sourceUri.toString(); - if (changes[uri]) { - changes[uri].push(change); - } else { - changes[uri] = [change]; - } - }); - return { changes }; - } - prepareRename(document, params) { - return this.renameNodeRange(document, params.position); - } - renameNodeRange(doc, position) { - const rootNode = doc.parseResult.value.$cstNode; - const offset = doc.textDocument.offsetAt(position); - if (rootNode && offset) { - const leafNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp); - if (!leafNode) { - return void 0; - } - const isCrossRef = this.references.findDeclaration(leafNode); - if (isCrossRef || this.isNameNode(leafNode)) { - return leafNode.range; - } - } - return void 0; - } - isNameNode(leafNode) { - return (leafNode === null || leafNode === void 0 ? void 0 : leafNode.astNode) && isNamed(leafNode.astNode) && leafNode === this.nameProvider.getNameNode(leafNode.astNode); - } -}; - -// node_modules/langium/lib/lsp/workspace-symbol-provider.js -var DefaultWorkspaceSymbolProvider = class { - constructor(services) { - this.indexManager = services.workspace.IndexManager; - this.nodeKindProvider = services.lsp.NodeKindProvider; - this.fuzzyMatcher = services.lsp.FuzzyMatcher; - } - async getSymbols(params, cancelToken = cancellation_exports.CancellationToken.None) { - const workspaceSymbols = []; - const query = params.query.toLowerCase(); - for (const description of this.indexManager.allElements()) { - await interruptAndCheck(cancelToken); - if (this.fuzzyMatcher.match(query, description.name)) { - const symbol = this.getWorkspaceSymbol(description); - if (symbol) { - workspaceSymbols.push(symbol); - } - } - } - return workspaceSymbols; - } - getWorkspaceSymbol(astDescription) { - const nameSegment = astDescription.nameSegment; - if (nameSegment) { - return { - kind: this.nodeKindProvider.getSymbolKind(astDescription), - name: astDescription.name, - location: { - range: nameSegment.range, - uri: astDescription.documentUri.toString() - } - }; - } else { - return void 0; - } - } -}; - -// node_modules/langium/lib/lsp/default-lsp-module.js -function createDefaultModule(context) { - return Module.merge(createDefaultCoreModule(context), createDefaultLSPModule(context)); -} -function createDefaultLSPModule(context) { - return { - lsp: { - CompletionProvider: (services) => new DefaultCompletionProvider(services), - DocumentSymbolProvider: (services) => new DefaultDocumentSymbolProvider(services), - HoverProvider: (services) => new MultilineCommentHoverProvider(services), - FoldingRangeProvider: (services) => new DefaultFoldingRangeProvider(services), - ReferencesProvider: (services) => new DefaultReferencesProvider(services), - DefinitionProvider: (services) => new DefaultDefinitionProvider(services), - DocumentHighlightProvider: (services) => new DefaultDocumentHighlightProvider(services), - RenameProvider: (services) => new DefaultRenameProvider(services) - }, - shared: () => context.shared - }; -} -function createDefaultSharedModule(context) { - return Module.merge(createDefaultSharedCoreModule(context), createDefaultSharedLSPModule(context)); -} -function createDefaultSharedLSPModule(context) { - return { - lsp: { - Connection: () => context.connection, - LanguageServer: (services) => new DefaultLanguageServer(services), - DocumentUpdateHandler: (services) => new DefaultDocumentUpdateHandler(services), - WorkspaceSymbolProvider: (services) => new DefaultWorkspaceSymbolProvider(services), - NodeKindProvider: () => new DefaultNodeKindProvider(), - FuzzyMatcher: () => new DefaultFuzzyMatcher() - }, - workspace: { - TextDocuments: () => new import_vscode_languageserver10.TextDocuments(TextDocument2) - } - }; -} - -// node_modules/langium/lib/lsp/formatter.js -var Formatting; -(function(Formatting2) { - function fit(...formattings) { - return { - options: {}, - moves: formattings.flatMap((e) => e.moves).sort(compareMoves) - }; - } - Formatting2.fit = fit; - function noSpace(options) { - return spaces(0, options); - } - Formatting2.noSpace = noSpace; - function oneSpace(options) { - return spaces(1, options); - } - Formatting2.oneSpace = oneSpace; - function spaces(count, options) { - return { - options: options !== null && options !== void 0 ? options : {}, - moves: [{ - characters: count - }] - }; - } - Formatting2.spaces = spaces; - function newLine(options) { - return newLines(1, options); - } - Formatting2.newLine = newLine; - function newLines(count, options) { - return { - options: options !== null && options !== void 0 ? options : {}, - moves: [{ - lines: count - }] - }; - } - Formatting2.newLines = newLines; - function indent(options) { - return { - options: options !== null && options !== void 0 ? options : {}, - moves: [{ - tabs: 1, - lines: 1 - }] - }; - } - Formatting2.indent = indent; - function noIndent(options) { - return { - options: options !== null && options !== void 0 ? options : {}, - moves: [{ - tabs: 0 - }] - }; - } - Formatting2.noIndent = noIndent; - function compareMoves(a2, b) { - var _a, _b, _c, _d, _e, _f; - const aLines = (_a = a2.lines) !== null && _a !== void 0 ? _a : 0; - const bLines = (_b = b.lines) !== null && _b !== void 0 ? _b : 0; - const aTabs = (_c = a2.tabs) !== null && _c !== void 0 ? _c : 0; - const bTabs = (_d = b.tabs) !== null && _d !== void 0 ? _d : 0; - const aSpaces = (_e = a2.characters) !== null && _e !== void 0 ? _e : 0; - const bSpaces = (_f = b.characters) !== null && _f !== void 0 ? _f : 0; - if (aLines < bLines) { - return -1; - } else if (aLines > bLines) { - return 1; - } else if (aTabs < bTabs) { - return -1; - } else if (aTabs > bTabs) { - return 1; - } else if (aSpaces < bSpaces) { - return -1; - } else if (aSpaces > bSpaces) { - return 1; - } else { - return 0; - } - } -})(Formatting || (Formatting = {})); - -// node_modules/langium/lib/lsp/type-hierarchy-provider.js -var import_vscode_languageserver11 = __toESM(require_main4(), 1); - -// node_modules/langium/lib/node/node-file-system-provider.js -var fs = __toESM(require("fs"), 1); -var NodeFileSystemProvider = class { - constructor() { - this.encoding = "utf-8"; - } - readFile(uri) { - return fs.promises.readFile(uri.fsPath, this.encoding); - } - async readDirectory(folderPath) { - const dirents = await fs.promises.readdir(folderPath.fsPath, { withFileTypes: true }); - return dirents.map((dirent) => ({ - dirent, - isFile: dirent.isFile(), - isDirectory: dirent.isDirectory(), - uri: UriUtils.joinPath(folderPath, dirent.name) - })); - } -}; -var NodeFileSystem = { - fileSystemProvider: () => new NodeFileSystemProvider() -}; - -// src/language/main.ts -var import_node2 = __toESM(require_node3(), 1); - -// node_modules/langium/lib/index.js -var lib_exports = {}; -__export(lib_exports, { - AbstractAstReflection: () => AbstractAstReflection, - AbstractCstNode: () => AbstractCstNode, - AbstractLangiumParser: () => AbstractLangiumParser, - AbstractParserErrorMessageProvider: () => AbstractParserErrorMessageProvider, - AbstractThreadedAsyncParser: () => AbstractThreadedAsyncParser, - AstUtils: () => ast_utils_exports, - BiMap: () => BiMap, - Cancellation: () => cancellation_exports, - CompositeCstNodeImpl: () => CompositeCstNodeImpl, - ContextCache: () => ContextCache, - CstNodeBuilder: () => CstNodeBuilder, - CstUtils: () => cst_utils_exports, - DONE_RESULT: () => DONE_RESULT, - DatatypeSymbol: () => DatatypeSymbol, - DefaultAstNodeDescriptionProvider: () => DefaultAstNodeDescriptionProvider, - DefaultAstNodeLocator: () => DefaultAstNodeLocator, - DefaultAsyncParser: () => DefaultAsyncParser, - DefaultCommentProvider: () => DefaultCommentProvider, - DefaultConfigurationProvider: () => DefaultConfigurationProvider, - DefaultDocumentBuilder: () => DefaultDocumentBuilder, - DefaultDocumentValidator: () => DefaultDocumentValidator, - DefaultHydrator: () => DefaultHydrator, - DefaultIndexManager: () => DefaultIndexManager, - DefaultJsonSerializer: () => DefaultJsonSerializer, - DefaultLangiumDocumentFactory: () => DefaultLangiumDocumentFactory, - DefaultLangiumDocuments: () => DefaultLangiumDocuments, - DefaultLexer: () => DefaultLexer, - DefaultLinker: () => DefaultLinker, - DefaultNameProvider: () => DefaultNameProvider, - DefaultReferenceDescriptionProvider: () => DefaultReferenceDescriptionProvider, - DefaultReferences: () => DefaultReferences, - DefaultScopeComputation: () => DefaultScopeComputation, - DefaultScopeProvider: () => DefaultScopeProvider, - DefaultServiceRegistry: () => DefaultServiceRegistry, - DefaultTokenBuilder: () => DefaultTokenBuilder, - DefaultValueConverter: () => DefaultValueConverter, - DefaultWorkspaceLock: () => DefaultWorkspaceLock, - DefaultWorkspaceManager: () => DefaultWorkspaceManager, - Deferred: () => Deferred, - Disposable: () => Disposable, - DisposableCache: () => DisposableCache, - DocumentCache: () => DocumentCache, - DocumentState: () => DocumentState, - DocumentValidator: () => DocumentValidator, - EMPTY_SCOPE: () => EMPTY_SCOPE, - EMPTY_STREAM: () => EMPTY_STREAM, - EmptyFileSystem: () => EmptyFileSystem, - EmptyFileSystemProvider: () => EmptyFileSystemProvider, - ErrorWithLocation: () => ErrorWithLocation, - GrammarAST: () => ast_exports, - GrammarUtils: () => grammar_utils_exports, - JSDocDocumentationProvider: () => JSDocDocumentationProvider, - LangiumCompletionParser: () => LangiumCompletionParser, - LangiumParser: () => LangiumParser, - LangiumParserErrorMessageProvider: () => LangiumParserErrorMessageProvider, - LeafCstNodeImpl: () => LeafCstNodeImpl, - MapScope: () => MapScope, - Module: () => Module, - MultiMap: () => MultiMap, - OperationCancelled: () => OperationCancelled, - ParserWorker: () => ParserWorker, - Reduction: () => Reduction, - RegExpUtils: () => regexp_utils_exports, - RootCstNodeImpl: () => RootCstNodeImpl, - SimpleCache: () => SimpleCache, - StreamImpl: () => StreamImpl, - StreamScope: () => StreamScope, - TextDocument: () => TextDocument2, - TreeStreamImpl: () => TreeStreamImpl, - URI: () => URI, - UriUtils: () => UriUtils, - ValidationCategory: () => ValidationCategory, - ValidationRegistry: () => ValidationRegistry, - ValueConverter: () => ValueConverter, - WorkspaceCache: () => WorkspaceCache, - assertUnreachable: () => assertUnreachable, - createCompletionParser: () => createCompletionParser, - createDefaultCoreModule: () => createDefaultCoreModule, - createDefaultSharedCoreModule: () => createDefaultSharedCoreModule, - createGrammarConfig: () => createGrammarConfig, - createLangiumParser: () => createLangiumParser, - delayNextTick: () => delayNextTick, - diagnosticData: () => diagnosticData, - eagerLoad: () => eagerLoad, - getDiagnosticRange: () => getDiagnosticRange, - inject: () => inject, - interruptAndCheck: () => interruptAndCheck, - isAstNode: () => isAstNode, - isAstNodeDescription: () => isAstNodeDescription, - isAstNodeWithComment: () => isAstNodeWithComment, - isCompositeCstNode: () => isCompositeCstNode, - isIMultiModeLexerDefinition: () => isIMultiModeLexerDefinition, - isJSDoc: () => isJSDoc, - isLeafCstNode: () => isLeafCstNode, - isLinkingError: () => isLinkingError, - isNamed: () => isNamed, - isOperationCancelled: () => isOperationCancelled, - isReference: () => isReference, - isRootCstNode: () => isRootCstNode, - isTokenTypeArray: () => isTokenTypeArray, - isTokenTypeDictionary: () => isTokenTypeDictionary, - loadGrammarFromJson: () => loadGrammarFromJson, - parseJSDoc: () => parseJSDoc, - prepareLangiumParser: () => prepareLangiumParser, - setInterruptionPeriod: () => setInterruptionPeriod, - startCancelableOperation: () => startCancelableOperation, - stream: () => stream, - toDiagnosticSeverity: () => toDiagnosticSeverity -}); - -// node_modules/langium/lib/utils/index.js -var utils_exports = {}; -__export(utils_exports, { - AstUtils: () => ast_utils_exports, - BiMap: () => BiMap, - Cancellation: () => cancellation_exports, - ContextCache: () => ContextCache, - CstUtils: () => cst_utils_exports, - DONE_RESULT: () => DONE_RESULT, - Deferred: () => Deferred, - Disposable: () => Disposable, - DisposableCache: () => DisposableCache, - DocumentCache: () => DocumentCache, - EMPTY_STREAM: () => EMPTY_STREAM, - ErrorWithLocation: () => ErrorWithLocation, - GrammarUtils: () => grammar_utils_exports, - MultiMap: () => MultiMap, - OperationCancelled: () => OperationCancelled, - Reduction: () => Reduction, - RegExpUtils: () => regexp_utils_exports, - SimpleCache: () => SimpleCache, - StreamImpl: () => StreamImpl, - TreeStreamImpl: () => TreeStreamImpl, - URI: () => URI, - UriUtils: () => UriUtils, - WorkspaceCache: () => WorkspaceCache, - assertUnreachable: () => assertUnreachable, - delayNextTick: () => delayNextTick, - interruptAndCheck: () => interruptAndCheck, - isOperationCancelled: () => isOperationCancelled, - loadGrammarFromJson: () => loadGrammarFromJson, - setInterruptionPeriod: () => setInterruptionPeriod, - startCancelableOperation: () => startCancelableOperation, - stream: () => stream -}); -__reExport(utils_exports, event_exports); - -// node_modules/langium/lib/workspace/file-system-provider.js -var EmptyFileSystemProvider = class { - readFile() { - throw new Error("No file system is available."); - } - async readDirectory() { - return []; - } -}; -var EmptyFileSystem = { - fileSystemProvider: () => new EmptyFileSystemProvider() -}; - -// node_modules/langium/lib/utils/grammar-loader.js -var minimalGrammarModule = { - Grammar: () => void 0, - LanguageMetaData: () => ({ - caseInsensitive: false, - fileExtensions: [".langium"], - languageId: "langium" - }) -}; -var minimalSharedGrammarModule = { - AstReflection: () => new LangiumGrammarAstReflection() -}; -function createMinimalGrammarServices() { - const shared2 = inject(createDefaultSharedCoreModule(EmptyFileSystem), minimalSharedGrammarModule); - const grammar = inject(createDefaultCoreModule({ shared: shared2 }), minimalGrammarModule); - shared2.ServiceRegistry.register(grammar); - return grammar; -} -function loadGrammarFromJson(json) { - var _a; - const services = createMinimalGrammarServices(); - const astNode = services.serializer.JsonSerializer.deserialize(json); - services.shared.workspace.LangiumDocumentFactory.fromModel(astNode, URI.parse(`memory://${(_a = astNode.name) !== null && _a !== void 0 ? _a : "grammar"}.langium`)); - return astNode; -} - -// node_modules/langium/lib/index.js -__reExport(lib_exports, utils_exports); - -// src/language/generated/ast.ts -var Person = "Person"; -var PlOneAstReflection = class extends AbstractAstReflection { - getAllTypes() { - return ["EndProgram", "Greeting", "Loop", "Model", "Person", "Progname"]; - } - computeIsSubtype(subtype, supertype) { - switch (subtype) { - default: { - return false; - } - } - } - getReferenceType(refInfo) { - const referenceId = `${refInfo.container.$type}:${refInfo.property}`; - switch (referenceId) { - case "Greeting:person": { - return Person; - } - default: { - throw new Error(`${referenceId} is not a valid reference id.`); - } - } - } - getTypeMetaData(type) { - switch (type) { - case "EndProgram": { - return { - name: "EndProgram", - properties: [ - { name: "name" } - ] - }; - } - case "Greeting": { - return { - name: "Greeting", - properties: [ - { name: "person" } - ] - }; - } - case "Loop": { - return { - name: "Loop", - properties: [ - { name: "name" }, - { name: "num" } - ] - }; - } - case "Model": { - return { - name: "Model", - properties: [ - { name: "endProgram" }, - { name: "greetings", defaultValue: [] }, - { name: "loop", defaultValue: [] }, - { name: "persons", defaultValue: [] }, - { name: "progname", defaultValue: [] } - ] - }; - } - case "Person": { - return { - name: "Person", - properties: [ - { name: "name" } - ] - }; - } - case "Progname": { - return { - name: "Progname", - properties: [ - { name: "name" }, - { name: "num" } - ] - }; - } - default: { - return { - name: type, - properties: [] - }; - } - } - } -}; -var reflection2 = new PlOneAstReflection(); - -// src/language/generated/grammar.ts -var loadedPlOneGrammar; -var PlOneGrammar = () => loadedPlOneGrammar != null ? loadedPlOneGrammar : loadedPlOneGrammar = loadGrammarFromJson(`{ - "$type": "Grammar", - "isDeclared": true, - "name": "PlOne", - "imports": [], - "rules": [ - { - "$type": "ParserRule", - "name": "Model", - "entry": true, - "definition": { - "$type": "Alternatives", - "elements": [ - { - "$type": "Group", - "elements": [ - { - "$type": "Assignment", - "feature": "progname", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@1" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "loop", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@2" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "endProgram", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@3" - }, - "arguments": [] - } - } - ], - "cardinality": "*" - }, - { - "$type": "Alternatives", - "elements": [ - { - "$type": "Assignment", - "feature": "persons", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@4" - }, - "arguments": [] - } - }, - { - "$type": "Assignment", - "feature": "greetings", - "operator": "+=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@5" - }, - "arguments": [] - } - } - ], - "cardinality": "*" - } - ] - }, - "definesHiddenTokens": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Progname", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ":" - }, - { - "$type": "Keyword", - "value": "PROCEDURE" - }, - { - "$type": "Keyword", - "value": "OPTIONS" - }, - { - "$type": "Keyword", - "value": "(MAIN)" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "/*" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": "*/" - } - ], - "cardinality": "*" - }, - { - "$type": "Keyword", - "value": "FLAG" - }, - { - "$type": "Keyword", - "value": "=" - }, - { - "$type": "Assignment", - "feature": "num", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@8" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ";" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Loop", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "LOOP" - }, - { - "$type": "Keyword", - "value": ":" - }, - { - "$type": "Keyword", - "value": "DO" - }, - { - "$type": "Keyword", - "value": "WHILE" - }, - { - "$type": "Keyword", - "value": "(" - }, - { - "$type": "Keyword", - "value": "FLAG" - }, - { - "$type": "Keyword", - "value": "=" - }, - { - "$type": "Assignment", - "feature": "num", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@8" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ")" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Keyword", - "value": "PUT" - }, - { - "$type": "Keyword", - "value": "SKIP" - }, - { - "$type": "Keyword", - "value": "DATA" - }, - { - "$type": "Keyword", - "value": "(" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ")" - }, - { - "$type": "Keyword", - "value": ";" - }, - { - "$type": "Keyword", - "value": "END" - }, - { - "$type": "Keyword", - "value": "LOOP;" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "EndProgram", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "END" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - }, - { - "$type": "Keyword", - "value": ";" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "ParserRule", - "name": "Person", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "person" - }, - { - "$type": "Assignment", - "feature": "name", - "operator": "=", - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - } - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false, - "$comment": "/*just simple program*/" - }, - { - "$type": "ParserRule", - "name": "Greeting", - "definition": { - "$type": "Group", - "elements": [ - { - "$type": "Keyword", - "value": "Hello" - }, - { - "$type": "Assignment", - "feature": "person", - "operator": "=", - "terminal": { - "$type": "CrossReference", - "type": { - "$ref": "#/rules@4" - }, - "terminal": { - "$type": "RuleCall", - "rule": { - "$ref": "#/rules@7" - }, - "arguments": [] - }, - "deprecatedSyntax": false - } - }, - { - "$type": "Keyword", - "value": "!" - } - ] - }, - "definesHiddenTokens": false, - "entry": false, - "fragment": false, - "hiddenTokens": [], - "parameters": [], - "wildcard": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "WS", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\s+/" - }, - "fragment": false - }, - { - "$type": "TerminalRule", - "name": "ID", - "definition": { - "$type": "RegexToken", - "regex": "/[_a-zA-Z][\\\\w_]*/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "name": "INT", - "type": { - "$type": "ReturnType", - "name": "number" - }, - "definition": { - "$type": "RegexToken", - "regex": "/[0-9]+/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "name": "STRING", - "definition": { - "$type": "RegexToken", - "regex": "/\\"(\\\\\\\\.|[^\\"\\\\\\\\])*\\"|'(\\\\\\\\.|[^'\\\\\\\\])*'/" - }, - "fragment": false, - "hidden": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "ML_COMMENT", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//" - }, - "fragment": false - }, - { - "$type": "TerminalRule", - "hidden": true, - "name": "SL_COMMENT", - "definition": { - "$type": "RegexToken", - "regex": "/\\\\/\\\\/[^\\\\n\\\\r]*/" - }, - "fragment": false - } - ], - "definesHiddenTokens": false, - "hiddenTokens": [], - "interfaces": [], - "types": [], - "usedGrammars": [] -}`); - -// src/language/generated/module.ts -var PlOneLanguageMetaData = { - languageId: "pl-one", - fileExtensions: [".pl1", ".PLI"], - caseInsensitive: false -}; -var PlOneGeneratedSharedModule = { - AstReflection: () => new PlOneAstReflection() -}; -var PlOneGeneratedModule = { - Grammar: () => PlOneGrammar(), - LanguageMetaData: () => PlOneLanguageMetaData, - parser: {} -}; - -// src/language/pl-one-validator.ts -function registerValidationChecks(services) { - const registry = services.validation.ValidationRegistry; - const validator = services.validation.PlOneValidator; - const checks = { - Progname: validator.checkPrognameStartsWithCapital - }; - registry.register(checks, validator); -} -var PlOneValidator = class { - checkPrognameStartsWithCapital(prog, accept) { - if (prog.name) { - const firstChar = prog.name.substring(0, 1); - if (firstChar.toUpperCase() !== firstChar) { - accept("warning", "Prog name should start with a capital.", { node: prog, property: "name" }); - } - } - } -}; - -// src/language/pl-one-module.ts -var PlOneModule = { - validation: { - PlOneValidator: () => new PlOneValidator() - } -}; -function createPlOneServices(context) { - const shared2 = inject( - createDefaultSharedModule(context), - PlOneGeneratedSharedModule - ); - const PlOne = inject( - createDefaultModule({ shared: shared2 }), - PlOneGeneratedModule, - PlOneModule - ); - shared2.ServiceRegistry.register(PlOne); - registerValidationChecks(PlOne); - return { shared: shared2, PlOne }; -} - -// src/language/main.ts -var connection = (0, import_node2.createConnection)(import_node2.ProposedFeatures.all); -var { shared } = createPlOneServices(__spreadValues({ connection }, NodeFileSystem)); -startLanguageServer(shared); -/*! Bundled license information: - -lodash-es/lodash.js: - (** - * @license - * Lodash (Custom Build) - * Build: `lodash modularize exports="es" -o ./` - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - *) -*/ -//# sourceMappingURL=main.cjs.map diff --git a/intellij-plugin/src/main/resources/language/main.cjs.map b/intellij-plugin/src/main/resources/language/main.cjs.map deleted file mode 100644 index 7ff472c..0000000 --- a/intellij-plugin/src/main/resources/language/main.cjs.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../node_modules/vscode-languageserver/lib/common/utils/is.js", "../../node_modules/vscode-jsonrpc/lib/common/is.js", "../../node_modules/vscode-jsonrpc/lib/common/messages.js", "../../node_modules/vscode-jsonrpc/lib/common/linkedMap.js", "../../node_modules/vscode-jsonrpc/lib/common/disposable.js", "../../node_modules/vscode-jsonrpc/lib/common/ral.js", "../../node_modules/vscode-jsonrpc/lib/common/events.js", "../../node_modules/vscode-jsonrpc/lib/common/cancellation.js", "../../node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js", "../../node_modules/vscode-jsonrpc/lib/common/semaphore.js", "../../node_modules/vscode-jsonrpc/lib/common/messageReader.js", "../../node_modules/vscode-jsonrpc/lib/common/messageWriter.js", "../../node_modules/vscode-jsonrpc/lib/common/messageBuffer.js", "../../node_modules/vscode-jsonrpc/lib/common/connection.js", "../../node_modules/vscode-jsonrpc/lib/common/api.js", "../../node_modules/vscode-jsonrpc/lib/node/ril.js", "../../node_modules/vscode-jsonrpc/lib/node/main.js", "../../node_modules/vscode-jsonrpc/node.js", "../../node_modules/vscode-languageserver-types/lib/umd/main.js", "../../node_modules/vscode-languageserver-protocol/lib/common/messages.js", "../../node_modules/vscode-languageserver-protocol/lib/common/utils/is.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js", "../../node_modules/vscode-languageserver-protocol/lib/common/protocol.js", "../../node_modules/vscode-languageserver-protocol/lib/common/connection.js", "../../node_modules/vscode-languageserver-protocol/lib/common/api.js", "../../node_modules/vscode-languageserver-protocol/lib/node/main.js", "../../node_modules/vscode-languageserver/lib/common/utils/uuid.js", "../../node_modules/vscode-languageserver/lib/common/progress.js", "../../node_modules/vscode-languageserver/lib/common/configuration.js", "../../node_modules/vscode-languageserver/lib/common/workspaceFolder.js", "../../node_modules/vscode-languageserver/lib/common/callHierarchy.js", "../../node_modules/vscode-languageserver/lib/common/semanticTokens.js", "../../node_modules/vscode-languageserver/lib/common/showDocument.js", "../../node_modules/vscode-languageserver/lib/common/fileOperations.js", "../../node_modules/vscode-languageserver/lib/common/linkedEditingRange.js", "../../node_modules/vscode-languageserver/lib/common/typeHierarchy.js", "../../node_modules/vscode-languageserver/lib/common/inlineValue.js", "../../node_modules/vscode-languageserver/lib/common/foldingRange.js", "../../node_modules/vscode-languageserver/lib/common/inlayHint.js", "../../node_modules/vscode-languageserver/lib/common/diagnostic.js", "../../node_modules/vscode-languageserver/lib/common/textDocuments.js", "../../node_modules/vscode-languageserver/lib/common/notebook.js", "../../node_modules/vscode-languageserver/lib/common/moniker.js", "../../node_modules/vscode-languageserver/lib/common/server.js", "../../node_modules/vscode-languageserver/lib/node/files.js", "../../node_modules/vscode-languageserver-protocol/node.js", "../../node_modules/vscode-languageserver/lib/common/inlineCompletion.proposed.js", "../../node_modules/vscode-languageserver/lib/common/api.js", "../../node_modules/vscode-languageserver/lib/node/main.js", "../../node_modules/vscode-languageserver/node.js", "../../node_modules/langium/src/lsp/completion/completion-provider.ts", "../../node_modules/langium/src/languages/generated/ast.ts", "../../node_modules/langium/src/syntax-tree.ts", "../../node_modules/langium/src/utils/ast-utils.ts", "../../node_modules/langium/src/utils/stream.ts", "../../node_modules/langium/src/utils/cst-utils.ts", "../../node_modules/langium/src/utils/grammar-utils.ts", "../../node_modules/langium/src/utils/errors.ts", "../../node_modules/langium/src/utils/regexp-utils.ts", "../../node_modules/@chevrotain/regexp-to-ast/src/utils.ts", "../../node_modules/@chevrotain/regexp-to-ast/src/character-classes.ts", "../../node_modules/@chevrotain/regexp-to-ast/src/regexp-parser.ts", "../../node_modules/@chevrotain/regexp-to-ast/src/base-regexp-visitor.ts", "../../node_modules/langium/src/lsp/completion/follow-element-computation.ts", "../../node_modules/langium/src/lsp/call-hierarchy-provider.ts", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/node_modules/path-browserify/index.js", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/bootstrap", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/define property getters", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/hasOwnProperty shorthand", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/webpack/runtime/make namespace object", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/src/platform.ts", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/src/uri.ts", "../../node_modules/vscode-uri/lib/esm/webpack:/LIB/src/utils.ts", "../../node_modules/langium/src/utils/uri-utils.ts", "../../node_modules/langium/src/lsp/definition-provider.ts", "../../node_modules/langium/src/lsp/default-lsp-module.ts", "../../node_modules/langium/src/languages/grammar-config.ts", "../../node_modules/lodash-es/_freeGlobal.js", "../../node_modules/lodash-es/_root.js", "../../node_modules/lodash-es/_Symbol.js", "../../node_modules/lodash-es/_getRawTag.js", "../../node_modules/lodash-es/_objectToString.js", "../../node_modules/lodash-es/_baseGetTag.js", "../../node_modules/lodash-es/isObjectLike.js", "../../node_modules/lodash-es/isSymbol.js", "../../node_modules/lodash-es/_arrayMap.js", "../../node_modules/lodash-es/isArray.js", "../../node_modules/lodash-es/_baseToString.js", "../../node_modules/lodash-es/_trimmedEndIndex.js", "../../node_modules/lodash-es/_baseTrim.js", "../../node_modules/lodash-es/isObject.js", "../../node_modules/lodash-es/toNumber.js", "../../node_modules/lodash-es/toFinite.js", "../../node_modules/lodash-es/toInteger.js", "../../node_modules/lodash-es/identity.js", "../../node_modules/lodash-es/isFunction.js", "../../node_modules/lodash-es/_coreJsData.js", "../../node_modules/lodash-es/_isMasked.js", "../../node_modules/lodash-es/_toSource.js", "../../node_modules/lodash-es/_baseIsNative.js", "../../node_modules/lodash-es/_getValue.js", "../../node_modules/lodash-es/_getNative.js", "../../node_modules/lodash-es/_WeakMap.js", "../../node_modules/lodash-es/_baseCreate.js", "../../node_modules/lodash-es/_apply.js", "../../node_modules/lodash-es/noop.js", "../../node_modules/lodash-es/_copyArray.js", "../../node_modules/lodash-es/_shortOut.js", "../../node_modules/lodash-es/constant.js", "../../node_modules/lodash-es/_defineProperty.js", "../../node_modules/lodash-es/_baseSetToString.js", "../../node_modules/lodash-es/_setToString.js", "../../node_modules/lodash-es/_arrayEach.js", "../../node_modules/lodash-es/_baseFindIndex.js", "../../node_modules/lodash-es/_baseIsNaN.js", "../../node_modules/lodash-es/_strictIndexOf.js", "../../node_modules/lodash-es/_baseIndexOf.js", "../../node_modules/lodash-es/_arrayIncludes.js", "../../node_modules/lodash-es/_isIndex.js", "../../node_modules/lodash-es/_baseAssignValue.js", "../../node_modules/lodash-es/eq.js", "../../node_modules/lodash-es/_assignValue.js", "../../node_modules/lodash-es/_copyObject.js", "../../node_modules/lodash-es/_overRest.js", "../../node_modules/lodash-es/_baseRest.js", "../../node_modules/lodash-es/isLength.js", "../../node_modules/lodash-es/isArrayLike.js", "../../node_modules/lodash-es/_isIterateeCall.js", "../../node_modules/lodash-es/_createAssigner.js", "../../node_modules/lodash-es/_isPrototype.js", "../../node_modules/lodash-es/_baseTimes.js", "../../node_modules/lodash-es/_baseIsArguments.js", "../../node_modules/lodash-es/isArguments.js", "../../node_modules/lodash-es/stubFalse.js", "../../node_modules/lodash-es/isBuffer.js", "../../node_modules/lodash-es/_baseIsTypedArray.js", "../../node_modules/lodash-es/_baseUnary.js", "../../node_modules/lodash-es/_nodeUtil.js", "../../node_modules/lodash-es/isTypedArray.js", "../../node_modules/lodash-es/_arrayLikeKeys.js", "../../node_modules/lodash-es/_overArg.js", "../../node_modules/lodash-es/_nativeKeys.js", "../../node_modules/lodash-es/_baseKeys.js", "../../node_modules/lodash-es/keys.js", "../../node_modules/lodash-es/assign.js", "../../node_modules/lodash-es/_nativeKeysIn.js", "../../node_modules/lodash-es/_baseKeysIn.js", "../../node_modules/lodash-es/keysIn.js", "../../node_modules/lodash-es/_isKey.js", "../../node_modules/lodash-es/_nativeCreate.js", "../../node_modules/lodash-es/_hashClear.js", "../../node_modules/lodash-es/_hashDelete.js", "../../node_modules/lodash-es/_hashGet.js", "../../node_modules/lodash-es/_hashHas.js", "../../node_modules/lodash-es/_hashSet.js", "../../node_modules/lodash-es/_Hash.js", "../../node_modules/lodash-es/_listCacheClear.js", "../../node_modules/lodash-es/_assocIndexOf.js", "../../node_modules/lodash-es/_listCacheDelete.js", "../../node_modules/lodash-es/_listCacheGet.js", "../../node_modules/lodash-es/_listCacheHas.js", "../../node_modules/lodash-es/_listCacheSet.js", "../../node_modules/lodash-es/_ListCache.js", "../../node_modules/lodash-es/_Map.js", "../../node_modules/lodash-es/_mapCacheClear.js", "../../node_modules/lodash-es/_isKeyable.js", "../../node_modules/lodash-es/_getMapData.js", "../../node_modules/lodash-es/_mapCacheDelete.js", "../../node_modules/lodash-es/_mapCacheGet.js", "../../node_modules/lodash-es/_mapCacheHas.js", "../../node_modules/lodash-es/_mapCacheSet.js", "../../node_modules/lodash-es/_MapCache.js", "../../node_modules/lodash-es/memoize.js", "../../node_modules/lodash-es/_memoizeCapped.js", "../../node_modules/lodash-es/_stringToPath.js", "../../node_modules/lodash-es/toString.js", "../../node_modules/lodash-es/_castPath.js", "../../node_modules/lodash-es/_toKey.js", "../../node_modules/lodash-es/_baseGet.js", "../../node_modules/lodash-es/get.js", "../../node_modules/lodash-es/_arrayPush.js", "../../node_modules/lodash-es/_isFlattenable.js", "../../node_modules/lodash-es/_baseFlatten.js", "../../node_modules/lodash-es/flatten.js", "../../node_modules/lodash-es/_getPrototype.js", "../../node_modules/lodash-es/_baseSlice.js", "../../node_modules/lodash-es/_arrayReduce.js", "../../node_modules/lodash-es/_stackClear.js", "../../node_modules/lodash-es/_stackDelete.js", "../../node_modules/lodash-es/_stackGet.js", "../../node_modules/lodash-es/_stackHas.js", "../../node_modules/lodash-es/_stackSet.js", "../../node_modules/lodash-es/_Stack.js", "../../node_modules/lodash-es/_baseAssign.js", "../../node_modules/lodash-es/_baseAssignIn.js", "../../node_modules/lodash-es/_cloneBuffer.js", "../../node_modules/lodash-es/_arrayFilter.js", "../../node_modules/lodash-es/stubArray.js", "../../node_modules/lodash-es/_getSymbols.js", "../../node_modules/lodash-es/_copySymbols.js", "../../node_modules/lodash-es/_getSymbolsIn.js", "../../node_modules/lodash-es/_copySymbolsIn.js", "../../node_modules/lodash-es/_baseGetAllKeys.js", "../../node_modules/lodash-es/_getAllKeys.js", "../../node_modules/lodash-es/_getAllKeysIn.js", "../../node_modules/lodash-es/_DataView.js", "../../node_modules/lodash-es/_Promise.js", "../../node_modules/lodash-es/_Set.js", "../../node_modules/lodash-es/_getTag.js", "../../node_modules/lodash-es/_initCloneArray.js", "../../node_modules/lodash-es/_Uint8Array.js", "../../node_modules/lodash-es/_cloneArrayBuffer.js", "../../node_modules/lodash-es/_cloneDataView.js", "../../node_modules/lodash-es/_cloneRegExp.js", "../../node_modules/lodash-es/_cloneSymbol.js", "../../node_modules/lodash-es/_cloneTypedArray.js", "../../node_modules/lodash-es/_initCloneByTag.js", "../../node_modules/lodash-es/_initCloneObject.js", "../../node_modules/lodash-es/_baseIsMap.js", "../../node_modules/lodash-es/isMap.js", "../../node_modules/lodash-es/_baseIsSet.js", "../../node_modules/lodash-es/isSet.js", "../../node_modules/lodash-es/_baseClone.js", "../../node_modules/lodash-es/clone.js", "../../node_modules/lodash-es/compact.js", "../../node_modules/lodash-es/_setCacheAdd.js", "../../node_modules/lodash-es/_setCacheHas.js", "../../node_modules/lodash-es/_SetCache.js", "../../node_modules/lodash-es/_arraySome.js", "../../node_modules/lodash-es/_cacheHas.js", "../../node_modules/lodash-es/_equalArrays.js", "../../node_modules/lodash-es/_mapToArray.js", "../../node_modules/lodash-es/_setToArray.js", "../../node_modules/lodash-es/_equalByTag.js", "../../node_modules/lodash-es/_equalObjects.js", "../../node_modules/lodash-es/_baseIsEqualDeep.js", "../../node_modules/lodash-es/_baseIsEqual.js", "../../node_modules/lodash-es/_baseIsMatch.js", "../../node_modules/lodash-es/_isStrictComparable.js", "../../node_modules/lodash-es/_getMatchData.js", "../../node_modules/lodash-es/_matchesStrictComparable.js", "../../node_modules/lodash-es/_baseMatches.js", "../../node_modules/lodash-es/_baseHasIn.js", "../../node_modules/lodash-es/_hasPath.js", "../../node_modules/lodash-es/hasIn.js", "../../node_modules/lodash-es/_baseMatchesProperty.js", "../../node_modules/lodash-es/_baseProperty.js", "../../node_modules/lodash-es/_basePropertyDeep.js", "../../node_modules/lodash-es/property.js", "../../node_modules/lodash-es/_baseIteratee.js", "../../node_modules/lodash-es/_arrayAggregator.js", "../../node_modules/lodash-es/_createBaseFor.js", "../../node_modules/lodash-es/_baseFor.js", "../../node_modules/lodash-es/_baseForOwn.js", "../../node_modules/lodash-es/_createBaseEach.js", "../../node_modules/lodash-es/_baseEach.js", "../../node_modules/lodash-es/_baseAggregator.js", "../../node_modules/lodash-es/_createAggregator.js", "../../node_modules/lodash-es/defaults.js", "../../node_modules/lodash-es/isArrayLikeObject.js", "../../node_modules/lodash-es/_arrayIncludesWith.js", "../../node_modules/lodash-es/_baseDifference.js", "../../node_modules/lodash-es/difference.js", "../../node_modules/lodash-es/last.js", "../../node_modules/lodash-es/drop.js", "../../node_modules/lodash-es/dropRight.js", "../../node_modules/lodash-es/_castFunction.js", "../../node_modules/lodash-es/forEach.js", "../../node_modules/lodash-es/_arrayEvery.js", "../../node_modules/lodash-es/_baseEvery.js", "../../node_modules/lodash-es/every.js", "../../node_modules/lodash-es/_baseFilter.js", "../../node_modules/lodash-es/filter.js", "../../node_modules/lodash-es/_createFind.js", "../../node_modules/lodash-es/findIndex.js", "../../node_modules/lodash-es/find.js", "../../node_modules/lodash-es/head.js", "../../node_modules/lodash-es/_baseMap.js", "../../node_modules/lodash-es/map.js", "../../node_modules/lodash-es/flatMap.js", "../../node_modules/lodash-es/groupBy.js", "../../node_modules/lodash-es/_baseHas.js", "../../node_modules/lodash-es/has.js", "../../node_modules/lodash-es/isString.js", "../../node_modules/lodash-es/_baseValues.js", "../../node_modules/lodash-es/values.js", "../../node_modules/lodash-es/includes.js", "../../node_modules/lodash-es/indexOf.js", "../../node_modules/lodash-es/isEmpty.js", "../../node_modules/lodash-es/_baseIsRegExp.js", "../../node_modules/lodash-es/isRegExp.js", "../../node_modules/lodash-es/isUndefined.js", "../../node_modules/lodash-es/_baseLt.js", "../../node_modules/lodash-es/_baseExtremum.js", "../../node_modules/lodash-es/min.js", "../../node_modules/lodash-es/negate.js", "../../node_modules/lodash-es/_baseSet.js", "../../node_modules/lodash-es/_basePickBy.js", "../../node_modules/lodash-es/pickBy.js", "../../node_modules/lodash-es/_baseReduce.js", "../../node_modules/lodash-es/reduce.js", "../../node_modules/lodash-es/reject.js", "../../node_modules/lodash-es/_baseSome.js", "../../node_modules/lodash-es/some.js", "../../node_modules/lodash-es/_createSet.js", "../../node_modules/lodash-es/_baseUniq.js", "../../node_modules/lodash-es/uniq.js", "../../node_modules/lodash-es/uniqBy.js", "../../node_modules/@chevrotain/utils/src/print.ts", "../../node_modules/@chevrotain/utils/src/timer.ts", "../../node_modules/@chevrotain/utils/src/to-fast-properties.ts", "../../node_modules/@chevrotain/gast/src/model.ts", "../../node_modules/@chevrotain/gast/src/visitor.ts", "../../node_modules/@chevrotain/gast/src/helpers.ts", "../../node_modules/chevrotain/src/parse/grammar/rest.ts", "../../node_modules/chevrotain/src/parse/grammar/first.ts", "../../node_modules/chevrotain/src/parse/constants.ts", "../../node_modules/chevrotain/src/parse/grammar/follow.ts", "../../node_modules/chevrotain/src/scan/reg_exp_parser.ts", "../../node_modules/chevrotain/src/scan/reg_exp.ts", "../../node_modules/chevrotain/src/scan/lexer.ts", "../../node_modules/chevrotain/src/scan/tokens.ts", "../../node_modules/chevrotain/src/scan/lexer_errors_public.ts", "../../node_modules/chevrotain/src/scan/lexer_public.ts", "../../node_modules/chevrotain/src/scan/tokens_public.ts", "../../node_modules/chevrotain/src/parse/errors_public.ts", "../../node_modules/chevrotain/src/parse/grammar/resolver.ts", "../../node_modules/chevrotain/src/parse/grammar/interpreter.ts", "../../node_modules/chevrotain/src/parse/grammar/lookahead.ts", "../../node_modules/chevrotain/src/parse/grammar/checks.ts", "../../node_modules/chevrotain/src/parse/grammar/gast/gast_resolver_public.ts", "../../node_modules/chevrotain/src/parse/exceptions_public.ts", "../../node_modules/chevrotain/src/parse/parser/traits/recoverable.ts", "../../node_modules/chevrotain/src/parse/grammar/keys.ts", "../../node_modules/chevrotain/src/parse/grammar/llk_lookahead.ts", "../../node_modules/chevrotain/src/parse/parser/traits/looksahead.ts", "../../node_modules/chevrotain/src/parse/cst/cst.ts", "../../node_modules/chevrotain/src/lang/lang_extensions.ts", "../../node_modules/chevrotain/src/parse/cst/cst_visitor.ts", "../../node_modules/chevrotain/src/parse/parser/traits/tree_builder.ts", "../../node_modules/chevrotain/src/parse/parser/traits/lexer_adapter.ts", "../../node_modules/chevrotain/src/parse/parser/traits/recognizer_api.ts", "../../node_modules/chevrotain/src/parse/parser/traits/recognizer_engine.ts", "../../node_modules/chevrotain/src/parse/parser/traits/error_handler.ts", "../../node_modules/chevrotain/src/parse/parser/traits/context_assist.ts", "../../node_modules/chevrotain/src/parse/parser/traits/gast_recorder.ts", "../../node_modules/chevrotain/src/parse/parser/traits/perf_tracer.ts", "../../node_modules/chevrotain/src/parse/parser/utils/apply_mixins.ts", "../../node_modules/chevrotain/src/parse/parser/parser.ts", "../../node_modules/chevrotain-allstar/src/atn.ts", "../../node_modules/chevrotain-allstar/src/dfa.ts", "../../node_modules/chevrotain-allstar/src/all-star-lookahead.ts", "../../node_modules/vscode-languageserver-types/lib/esm/main.js", "../../node_modules/langium/src/parser/cst-node-builder.ts", "../../node_modules/langium/src/parser/langium-parser.ts", "../../node_modules/langium/src/parser/parser-builder-base.ts", "../../node_modules/langium/src/parser/completion-parser-builder.ts", "../../node_modules/langium/src/parser/langium-parser-builder.ts", "../../node_modules/langium/src/parser/token-builder.ts", "../../node_modules/langium/src/parser/value-converter.ts", "../../node_modules/langium/src/utils/cancellation.ts", "../../node_modules/langium/src/utils/promise-utils.ts", "../../node_modules/vscode-languageserver-textdocument/lib/esm/main.js", "../../node_modules/langium/src/workspace/documents.ts", "../../node_modules/langium/src/references/linker.ts", "../../node_modules/langium/src/references/name-provider.ts", "../../node_modules/langium/src/references/references.ts", "../../node_modules/langium/src/utils/collections.ts", "../../node_modules/langium/src/references/scope-computation.ts", "../../node_modules/langium/src/references/scope.ts", "../../node_modules/langium/src/utils/caching.ts", "../../node_modules/langium/src/references/scope-provider.ts", "../../node_modules/langium/src/serializer/json-serializer.ts", "../../node_modules/langium/src/service-registry.ts", "../../node_modules/langium/src/validation/validation-registry.ts", "../../node_modules/langium/src/validation/document-validator.ts", "../../node_modules/langium/src/workspace/ast-descriptions.ts", "../../node_modules/langium/src/workspace/ast-node-locator.ts", "../../node_modules/langium/src/workspace/configuration.ts", "../../node_modules/langium/src/utils/disposable.ts", "../../node_modules/langium/src/workspace/document-builder.ts", "../../node_modules/langium/src/workspace/index-manager.ts", "../../node_modules/langium/src/workspace/workspace-manager.ts", "../../node_modules/langium/src/parser/lexer.ts", "../../node_modules/langium/src/documentation/jsdoc.ts", "../../node_modules/langium/src/documentation/documentation-provider.ts", "../../node_modules/langium/src/documentation/comment-provider.ts", "../../node_modules/langium/src/utils/event.ts", "../../node_modules/langium/src/parser/async-parser.ts", "../../node_modules/langium/src/workspace/workspace-lock.ts", "../../node_modules/langium/src/serializer/hydrator.ts", "../../node_modules/langium/src/default-module.ts", "../../node_modules/langium/src/dependency-injection.ts", "../../node_modules/langium/src/lsp/document-highlight-provider.ts", "../../node_modules/langium/src/lsp/document-symbol-provider.ts", "../../node_modules/langium/src/lsp/document-update-handler.ts", "../../node_modules/langium/src/lsp/folding-range-provider.ts", "../../node_modules/langium/src/lsp/fuzzy-matcher.ts", "../../node_modules/langium/src/lsp/hover-provider.ts", "../../node_modules/langium/src/lsp/language-server.ts", "../../node_modules/langium/src/lsp/semantic-token-provider.ts", "../../node_modules/langium/src/lsp/signature-help-provider.ts", "../../node_modules/langium/src/lsp/node-kind-provider.ts", "../../node_modules/langium/src/lsp/references-provider.ts", "../../node_modules/langium/src/lsp/rename-provider.ts", "../../node_modules/langium/src/lsp/workspace-symbol-provider.ts", "../../node_modules/langium/src/lsp/formatter.ts", "../../node_modules/langium/src/lsp/type-hierarchy-provider.ts", "../../node_modules/langium/src/node/node-file-system-provider.ts", "../../src/language/main.ts", "../../node_modules/langium/src/index.ts", "../../node_modules/langium/src/utils/index.ts", "../../node_modules/langium/src/workspace/file-system-provider.ts", "../../node_modules/langium/src/utils/grammar-loader.ts", "../../src/language/generated/ast.ts", "../../src/language/generated/grammar.ts", "../../src/language/generated/module.ts", "../../src/language/pl-one-validator.ts", "../../src/language/pl-one-module.ts"], - "sourcesContent": ["\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;\nfunction boolean(value) {\n return value === true || value === false;\n}\nexports.boolean = boolean;\nfunction string(value) {\n return typeof value === 'string' || value instanceof String;\n}\nexports.string = string;\nfunction number(value) {\n return typeof value === 'number' || value instanceof Number;\n}\nexports.number = number;\nfunction error(value) {\n return value instanceof Error;\n}\nexports.error = error;\nfunction func(value) {\n return typeof value === 'function';\n}\nexports.func = func;\nfunction array(value) {\n return Array.isArray(value);\n}\nexports.array = array;\nfunction stringArray(value) {\n return array(value) && value.every(elem => string(elem));\n}\nexports.stringArray = stringArray;\nfunction typedArray(value, check) {\n return Array.isArray(value) && value.every(check);\n}\nexports.typedArray = typedArray;\nfunction thenable(value) {\n return value && func(value.then);\n}\nexports.thenable = thenable;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;\nfunction boolean(value) {\n return value === true || value === false;\n}\nexports.boolean = boolean;\nfunction string(value) {\n return typeof value === 'string' || value instanceof String;\n}\nexports.string = string;\nfunction number(value) {\n return typeof value === 'number' || value instanceof Number;\n}\nexports.number = number;\nfunction error(value) {\n return value instanceof Error;\n}\nexports.error = error;\nfunction func(value) {\n return typeof value === 'function';\n}\nexports.func = func;\nfunction array(value) {\n return Array.isArray(value);\n}\nexports.array = array;\nfunction stringArray(value) {\n return array(value) && value.every(elem => string(elem));\n}\nexports.stringArray = stringArray;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;\nconst is = require(\"./is\");\n/**\n * Predefined error codes.\n */\nvar ErrorCodes;\n(function (ErrorCodes) {\n // Defined by JSON RPC\n ErrorCodes.ParseError = -32700;\n ErrorCodes.InvalidRequest = -32600;\n ErrorCodes.MethodNotFound = -32601;\n ErrorCodes.InvalidParams = -32602;\n ErrorCodes.InternalError = -32603;\n /**\n * This is the start range of JSON RPC reserved error codes.\n * It doesn't denote a real error code. No application error codes should\n * be defined between the start and end range. For backwards\n * compatibility the `ServerNotInitialized` and the `UnknownErrorCode`\n * are left in the range.\n *\n * @since 3.16.0\n */\n ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;\n /** @deprecated use jsonrpcReservedErrorRangeStart */\n ErrorCodes.serverErrorStart = -32099;\n /**\n * An error occurred when write a message to the transport layer.\n */\n ErrorCodes.MessageWriteError = -32099;\n /**\n * An error occurred when reading a message from the transport layer.\n */\n ErrorCodes.MessageReadError = -32098;\n /**\n * The connection got disposed or lost and all pending responses got\n * rejected.\n */\n ErrorCodes.PendingResponseRejected = -32097;\n /**\n * The connection is inactive and a use of it failed.\n */\n ErrorCodes.ConnectionInactive = -32096;\n /**\n * Error code indicating that a server received a notification or\n * request before the server has received the `initialize` request.\n */\n ErrorCodes.ServerNotInitialized = -32002;\n ErrorCodes.UnknownErrorCode = -32001;\n /**\n * This is the end range of JSON RPC reserved error codes.\n * It doesn't denote a real error code.\n *\n * @since 3.16.0\n */\n ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;\n /** @deprecated use jsonrpcReservedErrorRangeEnd */\n ErrorCodes.serverErrorEnd = -32000;\n})(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {}));\n/**\n * An error object return in a response in case a request\n * has failed.\n */\nclass ResponseError extends Error {\n constructor(code, message, data) {\n super(message);\n this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\n this.data = data;\n Object.setPrototypeOf(this, ResponseError.prototype);\n }\n toJson() {\n const result = {\n code: this.code,\n message: this.message\n };\n if (this.data !== undefined) {\n result.data = this.data;\n }\n return result;\n }\n}\nexports.ResponseError = ResponseError;\nclass ParameterStructures {\n constructor(kind) {\n this.kind = kind;\n }\n static is(value) {\n return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;\n }\n toString() {\n return this.kind;\n }\n}\nexports.ParameterStructures = ParameterStructures;\n/**\n * The parameter structure is automatically inferred on the number of parameters\n * and the parameter type in case of a single param.\n */\nParameterStructures.auto = new ParameterStructures('auto');\n/**\n * Forces `byPosition` parameter structure. This is useful if you have a single\n * parameter which has a literal type.\n */\nParameterStructures.byPosition = new ParameterStructures('byPosition');\n/**\n * Forces `byName` parameter structure. This is only useful when having a single\n * parameter. The library will report errors if used with a different number of\n * parameters.\n */\nParameterStructures.byName = new ParameterStructures('byName');\n/**\n * An abstract implementation of a MessageType.\n */\nclass AbstractMessageSignature {\n constructor(method, numberOfParams) {\n this.method = method;\n this.numberOfParams = numberOfParams;\n }\n get parameterStructures() {\n return ParameterStructures.auto;\n }\n}\nexports.AbstractMessageSignature = AbstractMessageSignature;\n/**\n * Classes to type request response pairs\n */\nclass RequestType0 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 0);\n }\n}\nexports.RequestType0 = RequestType0;\nclass RequestType extends AbstractMessageSignature {\n constructor(method, _parameterStructures = ParameterStructures.auto) {\n super(method, 1);\n this._parameterStructures = _parameterStructures;\n }\n get parameterStructures() {\n return this._parameterStructures;\n }\n}\nexports.RequestType = RequestType;\nclass RequestType1 extends AbstractMessageSignature {\n constructor(method, _parameterStructures = ParameterStructures.auto) {\n super(method, 1);\n this._parameterStructures = _parameterStructures;\n }\n get parameterStructures() {\n return this._parameterStructures;\n }\n}\nexports.RequestType1 = RequestType1;\nclass RequestType2 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 2);\n }\n}\nexports.RequestType2 = RequestType2;\nclass RequestType3 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 3);\n }\n}\nexports.RequestType3 = RequestType3;\nclass RequestType4 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 4);\n }\n}\nexports.RequestType4 = RequestType4;\nclass RequestType5 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 5);\n }\n}\nexports.RequestType5 = RequestType5;\nclass RequestType6 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 6);\n }\n}\nexports.RequestType6 = RequestType6;\nclass RequestType7 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 7);\n }\n}\nexports.RequestType7 = RequestType7;\nclass RequestType8 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 8);\n }\n}\nexports.RequestType8 = RequestType8;\nclass RequestType9 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 9);\n }\n}\nexports.RequestType9 = RequestType9;\nclass NotificationType extends AbstractMessageSignature {\n constructor(method, _parameterStructures = ParameterStructures.auto) {\n super(method, 1);\n this._parameterStructures = _parameterStructures;\n }\n get parameterStructures() {\n return this._parameterStructures;\n }\n}\nexports.NotificationType = NotificationType;\nclass NotificationType0 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 0);\n }\n}\nexports.NotificationType0 = NotificationType0;\nclass NotificationType1 extends AbstractMessageSignature {\n constructor(method, _parameterStructures = ParameterStructures.auto) {\n super(method, 1);\n this._parameterStructures = _parameterStructures;\n }\n get parameterStructures() {\n return this._parameterStructures;\n }\n}\nexports.NotificationType1 = NotificationType1;\nclass NotificationType2 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 2);\n }\n}\nexports.NotificationType2 = NotificationType2;\nclass NotificationType3 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 3);\n }\n}\nexports.NotificationType3 = NotificationType3;\nclass NotificationType4 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 4);\n }\n}\nexports.NotificationType4 = NotificationType4;\nclass NotificationType5 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 5);\n }\n}\nexports.NotificationType5 = NotificationType5;\nclass NotificationType6 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 6);\n }\n}\nexports.NotificationType6 = NotificationType6;\nclass NotificationType7 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 7);\n }\n}\nexports.NotificationType7 = NotificationType7;\nclass NotificationType8 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 8);\n }\n}\nexports.NotificationType8 = NotificationType8;\nclass NotificationType9 extends AbstractMessageSignature {\n constructor(method) {\n super(method, 9);\n }\n}\nexports.NotificationType9 = NotificationType9;\nvar Message;\n(function (Message) {\n /**\n * Tests if the given message is a request message\n */\n function isRequest(message) {\n const candidate = message;\n return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\n }\n Message.isRequest = isRequest;\n /**\n * Tests if the given message is a notification message\n */\n function isNotification(message) {\n const candidate = message;\n return candidate && is.string(candidate.method) && message.id === void 0;\n }\n Message.isNotification = isNotification;\n /**\n * Tests if the given message is a response message\n */\n function isResponse(message) {\n const candidate = message;\n return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\n }\n Message.isResponse = isResponse;\n})(Message || (exports.Message = Message = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LRUCache = exports.LinkedMap = exports.Touch = void 0;\nvar Touch;\n(function (Touch) {\n Touch.None = 0;\n Touch.First = 1;\n Touch.AsOld = Touch.First;\n Touch.Last = 2;\n Touch.AsNew = Touch.Last;\n})(Touch || (exports.Touch = Touch = {}));\nclass LinkedMap {\n constructor() {\n this[_a] = 'LinkedMap';\n this._map = new Map();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state = 0;\n }\n clear() {\n this._map.clear();\n this._head = undefined;\n this._tail = undefined;\n this._size = 0;\n this._state++;\n }\n isEmpty() {\n return !this._head && !this._tail;\n }\n get size() {\n return this._size;\n }\n get first() {\n return this._head?.value;\n }\n get last() {\n return this._tail?.value;\n }\n has(key) {\n return this._map.has(key);\n }\n get(key, touch = Touch.None) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n if (touch !== Touch.None) {\n this.touch(item, touch);\n }\n return item.value;\n }\n set(key, value, touch = Touch.None) {\n let item = this._map.get(key);\n if (item) {\n item.value = value;\n if (touch !== Touch.None) {\n this.touch(item, touch);\n }\n }\n else {\n item = { key, value, next: undefined, previous: undefined };\n switch (touch) {\n case Touch.None:\n this.addItemLast(item);\n break;\n case Touch.First:\n this.addItemFirst(item);\n break;\n case Touch.Last:\n this.addItemLast(item);\n break;\n default:\n this.addItemLast(item);\n break;\n }\n this._map.set(key, item);\n this._size++;\n }\n return this;\n }\n delete(key) {\n return !!this.remove(key);\n }\n remove(key) {\n const item = this._map.get(key);\n if (!item) {\n return undefined;\n }\n this._map.delete(key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n shift() {\n if (!this._head && !this._tail) {\n return undefined;\n }\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n const item = this._head;\n this._map.delete(item.key);\n this.removeItem(item);\n this._size--;\n return item.value;\n }\n forEach(callbackfn, thisArg) {\n const state = this._state;\n let current = this._head;\n while (current) {\n if (thisArg) {\n callbackfn.bind(thisArg)(current.value, current.key, this);\n }\n else {\n callbackfn(current.value, current.key, this);\n }\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n current = current.next;\n }\n }\n keys() {\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]: () => {\n return iterator;\n },\n next: () => {\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.key, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n values() {\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]: () => {\n return iterator;\n },\n next: () => {\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: current.value, done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n entries() {\n const state = this._state;\n let current = this._head;\n const iterator = {\n [Symbol.iterator]: () => {\n return iterator;\n },\n next: () => {\n if (this._state !== state) {\n throw new Error(`LinkedMap got modified during iteration.`);\n }\n if (current) {\n const result = { value: [current.key, current.value], done: false };\n current = current.next;\n return result;\n }\n else {\n return { value: undefined, done: true };\n }\n }\n };\n return iterator;\n }\n [(_a = Symbol.toStringTag, Symbol.iterator)]() {\n return this.entries();\n }\n trimOld(newSize) {\n if (newSize >= this.size) {\n return;\n }\n if (newSize === 0) {\n this.clear();\n return;\n }\n let current = this._head;\n let currentSize = this.size;\n while (current && currentSize > newSize) {\n this._map.delete(current.key);\n current = current.next;\n currentSize--;\n }\n this._head = current;\n this._size = currentSize;\n if (current) {\n current.previous = undefined;\n }\n this._state++;\n }\n addItemFirst(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._tail = item;\n }\n else if (!this._head) {\n throw new Error('Invalid list');\n }\n else {\n item.next = this._head;\n this._head.previous = item;\n }\n this._head = item;\n this._state++;\n }\n addItemLast(item) {\n // First time Insert\n if (!this._head && !this._tail) {\n this._head = item;\n }\n else if (!this._tail) {\n throw new Error('Invalid list');\n }\n else {\n item.previous = this._tail;\n this._tail.next = item;\n }\n this._tail = item;\n this._state++;\n }\n removeItem(item) {\n if (item === this._head && item === this._tail) {\n this._head = undefined;\n this._tail = undefined;\n }\n else if (item === this._head) {\n // This can only happened if size === 1 which is handle\n // by the case above.\n if (!item.next) {\n throw new Error('Invalid list');\n }\n item.next.previous = undefined;\n this._head = item.next;\n }\n else if (item === this._tail) {\n // This can only happened if size === 1 which is handle\n // by the case above.\n if (!item.previous) {\n throw new Error('Invalid list');\n }\n item.previous.next = undefined;\n this._tail = item.previous;\n }\n else {\n const next = item.next;\n const previous = item.previous;\n if (!next || !previous) {\n throw new Error('Invalid list');\n }\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = undefined;\n this._state++;\n }\n touch(item, touch) {\n if (!this._head || !this._tail) {\n throw new Error('Invalid list');\n }\n if ((touch !== Touch.First && touch !== Touch.Last)) {\n return;\n }\n if (touch === Touch.First) {\n if (item === this._head) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item\n if (item === this._tail) {\n // previous must be defined since item was not head but is tail\n // So there are more than on item in the map\n previous.next = undefined;\n this._tail = previous;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n // Insert the node at head\n item.previous = undefined;\n item.next = this._head;\n this._head.previous = item;\n this._head = item;\n this._state++;\n }\n else if (touch === Touch.Last) {\n if (item === this._tail) {\n return;\n }\n const next = item.next;\n const previous = item.previous;\n // Unlink the item.\n if (item === this._head) {\n // next must be defined since item was not tail but is head\n // So there are more than on item in the map\n next.previous = undefined;\n this._head = next;\n }\n else {\n // Both next and previous are not undefined since item was neither head nor tail.\n next.previous = previous;\n previous.next = next;\n }\n item.next = undefined;\n item.previous = this._tail;\n this._tail.next = item;\n this._tail = item;\n this._state++;\n }\n }\n toJSON() {\n const data = [];\n this.forEach((value, key) => {\n data.push([key, value]);\n });\n return data;\n }\n fromJSON(data) {\n this.clear();\n for (const [key, value] of data) {\n this.set(key, value);\n }\n }\n}\nexports.LinkedMap = LinkedMap;\nclass LRUCache extends LinkedMap {\n constructor(limit, ratio = 1) {\n super();\n this._limit = limit;\n this._ratio = Math.min(Math.max(0, ratio), 1);\n }\n get limit() {\n return this._limit;\n }\n set limit(limit) {\n this._limit = limit;\n this.checkTrim();\n }\n get ratio() {\n return this._ratio;\n }\n set ratio(ratio) {\n this._ratio = Math.min(Math.max(0, ratio), 1);\n this.checkTrim();\n }\n get(key, touch = Touch.AsNew) {\n return super.get(key, touch);\n }\n peek(key) {\n return super.get(key, Touch.None);\n }\n set(key, value) {\n super.set(key, value, Touch.Last);\n this.checkTrim();\n return this;\n }\n checkTrim() {\n if (this.size > this._limit) {\n this.trimOld(Math.round(this._limit * this._ratio));\n }\n }\n}\nexports.LRUCache = LRUCache;\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Disposable = void 0;\nvar Disposable;\n(function (Disposable) {\n function create(func) {\n return {\n dispose: func\n };\n }\n Disposable.create = create;\n})(Disposable || (exports.Disposable = Disposable = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nlet _ral;\nfunction RAL() {\n if (_ral === undefined) {\n throw new Error(`No runtime abstraction layer installed`);\n }\n return _ral;\n}\n(function (RAL) {\n function install(ral) {\n if (ral === undefined) {\n throw new Error(`No runtime abstraction layer provided`);\n }\n _ral = ral;\n }\n RAL.install = install;\n})(RAL || (RAL = {}));\nexports.default = RAL;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Emitter = exports.Event = void 0;\nconst ral_1 = require(\"./ral\");\nvar Event;\n(function (Event) {\n const _disposable = { dispose() { } };\n Event.None = function () { return _disposable; };\n})(Event || (exports.Event = Event = {}));\nclass CallbackList {\n add(callback, context = null, bucket) {\n if (!this._callbacks) {\n this._callbacks = [];\n this._contexts = [];\n }\n this._callbacks.push(callback);\n this._contexts.push(context);\n if (Array.isArray(bucket)) {\n bucket.push({ dispose: () => this.remove(callback, context) });\n }\n }\n remove(callback, context = null) {\n if (!this._callbacks) {\n return;\n }\n let foundCallbackWithDifferentContext = false;\n for (let i = 0, len = this._callbacks.length; i < len; i++) {\n if (this._callbacks[i] === callback) {\n if (this._contexts[i] === context) {\n // callback & context match => remove it\n this._callbacks.splice(i, 1);\n this._contexts.splice(i, 1);\n return;\n }\n else {\n foundCallbackWithDifferentContext = true;\n }\n }\n }\n if (foundCallbackWithDifferentContext) {\n throw new Error('When adding a listener with a context, you should remove it with the same context');\n }\n }\n invoke(...args) {\n if (!this._callbacks) {\n return [];\n }\n const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\n for (let i = 0, len = callbacks.length; i < len; i++) {\n try {\n ret.push(callbacks[i].apply(contexts[i], args));\n }\n catch (e) {\n // eslint-disable-next-line no-console\n (0, ral_1.default)().console.error(e);\n }\n }\n return ret;\n }\n isEmpty() {\n return !this._callbacks || this._callbacks.length === 0;\n }\n dispose() {\n this._callbacks = undefined;\n this._contexts = undefined;\n }\n}\nclass Emitter {\n constructor(_options) {\n this._options = _options;\n }\n /**\n * For the public to allow to subscribe\n * to events from this Emitter\n */\n get event() {\n if (!this._event) {\n this._event = (listener, thisArgs, disposables) => {\n if (!this._callbacks) {\n this._callbacks = new CallbackList();\n }\n if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\n this._options.onFirstListenerAdd(this);\n }\n this._callbacks.add(listener, thisArgs);\n const result = {\n dispose: () => {\n if (!this._callbacks) {\n // disposable is disposed after emitter is disposed.\n return;\n }\n this._callbacks.remove(listener, thisArgs);\n result.dispose = Emitter._noop;\n if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\n this._options.onLastListenerRemove(this);\n }\n }\n };\n if (Array.isArray(disposables)) {\n disposables.push(result);\n }\n return result;\n };\n }\n return this._event;\n }\n /**\n * To be kept private to fire an event to\n * subscribers\n */\n fire(event) {\n if (this._callbacks) {\n this._callbacks.invoke.call(this._callbacks, event);\n }\n }\n dispose() {\n if (this._callbacks) {\n this._callbacks.dispose();\n this._callbacks = undefined;\n }\n }\n}\nexports.Emitter = Emitter;\nEmitter._noop = function () { };\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CancellationTokenSource = exports.CancellationToken = void 0;\nconst ral_1 = require(\"./ral\");\nconst Is = require(\"./is\");\nconst events_1 = require(\"./events\");\nvar CancellationToken;\n(function (CancellationToken) {\n CancellationToken.None = Object.freeze({\n isCancellationRequested: false,\n onCancellationRequested: events_1.Event.None\n });\n CancellationToken.Cancelled = Object.freeze({\n isCancellationRequested: true,\n onCancellationRequested: events_1.Event.None\n });\n function is(value) {\n const candidate = value;\n return candidate && (candidate === CancellationToken.None\n || candidate === CancellationToken.Cancelled\n || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\n }\n CancellationToken.is = is;\n})(CancellationToken || (exports.CancellationToken = CancellationToken = {}));\nconst shortcutEvent = Object.freeze(function (callback, context) {\n const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0);\n return { dispose() { handle.dispose(); } };\n});\nclass MutableToken {\n constructor() {\n this._isCancelled = false;\n }\n cancel() {\n if (!this._isCancelled) {\n this._isCancelled = true;\n if (this._emitter) {\n this._emitter.fire(undefined);\n this.dispose();\n }\n }\n }\n get isCancellationRequested() {\n return this._isCancelled;\n }\n get onCancellationRequested() {\n if (this._isCancelled) {\n return shortcutEvent;\n }\n if (!this._emitter) {\n this._emitter = new events_1.Emitter();\n }\n return this._emitter.event;\n }\n dispose() {\n if (this._emitter) {\n this._emitter.dispose();\n this._emitter = undefined;\n }\n }\n}\nclass CancellationTokenSource {\n get token() {\n if (!this._token) {\n // be lazy and create the token only when\n // actually needed\n this._token = new MutableToken();\n }\n return this._token;\n }\n cancel() {\n if (!this._token) {\n // save an object by returning the default\n // cancelled token when cancellation happens\n // before someone asks for the token\n this._token = CancellationToken.Cancelled;\n }\n else {\n this._token.cancel();\n }\n }\n dispose() {\n if (!this._token) {\n // ensure to initialize with an empty token if we had none\n this._token = CancellationToken.None;\n }\n else if (this._token instanceof MutableToken) {\n // actually dispose\n this._token.dispose();\n }\n }\n}\nexports.CancellationTokenSource = CancellationTokenSource;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = void 0;\nconst cancellation_1 = require(\"./cancellation\");\nvar CancellationState;\n(function (CancellationState) {\n CancellationState.Continue = 0;\n CancellationState.Cancelled = 1;\n})(CancellationState || (CancellationState = {}));\nclass SharedArraySenderStrategy {\n constructor() {\n this.buffers = new Map();\n }\n enableCancellation(request) {\n if (request.id === null) {\n return;\n }\n const buffer = new SharedArrayBuffer(4);\n const data = new Int32Array(buffer, 0, 1);\n data[0] = CancellationState.Continue;\n this.buffers.set(request.id, buffer);\n request.$cancellationData = buffer;\n }\n async sendCancellation(_conn, id) {\n const buffer = this.buffers.get(id);\n if (buffer === undefined) {\n return;\n }\n const data = new Int32Array(buffer, 0, 1);\n Atomics.store(data, 0, CancellationState.Cancelled);\n }\n cleanup(id) {\n this.buffers.delete(id);\n }\n dispose() {\n this.buffers.clear();\n }\n}\nexports.SharedArraySenderStrategy = SharedArraySenderStrategy;\nclass SharedArrayBufferCancellationToken {\n constructor(buffer) {\n this.data = new Int32Array(buffer, 0, 1);\n }\n get isCancellationRequested() {\n return Atomics.load(this.data, 0) === CancellationState.Cancelled;\n }\n get onCancellationRequested() {\n throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`);\n }\n}\nclass SharedArrayBufferCancellationTokenSource {\n constructor(buffer) {\n this.token = new SharedArrayBufferCancellationToken(buffer);\n }\n cancel() {\n }\n dispose() {\n }\n}\nclass SharedArrayReceiverStrategy {\n constructor() {\n this.kind = 'request';\n }\n createCancellationTokenSource(request) {\n const buffer = request.$cancellationData;\n if (buffer === undefined) {\n return new cancellation_1.CancellationTokenSource();\n }\n return new SharedArrayBufferCancellationTokenSource(buffer);\n }\n}\nexports.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Semaphore = void 0;\nconst ral_1 = require(\"./ral\");\nclass Semaphore {\n constructor(capacity = 1) {\n if (capacity <= 0) {\n throw new Error('Capacity must be greater than 0');\n }\n this._capacity = capacity;\n this._active = 0;\n this._waiting = [];\n }\n lock(thunk) {\n return new Promise((resolve, reject) => {\n this._waiting.push({ thunk, resolve, reject });\n this.runNext();\n });\n }\n get active() {\n return this._active;\n }\n runNext() {\n if (this._waiting.length === 0 || this._active === this._capacity) {\n return;\n }\n (0, ral_1.default)().timer.setImmediate(() => this.doRunNext());\n }\n doRunNext() {\n if (this._waiting.length === 0 || this._active === this._capacity) {\n return;\n }\n const next = this._waiting.shift();\n this._active++;\n if (this._active > this._capacity) {\n throw new Error(`To many thunks active`);\n }\n try {\n const result = next.thunk();\n if (result instanceof Promise) {\n result.then((value) => {\n this._active--;\n next.resolve(value);\n this.runNext();\n }, (err) => {\n this._active--;\n next.reject(err);\n this.runNext();\n });\n }\n else {\n this._active--;\n next.resolve(result);\n this.runNext();\n }\n }\n catch (err) {\n this._active--;\n next.reject(err);\n this.runNext();\n }\n }\n}\nexports.Semaphore = Semaphore;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;\nconst ral_1 = require(\"./ral\");\nconst Is = require(\"./is\");\nconst events_1 = require(\"./events\");\nconst semaphore_1 = require(\"./semaphore\");\nvar MessageReader;\n(function (MessageReader) {\n function is(value) {\n let candidate = value;\n return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\n Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\n }\n MessageReader.is = is;\n})(MessageReader || (exports.MessageReader = MessageReader = {}));\nclass AbstractMessageReader {\n constructor() {\n this.errorEmitter = new events_1.Emitter();\n this.closeEmitter = new events_1.Emitter();\n this.partialMessageEmitter = new events_1.Emitter();\n }\n dispose() {\n this.errorEmitter.dispose();\n this.closeEmitter.dispose();\n }\n get onError() {\n return this.errorEmitter.event;\n }\n fireError(error) {\n this.errorEmitter.fire(this.asError(error));\n }\n get onClose() {\n return this.closeEmitter.event;\n }\n fireClose() {\n this.closeEmitter.fire(undefined);\n }\n get onPartialMessage() {\n return this.partialMessageEmitter.event;\n }\n firePartialMessage(info) {\n this.partialMessageEmitter.fire(info);\n }\n asError(error) {\n if (error instanceof Error) {\n return error;\n }\n else {\n return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\n }\n }\n}\nexports.AbstractMessageReader = AbstractMessageReader;\nvar ResolvedMessageReaderOptions;\n(function (ResolvedMessageReaderOptions) {\n function fromOptions(options) {\n let charset;\n let result;\n let contentDecoder;\n const contentDecoders = new Map();\n let contentTypeDecoder;\n const contentTypeDecoders = new Map();\n if (options === undefined || typeof options === 'string') {\n charset = options ?? 'utf-8';\n }\n else {\n charset = options.charset ?? 'utf-8';\n if (options.contentDecoder !== undefined) {\n contentDecoder = options.contentDecoder;\n contentDecoders.set(contentDecoder.name, contentDecoder);\n }\n if (options.contentDecoders !== undefined) {\n for (const decoder of options.contentDecoders) {\n contentDecoders.set(decoder.name, decoder);\n }\n }\n if (options.contentTypeDecoder !== undefined) {\n contentTypeDecoder = options.contentTypeDecoder;\n contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);\n }\n if (options.contentTypeDecoders !== undefined) {\n for (const decoder of options.contentTypeDecoders) {\n contentTypeDecoders.set(decoder.name, decoder);\n }\n }\n }\n if (contentTypeDecoder === undefined) {\n contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder;\n contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);\n }\n return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };\n }\n ResolvedMessageReaderOptions.fromOptions = fromOptions;\n})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));\nclass ReadableStreamMessageReader extends AbstractMessageReader {\n constructor(readable, options) {\n super();\n this.readable = readable;\n this.options = ResolvedMessageReaderOptions.fromOptions(options);\n this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset);\n this._partialMessageTimeout = 10000;\n this.nextMessageLength = -1;\n this.messageToken = 0;\n this.readSemaphore = new semaphore_1.Semaphore(1);\n }\n set partialMessageTimeout(timeout) {\n this._partialMessageTimeout = timeout;\n }\n get partialMessageTimeout() {\n return this._partialMessageTimeout;\n }\n listen(callback) {\n this.nextMessageLength = -1;\n this.messageToken = 0;\n this.partialMessageTimer = undefined;\n this.callback = callback;\n const result = this.readable.onData((data) => {\n this.onData(data);\n });\n this.readable.onError((error) => this.fireError(error));\n this.readable.onClose(() => this.fireClose());\n return result;\n }\n onData(data) {\n try {\n this.buffer.append(data);\n while (true) {\n if (this.nextMessageLength === -1) {\n const headers = this.buffer.tryReadHeaders(true);\n if (!headers) {\n return;\n }\n const contentLength = headers.get('content-length');\n if (!contentLength) {\n this.fireError(new Error(`Header must provide a Content-Length property.\\n${JSON.stringify(Object.fromEntries(headers))}`));\n return;\n }\n const length = parseInt(contentLength);\n if (isNaN(length)) {\n this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));\n return;\n }\n this.nextMessageLength = length;\n }\n const body = this.buffer.tryReadBody(this.nextMessageLength);\n if (body === undefined) {\n /** We haven't received the full message yet. */\n this.setPartialMessageTimer();\n return;\n }\n this.clearPartialMessageTimer();\n this.nextMessageLength = -1;\n // Make sure that we convert one received message after the\n // other. Otherwise it could happen that a decoding of a second\n // smaller message finished before the decoding of a first larger\n // message and then we would deliver the second message first.\n this.readSemaphore.lock(async () => {\n const bytes = this.options.contentDecoder !== undefined\n ? await this.options.contentDecoder.decode(body)\n : body;\n const message = await this.options.contentTypeDecoder.decode(bytes, this.options);\n this.callback(message);\n }).catch((error) => {\n this.fireError(error);\n });\n }\n }\n catch (error) {\n this.fireError(error);\n }\n }\n clearPartialMessageTimer() {\n if (this.partialMessageTimer) {\n this.partialMessageTimer.dispose();\n this.partialMessageTimer = undefined;\n }\n }\n setPartialMessageTimer() {\n this.clearPartialMessageTimer();\n if (this._partialMessageTimeout <= 0) {\n return;\n }\n this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => {\n this.partialMessageTimer = undefined;\n if (token === this.messageToken) {\n this.firePartialMessage({ messageToken: token, waitingTime: timeout });\n this.setPartialMessageTimer();\n }\n }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\n }\n}\nexports.ReadableStreamMessageReader = ReadableStreamMessageReader;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;\nconst ral_1 = require(\"./ral\");\nconst Is = require(\"./is\");\nconst semaphore_1 = require(\"./semaphore\");\nconst events_1 = require(\"./events\");\nconst ContentLength = 'Content-Length: ';\nconst CRLF = '\\r\\n';\nvar MessageWriter;\n(function (MessageWriter) {\n function is(value) {\n let candidate = value;\n return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\n Is.func(candidate.onError) && Is.func(candidate.write);\n }\n MessageWriter.is = is;\n})(MessageWriter || (exports.MessageWriter = MessageWriter = {}));\nclass AbstractMessageWriter {\n constructor() {\n this.errorEmitter = new events_1.Emitter();\n this.closeEmitter = new events_1.Emitter();\n }\n dispose() {\n this.errorEmitter.dispose();\n this.closeEmitter.dispose();\n }\n get onError() {\n return this.errorEmitter.event;\n }\n fireError(error, message, count) {\n this.errorEmitter.fire([this.asError(error), message, count]);\n }\n get onClose() {\n return this.closeEmitter.event;\n }\n fireClose() {\n this.closeEmitter.fire(undefined);\n }\n asError(error) {\n if (error instanceof Error) {\n return error;\n }\n else {\n return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\n }\n }\n}\nexports.AbstractMessageWriter = AbstractMessageWriter;\nvar ResolvedMessageWriterOptions;\n(function (ResolvedMessageWriterOptions) {\n function fromOptions(options) {\n if (options === undefined || typeof options === 'string') {\n return { charset: options ?? 'utf-8', contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder };\n }\n else {\n return { charset: options.charset ?? 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: options.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder };\n }\n }\n ResolvedMessageWriterOptions.fromOptions = fromOptions;\n})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));\nclass WriteableStreamMessageWriter extends AbstractMessageWriter {\n constructor(writable, options) {\n super();\n this.writable = writable;\n this.options = ResolvedMessageWriterOptions.fromOptions(options);\n this.errorCount = 0;\n this.writeSemaphore = new semaphore_1.Semaphore(1);\n this.writable.onError((error) => this.fireError(error));\n this.writable.onClose(() => this.fireClose());\n }\n async write(msg) {\n return this.writeSemaphore.lock(async () => {\n const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {\n if (this.options.contentEncoder !== undefined) {\n return this.options.contentEncoder.encode(buffer);\n }\n else {\n return buffer;\n }\n });\n return payload.then((buffer) => {\n const headers = [];\n headers.push(ContentLength, buffer.byteLength.toString(), CRLF);\n headers.push(CRLF);\n return this.doWrite(msg, headers, buffer);\n }, (error) => {\n this.fireError(error);\n throw error;\n });\n });\n }\n async doWrite(msg, headers, data) {\n try {\n await this.writable.write(headers.join(''), 'ascii');\n return this.writable.write(data);\n }\n catch (error) {\n this.handleError(error, msg);\n return Promise.reject(error);\n }\n }\n handleError(error, msg) {\n this.errorCount++;\n this.fireError(error, msg, this.errorCount);\n }\n end() {\n this.writable.end();\n }\n}\nexports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbstractMessageBuffer = void 0;\nconst CR = 13;\nconst LF = 10;\nconst CRLF = '\\r\\n';\nclass AbstractMessageBuffer {\n constructor(encoding = 'utf-8') {\n this._encoding = encoding;\n this._chunks = [];\n this._totalLength = 0;\n }\n get encoding() {\n return this._encoding;\n }\n append(chunk) {\n const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;\n this._chunks.push(toAppend);\n this._totalLength += toAppend.byteLength;\n }\n tryReadHeaders(lowerCaseKeys = false) {\n if (this._chunks.length === 0) {\n return undefined;\n }\n let state = 0;\n let chunkIndex = 0;\n let offset = 0;\n let chunkBytesRead = 0;\n row: while (chunkIndex < this._chunks.length) {\n const chunk = this._chunks[chunkIndex];\n offset = 0;\n column: while (offset < chunk.length) {\n const value = chunk[offset];\n switch (value) {\n case CR:\n switch (state) {\n case 0:\n state = 1;\n break;\n case 2:\n state = 3;\n break;\n default:\n state = 0;\n }\n break;\n case LF:\n switch (state) {\n case 1:\n state = 2;\n break;\n case 3:\n state = 4;\n offset++;\n break row;\n default:\n state = 0;\n }\n break;\n default:\n state = 0;\n }\n offset++;\n }\n chunkBytesRead += chunk.byteLength;\n chunkIndex++;\n }\n if (state !== 4) {\n return undefined;\n }\n // The buffer contains the two CRLF at the end. So we will\n // have two empty lines after the split at the end as well.\n const buffer = this._read(chunkBytesRead + offset);\n const result = new Map();\n const headers = this.toString(buffer, 'ascii').split(CRLF);\n if (headers.length < 2) {\n return result;\n }\n for (let i = 0; i < headers.length - 2; i++) {\n const header = headers[i];\n const index = header.indexOf(':');\n if (index === -1) {\n throw new Error(`Message header must separate key and value using ':'\\n${header}`);\n }\n const key = header.substr(0, index);\n const value = header.substr(index + 1).trim();\n result.set(lowerCaseKeys ? key.toLowerCase() : key, value);\n }\n return result;\n }\n tryReadBody(length) {\n if (this._totalLength < length) {\n return undefined;\n }\n return this._read(length);\n }\n get numberOfBytes() {\n return this._totalLength;\n }\n _read(byteCount) {\n if (byteCount === 0) {\n return this.emptyBuffer();\n }\n if (byteCount > this._totalLength) {\n throw new Error(`Cannot read so many bytes!`);\n }\n if (this._chunks[0].byteLength === byteCount) {\n // super fast path, precisely first chunk must be returned\n const chunk = this._chunks[0];\n this._chunks.shift();\n this._totalLength -= byteCount;\n return this.asNative(chunk);\n }\n if (this._chunks[0].byteLength > byteCount) {\n // fast path, the reading is entirely within the first chunk\n const chunk = this._chunks[0];\n const result = this.asNative(chunk, byteCount);\n this._chunks[0] = chunk.slice(byteCount);\n this._totalLength -= byteCount;\n return result;\n }\n const result = this.allocNative(byteCount);\n let resultOffset = 0;\n let chunkIndex = 0;\n while (byteCount > 0) {\n const chunk = this._chunks[chunkIndex];\n if (chunk.byteLength > byteCount) {\n // this chunk will survive\n const chunkPart = chunk.slice(0, byteCount);\n result.set(chunkPart, resultOffset);\n resultOffset += byteCount;\n this._chunks[chunkIndex] = chunk.slice(byteCount);\n this._totalLength -= byteCount;\n byteCount -= byteCount;\n }\n else {\n // this chunk will be entirely read\n result.set(chunk, resultOffset);\n resultOffset += chunk.byteLength;\n this._chunks.shift();\n this._totalLength -= chunk.byteLength;\n byteCount -= chunk.byteLength;\n }\n }\n return result;\n }\n}\nexports.AbstractMessageBuffer = AbstractMessageBuffer;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createMessageConnection = exports.ConnectionOptions = exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = exports.NullLogger = exports.ProgressType = exports.ProgressToken = void 0;\nconst ral_1 = require(\"./ral\");\nconst Is = require(\"./is\");\nconst messages_1 = require(\"./messages\");\nconst linkedMap_1 = require(\"./linkedMap\");\nconst events_1 = require(\"./events\");\nconst cancellation_1 = require(\"./cancellation\");\nvar CancelNotification;\n(function (CancelNotification) {\n CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\n})(CancelNotification || (CancelNotification = {}));\nvar ProgressToken;\n(function (ProgressToken) {\n function is(value) {\n return typeof value === 'string' || typeof value === 'number';\n }\n ProgressToken.is = is;\n})(ProgressToken || (exports.ProgressToken = ProgressToken = {}));\nvar ProgressNotification;\n(function (ProgressNotification) {\n ProgressNotification.type = new messages_1.NotificationType('$/progress');\n})(ProgressNotification || (ProgressNotification = {}));\nclass ProgressType {\n constructor() {\n }\n}\nexports.ProgressType = ProgressType;\nvar StarRequestHandler;\n(function (StarRequestHandler) {\n function is(value) {\n return Is.func(value);\n }\n StarRequestHandler.is = is;\n})(StarRequestHandler || (StarRequestHandler = {}));\nexports.NullLogger = Object.freeze({\n error: () => { },\n warn: () => { },\n info: () => { },\n log: () => { }\n});\nvar Trace;\n(function (Trace) {\n Trace[Trace[\"Off\"] = 0] = \"Off\";\n Trace[Trace[\"Messages\"] = 1] = \"Messages\";\n Trace[Trace[\"Compact\"] = 2] = \"Compact\";\n Trace[Trace[\"Verbose\"] = 3] = \"Verbose\";\n})(Trace || (exports.Trace = Trace = {}));\nvar TraceValues;\n(function (TraceValues) {\n /**\n * Turn tracing off.\n */\n TraceValues.Off = 'off';\n /**\n * Trace messages only.\n */\n TraceValues.Messages = 'messages';\n /**\n * Compact message tracing.\n */\n TraceValues.Compact = 'compact';\n /**\n * Verbose message tracing.\n */\n TraceValues.Verbose = 'verbose';\n})(TraceValues || (exports.TraceValues = TraceValues = {}));\n(function (Trace) {\n function fromString(value) {\n if (!Is.string(value)) {\n return Trace.Off;\n }\n value = value.toLowerCase();\n switch (value) {\n case 'off':\n return Trace.Off;\n case 'messages':\n return Trace.Messages;\n case 'compact':\n return Trace.Compact;\n case 'verbose':\n return Trace.Verbose;\n default:\n return Trace.Off;\n }\n }\n Trace.fromString = fromString;\n function toString(value) {\n switch (value) {\n case Trace.Off:\n return 'off';\n case Trace.Messages:\n return 'messages';\n case Trace.Compact:\n return 'compact';\n case Trace.Verbose:\n return 'verbose';\n default:\n return 'off';\n }\n }\n Trace.toString = toString;\n})(Trace || (exports.Trace = Trace = {}));\nvar TraceFormat;\n(function (TraceFormat) {\n TraceFormat[\"Text\"] = \"text\";\n TraceFormat[\"JSON\"] = \"json\";\n})(TraceFormat || (exports.TraceFormat = TraceFormat = {}));\n(function (TraceFormat) {\n function fromString(value) {\n if (!Is.string(value)) {\n return TraceFormat.Text;\n }\n value = value.toLowerCase();\n if (value === 'json') {\n return TraceFormat.JSON;\n }\n else {\n return TraceFormat.Text;\n }\n }\n TraceFormat.fromString = fromString;\n})(TraceFormat || (exports.TraceFormat = TraceFormat = {}));\nvar SetTraceNotification;\n(function (SetTraceNotification) {\n SetTraceNotification.type = new messages_1.NotificationType('$/setTrace');\n})(SetTraceNotification || (exports.SetTraceNotification = SetTraceNotification = {}));\nvar LogTraceNotification;\n(function (LogTraceNotification) {\n LogTraceNotification.type = new messages_1.NotificationType('$/logTrace');\n})(LogTraceNotification || (exports.LogTraceNotification = LogTraceNotification = {}));\nvar ConnectionErrors;\n(function (ConnectionErrors) {\n /**\n * The connection is closed.\n */\n ConnectionErrors[ConnectionErrors[\"Closed\"] = 1] = \"Closed\";\n /**\n * The connection got disposed.\n */\n ConnectionErrors[ConnectionErrors[\"Disposed\"] = 2] = \"Disposed\";\n /**\n * The connection is already in listening mode.\n */\n ConnectionErrors[ConnectionErrors[\"AlreadyListening\"] = 3] = \"AlreadyListening\";\n})(ConnectionErrors || (exports.ConnectionErrors = ConnectionErrors = {}));\nclass ConnectionError extends Error {\n constructor(code, message) {\n super(message);\n this.code = code;\n Object.setPrototypeOf(this, ConnectionError.prototype);\n }\n}\nexports.ConnectionError = ConnectionError;\nvar ConnectionStrategy;\n(function (ConnectionStrategy) {\n function is(value) {\n const candidate = value;\n return candidate && Is.func(candidate.cancelUndispatched);\n }\n ConnectionStrategy.is = is;\n})(ConnectionStrategy || (exports.ConnectionStrategy = ConnectionStrategy = {}));\nvar IdCancellationReceiverStrategy;\n(function (IdCancellationReceiverStrategy) {\n function is(value) {\n const candidate = value;\n return candidate && (candidate.kind === undefined || candidate.kind === 'id') && Is.func(candidate.createCancellationTokenSource) && (candidate.dispose === undefined || Is.func(candidate.dispose));\n }\n IdCancellationReceiverStrategy.is = is;\n})(IdCancellationReceiverStrategy || (exports.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {}));\nvar RequestCancellationReceiverStrategy;\n(function (RequestCancellationReceiverStrategy) {\n function is(value) {\n const candidate = value;\n return candidate && candidate.kind === 'request' && Is.func(candidate.createCancellationTokenSource) && (candidate.dispose === undefined || Is.func(candidate.dispose));\n }\n RequestCancellationReceiverStrategy.is = is;\n})(RequestCancellationReceiverStrategy || (exports.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {}));\nvar CancellationReceiverStrategy;\n(function (CancellationReceiverStrategy) {\n CancellationReceiverStrategy.Message = Object.freeze({\n createCancellationTokenSource(_) {\n return new cancellation_1.CancellationTokenSource();\n }\n });\n function is(value) {\n return IdCancellationReceiverStrategy.is(value) || RequestCancellationReceiverStrategy.is(value);\n }\n CancellationReceiverStrategy.is = is;\n})(CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = CancellationReceiverStrategy = {}));\nvar CancellationSenderStrategy;\n(function (CancellationSenderStrategy) {\n CancellationSenderStrategy.Message = Object.freeze({\n sendCancellation(conn, id) {\n return conn.sendNotification(CancelNotification.type, { id });\n },\n cleanup(_) { }\n });\n function is(value) {\n const candidate = value;\n return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);\n }\n CancellationSenderStrategy.is = is;\n})(CancellationSenderStrategy || (exports.CancellationSenderStrategy = CancellationSenderStrategy = {}));\nvar CancellationStrategy;\n(function (CancellationStrategy) {\n CancellationStrategy.Message = Object.freeze({\n receiver: CancellationReceiverStrategy.Message,\n sender: CancellationSenderStrategy.Message\n });\n function is(value) {\n const candidate = value;\n return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);\n }\n CancellationStrategy.is = is;\n})(CancellationStrategy || (exports.CancellationStrategy = CancellationStrategy = {}));\nvar MessageStrategy;\n(function (MessageStrategy) {\n function is(value) {\n const candidate = value;\n return candidate && Is.func(candidate.handleMessage);\n }\n MessageStrategy.is = is;\n})(MessageStrategy || (exports.MessageStrategy = MessageStrategy = {}));\nvar ConnectionOptions;\n(function (ConnectionOptions) {\n function is(value) {\n const candidate = value;\n return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy));\n }\n ConnectionOptions.is = is;\n})(ConnectionOptions || (exports.ConnectionOptions = ConnectionOptions = {}));\nvar ConnectionState;\n(function (ConnectionState) {\n ConnectionState[ConnectionState[\"New\"] = 1] = \"New\";\n ConnectionState[ConnectionState[\"Listening\"] = 2] = \"Listening\";\n ConnectionState[ConnectionState[\"Closed\"] = 3] = \"Closed\";\n ConnectionState[ConnectionState[\"Disposed\"] = 4] = \"Disposed\";\n})(ConnectionState || (ConnectionState = {}));\nfunction createMessageConnection(messageReader, messageWriter, _logger, options) {\n const logger = _logger !== undefined ? _logger : exports.NullLogger;\n let sequenceNumber = 0;\n let notificationSequenceNumber = 0;\n let unknownResponseSequenceNumber = 0;\n const version = '2.0';\n let starRequestHandler = undefined;\n const requestHandlers = new Map();\n let starNotificationHandler = undefined;\n const notificationHandlers = new Map();\n const progressHandlers = new Map();\n let timer;\n let messageQueue = new linkedMap_1.LinkedMap();\n let responsePromises = new Map();\n let knownCanceledRequests = new Set();\n let requestTokens = new Map();\n let trace = Trace.Off;\n let traceFormat = TraceFormat.Text;\n let tracer;\n let state = ConnectionState.New;\n const errorEmitter = new events_1.Emitter();\n const closeEmitter = new events_1.Emitter();\n const unhandledNotificationEmitter = new events_1.Emitter();\n const unhandledProgressEmitter = new events_1.Emitter();\n const disposeEmitter = new events_1.Emitter();\n const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message;\n function createRequestQueueKey(id) {\n if (id === null) {\n throw new Error(`Can't send requests with id null since the response can't be correlated.`);\n }\n return 'req-' + id.toString();\n }\n function createResponseQueueKey(id) {\n if (id === null) {\n return 'res-unknown-' + (++unknownResponseSequenceNumber).toString();\n }\n else {\n return 'res-' + id.toString();\n }\n }\n function createNotificationQueueKey() {\n return 'not-' + (++notificationSequenceNumber).toString();\n }\n function addMessageToQueue(queue, message) {\n if (messages_1.Message.isRequest(message)) {\n queue.set(createRequestQueueKey(message.id), message);\n }\n else if (messages_1.Message.isResponse(message)) {\n queue.set(createResponseQueueKey(message.id), message);\n }\n else {\n queue.set(createNotificationQueueKey(), message);\n }\n }\n function cancelUndispatched(_message) {\n return undefined;\n }\n function isListening() {\n return state === ConnectionState.Listening;\n }\n function isClosed() {\n return state === ConnectionState.Closed;\n }\n function isDisposed() {\n return state === ConnectionState.Disposed;\n }\n function closeHandler() {\n if (state === ConnectionState.New || state === ConnectionState.Listening) {\n state = ConnectionState.Closed;\n closeEmitter.fire(undefined);\n }\n // If the connection is disposed don't sent close events.\n }\n function readErrorHandler(error) {\n errorEmitter.fire([error, undefined, undefined]);\n }\n function writeErrorHandler(data) {\n errorEmitter.fire(data);\n }\n messageReader.onClose(closeHandler);\n messageReader.onError(readErrorHandler);\n messageWriter.onClose(closeHandler);\n messageWriter.onError(writeErrorHandler);\n function triggerMessageQueue() {\n if (timer || messageQueue.size === 0) {\n return;\n }\n timer = (0, ral_1.default)().timer.setImmediate(() => {\n timer = undefined;\n processMessageQueue();\n });\n }\n function handleMessage(message) {\n if (messages_1.Message.isRequest(message)) {\n handleRequest(message);\n }\n else if (messages_1.Message.isNotification(message)) {\n handleNotification(message);\n }\n else if (messages_1.Message.isResponse(message)) {\n handleResponse(message);\n }\n else {\n handleInvalidMessage(message);\n }\n }\n function processMessageQueue() {\n if (messageQueue.size === 0) {\n return;\n }\n const message = messageQueue.shift();\n try {\n const messageStrategy = options?.messageStrategy;\n if (MessageStrategy.is(messageStrategy)) {\n messageStrategy.handleMessage(message, handleMessage);\n }\n else {\n handleMessage(message);\n }\n }\n finally {\n triggerMessageQueue();\n }\n }\n const callback = (message) => {\n try {\n // We have received a cancellation message. Check if the message is still in the queue\n // and cancel it if allowed to do so.\n if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) {\n const cancelId = message.params.id;\n const key = createRequestQueueKey(cancelId);\n const toCancel = messageQueue.get(key);\n if (messages_1.Message.isRequest(toCancel)) {\n const strategy = options?.connectionStrategy;\n const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\n if (response && (response.error !== undefined || response.result !== undefined)) {\n messageQueue.delete(key);\n requestTokens.delete(cancelId);\n response.id = toCancel.id;\n traceSendingResponse(response, message.method, Date.now());\n messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`));\n return;\n }\n }\n const cancellationToken = requestTokens.get(cancelId);\n // The request is already running. Cancel the token\n if (cancellationToken !== undefined) {\n cancellationToken.cancel();\n traceReceivedNotification(message);\n return;\n }\n else {\n // Remember the cancel but still queue the message to\n // clean up state in process message.\n knownCanceledRequests.add(cancelId);\n }\n }\n addMessageToQueue(messageQueue, message);\n }\n finally {\n triggerMessageQueue();\n }\n };\n function handleRequest(requestMessage) {\n if (isDisposed()) {\n // we return here silently since we fired an event when the\n // connection got disposed.\n return;\n }\n function reply(resultOrError, method, startTime) {\n const message = {\n jsonrpc: version,\n id: requestMessage.id\n };\n if (resultOrError instanceof messages_1.ResponseError) {\n message.error = resultOrError.toJson();\n }\n else {\n message.result = resultOrError === undefined ? null : resultOrError;\n }\n traceSendingResponse(message, method, startTime);\n messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));\n }\n function replyError(error, method, startTime) {\n const message = {\n jsonrpc: version,\n id: requestMessage.id,\n error: error.toJson()\n };\n traceSendingResponse(message, method, startTime);\n messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));\n }\n function replySuccess(result, method, startTime) {\n // The JSON RPC defines that a response must either have a result or an error\n // So we can't treat undefined as a valid response result.\n if (result === undefined) {\n result = null;\n }\n const message = {\n jsonrpc: version,\n id: requestMessage.id,\n result: result\n };\n traceSendingResponse(message, method, startTime);\n messageWriter.write(message).catch(() => logger.error(`Sending response failed.`));\n }\n traceReceivedRequest(requestMessage);\n const element = requestHandlers.get(requestMessage.method);\n let type;\n let requestHandler;\n if (element) {\n type = element.type;\n requestHandler = element.handler;\n }\n const startTime = Date.now();\n if (requestHandler || starRequestHandler) {\n const tokenKey = requestMessage.id ?? String(Date.now()); //\n const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver)\n ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey)\n : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage);\n if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) {\n cancellationSource.cancel();\n }\n if (requestMessage.id !== null) {\n requestTokens.set(tokenKey, cancellationSource);\n }\n try {\n let handlerResult;\n if (requestHandler) {\n if (requestMessage.params === undefined) {\n if (type !== undefined && type.numberOfParams !== 0) {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime);\n return;\n }\n handlerResult = requestHandler(cancellationSource.token);\n }\n else if (Array.isArray(requestMessage.params)) {\n if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byName) {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);\n return;\n }\n handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);\n }\n else {\n if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);\n return;\n }\n handlerResult = requestHandler(requestMessage.params, cancellationSource.token);\n }\n }\n else if (starRequestHandler) {\n handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\n }\n const promise = handlerResult;\n if (!handlerResult) {\n requestTokens.delete(tokenKey);\n replySuccess(handlerResult, requestMessage.method, startTime);\n }\n else if (promise.then) {\n promise.then((resultOrError) => {\n requestTokens.delete(tokenKey);\n reply(resultOrError, requestMessage.method, startTime);\n }, error => {\n requestTokens.delete(tokenKey);\n if (error instanceof messages_1.ResponseError) {\n replyError(error, requestMessage.method, startTime);\n }\n else if (error && Is.string(error.message)) {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\n }\n else {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\n }\n });\n }\n else {\n requestTokens.delete(tokenKey);\n reply(handlerResult, requestMessage.method, startTime);\n }\n }\n catch (error) {\n requestTokens.delete(tokenKey);\n if (error instanceof messages_1.ResponseError) {\n reply(error, requestMessage.method, startTime);\n }\n else if (error && Is.string(error.message)) {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\n }\n else {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\n }\n }\n }\n else {\n replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\n }\n }\n function handleResponse(responseMessage) {\n if (isDisposed()) {\n // See handle request.\n return;\n }\n if (responseMessage.id === null) {\n if (responseMessage.error) {\n logger.error(`Received response message without id: Error is: \\n${JSON.stringify(responseMessage.error, undefined, 4)}`);\n }\n else {\n logger.error(`Received response message without id. No further error information provided.`);\n }\n }\n else {\n const key = responseMessage.id;\n const responsePromise = responsePromises.get(key);\n traceReceivedResponse(responseMessage, responsePromise);\n if (responsePromise !== undefined) {\n responsePromises.delete(key);\n try {\n if (responseMessage.error) {\n const error = responseMessage.error;\n responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\n }\n else if (responseMessage.result !== undefined) {\n responsePromise.resolve(responseMessage.result);\n }\n else {\n throw new Error('Should never happen.');\n }\n }\n catch (error) {\n if (error.message) {\n logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\n }\n else {\n logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\n }\n }\n }\n }\n }\n function handleNotification(message) {\n if (isDisposed()) {\n // See handle request.\n return;\n }\n let type = undefined;\n let notificationHandler;\n if (message.method === CancelNotification.type.method) {\n const cancelId = message.params.id;\n knownCanceledRequests.delete(cancelId);\n traceReceivedNotification(message);\n return;\n }\n else {\n const element = notificationHandlers.get(message.method);\n if (element) {\n notificationHandler = element.handler;\n type = element.type;\n }\n }\n if (notificationHandler || starNotificationHandler) {\n try {\n traceReceivedNotification(message);\n if (notificationHandler) {\n if (message.params === undefined) {\n if (type !== undefined) {\n if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {\n logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`);\n }\n }\n notificationHandler();\n }\n else if (Array.isArray(message.params)) {\n // There are JSON-RPC libraries that send progress message as positional params although\n // specified as named. So convert them if this is the case.\n const params = message.params;\n if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) {\n notificationHandler({ token: params[0], value: params[1] });\n }\n else {\n if (type !== undefined) {\n if (type.parameterStructures === messages_1.ParameterStructures.byName) {\n logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);\n }\n if (type.numberOfParams !== message.params.length) {\n logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`);\n }\n }\n notificationHandler(...params);\n }\n }\n else {\n if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {\n logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);\n }\n notificationHandler(message.params);\n }\n }\n else if (starNotificationHandler) {\n starNotificationHandler(message.method, message.params);\n }\n }\n catch (error) {\n if (error.message) {\n logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\n }\n else {\n logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\n }\n }\n }\n else {\n unhandledNotificationEmitter.fire(message);\n }\n }\n function handleInvalidMessage(message) {\n if (!message) {\n logger.error('Received empty message.');\n return;\n }\n logger.error(`Received message which is neither a response nor a notification message:\\n${JSON.stringify(message, null, 4)}`);\n // Test whether we find an id to reject the promise\n const responseMessage = message;\n if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\n const key = responseMessage.id;\n const responseHandler = responsePromises.get(key);\n if (responseHandler) {\n responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\n }\n }\n }\n function stringifyTrace(params) {\n if (params === undefined || params === null) {\n return undefined;\n }\n switch (trace) {\n case Trace.Verbose:\n return JSON.stringify(params, null, 4);\n case Trace.Compact:\n return JSON.stringify(params);\n default:\n return undefined;\n }\n }\n function traceSendingRequest(message) {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {\n data = `Params: ${stringifyTrace(message.params)}\\n\\n`;\n }\n tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\n }\n else {\n logLSPMessage('send-request', message);\n }\n }\n function traceSendingNotification(message) {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if (trace === Trace.Verbose || trace === Trace.Compact) {\n if (message.params) {\n data = `Params: ${stringifyTrace(message.params)}\\n\\n`;\n }\n else {\n data = 'No parameters provided.\\n\\n';\n }\n }\n tracer.log(`Sending notification '${message.method}'.`, data);\n }\n else {\n logLSPMessage('send-notification', message);\n }\n }\n function traceSendingResponse(message, method, startTime) {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if (trace === Trace.Verbose || trace === Trace.Compact) {\n if (message.error && message.error.data) {\n data = `Error data: ${stringifyTrace(message.error.data)}\\n\\n`;\n }\n else {\n if (message.result) {\n data = `Result: ${stringifyTrace(message.result)}\\n\\n`;\n }\n else if (message.error === undefined) {\n data = 'No result returned.\\n\\n';\n }\n }\n }\n tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\n }\n else {\n logLSPMessage('send-response', message);\n }\n }\n function traceReceivedRequest(message) {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) {\n data = `Params: ${stringifyTrace(message.params)}\\n\\n`;\n }\n tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\n }\n else {\n logLSPMessage('receive-request', message);\n }\n }\n function traceReceivedNotification(message) {\n if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if (trace === Trace.Verbose || trace === Trace.Compact) {\n if (message.params) {\n data = `Params: ${stringifyTrace(message.params)}\\n\\n`;\n }\n else {\n data = 'No parameters provided.\\n\\n';\n }\n }\n tracer.log(`Received notification '${message.method}'.`, data);\n }\n else {\n logLSPMessage('receive-notification', message);\n }\n }\n function traceReceivedResponse(message, responsePromise) {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n if (traceFormat === TraceFormat.Text) {\n let data = undefined;\n if (trace === Trace.Verbose || trace === Trace.Compact) {\n if (message.error && message.error.data) {\n data = `Error data: ${stringifyTrace(message.error.data)}\\n\\n`;\n }\n else {\n if (message.result) {\n data = `Result: ${stringifyTrace(message.result)}\\n\\n`;\n }\n else if (message.error === undefined) {\n data = 'No result returned.\\n\\n';\n }\n }\n }\n if (responsePromise) {\n const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\n tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\n }\n else {\n tracer.log(`Received response ${message.id} without active response promise.`, data);\n }\n }\n else {\n logLSPMessage('receive-response', message);\n }\n }\n function logLSPMessage(type, message) {\n if (!tracer || trace === Trace.Off) {\n return;\n }\n const lspMessage = {\n isLSPMessage: true,\n type,\n message,\n timestamp: Date.now()\n };\n tracer.log(lspMessage);\n }\n function throwIfClosedOrDisposed() {\n if (isClosed()) {\n throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\n }\n if (isDisposed()) {\n throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\n }\n }\n function throwIfListening() {\n if (isListening()) {\n throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\n }\n }\n function throwIfNotListening() {\n if (!isListening()) {\n throw new Error('Call listen() first.');\n }\n }\n function undefinedToNull(param) {\n if (param === undefined) {\n return null;\n }\n else {\n return param;\n }\n }\n function nullToUndefined(param) {\n if (param === null) {\n return undefined;\n }\n else {\n return param;\n }\n }\n function isNamedParam(param) {\n return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';\n }\n function computeSingleParam(parameterStructures, param) {\n switch (parameterStructures) {\n case messages_1.ParameterStructures.auto:\n if (isNamedParam(param)) {\n return nullToUndefined(param);\n }\n else {\n return [undefinedToNull(param)];\n }\n case messages_1.ParameterStructures.byName:\n if (!isNamedParam(param)) {\n throw new Error(`Received parameters by name but param is not an object literal.`);\n }\n return nullToUndefined(param);\n case messages_1.ParameterStructures.byPosition:\n return [undefinedToNull(param)];\n default:\n throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);\n }\n }\n function computeMessageParams(type, params) {\n let result;\n const numberOfParams = type.numberOfParams;\n switch (numberOfParams) {\n case 0:\n result = undefined;\n break;\n case 1:\n result = computeSingleParam(type.parameterStructures, params[0]);\n break;\n default:\n result = [];\n for (let i = 0; i < params.length && i < numberOfParams; i++) {\n result.push(undefinedToNull(params[i]));\n }\n if (params.length < numberOfParams) {\n for (let i = params.length; i < numberOfParams; i++) {\n result.push(null);\n }\n }\n break;\n }\n return result;\n }\n const connection = {\n sendNotification: (type, ...args) => {\n throwIfClosedOrDisposed();\n let method;\n let messageParams;\n if (Is.string(type)) {\n method = type;\n const first = args[0];\n let paramStart = 0;\n let parameterStructures = messages_1.ParameterStructures.auto;\n if (messages_1.ParameterStructures.is(first)) {\n paramStart = 1;\n parameterStructures = first;\n }\n let paramEnd = args.length;\n const numberOfParams = paramEnd - paramStart;\n switch (numberOfParams) {\n case 0:\n messageParams = undefined;\n break;\n case 1:\n messageParams = computeSingleParam(parameterStructures, args[paramStart]);\n break;\n default:\n if (parameterStructures === messages_1.ParameterStructures.byName) {\n throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`);\n }\n messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));\n break;\n }\n }\n else {\n const params = args;\n method = type.method;\n messageParams = computeMessageParams(type, params);\n }\n const notificationMessage = {\n jsonrpc: version,\n method: method,\n params: messageParams\n };\n traceSendingNotification(notificationMessage);\n return messageWriter.write(notificationMessage).catch((error) => {\n logger.error(`Sending notification failed.`);\n throw error;\n });\n },\n onNotification: (type, handler) => {\n throwIfClosedOrDisposed();\n let method;\n if (Is.func(type)) {\n starNotificationHandler = type;\n }\n else if (handler) {\n if (Is.string(type)) {\n method = type;\n notificationHandlers.set(type, { type: undefined, handler });\n }\n else {\n method = type.method;\n notificationHandlers.set(type.method, { type, handler });\n }\n }\n return {\n dispose: () => {\n if (method !== undefined) {\n notificationHandlers.delete(method);\n }\n else {\n starNotificationHandler = undefined;\n }\n }\n };\n },\n onProgress: (_type, token, handler) => {\n if (progressHandlers.has(token)) {\n throw new Error(`Progress handler for token ${token} already registered`);\n }\n progressHandlers.set(token, handler);\n return {\n dispose: () => {\n progressHandlers.delete(token);\n }\n };\n },\n sendProgress: (_type, token, value) => {\n // This should not await but simple return to ensure that we don't have another\n // async scheduling. Otherwise one send could overtake another send.\n return connection.sendNotification(ProgressNotification.type, { token, value });\n },\n onUnhandledProgress: unhandledProgressEmitter.event,\n sendRequest: (type, ...args) => {\n throwIfClosedOrDisposed();\n throwIfNotListening();\n let method;\n let messageParams;\n let token = undefined;\n if (Is.string(type)) {\n method = type;\n const first = args[0];\n const last = args[args.length - 1];\n let paramStart = 0;\n let parameterStructures = messages_1.ParameterStructures.auto;\n if (messages_1.ParameterStructures.is(first)) {\n paramStart = 1;\n parameterStructures = first;\n }\n let paramEnd = args.length;\n if (cancellation_1.CancellationToken.is(last)) {\n paramEnd = paramEnd - 1;\n token = last;\n }\n const numberOfParams = paramEnd - paramStart;\n switch (numberOfParams) {\n case 0:\n messageParams = undefined;\n break;\n case 1:\n messageParams = computeSingleParam(parameterStructures, args[paramStart]);\n break;\n default:\n if (parameterStructures === messages_1.ParameterStructures.byName) {\n throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`);\n }\n messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));\n break;\n }\n }\n else {\n const params = args;\n method = type.method;\n messageParams = computeMessageParams(type, params);\n const numberOfParams = type.numberOfParams;\n token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\n }\n const id = sequenceNumber++;\n let disposable;\n if (token) {\n disposable = token.onCancellationRequested(() => {\n const p = cancellationStrategy.sender.sendCancellation(connection, id);\n if (p === undefined) {\n logger.log(`Received no promise from cancellation strategy when cancelling id ${id}`);\n return Promise.resolve();\n }\n else {\n return p.catch(() => {\n logger.log(`Sending cancellation messages for id ${id} failed`);\n });\n }\n });\n }\n const requestMessage = {\n jsonrpc: version,\n id: id,\n method: method,\n params: messageParams\n };\n traceSendingRequest(requestMessage);\n if (typeof cancellationStrategy.sender.enableCancellation === 'function') {\n cancellationStrategy.sender.enableCancellation(requestMessage);\n }\n return new Promise(async (resolve, reject) => {\n const resolveWithCleanup = (r) => {\n resolve(r);\n cancellationStrategy.sender.cleanup(id);\n disposable?.dispose();\n };\n const rejectWithCleanup = (r) => {\n reject(r);\n cancellationStrategy.sender.cleanup(id);\n disposable?.dispose();\n };\n const responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };\n try {\n await messageWriter.write(requestMessage);\n responsePromises.set(id, responsePromise);\n }\n catch (error) {\n logger.error(`Sending request failed.`);\n // Writing the message failed. So we need to reject the promise.\n responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : 'Unknown reason'));\n throw error;\n }\n });\n },\n onRequest: (type, handler) => {\n throwIfClosedOrDisposed();\n let method = null;\n if (StarRequestHandler.is(type)) {\n method = undefined;\n starRequestHandler = type;\n }\n else if (Is.string(type)) {\n method = null;\n if (handler !== undefined) {\n method = type;\n requestHandlers.set(type, { handler: handler, type: undefined });\n }\n }\n else {\n if (handler !== undefined) {\n method = type.method;\n requestHandlers.set(type.method, { type, handler });\n }\n }\n return {\n dispose: () => {\n if (method === null) {\n return;\n }\n if (method !== undefined) {\n requestHandlers.delete(method);\n }\n else {\n starRequestHandler = undefined;\n }\n }\n };\n },\n hasPendingResponse: () => {\n return responsePromises.size > 0;\n },\n trace: async (_value, _tracer, sendNotificationOrTraceOptions) => {\n let _sendNotification = false;\n let _traceFormat = TraceFormat.Text;\n if (sendNotificationOrTraceOptions !== undefined) {\n if (Is.boolean(sendNotificationOrTraceOptions)) {\n _sendNotification = sendNotificationOrTraceOptions;\n }\n else {\n _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\n _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\n }\n }\n trace = _value;\n traceFormat = _traceFormat;\n if (trace === Trace.Off) {\n tracer = undefined;\n }\n else {\n tracer = _tracer;\n }\n if (_sendNotification && !isClosed() && !isDisposed()) {\n await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\n }\n },\n onError: errorEmitter.event,\n onClose: closeEmitter.event,\n onUnhandledNotification: unhandledNotificationEmitter.event,\n onDispose: disposeEmitter.event,\n end: () => {\n messageWriter.end();\n },\n dispose: () => {\n if (isDisposed()) {\n return;\n }\n state = ConnectionState.Disposed;\n disposeEmitter.fire(undefined);\n const error = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, 'Pending response rejected since connection got disposed');\n for (const promise of responsePromises.values()) {\n promise.reject(error);\n }\n responsePromises = new Map();\n requestTokens = new Map();\n knownCanceledRequests = new Set();\n messageQueue = new linkedMap_1.LinkedMap();\n // Test for backwards compatibility\n if (Is.func(messageWriter.dispose)) {\n messageWriter.dispose();\n }\n if (Is.func(messageReader.dispose)) {\n messageReader.dispose();\n }\n },\n listen: () => {\n throwIfClosedOrDisposed();\n throwIfListening();\n state = ConnectionState.Listening;\n messageReader.listen(callback);\n },\n inspect: () => {\n // eslint-disable-next-line no-console\n (0, ral_1.default)().console.log('inspect');\n }\n };\n connection.onNotification(LogTraceNotification.type, (params) => {\n if (trace === Trace.Off || !tracer) {\n return;\n }\n const verbose = trace === Trace.Verbose || trace === Trace.Compact;\n tracer.log(params.message, verbose ? params.verbose : undefined);\n });\n connection.onNotification(ProgressNotification.type, (params) => {\n const handler = progressHandlers.get(params.token);\n if (handler) {\n handler(params.value);\n }\n else {\n unhandledProgressEmitter.fire(params);\n }\n });\n return connection;\n}\nexports.createMessageConnection = createMessageConnection;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n/// \nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0;\nexports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0;\nconst messages_1 = require(\"./messages\");\nObject.defineProperty(exports, \"Message\", { enumerable: true, get: function () { return messages_1.Message; } });\nObject.defineProperty(exports, \"RequestType\", { enumerable: true, get: function () { return messages_1.RequestType; } });\nObject.defineProperty(exports, \"RequestType0\", { enumerable: true, get: function () { return messages_1.RequestType0; } });\nObject.defineProperty(exports, \"RequestType1\", { enumerable: true, get: function () { return messages_1.RequestType1; } });\nObject.defineProperty(exports, \"RequestType2\", { enumerable: true, get: function () { return messages_1.RequestType2; } });\nObject.defineProperty(exports, \"RequestType3\", { enumerable: true, get: function () { return messages_1.RequestType3; } });\nObject.defineProperty(exports, \"RequestType4\", { enumerable: true, get: function () { return messages_1.RequestType4; } });\nObject.defineProperty(exports, \"RequestType5\", { enumerable: true, get: function () { return messages_1.RequestType5; } });\nObject.defineProperty(exports, \"RequestType6\", { enumerable: true, get: function () { return messages_1.RequestType6; } });\nObject.defineProperty(exports, \"RequestType7\", { enumerable: true, get: function () { return messages_1.RequestType7; } });\nObject.defineProperty(exports, \"RequestType8\", { enumerable: true, get: function () { return messages_1.RequestType8; } });\nObject.defineProperty(exports, \"RequestType9\", { enumerable: true, get: function () { return messages_1.RequestType9; } });\nObject.defineProperty(exports, \"ResponseError\", { enumerable: true, get: function () { return messages_1.ResponseError; } });\nObject.defineProperty(exports, \"ErrorCodes\", { enumerable: true, get: function () { return messages_1.ErrorCodes; } });\nObject.defineProperty(exports, \"NotificationType\", { enumerable: true, get: function () { return messages_1.NotificationType; } });\nObject.defineProperty(exports, \"NotificationType0\", { enumerable: true, get: function () { return messages_1.NotificationType0; } });\nObject.defineProperty(exports, \"NotificationType1\", { enumerable: true, get: function () { return messages_1.NotificationType1; } });\nObject.defineProperty(exports, \"NotificationType2\", { enumerable: true, get: function () { return messages_1.NotificationType2; } });\nObject.defineProperty(exports, \"NotificationType3\", { enumerable: true, get: function () { return messages_1.NotificationType3; } });\nObject.defineProperty(exports, \"NotificationType4\", { enumerable: true, get: function () { return messages_1.NotificationType4; } });\nObject.defineProperty(exports, \"NotificationType5\", { enumerable: true, get: function () { return messages_1.NotificationType5; } });\nObject.defineProperty(exports, \"NotificationType6\", { enumerable: true, get: function () { return messages_1.NotificationType6; } });\nObject.defineProperty(exports, \"NotificationType7\", { enumerable: true, get: function () { return messages_1.NotificationType7; } });\nObject.defineProperty(exports, \"NotificationType8\", { enumerable: true, get: function () { return messages_1.NotificationType8; } });\nObject.defineProperty(exports, \"NotificationType9\", { enumerable: true, get: function () { return messages_1.NotificationType9; } });\nObject.defineProperty(exports, \"ParameterStructures\", { enumerable: true, get: function () { return messages_1.ParameterStructures; } });\nconst linkedMap_1 = require(\"./linkedMap\");\nObject.defineProperty(exports, \"LinkedMap\", { enumerable: true, get: function () { return linkedMap_1.LinkedMap; } });\nObject.defineProperty(exports, \"LRUCache\", { enumerable: true, get: function () { return linkedMap_1.LRUCache; } });\nObject.defineProperty(exports, \"Touch\", { enumerable: true, get: function () { return linkedMap_1.Touch; } });\nconst disposable_1 = require(\"./disposable\");\nObject.defineProperty(exports, \"Disposable\", { enumerable: true, get: function () { return disposable_1.Disposable; } });\nconst events_1 = require(\"./events\");\nObject.defineProperty(exports, \"Event\", { enumerable: true, get: function () { return events_1.Event; } });\nObject.defineProperty(exports, \"Emitter\", { enumerable: true, get: function () { return events_1.Emitter; } });\nconst cancellation_1 = require(\"./cancellation\");\nObject.defineProperty(exports, \"CancellationTokenSource\", { enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } });\nObject.defineProperty(exports, \"CancellationToken\", { enumerable: true, get: function () { return cancellation_1.CancellationToken; } });\nconst sharedArrayCancellation_1 = require(\"./sharedArrayCancellation\");\nObject.defineProperty(exports, \"SharedArraySenderStrategy\", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArraySenderStrategy; } });\nObject.defineProperty(exports, \"SharedArrayReceiverStrategy\", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArrayReceiverStrategy; } });\nconst messageReader_1 = require(\"./messageReader\");\nObject.defineProperty(exports, \"MessageReader\", { enumerable: true, get: function () { return messageReader_1.MessageReader; } });\nObject.defineProperty(exports, \"AbstractMessageReader\", { enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } });\nObject.defineProperty(exports, \"ReadableStreamMessageReader\", { enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } });\nconst messageWriter_1 = require(\"./messageWriter\");\nObject.defineProperty(exports, \"MessageWriter\", { enumerable: true, get: function () { return messageWriter_1.MessageWriter; } });\nObject.defineProperty(exports, \"AbstractMessageWriter\", { enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } });\nObject.defineProperty(exports, \"WriteableStreamMessageWriter\", { enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } });\nconst messageBuffer_1 = require(\"./messageBuffer\");\nObject.defineProperty(exports, \"AbstractMessageBuffer\", { enumerable: true, get: function () { return messageBuffer_1.AbstractMessageBuffer; } });\nconst connection_1 = require(\"./connection\");\nObject.defineProperty(exports, \"ConnectionStrategy\", { enumerable: true, get: function () { return connection_1.ConnectionStrategy; } });\nObject.defineProperty(exports, \"ConnectionOptions\", { enumerable: true, get: function () { return connection_1.ConnectionOptions; } });\nObject.defineProperty(exports, \"NullLogger\", { enumerable: true, get: function () { return connection_1.NullLogger; } });\nObject.defineProperty(exports, \"createMessageConnection\", { enumerable: true, get: function () { return connection_1.createMessageConnection; } });\nObject.defineProperty(exports, \"ProgressToken\", { enumerable: true, get: function () { return connection_1.ProgressToken; } });\nObject.defineProperty(exports, \"ProgressType\", { enumerable: true, get: function () { return connection_1.ProgressType; } });\nObject.defineProperty(exports, \"Trace\", { enumerable: true, get: function () { return connection_1.Trace; } });\nObject.defineProperty(exports, \"TraceValues\", { enumerable: true, get: function () { return connection_1.TraceValues; } });\nObject.defineProperty(exports, \"TraceFormat\", { enumerable: true, get: function () { return connection_1.TraceFormat; } });\nObject.defineProperty(exports, \"SetTraceNotification\", { enumerable: true, get: function () { return connection_1.SetTraceNotification; } });\nObject.defineProperty(exports, \"LogTraceNotification\", { enumerable: true, get: function () { return connection_1.LogTraceNotification; } });\nObject.defineProperty(exports, \"ConnectionErrors\", { enumerable: true, get: function () { return connection_1.ConnectionErrors; } });\nObject.defineProperty(exports, \"ConnectionError\", { enumerable: true, get: function () { return connection_1.ConnectionError; } });\nObject.defineProperty(exports, \"CancellationReceiverStrategy\", { enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } });\nObject.defineProperty(exports, \"CancellationSenderStrategy\", { enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } });\nObject.defineProperty(exports, \"CancellationStrategy\", { enumerable: true, get: function () { return connection_1.CancellationStrategy; } });\nObject.defineProperty(exports, \"MessageStrategy\", { enumerable: true, get: function () { return connection_1.MessageStrategy; } });\nconst ral_1 = require(\"./ral\");\nexports.RAL = ral_1.default;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"util\");\nconst api_1 = require(\"../common/api\");\nclass MessageBuffer extends api_1.AbstractMessageBuffer {\n constructor(encoding = 'utf-8') {\n super(encoding);\n }\n emptyBuffer() {\n return MessageBuffer.emptyBuffer;\n }\n fromString(value, encoding) {\n return Buffer.from(value, encoding);\n }\n toString(value, encoding) {\n if (value instanceof Buffer) {\n return value.toString(encoding);\n }\n else {\n return new util_1.TextDecoder(encoding).decode(value);\n }\n }\n asNative(buffer, length) {\n if (length === undefined) {\n return buffer instanceof Buffer ? buffer : Buffer.from(buffer);\n }\n else {\n return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);\n }\n }\n allocNative(length) {\n return Buffer.allocUnsafe(length);\n }\n}\nMessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);\nclass ReadableStreamWrapper {\n constructor(stream) {\n this.stream = stream;\n }\n onClose(listener) {\n this.stream.on('close', listener);\n return api_1.Disposable.create(() => this.stream.off('close', listener));\n }\n onError(listener) {\n this.stream.on('error', listener);\n return api_1.Disposable.create(() => this.stream.off('error', listener));\n }\n onEnd(listener) {\n this.stream.on('end', listener);\n return api_1.Disposable.create(() => this.stream.off('end', listener));\n }\n onData(listener) {\n this.stream.on('data', listener);\n return api_1.Disposable.create(() => this.stream.off('data', listener));\n }\n}\nclass WritableStreamWrapper {\n constructor(stream) {\n this.stream = stream;\n }\n onClose(listener) {\n this.stream.on('close', listener);\n return api_1.Disposable.create(() => this.stream.off('close', listener));\n }\n onError(listener) {\n this.stream.on('error', listener);\n return api_1.Disposable.create(() => this.stream.off('error', listener));\n }\n onEnd(listener) {\n this.stream.on('end', listener);\n return api_1.Disposable.create(() => this.stream.off('end', listener));\n }\n write(data, encoding) {\n return new Promise((resolve, reject) => {\n const callback = (error) => {\n if (error === undefined || error === null) {\n resolve();\n }\n else {\n reject(error);\n }\n };\n if (typeof data === 'string') {\n this.stream.write(data, encoding, callback);\n }\n else {\n this.stream.write(data, callback);\n }\n });\n }\n end() {\n this.stream.end();\n }\n}\nconst _ril = Object.freeze({\n messageBuffer: Object.freeze({\n create: (encoding) => new MessageBuffer(encoding)\n }),\n applicationJson: Object.freeze({\n encoder: Object.freeze({\n name: 'application/json',\n encode: (msg, options) => {\n try {\n return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n }),\n decoder: Object.freeze({\n name: 'application/json',\n decode: (buffer, options) => {\n try {\n if (buffer instanceof Buffer) {\n return Promise.resolve(JSON.parse(buffer.toString(options.charset)));\n }\n else {\n return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));\n }\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n })\n }),\n stream: Object.freeze({\n asReadableStream: (stream) => new ReadableStreamWrapper(stream),\n asWritableStream: (stream) => new WritableStreamWrapper(stream)\n }),\n console: console,\n timer: Object.freeze({\n setTimeout(callback, ms, ...args) {\n const handle = setTimeout(callback, ms, ...args);\n return { dispose: () => clearTimeout(handle) };\n },\n setImmediate(callback, ...args) {\n const handle = setImmediate(callback, ...args);\n return { dispose: () => clearImmediate(handle) };\n },\n setInterval(callback, ms, ...args) {\n const handle = setInterval(callback, ms, ...args);\n return { dispose: () => clearInterval(handle) };\n }\n })\n});\nfunction RIL() {\n return _ril;\n}\n(function (RIL) {\n function install() {\n api_1.RAL.install(_ril);\n }\n RIL.install = install;\n})(RIL || (RIL = {}));\nexports.default = RIL;\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.PortMessageWriter = exports.PortMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ----------------------------------------------------------------------------------------- */\nconst ril_1 = require(\"./ril\");\n// Install the node runtime abstract.\nril_1.default.install();\nconst path = require(\"path\");\nconst os = require(\"os\");\nconst crypto_1 = require(\"crypto\");\nconst net_1 = require(\"net\");\nconst api_1 = require(\"../common/api\");\n__exportStar(require(\"../common/api\"), exports);\nclass IPCMessageReader extends api_1.AbstractMessageReader {\n constructor(process) {\n super();\n this.process = process;\n let eventEmitter = this.process;\n eventEmitter.on('error', (error) => this.fireError(error));\n eventEmitter.on('close', () => this.fireClose());\n }\n listen(callback) {\n this.process.on('message', callback);\n return api_1.Disposable.create(() => this.process.off('message', callback));\n }\n}\nexports.IPCMessageReader = IPCMessageReader;\nclass IPCMessageWriter extends api_1.AbstractMessageWriter {\n constructor(process) {\n super();\n this.process = process;\n this.errorCount = 0;\n const eventEmitter = this.process;\n eventEmitter.on('error', (error) => this.fireError(error));\n eventEmitter.on('close', () => this.fireClose);\n }\n write(msg) {\n try {\n if (typeof this.process.send === 'function') {\n this.process.send(msg, undefined, undefined, (error) => {\n if (error) {\n this.errorCount++;\n this.handleError(error, msg);\n }\n else {\n this.errorCount = 0;\n }\n });\n }\n return Promise.resolve();\n }\n catch (error) {\n this.handleError(error, msg);\n return Promise.reject(error);\n }\n }\n handleError(error, msg) {\n this.errorCount++;\n this.fireError(error, msg, this.errorCount);\n }\n end() {\n }\n}\nexports.IPCMessageWriter = IPCMessageWriter;\nclass PortMessageReader extends api_1.AbstractMessageReader {\n constructor(port) {\n super();\n this.onData = new api_1.Emitter;\n port.on('close', () => this.fireClose);\n port.on('error', (error) => this.fireError(error));\n port.on('message', (message) => {\n this.onData.fire(message);\n });\n }\n listen(callback) {\n return this.onData.event(callback);\n }\n}\nexports.PortMessageReader = PortMessageReader;\nclass PortMessageWriter extends api_1.AbstractMessageWriter {\n constructor(port) {\n super();\n this.port = port;\n this.errorCount = 0;\n port.on('close', () => this.fireClose());\n port.on('error', (error) => this.fireError(error));\n }\n write(msg) {\n try {\n this.port.postMessage(msg);\n return Promise.resolve();\n }\n catch (error) {\n this.handleError(error, msg);\n return Promise.reject(error);\n }\n }\n handleError(error, msg) {\n this.errorCount++;\n this.fireError(error, msg, this.errorCount);\n }\n end() {\n }\n}\nexports.PortMessageWriter = PortMessageWriter;\nclass SocketMessageReader extends api_1.ReadableStreamMessageReader {\n constructor(socket, encoding = 'utf-8') {\n super((0, ril_1.default)().stream.asReadableStream(socket), encoding);\n }\n}\nexports.SocketMessageReader = SocketMessageReader;\nclass SocketMessageWriter extends api_1.WriteableStreamMessageWriter {\n constructor(socket, options) {\n super((0, ril_1.default)().stream.asWritableStream(socket), options);\n this.socket = socket;\n }\n dispose() {\n super.dispose();\n this.socket.destroy();\n }\n}\nexports.SocketMessageWriter = SocketMessageWriter;\nclass StreamMessageReader extends api_1.ReadableStreamMessageReader {\n constructor(readable, encoding) {\n super((0, ril_1.default)().stream.asReadableStream(readable), encoding);\n }\n}\nexports.StreamMessageReader = StreamMessageReader;\nclass StreamMessageWriter extends api_1.WriteableStreamMessageWriter {\n constructor(writable, options) {\n super((0, ril_1.default)().stream.asWritableStream(writable), options);\n }\n}\nexports.StreamMessageWriter = StreamMessageWriter;\nconst XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR'];\nconst safeIpcPathLengths = new Map([\n ['linux', 107],\n ['darwin', 103]\n]);\nfunction generateRandomPipeName() {\n const randomSuffix = (0, crypto_1.randomBytes)(21).toString('hex');\n if (process.platform === 'win32') {\n return `\\\\\\\\.\\\\pipe\\\\vscode-jsonrpc-${randomSuffix}-sock`;\n }\n let result;\n if (XDG_RUNTIME_DIR) {\n result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);\n }\n else {\n result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);\n }\n const limit = safeIpcPathLengths.get(process.platform);\n if (limit !== undefined && result.length > limit) {\n (0, ril_1.default)().console.warn(`WARNING: IPC handle \"${result}\" is longer than ${limit} characters.`);\n }\n return result;\n}\nexports.generateRandomPipeName = generateRandomPipeName;\nfunction createClientPipeTransport(pipeName, encoding = 'utf-8') {\n let connectResolve;\n const connected = new Promise((resolve, _reject) => {\n connectResolve = resolve;\n });\n return new Promise((resolve, reject) => {\n let server = (0, net_1.createServer)((socket) => {\n server.close();\n connectResolve([\n new SocketMessageReader(socket, encoding),\n new SocketMessageWriter(socket, encoding)\n ]);\n });\n server.on('error', reject);\n server.listen(pipeName, () => {\n server.removeListener('error', reject);\n resolve({\n onConnected: () => { return connected; }\n });\n });\n });\n}\nexports.createClientPipeTransport = createClientPipeTransport;\nfunction createServerPipeTransport(pipeName, encoding = 'utf-8') {\n const socket = (0, net_1.createConnection)(pipeName);\n return [\n new SocketMessageReader(socket, encoding),\n new SocketMessageWriter(socket, encoding)\n ];\n}\nexports.createServerPipeTransport = createServerPipeTransport;\nfunction createClientSocketTransport(port, encoding = 'utf-8') {\n let connectResolve;\n const connected = new Promise((resolve, _reject) => {\n connectResolve = resolve;\n });\n return new Promise((resolve, reject) => {\n const server = (0, net_1.createServer)((socket) => {\n server.close();\n connectResolve([\n new SocketMessageReader(socket, encoding),\n new SocketMessageWriter(socket, encoding)\n ]);\n });\n server.on('error', reject);\n server.listen(port, '127.0.0.1', () => {\n server.removeListener('error', reject);\n resolve({\n onConnected: () => { return connected; }\n });\n });\n });\n}\nexports.createClientSocketTransport = createClientSocketTransport;\nfunction createServerSocketTransport(port, encoding = 'utf-8') {\n const socket = (0, net_1.createConnection)(port, '127.0.0.1');\n return [\n new SocketMessageReader(socket, encoding),\n new SocketMessageWriter(socket, encoding)\n ];\n}\nexports.createServerSocketTransport = createServerSocketTransport;\nfunction isReadableStream(value) {\n const candidate = value;\n return candidate.read !== undefined && candidate.addListener !== undefined;\n}\nfunction isWritableStream(value) {\n const candidate = value;\n return candidate.write !== undefined && candidate.addListener !== undefined;\n}\nfunction createMessageConnection(input, output, logger, options) {\n if (!logger) {\n logger = api_1.NullLogger;\n }\n const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;\n const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;\n if (api_1.ConnectionStrategy.is(options)) {\n options = { connectionStrategy: options };\n }\n return (0, api_1.createMessageConnection)(reader, writer, logger, options);\n}\nexports.createMessageConnection = createMessageConnection;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ----------------------------------------------------------------------------------------- */\n'use strict';\n\nmodule.exports = require('./lib/node/main');", "(function (factory) {\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n var v = factory(require, exports);\n if (v !== undefined) module.exports = v;\n }\n else if (typeof define === \"function\" && define.amd) {\n define([\"require\", \"exports\"], factory);\n }\n})(function (require, exports) {\n /* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n 'use strict';\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.TextDocument = exports.EOL = exports.WorkspaceFolder = exports.InlineCompletionContext = exports.SelectedCompletionInfo = exports.InlineCompletionTriggerKind = exports.InlineCompletionList = exports.InlineCompletionItem = exports.StringValue = exports.InlayHint = exports.InlayHintLabelPart = exports.InlayHintKind = exports.InlineValueContext = exports.InlineValueEvaluatableExpression = exports.InlineValueVariableLookup = exports.InlineValueText = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.SelectionRange = exports.DocumentLink = exports.FormattingOptions = exports.CodeLens = exports.CodeAction = exports.CodeActionContext = exports.CodeActionTriggerKind = exports.CodeActionKind = exports.DocumentSymbol = exports.WorkspaceSymbol = exports.SymbolInformation = exports.SymbolTag = exports.SymbolKind = exports.DocumentHighlight = exports.DocumentHighlightKind = exports.SignatureInformation = exports.ParameterInformation = exports.Hover = exports.MarkedString = exports.CompletionList = exports.CompletionItem = exports.CompletionItemLabelDetails = exports.InsertTextMode = exports.InsertReplaceEdit = exports.CompletionItemTag = exports.InsertTextFormat = exports.CompletionItemKind = exports.MarkupContent = exports.MarkupKind = exports.TextDocumentItem = exports.OptionalVersionedTextDocumentIdentifier = exports.VersionedTextDocumentIdentifier = exports.TextDocumentIdentifier = exports.WorkspaceChange = exports.WorkspaceEdit = exports.DeleteFile = exports.RenameFile = exports.CreateFile = exports.TextDocumentEdit = exports.AnnotatedTextEdit = exports.ChangeAnnotationIdentifier = exports.ChangeAnnotation = exports.TextEdit = exports.Command = exports.Diagnostic = exports.CodeDescription = exports.DiagnosticTag = exports.DiagnosticSeverity = exports.DiagnosticRelatedInformation = exports.FoldingRange = exports.FoldingRangeKind = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.LocationLink = exports.Location = exports.Range = exports.Position = exports.uinteger = exports.integer = exports.URI = exports.DocumentUri = void 0;\n var DocumentUri;\n (function (DocumentUri) {\n function is(value) {\n return typeof value === 'string';\n }\n DocumentUri.is = is;\n })(DocumentUri || (exports.DocumentUri = DocumentUri = {}));\n var URI;\n (function (URI) {\n function is(value) {\n return typeof value === 'string';\n }\n URI.is = is;\n })(URI || (exports.URI = URI = {}));\n var integer;\n (function (integer) {\n integer.MIN_VALUE = -2147483648;\n integer.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;\n }\n integer.is = is;\n })(integer || (exports.integer = integer = {}));\n var uinteger;\n (function (uinteger) {\n uinteger.MIN_VALUE = 0;\n uinteger.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;\n }\n uinteger.is = is;\n })(uinteger || (exports.uinteger = uinteger = {}));\n /**\n * The Position namespace provides helper functions to work with\n * {@link Position} literals.\n */\n var Position;\n (function (Position) {\n /**\n * Creates a new Position literal from the given line and character.\n * @param line The position's line.\n * @param character The position's character.\n */\n function create(line, character) {\n if (line === Number.MAX_VALUE) {\n line = uinteger.MAX_VALUE;\n }\n if (character === Number.MAX_VALUE) {\n character = uinteger.MAX_VALUE;\n }\n return { line: line, character: character };\n }\n Position.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Position} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);\n }\n Position.is = is;\n })(Position || (exports.Position = Position = {}));\n /**\n * The Range namespace provides helper functions to work with\n * {@link Range} literals.\n */\n var Range;\n (function (Range) {\n function create(one, two, three, four) {\n if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {\n return { start: Position.create(one, two), end: Position.create(three, four) };\n }\n else if (Position.is(one) && Position.is(two)) {\n return { start: one, end: two };\n }\n else {\n throw new Error(\"Range#create called with invalid arguments[\".concat(one, \", \").concat(two, \", \").concat(three, \", \").concat(four, \"]\"));\n }\n }\n Range.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Range} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }\n Range.is = is;\n })(Range || (exports.Range = Range = {}));\n /**\n * The Location namespace provides helper functions to work with\n * {@link Location} literals.\n */\n var Location;\n (function (Location) {\n /**\n * Creates a Location literal.\n * @param uri The location's uri.\n * @param range The location's range.\n */\n function create(uri, range) {\n return { uri: uri, range: range };\n }\n Location.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Location} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\n }\n Location.is = is;\n })(Location || (exports.Location = Location = {}));\n /**\n * The LocationLink namespace provides helper functions to work with\n * {@link LocationLink} literals.\n */\n var LocationLink;\n (function (LocationLink) {\n /**\n * Creates a LocationLink literal.\n * @param targetUri The definition's uri.\n * @param targetRange The full range of the definition.\n * @param targetSelectionRange The span of the symbol definition at the target.\n * @param originSelectionRange The span of the symbol being defined in the originating source file.\n */\n function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\n return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\n }\n LocationLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link LocationLink} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\n && Range.is(candidate.targetSelectionRange)\n && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\n }\n LocationLink.is = is;\n })(LocationLink || (exports.LocationLink = LocationLink = {}));\n /**\n * The Color namespace provides helper functions to work with\n * {@link Color} literals.\n */\n var Color;\n (function (Color) {\n /**\n * Creates a new Color literal.\n */\n function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha,\n };\n }\n Color.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Color} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1)\n && Is.numberRange(candidate.green, 0, 1)\n && Is.numberRange(candidate.blue, 0, 1)\n && Is.numberRange(candidate.alpha, 0, 1);\n }\n Color.is = is;\n })(Color || (exports.Color = Color = {}));\n /**\n * The ColorInformation namespace provides helper functions to work with\n * {@link ColorInformation} literals.\n */\n var ColorInformation;\n (function (ColorInformation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(range, color) {\n return {\n range: range,\n color: color,\n };\n }\n ColorInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);\n }\n ColorInformation.is = is;\n })(ColorInformation || (exports.ColorInformation = ColorInformation = {}));\n /**\n * The Color namespace provides helper functions to work with\n * {@link ColorPresentation} literals.\n */\n var ColorPresentation;\n (function (ColorPresentation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(label, textEdit, additionalTextEdits) {\n return {\n label: label,\n textEdit: textEdit,\n additionalTextEdits: additionalTextEdits,\n };\n }\n ColorPresentation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label)\n && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\n && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\n }\n ColorPresentation.is = is;\n })(ColorPresentation || (exports.ColorPresentation = ColorPresentation = {}));\n /**\n * A set of predefined range kinds.\n */\n var FoldingRangeKind;\n (function (FoldingRangeKind) {\n /**\n * Folding range for a comment\n */\n FoldingRangeKind.Comment = 'comment';\n /**\n * Folding range for an import or include\n */\n FoldingRangeKind.Imports = 'imports';\n /**\n * Folding range for a region (e.g. `#region`)\n */\n FoldingRangeKind.Region = 'region';\n })(FoldingRangeKind || (exports.FoldingRangeKind = FoldingRangeKind = {}));\n /**\n * The folding range namespace provides helper functions to work with\n * {@link FoldingRange} literals.\n */\n var FoldingRange;\n (function (FoldingRange) {\n /**\n * Creates a new FoldingRange literal.\n */\n function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {\n var result = {\n startLine: startLine,\n endLine: endLine\n };\n if (Is.defined(startCharacter)) {\n result.startCharacter = startCharacter;\n }\n if (Is.defined(endCharacter)) {\n result.endCharacter = endCharacter;\n }\n if (Is.defined(kind)) {\n result.kind = kind;\n }\n if (Is.defined(collapsedText)) {\n result.collapsedText = collapsedText;\n }\n return result;\n }\n FoldingRange.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FoldingRange} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)\n && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))\n && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))\n && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\n }\n FoldingRange.is = is;\n })(FoldingRange || (exports.FoldingRange = FoldingRange = {}));\n /**\n * The DiagnosticRelatedInformation namespace provides helper functions to work with\n * {@link DiagnosticRelatedInformation} literals.\n */\n var DiagnosticRelatedInformation;\n (function (DiagnosticRelatedInformation) {\n /**\n * Creates a new DiagnosticRelatedInformation literal.\n */\n function create(location, message) {\n return {\n location: location,\n message: message\n };\n }\n DiagnosticRelatedInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DiagnosticRelatedInformation} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\n }\n DiagnosticRelatedInformation.is = is;\n })(DiagnosticRelatedInformation || (exports.DiagnosticRelatedInformation = DiagnosticRelatedInformation = {}));\n /**\n * The diagnostic's severity.\n */\n var DiagnosticSeverity;\n (function (DiagnosticSeverity) {\n /**\n * Reports an error.\n */\n DiagnosticSeverity.Error = 1;\n /**\n * Reports a warning.\n */\n DiagnosticSeverity.Warning = 2;\n /**\n * Reports an information.\n */\n DiagnosticSeverity.Information = 3;\n /**\n * Reports a hint.\n */\n DiagnosticSeverity.Hint = 4;\n })(DiagnosticSeverity || (exports.DiagnosticSeverity = DiagnosticSeverity = {}));\n /**\n * The diagnostic tags.\n *\n * @since 3.15.0\n */\n var DiagnosticTag;\n (function (DiagnosticTag) {\n /**\n * Unused or unnecessary code.\n *\n * Clients are allowed to render diagnostics with this tag faded out instead of having\n * an error squiggle.\n */\n DiagnosticTag.Unnecessary = 1;\n /**\n * Deprecated or obsolete code.\n *\n * Clients are allowed to rendered diagnostics with this tag strike through.\n */\n DiagnosticTag.Deprecated = 2;\n })(DiagnosticTag || (exports.DiagnosticTag = DiagnosticTag = {}));\n /**\n * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.\n *\n * @since 3.16.0\n */\n var CodeDescription;\n (function (CodeDescription) {\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.href);\n }\n CodeDescription.is = is;\n })(CodeDescription || (exports.CodeDescription = CodeDescription = {}));\n /**\n * The Diagnostic namespace provides helper functions to work with\n * {@link Diagnostic} literals.\n */\n var Diagnostic;\n (function (Diagnostic) {\n /**\n * Creates a new Diagnostic literal.\n */\n function create(range, message, severity, code, source, relatedInformation) {\n var result = { range: range, message: message };\n if (Is.defined(severity)) {\n result.severity = severity;\n }\n if (Is.defined(code)) {\n result.code = code;\n }\n if (Is.defined(source)) {\n result.source = source;\n }\n if (Is.defined(relatedInformation)) {\n result.relatedInformation = relatedInformation;\n }\n return result;\n }\n Diagnostic.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Diagnostic} interface.\n */\n function is(value) {\n var _a;\n var candidate = value;\n return Is.defined(candidate)\n && Range.is(candidate.range)\n && Is.string(candidate.message)\n && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\n && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\n && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))\n && (Is.string(candidate.source) || Is.undefined(candidate.source))\n && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\n }\n Diagnostic.is = is;\n })(Diagnostic || (exports.Diagnostic = Diagnostic = {}));\n /**\n * The Command namespace provides helper functions to work with\n * {@link Command} literals.\n */\n var Command;\n (function (Command) {\n /**\n * Creates a new Command literal.\n */\n function create(title, command) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n var result = { title: title, command: command };\n if (Is.defined(args) && args.length > 0) {\n result.arguments = args;\n }\n return result;\n }\n Command.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Command} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\n }\n Command.is = is;\n })(Command || (exports.Command = Command = {}));\n /**\n * The TextEdit namespace provides helper function to create replace,\n * insert and delete edits more easily.\n */\n var TextEdit;\n (function (TextEdit) {\n /**\n * Creates a replace text edit.\n * @param range The range of text to be replaced.\n * @param newText The new text.\n */\n function replace(range, newText) {\n return { range: range, newText: newText };\n }\n TextEdit.replace = replace;\n /**\n * Creates an insert text edit.\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n */\n function insert(position, newText) {\n return { range: { start: position, end: position }, newText: newText };\n }\n TextEdit.insert = insert;\n /**\n * Creates a delete text edit.\n * @param range The range of text to be deleted.\n */\n function del(range) {\n return { range: range, newText: '' };\n }\n TextEdit.del = del;\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate)\n && Is.string(candidate.newText)\n && Range.is(candidate.range);\n }\n TextEdit.is = is;\n })(TextEdit || (exports.TextEdit = TextEdit = {}));\n var ChangeAnnotation;\n (function (ChangeAnnotation) {\n function create(label, needsConfirmation, description) {\n var result = { label: label };\n if (needsConfirmation !== undefined) {\n result.needsConfirmation = needsConfirmation;\n }\n if (description !== undefined) {\n result.description = description;\n }\n return result;\n }\n ChangeAnnotation.create = create;\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label) &&\n (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n ChangeAnnotation.is = is;\n })(ChangeAnnotation || (exports.ChangeAnnotation = ChangeAnnotation = {}));\n var ChangeAnnotationIdentifier;\n (function (ChangeAnnotationIdentifier) {\n function is(value) {\n var candidate = value;\n return Is.string(candidate);\n }\n ChangeAnnotationIdentifier.is = is;\n })(ChangeAnnotationIdentifier || (exports.ChangeAnnotationIdentifier = ChangeAnnotationIdentifier = {}));\n var AnnotatedTextEdit;\n (function (AnnotatedTextEdit) {\n /**\n * Creates an annotated replace text edit.\n *\n * @param range The range of text to be replaced.\n * @param newText The new text.\n * @param annotation The annotation.\n */\n function replace(range, newText, annotation) {\n return { range: range, newText: newText, annotationId: annotation };\n }\n AnnotatedTextEdit.replace = replace;\n /**\n * Creates an annotated insert text edit.\n *\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n * @param annotation The annotation.\n */\n function insert(position, newText, annotation) {\n return { range: { start: position, end: position }, newText: newText, annotationId: annotation };\n }\n AnnotatedTextEdit.insert = insert;\n /**\n * Creates an annotated delete text edit.\n *\n * @param range The range of text to be deleted.\n * @param annotation The annotation.\n */\n function del(range, annotation) {\n return { range: range, newText: '', annotationId: annotation };\n }\n AnnotatedTextEdit.del = del;\n function is(value) {\n var candidate = value;\n return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n AnnotatedTextEdit.is = is;\n })(AnnotatedTextEdit || (exports.AnnotatedTextEdit = AnnotatedTextEdit = {}));\n /**\n * The TextDocumentEdit namespace provides helper function to create\n * an edit that manipulates a text document.\n */\n var TextDocumentEdit;\n (function (TextDocumentEdit) {\n /**\n * Creates a new `TextDocumentEdit`\n */\n function create(textDocument, edits) {\n return { textDocument: textDocument, edits: edits };\n }\n TextDocumentEdit.create = create;\n function is(value) {\n var candidate = value;\n return Is.defined(candidate)\n && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)\n && Array.isArray(candidate.edits);\n }\n TextDocumentEdit.is = is;\n })(TextDocumentEdit || (exports.TextDocumentEdit = TextDocumentEdit = {}));\n var CreateFile;\n (function (CreateFile) {\n function create(uri, options, annotation) {\n var result = {\n kind: 'create',\n uri: uri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n CreateFile.create = create;\n function is(value) {\n var candidate = value;\n return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n CreateFile.is = is;\n })(CreateFile || (exports.CreateFile = CreateFile = {}));\n var RenameFile;\n (function (RenameFile) {\n function create(oldUri, newUri, options, annotation) {\n var result = {\n kind: 'rename',\n oldUri: oldUri,\n newUri: newUri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n RenameFile.create = create;\n function is(value) {\n var candidate = value;\n return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n RenameFile.is = is;\n })(RenameFile || (exports.RenameFile = RenameFile = {}));\n var DeleteFile;\n (function (DeleteFile) {\n function create(uri, options, annotation) {\n var result = {\n kind: 'delete',\n uri: uri\n };\n if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n DeleteFile.create = create;\n function is(value) {\n var candidate = value;\n return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n DeleteFile.is = is;\n })(DeleteFile || (exports.DeleteFile = DeleteFile = {}));\n var WorkspaceEdit;\n (function (WorkspaceEdit) {\n function is(value) {\n var candidate = value;\n return candidate &&\n (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&\n (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {\n if (Is.string(change.kind)) {\n return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\n }\n else {\n return TextDocumentEdit.is(change);\n }\n }));\n }\n WorkspaceEdit.is = is;\n })(WorkspaceEdit || (exports.WorkspaceEdit = WorkspaceEdit = {}));\n var TextEditChangeImpl = /** @class */ (function () {\n function TextEditChangeImpl(edits, changeAnnotations) {\n this.edits = edits;\n this.changeAnnotations = changeAnnotations;\n }\n TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {\n var edit;\n var id;\n if (annotation === undefined) {\n edit = TextEdit.insert(position, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.insert(position, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.insert(position, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n };\n TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {\n var edit;\n var id;\n if (annotation === undefined) {\n edit = TextEdit.replace(range, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.replace(range, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.replace(range, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n };\n TextEditChangeImpl.prototype.delete = function (range, annotation) {\n var edit;\n var id;\n if (annotation === undefined) {\n edit = TextEdit.del(range);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.del(range, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.del(range, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n };\n TextEditChangeImpl.prototype.add = function (edit) {\n this.edits.push(edit);\n };\n TextEditChangeImpl.prototype.all = function () {\n return this.edits;\n };\n TextEditChangeImpl.prototype.clear = function () {\n this.edits.splice(0, this.edits.length);\n };\n TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {\n if (value === undefined) {\n throw new Error(\"Text edit change is not configured to manage change annotations.\");\n }\n };\n return TextEditChangeImpl;\n }());\n /**\n * A helper class\n */\n var ChangeAnnotations = /** @class */ (function () {\n function ChangeAnnotations(annotations) {\n this._annotations = annotations === undefined ? Object.create(null) : annotations;\n this._counter = 0;\n this._size = 0;\n }\n ChangeAnnotations.prototype.all = function () {\n return this._annotations;\n };\n Object.defineProperty(ChangeAnnotations.prototype, \"size\", {\n get: function () {\n return this._size;\n },\n enumerable: false,\n configurable: true\n });\n ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {\n var id;\n if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {\n id = idOrAnnotation;\n }\n else {\n id = this.nextId();\n annotation = idOrAnnotation;\n }\n if (this._annotations[id] !== undefined) {\n throw new Error(\"Id \".concat(id, \" is already in use.\"));\n }\n if (annotation === undefined) {\n throw new Error(\"No annotation provided for id \".concat(id));\n }\n this._annotations[id] = annotation;\n this._size++;\n return id;\n };\n ChangeAnnotations.prototype.nextId = function () {\n this._counter++;\n return this._counter.toString();\n };\n return ChangeAnnotations;\n }());\n /**\n * A workspace change helps constructing changes to a workspace.\n */\n var WorkspaceChange = /** @class */ (function () {\n function WorkspaceChange(workspaceEdit) {\n var _this = this;\n this._textEditChanges = Object.create(null);\n if (workspaceEdit !== undefined) {\n this._workspaceEdit = workspaceEdit;\n if (workspaceEdit.documentChanges) {\n this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);\n workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n workspaceEdit.documentChanges.forEach(function (change) {\n if (TextDocumentEdit.is(change)) {\n var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);\n _this._textEditChanges[change.textDocument.uri] = textEditChange;\n }\n });\n }\n else if (workspaceEdit.changes) {\n Object.keys(workspaceEdit.changes).forEach(function (key) {\n var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\n _this._textEditChanges[key] = textEditChange;\n });\n }\n }\n else {\n this._workspaceEdit = {};\n }\n }\n Object.defineProperty(WorkspaceChange.prototype, \"edit\", {\n /**\n * Returns the underlying {@link WorkspaceEdit} literal\n * use to be returned from a workspace edit operation like rename.\n */\n get: function () {\n this.initDocumentChanges();\n if (this._changeAnnotations !== undefined) {\n if (this._changeAnnotations.size === 0) {\n this._workspaceEdit.changeAnnotations = undefined;\n }\n else {\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n }\n return this._workspaceEdit;\n },\n enumerable: false,\n configurable: true\n });\n WorkspaceChange.prototype.getTextEditChange = function (key) {\n if (OptionalVersionedTextDocumentIdentifier.is(key)) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n var textDocument = { uri: key.uri, version: key.version };\n var result = this._textEditChanges[textDocument.uri];\n if (!result) {\n var edits = [];\n var textDocumentEdit = {\n textDocument: textDocument,\n edits: edits\n };\n this._workspaceEdit.documentChanges.push(textDocumentEdit);\n result = new TextEditChangeImpl(edits, this._changeAnnotations);\n this._textEditChanges[textDocument.uri] = result;\n }\n return result;\n }\n else {\n this.initChanges();\n if (this._workspaceEdit.changes === undefined) {\n throw new Error('Workspace edit is not configured for normal text edit changes.');\n }\n var result = this._textEditChanges[key];\n if (!result) {\n var edits = [];\n this._workspaceEdit.changes[key] = edits;\n result = new TextEditChangeImpl(edits);\n this._textEditChanges[key] = result;\n }\n return result;\n }\n };\n WorkspaceChange.prototype.initDocumentChanges = function () {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._changeAnnotations = new ChangeAnnotations();\n this._workspaceEdit.documentChanges = [];\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n };\n WorkspaceChange.prototype.initChanges = function () {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._workspaceEdit.changes = Object.create(null);\n }\n };\n WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n var annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n var operation;\n var id;\n if (annotation === undefined) {\n operation = CreateFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = CreateFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n };\n WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n var annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n var operation;\n var id;\n if (annotation === undefined) {\n operation = RenameFile.create(oldUri, newUri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = RenameFile.create(oldUri, newUri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n };\n WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n var annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n var operation;\n var id;\n if (annotation === undefined) {\n operation = DeleteFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = DeleteFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n };\n return WorkspaceChange;\n }());\n exports.WorkspaceChange = WorkspaceChange;\n /**\n * The TextDocumentIdentifier namespace provides helper functions to work with\n * {@link TextDocumentIdentifier} literals.\n */\n var TextDocumentIdentifier;\n (function (TextDocumentIdentifier) {\n /**\n * Creates a new TextDocumentIdentifier literal.\n * @param uri The document's uri.\n */\n function create(uri) {\n return { uri: uri };\n }\n TextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentIdentifier} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri);\n }\n TextDocumentIdentifier.is = is;\n })(TextDocumentIdentifier || (exports.TextDocumentIdentifier = TextDocumentIdentifier = {}));\n /**\n * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link VersionedTextDocumentIdentifier} literals.\n */\n var VersionedTextDocumentIdentifier;\n (function (VersionedTextDocumentIdentifier) {\n /**\n * Creates a new VersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri: uri, version: version };\n }\n VersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link VersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);\n }\n VersionedTextDocumentIdentifier.is = is;\n })(VersionedTextDocumentIdentifier || (exports.VersionedTextDocumentIdentifier = VersionedTextDocumentIdentifier = {}));\n /**\n * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link OptionalVersionedTextDocumentIdentifier} literals.\n */\n var OptionalVersionedTextDocumentIdentifier;\n (function (OptionalVersionedTextDocumentIdentifier) {\n /**\n * Creates a new OptionalVersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri: uri, version: version };\n }\n OptionalVersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link OptionalVersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));\n }\n OptionalVersionedTextDocumentIdentifier.is = is;\n })(OptionalVersionedTextDocumentIdentifier || (exports.OptionalVersionedTextDocumentIdentifier = OptionalVersionedTextDocumentIdentifier = {}));\n /**\n * The TextDocumentItem namespace provides helper functions to work with\n * {@link TextDocumentItem} literals.\n */\n var TextDocumentItem;\n (function (TextDocumentItem) {\n /**\n * Creates a new TextDocumentItem literal.\n * @param uri The document's uri.\n * @param languageId The document's language identifier.\n * @param version The document's version number.\n * @param text The document's text.\n */\n function create(uri, languageId, version, text) {\n return { uri: uri, languageId: languageId, version: version, text: text };\n }\n TextDocumentItem.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentItem} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);\n }\n TextDocumentItem.is = is;\n })(TextDocumentItem || (exports.TextDocumentItem = TextDocumentItem = {}));\n /**\n * Describes the content type that a client supports in various\n * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\n *\n * Please note that `MarkupKinds` must not start with a `$`. This kinds\n * are reserved for internal usage.\n */\n var MarkupKind;\n (function (MarkupKind) {\n /**\n * Plain text is supported as a content format\n */\n MarkupKind.PlainText = 'plaintext';\n /**\n * Markdown is supported as a content format\n */\n MarkupKind.Markdown = 'markdown';\n /**\n * Checks whether the given value is a value of the {@link MarkupKind} type.\n */\n function is(value) {\n var candidate = value;\n return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\n }\n MarkupKind.is = is;\n })(MarkupKind || (exports.MarkupKind = MarkupKind = {}));\n var MarkupContent;\n (function (MarkupContent) {\n /**\n * Checks whether the given value conforms to the {@link MarkupContent} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\n }\n MarkupContent.is = is;\n })(MarkupContent || (exports.MarkupContent = MarkupContent = {}));\n /**\n * The kind of a completion entry.\n */\n var CompletionItemKind;\n (function (CompletionItemKind) {\n CompletionItemKind.Text = 1;\n CompletionItemKind.Method = 2;\n CompletionItemKind.Function = 3;\n CompletionItemKind.Constructor = 4;\n CompletionItemKind.Field = 5;\n CompletionItemKind.Variable = 6;\n CompletionItemKind.Class = 7;\n CompletionItemKind.Interface = 8;\n CompletionItemKind.Module = 9;\n CompletionItemKind.Property = 10;\n CompletionItemKind.Unit = 11;\n CompletionItemKind.Value = 12;\n CompletionItemKind.Enum = 13;\n CompletionItemKind.Keyword = 14;\n CompletionItemKind.Snippet = 15;\n CompletionItemKind.Color = 16;\n CompletionItemKind.File = 17;\n CompletionItemKind.Reference = 18;\n CompletionItemKind.Folder = 19;\n CompletionItemKind.EnumMember = 20;\n CompletionItemKind.Constant = 21;\n CompletionItemKind.Struct = 22;\n CompletionItemKind.Event = 23;\n CompletionItemKind.Operator = 24;\n CompletionItemKind.TypeParameter = 25;\n })(CompletionItemKind || (exports.CompletionItemKind = CompletionItemKind = {}));\n /**\n * Defines whether the insert text in a completion item should be interpreted as\n * plain text or a snippet.\n */\n var InsertTextFormat;\n (function (InsertTextFormat) {\n /**\n * The primary text to be inserted is treated as a plain string.\n */\n InsertTextFormat.PlainText = 1;\n /**\n * The primary text to be inserted is treated as a snippet.\n *\n * A snippet can define tab stops and placeholders with `$1`, `$2`\n * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\n * the end of the snippet. Placeholders with equal identifiers are linked,\n * that is typing in one will update others too.\n *\n * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax\n */\n InsertTextFormat.Snippet = 2;\n })(InsertTextFormat || (exports.InsertTextFormat = InsertTextFormat = {}));\n /**\n * Completion item tags are extra annotations that tweak the rendering of a completion\n * item.\n *\n * @since 3.15.0\n */\n var CompletionItemTag;\n (function (CompletionItemTag) {\n /**\n * Render a completion as obsolete, usually using a strike-out.\n */\n CompletionItemTag.Deprecated = 1;\n })(CompletionItemTag || (exports.CompletionItemTag = CompletionItemTag = {}));\n /**\n * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.\n *\n * @since 3.16.0\n */\n var InsertReplaceEdit;\n (function (InsertReplaceEdit) {\n /**\n * Creates a new insert / replace edit\n */\n function create(newText, insert, replace) {\n return { newText: newText, insert: insert, replace: replace };\n }\n InsertReplaceEdit.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InsertReplaceEdit} interface.\n */\n function is(value) {\n var candidate = value;\n return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);\n }\n InsertReplaceEdit.is = is;\n })(InsertReplaceEdit || (exports.InsertReplaceEdit = InsertReplaceEdit = {}));\n /**\n * How whitespace and indentation is handled during completion\n * item insertion.\n *\n * @since 3.16.0\n */\n var InsertTextMode;\n (function (InsertTextMode) {\n /**\n * The insertion or replace strings is taken as it is. If the\n * value is multi line the lines below the cursor will be\n * inserted using the indentation defined in the string value.\n * The client will not apply any kind of adjustments to the\n * string.\n */\n InsertTextMode.asIs = 1;\n /**\n * The editor adjusts leading whitespace of new lines so that\n * they match the indentation up to the cursor of the line for\n * which the item is accepted.\n *\n * Consider a line like this: <2tabs><3tabs>foo. Accepting a\n * multi line completion item is indented using 2 tabs and all\n * following lines inserted will be indented using 2 tabs as well.\n */\n InsertTextMode.adjustIndentation = 2;\n })(InsertTextMode || (exports.InsertTextMode = InsertTextMode = {}));\n var CompletionItemLabelDetails;\n (function (CompletionItemLabelDetails) {\n function is(value) {\n var candidate = value;\n return candidate && (Is.string(candidate.detail) || candidate.detail === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n CompletionItemLabelDetails.is = is;\n })(CompletionItemLabelDetails || (exports.CompletionItemLabelDetails = CompletionItemLabelDetails = {}));\n /**\n * The CompletionItem namespace provides functions to deal with\n * completion items.\n */\n var CompletionItem;\n (function (CompletionItem) {\n /**\n * Create a completion item and seed it with a label.\n * @param label The completion item's label\n */\n function create(label) {\n return { label: label };\n }\n CompletionItem.create = create;\n })(CompletionItem || (exports.CompletionItem = CompletionItem = {}));\n /**\n * The CompletionList namespace provides functions to deal with\n * completion lists.\n */\n var CompletionList;\n (function (CompletionList) {\n /**\n * Creates a new completion list.\n *\n * @param items The completion items.\n * @param isIncomplete The list is not complete.\n */\n function create(items, isIncomplete) {\n return { items: items ? items : [], isIncomplete: !!isIncomplete };\n }\n CompletionList.create = create;\n })(CompletionList || (exports.CompletionList = CompletionList = {}));\n var MarkedString;\n (function (MarkedString) {\n /**\n * Creates a marked string from plain text.\n *\n * @param plainText The plain text.\n */\n function fromPlainText(plainText) {\n return plainText.replace(/[\\\\`*_{}[\\]()#+\\-.!]/g, '\\\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n }\n MarkedString.fromPlainText = fromPlainText;\n /**\n * Checks whether the given value conforms to the {@link MarkedString} type.\n */\n function is(value) {\n var candidate = value;\n return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\n }\n MarkedString.is = is;\n })(MarkedString || (exports.MarkedString = MarkedString = {}));\n var Hover;\n (function (Hover) {\n /**\n * Checks whether the given value conforms to the {@link Hover} interface.\n */\n function is(value) {\n var candidate = value;\n return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\n MarkedString.is(candidate.contents) ||\n Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));\n }\n Hover.is = is;\n })(Hover || (exports.Hover = Hover = {}));\n /**\n * The ParameterInformation namespace provides helper functions to work with\n * {@link ParameterInformation} literals.\n */\n var ParameterInformation;\n (function (ParameterInformation) {\n /**\n * Creates a new parameter information literal.\n *\n * @param label A label string.\n * @param documentation A doc string.\n */\n function create(label, documentation) {\n return documentation ? { label: label, documentation: documentation } : { label: label };\n }\n ParameterInformation.create = create;\n })(ParameterInformation || (exports.ParameterInformation = ParameterInformation = {}));\n /**\n * The SignatureInformation namespace provides helper functions to work with\n * {@link SignatureInformation} literals.\n */\n var SignatureInformation;\n (function (SignatureInformation) {\n function create(label, documentation) {\n var parameters = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n parameters[_i - 2] = arguments[_i];\n }\n var result = { label: label };\n if (Is.defined(documentation)) {\n result.documentation = documentation;\n }\n if (Is.defined(parameters)) {\n result.parameters = parameters;\n }\n else {\n result.parameters = [];\n }\n return result;\n }\n SignatureInformation.create = create;\n })(SignatureInformation || (exports.SignatureInformation = SignatureInformation = {}));\n /**\n * A document highlight kind.\n */\n var DocumentHighlightKind;\n (function (DocumentHighlightKind) {\n /**\n * A textual occurrence.\n */\n DocumentHighlightKind.Text = 1;\n /**\n * Read-access of a symbol, like reading a variable.\n */\n DocumentHighlightKind.Read = 2;\n /**\n * Write-access of a symbol, like writing to a variable.\n */\n DocumentHighlightKind.Write = 3;\n })(DocumentHighlightKind || (exports.DocumentHighlightKind = DocumentHighlightKind = {}));\n /**\n * DocumentHighlight namespace to provide helper functions to work with\n * {@link DocumentHighlight} literals.\n */\n var DocumentHighlight;\n (function (DocumentHighlight) {\n /**\n * Create a DocumentHighlight object.\n * @param range The range the highlight applies to.\n * @param kind The highlight kind\n */\n function create(range, kind) {\n var result = { range: range };\n if (Is.number(kind)) {\n result.kind = kind;\n }\n return result;\n }\n DocumentHighlight.create = create;\n })(DocumentHighlight || (exports.DocumentHighlight = DocumentHighlight = {}));\n /**\n * A symbol kind.\n */\n var SymbolKind;\n (function (SymbolKind) {\n SymbolKind.File = 1;\n SymbolKind.Module = 2;\n SymbolKind.Namespace = 3;\n SymbolKind.Package = 4;\n SymbolKind.Class = 5;\n SymbolKind.Method = 6;\n SymbolKind.Property = 7;\n SymbolKind.Field = 8;\n SymbolKind.Constructor = 9;\n SymbolKind.Enum = 10;\n SymbolKind.Interface = 11;\n SymbolKind.Function = 12;\n SymbolKind.Variable = 13;\n SymbolKind.Constant = 14;\n SymbolKind.String = 15;\n SymbolKind.Number = 16;\n SymbolKind.Boolean = 17;\n SymbolKind.Array = 18;\n SymbolKind.Object = 19;\n SymbolKind.Key = 20;\n SymbolKind.Null = 21;\n SymbolKind.EnumMember = 22;\n SymbolKind.Struct = 23;\n SymbolKind.Event = 24;\n SymbolKind.Operator = 25;\n SymbolKind.TypeParameter = 26;\n })(SymbolKind || (exports.SymbolKind = SymbolKind = {}));\n /**\n * Symbol tags are extra annotations that tweak the rendering of a symbol.\n *\n * @since 3.16\n */\n var SymbolTag;\n (function (SymbolTag) {\n /**\n * Render a symbol as obsolete, usually using a strike-out.\n */\n SymbolTag.Deprecated = 1;\n })(SymbolTag || (exports.SymbolTag = SymbolTag = {}));\n var SymbolInformation;\n (function (SymbolInformation) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the location of the symbol.\n * @param uri The resource of the location of symbol.\n * @param containerName The name of the symbol containing the symbol.\n */\n function create(name, kind, range, uri, containerName) {\n var result = {\n name: name,\n kind: kind,\n location: { uri: uri, range: range }\n };\n if (containerName) {\n result.containerName = containerName;\n }\n return result;\n }\n SymbolInformation.create = create;\n })(SymbolInformation || (exports.SymbolInformation = SymbolInformation = {}));\n var WorkspaceSymbol;\n (function (WorkspaceSymbol) {\n /**\n * Create a new workspace symbol.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param uri The resource of the location of the symbol.\n * @param range An options range of the location.\n * @returns A WorkspaceSymbol.\n */\n function create(name, kind, uri, range) {\n return range !== undefined\n ? { name: name, kind: kind, location: { uri: uri, range: range } }\n : { name: name, kind: kind, location: { uri: uri } };\n }\n WorkspaceSymbol.create = create;\n })(WorkspaceSymbol || (exports.WorkspaceSymbol = WorkspaceSymbol = {}));\n var DocumentSymbol;\n (function (DocumentSymbol) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param detail The detail of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the symbol.\n * @param selectionRange The selectionRange of the symbol.\n * @param children Children of the symbol.\n */\n function create(name, detail, kind, range, selectionRange, children) {\n var result = {\n name: name,\n detail: detail,\n kind: kind,\n range: range,\n selectionRange: selectionRange\n };\n if (children !== undefined) {\n result.children = children;\n }\n return result;\n }\n DocumentSymbol.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentSymbol} interface.\n */\n function is(value) {\n var candidate = value;\n return candidate &&\n Is.string(candidate.name) && Is.number(candidate.kind) &&\n Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\n (candidate.detail === undefined || Is.string(candidate.detail)) &&\n (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&\n (candidate.children === undefined || Array.isArray(candidate.children)) &&\n (candidate.tags === undefined || Array.isArray(candidate.tags));\n }\n DocumentSymbol.is = is;\n })(DocumentSymbol || (exports.DocumentSymbol = DocumentSymbol = {}));\n /**\n * A set of predefined code action kinds\n */\n var CodeActionKind;\n (function (CodeActionKind) {\n /**\n * Empty kind.\n */\n CodeActionKind.Empty = '';\n /**\n * Base kind for quickfix actions: 'quickfix'\n */\n CodeActionKind.QuickFix = 'quickfix';\n /**\n * Base kind for refactoring actions: 'refactor'\n */\n CodeActionKind.Refactor = 'refactor';\n /**\n * Base kind for refactoring extraction actions: 'refactor.extract'\n *\n * Example extract actions:\n *\n * - Extract method\n * - Extract function\n * - Extract variable\n * - Extract interface from class\n * - ...\n */\n CodeActionKind.RefactorExtract = 'refactor.extract';\n /**\n * Base kind for refactoring inline actions: 'refactor.inline'\n *\n * Example inline actions:\n *\n * - Inline function\n * - Inline variable\n * - Inline constant\n * - ...\n */\n CodeActionKind.RefactorInline = 'refactor.inline';\n /**\n * Base kind for refactoring rewrite actions: 'refactor.rewrite'\n *\n * Example rewrite actions:\n *\n * - Convert JavaScript function to class\n * - Add or remove parameter\n * - Encapsulate field\n * - Make method static\n * - Move method to base class\n * - ...\n */\n CodeActionKind.RefactorRewrite = 'refactor.rewrite';\n /**\n * Base kind for source actions: `source`\n *\n * Source code actions apply to the entire file.\n */\n CodeActionKind.Source = 'source';\n /**\n * Base kind for an organize imports source action: `source.organizeImports`\n */\n CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\n /**\n * Base kind for auto-fix source actions: `source.fixAll`.\n *\n * Fix all actions automatically fix errors that have a clear fix that do not require user input.\n * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\n *\n * @since 3.15.0\n */\n CodeActionKind.SourceFixAll = 'source.fixAll';\n })(CodeActionKind || (exports.CodeActionKind = CodeActionKind = {}));\n /**\n * The reason why code actions were requested.\n *\n * @since 3.17.0\n */\n var CodeActionTriggerKind;\n (function (CodeActionTriggerKind) {\n /**\n * Code actions were explicitly requested by the user or by an extension.\n */\n CodeActionTriggerKind.Invoked = 1;\n /**\n * Code actions were requested automatically.\n *\n * This typically happens when current selection in a file changes, but can\n * also be triggered when file content changes.\n */\n CodeActionTriggerKind.Automatic = 2;\n })(CodeActionTriggerKind || (exports.CodeActionTriggerKind = CodeActionTriggerKind = {}));\n /**\n * The CodeActionContext namespace provides helper functions to work with\n * {@link CodeActionContext} literals.\n */\n var CodeActionContext;\n (function (CodeActionContext) {\n /**\n * Creates a new CodeActionContext literal.\n */\n function create(diagnostics, only, triggerKind) {\n var result = { diagnostics: diagnostics };\n if (only !== undefined && only !== null) {\n result.only = only;\n }\n if (triggerKind !== undefined && triggerKind !== null) {\n result.triggerKind = triggerKind;\n }\n return result;\n }\n CodeActionContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeActionContext} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is)\n && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string))\n && (candidate.triggerKind === undefined || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);\n }\n CodeActionContext.is = is;\n })(CodeActionContext || (exports.CodeActionContext = CodeActionContext = {}));\n var CodeAction;\n (function (CodeAction) {\n function create(title, kindOrCommandOrEdit, kind) {\n var result = { title: title };\n var checkKind = true;\n if (typeof kindOrCommandOrEdit === 'string') {\n checkKind = false;\n result.kind = kindOrCommandOrEdit;\n }\n else if (Command.is(kindOrCommandOrEdit)) {\n result.command = kindOrCommandOrEdit;\n }\n else {\n result.edit = kindOrCommandOrEdit;\n }\n if (checkKind && kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n CodeAction.create = create;\n function is(value) {\n var candidate = value;\n return candidate && Is.string(candidate.title) &&\n (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\n (candidate.kind === undefined || Is.string(candidate.kind)) &&\n (candidate.edit !== undefined || candidate.command !== undefined) &&\n (candidate.command === undefined || Command.is(candidate.command)) &&\n (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&\n (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));\n }\n CodeAction.is = is;\n })(CodeAction || (exports.CodeAction = CodeAction = {}));\n /**\n * The CodeLens namespace provides helper functions to work with\n * {@link CodeLens} literals.\n */\n var CodeLens;\n (function (CodeLens) {\n /**\n * Creates a new CodeLens literal.\n */\n function create(range, data) {\n var result = { range: range };\n if (Is.defined(data)) {\n result.data = data;\n }\n return result;\n }\n CodeLens.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeLens} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\n }\n CodeLens.is = is;\n })(CodeLens || (exports.CodeLens = CodeLens = {}));\n /**\n * The FormattingOptions namespace provides helper functions to work with\n * {@link FormattingOptions} literals.\n */\n var FormattingOptions;\n (function (FormattingOptions) {\n /**\n * Creates a new FormattingOptions literal.\n */\n function create(tabSize, insertSpaces) {\n return { tabSize: tabSize, insertSpaces: insertSpaces };\n }\n FormattingOptions.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FormattingOptions} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\n }\n FormattingOptions.is = is;\n })(FormattingOptions || (exports.FormattingOptions = FormattingOptions = {}));\n /**\n * The DocumentLink namespace provides helper functions to work with\n * {@link DocumentLink} literals.\n */\n var DocumentLink;\n (function (DocumentLink) {\n /**\n * Creates a new DocumentLink literal.\n */\n function create(range, target, data) {\n return { range: range, target: target, data: data };\n }\n DocumentLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentLink} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\n }\n DocumentLink.is = is;\n })(DocumentLink || (exports.DocumentLink = DocumentLink = {}));\n /**\n * The SelectionRange namespace provides helper function to work with\n * SelectionRange literals.\n */\n var SelectionRange;\n (function (SelectionRange) {\n /**\n * Creates a new SelectionRange\n * @param range the range.\n * @param parent an optional parent.\n */\n function create(range, parent) {\n return { range: range, parent: parent };\n }\n SelectionRange.create = create;\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\n }\n SelectionRange.is = is;\n })(SelectionRange || (exports.SelectionRange = SelectionRange = {}));\n /**\n * A set of predefined token types. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\n var SemanticTokenTypes;\n (function (SemanticTokenTypes) {\n SemanticTokenTypes[\"namespace\"] = \"namespace\";\n /**\n * Represents a generic type. Acts as a fallback for types which can't be mapped to\n * a specific type like class or enum.\n */\n SemanticTokenTypes[\"type\"] = \"type\";\n SemanticTokenTypes[\"class\"] = \"class\";\n SemanticTokenTypes[\"enum\"] = \"enum\";\n SemanticTokenTypes[\"interface\"] = \"interface\";\n SemanticTokenTypes[\"struct\"] = \"struct\";\n SemanticTokenTypes[\"typeParameter\"] = \"typeParameter\";\n SemanticTokenTypes[\"parameter\"] = \"parameter\";\n SemanticTokenTypes[\"variable\"] = \"variable\";\n SemanticTokenTypes[\"property\"] = \"property\";\n SemanticTokenTypes[\"enumMember\"] = \"enumMember\";\n SemanticTokenTypes[\"event\"] = \"event\";\n SemanticTokenTypes[\"function\"] = \"function\";\n SemanticTokenTypes[\"method\"] = \"method\";\n SemanticTokenTypes[\"macro\"] = \"macro\";\n SemanticTokenTypes[\"keyword\"] = \"keyword\";\n SemanticTokenTypes[\"modifier\"] = \"modifier\";\n SemanticTokenTypes[\"comment\"] = \"comment\";\n SemanticTokenTypes[\"string\"] = \"string\";\n SemanticTokenTypes[\"number\"] = \"number\";\n SemanticTokenTypes[\"regexp\"] = \"regexp\";\n SemanticTokenTypes[\"operator\"] = \"operator\";\n /**\n * @since 3.17.0\n */\n SemanticTokenTypes[\"decorator\"] = \"decorator\";\n })(SemanticTokenTypes || (exports.SemanticTokenTypes = SemanticTokenTypes = {}));\n /**\n * A set of predefined token modifiers. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\n var SemanticTokenModifiers;\n (function (SemanticTokenModifiers) {\n SemanticTokenModifiers[\"declaration\"] = \"declaration\";\n SemanticTokenModifiers[\"definition\"] = \"definition\";\n SemanticTokenModifiers[\"readonly\"] = \"readonly\";\n SemanticTokenModifiers[\"static\"] = \"static\";\n SemanticTokenModifiers[\"deprecated\"] = \"deprecated\";\n SemanticTokenModifiers[\"abstract\"] = \"abstract\";\n SemanticTokenModifiers[\"async\"] = \"async\";\n SemanticTokenModifiers[\"modification\"] = \"modification\";\n SemanticTokenModifiers[\"documentation\"] = \"documentation\";\n SemanticTokenModifiers[\"defaultLibrary\"] = \"defaultLibrary\";\n })(SemanticTokenModifiers || (exports.SemanticTokenModifiers = SemanticTokenModifiers = {}));\n /**\n * @since 3.16.0\n */\n var SemanticTokens;\n (function (SemanticTokens) {\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\n Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\n }\n SemanticTokens.is = is;\n })(SemanticTokens || (exports.SemanticTokens = SemanticTokens = {}));\n /**\n * The InlineValueText namespace provides functions to deal with InlineValueTexts.\n *\n * @since 3.17.0\n */\n var InlineValueText;\n (function (InlineValueText) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, text) {\n return { range: range, text: text };\n }\n InlineValueText.create = create;\n function is(value) {\n var candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);\n }\n InlineValueText.is = is;\n })(InlineValueText || (exports.InlineValueText = InlineValueText = {}));\n /**\n * The InlineValueVariableLookup namespace provides functions to deal with InlineValueVariableLookups.\n *\n * @since 3.17.0\n */\n var InlineValueVariableLookup;\n (function (InlineValueVariableLookup) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, variableName, caseSensitiveLookup) {\n return { range: range, variableName: variableName, caseSensitiveLookup: caseSensitiveLookup };\n }\n InlineValueVariableLookup.create = create;\n function is(value) {\n var candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup)\n && (Is.string(candidate.variableName) || candidate.variableName === undefined);\n }\n InlineValueVariableLookup.is = is;\n })(InlineValueVariableLookup || (exports.InlineValueVariableLookup = InlineValueVariableLookup = {}));\n /**\n * The InlineValueEvaluatableExpression namespace provides functions to deal with InlineValueEvaluatableExpression.\n *\n * @since 3.17.0\n */\n var InlineValueEvaluatableExpression;\n (function (InlineValueEvaluatableExpression) {\n /**\n * Creates a new InlineValueEvaluatableExpression literal.\n */\n function create(range, expression) {\n return { range: range, expression: expression };\n }\n InlineValueEvaluatableExpression.create = create;\n function is(value) {\n var candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range)\n && (Is.string(candidate.expression) || candidate.expression === undefined);\n }\n InlineValueEvaluatableExpression.is = is;\n })(InlineValueEvaluatableExpression || (exports.InlineValueEvaluatableExpression = InlineValueEvaluatableExpression = {}));\n /**\n * The InlineValueContext namespace provides helper functions to work with\n * {@link InlineValueContext} literals.\n *\n * @since 3.17.0\n */\n var InlineValueContext;\n (function (InlineValueContext) {\n /**\n * Creates a new InlineValueContext literal.\n */\n function create(frameId, stoppedLocation) {\n return { frameId: frameId, stoppedLocation: stoppedLocation };\n }\n InlineValueContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InlineValueContext} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Range.is(value.stoppedLocation);\n }\n InlineValueContext.is = is;\n })(InlineValueContext || (exports.InlineValueContext = InlineValueContext = {}));\n /**\n * Inlay hint kinds.\n *\n * @since 3.17.0\n */\n var InlayHintKind;\n (function (InlayHintKind) {\n /**\n * An inlay hint that for a type annotation.\n */\n InlayHintKind.Type = 1;\n /**\n * An inlay hint that is for a parameter.\n */\n InlayHintKind.Parameter = 2;\n function is(value) {\n return value === 1 || value === 2;\n }\n InlayHintKind.is = is;\n })(InlayHintKind || (exports.InlayHintKind = InlayHintKind = {}));\n var InlayHintLabelPart;\n (function (InlayHintLabelPart) {\n function create(value) {\n return { value: value };\n }\n InlayHintLabelPart.create = create;\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.location === undefined || Location.is(candidate.location))\n && (candidate.command === undefined || Command.is(candidate.command));\n }\n InlayHintLabelPart.is = is;\n })(InlayHintLabelPart || (exports.InlayHintLabelPart = InlayHintLabelPart = {}));\n var InlayHint;\n (function (InlayHint) {\n function create(position, label, kind) {\n var result = { position: position, label: label };\n if (kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n InlayHint.create = create;\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.position)\n && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is))\n && (candidate.kind === undefined || InlayHintKind.is(candidate.kind))\n && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft))\n && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight));\n }\n InlayHint.is = is;\n })(InlayHint || (exports.InlayHint = InlayHint = {}));\n var StringValue;\n (function (StringValue) {\n function createSnippet(value) {\n return { kind: 'snippet', value: value };\n }\n StringValue.createSnippet = createSnippet;\n })(StringValue || (exports.StringValue = StringValue = {}));\n var InlineCompletionItem;\n (function (InlineCompletionItem) {\n function create(insertText, filterText, range, command) {\n return { insertText: insertText, filterText: filterText, range: range, command: command };\n }\n InlineCompletionItem.create = create;\n })(InlineCompletionItem || (exports.InlineCompletionItem = InlineCompletionItem = {}));\n var InlineCompletionList;\n (function (InlineCompletionList) {\n function create(items) {\n return { items: items };\n }\n InlineCompletionList.create = create;\n })(InlineCompletionList || (exports.InlineCompletionList = InlineCompletionList = {}));\n /**\n * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.\n *\n * @since 3.18.0\n * @proposed\n */\n var InlineCompletionTriggerKind;\n (function (InlineCompletionTriggerKind) {\n /**\n * Completion was triggered explicitly by a user gesture.\n */\n InlineCompletionTriggerKind.Invoked = 0;\n /**\n * Completion was triggered automatically while editing.\n */\n InlineCompletionTriggerKind.Automatic = 1;\n })(InlineCompletionTriggerKind || (exports.InlineCompletionTriggerKind = InlineCompletionTriggerKind = {}));\n var SelectedCompletionInfo;\n (function (SelectedCompletionInfo) {\n function create(range, text) {\n return { range: range, text: text };\n }\n SelectedCompletionInfo.create = create;\n })(SelectedCompletionInfo || (exports.SelectedCompletionInfo = SelectedCompletionInfo = {}));\n var InlineCompletionContext;\n (function (InlineCompletionContext) {\n function create(triggerKind, selectedCompletionInfo) {\n return { triggerKind: triggerKind, selectedCompletionInfo: selectedCompletionInfo };\n }\n InlineCompletionContext.create = create;\n })(InlineCompletionContext || (exports.InlineCompletionContext = InlineCompletionContext = {}));\n var WorkspaceFolder;\n (function (WorkspaceFolder) {\n function is(value) {\n var candidate = value;\n return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);\n }\n WorkspaceFolder.is = is;\n })(WorkspaceFolder || (exports.WorkspaceFolder = WorkspaceFolder = {}));\n exports.EOL = ['\\n', '\\r\\n', '\\r'];\n /**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\n var TextDocument;\n (function (TextDocument) {\n /**\n * Creates a new ITextDocument literal from the given uri and content.\n * @param uri The document's uri.\n * @param languageId The document's language Id.\n * @param version The document's version.\n * @param content The document's content.\n */\n function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }\n TextDocument.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ITextDocument} interface.\n */\n function is(value) {\n var candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)\n && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\n }\n TextDocument.is = is;\n function applyEdits(document, edits) {\n var text = document.getText();\n var sortedEdits = mergeSort(edits, function (a, b) {\n var diff = a.range.start.line - b.range.start.line;\n if (diff === 0) {\n return a.range.start.character - b.range.start.character;\n }\n return diff;\n });\n var lastModifiedOffset = text.length;\n for (var i = sortedEdits.length - 1; i >= 0; i--) {\n var e = sortedEdits[i];\n var startOffset = document.offsetAt(e.range.start);\n var endOffset = document.offsetAt(e.range.end);\n if (endOffset <= lastModifiedOffset) {\n text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\n }\n else {\n throw new Error('Overlapping edit');\n }\n lastModifiedOffset = startOffset;\n }\n return text;\n }\n TextDocument.applyEdits = applyEdits;\n function mergeSort(data, compare) {\n if (data.length <= 1) {\n // sorted\n return data;\n }\n var p = (data.length / 2) | 0;\n var left = data.slice(0, p);\n var right = data.slice(p);\n mergeSort(left, compare);\n mergeSort(right, compare);\n var leftIdx = 0;\n var rightIdx = 0;\n var i = 0;\n while (leftIdx < left.length && rightIdx < right.length) {\n var ret = compare(left[leftIdx], right[rightIdx]);\n if (ret <= 0) {\n // smaller_equal -> take left to preserve order\n data[i++] = left[leftIdx++];\n }\n else {\n // greater -> take right\n data[i++] = right[rightIdx++];\n }\n }\n while (leftIdx < left.length) {\n data[i++] = left[leftIdx++];\n }\n while (rightIdx < right.length) {\n data[i++] = right[rightIdx++];\n }\n return data;\n }\n })(TextDocument || (exports.TextDocument = TextDocument = {}));\n /**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\n var FullTextDocument = /** @class */ (function () {\n function FullTextDocument(uri, languageId, version, content) {\n this._uri = uri;\n this._languageId = languageId;\n this._version = version;\n this._content = content;\n this._lineOffsets = undefined;\n }\n Object.defineProperty(FullTextDocument.prototype, \"uri\", {\n get: function () {\n return this._uri;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FullTextDocument.prototype, \"languageId\", {\n get: function () {\n return this._languageId;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FullTextDocument.prototype, \"version\", {\n get: function () {\n return this._version;\n },\n enumerable: false,\n configurable: true\n });\n FullTextDocument.prototype.getText = function (range) {\n if (range) {\n var start = this.offsetAt(range.start);\n var end = this.offsetAt(range.end);\n return this._content.substring(start, end);\n }\n return this._content;\n };\n FullTextDocument.prototype.update = function (event, version) {\n this._content = event.text;\n this._version = version;\n this._lineOffsets = undefined;\n };\n FullTextDocument.prototype.getLineOffsets = function () {\n if (this._lineOffsets === undefined) {\n var lineOffsets = [];\n var text = this._content;\n var isLineStart = true;\n for (var i = 0; i < text.length; i++) {\n if (isLineStart) {\n lineOffsets.push(i);\n isLineStart = false;\n }\n var ch = text.charAt(i);\n isLineStart = (ch === '\\r' || ch === '\\n');\n if (ch === '\\r' && i + 1 < text.length && text.charAt(i + 1) === '\\n') {\n i++;\n }\n }\n if (isLineStart && text.length > 0) {\n lineOffsets.push(text.length);\n }\n this._lineOffsets = lineOffsets;\n }\n return this._lineOffsets;\n };\n FullTextDocument.prototype.positionAt = function (offset) {\n offset = Math.max(Math.min(offset, this._content.length), 0);\n var lineOffsets = this.getLineOffsets();\n var low = 0, high = lineOffsets.length;\n if (high === 0) {\n return Position.create(0, offset);\n }\n while (low < high) {\n var mid = Math.floor((low + high) / 2);\n if (lineOffsets[mid] > offset) {\n high = mid;\n }\n else {\n low = mid + 1;\n }\n }\n // low is the least x for which the line offset is larger than the current offset\n // or array.length if no line offset is larger than the current offset\n var line = low - 1;\n return Position.create(line, offset - lineOffsets[line]);\n };\n FullTextDocument.prototype.offsetAt = function (position) {\n var lineOffsets = this.getLineOffsets();\n if (position.line >= lineOffsets.length) {\n return this._content.length;\n }\n else if (position.line < 0) {\n return 0;\n }\n var lineOffset = lineOffsets[position.line];\n var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\n return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\n };\n Object.defineProperty(FullTextDocument.prototype, \"lineCount\", {\n get: function () {\n return this.getLineOffsets().length;\n },\n enumerable: false,\n configurable: true\n });\n return FullTextDocument;\n }());\n var Is;\n (function (Is) {\n var toString = Object.prototype.toString;\n function defined(value) {\n return typeof value !== 'undefined';\n }\n Is.defined = defined;\n function undefined(value) {\n return typeof value === 'undefined';\n }\n Is.undefined = undefined;\n function boolean(value) {\n return value === true || value === false;\n }\n Is.boolean = boolean;\n function string(value) {\n return toString.call(value) === '[object String]';\n }\n Is.string = string;\n function number(value) {\n return toString.call(value) === '[object Number]';\n }\n Is.number = number;\n function numberRange(value, min, max) {\n return toString.call(value) === '[object Number]' && min <= value && value <= max;\n }\n Is.numberRange = numberRange;\n function integer(value) {\n return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;\n }\n Is.integer = integer;\n function uinteger(value) {\n return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;\n }\n Is.uinteger = uinteger;\n function func(value) {\n return toString.call(value) === '[object Function]';\n }\n Is.func = func;\n function objectLiteral(value) {\n // Strictly speaking class instances pass this check as well. Since the LSP\n // doesn't use classes we ignore this for now. If we do we need to add something\n // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\n return value !== null && typeof value === 'object';\n }\n Is.objectLiteral = objectLiteral;\n function typedArray(value, check) {\n return Array.isArray(value) && value.every(check);\n }\n Is.typedArray = typedArray;\n })(Is || (Is = {}));\n});\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = exports.MessageDirection = void 0;\nconst vscode_jsonrpc_1 = require(\"vscode-jsonrpc\");\nvar MessageDirection;\n(function (MessageDirection) {\n MessageDirection[\"clientToServer\"] = \"clientToServer\";\n MessageDirection[\"serverToClient\"] = \"serverToClient\";\n MessageDirection[\"both\"] = \"both\";\n})(MessageDirection || (exports.MessageDirection = MessageDirection = {}));\nclass RegistrationType {\n constructor(method) {\n this.method = method;\n }\n}\nexports.RegistrationType = RegistrationType;\nclass ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\n constructor(method) {\n super(method);\n }\n}\nexports.ProtocolRequestType0 = ProtocolRequestType0;\nclass ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\n constructor(method) {\n super(method, vscode_jsonrpc_1.ParameterStructures.byName);\n }\n}\nexports.ProtocolRequestType = ProtocolRequestType;\nclass ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\n constructor(method) {\n super(method);\n }\n}\nexports.ProtocolNotificationType0 = ProtocolNotificationType0;\nclass ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\n constructor(method) {\n super(method, vscode_jsonrpc_1.ParameterStructures.byName);\n }\n}\nexports.ProtocolNotificationType = ProtocolNotificationType;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;\nfunction boolean(value) {\n return value === true || value === false;\n}\nexports.boolean = boolean;\nfunction string(value) {\n return typeof value === 'string' || value instanceof String;\n}\nexports.string = string;\nfunction number(value) {\n return typeof value === 'number' || value instanceof Number;\n}\nexports.number = number;\nfunction error(value) {\n return value instanceof Error;\n}\nexports.error = error;\nfunction func(value) {\n return typeof value === 'function';\n}\nexports.func = func;\nfunction array(value) {\n return Array.isArray(value);\n}\nexports.array = array;\nfunction stringArray(value) {\n return array(value) && value.every(elem => string(elem));\n}\nexports.stringArray = stringArray;\nfunction typedArray(value, check) {\n return Array.isArray(value) && value.every(check);\n}\nexports.typedArray = typedArray;\nfunction objectLiteral(value) {\n // Strictly speaking class instances pass this check as well. Since the LSP\n // doesn't use classes we ignore this for now. If we do we need to add something\n // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\n return value !== null && typeof value === 'object';\n}\nexports.objectLiteral = objectLiteral;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ImplementationRequest = void 0;\nconst messages_1 = require(\"./messages\");\n// @ts-ignore: to avoid inlining LocationLink as dynamic import\nlet __noDynamicImport;\n/**\n * A request to resolve the implementation locations of a symbol at a given text\n * document position. The request's parameter is of type {@link TextDocumentPositionParams}\n * the response is of type {@link Definition} or a Thenable that resolves to such.\n */\nvar ImplementationRequest;\n(function (ImplementationRequest) {\n ImplementationRequest.method = 'textDocument/implementation';\n ImplementationRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\n})(ImplementationRequest || (exports.ImplementationRequest = ImplementationRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TypeDefinitionRequest = void 0;\nconst messages_1 = require(\"./messages\");\n// @ts-ignore: to avoid inlining LocatioLink as dynamic import\nlet __noDynamicImport;\n/**\n * A request to resolve the type definition locations of a symbol at a given text\n * document position. The request's parameter is of type {@link TextDocumentPositionParams}\n * the response is of type {@link Definition} or a Thenable that resolves to such.\n */\nvar TypeDefinitionRequest;\n(function (TypeDefinitionRequest) {\n TypeDefinitionRequest.method = 'textDocument/typeDefinition';\n TypeDefinitionRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\n})(TypeDefinitionRequest || (exports.TypeDefinitionRequest = TypeDefinitionRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\n */\nvar WorkspaceFoldersRequest;\n(function (WorkspaceFoldersRequest) {\n WorkspaceFoldersRequest.method = 'workspace/workspaceFolders';\n WorkspaceFoldersRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest.method);\n})(WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {}));\n/**\n * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\n * folder configuration changes.\n */\nvar DidChangeWorkspaceFoldersNotification;\n(function (DidChangeWorkspaceFoldersNotification) {\n DidChangeWorkspaceFoldersNotification.method = 'workspace/didChangeWorkspaceFolders';\n DidChangeWorkspaceFoldersNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification.method);\n})(DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConfigurationRequest = void 0;\nconst messages_1 = require(\"./messages\");\n//---- Get Configuration request ----\n/**\n * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\n * configuration setting.\n *\n * This pull model replaces the old push model were the client signaled configuration change via an\n * event. If the server still needs to react to configuration changes (since the server caches the\n * result of `workspace/configuration` requests) the server should register for an empty configuration\n * change event and empty the cache if such an event is received.\n */\nvar ConfigurationRequest;\n(function (ConfigurationRequest) {\n ConfigurationRequest.method = 'workspace/configuration';\n ConfigurationRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n ConfigurationRequest.type = new messages_1.ProtocolRequestType(ConfigurationRequest.method);\n})(ConfigurationRequest || (exports.ConfigurationRequest = ConfigurationRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ColorPresentationRequest = exports.DocumentColorRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to list all color symbols found in a given text document. The request's\n * parameter is of type {@link DocumentColorParams} the\n * response is of type {@link ColorInformation ColorInformation[]} or a Thenable\n * that resolves to such.\n */\nvar DocumentColorRequest;\n(function (DocumentColorRequest) {\n DocumentColorRequest.method = 'textDocument/documentColor';\n DocumentColorRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\n})(DocumentColorRequest || (exports.DocumentColorRequest = DocumentColorRequest = {}));\n/**\n * A request to list all presentation for a color. The request's\n * parameter is of type {@link ColorPresentationParams} the\n * response is of type {@link ColorInformation ColorInformation[]} or a Thenable\n * that resolves to such.\n */\nvar ColorPresentationRequest;\n(function (ColorPresentationRequest) {\n ColorPresentationRequest.method = 'textDocument/colorPresentation';\n ColorPresentationRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n ColorPresentationRequest.type = new messages_1.ProtocolRequestType(ColorPresentationRequest.method);\n})(ColorPresentationRequest || (exports.ColorPresentationRequest = ColorPresentationRequest = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide folding ranges in a document. The request's\n * parameter is of type {@link FoldingRangeParams}, the\n * response is of type {@link FoldingRangeList} or a Thenable\n * that resolves to such.\n */\nvar FoldingRangeRequest;\n(function (FoldingRangeRequest) {\n FoldingRangeRequest.method = 'textDocument/foldingRange';\n FoldingRangeRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\n})(FoldingRangeRequest || (exports.FoldingRangeRequest = FoldingRangeRequest = {}));\n/**\n * @since 3.18.0\n * @proposed\n */\nvar FoldingRangeRefreshRequest;\n(function (FoldingRangeRefreshRequest) {\n FoldingRangeRefreshRequest.method = `workspace/foldingRange/refresh`;\n FoldingRangeRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n FoldingRangeRefreshRequest.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest.method);\n})(FoldingRangeRefreshRequest || (exports.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DeclarationRequest = void 0;\nconst messages_1 = require(\"./messages\");\n// @ts-ignore: to avoid inlining LocationLink as dynamic import\nlet __noDynamicImport;\n/**\n * A request to resolve the type definition locations of a symbol at a given text\n * document position. The request's parameter is of type {@link TextDocumentPositionParams}\n * the response is of type {@link Declaration} or a typed array of {@link DeclarationLink}\n * or a Thenable that resolves to such.\n */\nvar DeclarationRequest;\n(function (DeclarationRequest) {\n DeclarationRequest.method = 'textDocument/declaration';\n DeclarationRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\n})(DeclarationRequest || (exports.DeclarationRequest = DeclarationRequest = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SelectionRangeRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide selection ranges in a document. The request's\n * parameter is of type {@link SelectionRangeParams}, the\n * response is of type {@link SelectionRange SelectionRange[]} or a Thenable\n * that resolves to such.\n */\nvar SelectionRangeRequest;\n(function (SelectionRangeRequest) {\n SelectionRangeRequest.method = 'textDocument/selectionRange';\n SelectionRangeRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\n})(SelectionRangeRequest || (exports.SelectionRangeRequest = SelectionRangeRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0;\nconst vscode_jsonrpc_1 = require(\"vscode-jsonrpc\");\nconst messages_1 = require(\"./messages\");\nvar WorkDoneProgress;\n(function (WorkDoneProgress) {\n WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\n function is(value) {\n return value === WorkDoneProgress.type;\n }\n WorkDoneProgress.is = is;\n})(WorkDoneProgress || (exports.WorkDoneProgress = WorkDoneProgress = {}));\n/**\n * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\n * reporting from the server.\n */\nvar WorkDoneProgressCreateRequest;\n(function (WorkDoneProgressCreateRequest) {\n WorkDoneProgressCreateRequest.method = 'window/workDoneProgress/create';\n WorkDoneProgressCreateRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest.method);\n})(WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {}));\n/**\n * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\n * initiated on the server side.\n */\nvar WorkDoneProgressCancelNotification;\n(function (WorkDoneProgressCancelNotification) {\n WorkDoneProgressCancelNotification.method = 'window/workDoneProgress/cancel';\n WorkDoneProgressCancelNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification.method);\n})(WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) TypeFox, Microsoft and others. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to result a `CallHierarchyItem` in a document at a given position.\n * Can be used as an input to an incoming or outgoing call hierarchy.\n *\n * @since 3.16.0\n */\nvar CallHierarchyPrepareRequest;\n(function (CallHierarchyPrepareRequest) {\n CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\n CallHierarchyPrepareRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\n})(CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {}));\n/**\n * A request to resolve the incoming calls for a given `CallHierarchyItem`.\n *\n * @since 3.16.0\n */\nvar CallHierarchyIncomingCallsRequest;\n(function (CallHierarchyIncomingCallsRequest) {\n CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\n CallHierarchyIncomingCallsRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\n})(CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {}));\n/**\n * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\n *\n * @since 3.16.0\n */\nvar CallHierarchyOutgoingCallsRequest;\n(function (CallHierarchyOutgoingCallsRequest) {\n CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\n CallHierarchyOutgoingCallsRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\n})(CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = void 0;\nconst messages_1 = require(\"./messages\");\n//------- 'textDocument/semanticTokens' -----\nvar TokenFormat;\n(function (TokenFormat) {\n TokenFormat.Relative = 'relative';\n})(TokenFormat || (exports.TokenFormat = TokenFormat = {}));\nvar SemanticTokensRegistrationType;\n(function (SemanticTokensRegistrationType) {\n SemanticTokensRegistrationType.method = 'textDocument/semanticTokens';\n SemanticTokensRegistrationType.type = new messages_1.RegistrationType(SemanticTokensRegistrationType.method);\n})(SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {}));\n/**\n * @since 3.16.0\n */\nvar SemanticTokensRequest;\n(function (SemanticTokensRequest) {\n SemanticTokensRequest.method = 'textDocument/semanticTokens/full';\n SemanticTokensRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\n SemanticTokensRequest.registrationMethod = SemanticTokensRegistrationType.method;\n})(SemanticTokensRequest || (exports.SemanticTokensRequest = SemanticTokensRequest = {}));\n/**\n * @since 3.16.0\n */\nvar SemanticTokensDeltaRequest;\n(function (SemanticTokensDeltaRequest) {\n SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta';\n SemanticTokensDeltaRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n SemanticTokensDeltaRequest.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest.method);\n SemanticTokensDeltaRequest.registrationMethod = SemanticTokensRegistrationType.method;\n})(SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {}));\n/**\n * @since 3.16.0\n */\nvar SemanticTokensRangeRequest;\n(function (SemanticTokensRangeRequest) {\n SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\n SemanticTokensRangeRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\n SemanticTokensRangeRequest.registrationMethod = SemanticTokensRegistrationType.method;\n})(SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {}));\n/**\n * @since 3.16.0\n */\nvar SemanticTokensRefreshRequest;\n(function (SemanticTokensRefreshRequest) {\n SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`;\n SemanticTokensRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n SemanticTokensRefreshRequest.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest.method);\n})(SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ShowDocumentRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to show a document. This request might open an\n * external program depending on the value of the URI to open.\n * For example a request to open `https://code.visualstudio.com/`\n * will very likely open the URI in a WEB browser.\n *\n * @since 3.16.0\n*/\nvar ShowDocumentRequest;\n(function (ShowDocumentRequest) {\n ShowDocumentRequest.method = 'window/showDocument';\n ShowDocumentRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n ShowDocumentRequest.type = new messages_1.ProtocolRequestType(ShowDocumentRequest.method);\n})(ShowDocumentRequest || (exports.ShowDocumentRequest = ShowDocumentRequest = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LinkedEditingRangeRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide ranges that can be edited together.\n *\n * @since 3.16.0\n */\nvar LinkedEditingRangeRequest;\n(function (LinkedEditingRangeRequest) {\n LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange';\n LinkedEditingRangeRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n LinkedEditingRangeRequest.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest.method);\n})(LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A pattern kind describing if a glob pattern matches a file a folder or\n * both.\n *\n * @since 3.16.0\n */\nvar FileOperationPatternKind;\n(function (FileOperationPatternKind) {\n /**\n * The pattern matches a file only.\n */\n FileOperationPatternKind.file = 'file';\n /**\n * The pattern matches a folder only.\n */\n FileOperationPatternKind.folder = 'folder';\n})(FileOperationPatternKind || (exports.FileOperationPatternKind = FileOperationPatternKind = {}));\n/**\n * The will create files request is sent from the client to the server before files are actually\n * created as long as the creation is triggered from within the client.\n *\n * The request can return a `WorkspaceEdit` which will be applied to workspace before the\n * files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file\n * to be created.\n *\n * @since 3.16.0\n */\nvar WillCreateFilesRequest;\n(function (WillCreateFilesRequest) {\n WillCreateFilesRequest.method = 'workspace/willCreateFiles';\n WillCreateFilesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WillCreateFilesRequest.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest.method);\n})(WillCreateFilesRequest || (exports.WillCreateFilesRequest = WillCreateFilesRequest = {}));\n/**\n * The did create files notification is sent from the client to the server when\n * files were created from within the client.\n *\n * @since 3.16.0\n */\nvar DidCreateFilesNotification;\n(function (DidCreateFilesNotification) {\n DidCreateFilesNotification.method = 'workspace/didCreateFiles';\n DidCreateFilesNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidCreateFilesNotification.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification.method);\n})(DidCreateFilesNotification || (exports.DidCreateFilesNotification = DidCreateFilesNotification = {}));\n/**\n * The will rename files request is sent from the client to the server before files are actually\n * renamed as long as the rename is triggered from within the client.\n *\n * @since 3.16.0\n */\nvar WillRenameFilesRequest;\n(function (WillRenameFilesRequest) {\n WillRenameFilesRequest.method = 'workspace/willRenameFiles';\n WillRenameFilesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WillRenameFilesRequest.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest.method);\n})(WillRenameFilesRequest || (exports.WillRenameFilesRequest = WillRenameFilesRequest = {}));\n/**\n * The did rename files notification is sent from the client to the server when\n * files were renamed from within the client.\n *\n * @since 3.16.0\n */\nvar DidRenameFilesNotification;\n(function (DidRenameFilesNotification) {\n DidRenameFilesNotification.method = 'workspace/didRenameFiles';\n DidRenameFilesNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidRenameFilesNotification.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification.method);\n})(DidRenameFilesNotification || (exports.DidRenameFilesNotification = DidRenameFilesNotification = {}));\n/**\n * The will delete files request is sent from the client to the server before files are actually\n * deleted as long as the deletion is triggered from within the client.\n *\n * @since 3.16.0\n */\nvar DidDeleteFilesNotification;\n(function (DidDeleteFilesNotification) {\n DidDeleteFilesNotification.method = 'workspace/didDeleteFiles';\n DidDeleteFilesNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidDeleteFilesNotification.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification.method);\n})(DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = DidDeleteFilesNotification = {}));\n/**\n * The did delete files notification is sent from the client to the server when\n * files were deleted from within the client.\n *\n * @since 3.16.0\n */\nvar WillDeleteFilesRequest;\n(function (WillDeleteFilesRequest) {\n WillDeleteFilesRequest.method = 'workspace/willDeleteFiles';\n WillDeleteFilesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WillDeleteFilesRequest.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest.method);\n})(WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = WillDeleteFilesRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * Moniker uniqueness level to define scope of the moniker.\n *\n * @since 3.16.0\n */\nvar UniquenessLevel;\n(function (UniquenessLevel) {\n /**\n * The moniker is only unique inside a document\n */\n UniquenessLevel.document = 'document';\n /**\n * The moniker is unique inside a project for which a dump got created\n */\n UniquenessLevel.project = 'project';\n /**\n * The moniker is unique inside the group to which a project belongs\n */\n UniquenessLevel.group = 'group';\n /**\n * The moniker is unique inside the moniker scheme.\n */\n UniquenessLevel.scheme = 'scheme';\n /**\n * The moniker is globally unique\n */\n UniquenessLevel.global = 'global';\n})(UniquenessLevel || (exports.UniquenessLevel = UniquenessLevel = {}));\n/**\n * The moniker kind.\n *\n * @since 3.16.0\n */\nvar MonikerKind;\n(function (MonikerKind) {\n /**\n * The moniker represent a symbol that is imported into a project\n */\n MonikerKind.$import = 'import';\n /**\n * The moniker represents a symbol that is exported from a project\n */\n MonikerKind.$export = 'export';\n /**\n * The moniker represents a symbol that is local to a project (e.g. a local\n * variable of a function, a class not visible outside the project, ...)\n */\n MonikerKind.local = 'local';\n})(MonikerKind || (exports.MonikerKind = MonikerKind = {}));\n/**\n * A request to get the moniker of a symbol at a given text document position.\n * The request parameter is of type {@link TextDocumentPositionParams}.\n * The response is of type {@link Moniker Moniker[]} or `null`.\n */\nvar MonikerRequest;\n(function (MonikerRequest) {\n MonikerRequest.method = 'textDocument/moniker';\n MonikerRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n MonikerRequest.type = new messages_1.ProtocolRequestType(MonikerRequest.method);\n})(MonikerRequest || (exports.MonikerRequest = MonikerRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) TypeFox, Microsoft and others. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TypeHierarchySubtypesRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchyPrepareRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to result a `TypeHierarchyItem` in a document at a given position.\n * Can be used as an input to a subtypes or supertypes type hierarchy.\n *\n * @since 3.17.0\n */\nvar TypeHierarchyPrepareRequest;\n(function (TypeHierarchyPrepareRequest) {\n TypeHierarchyPrepareRequest.method = 'textDocument/prepareTypeHierarchy';\n TypeHierarchyPrepareRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n TypeHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest.method);\n})(TypeHierarchyPrepareRequest || (exports.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {}));\n/**\n * A request to resolve the supertypes for a given `TypeHierarchyItem`.\n *\n * @since 3.17.0\n */\nvar TypeHierarchySupertypesRequest;\n(function (TypeHierarchySupertypesRequest) {\n TypeHierarchySupertypesRequest.method = 'typeHierarchy/supertypes';\n TypeHierarchySupertypesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n TypeHierarchySupertypesRequest.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest.method);\n})(TypeHierarchySupertypesRequest || (exports.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {}));\n/**\n * A request to resolve the subtypes for a given `TypeHierarchyItem`.\n *\n * @since 3.17.0\n */\nvar TypeHierarchySubtypesRequest;\n(function (TypeHierarchySubtypesRequest) {\n TypeHierarchySubtypesRequest.method = 'typeHierarchy/subtypes';\n TypeHierarchySubtypesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n TypeHierarchySubtypesRequest.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest.method);\n})(TypeHierarchySubtypesRequest || (exports.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlineValueRefreshRequest = exports.InlineValueRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide inline values in a document. The request's parameter is of\n * type {@link InlineValueParams}, the response is of type\n * {@link InlineValue InlineValue[]} or a Thenable that resolves to such.\n *\n * @since 3.17.0\n */\nvar InlineValueRequest;\n(function (InlineValueRequest) {\n InlineValueRequest.method = 'textDocument/inlineValue';\n InlineValueRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n InlineValueRequest.type = new messages_1.ProtocolRequestType(InlineValueRequest.method);\n})(InlineValueRequest || (exports.InlineValueRequest = InlineValueRequest = {}));\n/**\n * @since 3.17.0\n */\nvar InlineValueRefreshRequest;\n(function (InlineValueRefreshRequest) {\n InlineValueRefreshRequest.method = `workspace/inlineValue/refresh`;\n InlineValueRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n InlineValueRefreshRequest.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest.method);\n})(InlineValueRefreshRequest || (exports.InlineValueRefreshRequest = InlineValueRefreshRequest = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide inlay hints in a document. The request's parameter is of\n * type {@link InlayHintsParams}, the response is of type\n * {@link InlayHint InlayHint[]} or a Thenable that resolves to such.\n *\n * @since 3.17.0\n */\nvar InlayHintRequest;\n(function (InlayHintRequest) {\n InlayHintRequest.method = 'textDocument/inlayHint';\n InlayHintRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n InlayHintRequest.type = new messages_1.ProtocolRequestType(InlayHintRequest.method);\n})(InlayHintRequest || (exports.InlayHintRequest = InlayHintRequest = {}));\n/**\n * A request to resolve additional properties for an inlay hint.\n * The request's parameter is of type {@link InlayHint}, the response is\n * of type {@link InlayHint} or a Thenable that resolves to such.\n *\n * @since 3.17.0\n */\nvar InlayHintResolveRequest;\n(function (InlayHintResolveRequest) {\n InlayHintResolveRequest.method = 'inlayHint/resolve';\n InlayHintResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n InlayHintResolveRequest.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest.method);\n})(InlayHintResolveRequest || (exports.InlayHintResolveRequest = InlayHintResolveRequest = {}));\n/**\n * @since 3.17.0\n */\nvar InlayHintRefreshRequest;\n(function (InlayHintRefreshRequest) {\n InlayHintRefreshRequest.method = `workspace/inlayHint/refresh`;\n InlayHintRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n InlayHintRefreshRequest.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest.method);\n})(InlayHintRefreshRequest || (exports.InlayHintRefreshRequest = InlayHintRefreshRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = void 0;\nconst vscode_jsonrpc_1 = require(\"vscode-jsonrpc\");\nconst Is = require(\"./utils/is\");\nconst messages_1 = require(\"./messages\");\n/**\n * @since 3.17.0\n */\nvar DiagnosticServerCancellationData;\n(function (DiagnosticServerCancellationData) {\n function is(value) {\n const candidate = value;\n return candidate && Is.boolean(candidate.retriggerRequest);\n }\n DiagnosticServerCancellationData.is = is;\n})(DiagnosticServerCancellationData || (exports.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {}));\n/**\n * The document diagnostic report kinds.\n *\n * @since 3.17.0\n */\nvar DocumentDiagnosticReportKind;\n(function (DocumentDiagnosticReportKind) {\n /**\n * A diagnostic report with a full\n * set of problems.\n */\n DocumentDiagnosticReportKind.Full = 'full';\n /**\n * A report indicating that the last\n * returned report is still accurate.\n */\n DocumentDiagnosticReportKind.Unchanged = 'unchanged';\n})(DocumentDiagnosticReportKind || (exports.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {}));\n/**\n * The document diagnostic request definition.\n *\n * @since 3.17.0\n */\nvar DocumentDiagnosticRequest;\n(function (DocumentDiagnosticRequest) {\n DocumentDiagnosticRequest.method = 'textDocument/diagnostic';\n DocumentDiagnosticRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentDiagnosticRequest.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest.method);\n DocumentDiagnosticRequest.partialResult = new vscode_jsonrpc_1.ProgressType();\n})(DocumentDiagnosticRequest || (exports.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {}));\n/**\n * The workspace diagnostic request definition.\n *\n * @since 3.17.0\n */\nvar WorkspaceDiagnosticRequest;\n(function (WorkspaceDiagnosticRequest) {\n WorkspaceDiagnosticRequest.method = 'workspace/diagnostic';\n WorkspaceDiagnosticRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WorkspaceDiagnosticRequest.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest.method);\n WorkspaceDiagnosticRequest.partialResult = new vscode_jsonrpc_1.ProgressType();\n})(WorkspaceDiagnosticRequest || (exports.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {}));\n/**\n * The diagnostic refresh request definition.\n *\n * @since 3.17.0\n */\nvar DiagnosticRefreshRequest;\n(function (DiagnosticRefreshRequest) {\n DiagnosticRefreshRequest.method = `workspace/diagnostic/refresh`;\n DiagnosticRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n DiagnosticRefreshRequest.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest.method);\n})(DiagnosticRefreshRequest || (exports.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = void 0;\nconst vscode_languageserver_types_1 = require(\"vscode-languageserver-types\");\nconst Is = require(\"./utils/is\");\nconst messages_1 = require(\"./messages\");\n/**\n * A notebook cell kind.\n *\n * @since 3.17.0\n */\nvar NotebookCellKind;\n(function (NotebookCellKind) {\n /**\n * A markup-cell is formatted source that is used for display.\n */\n NotebookCellKind.Markup = 1;\n /**\n * A code-cell is source code.\n */\n NotebookCellKind.Code = 2;\n function is(value) {\n return value === 1 || value === 2;\n }\n NotebookCellKind.is = is;\n})(NotebookCellKind || (exports.NotebookCellKind = NotebookCellKind = {}));\nvar ExecutionSummary;\n(function (ExecutionSummary) {\n function create(executionOrder, success) {\n const result = { executionOrder };\n if (success === true || success === false) {\n result.success = success;\n }\n return result;\n }\n ExecutionSummary.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === undefined || Is.boolean(candidate.success));\n }\n ExecutionSummary.is = is;\n function equals(one, other) {\n if (one === other) {\n return true;\n }\n if (one === null || one === undefined || other === null || other === undefined) {\n return false;\n }\n return one.executionOrder === other.executionOrder && one.success === other.success;\n }\n ExecutionSummary.equals = equals;\n})(ExecutionSummary || (exports.ExecutionSummary = ExecutionSummary = {}));\nvar NotebookCell;\n(function (NotebookCell) {\n function create(kind, document) {\n return { kind, document };\n }\n NotebookCell.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) &&\n (candidate.metadata === undefined || Is.objectLiteral(candidate.metadata));\n }\n NotebookCell.is = is;\n function diff(one, two) {\n const result = new Set();\n if (one.document !== two.document) {\n result.add('document');\n }\n if (one.kind !== two.kind) {\n result.add('kind');\n }\n if (one.executionSummary !== two.executionSummary) {\n result.add('executionSummary');\n }\n if ((one.metadata !== undefined || two.metadata !== undefined) && !equalsMetadata(one.metadata, two.metadata)) {\n result.add('metadata');\n }\n if ((one.executionSummary !== undefined || two.executionSummary !== undefined) && !ExecutionSummary.equals(one.executionSummary, two.executionSummary)) {\n result.add('executionSummary');\n }\n return result;\n }\n NotebookCell.diff = diff;\n function equalsMetadata(one, other) {\n if (one === other) {\n return true;\n }\n if (one === null || one === undefined || other === null || other === undefined) {\n return false;\n }\n if (typeof one !== typeof other) {\n return false;\n }\n if (typeof one !== 'object') {\n return false;\n }\n const oneArray = Array.isArray(one);\n const otherArray = Array.isArray(other);\n if (oneArray !== otherArray) {\n return false;\n }\n if (oneArray && otherArray) {\n if (one.length !== other.length) {\n return false;\n }\n for (let i = 0; i < one.length; i++) {\n if (!equalsMetadata(one[i], other[i])) {\n return false;\n }\n }\n }\n if (Is.objectLiteral(one) && Is.objectLiteral(other)) {\n const oneKeys = Object.keys(one);\n const otherKeys = Object.keys(other);\n if (oneKeys.length !== otherKeys.length) {\n return false;\n }\n oneKeys.sort();\n otherKeys.sort();\n if (!equalsMetadata(oneKeys, otherKeys)) {\n return false;\n }\n for (let i = 0; i < oneKeys.length; i++) {\n const prop = oneKeys[i];\n if (!equalsMetadata(one[prop], other[prop])) {\n return false;\n }\n }\n }\n return true;\n }\n})(NotebookCell || (exports.NotebookCell = NotebookCell = {}));\nvar NotebookDocument;\n(function (NotebookDocument) {\n function create(uri, notebookType, version, cells) {\n return { uri, notebookType, version, cells };\n }\n NotebookDocument.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is.typedArray(candidate.cells, NotebookCell.is);\n }\n NotebookDocument.is = is;\n})(NotebookDocument || (exports.NotebookDocument = NotebookDocument = {}));\nvar NotebookDocumentSyncRegistrationType;\n(function (NotebookDocumentSyncRegistrationType) {\n NotebookDocumentSyncRegistrationType.method = 'notebookDocument/sync';\n NotebookDocumentSyncRegistrationType.messageDirection = messages_1.MessageDirection.clientToServer;\n NotebookDocumentSyncRegistrationType.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType.method);\n})(NotebookDocumentSyncRegistrationType || (exports.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {}));\n/**\n * A notification sent when a notebook opens.\n *\n * @since 3.17.0\n */\nvar DidOpenNotebookDocumentNotification;\n(function (DidOpenNotebookDocumentNotification) {\n DidOpenNotebookDocumentNotification.method = 'notebookDocument/didOpen';\n DidOpenNotebookDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidOpenNotebookDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification.method);\n DidOpenNotebookDocumentNotification.registrationMethod = NotebookDocumentSyncRegistrationType.method;\n})(DidOpenNotebookDocumentNotification || (exports.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {}));\nvar NotebookCellArrayChange;\n(function (NotebookCellArrayChange) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === undefined || Is.typedArray(candidate.cells, NotebookCell.is));\n }\n NotebookCellArrayChange.is = is;\n function create(start, deleteCount, cells) {\n const result = { start, deleteCount };\n if (cells !== undefined) {\n result.cells = cells;\n }\n return result;\n }\n NotebookCellArrayChange.create = create;\n})(NotebookCellArrayChange || (exports.NotebookCellArrayChange = NotebookCellArrayChange = {}));\nvar DidChangeNotebookDocumentNotification;\n(function (DidChangeNotebookDocumentNotification) {\n DidChangeNotebookDocumentNotification.method = 'notebookDocument/didChange';\n DidChangeNotebookDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidChangeNotebookDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification.method);\n DidChangeNotebookDocumentNotification.registrationMethod = NotebookDocumentSyncRegistrationType.method;\n})(DidChangeNotebookDocumentNotification || (exports.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {}));\n/**\n * A notification sent when a notebook document is saved.\n *\n * @since 3.17.0\n */\nvar DidSaveNotebookDocumentNotification;\n(function (DidSaveNotebookDocumentNotification) {\n DidSaveNotebookDocumentNotification.method = 'notebookDocument/didSave';\n DidSaveNotebookDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidSaveNotebookDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification.method);\n DidSaveNotebookDocumentNotification.registrationMethod = NotebookDocumentSyncRegistrationType.method;\n})(DidSaveNotebookDocumentNotification || (exports.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {}));\n/**\n * A notification sent when a notebook closes.\n *\n * @since 3.17.0\n */\nvar DidCloseNotebookDocumentNotification;\n(function (DidCloseNotebookDocumentNotification) {\n DidCloseNotebookDocumentNotification.method = 'notebookDocument/didClose';\n DidCloseNotebookDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidCloseNotebookDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification.method);\n DidCloseNotebookDocumentNotification.registrationMethod = NotebookDocumentSyncRegistrationType.method;\n})(DidCloseNotebookDocumentNotification || (exports.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {}));\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlineCompletionRequest = void 0;\nconst messages_1 = require(\"./messages\");\n/**\n * A request to provide inline completions in a document. The request's parameter is of\n * type {@link InlineCompletionParams}, the response is of type\n * {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.\n *\n * @since 3.18.0\n * @proposed\n */\nvar InlineCompletionRequest;\n(function (InlineCompletionRequest) {\n InlineCompletionRequest.method = 'textDocument/inlineCompletion';\n InlineCompletionRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n InlineCompletionRequest.type = new messages_1.ProtocolRequestType(InlineCompletionRequest.method);\n})(InlineCompletionRequest || (exports.InlineCompletionRequest = InlineCompletionRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.RelativePattern = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeErrorCodes = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.PositionEncodingKind = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.NotebookCellTextDocumentFilter = exports.NotebookDocumentFilter = exports.TextDocumentFilter = void 0;\nexports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRefreshRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangesFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolResolveRequest = void 0;\nexports.InlineCompletionRequest = exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = exports.InlineValueRefreshRequest = exports.InlineValueRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchySubtypesRequest = exports.TypeHierarchyPrepareRequest = void 0;\nconst messages_1 = require(\"./messages\");\nconst vscode_languageserver_types_1 = require(\"vscode-languageserver-types\");\nconst Is = require(\"./utils/is\");\nconst protocol_implementation_1 = require(\"./protocol.implementation\");\nObject.defineProperty(exports, \"ImplementationRequest\", { enumerable: true, get: function () { return protocol_implementation_1.ImplementationRequest; } });\nconst protocol_typeDefinition_1 = require(\"./protocol.typeDefinition\");\nObject.defineProperty(exports, \"TypeDefinitionRequest\", { enumerable: true, get: function () { return protocol_typeDefinition_1.TypeDefinitionRequest; } });\nconst protocol_workspaceFolder_1 = require(\"./protocol.workspaceFolder\");\nObject.defineProperty(exports, \"WorkspaceFoldersRequest\", { enumerable: true, get: function () { return protocol_workspaceFolder_1.WorkspaceFoldersRequest; } });\nObject.defineProperty(exports, \"DidChangeWorkspaceFoldersNotification\", { enumerable: true, get: function () { return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; } });\nconst protocol_configuration_1 = require(\"./protocol.configuration\");\nObject.defineProperty(exports, \"ConfigurationRequest\", { enumerable: true, get: function () { return protocol_configuration_1.ConfigurationRequest; } });\nconst protocol_colorProvider_1 = require(\"./protocol.colorProvider\");\nObject.defineProperty(exports, \"DocumentColorRequest\", { enumerable: true, get: function () { return protocol_colorProvider_1.DocumentColorRequest; } });\nObject.defineProperty(exports, \"ColorPresentationRequest\", { enumerable: true, get: function () { return protocol_colorProvider_1.ColorPresentationRequest; } });\nconst protocol_foldingRange_1 = require(\"./protocol.foldingRange\");\nObject.defineProperty(exports, \"FoldingRangeRequest\", { enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRequest; } });\nObject.defineProperty(exports, \"FoldingRangeRefreshRequest\", { enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRefreshRequest; } });\nconst protocol_declaration_1 = require(\"./protocol.declaration\");\nObject.defineProperty(exports, \"DeclarationRequest\", { enumerable: true, get: function () { return protocol_declaration_1.DeclarationRequest; } });\nconst protocol_selectionRange_1 = require(\"./protocol.selectionRange\");\nObject.defineProperty(exports, \"SelectionRangeRequest\", { enumerable: true, get: function () { return protocol_selectionRange_1.SelectionRangeRequest; } });\nconst protocol_progress_1 = require(\"./protocol.progress\");\nObject.defineProperty(exports, \"WorkDoneProgress\", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgress; } });\nObject.defineProperty(exports, \"WorkDoneProgressCreateRequest\", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCreateRequest; } });\nObject.defineProperty(exports, \"WorkDoneProgressCancelNotification\", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCancelNotification; } });\nconst protocol_callHierarchy_1 = require(\"./protocol.callHierarchy\");\nObject.defineProperty(exports, \"CallHierarchyIncomingCallsRequest\", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } });\nObject.defineProperty(exports, \"CallHierarchyOutgoingCallsRequest\", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } });\nObject.defineProperty(exports, \"CallHierarchyPrepareRequest\", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } });\nconst protocol_semanticTokens_1 = require(\"./protocol.semanticTokens\");\nObject.defineProperty(exports, \"TokenFormat\", { enumerable: true, get: function () { return protocol_semanticTokens_1.TokenFormat; } });\nObject.defineProperty(exports, \"SemanticTokensRequest\", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRequest; } });\nObject.defineProperty(exports, \"SemanticTokensDeltaRequest\", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } });\nObject.defineProperty(exports, \"SemanticTokensRangeRequest\", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } });\nObject.defineProperty(exports, \"SemanticTokensRefreshRequest\", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } });\nObject.defineProperty(exports, \"SemanticTokensRegistrationType\", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } });\nconst protocol_showDocument_1 = require(\"./protocol.showDocument\");\nObject.defineProperty(exports, \"ShowDocumentRequest\", { enumerable: true, get: function () { return protocol_showDocument_1.ShowDocumentRequest; } });\nconst protocol_linkedEditingRange_1 = require(\"./protocol.linkedEditingRange\");\nObject.defineProperty(exports, \"LinkedEditingRangeRequest\", { enumerable: true, get: function () { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } });\nconst protocol_fileOperations_1 = require(\"./protocol.fileOperations\");\nObject.defineProperty(exports, \"FileOperationPatternKind\", { enumerable: true, get: function () { return protocol_fileOperations_1.FileOperationPatternKind; } });\nObject.defineProperty(exports, \"DidCreateFilesNotification\", { enumerable: true, get: function () { return protocol_fileOperations_1.DidCreateFilesNotification; } });\nObject.defineProperty(exports, \"WillCreateFilesRequest\", { enumerable: true, get: function () { return protocol_fileOperations_1.WillCreateFilesRequest; } });\nObject.defineProperty(exports, \"DidRenameFilesNotification\", { enumerable: true, get: function () { return protocol_fileOperations_1.DidRenameFilesNotification; } });\nObject.defineProperty(exports, \"WillRenameFilesRequest\", { enumerable: true, get: function () { return protocol_fileOperations_1.WillRenameFilesRequest; } });\nObject.defineProperty(exports, \"DidDeleteFilesNotification\", { enumerable: true, get: function () { return protocol_fileOperations_1.DidDeleteFilesNotification; } });\nObject.defineProperty(exports, \"WillDeleteFilesRequest\", { enumerable: true, get: function () { return protocol_fileOperations_1.WillDeleteFilesRequest; } });\nconst protocol_moniker_1 = require(\"./protocol.moniker\");\nObject.defineProperty(exports, \"UniquenessLevel\", { enumerable: true, get: function () { return protocol_moniker_1.UniquenessLevel; } });\nObject.defineProperty(exports, \"MonikerKind\", { enumerable: true, get: function () { return protocol_moniker_1.MonikerKind; } });\nObject.defineProperty(exports, \"MonikerRequest\", { enumerable: true, get: function () { return protocol_moniker_1.MonikerRequest; } });\nconst protocol_typeHierarchy_1 = require(\"./protocol.typeHierarchy\");\nObject.defineProperty(exports, \"TypeHierarchyPrepareRequest\", { enumerable: true, get: function () { return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; } });\nObject.defineProperty(exports, \"TypeHierarchySubtypesRequest\", { enumerable: true, get: function () { return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; } });\nObject.defineProperty(exports, \"TypeHierarchySupertypesRequest\", { enumerable: true, get: function () { return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; } });\nconst protocol_inlineValue_1 = require(\"./protocol.inlineValue\");\nObject.defineProperty(exports, \"InlineValueRequest\", { enumerable: true, get: function () { return protocol_inlineValue_1.InlineValueRequest; } });\nObject.defineProperty(exports, \"InlineValueRefreshRequest\", { enumerable: true, get: function () { return protocol_inlineValue_1.InlineValueRefreshRequest; } });\nconst protocol_inlayHint_1 = require(\"./protocol.inlayHint\");\nObject.defineProperty(exports, \"InlayHintRequest\", { enumerable: true, get: function () { return protocol_inlayHint_1.InlayHintRequest; } });\nObject.defineProperty(exports, \"InlayHintResolveRequest\", { enumerable: true, get: function () { return protocol_inlayHint_1.InlayHintResolveRequest; } });\nObject.defineProperty(exports, \"InlayHintRefreshRequest\", { enumerable: true, get: function () { return protocol_inlayHint_1.InlayHintRefreshRequest; } });\nconst protocol_diagnostic_1 = require(\"./protocol.diagnostic\");\nObject.defineProperty(exports, \"DiagnosticServerCancellationData\", { enumerable: true, get: function () { return protocol_diagnostic_1.DiagnosticServerCancellationData; } });\nObject.defineProperty(exports, \"DocumentDiagnosticReportKind\", { enumerable: true, get: function () { return protocol_diagnostic_1.DocumentDiagnosticReportKind; } });\nObject.defineProperty(exports, \"DocumentDiagnosticRequest\", { enumerable: true, get: function () { return protocol_diagnostic_1.DocumentDiagnosticRequest; } });\nObject.defineProperty(exports, \"WorkspaceDiagnosticRequest\", { enumerable: true, get: function () { return protocol_diagnostic_1.WorkspaceDiagnosticRequest; } });\nObject.defineProperty(exports, \"DiagnosticRefreshRequest\", { enumerable: true, get: function () { return protocol_diagnostic_1.DiagnosticRefreshRequest; } });\nconst protocol_notebook_1 = require(\"./protocol.notebook\");\nObject.defineProperty(exports, \"NotebookCellKind\", { enumerable: true, get: function () { return protocol_notebook_1.NotebookCellKind; } });\nObject.defineProperty(exports, \"ExecutionSummary\", { enumerable: true, get: function () { return protocol_notebook_1.ExecutionSummary; } });\nObject.defineProperty(exports, \"NotebookCell\", { enumerable: true, get: function () { return protocol_notebook_1.NotebookCell; } });\nObject.defineProperty(exports, \"NotebookDocument\", { enumerable: true, get: function () { return protocol_notebook_1.NotebookDocument; } });\nObject.defineProperty(exports, \"NotebookDocumentSyncRegistrationType\", { enumerable: true, get: function () { return protocol_notebook_1.NotebookDocumentSyncRegistrationType; } });\nObject.defineProperty(exports, \"DidOpenNotebookDocumentNotification\", { enumerable: true, get: function () { return protocol_notebook_1.DidOpenNotebookDocumentNotification; } });\nObject.defineProperty(exports, \"NotebookCellArrayChange\", { enumerable: true, get: function () { return protocol_notebook_1.NotebookCellArrayChange; } });\nObject.defineProperty(exports, \"DidChangeNotebookDocumentNotification\", { enumerable: true, get: function () { return protocol_notebook_1.DidChangeNotebookDocumentNotification; } });\nObject.defineProperty(exports, \"DidSaveNotebookDocumentNotification\", { enumerable: true, get: function () { return protocol_notebook_1.DidSaveNotebookDocumentNotification; } });\nObject.defineProperty(exports, \"DidCloseNotebookDocumentNotification\", { enumerable: true, get: function () { return protocol_notebook_1.DidCloseNotebookDocumentNotification; } });\nconst protocol_inlineCompletion_1 = require(\"./protocol.inlineCompletion\");\nObject.defineProperty(exports, \"InlineCompletionRequest\", { enumerable: true, get: function () { return protocol_inlineCompletion_1.InlineCompletionRequest; } });\n// @ts-ignore: to avoid inlining LocationLink as dynamic import\nlet __noDynamicImport;\n/**\n * The TextDocumentFilter namespace provides helper functions to work with\n * {@link TextDocumentFilter} literals.\n *\n * @since 3.17.0\n */\nvar TextDocumentFilter;\n(function (TextDocumentFilter) {\n function is(value) {\n const candidate = value;\n return Is.string(candidate) || (Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern));\n }\n TextDocumentFilter.is = is;\n})(TextDocumentFilter || (exports.TextDocumentFilter = TextDocumentFilter = {}));\n/**\n * The NotebookDocumentFilter namespace provides helper functions to work with\n * {@link NotebookDocumentFilter} literals.\n *\n * @since 3.17.0\n */\nvar NotebookDocumentFilter;\n(function (NotebookDocumentFilter) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && (Is.string(candidate.notebookType) || Is.string(candidate.scheme) || Is.string(candidate.pattern));\n }\n NotebookDocumentFilter.is = is;\n})(NotebookDocumentFilter || (exports.NotebookDocumentFilter = NotebookDocumentFilter = {}));\n/**\n * The NotebookCellTextDocumentFilter namespace provides helper functions to work with\n * {@link NotebookCellTextDocumentFilter} literals.\n *\n * @since 3.17.0\n */\nvar NotebookCellTextDocumentFilter;\n(function (NotebookCellTextDocumentFilter) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate)\n && (Is.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook))\n && (candidate.language === undefined || Is.string(candidate.language));\n }\n NotebookCellTextDocumentFilter.is = is;\n})(NotebookCellTextDocumentFilter || (exports.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {}));\n/**\n * The DocumentSelector namespace provides helper functions to work with\n * {@link DocumentSelector}s.\n */\nvar DocumentSelector;\n(function (DocumentSelector) {\n function is(value) {\n if (!Array.isArray(value)) {\n return false;\n }\n for (let elem of value) {\n if (!Is.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) {\n return false;\n }\n }\n return true;\n }\n DocumentSelector.is = is;\n})(DocumentSelector || (exports.DocumentSelector = DocumentSelector = {}));\n/**\n * The `client/registerCapability` request is sent from the server to the client to register a new capability\n * handler on the client side.\n */\nvar RegistrationRequest;\n(function (RegistrationRequest) {\n RegistrationRequest.method = 'client/registerCapability';\n RegistrationRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n RegistrationRequest.type = new messages_1.ProtocolRequestType(RegistrationRequest.method);\n})(RegistrationRequest || (exports.RegistrationRequest = RegistrationRequest = {}));\n/**\n * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\n * handler on the client side.\n */\nvar UnregistrationRequest;\n(function (UnregistrationRequest) {\n UnregistrationRequest.method = 'client/unregisterCapability';\n UnregistrationRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n UnregistrationRequest.type = new messages_1.ProtocolRequestType(UnregistrationRequest.method);\n})(UnregistrationRequest || (exports.UnregistrationRequest = UnregistrationRequest = {}));\nvar ResourceOperationKind;\n(function (ResourceOperationKind) {\n /**\n * Supports creating new files and folders.\n */\n ResourceOperationKind.Create = 'create';\n /**\n * Supports renaming existing files and folders.\n */\n ResourceOperationKind.Rename = 'rename';\n /**\n * Supports deleting existing files and folders.\n */\n ResourceOperationKind.Delete = 'delete';\n})(ResourceOperationKind || (exports.ResourceOperationKind = ResourceOperationKind = {}));\nvar FailureHandlingKind;\n(function (FailureHandlingKind) {\n /**\n * Applying the workspace change is simply aborted if one of the changes provided\n * fails. All operations executed before the failing operation stay executed.\n */\n FailureHandlingKind.Abort = 'abort';\n /**\n * All operations are executed transactional. That means they either all\n * succeed or no changes at all are applied to the workspace.\n */\n FailureHandlingKind.Transactional = 'transactional';\n /**\n * If the workspace edit contains only textual file changes they are executed transactional.\n * If resource changes (create, rename or delete file) are part of the change the failure\n * handling strategy is abort.\n */\n FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\n /**\n * The client tries to undo the operations already executed. But there is no\n * guarantee that this is succeeding.\n */\n FailureHandlingKind.Undo = 'undo';\n})(FailureHandlingKind || (exports.FailureHandlingKind = FailureHandlingKind = {}));\n/**\n * A set of predefined position encoding kinds.\n *\n * @since 3.17.0\n */\nvar PositionEncodingKind;\n(function (PositionEncodingKind) {\n /**\n * Character offsets count UTF-8 code units (e.g. bytes).\n */\n PositionEncodingKind.UTF8 = 'utf-8';\n /**\n * Character offsets count UTF-16 code units.\n *\n * This is the default and must always be supported\n * by servers\n */\n PositionEncodingKind.UTF16 = 'utf-16';\n /**\n * Character offsets count UTF-32 code units.\n *\n * Implementation note: these are the same as Unicode codepoints,\n * so this `PositionEncodingKind` may also be used for an\n * encoding-agnostic representation of character offsets.\n */\n PositionEncodingKind.UTF32 = 'utf-32';\n})(PositionEncodingKind || (exports.PositionEncodingKind = PositionEncodingKind = {}));\n/**\n * The StaticRegistrationOptions namespace provides helper functions to work with\n * {@link StaticRegistrationOptions} literals.\n */\nvar StaticRegistrationOptions;\n(function (StaticRegistrationOptions) {\n function hasId(value) {\n const candidate = value;\n return candidate && Is.string(candidate.id) && candidate.id.length > 0;\n }\n StaticRegistrationOptions.hasId = hasId;\n})(StaticRegistrationOptions || (exports.StaticRegistrationOptions = StaticRegistrationOptions = {}));\n/**\n * The TextDocumentRegistrationOptions namespace provides helper functions to work with\n * {@link TextDocumentRegistrationOptions} literals.\n */\nvar TextDocumentRegistrationOptions;\n(function (TextDocumentRegistrationOptions) {\n function is(value) {\n const candidate = value;\n return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\n }\n TextDocumentRegistrationOptions.is = is;\n})(TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {}));\n/**\n * The WorkDoneProgressOptions namespace provides helper functions to work with\n * {@link WorkDoneProgressOptions} literals.\n */\nvar WorkDoneProgressOptions;\n(function (WorkDoneProgressOptions) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\n }\n WorkDoneProgressOptions.is = is;\n function hasWorkDoneProgress(value) {\n const candidate = value;\n return candidate && Is.boolean(candidate.workDoneProgress);\n }\n WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\n})(WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = WorkDoneProgressOptions = {}));\n/**\n * The initialize request is sent from the client to the server.\n * It is sent once as the request after starting up the server.\n * The requests parameter is of type {@link InitializeParams}\n * the response if of type {@link InitializeResult} of a Thenable that\n * resolves to such.\n */\nvar InitializeRequest;\n(function (InitializeRequest) {\n InitializeRequest.method = 'initialize';\n InitializeRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n InitializeRequest.type = new messages_1.ProtocolRequestType(InitializeRequest.method);\n})(InitializeRequest || (exports.InitializeRequest = InitializeRequest = {}));\n/**\n * Known error codes for an `InitializeErrorCodes`;\n */\nvar InitializeErrorCodes;\n(function (InitializeErrorCodes) {\n /**\n * If the protocol version provided by the client can't be handled by the server.\n *\n * @deprecated This initialize error got replaced by client capabilities. There is\n * no version handshake in version 3.0x\n */\n InitializeErrorCodes.unknownProtocolVersion = 1;\n})(InitializeErrorCodes || (exports.InitializeErrorCodes = InitializeErrorCodes = {}));\n/**\n * The initialized notification is sent from the client to the\n * server after the client is fully initialized and the server\n * is allowed to send requests from the server to the client.\n */\nvar InitializedNotification;\n(function (InitializedNotification) {\n InitializedNotification.method = 'initialized';\n InitializedNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n InitializedNotification.type = new messages_1.ProtocolNotificationType(InitializedNotification.method);\n})(InitializedNotification || (exports.InitializedNotification = InitializedNotification = {}));\n//---- Shutdown Method ----\n/**\n * A shutdown request is sent from the client to the server.\n * It is sent once when the client decides to shutdown the\n * server. The only notification that is sent after a shutdown request\n * is the exit event.\n */\nvar ShutdownRequest;\n(function (ShutdownRequest) {\n ShutdownRequest.method = 'shutdown';\n ShutdownRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n ShutdownRequest.type = new messages_1.ProtocolRequestType0(ShutdownRequest.method);\n})(ShutdownRequest || (exports.ShutdownRequest = ShutdownRequest = {}));\n//---- Exit Notification ----\n/**\n * The exit event is sent from the client to the server to\n * ask the server to exit its process.\n */\nvar ExitNotification;\n(function (ExitNotification) {\n ExitNotification.method = 'exit';\n ExitNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n ExitNotification.type = new messages_1.ProtocolNotificationType0(ExitNotification.method);\n})(ExitNotification || (exports.ExitNotification = ExitNotification = {}));\n/**\n * The configuration change notification is sent from the client to the server\n * when the client's configuration has changed. The notification contains\n * the changed configuration as defined by the language client.\n */\nvar DidChangeConfigurationNotification;\n(function (DidChangeConfigurationNotification) {\n DidChangeConfigurationNotification.method = 'workspace/didChangeConfiguration';\n DidChangeConfigurationNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification.method);\n})(DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = DidChangeConfigurationNotification = {}));\n//---- Message show and log notifications ----\n/**\n * The message type\n */\nvar MessageType;\n(function (MessageType) {\n /**\n * An error message.\n */\n MessageType.Error = 1;\n /**\n * A warning message.\n */\n MessageType.Warning = 2;\n /**\n * An information message.\n */\n MessageType.Info = 3;\n /**\n * A log message.\n */\n MessageType.Log = 4;\n /**\n * A debug message.\n *\n * @since 3.18.0\n */\n MessageType.Debug = 5;\n})(MessageType || (exports.MessageType = MessageType = {}));\n/**\n * The show message notification is sent from a server to a client to ask\n * the client to display a particular message in the user interface.\n */\nvar ShowMessageNotification;\n(function (ShowMessageNotification) {\n ShowMessageNotification.method = 'window/showMessage';\n ShowMessageNotification.messageDirection = messages_1.MessageDirection.serverToClient;\n ShowMessageNotification.type = new messages_1.ProtocolNotificationType(ShowMessageNotification.method);\n})(ShowMessageNotification || (exports.ShowMessageNotification = ShowMessageNotification = {}));\n/**\n * The show message request is sent from the server to the client to show a message\n * and a set of options actions to the user.\n */\nvar ShowMessageRequest;\n(function (ShowMessageRequest) {\n ShowMessageRequest.method = 'window/showMessageRequest';\n ShowMessageRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n ShowMessageRequest.type = new messages_1.ProtocolRequestType(ShowMessageRequest.method);\n})(ShowMessageRequest || (exports.ShowMessageRequest = ShowMessageRequest = {}));\n/**\n * The log message notification is sent from the server to the client to ask\n * the client to log a particular message.\n */\nvar LogMessageNotification;\n(function (LogMessageNotification) {\n LogMessageNotification.method = 'window/logMessage';\n LogMessageNotification.messageDirection = messages_1.MessageDirection.serverToClient;\n LogMessageNotification.type = new messages_1.ProtocolNotificationType(LogMessageNotification.method);\n})(LogMessageNotification || (exports.LogMessageNotification = LogMessageNotification = {}));\n//---- Telemetry notification\n/**\n * The telemetry event notification is sent from the server to the client to ask\n * the client to log telemetry data.\n */\nvar TelemetryEventNotification;\n(function (TelemetryEventNotification) {\n TelemetryEventNotification.method = 'telemetry/event';\n TelemetryEventNotification.messageDirection = messages_1.MessageDirection.serverToClient;\n TelemetryEventNotification.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification.method);\n})(TelemetryEventNotification || (exports.TelemetryEventNotification = TelemetryEventNotification = {}));\n/**\n * Defines how the host (editor) should sync\n * document changes to the language server.\n */\nvar TextDocumentSyncKind;\n(function (TextDocumentSyncKind) {\n /**\n * Documents should not be synced at all.\n */\n TextDocumentSyncKind.None = 0;\n /**\n * Documents are synced by always sending the full content\n * of the document.\n */\n TextDocumentSyncKind.Full = 1;\n /**\n * Documents are synced by sending the full content on open.\n * After that only incremental updates to the document are\n * send.\n */\n TextDocumentSyncKind.Incremental = 2;\n})(TextDocumentSyncKind || (exports.TextDocumentSyncKind = TextDocumentSyncKind = {}));\n/**\n * The document open notification is sent from the client to the server to signal\n * newly opened text documents. The document's truth is now managed by the client\n * and the server must not try to read the document's truth using the document's\n * uri. Open in this sense means it is managed by the client. It doesn't necessarily\n * mean that its content is presented in an editor. An open notification must not\n * be sent more than once without a corresponding close notification send before.\n * This means open and close notification must be balanced and the max open count\n * is one.\n */\nvar DidOpenTextDocumentNotification;\n(function (DidOpenTextDocumentNotification) {\n DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\n DidOpenTextDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\n})(DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification = {}));\nvar TextDocumentContentChangeEvent;\n(function (TextDocumentContentChangeEvent) {\n /**\n * Checks whether the information describes a delta event.\n */\n function isIncremental(event) {\n let candidate = event;\n return candidate !== undefined && candidate !== null &&\n typeof candidate.text === 'string' && candidate.range !== undefined &&\n (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');\n }\n TextDocumentContentChangeEvent.isIncremental = isIncremental;\n /**\n * Checks whether the information describes a full replacement event.\n */\n function isFull(event) {\n let candidate = event;\n return candidate !== undefined && candidate !== null &&\n typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;\n }\n TextDocumentContentChangeEvent.isFull = isFull;\n})(TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {}));\n/**\n * The document change notification is sent from the client to the server to signal\n * changes to a text document.\n */\nvar DidChangeTextDocumentNotification;\n(function (DidChangeTextDocumentNotification) {\n DidChangeTextDocumentNotification.method = 'textDocument/didChange';\n DidChangeTextDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\n})(DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification = {}));\n/**\n * The document close notification is sent from the client to the server when\n * the document got closed in the client. The document's truth now exists where\n * the document's uri points to (e.g. if the document's uri is a file uri the\n * truth now exists on disk). As with the open notification the close notification\n * is about managing the document's content. Receiving a close notification\n * doesn't mean that the document was open in an editor before. A close\n * notification requires a previous open notification to be sent.\n */\nvar DidCloseTextDocumentNotification;\n(function (DidCloseTextDocumentNotification) {\n DidCloseTextDocumentNotification.method = 'textDocument/didClose';\n DidCloseTextDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\n})(DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification = {}));\n/**\n * The document save notification is sent from the client to the server when\n * the document got saved in the client.\n */\nvar DidSaveTextDocumentNotification;\n(function (DidSaveTextDocumentNotification) {\n DidSaveTextDocumentNotification.method = 'textDocument/didSave';\n DidSaveTextDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\n})(DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {}));\n/**\n * Represents reasons why a text document is saved.\n */\nvar TextDocumentSaveReason;\n(function (TextDocumentSaveReason) {\n /**\n * Manually triggered, e.g. by the user pressing save, by starting debugging,\n * or by an API call.\n */\n TextDocumentSaveReason.Manual = 1;\n /**\n * Automatic after a delay.\n */\n TextDocumentSaveReason.AfterDelay = 2;\n /**\n * When the editor lost focus.\n */\n TextDocumentSaveReason.FocusOut = 3;\n})(TextDocumentSaveReason || (exports.TextDocumentSaveReason = TextDocumentSaveReason = {}));\n/**\n * A document will save notification is sent from the client to the server before\n * the document is actually saved.\n */\nvar WillSaveTextDocumentNotification;\n(function (WillSaveTextDocumentNotification) {\n WillSaveTextDocumentNotification.method = 'textDocument/willSave';\n WillSaveTextDocumentNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\n})(WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {}));\n/**\n * A document will save request is sent from the client to the server before\n * the document is actually saved. The request can return an array of TextEdits\n * which will be applied to the text document before it is saved. Please note that\n * clients might drop results if computing the text edits took too long or if a\n * server constantly fails on this request. This is done to keep the save fast and\n * reliable.\n */\nvar WillSaveTextDocumentWaitUntilRequest;\n(function (WillSaveTextDocumentWaitUntilRequest) {\n WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\n WillSaveTextDocumentWaitUntilRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\n})(WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {}));\n/**\n * The watched files notification is sent from the client to the server when\n * the client detects changes to file watched by the language client.\n */\nvar DidChangeWatchedFilesNotification;\n(function (DidChangeWatchedFilesNotification) {\n DidChangeWatchedFilesNotification.method = 'workspace/didChangeWatchedFiles';\n DidChangeWatchedFilesNotification.messageDirection = messages_1.MessageDirection.clientToServer;\n DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification.method);\n})(DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {}));\n/**\n * The file event type\n */\nvar FileChangeType;\n(function (FileChangeType) {\n /**\n * The file got created.\n */\n FileChangeType.Created = 1;\n /**\n * The file got changed.\n */\n FileChangeType.Changed = 2;\n /**\n * The file got deleted.\n */\n FileChangeType.Deleted = 3;\n})(FileChangeType || (exports.FileChangeType = FileChangeType = {}));\nvar RelativePattern;\n(function (RelativePattern) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is.string(candidate.pattern);\n }\n RelativePattern.is = is;\n})(RelativePattern || (exports.RelativePattern = RelativePattern = {}));\nvar WatchKind;\n(function (WatchKind) {\n /**\n * Interested in create events.\n */\n WatchKind.Create = 1;\n /**\n * Interested in change events\n */\n WatchKind.Change = 2;\n /**\n * Interested in delete events\n */\n WatchKind.Delete = 4;\n})(WatchKind || (exports.WatchKind = WatchKind = {}));\n/**\n * Diagnostics notification are sent from the server to the client to signal\n * results of validation runs.\n */\nvar PublishDiagnosticsNotification;\n(function (PublishDiagnosticsNotification) {\n PublishDiagnosticsNotification.method = 'textDocument/publishDiagnostics';\n PublishDiagnosticsNotification.messageDirection = messages_1.MessageDirection.serverToClient;\n PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification.method);\n})(PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = PublishDiagnosticsNotification = {}));\n/**\n * How a completion was triggered\n */\nvar CompletionTriggerKind;\n(function (CompletionTriggerKind) {\n /**\n * Completion was triggered by typing an identifier (24x7 code\n * complete), manual invocation (e.g Ctrl+Space) or via API.\n */\n CompletionTriggerKind.Invoked = 1;\n /**\n * Completion was triggered by a trigger character specified by\n * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\n */\n CompletionTriggerKind.TriggerCharacter = 2;\n /**\n * Completion was re-triggered as current completion list is incomplete\n */\n CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\n})(CompletionTriggerKind || (exports.CompletionTriggerKind = CompletionTriggerKind = {}));\n/**\n * Request to request completion at a given text document position. The request's\n * parameter is of type {@link TextDocumentPosition} the response\n * is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList}\n * or a Thenable that resolves to such.\n *\n * The request can delay the computation of the {@link CompletionItem.detail `detail`}\n * and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve`\n * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\n * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\n */\nvar CompletionRequest;\n(function (CompletionRequest) {\n CompletionRequest.method = 'textDocument/completion';\n CompletionRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\n})(CompletionRequest || (exports.CompletionRequest = CompletionRequest = {}));\n/**\n * Request to resolve additional information for a given completion item.The request's\n * parameter is of type {@link CompletionItem} the response\n * is of type {@link CompletionItem} or a Thenable that resolves to such.\n */\nvar CompletionResolveRequest;\n(function (CompletionResolveRequest) {\n CompletionResolveRequest.method = 'completionItem/resolve';\n CompletionResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\n})(CompletionResolveRequest || (exports.CompletionResolveRequest = CompletionResolveRequest = {}));\n/**\n * Request to request hover information at a given text document position. The request's\n * parameter is of type {@link TextDocumentPosition} the response is of\n * type {@link Hover} or a Thenable that resolves to such.\n */\nvar HoverRequest;\n(function (HoverRequest) {\n HoverRequest.method = 'textDocument/hover';\n HoverRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\n})(HoverRequest || (exports.HoverRequest = HoverRequest = {}));\n/**\n * How a signature help was triggered.\n *\n * @since 3.15.0\n */\nvar SignatureHelpTriggerKind;\n(function (SignatureHelpTriggerKind) {\n /**\n * Signature help was invoked manually by the user or by a command.\n */\n SignatureHelpTriggerKind.Invoked = 1;\n /**\n * Signature help was triggered by a trigger character.\n */\n SignatureHelpTriggerKind.TriggerCharacter = 2;\n /**\n * Signature help was triggered by the cursor moving or by the document content changing.\n */\n SignatureHelpTriggerKind.ContentChange = 3;\n})(SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {}));\nvar SignatureHelpRequest;\n(function (SignatureHelpRequest) {\n SignatureHelpRequest.method = 'textDocument/signatureHelp';\n SignatureHelpRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\n})(SignatureHelpRequest || (exports.SignatureHelpRequest = SignatureHelpRequest = {}));\n/**\n * A request to resolve the definition location of a symbol at a given text\n * document position. The request's parameter is of type {@link TextDocumentPosition}\n * the response is of either type {@link Definition} or a typed array of\n * {@link DefinitionLink} or a Thenable that resolves to such.\n */\nvar DefinitionRequest;\n(function (DefinitionRequest) {\n DefinitionRequest.method = 'textDocument/definition';\n DefinitionRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\n})(DefinitionRequest || (exports.DefinitionRequest = DefinitionRequest = {}));\n/**\n * A request to resolve project-wide references for the symbol denoted\n * by the given text document position. The request's parameter is of\n * type {@link ReferenceParams} the response is of type\n * {@link Location Location[]} or a Thenable that resolves to such.\n */\nvar ReferencesRequest;\n(function (ReferencesRequest) {\n ReferencesRequest.method = 'textDocument/references';\n ReferencesRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\n})(ReferencesRequest || (exports.ReferencesRequest = ReferencesRequest = {}));\n/**\n * Request to resolve a {@link DocumentHighlight} for a given\n * text document position. The request's parameter is of type {@link TextDocumentPosition}\n * the request response is an array of type {@link DocumentHighlight}\n * or a Thenable that resolves to such.\n */\nvar DocumentHighlightRequest;\n(function (DocumentHighlightRequest) {\n DocumentHighlightRequest.method = 'textDocument/documentHighlight';\n DocumentHighlightRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\n})(DocumentHighlightRequest || (exports.DocumentHighlightRequest = DocumentHighlightRequest = {}));\n/**\n * A request to list all symbols found in a given text document. The request's\n * parameter is of type {@link TextDocumentIdentifier} the\n * response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable\n * that resolves to such.\n */\nvar DocumentSymbolRequest;\n(function (DocumentSymbolRequest) {\n DocumentSymbolRequest.method = 'textDocument/documentSymbol';\n DocumentSymbolRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\n})(DocumentSymbolRequest || (exports.DocumentSymbolRequest = DocumentSymbolRequest = {}));\n/**\n * A request to provide commands for the given text document and range.\n */\nvar CodeActionRequest;\n(function (CodeActionRequest) {\n CodeActionRequest.method = 'textDocument/codeAction';\n CodeActionRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\n})(CodeActionRequest || (exports.CodeActionRequest = CodeActionRequest = {}));\n/**\n * Request to resolve additional information for a given code action.The request's\n * parameter is of type {@link CodeAction} the response\n * is of type {@link CodeAction} or a Thenable that resolves to such.\n */\nvar CodeActionResolveRequest;\n(function (CodeActionResolveRequest) {\n CodeActionResolveRequest.method = 'codeAction/resolve';\n CodeActionResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CodeActionResolveRequest.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest.method);\n})(CodeActionResolveRequest || (exports.CodeActionResolveRequest = CodeActionResolveRequest = {}));\n/**\n * A request to list project-wide symbols matching the query string given\n * by the {@link WorkspaceSymbolParams}. The response is\n * of type {@link SymbolInformation SymbolInformation[]} or a Thenable that\n * resolves to such.\n *\n * @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients\n * need to advertise support for WorkspaceSymbols via the client capability\n * `workspace.symbol.resolveSupport`.\n *\n */\nvar WorkspaceSymbolRequest;\n(function (WorkspaceSymbolRequest) {\n WorkspaceSymbolRequest.method = 'workspace/symbol';\n WorkspaceSymbolRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\n})(WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {}));\n/**\n * A request to resolve the range inside the workspace\n * symbol's location.\n *\n * @since 3.17.0\n */\nvar WorkspaceSymbolResolveRequest;\n(function (WorkspaceSymbolResolveRequest) {\n WorkspaceSymbolResolveRequest.method = 'workspaceSymbol/resolve';\n WorkspaceSymbolResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n WorkspaceSymbolResolveRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest.method);\n})(WorkspaceSymbolResolveRequest || (exports.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {}));\n/**\n * A request to provide code lens for the given text document.\n */\nvar CodeLensRequest;\n(function (CodeLensRequest) {\n CodeLensRequest.method = 'textDocument/codeLens';\n CodeLensRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CodeLensRequest.type = new messages_1.ProtocolRequestType(CodeLensRequest.method);\n})(CodeLensRequest || (exports.CodeLensRequest = CodeLensRequest = {}));\n/**\n * A request to resolve a command for a given code lens.\n */\nvar CodeLensResolveRequest;\n(function (CodeLensResolveRequest) {\n CodeLensResolveRequest.method = 'codeLens/resolve';\n CodeLensResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n CodeLensResolveRequest.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest.method);\n})(CodeLensResolveRequest || (exports.CodeLensResolveRequest = CodeLensResolveRequest = {}));\n/**\n * A request to refresh all code actions\n *\n * @since 3.16.0\n */\nvar CodeLensRefreshRequest;\n(function (CodeLensRefreshRequest) {\n CodeLensRefreshRequest.method = `workspace/codeLens/refresh`;\n CodeLensRefreshRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n CodeLensRefreshRequest.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest.method);\n})(CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = CodeLensRefreshRequest = {}));\n/**\n * A request to provide document links\n */\nvar DocumentLinkRequest;\n(function (DocumentLinkRequest) {\n DocumentLinkRequest.method = 'textDocument/documentLink';\n DocumentLinkRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\n})(DocumentLinkRequest || (exports.DocumentLinkRequest = DocumentLinkRequest = {}));\n/**\n * Request to resolve additional information for a given document link. The request's\n * parameter is of type {@link DocumentLink} the response\n * is of type {@link DocumentLink} or a Thenable that resolves to such.\n */\nvar DocumentLinkResolveRequest;\n(function (DocumentLinkResolveRequest) {\n DocumentLinkResolveRequest.method = 'documentLink/resolve';\n DocumentLinkResolveRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest.method);\n})(DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {}));\n/**\n * A request to format a whole document.\n */\nvar DocumentFormattingRequest;\n(function (DocumentFormattingRequest) {\n DocumentFormattingRequest.method = 'textDocument/formatting';\n DocumentFormattingRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\n})(DocumentFormattingRequest || (exports.DocumentFormattingRequest = DocumentFormattingRequest = {}));\n/**\n * A request to format a range in a document.\n */\nvar DocumentRangeFormattingRequest;\n(function (DocumentRangeFormattingRequest) {\n DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\n DocumentRangeFormattingRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\n})(DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {}));\n/**\n * A request to format ranges in a document.\n *\n * @since 3.18.0\n * @proposed\n */\nvar DocumentRangesFormattingRequest;\n(function (DocumentRangesFormattingRequest) {\n DocumentRangesFormattingRequest.method = 'textDocument/rangesFormatting';\n DocumentRangesFormattingRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentRangesFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest.method);\n})(DocumentRangesFormattingRequest || (exports.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {}));\n/**\n * A request to format a document on type.\n */\nvar DocumentOnTypeFormattingRequest;\n(function (DocumentOnTypeFormattingRequest) {\n DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\n DocumentOnTypeFormattingRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\n})(DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {}));\n//---- Rename ----------------------------------------------\nvar PrepareSupportDefaultBehavior;\n(function (PrepareSupportDefaultBehavior) {\n /**\n * The client's default behavior is to select the identifier\n * according the to language's syntax rule.\n */\n PrepareSupportDefaultBehavior.Identifier = 1;\n})(PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {}));\n/**\n * A request to rename a symbol.\n */\nvar RenameRequest;\n(function (RenameRequest) {\n RenameRequest.method = 'textDocument/rename';\n RenameRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\n})(RenameRequest || (exports.RenameRequest = RenameRequest = {}));\n/**\n * A request to test and perform the setup necessary for a rename.\n *\n * @since 3.16 - support for default behavior\n */\nvar PrepareRenameRequest;\n(function (PrepareRenameRequest) {\n PrepareRenameRequest.method = 'textDocument/prepareRename';\n PrepareRenameRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\n})(PrepareRenameRequest || (exports.PrepareRenameRequest = PrepareRenameRequest = {}));\n/**\n * A request send from the client to the server to execute a command. The request might return\n * a workspace edit which the client will apply to the workspace.\n */\nvar ExecuteCommandRequest;\n(function (ExecuteCommandRequest) {\n ExecuteCommandRequest.method = 'workspace/executeCommand';\n ExecuteCommandRequest.messageDirection = messages_1.MessageDirection.clientToServer;\n ExecuteCommandRequest.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest.method);\n})(ExecuteCommandRequest || (exports.ExecuteCommandRequest = ExecuteCommandRequest = {}));\n/**\n * A request sent from the server to the client to modified certain resources.\n */\nvar ApplyWorkspaceEditRequest;\n(function (ApplyWorkspaceEditRequest) {\n ApplyWorkspaceEditRequest.method = 'workspace/applyEdit';\n ApplyWorkspaceEditRequest.messageDirection = messages_1.MessageDirection.serverToClient;\n ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\n})(ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createProtocolConnection = void 0;\nconst vscode_jsonrpc_1 = require(\"vscode-jsonrpc\");\nfunction createProtocolConnection(input, output, logger, options) {\n if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {\n options = { connectionStrategy: options };\n }\n return (0, vscode_jsonrpc_1.createMessageConnection)(input, output, logger, options);\n}\nexports.createProtocolConnection = createProtocolConnection;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LSPErrorCodes = exports.createProtocolConnection = void 0;\n__exportStar(require(\"vscode-jsonrpc\"), exports);\n__exportStar(require(\"vscode-languageserver-types\"), exports);\n__exportStar(require(\"./messages\"), exports);\n__exportStar(require(\"./protocol\"), exports);\nvar connection_1 = require(\"./connection\");\nObject.defineProperty(exports, \"createProtocolConnection\", { enumerable: true, get: function () { return connection_1.createProtocolConnection; } });\nvar LSPErrorCodes;\n(function (LSPErrorCodes) {\n /**\n * This is the start range of LSP reserved error codes.\n * It doesn't denote a real error code.\n *\n * @since 3.16.0\n */\n LSPErrorCodes.lspReservedErrorRangeStart = -32899;\n /**\n * A request failed but it was syntactically correct, e.g the\n * method name was known and the parameters were valid. The error\n * message should contain human readable information about why\n * the request failed.\n *\n * @since 3.17.0\n */\n LSPErrorCodes.RequestFailed = -32803;\n /**\n * The server cancelled the request. This error code should\n * only be used for requests that explicitly support being\n * server cancellable.\n *\n * @since 3.17.0\n */\n LSPErrorCodes.ServerCancelled = -32802;\n /**\n * The server detected that the content of a document got\n * modified outside normal conditions. A server should\n * NOT send this error code if it detects a content change\n * in it unprocessed messages. The result even computed\n * on an older state might still be useful for the client.\n *\n * If a client decides that a result is not of any use anymore\n * the client should cancel the request.\n */\n LSPErrorCodes.ContentModified = -32801;\n /**\n * The client has canceled a request and a server as detected\n * the cancel.\n */\n LSPErrorCodes.RequestCancelled = -32800;\n /**\n * This is the end range of LSP reserved error codes.\n * It doesn't denote a real error code.\n *\n * @since 3.16.0\n */\n LSPErrorCodes.lspReservedErrorRangeEnd = -32800;\n})(LSPErrorCodes || (exports.LSPErrorCodes = LSPErrorCodes = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createProtocolConnection = void 0;\nconst node_1 = require(\"vscode-jsonrpc/node\");\n__exportStar(require(\"vscode-jsonrpc/node\"), exports);\n__exportStar(require(\"../common/api\"), exports);\nfunction createProtocolConnection(input, output, logger, options) {\n return (0, node_1.createMessageConnection)(input, output, logger, options);\n}\nexports.createProtocolConnection = createProtocolConnection;\n", "\"use strict\";\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateUuid = exports.parse = exports.isUUID = exports.v4 = exports.empty = void 0;\nclass ValueUUID {\n constructor(_value) {\n this._value = _value;\n // empty\n }\n asHex() {\n return this._value;\n }\n equals(other) {\n return this.asHex() === other.asHex();\n }\n}\nclass V4UUID extends ValueUUID {\n static _oneOf(array) {\n return array[Math.floor(array.length * Math.random())];\n }\n static _randomHex() {\n return V4UUID._oneOf(V4UUID._chars);\n }\n constructor() {\n super([\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n '-',\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n '-',\n '4',\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n '-',\n V4UUID._oneOf(V4UUID._timeHighBits),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n '-',\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n V4UUID._randomHex(),\n ].join(''));\n }\n}\nV4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\nV4UUID._timeHighBits = ['8', '9', 'a', 'b'];\n/**\n * An empty UUID that contains only zeros.\n */\nexports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');\nfunction v4() {\n return new V4UUID();\n}\nexports.v4 = v4;\nconst _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nfunction isUUID(value) {\n return _UUIDPattern.test(value);\n}\nexports.isUUID = isUUID;\n/**\n * Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.\n * @param value A uuid string.\n */\nfunction parse(value) {\n if (!isUUID(value)) {\n throw new Error('invalid uuid');\n }\n return new ValueUUID(value);\n}\nexports.parse = parse;\nfunction generateUuid() {\n return v4().asHex();\n}\nexports.generateUuid = generateUuid;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.attachPartialResult = exports.ProgressFeature = exports.attachWorkDone = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst uuid_1 = require(\"./utils/uuid\");\nclass WorkDoneProgressReporterImpl {\n constructor(_connection, _token) {\n this._connection = _connection;\n this._token = _token;\n WorkDoneProgressReporterImpl.Instances.set(this._token, this);\n }\n begin(title, percentage, message, cancellable) {\n let param = {\n kind: 'begin',\n title,\n percentage,\n message,\n cancellable\n };\n this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);\n }\n report(arg0, arg1) {\n let param = {\n kind: 'report'\n };\n if (typeof arg0 === 'number') {\n param.percentage = arg0;\n if (arg1 !== undefined) {\n param.message = arg1;\n }\n }\n else {\n param.message = arg0;\n }\n this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);\n }\n done() {\n WorkDoneProgressReporterImpl.Instances.delete(this._token);\n this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' });\n }\n}\nWorkDoneProgressReporterImpl.Instances = new Map();\nclass WorkDoneProgressServerReporterImpl extends WorkDoneProgressReporterImpl {\n constructor(connection, token) {\n super(connection, token);\n this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();\n }\n get token() {\n return this._source.token;\n }\n done() {\n this._source.dispose();\n super.done();\n }\n cancel() {\n this._source.cancel();\n }\n}\nclass NullProgressReporter {\n constructor() {\n }\n begin() {\n }\n report() {\n }\n done() {\n }\n}\nclass NullProgressServerReporter extends NullProgressReporter {\n constructor() {\n super();\n this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();\n }\n get token() {\n return this._source.token;\n }\n done() {\n this._source.dispose();\n }\n cancel() {\n this._source.cancel();\n }\n}\nfunction attachWorkDone(connection, params) {\n if (params === undefined || params.workDoneToken === undefined) {\n return new NullProgressReporter();\n }\n const token = params.workDoneToken;\n delete params.workDoneToken;\n return new WorkDoneProgressReporterImpl(connection, token);\n}\nexports.attachWorkDone = attachWorkDone;\nconst ProgressFeature = (Base) => {\n return class extends Base {\n constructor() {\n super();\n this._progressSupported = false;\n }\n initialize(capabilities) {\n super.initialize(capabilities);\n if (capabilities?.window?.workDoneProgress === true) {\n this._progressSupported = true;\n this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => {\n let progress = WorkDoneProgressReporterImpl.Instances.get(params.token);\n if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) {\n progress.cancel();\n }\n });\n }\n }\n attachWorkDoneProgress(token) {\n if (token === undefined) {\n return new NullProgressReporter();\n }\n else {\n return new WorkDoneProgressReporterImpl(this.connection, token);\n }\n }\n createWorkDoneProgress() {\n if (this._progressSupported) {\n const token = (0, uuid_1.generateUuid)();\n return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => {\n const result = new WorkDoneProgressServerReporterImpl(this.connection, token);\n return result;\n });\n }\n else {\n return Promise.resolve(new NullProgressServerReporter());\n }\n }\n };\n};\nexports.ProgressFeature = ProgressFeature;\nvar ResultProgress;\n(function (ResultProgress) {\n ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType();\n})(ResultProgress || (ResultProgress = {}));\nclass ResultProgressReporterImpl {\n constructor(_connection, _token) {\n this._connection = _connection;\n this._token = _token;\n }\n report(data) {\n this._connection.sendProgress(ResultProgress.type, this._token, data);\n }\n}\nfunction attachPartialResult(connection, params) {\n if (params === undefined || params.partialResultToken === undefined) {\n return undefined;\n }\n const token = params.partialResultToken;\n delete params.partialResultToken;\n return new ResultProgressReporterImpl(connection, token);\n}\nexports.attachPartialResult = attachPartialResult;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConfigurationFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst Is = require(\"./utils/is\");\nconst ConfigurationFeature = (Base) => {\n return class extends Base {\n getConfiguration(arg) {\n if (!arg) {\n return this._getConfiguration({});\n }\n else if (Is.string(arg)) {\n return this._getConfiguration({ section: arg });\n }\n else {\n return this._getConfiguration(arg);\n }\n }\n _getConfiguration(arg) {\n let params = {\n items: Array.isArray(arg) ? arg : [arg]\n };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {\n if (Array.isArray(result)) {\n return Array.isArray(arg) ? result : result[0];\n }\n else {\n return Array.isArray(arg) ? [] : null;\n }\n });\n }\n };\n};\nexports.ConfigurationFeature = ConfigurationFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkspaceFoldersFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst WorkspaceFoldersFeature = (Base) => {\n return class extends Base {\n constructor() {\n super();\n this._notificationIsAutoRegistered = false;\n }\n initialize(capabilities) {\n super.initialize(capabilities);\n let workspaceCapabilities = capabilities.workspace;\n if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {\n this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();\n this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {\n this._onDidChangeWorkspaceFolders.fire(params.event);\n });\n }\n }\n fillServerCapabilities(capabilities) {\n super.fillServerCapabilities(capabilities);\n const changeNotifications = capabilities.workspace?.workspaceFolders?.changeNotifications;\n this._notificationIsAutoRegistered = changeNotifications === true || typeof changeNotifications === 'string';\n }\n getWorkspaceFolders() {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);\n }\n get onDidChangeWorkspaceFolders() {\n if (!this._onDidChangeWorkspaceFolders) {\n throw new Error('Client doesn\\'t support sending workspace folder change events.');\n }\n if (!this._notificationIsAutoRegistered && !this._unregistration) {\n this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);\n }\n return this._onDidChangeWorkspaceFolders.event;\n }\n };\n};\nexports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CallHierarchyFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst CallHierarchyFeature = (Base) => {\n return class extends Base {\n get callHierarchy() {\n return {\n onPrepare: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);\n });\n },\n onIncomingCalls: (handler) => {\n const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n },\n onOutgoingCalls: (handler) => {\n const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n }\n };\n }\n };\n};\nexports.CallHierarchyFeature = CallHierarchyFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SemanticTokensBuilder = exports.SemanticTokensDiff = exports.SemanticTokensFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst SemanticTokensFeature = (Base) => {\n return class extends Base {\n get semanticTokens() {\n return {\n refresh: () => {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.SemanticTokensRefreshRequest.type);\n },\n on: (handler) => {\n const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n },\n onDelta: (handler) => {\n const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n },\n onRange: (handler) => {\n const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n }\n };\n }\n };\n};\nexports.SemanticTokensFeature = SemanticTokensFeature;\nclass SemanticTokensDiff {\n constructor(originalSequence, modifiedSequence) {\n this.originalSequence = originalSequence;\n this.modifiedSequence = modifiedSequence;\n }\n computeDiff() {\n const originalLength = this.originalSequence.length;\n const modifiedLength = this.modifiedSequence.length;\n let startIndex = 0;\n while (startIndex < modifiedLength && startIndex < originalLength && this.originalSequence[startIndex] === this.modifiedSequence[startIndex]) {\n startIndex++;\n }\n if (startIndex < modifiedLength && startIndex < originalLength) {\n let originalEndIndex = originalLength - 1;\n let modifiedEndIndex = modifiedLength - 1;\n while (originalEndIndex >= startIndex && modifiedEndIndex >= startIndex && this.originalSequence[originalEndIndex] === this.modifiedSequence[modifiedEndIndex]) {\n originalEndIndex--;\n modifiedEndIndex--;\n }\n // if one moved behind the start index move them forward again\n if (originalEndIndex < startIndex || modifiedEndIndex < startIndex) {\n originalEndIndex++;\n modifiedEndIndex++;\n }\n const deleteCount = originalEndIndex - startIndex + 1;\n const newData = this.modifiedSequence.slice(startIndex, modifiedEndIndex + 1);\n // If we moved behind the start index we could have missed a simple delete.\n if (newData.length === 1 && newData[0] === this.originalSequence[originalEndIndex]) {\n return [\n { start: startIndex, deleteCount: deleteCount - 1 }\n ];\n }\n else {\n return [\n { start: startIndex, deleteCount, data: newData }\n ];\n }\n }\n else if (startIndex < modifiedLength) {\n return [\n { start: startIndex, deleteCount: 0, data: this.modifiedSequence.slice(startIndex) }\n ];\n }\n else if (startIndex < originalLength) {\n return [\n { start: startIndex, deleteCount: originalLength - startIndex }\n ];\n }\n else {\n // The two arrays are the same.\n return [];\n }\n }\n}\nexports.SemanticTokensDiff = SemanticTokensDiff;\nclass SemanticTokensBuilder {\n constructor() {\n this._prevData = undefined;\n this.initialize();\n }\n initialize() {\n this._id = Date.now();\n this._prevLine = 0;\n this._prevChar = 0;\n this._data = [];\n this._dataLen = 0;\n }\n push(line, char, length, tokenType, tokenModifiers) {\n let pushLine = line;\n let pushChar = char;\n if (this._dataLen > 0) {\n pushLine -= this._prevLine;\n if (pushLine === 0) {\n pushChar -= this._prevChar;\n }\n }\n this._data[this._dataLen++] = pushLine;\n this._data[this._dataLen++] = pushChar;\n this._data[this._dataLen++] = length;\n this._data[this._dataLen++] = tokenType;\n this._data[this._dataLen++] = tokenModifiers;\n this._prevLine = line;\n this._prevChar = char;\n }\n get id() {\n return this._id.toString();\n }\n previousResult(id) {\n if (this.id === id) {\n this._prevData = this._data;\n }\n this.initialize();\n }\n build() {\n this._prevData = undefined;\n return {\n resultId: this.id,\n data: this._data\n };\n }\n canBuildEdits() {\n return this._prevData !== undefined;\n }\n buildEdits() {\n if (this._prevData !== undefined) {\n return {\n resultId: this.id,\n edits: (new SemanticTokensDiff(this._prevData, this._data)).computeDiff()\n };\n }\n else {\n return this.build();\n }\n }\n}\nexports.SemanticTokensBuilder = SemanticTokensBuilder;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ShowDocumentFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst ShowDocumentFeature = (Base) => {\n return class extends Base {\n showDocument(params) {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params);\n }\n };\n};\nexports.ShowDocumentFeature = ShowDocumentFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FileOperationsFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst FileOperationsFeature = (Base) => {\n return class extends Base {\n onDidCreateFiles(handler) {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => {\n handler(params);\n });\n }\n onDidRenameFiles(handler) {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => {\n handler(params);\n });\n }\n onDidDeleteFiles(handler) {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => {\n handler(params);\n });\n }\n onWillCreateFiles(handler) {\n return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => {\n return handler(params, cancel);\n });\n }\n onWillRenameFiles(handler) {\n return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => {\n return handler(params, cancel);\n });\n }\n onWillDeleteFiles(handler) {\n return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => {\n return handler(params, cancel);\n });\n }\n };\n};\nexports.FileOperationsFeature = FileOperationsFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LinkedEditingRangeFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst LinkedEditingRangeFeature = (Base) => {\n return class extends Base {\n onLinkedEditingRange(handler) {\n return this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);\n });\n }\n };\n};\nexports.LinkedEditingRangeFeature = LinkedEditingRangeFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TypeHierarchyFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst TypeHierarchyFeature = (Base) => {\n return class extends Base {\n get typeHierarchy() {\n return {\n onPrepare: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.TypeHierarchyPrepareRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);\n });\n },\n onSupertypes: (handler) => {\n const type = vscode_languageserver_protocol_1.TypeHierarchySupertypesRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n },\n onSubtypes: (handler) => {\n const type = vscode_languageserver_protocol_1.TypeHierarchySubtypesRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n }\n };\n }\n };\n};\nexports.TypeHierarchyFeature = TypeHierarchyFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlineValueFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst InlineValueFeature = (Base) => {\n return class extends Base {\n get inlineValue() {\n return {\n refresh: () => {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.InlineValueRefreshRequest.type);\n },\n on: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.InlineValueRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params));\n });\n }\n };\n }\n };\n};\nexports.InlineValueFeature = InlineValueFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FoldingRangeFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst FoldingRangeFeature = (Base) => {\n return class extends Base {\n get foldingRange() {\n return {\n refresh: () => {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.FoldingRangeRefreshRequest.type);\n },\n on: (handler) => {\n const type = vscode_languageserver_protocol_1.FoldingRangeRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n }\n };\n }\n };\n};\nexports.FoldingRangeFeature = FoldingRangeFeature;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlayHintFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst InlayHintFeature = (Base) => {\n return class extends Base {\n get inlayHint() {\n return {\n refresh: () => {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.InlayHintRefreshRequest.type);\n },\n on: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.InlayHintRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params));\n });\n },\n resolve: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.InlayHintResolveRequest.type, (params, cancel) => {\n return handler(params, cancel);\n });\n }\n };\n }\n };\n};\nexports.InlayHintFeature = InlayHintFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DiagnosticFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst DiagnosticFeature = (Base) => {\n return class extends Base {\n get diagnostics() {\n return {\n refresh: () => {\n return this.connection.sendRequest(vscode_languageserver_protocol_1.DiagnosticRefreshRequest.type);\n },\n on: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.DocumentDiagnosticRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.DocumentDiagnosticRequest.partialResult, params));\n });\n },\n onWorkspace: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.WorkspaceDiagnosticRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(vscode_languageserver_protocol_1.WorkspaceDiagnosticRequest.partialResult, params));\n });\n }\n };\n }\n };\n};\nexports.DiagnosticFeature = DiagnosticFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TextDocuments = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\n/**\n * A manager for simple text documents. The manager requires at a minimum that\n * the server registered for the following text document sync events in the\n * initialize handler or via dynamic registration:\n *\n * - open and close events.\n * - change events.\n *\n * Registering for save and will save events is optional.\n */\nclass TextDocuments {\n /**\n * Create a new text document manager.\n */\n constructor(configuration) {\n this._configuration = configuration;\n this._syncedDocuments = new Map();\n this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();\n this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();\n this._onDidClose = new vscode_languageserver_protocol_1.Emitter();\n this._onDidSave = new vscode_languageserver_protocol_1.Emitter();\n this._onWillSave = new vscode_languageserver_protocol_1.Emitter();\n }\n /**\n * An event that fires when a text document managed by this manager\n * has been opened.\n */\n get onDidOpen() {\n return this._onDidOpen.event;\n }\n /**\n * An event that fires when a text document managed by this manager\n * has been opened or the content changes.\n */\n get onDidChangeContent() {\n return this._onDidChangeContent.event;\n }\n /**\n * An event that fires when a text document managed by this manager\n * will be saved.\n */\n get onWillSave() {\n return this._onWillSave.event;\n }\n /**\n * Sets a handler that will be called if a participant wants to provide\n * edits during a text document save.\n */\n onWillSaveWaitUntil(handler) {\n this._willSaveWaitUntil = handler;\n }\n /**\n * An event that fires when a text document managed by this manager\n * has been saved.\n */\n get onDidSave() {\n return this._onDidSave.event;\n }\n /**\n * An event that fires when a text document managed by this manager\n * has been closed.\n */\n get onDidClose() {\n return this._onDidClose.event;\n }\n /**\n * Returns the document for the given URI. Returns undefined if\n * the document is not managed by this instance.\n *\n * @param uri The text document's URI to retrieve.\n * @return the text document or `undefined`.\n */\n get(uri) {\n return this._syncedDocuments.get(uri);\n }\n /**\n * Returns all text documents managed by this instance.\n *\n * @return all text documents.\n */\n all() {\n return Array.from(this._syncedDocuments.values());\n }\n /**\n * Returns the URIs of all text documents managed by this instance.\n *\n * @return the URI's of all text documents.\n */\n keys() {\n return Array.from(this._syncedDocuments.keys());\n }\n /**\n * Listens for `low level` notification on the given connection to\n * update the text documents managed by this instance.\n *\n * Please note that the connection only provides handlers not an event model. Therefore\n * listening on a connection will overwrite the following handlers on a connection:\n * `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,\n * `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.\n *\n * Use the corresponding events on the TextDocuments instance instead.\n *\n * @param connection The connection to listen on.\n */\n listen(connection) {\n connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Incremental;\n const disposables = [];\n disposables.push(connection.onDidOpenTextDocument((event) => {\n const td = event.textDocument;\n const document = this._configuration.create(td.uri, td.languageId, td.version, td.text);\n this._syncedDocuments.set(td.uri, document);\n const toFire = Object.freeze({ document });\n this._onDidOpen.fire(toFire);\n this._onDidChangeContent.fire(toFire);\n }));\n disposables.push(connection.onDidChangeTextDocument((event) => {\n const td = event.textDocument;\n const changes = event.contentChanges;\n if (changes.length === 0) {\n return;\n }\n const { version } = td;\n if (version === null || version === undefined) {\n throw new Error(`Received document change event for ${td.uri} without valid version identifier`);\n }\n let syncedDocument = this._syncedDocuments.get(td.uri);\n if (syncedDocument !== undefined) {\n syncedDocument = this._configuration.update(syncedDocument, changes, version);\n this._syncedDocuments.set(td.uri, syncedDocument);\n this._onDidChangeContent.fire(Object.freeze({ document: syncedDocument }));\n }\n }));\n disposables.push(connection.onDidCloseTextDocument((event) => {\n let syncedDocument = this._syncedDocuments.get(event.textDocument.uri);\n if (syncedDocument !== undefined) {\n this._syncedDocuments.delete(event.textDocument.uri);\n this._onDidClose.fire(Object.freeze({ document: syncedDocument }));\n }\n }));\n disposables.push(connection.onWillSaveTextDocument((event) => {\n let syncedDocument = this._syncedDocuments.get(event.textDocument.uri);\n if (syncedDocument !== undefined) {\n this._onWillSave.fire(Object.freeze({ document: syncedDocument, reason: event.reason }));\n }\n }));\n disposables.push(connection.onWillSaveTextDocumentWaitUntil((event, token) => {\n let syncedDocument = this._syncedDocuments.get(event.textDocument.uri);\n if (syncedDocument !== undefined && this._willSaveWaitUntil) {\n return this._willSaveWaitUntil(Object.freeze({ document: syncedDocument, reason: event.reason }), token);\n }\n else {\n return [];\n }\n }));\n disposables.push(connection.onDidSaveTextDocument((event) => {\n let syncedDocument = this._syncedDocuments.get(event.textDocument.uri);\n if (syncedDocument !== undefined) {\n this._onDidSave.fire(Object.freeze({ document: syncedDocument }));\n }\n }));\n return vscode_languageserver_protocol_1.Disposable.create(() => { disposables.forEach(disposable => disposable.dispose()); });\n }\n}\nexports.TextDocuments = TextDocuments;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NotebookDocuments = exports.NotebookSyncFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst textDocuments_1 = require(\"./textDocuments\");\nconst NotebookSyncFeature = (Base) => {\n return class extends Base {\n get synchronization() {\n return {\n onDidOpenNotebookDocument: (handler) => {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidOpenNotebookDocumentNotification.type, (params) => {\n handler(params);\n });\n },\n onDidChangeNotebookDocument: (handler) => {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeNotebookDocumentNotification.type, (params) => {\n handler(params);\n });\n },\n onDidSaveNotebookDocument: (handler) => {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidSaveNotebookDocumentNotification.type, (params) => {\n handler(params);\n });\n },\n onDidCloseNotebookDocument: (handler) => {\n return this.connection.onNotification(vscode_languageserver_protocol_1.DidCloseNotebookDocumentNotification.type, (params) => {\n handler(params);\n });\n }\n };\n }\n };\n};\nexports.NotebookSyncFeature = NotebookSyncFeature;\nclass CellTextDocumentConnection {\n onDidOpenTextDocument(handler) {\n this.openHandler = handler;\n return vscode_languageserver_protocol_1.Disposable.create(() => { this.openHandler = undefined; });\n }\n openTextDocument(params) {\n this.openHandler && this.openHandler(params);\n }\n onDidChangeTextDocument(handler) {\n this.changeHandler = handler;\n return vscode_languageserver_protocol_1.Disposable.create(() => { this.changeHandler = handler; });\n }\n changeTextDocument(params) {\n this.changeHandler && this.changeHandler(params);\n }\n onDidCloseTextDocument(handler) {\n this.closeHandler = handler;\n return vscode_languageserver_protocol_1.Disposable.create(() => { this.closeHandler = undefined; });\n }\n closeTextDocument(params) {\n this.closeHandler && this.closeHandler(params);\n }\n onWillSaveTextDocument() {\n return CellTextDocumentConnection.NULL_DISPOSE;\n }\n onWillSaveTextDocumentWaitUntil() {\n return CellTextDocumentConnection.NULL_DISPOSE;\n }\n onDidSaveTextDocument() {\n return CellTextDocumentConnection.NULL_DISPOSE;\n }\n}\nCellTextDocumentConnection.NULL_DISPOSE = Object.freeze({ dispose: () => { } });\nclass NotebookDocuments {\n constructor(configurationOrTextDocuments) {\n if (configurationOrTextDocuments instanceof textDocuments_1.TextDocuments) {\n this._cellTextDocuments = configurationOrTextDocuments;\n }\n else {\n this._cellTextDocuments = new textDocuments_1.TextDocuments(configurationOrTextDocuments);\n }\n this.notebookDocuments = new Map();\n this.notebookCellMap = new Map();\n this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();\n this._onDidChange = new vscode_languageserver_protocol_1.Emitter();\n this._onDidSave = new vscode_languageserver_protocol_1.Emitter();\n this._onDidClose = new vscode_languageserver_protocol_1.Emitter();\n }\n get cellTextDocuments() {\n return this._cellTextDocuments;\n }\n getCellTextDocument(cell) {\n return this._cellTextDocuments.get(cell.document);\n }\n getNotebookDocument(uri) {\n return this.notebookDocuments.get(uri);\n }\n getNotebookCell(uri) {\n const value = this.notebookCellMap.get(uri);\n return value && value[0];\n }\n findNotebookDocumentForCell(cell) {\n const key = typeof cell === 'string' ? cell : cell.document;\n const value = this.notebookCellMap.get(key);\n return value && value[1];\n }\n get onDidOpen() {\n return this._onDidOpen.event;\n }\n get onDidSave() {\n return this._onDidSave.event;\n }\n get onDidChange() {\n return this._onDidChange.event;\n }\n get onDidClose() {\n return this._onDidClose.event;\n }\n /**\n * Listens for `low level` notification on the given connection to\n * update the notebook documents managed by this instance.\n *\n * Please note that the connection only provides handlers not an event model. Therefore\n * listening on a connection will overwrite the following handlers on a connection:\n * `onDidOpenNotebookDocument`, `onDidChangeNotebookDocument`, `onDidSaveNotebookDocument`,\n * and `onDidCloseNotebookDocument`.\n *\n * @param connection The connection to listen on.\n */\n listen(connection) {\n const cellTextDocumentConnection = new CellTextDocumentConnection();\n const disposables = [];\n disposables.push(this.cellTextDocuments.listen(cellTextDocumentConnection));\n disposables.push(connection.notebooks.synchronization.onDidOpenNotebookDocument((params) => {\n this.notebookDocuments.set(params.notebookDocument.uri, params.notebookDocument);\n for (const cellTextDocument of params.cellTextDocuments) {\n cellTextDocumentConnection.openTextDocument({ textDocument: cellTextDocument });\n }\n this.updateCellMap(params.notebookDocument);\n this._onDidOpen.fire(params.notebookDocument);\n }));\n disposables.push(connection.notebooks.synchronization.onDidChangeNotebookDocument((params) => {\n const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri);\n if (notebookDocument === undefined) {\n return;\n }\n notebookDocument.version = params.notebookDocument.version;\n const oldMetadata = notebookDocument.metadata;\n let metadataChanged = false;\n const change = params.change;\n if (change.metadata !== undefined) {\n metadataChanged = true;\n notebookDocument.metadata = change.metadata;\n }\n const opened = [];\n const closed = [];\n const data = [];\n const text = [];\n if (change.cells !== undefined) {\n const changedCells = change.cells;\n if (changedCells.structure !== undefined) {\n const array = changedCells.structure.array;\n notebookDocument.cells.splice(array.start, array.deleteCount, ...(array.cells !== undefined ? array.cells : []));\n // Additional open cell text documents.\n if (changedCells.structure.didOpen !== undefined) {\n for (const open of changedCells.structure.didOpen) {\n cellTextDocumentConnection.openTextDocument({ textDocument: open });\n opened.push(open.uri);\n }\n }\n // Additional closed cell test documents.\n if (changedCells.structure.didClose) {\n for (const close of changedCells.structure.didClose) {\n cellTextDocumentConnection.closeTextDocument({ textDocument: close });\n closed.push(close.uri);\n }\n }\n }\n if (changedCells.data !== undefined) {\n const cellUpdates = new Map(changedCells.data.map(cell => [cell.document, cell]));\n for (let i = 0; i <= notebookDocument.cells.length; i++) {\n const change = cellUpdates.get(notebookDocument.cells[i].document);\n if (change !== undefined) {\n const old = notebookDocument.cells.splice(i, 1, change);\n data.push({ old: old[0], new: change });\n cellUpdates.delete(change.document);\n if (cellUpdates.size === 0) {\n break;\n }\n }\n }\n }\n if (changedCells.textContent !== undefined) {\n for (const cellTextDocument of changedCells.textContent) {\n cellTextDocumentConnection.changeTextDocument({ textDocument: cellTextDocument.document, contentChanges: cellTextDocument.changes });\n text.push(cellTextDocument.document.uri);\n }\n }\n }\n // Update internal data structure.\n this.updateCellMap(notebookDocument);\n const changeEvent = { notebookDocument };\n if (metadataChanged) {\n changeEvent.metadata = { old: oldMetadata, new: notebookDocument.metadata };\n }\n const added = [];\n for (const open of opened) {\n added.push(this.getNotebookCell(open));\n }\n const removed = [];\n for (const close of closed) {\n removed.push(this.getNotebookCell(close));\n }\n const textContent = [];\n for (const change of text) {\n textContent.push(this.getNotebookCell(change));\n }\n if (added.length > 0 || removed.length > 0 || data.length > 0 || textContent.length > 0) {\n changeEvent.cells = { added, removed, changed: { data, textContent } };\n }\n if (changeEvent.metadata !== undefined || changeEvent.cells !== undefined) {\n this._onDidChange.fire(changeEvent);\n }\n }));\n disposables.push(connection.notebooks.synchronization.onDidSaveNotebookDocument((params) => {\n const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri);\n if (notebookDocument === undefined) {\n return;\n }\n this._onDidSave.fire(notebookDocument);\n }));\n disposables.push(connection.notebooks.synchronization.onDidCloseNotebookDocument((params) => {\n const notebookDocument = this.notebookDocuments.get(params.notebookDocument.uri);\n if (notebookDocument === undefined) {\n return;\n }\n this._onDidClose.fire(notebookDocument);\n for (const cellTextDocument of params.cellTextDocuments) {\n cellTextDocumentConnection.closeTextDocument({ textDocument: cellTextDocument });\n }\n this.notebookDocuments.delete(params.notebookDocument.uri);\n for (const cell of notebookDocument.cells) {\n this.notebookCellMap.delete(cell.document);\n }\n }));\n return vscode_languageserver_protocol_1.Disposable.create(() => { disposables.forEach(disposable => disposable.dispose()); });\n }\n updateCellMap(notebookDocument) {\n for (const cell of notebookDocument.cells) {\n this.notebookCellMap.set(cell.document, [cell, notebookDocument]);\n }\n }\n}\nexports.NotebookDocuments = NotebookDocuments;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MonikerFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst MonikerFeature = (Base) => {\n return class extends Base {\n get moniker() {\n return {\n on: (handler) => {\n const type = vscode_languageserver_protocol_1.MonikerRequest.type;\n return this.connection.onRequest(type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));\n });\n },\n };\n }\n };\n};\nexports.MonikerFeature = MonikerFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createConnection = exports.combineFeatures = exports.combineNotebooksFeatures = exports.combineLanguagesFeatures = exports.combineWorkspaceFeatures = exports.combineWindowFeatures = exports.combineClientFeatures = exports.combineTracerFeatures = exports.combineTelemetryFeatures = exports.combineConsoleFeatures = exports._NotebooksImpl = exports._LanguagesImpl = exports.BulkUnregistration = exports.BulkRegistration = exports.ErrorMessageTracker = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst Is = require(\"./utils/is\");\nconst UUID = require(\"./utils/uuid\");\nconst progress_1 = require(\"./progress\");\nconst configuration_1 = require(\"./configuration\");\nconst workspaceFolder_1 = require(\"./workspaceFolder\");\nconst callHierarchy_1 = require(\"./callHierarchy\");\nconst semanticTokens_1 = require(\"./semanticTokens\");\nconst showDocument_1 = require(\"./showDocument\");\nconst fileOperations_1 = require(\"./fileOperations\");\nconst linkedEditingRange_1 = require(\"./linkedEditingRange\");\nconst typeHierarchy_1 = require(\"./typeHierarchy\");\nconst inlineValue_1 = require(\"./inlineValue\");\nconst foldingRange_1 = require(\"./foldingRange\");\n// import { InlineCompletionFeatureShape, InlineCompletionFeature } from './inlineCompletion.proposed';\nconst inlayHint_1 = require(\"./inlayHint\");\nconst diagnostic_1 = require(\"./diagnostic\");\nconst notebook_1 = require(\"./notebook\");\nconst moniker_1 = require(\"./moniker\");\nfunction null2Undefined(value) {\n if (value === null) {\n return undefined;\n }\n return value;\n}\n/**\n * Helps tracking error message. Equal occurrences of the same\n * message are only stored once. This class is for example\n * useful if text documents are validated in a loop and equal\n * error message should be folded into one.\n */\nclass ErrorMessageTracker {\n constructor() {\n this._messages = Object.create(null);\n }\n /**\n * Add a message to the tracker.\n *\n * @param message The message to add.\n */\n add(message) {\n let count = this._messages[message];\n if (!count) {\n count = 0;\n }\n count++;\n this._messages[message] = count;\n }\n /**\n * Send all tracked messages to the connection's window.\n *\n * @param connection The connection established between client and server.\n */\n sendErrors(connection) {\n Object.keys(this._messages).forEach(message => {\n connection.window.showErrorMessage(message);\n });\n }\n}\nexports.ErrorMessageTracker = ErrorMessageTracker;\nclass RemoteConsoleImpl {\n constructor() {\n }\n rawAttach(connection) {\n this._rawConnection = connection;\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n fillServerCapabilities(_capabilities) {\n }\n initialize(_capabilities) {\n }\n error(message) {\n this.send(vscode_languageserver_protocol_1.MessageType.Error, message);\n }\n warn(message) {\n this.send(vscode_languageserver_protocol_1.MessageType.Warning, message);\n }\n info(message) {\n this.send(vscode_languageserver_protocol_1.MessageType.Info, message);\n }\n log(message) {\n this.send(vscode_languageserver_protocol_1.MessageType.Log, message);\n }\n debug(message) {\n this.send(vscode_languageserver_protocol_1.MessageType.Debug, message);\n }\n send(type, message) {\n if (this._rawConnection) {\n this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message }).catch(() => {\n (0, vscode_languageserver_protocol_1.RAL)().console.error(`Sending log message failed`);\n });\n }\n }\n}\nclass _RemoteWindowImpl {\n constructor() {\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n showErrorMessage(message, ...actions) {\n let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\n }\n showWarningMessage(message, ...actions) {\n let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\n }\n showInformationMessage(message, ...actions) {\n let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);\n }\n}\nconst RemoteWindowImpl = (0, showDocument_1.ShowDocumentFeature)((0, progress_1.ProgressFeature)(_RemoteWindowImpl));\nvar BulkRegistration;\n(function (BulkRegistration) {\n /**\n * Creates a new bulk registration.\n * @return an empty bulk registration.\n */\n function create() {\n return new BulkRegistrationImpl();\n }\n BulkRegistration.create = create;\n})(BulkRegistration || (exports.BulkRegistration = BulkRegistration = {}));\nclass BulkRegistrationImpl {\n constructor() {\n this._registrations = [];\n this._registered = new Set();\n }\n add(type, registerOptions) {\n const method = Is.string(type) ? type : type.method;\n if (this._registered.has(method)) {\n throw new Error(`${method} is already added to this registration`);\n }\n const id = UUID.generateUuid();\n this._registrations.push({\n id: id,\n method: method,\n registerOptions: registerOptions || {}\n });\n this._registered.add(method);\n }\n asRegistrationParams() {\n return {\n registrations: this._registrations\n };\n }\n}\nvar BulkUnregistration;\n(function (BulkUnregistration) {\n function create() {\n return new BulkUnregistrationImpl(undefined, []);\n }\n BulkUnregistration.create = create;\n})(BulkUnregistration || (exports.BulkUnregistration = BulkUnregistration = {}));\nclass BulkUnregistrationImpl {\n constructor(_connection, unregistrations) {\n this._connection = _connection;\n this._unregistrations = new Map();\n unregistrations.forEach(unregistration => {\n this._unregistrations.set(unregistration.method, unregistration);\n });\n }\n get isAttached() {\n return !!this._connection;\n }\n attach(connection) {\n this._connection = connection;\n }\n add(unregistration) {\n this._unregistrations.set(unregistration.method, unregistration);\n }\n dispose() {\n let unregistrations = [];\n for (let unregistration of this._unregistrations.values()) {\n unregistrations.push(unregistration);\n }\n let params = {\n unregisterations: unregistrations\n };\n this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).catch(() => {\n this._connection.console.info(`Bulk unregistration failed.`);\n });\n }\n disposeSingle(arg) {\n const method = Is.string(arg) ? arg : arg.method;\n const unregistration = this._unregistrations.get(method);\n if (!unregistration) {\n return false;\n }\n let params = {\n unregisterations: [unregistration]\n };\n this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => {\n this._unregistrations.delete(method);\n }, (_error) => {\n this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`);\n });\n return true;\n }\n}\nclass RemoteClientImpl {\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n register(typeOrRegistrations, registerOptionsOrType, registerOptions) {\n if (typeOrRegistrations instanceof BulkRegistrationImpl) {\n return this.registerMany(typeOrRegistrations);\n }\n else if (typeOrRegistrations instanceof BulkUnregistrationImpl) {\n return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions);\n }\n else {\n return this.registerSingle2(typeOrRegistrations, registerOptionsOrType);\n }\n }\n registerSingle1(unregistration, type, registerOptions) {\n const method = Is.string(type) ? type : type.method;\n const id = UUID.generateUuid();\n let params = {\n registrations: [{ id, method, registerOptions: registerOptions || {} }]\n };\n if (!unregistration.isAttached) {\n unregistration.attach(this.connection);\n }\n return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {\n unregistration.add({ id: id, method: method });\n return unregistration;\n }, (_error) => {\n this.connection.console.info(`Registering request handler for ${method} failed.`);\n return Promise.reject(_error);\n });\n }\n registerSingle2(type, registerOptions) {\n const method = Is.string(type) ? type : type.method;\n const id = UUID.generateUuid();\n let params = {\n registrations: [{ id, method, registerOptions: registerOptions || {} }]\n };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {\n return vscode_languageserver_protocol_1.Disposable.create(() => {\n this.unregisterSingle(id, method).catch(() => { this.connection.console.info(`Un-registering capability with id ${id} failed.`); });\n });\n }, (_error) => {\n this.connection.console.info(`Registering request handler for ${method} failed.`);\n return Promise.reject(_error);\n });\n }\n unregisterSingle(id, method) {\n let params = {\n unregisterations: [{ id, method }]\n };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).catch(() => {\n this.connection.console.info(`Un-registering request handler for ${id} failed.`);\n });\n }\n registerMany(registrations) {\n let params = registrations.asRegistrationParams();\n return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => {\n return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; }));\n }, (_error) => {\n this.connection.console.info(`Bulk registration failed.`);\n return Promise.reject(_error);\n });\n }\n}\nclass _RemoteWorkspaceImpl {\n constructor() {\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n applyEdit(paramOrEdit) {\n function isApplyWorkspaceEditParams(value) {\n return value && !!value.edit;\n }\n let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit };\n return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params);\n }\n}\nconst RemoteWorkspaceImpl = (0, fileOperations_1.FileOperationsFeature)((0, workspaceFolder_1.WorkspaceFoldersFeature)((0, configuration_1.ConfigurationFeature)(_RemoteWorkspaceImpl)));\nclass TracerImpl {\n constructor() {\n this._trace = vscode_languageserver_protocol_1.Trace.Off;\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n set trace(value) {\n this._trace = value;\n }\n log(message, verbose) {\n if (this._trace === vscode_languageserver_protocol_1.Trace.Off) {\n return;\n }\n this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, {\n message: message,\n verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined\n }).catch(() => {\n // Very hard to decide what to do. We tried to send a log\n // message which failed so we can't simply send another :-(.\n });\n }\n}\nclass TelemetryImpl {\n constructor() {\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n logEvent(data) {\n this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data).catch(() => {\n this.connection.console.log(`Sending TelemetryEventNotification failed`);\n });\n }\n}\nclass _LanguagesImpl {\n constructor() {\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n attachWorkDoneProgress(params) {\n return (0, progress_1.attachWorkDone)(this.connection, params);\n }\n attachPartialResultProgress(_type, params) {\n return (0, progress_1.attachPartialResult)(this.connection, params);\n }\n}\nexports._LanguagesImpl = _LanguagesImpl;\nconst LanguagesImpl = (0, foldingRange_1.FoldingRangeFeature)((0, moniker_1.MonikerFeature)((0, diagnostic_1.DiagnosticFeature)((0, inlayHint_1.InlayHintFeature)((0, inlineValue_1.InlineValueFeature)((0, typeHierarchy_1.TypeHierarchyFeature)((0, linkedEditingRange_1.LinkedEditingRangeFeature)((0, semanticTokens_1.SemanticTokensFeature)((0, callHierarchy_1.CallHierarchyFeature)(_LanguagesImpl)))))))));\nclass _NotebooksImpl {\n constructor() {\n }\n attach(connection) {\n this._connection = connection;\n }\n get connection() {\n if (!this._connection) {\n throw new Error('Remote is not attached to a connection yet.');\n }\n return this._connection;\n }\n initialize(_capabilities) {\n }\n fillServerCapabilities(_capabilities) {\n }\n attachWorkDoneProgress(params) {\n return (0, progress_1.attachWorkDone)(this.connection, params);\n }\n attachPartialResultProgress(_type, params) {\n return (0, progress_1.attachPartialResult)(this.connection, params);\n }\n}\nexports._NotebooksImpl = _NotebooksImpl;\nconst NotebooksImpl = (0, notebook_1.NotebookSyncFeature)(_NotebooksImpl);\nfunction combineConsoleFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineConsoleFeatures = combineConsoleFeatures;\nfunction combineTelemetryFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineTelemetryFeatures = combineTelemetryFeatures;\nfunction combineTracerFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineTracerFeatures = combineTracerFeatures;\nfunction combineClientFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineClientFeatures = combineClientFeatures;\nfunction combineWindowFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineWindowFeatures = combineWindowFeatures;\nfunction combineWorkspaceFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineWorkspaceFeatures = combineWorkspaceFeatures;\nfunction combineLanguagesFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineLanguagesFeatures = combineLanguagesFeatures;\nfunction combineNotebooksFeatures(one, two) {\n return function (Base) {\n return two(one(Base));\n };\n}\nexports.combineNotebooksFeatures = combineNotebooksFeatures;\nfunction combineFeatures(one, two) {\n function combine(one, two, func) {\n if (one && two) {\n return func(one, two);\n }\n else if (one) {\n return one;\n }\n else {\n return two;\n }\n }\n let result = {\n __brand: 'features',\n console: combine(one.console, two.console, combineConsoleFeatures),\n tracer: combine(one.tracer, two.tracer, combineTracerFeatures),\n telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures),\n client: combine(one.client, two.client, combineClientFeatures),\n window: combine(one.window, two.window, combineWindowFeatures),\n workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures),\n languages: combine(one.languages, two.languages, combineLanguagesFeatures),\n notebooks: combine(one.notebooks, two.notebooks, combineNotebooksFeatures)\n };\n return result;\n}\nexports.combineFeatures = combineFeatures;\nfunction createConnection(connectionFactory, watchDog, factories) {\n const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl());\n const connection = connectionFactory(logger);\n logger.rawAttach(connection);\n const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl());\n const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl());\n const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl());\n const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl());\n const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl());\n const languages = (factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl());\n const notebooks = (factories && factories.notebooks ? new (factories.notebooks(NotebooksImpl))() : new NotebooksImpl());\n const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages, notebooks];\n function asPromise(value) {\n if (value instanceof Promise) {\n return value;\n }\n else if (Is.thenable(value)) {\n return new Promise((resolve, reject) => {\n value.then((resolved) => resolve(resolved), (error) => reject(error));\n });\n }\n else {\n return Promise.resolve(value);\n }\n }\n let shutdownHandler = undefined;\n let initializeHandler = undefined;\n let exitHandler = undefined;\n let protocolConnection = {\n listen: () => connection.listen(),\n sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params),\n onRequest: (type, handler) => connection.onRequest(type, handler),\n sendNotification: (type, param) => {\n const method = Is.string(type) ? type : type.method;\n return connection.sendNotification(method, param);\n },\n onNotification: (type, handler) => connection.onNotification(type, handler),\n onProgress: connection.onProgress,\n sendProgress: connection.sendProgress,\n onInitialize: (handler) => {\n initializeHandler = handler;\n return {\n dispose: () => {\n initializeHandler = undefined;\n }\n };\n },\n onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler),\n onShutdown: (handler) => {\n shutdownHandler = handler;\n return {\n dispose: () => {\n shutdownHandler = undefined;\n }\n };\n },\n onExit: (handler) => {\n exitHandler = handler;\n return {\n dispose: () => {\n exitHandler = undefined;\n }\n };\n },\n get console() { return logger; },\n get telemetry() { return telemetry; },\n get tracer() { return tracer; },\n get client() { return client; },\n get window() { return remoteWindow; },\n get workspace() { return workspace; },\n get languages() { return languages; },\n get notebooks() { return notebooks; },\n onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler),\n onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler),\n __textDocumentSync: undefined,\n onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler),\n onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler),\n onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler),\n onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler),\n onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler),\n onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler),\n sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params),\n onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler),\n onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onWorkspaceSymbolResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolResolveRequest.type, handler),\n onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onCodeActionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => {\n return handler(params, cancel);\n }),\n onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => {\n return handler(params, cancel);\n }),\n onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => {\n return handler(params, cancel);\n }),\n onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => {\n return handler(params, cancel);\n }),\n onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => {\n return handler(params, cancel);\n }),\n onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), (0, progress_1.attachPartialResult)(connection, params));\n }),\n onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => {\n return handler(params, cancel, (0, progress_1.attachWorkDone)(connection, params), undefined);\n }),\n dispose: () => connection.dispose()\n };\n for (let remote of allRemotes) {\n remote.attach(protocolConnection);\n }\n connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => {\n watchDog.initialize(params);\n if (Is.string(params.trace)) {\n tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace);\n }\n for (let remote of allRemotes) {\n remote.initialize(params.capabilities);\n }\n if (initializeHandler) {\n let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, (0, progress_1.attachWorkDone)(connection, params), undefined);\n return asPromise(result).then((value) => {\n if (value instanceof vscode_languageserver_protocol_1.ResponseError) {\n return value;\n }\n let result = value;\n if (!result) {\n result = { capabilities: {} };\n }\n let capabilities = result.capabilities;\n if (!capabilities) {\n capabilities = {};\n result.capabilities = capabilities;\n }\n if (capabilities.textDocumentSync === undefined || capabilities.textDocumentSync === null) {\n capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;\n }\n else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) {\n capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;\n }\n for (let remote of allRemotes) {\n remote.fillServerCapabilities(capabilities);\n }\n return result;\n });\n }\n else {\n let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } };\n for (let remote of allRemotes) {\n remote.fillServerCapabilities(result.capabilities);\n }\n return result;\n }\n });\n connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => {\n watchDog.shutdownReceived = true;\n if (shutdownHandler) {\n return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token);\n }\n else {\n return undefined;\n }\n });\n connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => {\n try {\n if (exitHandler) {\n exitHandler();\n }\n }\n finally {\n if (watchDog.shutdownReceived) {\n watchDog.exit(0);\n }\n else {\n watchDog.exit(1);\n }\n }\n });\n connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => {\n tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value);\n });\n return protocolConnection;\n}\nexports.createConnection = createConnection;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveModulePath = exports.FileSystem = exports.resolveGlobalYarnPath = exports.resolveGlobalNodePath = exports.resolve = exports.uriToFilePath = void 0;\nconst url = require(\"url\");\nconst path = require(\"path\");\nconst fs = require(\"fs\");\nconst child_process_1 = require(\"child_process\");\n/**\n * @deprecated Use the `vscode-uri` npm module which provides a more\n * complete implementation of handling VS Code URIs.\n */\nfunction uriToFilePath(uri) {\n let parsed = url.parse(uri);\n if (parsed.protocol !== 'file:' || !parsed.path) {\n return undefined;\n }\n let segments = parsed.path.split('/');\n for (var i = 0, len = segments.length; i < len; i++) {\n segments[i] = decodeURIComponent(segments[i]);\n }\n if (process.platform === 'win32' && segments.length > 1) {\n let first = segments[0];\n let second = segments[1];\n // Do we have a drive letter and we started with a / which is the\n // case if the first segement is empty (see split above)\n if (first.length === 0 && second.length > 1 && second[1] === ':') {\n // Remove first slash\n segments.shift();\n }\n }\n return path.normalize(segments.join('/'));\n}\nexports.uriToFilePath = uriToFilePath;\nfunction isWindows() {\n return process.platform === 'win32';\n}\nfunction resolve(moduleName, nodePath, cwd, tracer) {\n const nodePathKey = 'NODE_PATH';\n const app = [\n 'var p = process;',\n 'p.on(\\'message\\',function(m){',\n 'if(m.c===\\'e\\'){',\n 'p.exit(0);',\n '}',\n 'else if(m.c===\\'rs\\'){',\n 'try{',\n 'var r=require.resolve(m.a);',\n 'p.send({c:\\'r\\',s:true,r:r});',\n '}',\n 'catch(err){',\n 'p.send({c:\\'r\\',s:false});',\n '}',\n '}',\n '});'\n ].join('');\n return new Promise((resolve, reject) => {\n let env = process.env;\n let newEnv = Object.create(null);\n Object.keys(env).forEach(key => newEnv[key] = env[key]);\n if (nodePath && fs.existsSync(nodePath) /* see issue 545 */) {\n if (newEnv[nodePathKey]) {\n newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey];\n }\n else {\n newEnv[nodePathKey] = nodePath;\n }\n if (tracer) {\n tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`);\n }\n }\n newEnv['ELECTRON_RUN_AS_NODE'] = '1';\n try {\n let cp = (0, child_process_1.fork)('', [], {\n cwd: cwd,\n env: newEnv,\n execArgv: ['-e', app]\n });\n if (cp.pid === void 0) {\n reject(new Error(`Starting process to resolve node module ${moduleName} failed`));\n return;\n }\n cp.on('error', (error) => {\n reject(error);\n });\n cp.on('message', (message) => {\n if (message.c === 'r') {\n cp.send({ c: 'e' });\n if (message.s) {\n resolve(message.r);\n }\n else {\n reject(new Error(`Failed to resolve module: ${moduleName}`));\n }\n }\n });\n let message = {\n c: 'rs',\n a: moduleName\n };\n cp.send(message);\n }\n catch (error) {\n reject(error);\n }\n });\n}\nexports.resolve = resolve;\n/**\n * Resolve the global npm package path.\n * @deprecated Since this depends on the used package manager and their version the best is that servers\n * implement this themselves since they know best what kind of package managers to support.\n * @param tracer the tracer to use\n */\nfunction resolveGlobalNodePath(tracer) {\n let npmCommand = 'npm';\n const env = Object.create(null);\n Object.keys(process.env).forEach(key => env[key] = process.env[key]);\n env['NO_UPDATE_NOTIFIER'] = 'true';\n const options = {\n encoding: 'utf8',\n env\n };\n if (isWindows()) {\n npmCommand = 'npm.cmd';\n options.shell = true;\n }\n let handler = () => { };\n try {\n process.on('SIGPIPE', handler);\n let stdout = (0, child_process_1.spawnSync)(npmCommand, ['config', 'get', 'prefix'], options).stdout;\n if (!stdout) {\n if (tracer) {\n tracer(`'npm config get prefix' didn't return a value.`);\n }\n return undefined;\n }\n let prefix = stdout.trim();\n if (tracer) {\n tracer(`'npm config get prefix' value is: ${prefix}`);\n }\n if (prefix.length > 0) {\n if (isWindows()) {\n return path.join(prefix, 'node_modules');\n }\n else {\n return path.join(prefix, 'lib', 'node_modules');\n }\n }\n return undefined;\n }\n catch (err) {\n return undefined;\n }\n finally {\n process.removeListener('SIGPIPE', handler);\n }\n}\nexports.resolveGlobalNodePath = resolveGlobalNodePath;\n/*\n * Resolve the global yarn pakage path.\n * @deprecated Since this depends on the used package manager and their version the best is that servers\n * implement this themselves since they know best what kind of package managers to support.\n * @param tracer the tracer to use\n */\nfunction resolveGlobalYarnPath(tracer) {\n let yarnCommand = 'yarn';\n let options = {\n encoding: 'utf8'\n };\n if (isWindows()) {\n yarnCommand = 'yarn.cmd';\n options.shell = true;\n }\n let handler = () => { };\n try {\n process.on('SIGPIPE', handler);\n let results = (0, child_process_1.spawnSync)(yarnCommand, ['global', 'dir', '--json'], options);\n let stdout = results.stdout;\n if (!stdout) {\n if (tracer) {\n tracer(`'yarn global dir' didn't return a value.`);\n if (results.stderr) {\n tracer(results.stderr);\n }\n }\n return undefined;\n }\n let lines = stdout.trim().split(/\\r?\\n/);\n for (let line of lines) {\n try {\n let yarn = JSON.parse(line);\n if (yarn.type === 'log') {\n return path.join(yarn.data, 'node_modules');\n }\n }\n catch (e) {\n // Do nothing. Ignore the line\n }\n }\n return undefined;\n }\n catch (err) {\n return undefined;\n }\n finally {\n process.removeListener('SIGPIPE', handler);\n }\n}\nexports.resolveGlobalYarnPath = resolveGlobalYarnPath;\nvar FileSystem;\n(function (FileSystem) {\n let _isCaseSensitive = undefined;\n function isCaseSensitive() {\n if (_isCaseSensitive !== void 0) {\n return _isCaseSensitive;\n }\n if (process.platform === 'win32') {\n _isCaseSensitive = false;\n }\n else {\n // convert current file name to upper case / lower case and check if file exists\n // (guards against cases when name is already all uppercase or lowercase)\n _isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase());\n }\n return _isCaseSensitive;\n }\n FileSystem.isCaseSensitive = isCaseSensitive;\n function isParent(parent, child) {\n if (isCaseSensitive()) {\n return path.normalize(child).indexOf(path.normalize(parent)) === 0;\n }\n else {\n return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0;\n }\n }\n FileSystem.isParent = isParent;\n})(FileSystem || (exports.FileSystem = FileSystem = {}));\nfunction resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {\n if (nodePath) {\n if (!path.isAbsolute(nodePath)) {\n nodePath = path.join(workspaceRoot, nodePath);\n }\n return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {\n if (FileSystem.isParent(nodePath, value)) {\n return value;\n }\n else {\n return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));\n }\n }).then(undefined, (_error) => {\n return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);\n });\n }\n else {\n return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);\n }\n}\nexports.resolveModulePath = resolveModulePath;\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ----------------------------------------------------------------------------------------- */\n'use strict';\n\nmodule.exports = require('./lib/node/main');", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InlineCompletionFeature = void 0;\nconst vscode_languageserver_protocol_1 = require(\"vscode-languageserver-protocol\");\nconst InlineCompletionFeature = (Base) => {\n return class extends Base {\n get inlineCompletion() {\n return {\n on: (handler) => {\n return this.connection.onRequest(vscode_languageserver_protocol_1.InlineCompletionRequest.type, (params, cancel) => {\n return handler(params, cancel, this.attachWorkDoneProgress(params));\n });\n }\n };\n }\n };\n};\nexports.InlineCompletionFeature = InlineCompletionFeature;\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ProposedFeatures = exports.NotebookDocuments = exports.TextDocuments = exports.SemanticTokensBuilder = void 0;\nconst semanticTokens_1 = require(\"./semanticTokens\");\nObject.defineProperty(exports, \"SemanticTokensBuilder\", { enumerable: true, get: function () { return semanticTokens_1.SemanticTokensBuilder; } });\nconst ic = require(\"./inlineCompletion.proposed\");\n__exportStar(require(\"vscode-languageserver-protocol/\"), exports);\nconst textDocuments_1 = require(\"./textDocuments\");\nObject.defineProperty(exports, \"TextDocuments\", { enumerable: true, get: function () { return textDocuments_1.TextDocuments; } });\nconst notebook_1 = require(\"./notebook\");\nObject.defineProperty(exports, \"NotebookDocuments\", { enumerable: true, get: function () { return notebook_1.NotebookDocuments; } });\n__exportStar(require(\"./server\"), exports);\nvar ProposedFeatures;\n(function (ProposedFeatures) {\n ProposedFeatures.all = {\n __brand: 'features',\n languages: ic.InlineCompletionFeature\n };\n})(ProposedFeatures || (exports.ProposedFeatures = ProposedFeatures = {}));\n", "\"use strict\";\n/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n/// \nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createConnection = exports.Files = void 0;\nconst node_util_1 = require(\"node:util\");\nconst Is = require(\"../common/utils/is\");\nconst server_1 = require(\"../common/server\");\nconst fm = require(\"./files\");\nconst node_1 = require(\"vscode-languageserver-protocol/node\");\n__exportStar(require(\"vscode-languageserver-protocol/node\"), exports);\n__exportStar(require(\"../common/api\"), exports);\nvar Files;\n(function (Files) {\n Files.uriToFilePath = fm.uriToFilePath;\n Files.resolveGlobalNodePath = fm.resolveGlobalNodePath;\n Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;\n Files.resolve = fm.resolve;\n Files.resolveModulePath = fm.resolveModulePath;\n})(Files || (exports.Files = Files = {}));\nlet _protocolConnection;\nfunction endProtocolConnection() {\n if (_protocolConnection === undefined) {\n return;\n }\n try {\n _protocolConnection.end();\n }\n catch (_err) {\n // Ignore. The client process could have already\n // did and we can't send an end into the connection.\n }\n}\nlet _shutdownReceived = false;\nlet exitTimer = undefined;\nfunction setupExitTimer() {\n const argName = '--clientProcessId';\n function runTimer(value) {\n try {\n let processId = parseInt(value);\n if (!isNaN(processId)) {\n exitTimer = setInterval(() => {\n try {\n process.kill(processId, 0);\n }\n catch (ex) {\n // Parent process doesn't exist anymore. Exit the server.\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n }\n }, 3000);\n }\n }\n catch (e) {\n // Ignore errors;\n }\n }\n for (let i = 2; i < process.argv.length; i++) {\n let arg = process.argv[i];\n if (arg === argName && i + 1 < process.argv.length) {\n runTimer(process.argv[i + 1]);\n return;\n }\n else {\n let args = arg.split('=');\n if (args[0] === argName) {\n runTimer(args[1]);\n }\n }\n }\n}\nsetupExitTimer();\nconst watchDog = {\n initialize: (params) => {\n const processId = params.processId;\n if (Is.number(processId) && exitTimer === undefined) {\n // We received a parent process id. Set up a timer to periodically check\n // if the parent is still alive.\n setInterval(() => {\n try {\n process.kill(processId, 0);\n }\n catch (ex) {\n // Parent process doesn't exist anymore. Exit the server.\n process.exit(_shutdownReceived ? 0 : 1);\n }\n }, 3000);\n }\n },\n get shutdownReceived() {\n return _shutdownReceived;\n },\n set shutdownReceived(value) {\n _shutdownReceived = value;\n },\n exit: (code) => {\n endProtocolConnection();\n process.exit(code);\n }\n};\nfunction createConnection(arg1, arg2, arg3, arg4) {\n let factories;\n let input;\n let output;\n let options;\n if (arg1 !== void 0 && arg1.__brand === 'features') {\n factories = arg1;\n arg1 = arg2;\n arg2 = arg3;\n arg3 = arg4;\n }\n if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) {\n options = arg1;\n }\n else {\n input = arg1;\n output = arg2;\n options = arg3;\n }\n return _createConnection(input, output, options, factories);\n}\nexports.createConnection = createConnection;\nfunction _createConnection(input, output, options, factories) {\n let stdio = false;\n if (!input && !output && process.argv.length > 2) {\n let port = void 0;\n let pipeName = void 0;\n let argv = process.argv.slice(2);\n for (let i = 0; i < argv.length; i++) {\n let arg = argv[i];\n if (arg === '--node-ipc') {\n input = new node_1.IPCMessageReader(process);\n output = new node_1.IPCMessageWriter(process);\n break;\n }\n else if (arg === '--stdio') {\n stdio = true;\n input = process.stdin;\n output = process.stdout;\n break;\n }\n else if (arg === '--socket') {\n port = parseInt(argv[i + 1]);\n break;\n }\n else if (arg === '--pipe') {\n pipeName = argv[i + 1];\n break;\n }\n else {\n var args = arg.split('=');\n if (args[0] === '--socket') {\n port = parseInt(args[1]);\n break;\n }\n else if (args[0] === '--pipe') {\n pipeName = args[1];\n break;\n }\n }\n }\n if (port) {\n let transport = (0, node_1.createServerSocketTransport)(port);\n input = transport[0];\n output = transport[1];\n }\n else if (pipeName) {\n let transport = (0, node_1.createServerPipeTransport)(pipeName);\n input = transport[0];\n output = transport[1];\n }\n }\n var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \\'--node-ipc\\', \\'--stdio\\' or \\'--socket={number}\\'';\n if (!input) {\n throw new Error('Connection input stream is not set. ' + commandLineMessage);\n }\n if (!output) {\n throw new Error('Connection output stream is not set. ' + commandLineMessage);\n }\n // Backwards compatibility\n if (Is.func(input.read) && Is.func(input.on)) {\n let inputStream = input;\n inputStream.on('end', () => {\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n });\n inputStream.on('close', () => {\n endProtocolConnection();\n process.exit(_shutdownReceived ? 0 : 1);\n });\n }\n const connectionFactory = (logger) => {\n const result = (0, node_1.createProtocolConnection)(input, output, logger, options);\n if (stdio) {\n patchConsole(logger);\n }\n return result;\n };\n return (0, server_1.createConnection)(connectionFactory, watchDog, factories);\n}\nfunction patchConsole(logger) {\n function serialize(args) {\n return args.map(arg => typeof arg === 'string' ? arg : (0, node_util_1.inspect)(arg)).join(' ');\n }\n const counters = new Map();\n console.assert = function assert(assertion, ...args) {\n if (assertion) {\n return;\n }\n if (args.length === 0) {\n logger.error('Assertion failed');\n }\n else {\n const [message, ...rest] = args;\n logger.error(`Assertion failed: ${message} ${serialize(rest)}`);\n }\n };\n console.count = function count(label = 'default') {\n const message = String(label);\n let counter = counters.get(message) ?? 0;\n counter += 1;\n counters.set(message, counter);\n logger.log(`${message}: ${message}`);\n };\n console.countReset = function countReset(label) {\n if (label === undefined) {\n counters.clear();\n }\n else {\n counters.delete(String(label));\n }\n };\n console.debug = function debug(...args) {\n logger.log(serialize(args));\n };\n console.dir = function dir(arg, options) {\n // @ts-expect-error https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66626\n logger.log((0, node_util_1.inspect)(arg, options));\n };\n console.log = function log(...args) {\n logger.log(serialize(args));\n };\n console.error = function error(...args) {\n logger.error(serialize(args));\n };\n console.trace = function trace(...args) {\n const stack = new Error().stack.replace(/(.+\\n){2}/, '');\n let message = 'Trace';\n if (args.length !== 0) {\n message += `: ${serialize(args)}`;\n }\n logger.log(`${message}\\n${stack}`);\n };\n console.warn = function warn(...args) {\n logger.warn(serialize(args));\n };\n}\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ----------------------------------------------------------------------------------------- */\n'use strict';\n\nmodule.exports = require('./lib/node/main');", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CompletionItem, CompletionParams, TextEdit } from 'vscode-languageserver-protocol';\nimport type { LangiumCompletionParser } from '../../parser/langium-parser.js';\nimport type { NameProvider } from '../../references/name-provider.js';\nimport type { ScopeProvider } from '../../references/scope-provider.js';\nimport type { LangiumServices } from '../lsp-services.js';\nimport type { AstNode, AstNodeDescription, AstReflection, CstNode, ReferenceInfo } from '../../syntax-tree.js';\nimport type { CancellationToken } from '../../utils/cancellation.js';\nimport type { MaybePromise } from '../../utils/promise-utils.js';\nimport type { LangiumDocument, TextDocument } from '../../workspace/documents.js';\nimport type { NextFeature } from './follow-element-computation.js';\nimport type { NodeKindProvider } from '../node-kind-provider.js';\nimport type { FuzzyMatcher } from '../fuzzy-matcher.js';\nimport type { GrammarConfig } from '../../languages/grammar-config.js';\nimport type { Lexer } from '../../parser/lexer.js';\nimport type { IToken } from 'chevrotain';\nimport { CompletionItemKind, CompletionList, Position } from 'vscode-languageserver';\nimport * as ast from '../../languages/generated/ast.js';\nimport { assignMandatoryProperties, getContainerOfType } from '../../utils/ast-utils.js';\nimport { findDeclarationNodeAtOffset, findLeafNodeBeforeOffset } from '../../utils/cst-utils.js';\nimport { getEntryRule, getExplicitRuleType } from '../../utils/grammar-utils.js';\nimport { stream, type Stream } from '../../utils/stream.js';\nimport { findFirstFeatures, findNextFeatures } from './follow-element-computation.js';\n\nexport type CompletionAcceptor = (context: CompletionContext, value: CompletionValueItem) => void\n\nexport type CompletionValueItem = ({\n label?: string\n} | {\n node: AstNode\n} | {\n nodeDescription: AstNodeDescription\n}) & Partial;\n\nexport interface CompletionContext {\n node?: AstNode\n document: LangiumDocument\n textDocument: TextDocument\n features: NextFeature[]\n /**\n * Index at the start of the token related to this context.\n * If the context performs completion for a token that doesn't exist yet, it is equal to the `offset`.\n */\n tokenOffset: number\n /**\n * Index at the end of the token related to this context, even if it is behind the cursor position.\n * Points at the first character after the last token.\n * If the context performs completion for a token that doesn't exist yet, it is equal to the `offset`.\n */\n tokenEndOffset: number\n /**\n * Index of the requested completed position.\n */\n offset: number\n position: Position\n}\n\nexport interface CompletionProviderOptions {\n /**\n * Most tools trigger completion request automatically without explicitly requesting\n * it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user\n * starts to type an identifier. For example if the user types `c` in a JavaScript file\n * code complete will automatically pop up present `console` besides others as a\n * completion item. Characters that make up identifiers don't need to be listed here.\n *\n * If code complete should automatically be trigger on characters not being valid inside\n * an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.\n */\n triggerCharacters?: string[];\n /**\n * The list of all possible characters that commit a completion. This field can be used\n * if clients don't support individual commit characters per completion item.\n *\n * If a server provides both `allCommitCharacters` and commit characters on an individual\n * completion item the ones on the completion item win.\n */\n allCommitCharacters?: string[];\n}\n\nexport interface CompletionBacktrackingInformation {\n previousTokenStart?: number;\n previousTokenEnd?: number;\n nextTokenStart: number;\n nextTokenEnd: number;\n}\n\nexport function mergeCompletionProviderOptions(options: Array): CompletionProviderOptions {\n const triggerCharacters = Array.from(new Set(options.flatMap(option => option?.triggerCharacters ?? [])));\n const allCommitCharacters = Array.from(new Set(options.flatMap(option => option?.allCommitCharacters ?? [])));\n return {\n triggerCharacters: triggerCharacters.length > 0 ? triggerCharacters : undefined,\n allCommitCharacters: allCommitCharacters.length > 0 ? allCommitCharacters : undefined\n };\n}\n\n/**\n * Language-specific service for handling completion requests.\n */\nexport interface CompletionProvider {\n /**\n * Handle a completion request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getCompletion(document: LangiumDocument, params: CompletionParams, cancelToken?: CancellationToken): MaybePromise\n /**\n * Contains the completion options for this completion provider.\n *\n * If multiple languages return different options, they are merged before being sent to the language client.\n */\n readonly completionOptions?: CompletionProviderOptions;\n}\n\nexport class DefaultCompletionProvider implements CompletionProvider {\n\n protected readonly completionParser: LangiumCompletionParser;\n protected readonly scopeProvider: ScopeProvider;\n protected readonly grammar: ast.Grammar;\n protected readonly nameProvider: NameProvider;\n protected readonly lexer: Lexer;\n protected readonly nodeKindProvider: NodeKindProvider;\n protected readonly fuzzyMatcher: FuzzyMatcher;\n protected readonly grammarConfig: GrammarConfig;\n protected readonly astReflection: AstReflection;\n\n constructor(services: LangiumServices) {\n this.scopeProvider = services.references.ScopeProvider;\n this.grammar = services.Grammar;\n this.completionParser = services.parser.CompletionParser;\n this.nameProvider = services.references.NameProvider;\n this.lexer = services.parser.Lexer;\n this.nodeKindProvider = services.shared.lsp.NodeKindProvider;\n this.fuzzyMatcher = services.shared.lsp.FuzzyMatcher;\n this.grammarConfig = services.parser.GrammarConfig;\n this.astReflection = services.shared.AstReflection;\n }\n\n async getCompletion(document: LangiumDocument, params: CompletionParams): Promise {\n const items: CompletionItem[] = [];\n const contexts = this.buildContexts(document, params.position);\n\n const acceptor: CompletionAcceptor = (context, value) => {\n const completionItem = this.fillCompletionItem(context, value);\n if (completionItem) {\n items.push(completionItem);\n }\n };\n\n const distinctionFunction = (element: NextFeature) => {\n if (ast.isKeyword(element.feature)) {\n return element.feature.value;\n } else {\n return element.feature;\n }\n };\n\n const completedFeatures: NextFeature[] = [];\n for (const context of contexts) {\n await Promise.all(\n stream(context.features)\n .distinct(distinctionFunction)\n .exclude(completedFeatures)\n .map(e => this.completionFor(context, e, acceptor))\n );\n // Do not try to complete the same feature multiple times\n completedFeatures.push(...context.features);\n // We might want to stop computing completion results\n if (!this.continueCompletion(items)) {\n break;\n }\n }\n\n return CompletionList.create(this.deduplicateItems(items), true);\n }\n\n /**\n * The completion algorithm could yield the same reference/keyword multiple times.\n *\n * This methods deduplicates these items afterwards before returning to the client.\n * Unique items are identified as a combination of `kind`, `label` and `detail`.\n */\n protected deduplicateItems(items: CompletionItem[]): CompletionItem[] {\n return stream(items).distinct(item => `${item.kind}_${item.label}_${item.detail}`).toArray();\n }\n\n protected findFeaturesAt(document: TextDocument, offset: number): NextFeature[] {\n const text = document.getText({\n start: Position.create(0, 0),\n end: document.positionAt(offset)\n });\n const parserResult = this.completionParser.parse(text);\n const tokens = parserResult.tokens;\n // If the parser didn't parse any tokens, return the next features of the entry rule\n if (parserResult.tokenIndex === 0) {\n const parserRule = getEntryRule(this.grammar)!;\n const firstFeatures = findFirstFeatures({\n feature: parserRule.definition,\n type: getExplicitRuleType(parserRule)\n });\n if (tokens.length > 0) {\n // We have to skip the first token\n // The interpreter will only look at the next features, which requires every token after the first\n tokens.shift();\n return findNextFeatures(firstFeatures.map(e => [e]), tokens);\n } else {\n return firstFeatures;\n }\n }\n const leftoverTokens = [...tokens].splice(parserResult.tokenIndex);\n const features = findNextFeatures([parserResult.elementStack.map(feature => ({ feature }))], leftoverTokens);\n return features;\n }\n\n protected *buildContexts(document: LangiumDocument, position: Position): IterableIterator {\n const cst = document.parseResult.value.$cstNode;\n if (!cst) {\n return;\n }\n const textDocument = document.textDocument;\n const text = textDocument.getText();\n const offset = textDocument.offsetAt(position);\n const partialContext = {\n document,\n textDocument,\n offset,\n position\n };\n // Data type rules need special handling, as their tokens are irrelevant for completion purposes.\n // If we encounter a data type rule at the current offset, we jump to the start of the data type rule.\n const dataTypeRuleOffsets = this.findDataTypeRuleStart(cst, offset);\n if (dataTypeRuleOffsets) {\n const [ruleStart, ruleEnd] = dataTypeRuleOffsets;\n const parentNode = findLeafNodeBeforeOffset(cst, ruleStart)?.astNode;\n yield {\n ...partialContext,\n node: parentNode,\n tokenOffset: ruleStart,\n tokenEndOffset: ruleEnd,\n features: this.findFeaturesAt(textDocument, ruleStart),\n };\n }\n // For all other purposes, it's enough to jump to the start of the current/previous token\n const { nextTokenStart, nextTokenEnd, previousTokenStart, previousTokenEnd } = this.backtrackToAnyToken(text, offset);\n let astNodeOffset = nextTokenStart;\n if (offset <= nextTokenStart && previousTokenStart !== undefined) {\n // This check indicates that the cursor is still before the next token, so we should use the previous AST node (if it exists)\n astNodeOffset = previousTokenStart;\n }\n const astNode = findLeafNodeBeforeOffset(cst, astNodeOffset)?.astNode;\n let performNextCompletion = true;\n if (previousTokenStart !== undefined && previousTokenEnd !== undefined && previousTokenEnd === offset) {\n // This context aims to complete the current feature\n yield {\n ...partialContext,\n node: astNode,\n tokenOffset: previousTokenStart,\n tokenEndOffset: previousTokenEnd,\n features: this.findFeaturesAt(textDocument, previousTokenStart),\n };\n // The completion after the current token should be prevented in case we find out that the current token definitely isn't completed yet\n // This is usually the case when the current token ends on a letter.\n performNextCompletion = this.performNextTokenCompletion(\n document,\n text.substring(previousTokenStart, previousTokenEnd),\n previousTokenStart,\n previousTokenEnd\n );\n if (performNextCompletion) {\n // This context aims to complete the immediate next feature (if one exists at the current cursor position)\n // It uses the previous cst start/offset for that.\n yield {\n ...partialContext,\n node: astNode,\n tokenOffset: previousTokenEnd,\n tokenEndOffset: previousTokenEnd,\n features: this.findFeaturesAt(textDocument, previousTokenEnd),\n };\n }\n }\n\n if (!astNode) {\n const parserRule = getEntryRule(this.grammar);\n if (!parserRule) {\n throw new Error('Missing entry parser rule');\n }\n // This context aims to perform completion for the grammar start (usually when the document is empty)\n yield {\n ...partialContext,\n tokenOffset: nextTokenStart,\n tokenEndOffset: nextTokenEnd,\n features: findFirstFeatures(parserRule.definition)\n };\n } else if (performNextCompletion) {\n // This context aims to complete the next feature, using the next cst start/end\n yield {\n ...partialContext,\n node: astNode,\n tokenOffset: nextTokenStart,\n tokenEndOffset: nextTokenEnd,\n features: this.findFeaturesAt(textDocument, nextTokenStart),\n };\n }\n }\n\n protected performNextTokenCompletion(document: LangiumDocument, text: string, _offset: number, _end: number): boolean {\n // This regex returns false if the text ends with a letter.\n // We don't want to complete new text immediately after a keyword, ID etc.\n // We only care about the last character in the text, so we use $ here.\n // The \\P{L} used here is a Unicode category that matches any character that is not a letter\n return /\\P{L}$/u.test(text);\n }\n\n protected findDataTypeRuleStart(cst: CstNode, offset: number): [number, number] | undefined {\n let containerNode: CstNode | undefined = findDeclarationNodeAtOffset(cst, offset, this.grammarConfig.nameRegexp);\n // Identify whether the element was parsed as part of a data type rule\n let isDataTypeNode = Boolean(getContainerOfType(containerNode?.grammarSource, ast.isParserRule)?.dataType);\n if (isDataTypeNode) {\n while (isDataTypeNode) {\n // Use the container to find the correct parent element\n containerNode = containerNode?.container;\n isDataTypeNode = Boolean(getContainerOfType(containerNode?.grammarSource, ast.isParserRule)?.dataType);\n }\n if (containerNode) {\n return [containerNode.offset, containerNode.end];\n }\n }\n return undefined;\n }\n\n /**\n * Indicates whether the completion should continue to process the next completion context.\n *\n * The default implementation continues the completion only if there are currently no proposed completion items.\n */\n protected continueCompletion(items: CompletionItem[]): boolean {\n return items.length === 0;\n }\n\n /**\n * This method returns two sets of token offset information.\n *\n * The `nextToken*` offsets are related to the token at the cursor position.\n * If there is none, both offsets are simply set to `offset`.\n *\n * The `previousToken*` offsets are related to the last token before the current token at the cursor position.\n * They are `undefined`, if there is no token before the cursor position.\n */\n protected backtrackToAnyToken(text: string, offset: number): CompletionBacktrackingInformation {\n const tokens = this.lexer.tokenize(text).tokens;\n if (tokens.length === 0) {\n // If we don't have any tokens in our document, just return the offset position\n return {\n nextTokenStart: offset,\n nextTokenEnd: offset\n };\n }\n let previousToken: IToken | undefined;\n for (const token of tokens) {\n if (token.startOffset >= offset) {\n // We are between two tokens\n // Return the current offset as the next token index\n return {\n nextTokenStart: offset,\n nextTokenEnd: offset,\n previousTokenStart: previousToken ? previousToken.startOffset : undefined,\n previousTokenEnd: previousToken ? previousToken.endOffset! + 1 : undefined\n };\n }\n if (token.endOffset! >= offset) {\n // We are within a token\n // Return the current and previous token offsets as normal\n return {\n nextTokenStart: token.startOffset,\n nextTokenEnd: token.endOffset! + 1,\n previousTokenStart: previousToken ? previousToken.startOffset : undefined,\n previousTokenEnd: previousToken ? previousToken.endOffset! + 1 : undefined\n };\n }\n previousToken = token;\n }\n // We have run into the end of the file\n // Return the current offset as the next token index\n return {\n nextTokenStart: offset,\n nextTokenEnd: offset,\n previousTokenStart: previousToken ? previousToken.startOffset : undefined,\n previousTokenEnd: previousToken ? previousToken.endOffset! + 1 : undefined\n };\n }\n\n protected completionFor(context: CompletionContext, next: NextFeature, acceptor: CompletionAcceptor): MaybePromise {\n if (ast.isKeyword(next.feature)) {\n return this.completionForKeyword(context, next.feature, acceptor);\n } else if (ast.isCrossReference(next.feature) && context.node) {\n return this.completionForCrossReference(context, next as NextFeature, acceptor);\n }\n // Don't offer any completion for other elements (i.e. terminals, datatype rules)\n // We - from a framework level - cannot reasonably assume their contents.\n // Adopters can just override `completionFor` if they want to do that anyway.\n }\n\n protected completionForCrossReference(context: CompletionContext, next: NextFeature, acceptor: CompletionAcceptor): MaybePromise {\n const assignment = getContainerOfType(next.feature, ast.isAssignment);\n let node = context.node;\n if (assignment && node) {\n if (next.type) {\n // When `type` is set, it indicates that we have just entered a new parser rule.\n // The cross reference that we're trying to complete is on a new element that doesn't exist yet.\n // So we create a new synthetic element with the correct type information.\n node = {\n $type: next.type,\n $container: node,\n $containerProperty: next.property\n };\n assignMandatoryProperties(this.astReflection, node);\n }\n const refInfo: ReferenceInfo = {\n reference: {\n $refText: ''\n },\n container: node,\n property: assignment.feature\n };\n try {\n this.getReferenceCandidates(refInfo, context).forEach(\n c => acceptor(context, this.createReferenceCompletionItem(c))\n );\n } catch (err) {\n console.error(err);\n }\n }\n }\n\n /**\n * Override this method to change how the stream of candidates is determined for a reference.\n * This way completion-specific modifications and refinements can be added to the proposals computation\n * beyond the rules being implemented in the scope provider, e.g. filtering.\n *\n * @param refInfo Information about the reference for which the candidates are requested.\n * @param _context Information about the completion request including document, cursor position, token under cursor, etc.\n * @returns A stream of all elements being valid for the given reference.\n */\n protected getReferenceCandidates(refInfo: ReferenceInfo, _context: CompletionContext): Stream {\n return this.scopeProvider.getScope(refInfo).getAllElements();\n }\n\n /**\n * Override this method to change how reference completion items are created.\n * To change the `kind` of a completion item, override the `NodeKindProvider` service instead.\n *\n * @param nodeDescription The description of a reference candidate\n * @returns A partial completion item\n */\n protected createReferenceCompletionItem(nodeDescription: AstNodeDescription): CompletionValueItem {\n return {\n nodeDescription,\n kind: this.nodeKindProvider.getCompletionItemKind(nodeDescription),\n detail: nodeDescription.type,\n sortText: '0'\n };\n }\n\n protected completionForKeyword(context: CompletionContext, keyword: ast.Keyword, acceptor: CompletionAcceptor): MaybePromise {\n if (!this.filterKeyword(context, keyword)) {\n return;\n }\n acceptor(context, {\n label: keyword.value,\n kind: CompletionItemKind.Keyword,\n detail: 'Keyword',\n sortText: '1'\n });\n }\n\n protected filterKeyword(context: CompletionContext, keyword: ast.Keyword): boolean {\n // Filter out keywords that do not contain any word character\n return /\\p{L}/u.test(keyword.value);\n }\n\n protected fillCompletionItem(context: CompletionContext, item: CompletionValueItem): CompletionItem | undefined {\n let label: string;\n if (typeof item.label === 'string') {\n label = item.label;\n } else if ('node' in item) {\n const name = this.nameProvider.getName(item.node);\n if (!name) {\n return undefined;\n }\n label = name;\n } else if ('nodeDescription' in item) {\n label = item.nodeDescription.name;\n } else {\n return undefined;\n }\n let insertText: string;\n if (typeof item.textEdit?.newText === 'string') {\n insertText = item.textEdit.newText;\n } else if (typeof item.insertText === 'string') {\n insertText = item.insertText;\n } else {\n insertText = label;\n }\n const textEdit = item.textEdit ?? this.buildCompletionTextEdit(context, label, insertText);\n if (!textEdit) {\n return undefined;\n }\n // Copy all valid properties of `CompletionItem`\n const completionItem: CompletionItem = {\n additionalTextEdits: item.additionalTextEdits,\n command: item.command,\n commitCharacters: item.commitCharacters,\n data: item.data,\n detail: item.detail,\n documentation: item.documentation,\n filterText: item.filterText,\n insertText: item.insertText,\n insertTextFormat: item.insertTextFormat,\n insertTextMode: item.insertTextMode,\n kind: item.kind,\n labelDetails: item.labelDetails,\n preselect: item.preselect,\n sortText: item.sortText,\n tags: item.tags,\n textEditText: item.textEditText,\n textEdit,\n label\n };\n return completionItem;\n }\n\n protected buildCompletionTextEdit(context: CompletionContext, label: string, newText: string): TextEdit | undefined {\n const content = context.textDocument.getText();\n const identifier = content.substring(context.tokenOffset, context.offset);\n if (this.fuzzyMatcher.match(identifier, label)) {\n const start = context.textDocument.positionAt(context.tokenOffset);\n const end = context.position;\n return {\n newText,\n range: {\n start,\n end\n }\n };\n } else {\n return undefined;\n }\n }\n}\n", "/******************************************************************************\n * This file was generated by langium-cli 3.0.0.\n * DO NOT EDIT MANUALLY!\n ******************************************************************************/\n\n/* eslint-disable */\nimport type { AstNode, Reference, ReferenceInfo, TypeMetaData } from '../../syntax-tree.js';\nimport { AbstractAstReflection } from '../../syntax-tree.js';\n\nexport const LangiumGrammarTerminals = {\n ID: /\\^?[_a-zA-Z][\\w_]*/,\n STRING: /\"(\\\\.|[^\"\\\\])*\"|'(\\\\.|[^'\\\\])*'/,\n NUMBER: /NaN|-?((\\d*\\.\\d+|\\d+)([Ee][+-]?\\d+)?|Infinity)/,\n RegexLiteral: /\\/(?![*+?])(?:[^\\r\\n\\[/\\\\]|\\\\.|\\[(?:[^\\r\\n\\]\\\\]|\\\\.)*\\])+\\/[a-z]*/,\n WS: /\\s+/,\n ML_COMMENT: /\\/\\*[\\s\\S]*?\\*\\//,\n SL_COMMENT: /\\/\\/[^\\n\\r]*/,\n};\n\nexport type AbstractRule = ParserRule | TerminalRule;\n\nexport const AbstractRule = 'AbstractRule';\n\nexport function isAbstractRule(item: unknown): item is AbstractRule {\n return reflection.isInstance(item, AbstractRule);\n}\n\nexport type AbstractType = InferredType | Interface | ParserRule | Type;\n\nexport const AbstractType = 'AbstractType';\n\nexport function isAbstractType(item: unknown): item is AbstractType {\n return reflection.isInstance(item, AbstractType);\n}\n\nexport type Condition = BooleanLiteral | Conjunction | Disjunction | Negation | ParameterReference;\n\nexport const Condition = 'Condition';\n\nexport function isCondition(item: unknown): item is Condition {\n return reflection.isInstance(item, Condition);\n}\n\nexport type FeatureName = 'current' | 'entry' | 'extends' | 'false' | 'fragment' | 'grammar' | 'hidden' | 'import' | 'infer' | 'infers' | 'interface' | 'returns' | 'terminal' | 'true' | 'type' | 'with' | PrimitiveType | string;\n\nexport function isFeatureName(item: unknown): item is FeatureName {\n return isPrimitiveType(item) || item === 'current' || item === 'entry' || item === 'extends' || item === 'false' || item === 'fragment' || item === 'grammar' || item === 'hidden' || item === 'import' || item === 'interface' || item === 'returns' || item === 'terminal' || item === 'true' || item === 'type' || item === 'infer' || item === 'infers' || item === 'with' || (typeof item === 'string' && (/\\^?[_a-zA-Z][\\w_]*/.test(item)));\n}\n\nexport type PrimitiveType = 'Date' | 'bigint' | 'boolean' | 'number' | 'string';\n\nexport function isPrimitiveType(item: unknown): item is PrimitiveType {\n return item === 'string' || item === 'number' || item === 'boolean' || item === 'Date' || item === 'bigint';\n}\n\nexport type TypeDefinition = ArrayType | ReferenceType | SimpleType | UnionType;\n\nexport const TypeDefinition = 'TypeDefinition';\n\nexport function isTypeDefinition(item: unknown): item is TypeDefinition {\n return reflection.isInstance(item, TypeDefinition);\n}\n\nexport type ValueLiteral = ArrayLiteral | BooleanLiteral | NumberLiteral | StringLiteral;\n\nexport const ValueLiteral = 'ValueLiteral';\n\nexport function isValueLiteral(item: unknown): item is ValueLiteral {\n return reflection.isInstance(item, ValueLiteral);\n}\n\nexport interface AbstractElement extends AstNode {\n readonly $type: 'AbstractElement' | 'Action' | 'Alternatives' | 'Assignment' | 'CharacterRange' | 'CrossReference' | 'EndOfFile' | 'Group' | 'Keyword' | 'NegatedToken' | 'RegexToken' | 'RuleCall' | 'TerminalAlternatives' | 'TerminalGroup' | 'TerminalRuleCall' | 'UnorderedGroup' | 'UntilToken' | 'Wildcard';\n cardinality?: '*' | '+' | '?';\n lookahead?: '?!' | '?;\n}\n\nexport const ArrayLiteral = 'ArrayLiteral';\n\nexport function isArrayLiteral(item: unknown): item is ArrayLiteral {\n return reflection.isInstance(item, ArrayLiteral);\n}\n\nexport interface ArrayType extends AstNode {\n readonly $container: ArrayType | ReferenceType | Type | TypeAttribute | UnionType;\n readonly $type: 'ArrayType';\n elementType: TypeDefinition;\n}\n\nexport const ArrayType = 'ArrayType';\n\nexport function isArrayType(item: unknown): item is ArrayType {\n return reflection.isInstance(item, ArrayType);\n}\n\nexport interface BooleanLiteral extends AstNode {\n readonly $container: ArrayLiteral | Conjunction | Disjunction | Group | NamedArgument | Negation | TypeAttribute;\n readonly $type: 'BooleanLiteral';\n true: boolean;\n}\n\nexport const BooleanLiteral = 'BooleanLiteral';\n\nexport function isBooleanLiteral(item: unknown): item is BooleanLiteral {\n return reflection.isInstance(item, BooleanLiteral);\n}\n\nexport interface Conjunction extends AstNode {\n readonly $container: Conjunction | Disjunction | Group | NamedArgument | Negation;\n readonly $type: 'Conjunction';\n left: Condition;\n right: Condition;\n}\n\nexport const Conjunction = 'Conjunction';\n\nexport function isConjunction(item: unknown): item is Conjunction {\n return reflection.isInstance(item, Conjunction);\n}\n\nexport interface Disjunction extends AstNode {\n readonly $container: Conjunction | Disjunction | Group | NamedArgument | Negation;\n readonly $type: 'Disjunction';\n left: Condition;\n right: Condition;\n}\n\nexport const Disjunction = 'Disjunction';\n\nexport function isDisjunction(item: unknown): item is Disjunction {\n return reflection.isInstance(item, Disjunction);\n}\n\nexport interface Grammar extends AstNode {\n readonly $type: 'Grammar';\n definesHiddenTokens: boolean;\n hiddenTokens: Array>;\n imports: Array;\n interfaces: Array;\n isDeclared: boolean;\n name?: string;\n rules: Array;\n types: Array;\n usedGrammars: Array>;\n}\n\nexport const Grammar = 'Grammar';\n\nexport function isGrammar(item: unknown): item is Grammar {\n return reflection.isInstance(item, Grammar);\n}\n\nexport interface GrammarImport extends AstNode {\n readonly $container: Grammar;\n readonly $type: 'GrammarImport';\n path: string;\n}\n\nexport const GrammarImport = 'GrammarImport';\n\nexport function isGrammarImport(item: unknown): item is GrammarImport {\n return reflection.isInstance(item, GrammarImport);\n}\n\nexport interface InferredType extends AstNode {\n readonly $container: Action | ParserRule;\n readonly $type: 'InferredType';\n name: string;\n}\n\nexport const InferredType = 'InferredType';\n\nexport function isInferredType(item: unknown): item is InferredType {\n return reflection.isInstance(item, InferredType);\n}\n\nexport interface Interface extends AstNode {\n readonly $container: Grammar;\n readonly $type: 'Interface';\n attributes: Array;\n name: string;\n superTypes: Array>;\n}\n\nexport const Interface = 'Interface';\n\nexport function isInterface(item: unknown): item is Interface {\n return reflection.isInstance(item, Interface);\n}\n\nexport interface NamedArgument extends AstNode {\n readonly $container: RuleCall;\n readonly $type: 'NamedArgument';\n calledByName: boolean;\n parameter?: Reference;\n value: Condition;\n}\n\nexport const NamedArgument = 'NamedArgument';\n\nexport function isNamedArgument(item: unknown): item is NamedArgument {\n return reflection.isInstance(item, NamedArgument);\n}\n\nexport interface Negation extends AstNode {\n readonly $container: Conjunction | Disjunction | Group | NamedArgument | Negation;\n readonly $type: 'Negation';\n value: Condition;\n}\n\nexport const Negation = 'Negation';\n\nexport function isNegation(item: unknown): item is Negation {\n return reflection.isInstance(item, Negation);\n}\n\nexport interface NumberLiteral extends AstNode {\n readonly $container: ArrayLiteral | TypeAttribute;\n readonly $type: 'NumberLiteral';\n value: number;\n}\n\nexport const NumberLiteral = 'NumberLiteral';\n\nexport function isNumberLiteral(item: unknown): item is NumberLiteral {\n return reflection.isInstance(item, NumberLiteral);\n}\n\nexport interface Parameter extends AstNode {\n readonly $container: ParserRule;\n readonly $type: 'Parameter';\n name: string;\n}\n\nexport const Parameter = 'Parameter';\n\nexport function isParameter(item: unknown): item is Parameter {\n return reflection.isInstance(item, Parameter);\n}\n\nexport interface ParameterReference extends AstNode {\n readonly $container: Conjunction | Disjunction | Group | NamedArgument | Negation;\n readonly $type: 'ParameterReference';\n parameter: Reference;\n}\n\nexport const ParameterReference = 'ParameterReference';\n\nexport function isParameterReference(item: unknown): item is ParameterReference {\n return reflection.isInstance(item, ParameterReference);\n}\n\nexport interface ParserRule extends AstNode {\n readonly $container: Grammar;\n readonly $type: 'ParserRule';\n dataType?: PrimitiveType;\n definesHiddenTokens: boolean;\n definition: AbstractElement;\n entry: boolean;\n fragment: boolean;\n hiddenTokens: Array>;\n inferredType?: InferredType;\n name: string;\n parameters: Array;\n returnType?: Reference;\n wildcard: boolean;\n}\n\nexport const ParserRule = 'ParserRule';\n\nexport function isParserRule(item: unknown): item is ParserRule {\n return reflection.isInstance(item, ParserRule);\n}\n\nexport interface ReferenceType extends AstNode {\n readonly $container: ArrayType | ReferenceType | Type | TypeAttribute | UnionType;\n readonly $type: 'ReferenceType';\n referenceType: TypeDefinition;\n}\n\nexport const ReferenceType = 'ReferenceType';\n\nexport function isReferenceType(item: unknown): item is ReferenceType {\n return reflection.isInstance(item, ReferenceType);\n}\n\nexport interface ReturnType extends AstNode {\n readonly $container: TerminalRule;\n readonly $type: 'ReturnType';\n name: PrimitiveType | string;\n}\n\nexport const ReturnType = 'ReturnType';\n\nexport function isReturnType(item: unknown): item is ReturnType {\n return reflection.isInstance(item, ReturnType);\n}\n\nexport interface SimpleType extends AstNode {\n readonly $container: ArrayType | ReferenceType | Type | TypeAttribute | UnionType;\n readonly $type: 'SimpleType';\n primitiveType?: PrimitiveType;\n stringType?: string;\n typeRef?: Reference;\n}\n\nexport const SimpleType = 'SimpleType';\n\nexport function isSimpleType(item: unknown): item is SimpleType {\n return reflection.isInstance(item, SimpleType);\n}\n\nexport interface StringLiteral extends AstNode {\n readonly $container: ArrayLiteral | TypeAttribute;\n readonly $type: 'StringLiteral';\n value: string;\n}\n\nexport const StringLiteral = 'StringLiteral';\n\nexport function isStringLiteral(item: unknown): item is StringLiteral {\n return reflection.isInstance(item, StringLiteral);\n}\n\nexport interface TerminalRule extends AstNode {\n readonly $container: Grammar;\n readonly $type: 'TerminalRule';\n definition: AbstractElement;\n fragment: boolean;\n hidden: boolean;\n name: string;\n type?: ReturnType;\n}\n\nexport const TerminalRule = 'TerminalRule';\n\nexport function isTerminalRule(item: unknown): item is TerminalRule {\n return reflection.isInstance(item, TerminalRule);\n}\n\nexport interface Type extends AstNode {\n readonly $container: Grammar;\n readonly $type: 'Type';\n name: string;\n type: TypeDefinition;\n}\n\nexport const Type = 'Type';\n\nexport function isType(item: unknown): item is Type {\n return reflection.isInstance(item, Type);\n}\n\nexport interface TypeAttribute extends AstNode {\n readonly $container: Interface;\n readonly $type: 'TypeAttribute';\n defaultValue?: ValueLiteral;\n isOptional: boolean;\n name: FeatureName;\n type: TypeDefinition;\n}\n\nexport const TypeAttribute = 'TypeAttribute';\n\nexport function isTypeAttribute(item: unknown): item is TypeAttribute {\n return reflection.isInstance(item, TypeAttribute);\n}\n\nexport interface UnionType extends AstNode {\n readonly $container: ArrayType | ReferenceType | Type | TypeAttribute | UnionType;\n readonly $type: 'UnionType';\n types: Array;\n}\n\nexport const UnionType = 'UnionType';\n\nexport function isUnionType(item: unknown): item is UnionType {\n return reflection.isInstance(item, UnionType);\n}\n\nexport interface Action extends AbstractElement {\n readonly $type: 'Action';\n feature?: FeatureName;\n inferredType?: InferredType;\n operator?: '+=' | '=';\n type?: Reference;\n}\n\nexport const Action = 'Action';\n\nexport function isAction(item: unknown): item is Action {\n return reflection.isInstance(item, Action);\n}\n\nexport interface Alternatives extends AbstractElement {\n readonly $type: 'Alternatives';\n elements: Array;\n}\n\nexport const Alternatives = 'Alternatives';\n\nexport function isAlternatives(item: unknown): item is Alternatives {\n return reflection.isInstance(item, Alternatives);\n}\n\nexport interface Assignment extends AbstractElement {\n readonly $type: 'Assignment';\n feature: FeatureName;\n operator: '+=' | '=' | '?=';\n terminal: AbstractElement;\n}\n\nexport const Assignment = 'Assignment';\n\nexport function isAssignment(item: unknown): item is Assignment {\n return reflection.isInstance(item, Assignment);\n}\n\nexport interface CharacterRange extends AbstractElement {\n readonly $type: 'CharacterRange';\n left: Keyword;\n right?: Keyword;\n}\n\nexport const CharacterRange = 'CharacterRange';\n\nexport function isCharacterRange(item: unknown): item is CharacterRange {\n return reflection.isInstance(item, CharacterRange);\n}\n\nexport interface CrossReference extends AbstractElement {\n readonly $type: 'CrossReference';\n deprecatedSyntax: boolean;\n terminal?: AbstractElement;\n type: Reference;\n}\n\nexport const CrossReference = 'CrossReference';\n\nexport function isCrossReference(item: unknown): item is CrossReference {\n return reflection.isInstance(item, CrossReference);\n}\n\nexport interface EndOfFile extends AbstractElement {\n readonly $type: 'EndOfFile';\n}\n\nexport const EndOfFile = 'EndOfFile';\n\nexport function isEndOfFile(item: unknown): item is EndOfFile {\n return reflection.isInstance(item, EndOfFile);\n}\n\nexport interface Group extends AbstractElement {\n readonly $type: 'Group';\n elements: Array;\n guardCondition?: Condition;\n}\n\nexport const Group = 'Group';\n\nexport function isGroup(item: unknown): item is Group {\n return reflection.isInstance(item, Group);\n}\n\nexport interface Keyword extends AbstractElement {\n readonly $container: CharacterRange;\n readonly $type: 'Keyword';\n value: string;\n}\n\nexport const Keyword = 'Keyword';\n\nexport function isKeyword(item: unknown): item is Keyword {\n return reflection.isInstance(item, Keyword);\n}\n\nexport interface NegatedToken extends AbstractElement {\n readonly $type: 'NegatedToken';\n terminal: AbstractElement;\n}\n\nexport const NegatedToken = 'NegatedToken';\n\nexport function isNegatedToken(item: unknown): item is NegatedToken {\n return reflection.isInstance(item, NegatedToken);\n}\n\nexport interface RegexToken extends AbstractElement {\n readonly $type: 'RegexToken';\n regex: string;\n}\n\nexport const RegexToken = 'RegexToken';\n\nexport function isRegexToken(item: unknown): item is RegexToken {\n return reflection.isInstance(item, RegexToken);\n}\n\nexport interface RuleCall extends AbstractElement {\n readonly $type: 'RuleCall';\n arguments: Array;\n rule: Reference;\n}\n\nexport const RuleCall = 'RuleCall';\n\nexport function isRuleCall(item: unknown): item is RuleCall {\n return reflection.isInstance(item, RuleCall);\n}\n\nexport interface TerminalAlternatives extends AbstractElement {\n readonly $type: 'TerminalAlternatives';\n elements: Array;\n}\n\nexport const TerminalAlternatives = 'TerminalAlternatives';\n\nexport function isTerminalAlternatives(item: unknown): item is TerminalAlternatives {\n return reflection.isInstance(item, TerminalAlternatives);\n}\n\nexport interface TerminalGroup extends AbstractElement {\n readonly $type: 'TerminalGroup';\n elements: Array;\n}\n\nexport const TerminalGroup = 'TerminalGroup';\n\nexport function isTerminalGroup(item: unknown): item is TerminalGroup {\n return reflection.isInstance(item, TerminalGroup);\n}\n\nexport interface TerminalRuleCall extends AbstractElement {\n readonly $type: 'TerminalRuleCall';\n rule: Reference;\n}\n\nexport const TerminalRuleCall = 'TerminalRuleCall';\n\nexport function isTerminalRuleCall(item: unknown): item is TerminalRuleCall {\n return reflection.isInstance(item, TerminalRuleCall);\n}\n\nexport interface UnorderedGroup extends AbstractElement {\n readonly $type: 'UnorderedGroup';\n elements: Array;\n}\n\nexport const UnorderedGroup = 'UnorderedGroup';\n\nexport function isUnorderedGroup(item: unknown): item is UnorderedGroup {\n return reflection.isInstance(item, UnorderedGroup);\n}\n\nexport interface UntilToken extends AbstractElement {\n readonly $type: 'UntilToken';\n terminal: AbstractElement;\n}\n\nexport const UntilToken = 'UntilToken';\n\nexport function isUntilToken(item: unknown): item is UntilToken {\n return reflection.isInstance(item, UntilToken);\n}\n\nexport interface Wildcard extends AbstractElement {\n readonly $type: 'Wildcard';\n}\n\nexport const Wildcard = 'Wildcard';\n\nexport function isWildcard(item: unknown): item is Wildcard {\n return reflection.isInstance(item, Wildcard);\n}\n\nexport type LangiumGrammarAstType = {\n AbstractElement: AbstractElement\n AbstractRule: AbstractRule\n AbstractType: AbstractType\n Action: Action\n Alternatives: Alternatives\n ArrayLiteral: ArrayLiteral\n ArrayType: ArrayType\n Assignment: Assignment\n BooleanLiteral: BooleanLiteral\n CharacterRange: CharacterRange\n Condition: Condition\n Conjunction: Conjunction\n CrossReference: CrossReference\n Disjunction: Disjunction\n EndOfFile: EndOfFile\n Grammar: Grammar\n GrammarImport: GrammarImport\n Group: Group\n InferredType: InferredType\n Interface: Interface\n Keyword: Keyword\n NamedArgument: NamedArgument\n NegatedToken: NegatedToken\n Negation: Negation\n NumberLiteral: NumberLiteral\n Parameter: Parameter\n ParameterReference: ParameterReference\n ParserRule: ParserRule\n ReferenceType: ReferenceType\n RegexToken: RegexToken\n ReturnType: ReturnType\n RuleCall: RuleCall\n SimpleType: SimpleType\n StringLiteral: StringLiteral\n TerminalAlternatives: TerminalAlternatives\n TerminalGroup: TerminalGroup\n TerminalRule: TerminalRule\n TerminalRuleCall: TerminalRuleCall\n Type: Type\n TypeAttribute: TypeAttribute\n TypeDefinition: TypeDefinition\n UnionType: UnionType\n UnorderedGroup: UnorderedGroup\n UntilToken: UntilToken\n ValueLiteral: ValueLiteral\n Wildcard: Wildcard\n}\n\nexport class LangiumGrammarAstReflection extends AbstractAstReflection {\n\n getAllTypes(): string[] {\n return ['AbstractElement', 'AbstractRule', 'AbstractType', 'Action', 'Alternatives', 'ArrayLiteral', 'ArrayType', 'Assignment', 'BooleanLiteral', 'CharacterRange', 'Condition', 'Conjunction', 'CrossReference', 'Disjunction', 'EndOfFile', 'Grammar', 'GrammarImport', 'Group', 'InferredType', 'Interface', 'Keyword', 'NamedArgument', 'NegatedToken', 'Negation', 'NumberLiteral', 'Parameter', 'ParameterReference', 'ParserRule', 'ReferenceType', 'RegexToken', 'ReturnType', 'RuleCall', 'SimpleType', 'StringLiteral', 'TerminalAlternatives', 'TerminalGroup', 'TerminalRule', 'TerminalRuleCall', 'Type', 'TypeAttribute', 'TypeDefinition', 'UnionType', 'UnorderedGroup', 'UntilToken', 'ValueLiteral', 'Wildcard'];\n }\n\n protected override computeIsSubtype(subtype: string, supertype: string): boolean {\n switch (subtype) {\n case Action:\n case Alternatives:\n case Assignment:\n case CharacterRange:\n case CrossReference:\n case EndOfFile:\n case Group:\n case Keyword:\n case NegatedToken:\n case RegexToken:\n case RuleCall:\n case TerminalAlternatives:\n case TerminalGroup:\n case TerminalRuleCall:\n case UnorderedGroup:\n case UntilToken:\n case Wildcard: {\n return this.isSubtype(AbstractElement, supertype);\n }\n case ArrayLiteral:\n case NumberLiteral:\n case StringLiteral: {\n return this.isSubtype(ValueLiteral, supertype);\n }\n case ArrayType:\n case ReferenceType:\n case SimpleType:\n case UnionType: {\n return this.isSubtype(TypeDefinition, supertype);\n }\n case BooleanLiteral: {\n return this.isSubtype(Condition, supertype) || this.isSubtype(ValueLiteral, supertype);\n }\n case Conjunction:\n case Disjunction:\n case Negation:\n case ParameterReference: {\n return this.isSubtype(Condition, supertype);\n }\n case InferredType:\n case Interface:\n case Type: {\n return this.isSubtype(AbstractType, supertype);\n }\n case ParserRule: {\n return this.isSubtype(AbstractRule, supertype) || this.isSubtype(AbstractType, supertype);\n }\n case TerminalRule: {\n return this.isSubtype(AbstractRule, supertype);\n }\n default: {\n return false;\n }\n }\n }\n\n getReferenceType(refInfo: ReferenceInfo): string {\n const referenceId = `${refInfo.container.$type}:${refInfo.property}`;\n switch (referenceId) {\n case 'Action:type':\n case 'CrossReference:type':\n case 'Interface:superTypes':\n case 'ParserRule:returnType':\n case 'SimpleType:typeRef': {\n return AbstractType;\n }\n case 'Grammar:hiddenTokens':\n case 'ParserRule:hiddenTokens':\n case 'RuleCall:rule': {\n return AbstractRule;\n }\n case 'Grammar:usedGrammars': {\n return Grammar;\n }\n case 'NamedArgument:parameter':\n case 'ParameterReference:parameter': {\n return Parameter;\n }\n case 'TerminalRuleCall:rule': {\n return TerminalRule;\n }\n default: {\n throw new Error(`${referenceId} is not a valid reference id.`);\n }\n }\n }\n\n getTypeMetaData(type: string): TypeMetaData {\n switch (type) {\n case 'AbstractElement': {\n return {\n name: 'AbstractElement',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' }\n ]\n };\n }\n case 'ArrayLiteral': {\n return {\n name: 'ArrayLiteral',\n properties: [\n { name: 'elements', defaultValue: [] }\n ]\n };\n }\n case 'ArrayType': {\n return {\n name: 'ArrayType',\n properties: [\n { name: 'elementType' }\n ]\n };\n }\n case 'BooleanLiteral': {\n return {\n name: 'BooleanLiteral',\n properties: [\n { name: 'true', defaultValue: false }\n ]\n };\n }\n case 'Conjunction': {\n return {\n name: 'Conjunction',\n properties: [\n { name: 'left' },\n { name: 'right' }\n ]\n };\n }\n case 'Disjunction': {\n return {\n name: 'Disjunction',\n properties: [\n { name: 'left' },\n { name: 'right' }\n ]\n };\n }\n case 'Grammar': {\n return {\n name: 'Grammar',\n properties: [\n { name: 'definesHiddenTokens', defaultValue: false },\n { name: 'hiddenTokens', defaultValue: [] },\n { name: 'imports', defaultValue: [] },\n { name: 'interfaces', defaultValue: [] },\n { name: 'isDeclared', defaultValue: false },\n { name: 'name' },\n { name: 'rules', defaultValue: [] },\n { name: 'types', defaultValue: [] },\n { name: 'usedGrammars', defaultValue: [] }\n ]\n };\n }\n case 'GrammarImport': {\n return {\n name: 'GrammarImport',\n properties: [\n { name: 'path' }\n ]\n };\n }\n case 'InferredType': {\n return {\n name: 'InferredType',\n properties: [\n { name: 'name' }\n ]\n };\n }\n case 'Interface': {\n return {\n name: 'Interface',\n properties: [\n { name: 'attributes', defaultValue: [] },\n { name: 'name' },\n { name: 'superTypes', defaultValue: [] }\n ]\n };\n }\n case 'NamedArgument': {\n return {\n name: 'NamedArgument',\n properties: [\n { name: 'calledByName', defaultValue: false },\n { name: 'parameter' },\n { name: 'value' }\n ]\n };\n }\n case 'Negation': {\n return {\n name: 'Negation',\n properties: [\n { name: 'value' }\n ]\n };\n }\n case 'NumberLiteral': {\n return {\n name: 'NumberLiteral',\n properties: [\n { name: 'value' }\n ]\n };\n }\n case 'Parameter': {\n return {\n name: 'Parameter',\n properties: [\n { name: 'name' }\n ]\n };\n }\n case 'ParameterReference': {\n return {\n name: 'ParameterReference',\n properties: [\n { name: 'parameter' }\n ]\n };\n }\n case 'ParserRule': {\n return {\n name: 'ParserRule',\n properties: [\n { name: 'dataType' },\n { name: 'definesHiddenTokens', defaultValue: false },\n { name: 'definition' },\n { name: 'entry', defaultValue: false },\n { name: 'fragment', defaultValue: false },\n { name: 'hiddenTokens', defaultValue: [] },\n { name: 'inferredType' },\n { name: 'name' },\n { name: 'parameters', defaultValue: [] },\n { name: 'returnType' },\n { name: 'wildcard', defaultValue: false }\n ]\n };\n }\n case 'ReferenceType': {\n return {\n name: 'ReferenceType',\n properties: [\n { name: 'referenceType' }\n ]\n };\n }\n case 'ReturnType': {\n return {\n name: 'ReturnType',\n properties: [\n { name: 'name' }\n ]\n };\n }\n case 'SimpleType': {\n return {\n name: 'SimpleType',\n properties: [\n { name: 'primitiveType' },\n { name: 'stringType' },\n { name: 'typeRef' }\n ]\n };\n }\n case 'StringLiteral': {\n return {\n name: 'StringLiteral',\n properties: [\n { name: 'value' }\n ]\n };\n }\n case 'TerminalRule': {\n return {\n name: 'TerminalRule',\n properties: [\n { name: 'definition' },\n { name: 'fragment', defaultValue: false },\n { name: 'hidden', defaultValue: false },\n { name: 'name' },\n { name: 'type' }\n ]\n };\n }\n case 'Type': {\n return {\n name: 'Type',\n properties: [\n { name: 'name' },\n { name: 'type' }\n ]\n };\n }\n case 'TypeAttribute': {\n return {\n name: 'TypeAttribute',\n properties: [\n { name: 'defaultValue' },\n { name: 'isOptional', defaultValue: false },\n { name: 'name' },\n { name: 'type' }\n ]\n };\n }\n case 'UnionType': {\n return {\n name: 'UnionType',\n properties: [\n { name: 'types', defaultValue: [] }\n ]\n };\n }\n case 'Action': {\n return {\n name: 'Action',\n properties: [\n { name: 'cardinality' },\n { name: 'feature' },\n { name: 'inferredType' },\n { name: 'lookahead' },\n { name: 'operator' },\n { name: 'type' }\n ]\n };\n }\n case 'Alternatives': {\n return {\n name: 'Alternatives',\n properties: [\n { name: 'cardinality' },\n { name: 'elements', defaultValue: [] },\n { name: 'lookahead' }\n ]\n };\n }\n case 'Assignment': {\n return {\n name: 'Assignment',\n properties: [\n { name: 'cardinality' },\n { name: 'feature' },\n { name: 'lookahead' },\n { name: 'operator' },\n { name: 'terminal' }\n ]\n };\n }\n case 'CharacterRange': {\n return {\n name: 'CharacterRange',\n properties: [\n { name: 'cardinality' },\n { name: 'left' },\n { name: 'lookahead' },\n { name: 'right' }\n ]\n };\n }\n case 'CrossReference': {\n return {\n name: 'CrossReference',\n properties: [\n { name: 'cardinality' },\n { name: 'deprecatedSyntax', defaultValue: false },\n { name: 'lookahead' },\n { name: 'terminal' },\n { name: 'type' }\n ]\n };\n }\n case 'EndOfFile': {\n return {\n name: 'EndOfFile',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' }\n ]\n };\n }\n case 'Group': {\n return {\n name: 'Group',\n properties: [\n { name: 'cardinality' },\n { name: 'elements', defaultValue: [] },\n { name: 'guardCondition' },\n { name: 'lookahead' }\n ]\n };\n }\n case 'Keyword': {\n return {\n name: 'Keyword',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'value' }\n ]\n };\n }\n case 'NegatedToken': {\n return {\n name: 'NegatedToken',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'terminal' }\n ]\n };\n }\n case 'RegexToken': {\n return {\n name: 'RegexToken',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'regex' }\n ]\n };\n }\n case 'RuleCall': {\n return {\n name: 'RuleCall',\n properties: [\n { name: 'arguments', defaultValue: [] },\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'rule' }\n ]\n };\n }\n case 'TerminalAlternatives': {\n return {\n name: 'TerminalAlternatives',\n properties: [\n { name: 'cardinality' },\n { name: 'elements', defaultValue: [] },\n { name: 'lookahead' }\n ]\n };\n }\n case 'TerminalGroup': {\n return {\n name: 'TerminalGroup',\n properties: [\n { name: 'cardinality' },\n { name: 'elements', defaultValue: [] },\n { name: 'lookahead' }\n ]\n };\n }\n case 'TerminalRuleCall': {\n return {\n name: 'TerminalRuleCall',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'rule' }\n ]\n };\n }\n case 'UnorderedGroup': {\n return {\n name: 'UnorderedGroup',\n properties: [\n { name: 'cardinality' },\n { name: 'elements', defaultValue: [] },\n { name: 'lookahead' }\n ]\n };\n }\n case 'UntilToken': {\n return {\n name: 'UntilToken',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' },\n { name: 'terminal' }\n ]\n };\n }\n case 'Wildcard': {\n return {\n name: 'Wildcard',\n properties: [\n { name: 'cardinality' },\n { name: 'lookahead' }\n ]\n };\n }\n default: {\n return {\n name: type,\n properties: []\n };\n }\n }\n }\n}\n\nexport const reflection = new LangiumGrammarAstReflection();\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { TokenType } from 'chevrotain';\nimport type { URI } from './utils/uri-utils.js';\nimport type { AbstractElement } from './languages/generated/ast.js';\nimport type { DocumentSegment, LangiumDocument } from './workspace/documents.js';\n\n/**\n * A node in the Abstract Syntax Tree (AST).\n */\nexport interface AstNode {\n /** Every AST node has a type corresponding to what was specified in the grammar declaration. */\n readonly $type: string;\n /** The container node in the AST; every node except the root node has a container. */\n readonly $container?: AstNode;\n /** The property of the `$container` node that contains this node. This is either a direct reference or an array. */\n readonly $containerProperty?: string;\n /** In case `$containerProperty` is an array, the array index is stored here. */\n readonly $containerIndex?: number;\n /** The Concrete Syntax Tree (CST) node of the text range from which this node was parsed. */\n readonly $cstNode?: CstNode;\n /** The document containing the AST; only the root node has a direct reference to the document. */\n readonly $document?: LangiumDocument;\n}\n\nexport function isAstNode(obj: unknown): obj is AstNode {\n return typeof obj === 'object' && obj !== null && typeof (obj as AstNode).$type === 'string';\n}\n\nexport interface GenericAstNode extends AstNode {\n [key: string]: unknown\n}\n\ntype SpecificNodeProperties = keyof Omit;\n\n/**\n * The property names of a given AST node type.\n */\nexport type Properties = SpecificNodeProperties extends never ? string : SpecificNodeProperties\n\n/**\n * A cross-reference in the AST. Cross-references may or may not be successfully resolved.\n */\nexport interface Reference {\n /**\n * The target AST node of this reference. Accessing this property may trigger cross-reference\n * resolution by the `Linker` in case it has not been done yet. If the reference cannot be resolved,\n * the value is `undefined`.\n */\n readonly ref?: T;\n\n /** If any problem occurred while resolving the reference, it is described by this property. */\n readonly error?: LinkingError;\n /** The CST node from which the reference was parsed */\n readonly $refNode?: CstNode;\n /** The actual text used to look up in the surrounding scope */\n readonly $refText: string;\n /** The node description for the AstNode returned by `ref` */\n readonly $nodeDescription?: AstNodeDescription;\n}\n\nexport function isReference(obj: unknown): obj is Reference {\n return typeof obj === 'object' && obj !== null && typeof (obj as Reference).$refText === 'string';\n}\n\nexport type ResolvedReference = Reference & {\n readonly ref: T;\n}\n\n/**\n * A description of an AST node is used when constructing scopes and looking up cross-reference targets.\n */\nexport interface AstNodeDescription {\n /** The target node; should be present only for local references (linking to the same document). */\n node?: AstNode;\n /**\n * The document segment that represents the range of the name of the AST node.\n */\n nameSegment?: DocumentSegment;\n /**\n * The document segment that represents the full range of the AST node.\n */\n selectionSegment?: DocumentSegment;\n /** `$type` property value of the AST node */\n type: string;\n /** Name of the AST node; this is usually determined by the `NameProvider` service. */\n name: string;\n /** URI to the document containing the AST node */\n documentUri: URI;\n /** Navigation path inside the document */\n path: string;\n}\n\nexport function isAstNodeDescription(obj: unknown): obj is AstNodeDescription {\n return typeof obj === 'object' && obj !== null\n && typeof (obj as AstNodeDescription).name === 'string'\n && typeof (obj as AstNodeDescription).type === 'string'\n && typeof (obj as AstNodeDescription).path === 'string';\n}\n\n/**\n * Information about a cross-reference. This is used when traversing references in an AST or to describe\n * unresolved references.\n */\nexport interface ReferenceInfo {\n reference: Reference\n container: AstNode\n property: string\n index?: number\n}\n\n/**\n * Used to collect information when the `Linker` service fails to resolve a cross-reference.\n */\nexport interface LinkingError extends ReferenceInfo {\n message: string;\n targetDescription?: AstNodeDescription;\n}\n\nexport function isLinkingError(obj: unknown): obj is LinkingError {\n return typeof obj === 'object' && obj !== null\n && isAstNode((obj as LinkingError).container)\n && isReference((obj as LinkingError).reference)\n && typeof (obj as LinkingError).message === 'string';\n}\n\n/**\n * Service used for generic access to the structure of the AST. This service is shared between\n * all involved languages, so it operates on the superset of types of these languages.\n */\nexport interface AstReflection {\n getAllTypes(): string[]\n getAllSubTypes(type: string): string[]\n getReferenceType(refInfo: ReferenceInfo): string\n getTypeMetaData(type: string): TypeMetaData\n isInstance(node: unknown, type: string): boolean\n isSubtype(subtype: string, supertype: string): boolean\n}\n\n/**\n * An abstract implementation of the {@link AstReflection} interface.\n * Serves to cache subtype computation results to improve performance throughout different parts of Langium.\n */\nexport abstract class AbstractAstReflection implements AstReflection {\n\n protected subtypes: Record> = {};\n protected allSubtypes: Record = {};\n\n abstract getAllTypes(): string[];\n abstract getReferenceType(refInfo: ReferenceInfo): string;\n abstract getTypeMetaData(type: string): TypeMetaData;\n protected abstract computeIsSubtype(subtype: string, supertype: string): boolean;\n\n isInstance(node: unknown, type: string): boolean {\n return isAstNode(node) && this.isSubtype(node.$type, type);\n }\n\n isSubtype(subtype: string, supertype: string): boolean {\n if (subtype === supertype) {\n return true;\n }\n let nested = this.subtypes[subtype];\n if (!nested) {\n nested = this.subtypes[subtype] = {};\n }\n const existing = nested[supertype];\n if (existing !== undefined) {\n return existing;\n } else {\n const result = this.computeIsSubtype(subtype, supertype);\n nested[supertype] = result;\n return result;\n }\n }\n\n getAllSubTypes(type: string): string[] {\n const existing = this.allSubtypes[type];\n if (existing) {\n return existing;\n } else {\n const allTypes = this.getAllTypes();\n const types: string[] = [];\n for (const possibleSubType of allTypes) {\n if (this.isSubtype(possibleSubType, type)) {\n types.push(possibleSubType);\n }\n }\n this.allSubtypes[type] = types;\n return types;\n }\n }\n}\n\n/**\n * Represents runtime meta data about a meta model type.\n */\nexport interface TypeMetaData {\n /** The name of this meta model type. Corresponds to the `AstNode.$type` value. */\n name: string\n /** A list of properties. They can contain default values for their respective property in the AST. */\n properties: TypeProperty[]\n}\n\n/**\n * Describes the meta data of a property of an AST node.\n *\n * The optional `defaultValue` indicates that the property is mandatory in the AST node.\n * For example, if an AST node contains an array, but no elements of this array have been parsed, we still expect an empty array instead of `undefined`.\n */\nexport interface TypeProperty {\n name: string\n defaultValue?: PropertyType\n}\n\n/**\n * Represents a default value for an AST property.\n */\nexport type PropertyType = number | string | boolean | PropertyType[];\n\n/**\n * A node in the Concrete Syntax Tree (CST).\n */\nexport interface CstNode extends DocumentSegment {\n /** The container node in the CST */\n readonly container?: CompositeCstNode;\n /** @deprecated use `container` instead. */\n readonly parent?: CompositeCstNode;\n /** The actual text */\n readonly text: string;\n /** The root CST node */\n readonly root: RootCstNode;\n /** The grammar element from which this node was parsed */\n readonly grammarSource: AbstractElement;\n /** @deprecated use `grammarSource` instead. */\n readonly feature: AbstractElement;\n /** The AST node created from this CST node */\n readonly astNode: AstNode;\n /** @deprecated use `astNode` instead. */\n readonly element: AstNode;\n /** Whether the token is hidden, i.e. not explicitly part of the containing grammar rule */\n readonly hidden: boolean;\n}\n\n/**\n * A composite CST node contains other nodes, but no directly associated token.\n */\nexport interface CompositeCstNode extends CstNode {\n readonly content: CstNode[];\n /** @deprecated use `content` instead. */\n readonly children: CstNode[];\n}\n\nexport function isCompositeCstNode(node: unknown): node is CompositeCstNode {\n return typeof node === 'object' && node !== null && Array.isArray((node as CompositeCstNode).content);\n}\n\n/**\n * A leaf CST node corresponds to a token in the input token stream.\n */\nexport interface LeafCstNode extends CstNode {\n readonly tokenType: TokenType;\n}\n\nexport function isLeafCstNode(node: unknown): node is LeafCstNode {\n return typeof node === 'object' && node !== null && typeof (node as LeafCstNode).tokenType === 'object';\n}\n\nexport interface RootCstNode extends CompositeCstNode {\n readonly fullText: string\n}\n\nexport function isRootCstNode(node: unknown): node is RootCstNode {\n return isCompositeCstNode(node) && typeof (node as RootCstNode).fullText === 'string';\n}\n\n/**\n * Returns a type to have only properties names (!) of a type T whose property value is of a certain type K.\n */\ntype ExtractKeysOfValueType = { [I in keyof T]: T[I] extends K ? I : never }[keyof T];\n\n/**\n * Returns the property names (!) of an AstNode that are cross-references.\n * Meant to be used during cross-reference resolution in combination with `assertUnreachable(context.property)`.\n */\nexport type CrossReferencesOfAstNodeType = (\n ExtractKeysOfValueType\n | ExtractKeysOfValueType|undefined>\n// eslint-disable-next-line @typescript-eslint/ban-types\n) & {};\n\n/**\n * Represents the enumeration-like type, that lists all AstNode types of your grammar.\n */\nexport type AstTypeList = Record;\n\n/**\n * Returns all types that contain cross-references, A is meant to be the interface `XXXAstType` fromm your generated `ast.ts` file.\n * Meant to be used during cross-reference resolution in combination with `assertUnreachable(context.container)`.\n */\nexport type AstNodeTypesWithCrossReferences> = {\n [T in keyof A]: CrossReferencesOfAstNodeType extends never ? never : A[T]\n}[keyof A];\n\nexport type Mutable = {\n -readonly [P in keyof T]: T[P]\n};\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Range } from 'vscode-languageserver-types';\nimport type { AstNode, AstReflection, CstNode, GenericAstNode, Mutable, PropertyType, Reference, ReferenceInfo } from '../syntax-tree.js';\nimport type { Stream, TreeStream } from './stream.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport { isAstNode, isReference } from '../syntax-tree.js';\nimport { DONE_RESULT, stream, StreamImpl, TreeStreamImpl } from './stream.js';\nimport { inRange } from './cst-utils.js';\n\n/**\n * Link the `$container` and other related properties of every AST node that is directly contained\n * in the given `node`.\n */\nexport function linkContentToContainer(node: AstNode): void {\n for (const [name, value] of Object.entries(node)) {\n if (!name.startsWith('$')) {\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n if (isAstNode(item)) {\n (item as Mutable).$container = node;\n (item as Mutable).$containerProperty = name;\n (item as Mutable).$containerIndex = index;\n }\n });\n } else if (isAstNode(value)) {\n (value as Mutable).$container = node;\n (value as Mutable).$containerProperty = name;\n }\n }\n }\n}\n\n/**\n * Walk along the hierarchy of containers from the given AST node to the root and return the first\n * node that matches the type predicate. If the start node itself matches, it is returned.\n * If no container matches, `undefined` is returned.\n */\nexport function getContainerOfType(node: AstNode | undefined, typePredicate: (n: AstNode) => n is T): T | undefined {\n let item = node;\n while (item) {\n if (typePredicate(item)) {\n return item;\n }\n item = item.$container;\n }\n return undefined;\n}\n\n/**\n * Walk along the hierarchy of containers from the given AST node to the root and check for existence\n * of a container that matches the given predicate. The start node is included in the checks.\n */\nexport function hasContainerOfType(node: AstNode | undefined, predicate: (n: AstNode) => boolean): boolean {\n let item = node;\n while (item) {\n if (predicate(item)) {\n return true;\n }\n item = item.$container;\n }\n return false;\n}\n\n/**\n * Retrieve the document in which the given AST node is contained. A reference to the document is\n * usually held by the root node of the AST.\n *\n * @throws an error if the node is not contained in a document.\n */\nexport function getDocument(node: AstNode): LangiumDocument {\n const rootNode = findRootNode(node);\n const result = rootNode.$document;\n if (!result) {\n throw new Error('AST node has no document.');\n }\n return result as LangiumDocument;\n}\n\n/**\n * Returns the root node of the given AST node by following the `$container` references.\n */\nexport function findRootNode(node: AstNode): AstNode {\n while (node.$container) {\n node = node.$container;\n }\n return node;\n}\n\nexport interface AstStreamOptions {\n /**\n * Optional target range that the nodes in the stream need to intersect\n */\n range?: Range\n}\n\n/**\n * Create a stream of all AST nodes that are directly contained in the given node. This includes\n * single-valued as well as multi-valued (array) properties.\n */\nexport function streamContents(node: AstNode, options?: AstStreamOptions): Stream {\n if (!node) {\n throw new Error('Node must be an AstNode.');\n }\n const range = options?.range;\n type State = { keys: string[], keyIndex: number, arrayIndex: number };\n return new StreamImpl(() => ({\n keys: Object.keys(node),\n keyIndex: 0,\n arrayIndex: 0\n }), state => {\n while (state.keyIndex < state.keys.length) {\n const property = state.keys[state.keyIndex];\n if (!property.startsWith('$')) {\n const value = (node as GenericAstNode)[property];\n if (isAstNode(value)) {\n state.keyIndex++;\n if (isAstNodeInRange(value, range)) {\n return { done: false, value };\n }\n } else if (Array.isArray(value)) {\n while (state.arrayIndex < value.length) {\n const index = state.arrayIndex++;\n const element = value[index];\n if (isAstNode(element) && isAstNodeInRange(element, range)) {\n return { done: false, value: element };\n }\n }\n state.arrayIndex = 0;\n }\n }\n state.keyIndex++;\n }\n return DONE_RESULT;\n });\n}\n\n/**\n * Create a stream of all AST nodes that are directly and indirectly contained in the given root node.\n * This does not include the root node itself.\n */\nexport function streamAllContents(root: AstNode, options?: AstStreamOptions): TreeStream {\n if (!root) {\n throw new Error('Root node must be an AstNode.');\n }\n return new TreeStreamImpl(root, node => streamContents(node, options));\n}\n\n/**\n * Create a stream of all AST nodes that are directly and indirectly contained in the given root node,\n * including the root node itself.\n */\nexport function streamAst(root: AstNode, options?: AstStreamOptions): TreeStream {\n if (!root) {\n throw new Error('Root node must be an AstNode.');\n } else if (options?.range && !isAstNodeInRange(root, options.range)) {\n // Return an empty stream if the root node isn't in range\n return new TreeStreamImpl(root, () => []);\n }\n return new TreeStreamImpl(root, node => streamContents(node, options), { includeRoot: true });\n}\n\nfunction isAstNodeInRange(astNode: AstNode, range?: Range): boolean {\n if (!range) {\n return true;\n }\n const nodeRange = astNode.$cstNode?.range;\n if (!nodeRange) {\n return false;\n }\n return inRange(nodeRange, range);\n}\n\n/**\n * Create a stream of all cross-references that are held by the given AST node. This includes\n * single-valued as well as multi-valued (array) properties.\n */\nexport function streamReferences(node: AstNode): Stream {\n type State = { keys: string[], keyIndex: number, arrayIndex: number };\n return new StreamImpl(() => ({\n keys: Object.keys(node),\n keyIndex: 0,\n arrayIndex: 0\n }), state => {\n while (state.keyIndex < state.keys.length) {\n const property = state.keys[state.keyIndex];\n if (!property.startsWith('$')) {\n const value = (node as GenericAstNode)[property];\n if (isReference(value)) {\n state.keyIndex++;\n return { done: false, value: { reference: value, container: node, property } };\n } else if (Array.isArray(value)) {\n while (state.arrayIndex < value.length) {\n const index = state.arrayIndex++;\n const element = value[index];\n if (isReference(element)) {\n return { done: false, value: { reference: element, container: node, property, index } };\n }\n }\n state.arrayIndex = 0;\n }\n }\n state.keyIndex++;\n }\n return DONE_RESULT;\n });\n}\n\n/**\n * Returns a Stream of references to the target node from the AstNode tree\n *\n * @param targetNode AstNode we are looking for\n * @param lookup AstNode where we search for references. If not provided, the root node of the document is used as the default value\n */\nexport function findLocalReferences(targetNode: AstNode, lookup = getDocument(targetNode).parseResult.value): Stream {\n const refs: Reference[] = [];\n streamAst(lookup).forEach(node => {\n streamReferences(node).forEach(refInfo => {\n if (refInfo.reference.ref === targetNode) {\n refs.push(refInfo.reference);\n }\n });\n });\n return stream(refs);\n}\n\n/**\n * Assigns all mandatory AST properties to the specified node.\n *\n * @param reflection Reflection object used to gather mandatory properties for the node.\n * @param node Specified node is modified in place and properties are directly assigned.\n */\nexport function assignMandatoryProperties(reflection: AstReflection, node: AstNode): void {\n const typeMetaData = reflection.getTypeMetaData(node.$type);\n const genericNode = node as GenericAstNode;\n for (const property of typeMetaData.properties) {\n // Only set the value if the property is not already set and if it has a default value\n if (property.defaultValue !== undefined && genericNode[property.name] === undefined) {\n genericNode[property.name] = copyDefaultValue(property.defaultValue);\n }\n }\n}\n\nfunction copyDefaultValue(propertyType: PropertyType): PropertyType {\n if (Array.isArray(propertyType)) {\n return [...propertyType.map(copyDefaultValue)];\n } else {\n return propertyType;\n }\n}\n\n/**\n * Creates a deep copy of the specified AST node.\n * The resulting copy will only contain semantically relevant information, such as the `$type` property and AST properties.\n *\n * References are copied without resolved cross reference. The specified function is used to rebuild them.\n */\nexport function copyAstNode(node: T, buildReference: (node: AstNode, property: string, refNode: CstNode | undefined, refText: string) => Reference): T {\n const copy: GenericAstNode = { $type: node.$type };\n\n for (const [name, value] of Object.entries(node)) {\n if (!name.startsWith('$')) {\n if (isAstNode(value)) {\n copy[name] = copyAstNode(value, buildReference);\n } else if (isReference(value)) {\n copy[name] = buildReference(\n copy,\n name,\n value.$refNode,\n value.$refText\n );\n } else if (Array.isArray(value)) {\n const copiedArray: unknown[] = [];\n for (const element of value) {\n if (isAstNode(element)) {\n copiedArray.push(copyAstNode(element, buildReference));\n } else if (isReference(element)) {\n copiedArray.push(\n buildReference(\n copy,\n name,\n element.$refNode,\n element.$refText\n )\n );\n } else {\n copiedArray.push(element);\n }\n }\n copy[name] = copiedArray;\n } else {\n copy[name] = value;\n }\n }\n }\n\n linkContentToContainer(copy);\n return copy as unknown as T;\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/**\n * A stream is a read-only sequence of values. While the contents of an array can be accessed\n * both sequentially and randomly (via index), a stream allows only sequential access.\n *\n * The advantage of this is that a stream can be evaluated lazily, so it does not require\n * to store intermediate values. This can boost performance when a large sequence is\n * processed via filtering, mapping etc. and accessed at most once. However, lazy\n * evaluation means that all processing is repeated when you access the sequence multiple\n * times; in such a case, it may be better to store the resulting sequence into an array.\n */\nexport interface Stream extends Iterable {\n\n /**\n * Returns an iterator for this stream. This is the same as calling the `Symbol.iterator` function property.\n */\n iterator(): IterableIterator;\n\n /**\n * Determines whether this stream contains no elements.\n */\n isEmpty(): boolean;\n\n /**\n * Determines the number of elements in this stream.\n */\n count(): number;\n\n /**\n * Collects all elements of this stream into an array.\n */\n toArray(): T[];\n\n /**\n * Collects all elements of this stream into a Set.\n */\n toSet(): Set;\n\n /**\n * Collects all elements of this stream into a Map, applying the provided functions to determine keys and values.\n *\n * @param keyFn The function to derive map keys. If omitted, the stream elements are used as keys.\n * @param valueFn The function to derive map values. If omitted, the stream elements are used as values.\n */\n toMap(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map;\n\n /**\n * Returns a string representation of a stream.\n */\n toString(): string;\n\n /**\n * Combines two streams by returning a new stream that yields all elements of this stream and the other stream.\n *\n * @param other Stream to be concatenated with this one.\n */\n concat(other: Iterable): Stream;\n\n /**\n * Adds all elements of the stream into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the stream from the next in the resulting string.\n * If omitted, the steam elements are separated with a comma.\n */\n join(separator?: string): string\n\n /**\n * Returns the index of the first occurrence of a value in the stream, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the array.\n * @param fromIndex The stream index at which to begin the search. If fromIndex is omitted, the search\n * starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n\n /**\n * Determines whether all members of the stream satisfy the specified test.\n *\n * @param predicate This method calls the predicate function for each element in the stream until the\n * predicate returns a value which is coercible to the Boolean value `false`, or until the end\n * of the stream.\n */\n every(predicate: (value: T) => value is S): this is Stream;\n every(predicate: (value: T) => unknown): boolean;\n\n /**\n * Determines whether any member of the stream satisfies the specified test.\n *\n * @param predicate This method calls the predicate function for each element in the stream until the\n * predicate returns a value which is coercible to the Boolean value `true`, or until the end\n * of the stream.\n */\n some(predicate: (value: T) => unknown): boolean;\n\n /**\n * Performs the specified action for each element in the stream.\n *\n * @param callbackfn Function called once for each element in the stream.\n */\n forEach(callbackfn: (value: T, index: number) => void): void;\n\n /**\n * Returns a stream that yields the results of calling the specified callback function on each element\n * of the stream. The function is called when the resulting stream elements are actually accessed, so\n * accessing the resulting stream multiple times means the function is also called multiple times for\n * each element of the stream.\n *\n * @param callbackfn Lazily evaluated function mapping stream elements.\n */\n map(callbackfn: (value: T) => U): Stream;\n\n /**\n * Returns the elements of the stream that meet the condition specified in a callback function.\n * The function is called when the resulting stream elements are actually accessed, so accessing the\n * resulting stream multiple times means the function is also called multiple times for each element\n * of the stream.\n *\n * @param predicate Lazily evaluated function checking a condition on stream elements.\n */\n filter(predicate: (value: T) => value is S): Stream;\n filter(predicate: (value: T) => unknown): Stream;\n\n /**\n * Returns the elements of the stream that are _non-nullable_, which means they are neither `undefined`\n * nor `null`.\n */\n nonNullable(): Stream>;\n\n /**\n * Calls the specified callback function for all elements in the stream. The return value of the\n * callback function is the accumulated result, and is provided as an argument in the next call to\n * the callback function.\n *\n * @param callbackfn This method calls the function once for each element in the stream, providing\n * the previous and current values of the reduction.\n * @param initialValue If specified, `initialValue` is used as the initial value to start the\n * accumulation. The first call to the function provides this value as an argument instead\n * of a stream value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduce(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all elements in the stream, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n *\n * @param callbackfn This method calls the function once for each element in the stream, providing\n * the previous and current values of the reduction.\n * @param initialValue If specified, `initialValue` is used as the initial value to start the\n * accumulation. The first call to the function provides this value as an argument instead\n * of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduceRight(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n\n /**\n * Returns the value of the first element in the stream that meets the condition, or `undefined`\n * if there is no such element.\n *\n * @param predicate This method calls `predicate` once for each element of the stream, in ascending\n * order, until it finds one where `predicate` returns a value which is coercible to the\n * Boolean value `true`.\n */\n find(predicate: (value: T) => value is S): S | undefined;\n find(predicate: (value: T) => unknown): T | undefined;\n\n /**\n * Returns the index of the first element in the stream that meets the condition, or `-1`\n * if there is no such element.\n *\n * @param predicate This method calls `predicate` once for each element of the stream, in ascending\n * order, until it finds one where `predicate` returns a value which is coercible to the\n * Boolean value `true`.\n */\n findIndex(predicate: (value: T) => unknown): number;\n\n /**\n * Determines whether the stream includes a certain element, returning `true` or `false` as appropriate.\n *\n * @param searchElement The element to search for.\n */\n includes(searchElement: T): boolean;\n\n /**\n * Calls a defined callback function on each element of the stream and then flattens the result into\n * a new stream. This is identical to a `map` followed by `flat` with depth 1.\n *\n * @param callbackfn Lazily evaluated function mapping stream elements.\n */\n flatMap(callbackfn: (value: T) => U | Iterable): Stream;\n\n /**\n * Returns a new stream with all sub-stream or sub-array elements concatenated into it recursively up\n * to the specified depth.\n *\n * @param depth The maximum recursion depth. Defaults to 1.\n */\n flat(depth?: D): FlatStream;\n\n /**\n * Returns the first element in the stream, or `undefined` if the stream is empty.\n */\n head(): T | undefined;\n\n /**\n * Returns a stream that skips the first `skipCount` elements from this stream.\n *\n * @param skipCount The number of elements to skip. If this is larger than the number of elements in\n * the stream, an empty stream is returned. Defaults to 1.\n */\n tail(skipCount?: number): Stream;\n\n /**\n * Returns a stream consisting of the elements of this stream, truncated to be no longer than `maxSize`\n * in length.\n *\n * @param maxSize The number of elements the stream should be limited to\n */\n limit(maxSize: number): Stream;\n\n /**\n * Returns a stream containing only the distinct elements from this stream.\n * Equality is determined with the same rules as a standard `Set`.\n *\n * @param by A function returning the key used to check equality with a previous stream element.\n * If omitted, the stream elements themselves are used for comparison.\n */\n distinct(by?: (element: T) => Key): Stream;\n\n /**\n * Returns a stream that contains all elements that don't exist in the {@link other} iterable.\n * Equality is determined with the same rules as a standard `Set`.\n * @param other The elements that should be exluded from this stream.\n * @param key A function returning the key used to check quality.\n * If omitted, the stream elements themselves are used for comparison.\n */\n exclude(other: Iterable, key?: (element: T) => Key): Stream;\n\n}\n\nexport type FlatStream = {\n 'done': Stream,\n 'recur': T extends Iterable\n ? FlatStream>\n : Stream\n}[Depth extends 0 ? 'done' : 'recur'];\n\nexport type MinusOne = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][N];\n\n/**\n * The default implementation of `Stream` works with two input functions:\n * - The first function creates the initial state of an iteration.\n * - The second function gets the current state as argument and returns an `IteratorResult`.\n */\nexport class StreamImpl implements Stream {\n protected readonly startFn: () => S;\n protected readonly nextFn: (state: S) => IteratorResult;\n\n constructor(startFn: () => S, nextFn: (state: S) => IteratorResult) {\n this.startFn = startFn;\n this.nextFn = nextFn;\n }\n\n iterator(): IterableIterator {\n const iterator = {\n state: this.startFn(),\n next: () => this.nextFn(iterator.state),\n [Symbol.iterator]: () => iterator\n };\n return iterator;\n }\n\n [Symbol.iterator](): Iterator {\n return this.iterator();\n }\n\n isEmpty(): boolean {\n const iterator = this.iterator();\n return Boolean(iterator.next().done);\n }\n\n count(): number {\n const iterator = this.iterator();\n let count = 0;\n let next = iterator.next();\n while (!next.done) {\n count++;\n next = iterator.next();\n }\n return count;\n }\n\n toArray(): T[] {\n const result: T[] = [];\n const iterator = this.iterator();\n let next: IteratorResult;\n do {\n next = iterator.next();\n if (next.value !== undefined) {\n result.push(next.value);\n }\n } while (!next.done);\n return result;\n }\n\n toSet(): Set {\n return new Set(this);\n }\n\n toMap(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map {\n const entryStream = this.map(element => <[K, V]>[\n keyFn ? keyFn(element) : element,\n valueFn ? valueFn(element) : element\n ]);\n return new Map(entryStream);\n }\n\n toString(): string {\n return this.join();\n }\n\n concat(other: Iterable): Stream {\n const iterator = other[Symbol.iterator]();\n return new StreamImpl<{ first: S, firstDone: boolean }, T | T2>(\n () => ({ first: this.startFn(), firstDone: false }),\n state => {\n let result: IteratorResult;\n if (!state.firstDone) {\n do {\n result = this.nextFn(state.first);\n if (!result.done) {\n return result;\n }\n } while (!result.done);\n state.firstDone = true;\n }\n do {\n result = iterator.next();\n if (!result.done) {\n return result;\n }\n } while (!result.done);\n return DONE_RESULT;\n }\n );\n }\n\n join(separator = ','): string {\n const iterator = this.iterator();\n let value = '';\n let result: IteratorResult;\n let addSeparator = false;\n do {\n result = iterator.next();\n if (!result.done) {\n if (addSeparator) {\n value += separator;\n }\n value += toString(result.value);\n }\n addSeparator = true;\n } while (!result.done);\n return value;\n }\n\n indexOf(searchElement: T, fromIndex = 0): number {\n const iterator = this.iterator();\n let index = 0;\n let next = iterator.next();\n while (!next.done) {\n if (index >= fromIndex && next.value === searchElement) {\n return index;\n }\n next = iterator.next();\n index++;\n }\n return -1;\n }\n\n // In the following definition the '& this' part in the return type is important\n // _and_ the order within 'Stream & this' is crucial!\n // Otherwise Typescript would infer the type of 'this' as 'StreamImpl & Stream'\n // (or ' & Stream') and usages like\n // ```\n // const stream = new StreamImpl(...);\n // ... stream.every() & stream....\n // ```\n // cannot benefit from '', as Typescript would priorize the signatures\n // of 'StreamImpl' (i.e. those of 'Stream') over those of 'Stream'.\n // With the order of 'Stream & this' the signatures of 'Stream' get precedence.\n every(predicate: (value: T) => value is U): this is Stream & this;\n every(predicate: (value: T) => unknown): boolean;\n every(predicate: (value: T) => unknown): boolean {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (!predicate(next.value)) {\n return false;\n }\n next = iterator.next();\n }\n return true;\n }\n\n some(predicate: (value: T) => unknown): boolean {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (predicate(next.value)) {\n return true;\n }\n next = iterator.next();\n }\n return false;\n }\n\n forEach(callbackfn: (value: T, index: number) => void): void {\n const iterator = this.iterator();\n let index = 0;\n let next = iterator.next();\n while (!next.done) {\n callbackfn(next.value, index);\n next = iterator.next();\n index++;\n }\n }\n\n map(callbackfn: (value: T) => U): Stream {\n return new StreamImpl(\n this.startFn,\n (state) => {\n const { done, value } = this.nextFn(state);\n if (done) {\n return DONE_RESULT;\n } else {\n return { done: false, value: callbackfn(value) };\n }\n }\n );\n }\n\n // for remarks on the return type definition refer to 'every(...)'\n filter(predicate: (value: T) => value is U): Stream & this;\n filter(predicate: (value: T) => unknown): Stream & this;\n filter(predicate: (value: T) => unknown): Stream {\n return new StreamImpl(\n this.startFn,\n state => {\n let result: IteratorResult;\n do {\n result = this.nextFn(state);\n if (!result.done && predicate(result.value)) {\n return result;\n }\n } while (!result.done);\n return DONE_RESULT;\n }\n );\n }\n\n nonNullable(): Stream> {\n return this.filter(e => e !== undefined && e !== null) as Stream>;\n }\n\n reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduce(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n reduce(callbackfn: (previousValue: U | T, currentValue: T) => U, initialValue?: U): U | T | undefined {\n const iterator = this.iterator();\n let previousValue: U | T | undefined = initialValue;\n let next = iterator.next();\n while (!next.done) {\n if (previousValue === undefined) {\n previousValue = next.value;\n } else {\n previousValue = callbackfn(previousValue, next.value);\n }\n next = iterator.next();\n }\n return previousValue;\n }\n\n reduceRight(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;\n reduceRight(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;\n reduceRight(callbackfn: (previousValue: U | T, currentValue: T) => U, initialValue?: U): U | T | undefined {\n return this.recursiveReduce(this.iterator(), callbackfn, initialValue);\n }\n\n protected recursiveReduce(iterator: Iterator, callbackfn: (previousValue: U | T, currentValue: T) => U, initialValue?: U): U | T | undefined {\n const next = iterator.next();\n if (next.done) {\n return initialValue;\n }\n const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue);\n if (previousValue === undefined) {\n return next.value;\n }\n return callbackfn(previousValue, next.value);\n }\n\n find(predicate: (value: T) => value is S): S | undefined;\n find(predicate: (value: T) => unknown): T | undefined;\n find(predicate: (value: T) => unknown): T | undefined {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (predicate(next.value)) {\n return next.value;\n }\n next = iterator.next();\n }\n return undefined;\n }\n\n findIndex(predicate: (value: T) => unknown): number {\n const iterator = this.iterator();\n let index = 0;\n let next = iterator.next();\n while (!next.done) {\n if (predicate(next.value)) {\n return index;\n }\n next = iterator.next();\n index++;\n }\n return -1;\n }\n\n includes(searchElement: T): boolean {\n const iterator = this.iterator();\n let next = iterator.next();\n while (!next.done) {\n if (next.value === searchElement) {\n return true;\n }\n next = iterator.next();\n }\n return false;\n }\n\n flatMap(callbackfn: (value: T) => U | Iterable): Stream {\n type FlatMapState = { this: S, iterator?: Iterator }\n return new StreamImpl(\n () => ({ this: this.startFn() }),\n (state) => {\n do {\n if (state.iterator) {\n const next = state.iterator.next();\n if (next.done) {\n state.iterator = undefined;\n } else {\n return next;\n }\n }\n const { done, value } = this.nextFn(state.this);\n if (!done) {\n const mapped = callbackfn(value);\n if (isIterable(mapped)) {\n state.iterator = mapped[Symbol.iterator]();\n } else {\n return { done: false, value: mapped };\n }\n }\n } while (state.iterator);\n return DONE_RESULT;\n }\n );\n }\n\n flat(depth?: D): FlatStream {\n if (depth === undefined) {\n depth = 1 as D;\n }\n if (depth <= 0) {\n return this as unknown as FlatStream;\n }\n const stream = depth > 1 ? this.flat(depth - 1) as unknown as StreamImpl : this;\n type FlatMapState = { this: S, iterator?: Iterator }\n return new StreamImpl(\n () => ({ this: stream.startFn() }),\n (state) => {\n do {\n if (state.iterator) {\n const next = state.iterator.next();\n if (next.done) {\n state.iterator = undefined;\n } else {\n return next;\n }\n }\n const { done, value } = stream.nextFn(state.this);\n if (!done) {\n if (isIterable(value)) {\n state.iterator = value[Symbol.iterator]() as Iterator;\n } else {\n return { done: false, value: value };\n }\n }\n } while (state.iterator);\n return DONE_RESULT;\n }\n ) as unknown as FlatStream;\n }\n\n head(): T | undefined {\n const iterator = this.iterator();\n const result = iterator.next();\n if (result.done) {\n return undefined;\n }\n return result.value;\n }\n\n tail(skipCount = 1): Stream {\n return new StreamImpl(\n () => {\n const state = this.startFn();\n for (let i = 0; i < skipCount; i++) {\n const next = this.nextFn(state);\n if (next.done) {\n return state;\n }\n }\n return state;\n },\n this.nextFn\n );\n }\n\n limit(maxSize: number): Stream {\n return new StreamImpl<{ size: number, state: S }, T>(\n () => ({ size: 0, state: this.startFn() }),\n state => {\n state.size++;\n if (state.size > maxSize) {\n return DONE_RESULT;\n }\n return this.nextFn(state.state);\n }\n );\n }\n\n distinct(by?: (element: T) => Key): Stream {\n const set = new Set();\n return this.filter(e => {\n const value = by ? by(e) : e;\n if (set.has(value)) {\n return false;\n } else {\n set.add(value);\n return true;\n }\n });\n }\n\n exclude(other: Iterable, key?: (element: T) => Key): Stream {\n const otherKeySet = new Set();\n for (const item of other) {\n const value = key ? key(item) : item;\n otherKeySet.add(value);\n }\n return this.filter(e => {\n const ownKey = key ? key(e) : e;\n return !otherKeySet.has(ownKey);\n });\n }\n}\n\nfunction toString(item: unknown): string {\n if (typeof item === 'string') {\n return item as string;\n }\n if (typeof item === 'undefined') {\n return 'undefined';\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof (item as any).toString === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (item as any).toString();\n }\n return Object.prototype.toString.call(item);\n}\n\nfunction isIterable(obj: unknown): obj is Iterable {\n return !!obj && typeof (obj as Iterable)[Symbol.iterator] === 'function';\n}\n\n/**\n * An empty stream of any type.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const EMPTY_STREAM: Stream = new StreamImpl(() => undefined, () => DONE_RESULT);\n\n/**\n * Use this `IteratorResult` when implementing a `StreamImpl` to indicate that there are no more elements in the stream.\n */\nexport const DONE_RESULT: IteratorReturnResult = Object.freeze({ done: true, value: undefined });\n\n/**\n * Create a stream from one or more iterables or array-likes.\n */\nexport function stream(...collections: Array | ArrayLike>): Stream {\n if (collections.length === 1) {\n const collection = collections[0];\n if (collection instanceof StreamImpl) {\n return collection as Stream;\n }\n if (isIterable(collection)) {\n return new StreamImpl, T>(\n () => collection[Symbol.iterator](),\n (iterator) => iterator.next()\n );\n }\n if (typeof collection.length === 'number') {\n return new StreamImpl<{ index: number }, T>(\n () => ({ index: 0 }),\n (state) => {\n if (state.index < collection.length) {\n return { done: false, value: collection[state.index++] };\n } else {\n return DONE_RESULT;\n }\n }\n );\n }\n }\n if (collections.length > 1) {\n type State = { collIndex: number, iterator?: Iterator, array?: ArrayLike, arrIndex: number };\n return new StreamImpl(\n () => ({ collIndex: 0, arrIndex: 0 }),\n (state) => {\n do {\n if (state.iterator) {\n const next = state.iterator.next();\n if (!next.done) {\n return next;\n }\n state.iterator = undefined;\n }\n if (state.array) {\n if (state.arrIndex < state.array.length) {\n return { done: false, value: state.array[state.arrIndex++] };\n }\n state.array = undefined;\n state.arrIndex = 0;\n }\n if (state.collIndex < collections.length) {\n const collection = collections[state.collIndex++];\n if (isIterable(collection)) {\n state.iterator = collection[Symbol.iterator]();\n } else if (collection && typeof collection.length === 'number') {\n state.array = collection;\n }\n }\n } while (state.iterator || state.array || state.collIndex < collections.length);\n return DONE_RESULT;\n }\n );\n }\n return EMPTY_STREAM;\n}\n\n/**\n * A tree iterator adds the ability to prune the current iteration.\n */\nexport interface TreeIterator extends IterableIterator {\n /**\n * Skip the whole subtree below the last returned element. The iteration continues as if that\n * element had no children.\n */\n prune(): void\n}\n\n/**\n * A tree stream is used to stream the elements of a tree, for example an AST or CST.\n */\nexport interface TreeStream extends Stream {\n iterator(): TreeIterator\n}\n\n/**\n * The default implementation of `TreeStream` takes a root element and a function that computes the\n * children of its argument. Whether the root node included in the stream is controlled with the\n * `includeRoot` option, which defaults to `false`.\n */\nexport class TreeStreamImpl\n extends StreamImpl<{ iterators: Array>, pruned: boolean }, T>\n implements TreeStream {\n\n constructor(root: T, children: (node: T) => Iterable, options?: { includeRoot?: boolean }) {\n super(\n () => ({\n iterators: options?.includeRoot ? [[root][Symbol.iterator]()] : [children(root)[Symbol.iterator]()],\n pruned: false\n }),\n state => {\n if (state.pruned) {\n state.iterators.pop();\n state.pruned = false;\n }\n while (state.iterators.length > 0) {\n const iterator = state.iterators[state.iterators.length - 1];\n const next = iterator.next();\n if (next.done) {\n state.iterators.pop();\n } else {\n state.iterators.push(children(next.value)[Symbol.iterator]());\n return next;\n }\n }\n return DONE_RESULT;\n }\n );\n }\n\n override iterator(): TreeIterator {\n const iterator = {\n state: this.startFn(),\n next: () => this.nextFn(iterator.state),\n prune: () => {\n iterator.state.pruned = true;\n },\n [Symbol.iterator]: () => iterator\n };\n return iterator;\n }\n}\n\n/**\n * A set of utility functions that reduce a stream to a single value.\n */\nexport namespace Reduction {\n\n /**\n * Compute the sum of a number stream.\n */\n export function sum(stream: Stream): number {\n return stream.reduce((a, b) => a + b, 0);\n }\n\n /**\n * Compute the product of a number stream.\n */\n export function product(stream: Stream): number {\n return stream.reduce((a, b) => a * b, 0);\n }\n\n /**\n * Compute the minimum of a number stream. Returns `undefined` if the stream is empty.\n */\n export function min(stream: Stream): number | undefined {\n return stream.reduce((a, b) => Math.min(a, b));\n }\n\n /**\n * Compute the maximum of a number stream. Returns `undefined` if the stream is empty.\n */\n export function max(stream: Stream): number | undefined {\n return stream.reduce((a, b) => Math.max(a, b));\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { IToken } from '@chevrotain/types';\nimport type { Range } from 'vscode-languageserver-types';\nimport type { CstNode, CompositeCstNode, LeafCstNode } from '../syntax-tree.js';\nimport type { DocumentSegment } from '../workspace/documents.js';\nimport type { Stream, TreeStream } from './stream.js';\nimport { isCompositeCstNode, isLeafCstNode, isRootCstNode } from '../syntax-tree.js';\nimport { TreeStreamImpl } from './stream.js';\n\n/**\n * Create a stream of all CST nodes that are directly and indirectly contained in the given root node,\n * including the root node itself.\n */\nexport function streamCst(node: CstNode): TreeStream {\n return new TreeStreamImpl(node, element => {\n if (isCompositeCstNode(element)) {\n return element.content;\n } else {\n return [];\n }\n }, { includeRoot: true });\n}\n\n/**\n * Create a stream of all leaf nodes that are directly and indirectly contained in the given root node.\n */\nexport function flattenCst(node: CstNode): Stream {\n return streamCst(node).filter(isLeafCstNode);\n}\n\n/**\n * Determines whether the specified cst node is a child of the specified parent node.\n */\nexport function isChildNode(child: CstNode, parent: CstNode): boolean {\n while (child.container) {\n child = child.container;\n if (child === parent) {\n return true;\n }\n }\n return false;\n}\n\nexport function tokenToRange(token: IToken): Range {\n // Chevrotain uses 1-based indices everywhere\n // So we subtract 1 from every value to align with the LSP\n return {\n start: {\n character: token.startColumn! - 1,\n line: token.startLine! - 1\n },\n end: {\n character: token.endColumn!, // endColumn uses the correct index\n line: token.endLine! - 1\n }\n };\n}\n\nexport function toDocumentSegment(node: CstNode): DocumentSegment;\nexport function toDocumentSegment(node?: CstNode): DocumentSegment | undefined;\nexport function toDocumentSegment(node?: CstNode): DocumentSegment | undefined {\n if (!node) {\n return undefined;\n }\n const { offset, end, range } = node;\n return {\n range,\n offset,\n end,\n length: end - offset\n };\n}\n\nexport enum RangeComparison {\n Before = 0,\n After = 1,\n OverlapFront = 2,\n OverlapBack = 3,\n Inside = 4\n}\n\nexport function compareRange(range: Range, to: Range): RangeComparison {\n if (range.end.line < to.start.line || (range.end.line === to.start.line && range.end.character < range.start.character)) {\n return RangeComparison.Before;\n } else if (range.start.line > to.end.line || (range.start.line === to.end.line && range.start.character > to.end.character)) {\n return RangeComparison.After;\n }\n const startInside = range.start.line > to.start.line || (range.start.line === to.start.line && range.start.character >= to.start.character);\n const endInside = range.end.line < to.end.line || (range.end.line === to.end.line && range.end.character <= to.end.character);\n if (startInside && endInside) {\n return RangeComparison.Inside;\n } else if (startInside) {\n return RangeComparison.OverlapBack;\n } else {\n return RangeComparison.OverlapFront;\n }\n}\n\nexport function inRange(range: Range, to: Range): boolean {\n const comparison = compareRange(range, to);\n return comparison > RangeComparison.After;\n}\n\n// The \\p{L} regex matches any unicode letter character, i.e. characters from non-english alphabets\n// Together with \\w it matches any kind of character which can commonly appear in IDs\nexport const DefaultNameRegexp = /^[\\w\\p{L}]$/u;\n\n/**\n * Performs `findLeafNodeAtOffset` with a minor difference: When encountering a character that matches the `nameRegexp` argument,\n * it will instead return the leaf node at the `offset - 1` position.\n *\n * For LSP services, users expect that the declaration of an element is available if the cursor is directly after the element.\n */\nexport function findDeclarationNodeAtOffset(cstNode: CstNode | undefined, offset: number, nameRegexp = DefaultNameRegexp): LeafCstNode | undefined {\n if (cstNode) {\n if (offset > 0) {\n const localOffset = offset - cstNode.offset;\n const textAtOffset = cstNode.text.charAt(localOffset);\n if (!nameRegexp.test(textAtOffset)) {\n offset--;\n }\n }\n return findLeafNodeAtOffset(cstNode, offset);\n }\n return undefined;\n}\n\nexport function findCommentNode(cstNode: CstNode | undefined, commentNames: string[]): CstNode | undefined {\n if (cstNode) {\n const previous = getPreviousNode(cstNode, true);\n if (previous && isCommentNode(previous, commentNames)) {\n return previous;\n }\n if (isRootCstNode(cstNode)) {\n // Go from the first non-hidden node through all nodes in reverse order\n // We do this to find the comment node which directly precedes the root node\n const endIndex = cstNode.content.findIndex(e => !e.hidden);\n for (let i = endIndex - 1; i >= 0; i--) {\n const child = cstNode.content[i];\n if (isCommentNode(child, commentNames)) {\n return child;\n }\n }\n }\n }\n return undefined;\n}\n\nexport function isCommentNode(cstNode: CstNode, commentNames: string[]): boolean {\n return isLeafCstNode(cstNode) && commentNames.includes(cstNode.tokenType.name);\n}\n\n/**\n * Finds the leaf CST node at the specified 0-based string offset.\n * Note that the given offset will be within the range of the returned leaf node.\n *\n * If the offset does not point to a CST node (but just white space), this method will return `undefined`.\n *\n * @param node The CST node to search through.\n * @param offset The specified offset.\n * @returns The CST node at the specified offset.\n */\nexport function findLeafNodeAtOffset(node: CstNode, offset: number): LeafCstNode | undefined {\n if (isLeafCstNode(node)) {\n return node;\n } else if (isCompositeCstNode(node)) {\n const searchResult = binarySearch(node, offset, false);\n if (searchResult) {\n return findLeafNodeAtOffset(searchResult, offset);\n }\n }\n return undefined;\n}\n\n/**\n * Finds the leaf CST node at the specified 0-based string offset.\n * If no CST node exists at the specified position, it will return the leaf node before it.\n *\n * If there is no leaf node before the specified offset, this method will return `undefined`.\n *\n * @param node The CST node to search through.\n * @param offset The specified offset.\n * @returns The CST node closest to the specified offset.\n */\nexport function findLeafNodeBeforeOffset(node: CstNode, offset: number): LeafCstNode | undefined {\n if (isLeafCstNode(node)) {\n return node;\n } else if (isCompositeCstNode(node)) {\n const searchResult = binarySearch(node, offset, true);\n if (searchResult) {\n return findLeafNodeBeforeOffset(searchResult, offset);\n }\n }\n return undefined;\n}\n\nfunction binarySearch(node: CompositeCstNode, offset: number, closest: boolean): CstNode | undefined {\n let left = 0;\n let right = node.content.length - 1;\n let closestNode: CstNode | undefined = undefined;\n\n while (left <= right) {\n const middle = Math.floor((left + right) / 2);\n const middleNode = node.content[middle];\n\n if (middleNode.offset <= offset && middleNode.end > offset) {\n // Found an exact match\n return middleNode;\n }\n\n if (middleNode.end <= offset) {\n // Update the closest node (less than offset) and move to the right half\n closestNode = closest ? middleNode : undefined;\n left = middle + 1;\n } else {\n // Move to the left half\n right = middle - 1;\n }\n }\n\n return closestNode;\n}\n\nexport function getPreviousNode(node: CstNode, hidden = true): CstNode | undefined {\n while (node.container) {\n const parent = node.container;\n let index = parent.content.indexOf(node);\n while (index > 0) {\n index--;\n const previous = parent.content[index];\n if (hidden || !previous.hidden) {\n return previous;\n }\n }\n node = parent;\n }\n return undefined;\n}\n\nexport function getNextNode(node: CstNode, hidden = true): CstNode | undefined {\n while (node.container) {\n const parent = node.container;\n let index = parent.content.indexOf(node);\n const last = parent.content.length - 1;\n while (index < last) {\n index++;\n const next = parent.content[index];\n if (hidden || !next.hidden) {\n return next;\n }\n }\n node = parent;\n }\n return undefined;\n}\n\nexport function getStartlineNode(node: CstNode): CstNode {\n if (node.range.start.character === 0) {\n return node;\n }\n const line = node.range.start.line;\n let last = node;\n let index: number | undefined;\n while (node.container) {\n const parent = node.container;\n const selfIndex = index ?? parent.content.indexOf(node);\n if (selfIndex === 0) {\n node = parent;\n index = undefined;\n } else {\n index = selfIndex - 1;\n node = parent.content[index];\n }\n if (node.range.start.line !== line) {\n break;\n }\n last = node;\n }\n return last;\n}\n\nexport function getInteriorNodes(start: CstNode, end: CstNode): CstNode[] {\n const commonParent = getCommonParent(start, end);\n if (!commonParent) {\n return [];\n }\n return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b);\n}\n\nfunction getCommonParent(a: CstNode, b: CstNode): CommonParent | undefined {\n const aParents = getParentChain(a);\n const bParents = getParentChain(b);\n let current: CommonParent | undefined;\n for (let i = 0; i < aParents.length && i < bParents.length; i++) {\n const aParent = aParents[i];\n const bParent = bParents[i];\n if (aParent.parent === bParent.parent) {\n current = {\n parent: aParent.parent,\n a: aParent.index,\n b: bParent.index\n };\n } else {\n break;\n }\n }\n return current;\n}\n\ninterface CommonParent {\n parent: CompositeCstNode\n a: number\n b: number\n}\n\nfunction getParentChain(node: CstNode): ParentLink[] {\n const chain: ParentLink[] = [];\n while (node.container) {\n const parent = node.container;\n const index = parent.content.indexOf(node);\n chain.push({\n parent,\n index\n });\n node = parent;\n }\n return chain.reverse();\n}\n\ninterface ParentLink {\n parent: CompositeCstNode\n index: number\n}\n", "/******************************************************************************\n * Copyright 2021-2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { assertUnreachable } from '../utils/errors.js';\nimport * as ast from '../languages/generated/ast.js';\nimport type { AstNode, CstNode } from '../syntax-tree.js';\nimport { isCompositeCstNode } from '../syntax-tree.js';\nimport { getContainerOfType, streamAllContents } from './ast-utils.js';\nimport { streamCst } from './cst-utils.js';\nimport { escapeRegExp } from './regexp-utils.js';\n\n/**\n * Returns the entry rule of the given grammar, if any. If the grammar file does not contain an entry rule,\n * the result is `undefined`.\n */\nexport function getEntryRule(grammar: ast.Grammar): ast.ParserRule | undefined {\n return grammar.rules.find(e => ast.isParserRule(e) && e.entry) as ast.ParserRule;\n}\n\n/**\n * Returns all hidden terminal rules of the given grammar, if any.\n */\nexport function getHiddenRules(grammar: ast.Grammar) {\n return grammar.rules.filter((e): e is ast.TerminalRule => ast.isTerminalRule(e) && e.hidden);\n}\n\n/**\n * Returns all rules that can be reached from the topmost rules of the specified grammar (entry and hidden terminal rules).\n *\n * @param grammar The grammar that contains all rules\n * @param allTerminals Whether or not to include terminals that are referenced only by other terminals\n * @returns A list of referenced parser and terminal rules. If the grammar contains no entry rule,\n * this function returns all rules of the specified grammar.\n */\nexport function getAllReachableRules(grammar: ast.Grammar, allTerminals: boolean): Set {\n const ruleNames = new Set();\n const entryRule = getEntryRule(grammar);\n if (!entryRule) {\n return new Set(grammar.rules);\n }\n\n const topMostRules = [entryRule as ast.AbstractRule].concat(getHiddenRules(grammar));\n for (const rule of topMostRules) {\n ruleDfs(rule, ruleNames, allTerminals);\n }\n\n const rules = new Set();\n for (const rule of grammar.rules) {\n if (ruleNames.has(rule.name) || (ast.isTerminalRule(rule) && rule.hidden)) {\n rules.add(rule);\n }\n }\n return rules;\n}\n\nfunction ruleDfs(rule: ast.AbstractRule, visitedSet: Set, allTerminals: boolean): void {\n visitedSet.add(rule.name);\n streamAllContents(rule).forEach(node => {\n if (ast.isRuleCall(node) || (allTerminals && ast.isTerminalRuleCall(node))) {\n const refRule = node.rule.ref;\n if (refRule && !visitedSet.has(refRule.name)) {\n ruleDfs(refRule, visitedSet, allTerminals);\n }\n }\n });\n}\n\n/**\n * Determines the grammar expression used to parse a cross-reference (usually a reference to a terminal rule).\n * A cross-reference can declare this expression explicitly in the form `[Type : Terminal]`, but if `Terminal`\n * is omitted, this function attempts to infer it from the name of the referenced `Type` (using `findNameAssignment`).\n *\n * Returns the grammar expression used to parse the given cross-reference, or `undefined` if it is not declared\n * and cannot be inferred.\n */\nexport function getCrossReferenceTerminal(crossRef: ast.CrossReference): ast.AbstractElement | undefined {\n if (crossRef.terminal) {\n return crossRef.terminal;\n } else if (crossRef.type.ref) {\n const nameAssigment = findNameAssignment(crossRef.type.ref);\n return nameAssigment?.terminal;\n }\n return undefined;\n}\n\n/**\n * Determines whether the given terminal rule represents a comment. This is true if the rule is marked\n * as `hidden` and it does not match white space. This means every hidden token (i.e. excluded from the AST)\n * that contains visible characters is considered a comment.\n */\nexport function isCommentTerminal(terminalRule: ast.TerminalRule): boolean {\n return terminalRule.hidden && !terminalRegex(terminalRule).test(' ');\n}\n\n/**\n * Find all CST nodes within the given node that contribute to the specified property.\n *\n * @param node A CST node in which to look for property assignments. If this is undefined, the result is an empty array.\n * @param property A property name of the constructed AST node. If this is undefined, the result is an empty array.\n */\nexport function findNodesForProperty(node: CstNode | undefined, property: string | undefined): CstNode[] {\n if (!node || !property) {\n return [];\n }\n return findNodesForPropertyInternal(node, property, node.astNode, true);\n}\n\n/**\n * Find a single CST node within the given node that contributes to the specified property.\n *\n * @param node A CST node in which to look for property assignments. If this is undefined, the result is `undefined`.\n * @param property A property name of the constructed AST node. If this is undefined, the result is `undefined`.\n * @param index If no index is specified or the index is less than zero, the first found node is returned. If the\n * specified index exceeds the number of assignments to the property, the last found node is returned. Otherwise,\n * the node with the specified index is returned.\n */\nexport function findNodeForProperty(node: CstNode | undefined, property: string | undefined, index?: number): CstNode | undefined {\n if (!node || !property) {\n return undefined;\n }\n const nodes = findNodesForPropertyInternal(node, property, node.astNode, true);\n if (nodes.length === 0) {\n return undefined;\n }\n if (index !== undefined) {\n index = Math.max(0, Math.min(index, nodes.length - 1));\n } else {\n index = 0;\n }\n return nodes[index];\n}\n\nfunction findNodesForPropertyInternal(node: CstNode, property: string, element: AstNode | undefined, first: boolean): CstNode[] {\n if (!first) {\n const nodeFeature = getContainerOfType(node.grammarSource, ast.isAssignment);\n if (nodeFeature && nodeFeature.feature === property) {\n return [node];\n }\n }\n if (isCompositeCstNode(node) && node.astNode === element) {\n return node.content.flatMap(e => findNodesForPropertyInternal(e, property, element, false));\n }\n return [];\n}\n\n/**\n * Find all CST nodes within the given node that correspond to the specified keyword.\n *\n * @param node A CST node in which to look for keywords. If this is undefined, the result is an empty array.\n * @param keyword A keyword as specified in the grammar.\n */\nexport function findNodesForKeyword(node: CstNode | undefined, keyword: string): CstNode[] {\n if (!node) {\n return [];\n }\n return findNodesForKeywordInternal(node, keyword, node?.astNode);\n}\n\n/**\n * Find a single CST node within the given node that corresponds to the specified keyword.\n *\n * @param node A CST node in which to look for keywords. If this is undefined, the result is `undefined`.\n * @param keyword A keyword as specified in the grammar.\n * @param index If no index is specified or the index is less than zero, the first found node is returned. If the\n * specified index exceeds the number of keyword occurrences, the last found node is returned. Otherwise,\n * the node with the specified index is returned.\n */\nexport function findNodeForKeyword(node: CstNode | undefined, keyword: string, index?: number): CstNode | undefined {\n if (!node) {\n return undefined;\n }\n const nodes = findNodesForKeywordInternal(node, keyword, node?.astNode);\n if (nodes.length === 0) {\n return undefined;\n }\n if (index !== undefined) {\n index = Math.max(0, Math.min(index, nodes.length - 1));\n } else {\n index = 0;\n }\n return nodes[index];\n}\n\nexport function findNodesForKeywordInternal(node: CstNode, keyword: string, element: AstNode | undefined): CstNode[] {\n if (node.astNode !== element) {\n return [];\n }\n if (ast.isKeyword(node.grammarSource) && node.grammarSource.value === keyword) {\n return [node];\n }\n const treeIterator = streamCst(node).iterator();\n let result: IteratorResult;\n const keywordNodes: CstNode[] = [];\n do {\n result = treeIterator.next();\n if (!result.done) {\n const childNode = result.value;\n if (childNode.astNode === element) {\n if (ast.isKeyword(childNode.grammarSource) && childNode.grammarSource.value === keyword) {\n keywordNodes.push(childNode);\n }\n } else {\n treeIterator.prune();\n }\n }\n } while (!result.done);\n return keywordNodes;\n}\n\n/**\n * If the given CST node was parsed in the context of a property assignment, the respective `Assignment` grammar\n * node is returned. If no assignment is found, the result is `undefined`.\n *\n * @param cstNode A CST node for which to find a property assignment.\n */\nexport function findAssignment(cstNode: CstNode): ast.Assignment | undefined {\n const astNode = cstNode.astNode;\n // Only search until the ast node of the parent cst node is no longer the original ast node\n // This would make us jump to a preceding rule call, which contains only unrelated assignments\n while (astNode === cstNode.container?.astNode) {\n const assignment = getContainerOfType(cstNode.grammarSource, ast.isAssignment);\n if (assignment) {\n return assignment;\n }\n cstNode = cstNode.container;\n }\n return undefined;\n}\n\n/**\n * Find an assignment to the `name` property for the given grammar type. This requires the `type` to be inferred\n * from a parser rule, and that rule must contain an assignment to the `name` property. In all other cases,\n * this function returns `undefined`.\n */\nexport function findNameAssignment(type: ast.AbstractType): ast.Assignment | undefined {\n let startNode: AstNode = type;\n if (ast.isInferredType(startNode)) {\n // for inferred types, the location to start searching for the name-assignment is different\n if (ast.isAction(startNode.$container)) {\n // a type which is explicitly inferred by an action: investigate the sibbling of the Action node, i.e. start searching at the Action's parent\n startNode = startNode.$container.$container!;\n } else if (ast.isParserRule(startNode.$container)) {\n // investigate the parser rule with the explicitly inferred type\n startNode = startNode.$container;\n } else {\n assertUnreachable(startNode.$container);\n }\n }\n return findNameAssignmentInternal(type, startNode, new Map());\n}\n\nfunction findNameAssignmentInternal(type: ast.AbstractType, startNode: AstNode, cache: Map): ast.Assignment | undefined {\n // the cache is only required to prevent infinite loops\n function go(node: AstNode, refType: ast.AbstractType): ast.Assignment | undefined {\n let childAssignment: ast.Assignment | undefined = undefined;\n const parentAssignment = getContainerOfType(node, ast.isAssignment);\n // No parent assignment implies unassigned rule call\n if (!parentAssignment) {\n childAssignment = findNameAssignmentInternal(refType, refType, cache);\n }\n cache.set(type, childAssignment);\n return childAssignment;\n }\n\n if (cache.has(type)) {\n return cache.get(type);\n }\n cache.set(type, undefined);\n for (const node of streamAllContents(startNode)) {\n if (ast.isAssignment(node) && node.feature.toLowerCase() === 'name') {\n cache.set(type, node);\n return node;\n } else if (ast.isRuleCall(node) && ast.isParserRule(node.rule.ref)) {\n return go(node, node.rule.ref);\n } else if (ast.isSimpleType(node) && node.typeRef?.ref) {\n return go(node, node.typeRef.ref);\n }\n }\n return undefined;\n}\n\nexport function getActionAtElement(element: ast.AbstractElement): ast.Action | undefined {\n const parent = element.$container;\n if (ast.isGroup(parent)) {\n const elements = parent.elements;\n const index = elements.indexOf(element);\n for (let i = index - 1; i >= 0; i--) {\n const item = elements[i];\n if (ast.isAction(item)) {\n return item;\n } else {\n const action = streamAllContents(elements[i]).find(ast.isAction);\n if (action) {\n return action;\n }\n }\n }\n }\n if (ast.isAbstractElement(parent)) {\n return getActionAtElement(parent);\n } else {\n return undefined;\n }\n}\n\nexport type Cardinality = '?' | '*' | '+' | undefined;\nexport type Operator = '=' | '+=' | '?=' | undefined;\n\nexport function isOptionalCardinality(cardinality?: Cardinality, element?: ast.AbstractElement): boolean {\n return cardinality === '?' || cardinality === '*' || (ast.isGroup(element) && Boolean(element.guardCondition));\n}\n\nexport function isArrayCardinality(cardinality?: Cardinality): boolean {\n return cardinality === '*' || cardinality === '+';\n}\n\nexport function isArrayOperator(operator?: Operator): boolean {\n return operator === '+=';\n}\n\n/**\n * Determines whether the given parser rule is a _data type rule_, meaning that it has a\n * primitive return type like `number`, `boolean`, etc.\n */\nexport function isDataTypeRule(rule: ast.ParserRule): boolean {\n return isDataTypeRuleInternal(rule, new Set());\n}\n\nfunction isDataTypeRuleInternal(rule: ast.ParserRule, visited: Set): boolean {\n if (visited.has(rule)) {\n return true;\n } else {\n visited.add(rule);\n }\n for (const node of streamAllContents(rule)) {\n if (ast.isRuleCall(node)) {\n if (!node.rule.ref) {\n // RuleCall to unresolved rule. Don't assume `rule` is a DataType rule.\n return false;\n }\n if (ast.isParserRule(node.rule.ref) && !isDataTypeRuleInternal(node.rule.ref, visited)) {\n return false;\n }\n } else if (ast.isAssignment(node)) {\n return false;\n } else if (ast.isAction(node)) {\n return false;\n }\n }\n return Boolean(rule.definition);\n}\n\nexport function isDataType(type: ast.Type): boolean {\n return isDataTypeInternal(type.type, new Set());\n}\n\nfunction isDataTypeInternal(type: ast.TypeDefinition, visited: Set): boolean {\n if (visited.has(type)) {\n return true;\n } else {\n visited.add(type);\n }\n if (ast.isArrayType(type)) {\n return false;\n } else if (ast.isReferenceType(type)) {\n return false;\n } else if (ast.isUnionType(type)) {\n return type.types.every(e => isDataTypeInternal(e, visited));\n } else if (ast.isSimpleType(type)) {\n if (type.primitiveType !== undefined) {\n return true;\n } else if (type.stringType !== undefined) {\n return true;\n } else if (type.typeRef !== undefined) {\n const ref = type.typeRef.ref;\n if (ast.isType(ref)) {\n return isDataTypeInternal(ref.type, visited);\n } else {\n return false;\n }\n } else {\n return false;\n }\n } else {\n return false;\n }\n}\n\nexport function getExplicitRuleType(rule: ast.ParserRule): string | undefined {\n if (rule.inferredType) {\n return rule.inferredType.name;\n } else if (rule.dataType) {\n return rule.dataType;\n } else if (rule.returnType) {\n const refType = rule.returnType.ref;\n if(refType) {\n // check if we need to check Action as return type\n if (ast.isParserRule(refType)) {\n return refType.name;\n } else if(ast.isInterface(refType) || ast.isType(refType)) {\n return refType.name;\n }\n }\n }\n return undefined;\n}\n\nexport function getTypeName(type: ast.AbstractType | ast.Action): string {\n if (ast.isParserRule(type)) {\n return isDataTypeRule(type) ? type.name : getExplicitRuleType(type) ?? type.name;\n } else if (ast.isInterface(type) || ast.isType(type) || ast.isReturnType(type)) {\n return type.name;\n } else if (ast.isAction(type)) {\n const actionType = getActionType(type);\n if (actionType) {\n return actionType;\n }\n } else if (ast.isInferredType(type)) {\n return type.name;\n }\n throw new Error('Cannot get name of Unknown Type');\n}\n\nexport function getActionType(action: ast.Action): string | undefined {\n if (action.inferredType) {\n return action.inferredType.name;\n } else if (action.type?.ref) {\n return getTypeName(action.type.ref);\n }\n return undefined; // not inferring and not referencing a valid type\n}\n\nexport function getRuleType(rule: ast.AbstractRule): string {\n if (ast.isTerminalRule(rule)) {\n return rule.type?.name ?? 'string';\n } else {\n return isDataTypeRule(rule) ? rule.name : getExplicitRuleType(rule) ?? rule.name;\n }\n}\n\nexport function terminalRegex(terminalRule: ast.TerminalRule): RegExp {\n const flags: Flags = {\n s: false,\n i: false,\n u: false\n };\n const source = abstractElementToRegex(terminalRule.definition, flags);\n const flagText = Object.entries(flags).filter(([, value]) => value).map(([name]) => name).join('');\n return new RegExp(source, flagText);\n}\n\n// Using [\\s\\S]* allows to match everything, compared to . which doesn't match line terminators\nconst WILDCARD = /[\\s\\S]/.source;\n\ntype Flags = {\n s: boolean;\n i: boolean;\n u: boolean;\n}\n\nfunction abstractElementToRegex(element: ast.AbstractElement, flags?: Flags): string {\n if (ast.isTerminalAlternatives(element)) {\n return terminalAlternativesToRegex(element);\n } else if (ast.isTerminalGroup(element)) {\n return terminalGroupToRegex(element);\n } else if (ast.isCharacterRange(element)) {\n return characterRangeToRegex(element);\n } else if (ast.isTerminalRuleCall(element)) {\n const rule = element.rule.ref;\n if (!rule) {\n throw new Error('Missing rule reference.');\n }\n return withCardinality(abstractElementToRegex(rule.definition), {\n cardinality: element.cardinality,\n lookahead: element.lookahead\n });\n } else if (ast.isNegatedToken(element)) {\n return negateTokenToRegex(element);\n } else if (ast.isUntilToken(element)) {\n return untilTokenToRegex(element);\n } else if (ast.isRegexToken(element)) {\n const lastSlash = element.regex.lastIndexOf('/');\n const source = element.regex.substring(1, lastSlash);\n const regexFlags = element.regex.substring(lastSlash + 1);\n if (flags) {\n flags.i = regexFlags.includes('i');\n flags.s = regexFlags.includes('s');\n flags.u = regexFlags.includes('u');\n }\n return withCardinality(source, {\n cardinality: element.cardinality,\n lookahead: element.lookahead,\n wrap: false\n });\n } else if (ast.isWildcard(element)) {\n return withCardinality(WILDCARD, {\n cardinality: element.cardinality,\n lookahead: element.lookahead\n });\n } else {\n throw new Error(`Invalid terminal element: ${element?.$type}`);\n }\n}\n\nfunction terminalAlternativesToRegex(alternatives: ast.TerminalAlternatives): string {\n return withCardinality(alternatives.elements.map(e => abstractElementToRegex(e)).join('|'), {\n cardinality: alternatives.cardinality,\n lookahead: alternatives.lookahead\n });\n}\n\nfunction terminalGroupToRegex(group: ast.TerminalGroup): string {\n return withCardinality(group.elements.map(e => abstractElementToRegex(e)).join(''), {\n cardinality: group.cardinality,\n lookahead: group.lookahead\n });\n}\n\nfunction untilTokenToRegex(until: ast.UntilToken): string {\n return withCardinality(`${WILDCARD}*?${abstractElementToRegex(until.terminal)}`, {\n cardinality: until.cardinality,\n lookahead: until.lookahead\n });\n}\n\nfunction negateTokenToRegex(negate: ast.NegatedToken): string {\n return withCardinality(`(?!${abstractElementToRegex(negate.terminal)})${WILDCARD}*?`, {\n cardinality: negate.cardinality,\n lookahead: negate.lookahead\n });\n}\n\nfunction characterRangeToRegex(range: ast.CharacterRange): string {\n if (range.right) {\n return withCardinality(`[${keywordToRegex(range.left)}-${keywordToRegex(range.right)}]`, {\n cardinality: range.cardinality,\n lookahead: range.lookahead,\n wrap: false\n });\n }\n return withCardinality(keywordToRegex(range.left), {\n cardinality: range.cardinality,\n lookahead: range.lookahead,\n wrap: false\n });\n}\n\nfunction keywordToRegex(keyword: ast.Keyword): string {\n return escapeRegExp(keyword.value);\n}\n\nfunction withCardinality(regex: string, options: {\n cardinality?: string\n wrap?: boolean\n lookahead?: string\n}): string {\n if (options.wrap !== false || options.lookahead) {\n regex = `(${options.lookahead ?? ''}${regex})`;\n }\n if (options.cardinality) {\n return `${regex}${options.cardinality}`;\n }\n return regex;\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CstNode } from '../syntax-tree.js';\n\nexport class ErrorWithLocation extends Error {\n constructor(node: CstNode | undefined, message: string) {\n super(node ? `${message} at ${node.range.start.line}:${node.range.start.character}` : message);\n }\n}\n\nexport function assertUnreachable(_: never): never {\n throw new Error('Error! The input value was not handled.');\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Set, Group, Character, IRegExpAST } from '@chevrotain/regexp-to-ast';\nimport { RegExpParser, BaseRegExpVisitor } from '@chevrotain/regexp-to-ast';\n\nexport const NEWLINE_REGEXP = /\\r?\\n/gm;\n\nconst regexpParser = new RegExpParser();\n\n/**\n * This class is in charge of heuristically identifying start/end tokens of terminals.\n *\n * The way this works is by doing the following:\n * 1. Traverse the regular expression in the \"start state\"\n * 2. Add any encountered sets/single characters to the \"start regexp\"\n * 3. Once we encounter any variable-length content (i.e. with quantifiers such as +/?/*), we enter the \"end state\"\n * 4. In the end state, any sets/single characters are added to an \"end stack\".\n * 5. If we re-encounter any variable-length content we reset the end stack\n * 6. We continue visiting the regex until the end, reseting the end stack and rebuilding it as necessary\n *\n * After traversing a regular expression the `startRegexp/endRegexp` properties allow access to the stored start/end of the terminal\n */\nclass TerminalRegExpVisitor extends BaseRegExpVisitor {\n\n private isStarting = true;\n startRegexp: string;\n private endRegexpStack: string[] = [];\n multiline = false;\n regex: string;\n\n get endRegex(): string {\n return this.endRegexpStack.join('');\n }\n\n reset(regex: string): void {\n this.multiline = false;\n this.regex = regex;\n this.startRegexp = '';\n this.isStarting = true;\n this.endRegexpStack = [];\n }\n\n override visitGroup(node: Group) {\n if (node.quantifier) {\n this.isStarting = false;\n this.endRegexpStack = [];\n }\n }\n\n override visitCharacter(node: Character): void {\n const char = String.fromCharCode(node.value);\n if (!this.multiline && char === '\\n') {\n this.multiline = true;\n }\n if (node.quantifier) {\n this.isStarting = false;\n this.endRegexpStack = [];\n } else {\n const escapedChar = escapeRegExp(char);\n this.endRegexpStack.push(escapedChar);\n if (this.isStarting) {\n this.startRegexp += escapedChar;\n }\n }\n }\n\n override visitSet(node: Set): void {\n if (!this.multiline) {\n const set = this.regex.substring(node.loc.begin, node.loc.end);\n const regex = new RegExp(set);\n this.multiline = Boolean('\\n'.match(regex));\n }\n if (node.quantifier) {\n this.isStarting = false;\n this.endRegexpStack = [];\n } else {\n const set = this.regex.substring(node.loc.begin, node.loc.end);\n this.endRegexpStack.push(set);\n if (this.isStarting) {\n this.startRegexp += set;\n }\n }\n }\n\n override visitChildren(node: IRegExpAST): void {\n if (node.type === 'Group') {\n // Ignore children of groups with quantifier (+/*/?)\n // These groups are unrelated to start/end tokens of terminals\n const group = node as Group;\n if (group.quantifier) {\n return;\n }\n }\n super.visitChildren(node);\n }\n}\n\nconst visitor = new TerminalRegExpVisitor();\n\nexport function getTerminalParts(regexp: RegExp | string): Array<{ start: string, end: string }> {\n try {\n if (typeof regexp !== 'string') {\n regexp = regexp.source;\n }\n regexp = `/${regexp}/`;\n const pattern = regexpParser.pattern(regexp);\n const parts: Array<{ start: string, end: string }> = [];\n for (const alternative of pattern.value.value) {\n visitor.reset(regexp);\n visitor.visit(alternative);\n parts.push({\n start: visitor.startRegexp,\n end: visitor.endRegex\n });\n }\n return parts;\n } catch {\n return [];\n }\n}\n\nexport function isMultilineComment(regexp: RegExp | string): boolean {\n try {\n if (typeof regexp === 'string') {\n regexp = new RegExp(regexp);\n }\n regexp = regexp.toString();\n visitor.reset(regexp);\n // Parsing the pattern might fail (since it's user code)\n visitor.visit(regexpParser.pattern(regexp));\n return visitor.multiline;\n } catch {\n return false;\n }\n}\n\nexport function isWhitespace(value: RegExp | string): boolean {\n const regexp = typeof value === 'string' ? new RegExp(value) : value;\n return regexp.test(' ');\n}\n\nexport function escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function getCaseInsensitivePattern(keyword: string): string {\n return Array.prototype.map.call(keyword, letter =>\n /\\w/.test(letter) ? `[${letter.toLowerCase()}${letter.toUpperCase()}]` : escapeRegExp(letter)\n ).join('');\n}\n\n/**\n * Determines whether the given input has a partial match with the specified regex.\n * @param regex The regex to partially match against\n * @param input The input string\n * @returns Whether any match exists.\n */\nexport function partialMatches(regex: RegExp | string, input: string): boolean {\n const partial = partialRegExp(regex);\n const match = input.match(partial);\n return !!match && match[0].length > 0;\n}\n\n/**\n * Builds a partial regex from the input regex. A partial regex is able to match incomplete input strings. E.g.\n * a partial regex constructed from `/ab/` is able to match the string `a` without needing a following `b` character. However it won't match `b` alone.\n * @param regex The input regex to be converted.\n * @returns A partial regex constructed from the input regex.\n */\nexport function partialRegExp(regex: RegExp | string): RegExp {\n if (typeof regex === 'string') {\n regex = new RegExp(regex);\n }\n const re = regex, source = regex.source;\n let i = 0;\n\n function process() {\n let result = '',\n tmp;\n\n function appendRaw(nbChars: number) {\n result += source.substr(i, nbChars);\n i += nbChars;\n }\n\n function appendOptional(nbChars: number) {\n result += '(?:' + source.substr(i, nbChars) + '|$)';\n i += nbChars;\n }\n\n while (i < source.length) {\n switch (source[i]) {\n case '\\\\':\n switch (source[i + 1]) {\n case 'c':\n appendOptional(3);\n break;\n case 'x':\n appendOptional(4);\n break;\n case 'u':\n if (re.unicode) {\n if (source[i + 2] === '{') {\n appendOptional(source.indexOf('}', i) - i + 1);\n } else {\n appendOptional(6);\n }\n } else {\n appendOptional(2);\n }\n break;\n case 'p':\n case 'P':\n if (re.unicode) {\n appendOptional(source.indexOf('}', i) - i + 1);\n } else {\n appendOptional(2);\n }\n break;\n case 'k':\n appendOptional(source.indexOf('>', i) - i + 1);\n break;\n default:\n appendOptional(2);\n break;\n }\n break;\n\n case '[':\n tmp = /\\[(?:\\\\.|.)*?\\]/g;\n tmp.lastIndex = i;\n tmp = tmp.exec(source) || [];\n appendOptional(tmp[0].length);\n break;\n\n case '|':\n case '^':\n case '$':\n case '*':\n case '+':\n case '?':\n appendRaw(1);\n break;\n case '{':\n tmp = /\\{\\d+,?\\d*\\}/g;\n tmp.lastIndex = i;\n tmp = tmp.exec(source);\n if (tmp) {\n appendRaw(tmp[0].length);\n } else {\n appendOptional(1);\n }\n break;\n case '(':\n if (source[i + 1] === '?') {\n switch (source[i + 2]) {\n case ':':\n result += '(?:';\n i += 3;\n result += process() + '|$)';\n break;\n case '=':\n result += '(?=';\n i += 3;\n result += process() + ')';\n break;\n case '!':\n tmp = i;\n i += 3;\n process();\n result += source.substr(tmp, i - tmp);\n break;\n case '<':\n switch (source[i + 3]) {\n case '=':\n case '!':\n tmp = i;\n i += 4;\n process();\n result += source.substr(tmp, i - tmp);\n break;\n default:\n appendRaw(source.indexOf('>', i) - i + 1);\n result += process() + '|$)';\n break;\n }\n break;\n }\n } else {\n appendRaw(1);\n result += process() + '|$)';\n }\n break;\n case ')':\n ++i;\n return result;\n default:\n appendOptional(1);\n break;\n }\n }\n\n return result;\n }\n\n return new RegExp(process(), regex.flags);\n}\n", "import type { Character, IRegExpAST, RegExpFlags } from \"../types\";\n\nexport function cc(char: string): number {\n return char.charCodeAt(0);\n}\n\nexport function insertToSet(item: T | T[], set: T[]) {\n if (Array.isArray(item)) {\n item.forEach(function (subItem) {\n set.push(subItem);\n });\n } else {\n set.push(item);\n }\n}\n\nexport function addFlag(\n flagObj: RegExpFlags,\n flagKey: keyof Omit,\n) {\n if (flagObj[flagKey] === true) {\n throw \"duplicate flag \" + flagKey;\n }\n\n const x: boolean = flagObj[flagKey];\n flagObj[flagKey] = true;\n}\n\nexport function ASSERT_EXISTS(obj: any): obj is T {\n // istanbul ignore next\n if (obj === undefined) {\n throw Error(\"Internal Error - Should never get here!\");\n }\n return true;\n}\n\n// istanbul ignore next\nexport function ASSERT_NEVER_REACH_HERE(): any {\n throw Error(\"Internal Error - Should never get here!\");\n}\n\nexport function isCharacter(obj: { type: string }): obj is Character {\n return obj[\"type\"] === \"Character\";\n}\n", "import { cc } from \"./utils.js\";\n\nexport const digitsCharCodes: number[] = [];\nfor (let i = cc(\"0\"); i <= cc(\"9\"); i++) {\n digitsCharCodes.push(i);\n}\n\nexport const wordCharCodes: number[] = [cc(\"_\")].concat(digitsCharCodes);\nfor (let i = cc(\"a\"); i <= cc(\"z\"); i++) {\n wordCharCodes.push(i);\n}\n\nfor (let i = cc(\"A\"); i <= cc(\"Z\"); i++) {\n wordCharCodes.push(i);\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#character-classes\nexport const whitespaceCodes: number[] = [\n cc(\" \"),\n cc(\"\\f\"),\n cc(\"\\n\"),\n cc(\"\\r\"),\n cc(\"\\t\"),\n cc(\"\\v\"),\n cc(\"\\t\"),\n cc(\"\\u00a0\"),\n cc(\"\\u1680\"),\n cc(\"\\u2000\"),\n cc(\"\\u2001\"),\n cc(\"\\u2002\"),\n cc(\"\\u2003\"),\n cc(\"\\u2004\"),\n cc(\"\\u2005\"),\n cc(\"\\u2006\"),\n cc(\"\\u2007\"),\n cc(\"\\u2008\"),\n cc(\"\\u2009\"),\n cc(\"\\u200a\"),\n cc(\"\\u2028\"),\n cc(\"\\u2029\"),\n cc(\"\\u202f\"),\n cc(\"\\u205f\"),\n cc(\"\\u3000\"),\n cc(\"\\ufeff\"),\n];\n", "import type {\n Alternative,\n Assertion,\n Atom,\n Character,\n Disjunction,\n Group,\n GroupBackReference,\n Location,\n Quantifier,\n Range,\n RegExpFlags,\n RegExpPattern,\n Set,\n Term,\n} from \"../types\";\nimport {\n addFlag,\n ASSERT_EXISTS,\n ASSERT_NEVER_REACH_HERE,\n cc,\n insertToSet,\n isCharacter,\n} from \"./utils.js\";\nimport {\n digitsCharCodes,\n whitespaceCodes,\n wordCharCodes,\n} from \"./character-classes.js\";\n\n// consts and utilities\nconst hexDigitPattern = /[0-9a-fA-F]/;\nconst decimalPattern = /[0-9]/;\nconst decimalPatternNoZero = /[1-9]/;\n\n// https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983\n// https://www.ecma-international.org/ecma-262/8.0/index.html#prod-Pattern\nexport class RegExpParser {\n protected idx: number = 0;\n protected input: string = \"\";\n protected groupIdx: number = 0;\n\n protected saveState() {\n return {\n idx: this.idx,\n input: this.input,\n groupIdx: this.groupIdx,\n };\n }\n\n protected restoreState(newState: {\n idx: number;\n input: string;\n groupIdx: number;\n }) {\n this.idx = newState.idx;\n this.input = newState.input;\n this.groupIdx = newState.groupIdx;\n }\n\n public pattern(input: string): RegExpPattern {\n // parser state\n this.idx = 0;\n this.input = input;\n this.groupIdx = 0;\n\n this.consumeChar(\"/\");\n const value = this.disjunction();\n this.consumeChar(\"/\");\n\n const flags: RegExpFlags = {\n type: \"Flags\",\n loc: { begin: this.idx, end: input.length },\n global: false,\n ignoreCase: false,\n multiLine: false,\n unicode: false,\n sticky: false,\n };\n\n while (this.isRegExpFlag()) {\n switch (this.popChar()) {\n case \"g\":\n addFlag(flags, \"global\");\n break;\n case \"i\":\n addFlag(flags, \"ignoreCase\");\n break;\n case \"m\":\n addFlag(flags, \"multiLine\");\n break;\n case \"u\":\n addFlag(flags, \"unicode\");\n break;\n case \"y\":\n addFlag(flags, \"sticky\");\n break;\n }\n }\n\n if (this.idx !== this.input.length) {\n throw Error(\"Redundant input: \" + this.input.substring(this.idx));\n }\n return {\n type: \"Pattern\",\n flags: flags,\n value: value,\n loc: this.loc(0),\n };\n }\n\n protected disjunction(): Disjunction {\n const alts = [];\n const begin = this.idx;\n\n alts.push(this.alternative());\n\n while (this.peekChar() === \"|\") {\n this.consumeChar(\"|\");\n alts.push(this.alternative());\n }\n\n return { type: \"Disjunction\", value: alts, loc: this.loc(begin) };\n }\n\n protected alternative(): Alternative {\n const terms = [];\n const begin = this.idx;\n\n while (this.isTerm()) {\n terms.push(this.term());\n }\n\n return { type: \"Alternative\", value: terms, loc: this.loc(begin) };\n }\n\n protected term(): Term {\n if (this.isAssertion()) {\n return this.assertion();\n } else {\n return this.atom();\n }\n }\n\n protected assertion(): Assertion {\n const begin = this.idx;\n switch (this.popChar()) {\n case \"^\":\n return {\n type: \"StartAnchor\",\n loc: this.loc(begin),\n };\n case \"$\":\n return { type: \"EndAnchor\", loc: this.loc(begin) };\n // '\\b' or '\\B'\n case \"\\\\\":\n switch (this.popChar()) {\n case \"b\":\n return {\n type: \"WordBoundary\",\n loc: this.loc(begin),\n };\n case \"B\":\n return {\n type: \"NonWordBoundary\",\n loc: this.loc(begin),\n };\n }\n // istanbul ignore next\n throw Error(\"Invalid Assertion Escape\");\n // '(?=' or '(?!'\n case \"(\":\n this.consumeChar(\"?\");\n\n let type: \"Lookahead\" | \"NegativeLookahead\" | undefined;\n switch (this.popChar()) {\n case \"=\":\n type = \"Lookahead\";\n break;\n case \"!\":\n type = \"NegativeLookahead\";\n break;\n }\n ASSERT_EXISTS(type);\n\n const disjunction = this.disjunction();\n\n this.consumeChar(\")\");\n\n return {\n type: type!,\n value: disjunction,\n loc: this.loc(begin),\n };\n }\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE();\n }\n\n protected quantifier(\n isBacktracking: boolean = false,\n ): Quantifier | undefined {\n let range: Partial | undefined = undefined;\n const begin = this.idx;\n switch (this.popChar()) {\n case \"*\":\n range = {\n atLeast: 0,\n atMost: Infinity,\n };\n break;\n case \"+\":\n range = {\n atLeast: 1,\n atMost: Infinity,\n };\n break;\n case \"?\":\n range = {\n atLeast: 0,\n atMost: 1,\n };\n break;\n case \"{\":\n const atLeast = this.integerIncludingZero();\n switch (this.popChar()) {\n case \"}\":\n range = {\n atLeast: atLeast,\n atMost: atLeast,\n };\n break;\n case \",\":\n let atMost;\n if (this.isDigit()) {\n atMost = this.integerIncludingZero();\n range = {\n atLeast: atLeast,\n atMost: atMost,\n };\n } else {\n range = {\n atLeast: atLeast,\n atMost: Infinity,\n };\n }\n this.consumeChar(\"}\");\n break;\n }\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined;\n }\n ASSERT_EXISTS(range);\n break;\n }\n\n // throwing exceptions from \"ASSERT_EXISTS\" during backtracking\n // causes severe performance degradations\n if (isBacktracking === true && range === undefined) {\n return undefined;\n }\n\n // istanbul ignore else\n if (ASSERT_EXISTS(range)) {\n if (this.peekChar(0) === \"?\") {\n this.consumeChar(\"?\");\n range.greedy = false;\n } else {\n range.greedy = true;\n }\n\n range.type = \"Quantifier\";\n range.loc = this.loc(begin);\n return range as Quantifier;\n }\n }\n\n protected atom(): Atom {\n let atom: Omit | undefined;\n const begin = this.idx;\n switch (this.peekChar()) {\n case \".\":\n atom = this.dotAll();\n break;\n case \"\\\\\":\n atom = this.atomEscape();\n break;\n case \"[\":\n atom = this.characterClass();\n break;\n case \"(\":\n atom = this.group();\n break;\n }\n\n if (atom === undefined && this.isPatternCharacter()) {\n atom = this.patternCharacter();\n }\n\n // istanbul ignore else\n if (ASSERT_EXISTS(atom)) {\n atom.loc = this.loc(begin);\n\n if (this.isQuantifier()) {\n atom.quantifier = this.quantifier();\n }\n\n return atom;\n }\n\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE();\n }\n\n protected dotAll(): Omit {\n this.consumeChar(\".\");\n return {\n type: \"Set\",\n complement: true,\n value: [cc(\"\\n\"), cc(\"\\r\"), cc(\"\\u2028\"), cc(\"\\u2029\")],\n };\n }\n\n protected atomEscape(): Omit {\n this.consumeChar(\"\\\\\");\n\n switch (this.peekChar()) {\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\":\n return this.decimalEscapeAtom();\n case \"d\":\n case \"D\":\n case \"s\":\n case \"S\":\n case \"w\":\n case \"W\":\n return this.characterClassEscape();\n case \"f\":\n case \"n\":\n case \"r\":\n case \"t\":\n case \"v\":\n return this.controlEscapeAtom();\n case \"c\":\n return this.controlLetterEscapeAtom();\n case \"0\":\n return this.nulCharacterAtom();\n case \"x\":\n return this.hexEscapeSequenceAtom();\n case \"u\":\n return this.regExpUnicodeEscapeSequenceAtom();\n default:\n return this.identityEscapeAtom();\n }\n }\n\n protected decimalEscapeAtom(): Omit {\n const value = this.positiveInteger();\n\n return { type: \"GroupBackReference\", value: value };\n }\n\n protected characterClassEscape(): Omit {\n let set: (number | Range)[] | undefined;\n let complement = false;\n switch (this.popChar()) {\n case \"d\":\n set = digitsCharCodes;\n break;\n case \"D\":\n set = digitsCharCodes;\n complement = true;\n break;\n case \"s\":\n set = whitespaceCodes;\n break;\n case \"S\":\n set = whitespaceCodes;\n complement = true;\n break;\n case \"w\":\n set = wordCharCodes;\n break;\n case \"W\":\n set = wordCharCodes;\n complement = true;\n break;\n }\n\n // istanbul ignore else\n if (ASSERT_EXISTS(set)) {\n return { type: \"Set\", value: set, complement: complement };\n }\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE();\n }\n\n protected controlEscapeAtom(): Omit {\n let escapeCode;\n switch (this.popChar()) {\n case \"f\":\n escapeCode = cc(\"\\f\");\n break;\n case \"n\":\n escapeCode = cc(\"\\n\");\n break;\n case \"r\":\n escapeCode = cc(\"\\r\");\n break;\n case \"t\":\n escapeCode = cc(\"\\t\");\n break;\n case \"v\":\n escapeCode = cc(\"\\v\");\n break;\n }\n\n // istanbul ignore else\n if (ASSERT_EXISTS(escapeCode)) {\n return { type: \"Character\", value: escapeCode };\n }\n // istanbul ignore next\n return ASSERT_NEVER_REACH_HERE();\n }\n\n protected controlLetterEscapeAtom(): Omit {\n this.consumeChar(\"c\");\n const letter = this.popChar();\n if (/[a-zA-Z]/.test(letter) === false) {\n throw Error(\"Invalid \");\n }\n\n const letterCode = letter.toUpperCase().charCodeAt(0) - 64;\n return { type: \"Character\", value: letterCode };\n }\n\n protected nulCharacterAtom(): Omit {\n // TODO implement '[lookahead \u2209 DecimalDigit]'\n // TODO: for the deprecated octal escape sequence\n this.consumeChar(\"0\");\n return { type: \"Character\", value: cc(\"\\0\") };\n }\n\n protected hexEscapeSequenceAtom(): Omit {\n this.consumeChar(\"x\");\n return this.parseHexDigits(2);\n }\n\n protected regExpUnicodeEscapeSequenceAtom(): Omit {\n this.consumeChar(\"u\");\n return this.parseHexDigits(4);\n }\n\n protected identityEscapeAtom(): Omit {\n // TODO: implement \"SourceCharacter but not UnicodeIDContinue\"\n // // http://unicode.org/reports/tr31/#Specific_Character_Adjustments\n const escapedChar = this.popChar();\n return { type: \"Character\", value: cc(escapedChar) };\n }\n\n protected classPatternCharacterAtom(): Omit {\n switch (this.peekChar()) {\n // istanbul ignore next\n case \"\\n\":\n // istanbul ignore next\n case \"\\r\":\n // istanbul ignore next\n case \"\\u2028\":\n // istanbul ignore next\n case \"\\u2029\":\n // istanbul ignore next\n case \"\\\\\":\n // istanbul ignore next\n case \"]\":\n throw Error(\"TBD\");\n default:\n const nextChar = this.popChar();\n return { type: \"Character\", value: cc(nextChar) };\n }\n }\n\n protected characterClass(): Omit {\n const set: (number | Range)[] = [];\n let complement = false;\n this.consumeChar(\"[\");\n if (this.peekChar(0) === \"^\") {\n this.consumeChar(\"^\");\n complement = true;\n }\n\n while (this.isClassAtom()) {\n const from = this.classAtom();\n const isFromSingleChar = from.type === \"Character\";\n if (isCharacter(from) && this.isRangeDash()) {\n this.consumeChar(\"-\");\n const to = this.classAtom();\n const isToSingleChar = to.type === \"Character\";\n\n // a range can only be used when both sides are single characters\n if (isCharacter(to)) {\n if (to.value < from.value) {\n throw Error(\"Range out of order in character class\");\n }\n set.push({ from: from.value, to: to.value });\n } else {\n // literal dash\n insertToSet(from.value, set);\n set.push(cc(\"-\"));\n insertToSet(to.value, set);\n }\n } else {\n insertToSet(from.value, set);\n }\n }\n\n this.consumeChar(\"]\");\n\n return { type: \"Set\", complement: complement, value: set };\n }\n\n protected classAtom(): Omit {\n switch (this.peekChar()) {\n // istanbul ignore next\n case \"]\":\n // istanbul ignore next\n case \"\\n\":\n // istanbul ignore next\n case \"\\r\":\n // istanbul ignore next\n case \"\\u2028\":\n // istanbul ignore next\n case \"\\u2029\":\n throw Error(\"TBD\");\n case \"\\\\\":\n return this.classEscape();\n default:\n return this.classPatternCharacterAtom();\n }\n }\n\n protected classEscape(): Omit {\n this.consumeChar(\"\\\\\");\n switch (this.peekChar()) {\n // Matches a backspace.\n // (Not to be confused with \\b word boundary outside characterClass)\n case \"b\":\n this.consumeChar(\"b\");\n return { type: \"Character\", value: cc(\"\\u0008\") };\n case \"d\":\n case \"D\":\n case \"s\":\n case \"S\":\n case \"w\":\n case \"W\":\n return this.characterClassEscape();\n case \"f\":\n case \"n\":\n case \"r\":\n case \"t\":\n case \"v\":\n return this.controlEscapeAtom();\n case \"c\":\n return this.controlLetterEscapeAtom();\n case \"0\":\n return this.nulCharacterAtom();\n case \"x\":\n return this.hexEscapeSequenceAtom();\n case \"u\":\n return this.regExpUnicodeEscapeSequenceAtom();\n default:\n return this.identityEscapeAtom();\n }\n }\n\n protected group(): Omit {\n let capturing = true;\n this.consumeChar(\"(\");\n switch (this.peekChar(0)) {\n case \"?\":\n this.consumeChar(\"?\");\n this.consumeChar(\":\");\n capturing = false;\n break;\n default:\n this.groupIdx++;\n break;\n }\n const value = this.disjunction();\n this.consumeChar(\")\");\n\n const groupAst: Omit = {\n type: \"Group\",\n capturing: capturing,\n value: value,\n };\n\n if (capturing) {\n groupAst[\"idx\"] = this.groupIdx;\n }\n\n return groupAst;\n }\n\n protected positiveInteger(): number {\n let number = this.popChar();\n\n // istanbul ignore next - can't ever get here due to previous lookahead checks\n // still implementing this error checking in case this ever changes.\n if (decimalPatternNoZero.test(number) === false) {\n throw Error(\"Expecting a positive integer\");\n }\n\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar();\n }\n\n return parseInt(number, 10);\n }\n\n protected integerIncludingZero(): number {\n let number = this.popChar();\n if (decimalPattern.test(number) === false) {\n throw Error(\"Expecting an integer\");\n }\n\n while (decimalPattern.test(this.peekChar(0))) {\n number += this.popChar();\n }\n\n return parseInt(number, 10);\n }\n\n protected patternCharacter(): Omit {\n const nextChar = this.popChar();\n switch (nextChar) {\n // istanbul ignore next\n case \"\\n\":\n // istanbul ignore next\n case \"\\r\":\n // istanbul ignore next\n case \"\\u2028\":\n // istanbul ignore next\n case \"\\u2029\":\n // istanbul ignore next\n case \"^\":\n // istanbul ignore next\n case \"$\":\n // istanbul ignore next\n case \"\\\\\":\n // istanbul ignore next\n case \".\":\n // istanbul ignore next\n case \"*\":\n // istanbul ignore next\n case \"+\":\n // istanbul ignore next\n case \"?\":\n // istanbul ignore next\n case \"(\":\n // istanbul ignore next\n case \")\":\n // istanbul ignore next\n case \"[\":\n // istanbul ignore next\n case \"|\":\n // istanbul ignore next\n throw Error(\"TBD\");\n default:\n return { type: \"Character\", value: cc(nextChar) };\n }\n }\n protected isRegExpFlag(): boolean {\n switch (this.peekChar(0)) {\n case \"g\":\n case \"i\":\n case \"m\":\n case \"u\":\n case \"y\":\n return true;\n default:\n return false;\n }\n }\n\n protected isRangeDash(): boolean {\n return this.peekChar() === \"-\" && this.isClassAtom(1);\n }\n\n protected isDigit(): boolean {\n return decimalPattern.test(this.peekChar(0));\n }\n\n protected isClassAtom(howMuch = 0): boolean {\n switch (this.peekChar(howMuch)) {\n case \"]\":\n case \"\\n\":\n case \"\\r\":\n case \"\\u2028\":\n case \"\\u2029\":\n return false;\n default:\n return true;\n }\n }\n\n protected isTerm() {\n return this.isAtom() || this.isAssertion();\n }\n\n protected isAtom(): boolean {\n if (this.isPatternCharacter()) {\n return true;\n }\n\n switch (this.peekChar(0)) {\n case \".\":\n case \"\\\\\": // atomEscape\n case \"[\": // characterClass\n // TODO: isAtom must be called before isAssertion - disambiguate\n case \"(\": // group\n return true;\n default:\n return false;\n }\n }\n\n protected isAssertion(): boolean {\n switch (this.peekChar(0)) {\n case \"^\":\n case \"$\":\n return true;\n // '\\b' or '\\B'\n case \"\\\\\":\n switch (this.peekChar(1)) {\n case \"b\":\n case \"B\":\n return true;\n default:\n return false;\n }\n // '(?=' or '(?!'\n case \"(\":\n return (\n this.peekChar(1) === \"?\" &&\n (this.peekChar(2) === \"=\" || this.peekChar(2) === \"!\")\n );\n default:\n return false;\n }\n }\n\n protected isQuantifier(): boolean {\n const prevState = this.saveState();\n try {\n return this.quantifier(true) !== undefined;\n } catch (e) {\n return false;\n } finally {\n this.restoreState(prevState);\n }\n }\n\n protected isPatternCharacter(): boolean {\n switch (this.peekChar()) {\n case \"^\":\n case \"$\":\n case \"\\\\\":\n case \".\":\n case \"*\":\n case \"+\":\n case \"?\":\n case \"(\":\n case \")\":\n case \"[\":\n case \"|\":\n case \"/\":\n case \"\\n\":\n case \"\\r\":\n case \"\\u2028\":\n case \"\\u2029\":\n return false;\n default:\n return true;\n }\n }\n\n protected parseHexDigits(howMany: number): Omit {\n let hexString = \"\";\n for (let i = 0; i < howMany; i++) {\n const hexChar = this.popChar();\n if (hexDigitPattern.test(hexChar) === false) {\n throw Error(\"Expecting a HexDecimal digits\");\n }\n hexString += hexChar;\n }\n const charCode = parseInt(hexString, 16);\n return { type: \"Character\", value: charCode };\n }\n\n protected peekChar(howMuch = 0): string {\n return this.input[this.idx + howMuch];\n }\n\n protected popChar(): string {\n const nextChar = this.peekChar(0);\n this.consumeChar(undefined);\n return nextChar;\n }\n\n protected consumeChar(char: string | undefined): void {\n if (char !== undefined && this.input[this.idx] !== char) {\n throw Error(\n \"Expected: '\" +\n char +\n \"' but found: '\" +\n this.input[this.idx] +\n \"' at offset: \" +\n this.idx,\n );\n }\n\n if (this.idx >= this.input.length) {\n throw Error(\"Unexpected end of input\");\n }\n this.idx++;\n }\n\n protected loc(begin: number): Location {\n return { begin: begin, end: this.idx };\n }\n}\n", "import type {\n Alternative,\n Assertion,\n Character,\n Disjunction,\n Group,\n GroupBackReference,\n IRegExpAST,\n Quantifier,\n RegExpAstPart,\n RegExpFlags,\n RegExpPattern,\n Set,\n} from \"../types\";\n\nexport class BaseRegExpVisitor {\n public visitChildren(node: IRegExpAST) {\n for (const key in node) {\n const child = (node as any)[key];\n /* istanbul ignore else */\n if (node.hasOwnProperty(key)) {\n if (child.type !== undefined) {\n this.visit(child);\n } else if (Array.isArray(child)) {\n child.forEach((subChild) => {\n this.visit(subChild);\n }, this);\n }\n }\n }\n }\n\n public visit(node: RegExpAstPart): void {\n switch (node.type) {\n case \"Pattern\":\n this.visitPattern(node);\n break;\n case \"Flags\":\n this.visitFlags(node);\n break;\n case \"Disjunction\":\n this.visitDisjunction(node);\n break;\n case \"Alternative\":\n this.visitAlternative(node);\n break;\n case \"StartAnchor\":\n this.visitStartAnchor(node);\n break;\n case \"EndAnchor\":\n this.visitEndAnchor(node);\n break;\n case \"WordBoundary\":\n this.visitWordBoundary(node);\n break;\n case \"NonWordBoundary\":\n this.visitNonWordBoundary(node);\n break;\n case \"Lookahead\":\n this.visitLookahead(node);\n break;\n case \"NegativeLookahead\":\n this.visitNegativeLookahead(node);\n break;\n case \"Character\":\n this.visitCharacter(node);\n break;\n case \"Set\":\n this.visitSet(node);\n break;\n case \"Group\":\n this.visitGroup(node);\n break;\n case \"GroupBackReference\":\n this.visitGroupBackReference(node);\n break;\n case \"Quantifier\":\n this.visitQuantifier(node);\n break;\n }\n\n this.visitChildren(node);\n }\n\n public visitPattern(node: RegExpPattern): void {}\n\n public visitFlags(node: RegExpFlags): void {}\n\n public visitDisjunction(node: Disjunction): void {}\n\n public visitAlternative(node: Alternative): void {}\n\n // Assertion\n public visitStartAnchor(node: Assertion): void {}\n\n public visitEndAnchor(node: Assertion): void {}\n\n public visitWordBoundary(node: Assertion): void {}\n\n public visitNonWordBoundary(node: Assertion): void {}\n\n public visitLookahead(node: Assertion): void {}\n\n public visitNegativeLookahead(node: Assertion): void {}\n\n // atoms\n public visitCharacter(node: Character): void {}\n\n public visitSet(node: Set): void {}\n\n public visitGroup(node: Group): void {}\n\n public visitGroupBackReference(node: GroupBackReference): void {}\n\n public visitQuantifier(node: Quantifier): void {}\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { IToken } from 'chevrotain';\nimport * as ast from '../../languages/generated/ast.js';\nimport { isAstNode } from '../../syntax-tree.js';\nimport { getContainerOfType } from '../../utils/ast-utils.js';\nimport type { Cardinality } from '../../utils/grammar-utils.js';\nimport { getCrossReferenceTerminal, getExplicitRuleType, getTypeName, isArrayCardinality, isOptionalCardinality, terminalRegex } from '../../utils/grammar-utils.js';\n\nexport interface NextFeature {\n /**\n * A feature that could appear during completion.\n */\n feature: T\n /**\n * The type that carries this `feature`. Only set if we encounter a new type.\n */\n type?: string\n /**\n * The container property for the new `type`\n */\n property?: string\n}\n\n/**\n * Calculates any features that can follow the given feature stack.\n * This also includes features following optional features and features from previously called rules that could follow the last feature.\n * @param featureStack A stack of features starting at the entry rule and ending at the feature of the current cursor position.\n * @param unparsedTokens All tokens which haven't been parsed successfully yet. This is the case when we call this function inside an alternative.\n * @returns Any `AbstractElement` that could be following the given feature stack.\n */\nexport function findNextFeatures(featureStack: NextFeature[][], unparsedTokens: IToken[]): NextFeature[] {\n const context: InterpretationContext = {\n stacks: featureStack,\n tokens: unparsedTokens\n };\n interpretTokens(context);\n // Reset the container property\n context.stacks.flat().forEach(feature => { feature.property = undefined; });\n const nextStacks = findNextFeatureStacks(context.stacks);\n // We only need the last element of each stack\n return nextStacks.map(e => e[e.length - 1]);\n}\n\nfunction findNextFeaturesInternal(options: { next: NextFeature, cardinalities: Map, visited: Set, plus: Set }): NextFeature[] {\n const { next, cardinalities, visited, plus } = options;\n const features: NextFeature[] = [];\n const feature = next.feature;\n if (visited.has(feature)) {\n return [];\n } else {\n visited.add(feature);\n }\n let parent: ast.Group | undefined;\n let item = feature;\n while (item.$container) {\n if (ast.isGroup(item.$container)) {\n parent = item.$container;\n break;\n } else if (ast.isAbstractElement(item.$container)) {\n item = item.$container;\n } else {\n break;\n }\n }\n // First try to iterate the same element again\n if (isArrayCardinality(item.cardinality)) {\n const repeatingFeatures = findFirstFeaturesInternal({\n next: {\n feature: item,\n type: next.type\n },\n cardinalities,\n visited,\n plus\n });\n for (const repeatingFeature of repeatingFeatures) {\n plus.add(repeatingFeature.feature);\n }\n features.push(...repeatingFeatures);\n }\n if (parent) {\n const ownIndex = parent.elements.indexOf(item);\n // Find next elements of the same group\n if (ownIndex !== undefined && ownIndex < parent.elements.length - 1) {\n features.push(...findNextFeaturesInGroup({\n feature: parent,\n type: next.type\n }, ownIndex + 1, cardinalities, visited, plus));\n }\n // Try to find the next elements of the parent\n // Only do this if every following element is either optional or has been parsed as +\n if (features.every(e => isOptionalCardinality(e.feature.cardinality, e.feature) || isOptionalCardinality(cardinalities.get(e.feature)) || plus.has(e.feature))) {\n features.push(...findNextFeaturesInternal({\n next: {\n feature: parent,\n type: next.type\n },\n cardinalities,\n visited,\n plus\n }));\n }\n }\n return features;\n}\n\n/**\n * Calculates the first child feature of any `AbstractElement`.\n * @param next The `AbstractElement` whose first child features should be calculated.\n */\nexport function findFirstFeatures(next: ast.AbstractElement | NextFeature): NextFeature[] {\n if (isAstNode(next)) {\n next = { feature: next };\n }\n return findFirstFeaturesInternal({ next, cardinalities: new Map(), visited: new Set(), plus: new Set() });\n}\n\nfunction findFirstFeaturesInternal(options: { next: NextFeature, cardinalities: Map, visited: Set, plus: Set }): NextFeature[] {\n const { next, cardinalities, visited, plus } = options;\n if (next === undefined) {\n return [];\n }\n const { feature, type } = next;\n if (ast.isGroup(feature)) {\n if (visited.has(feature)) {\n return [];\n } else {\n visited.add(feature);\n }\n }\n if (ast.isGroup(feature)) {\n return findNextFeaturesInGroup(next as NextFeature, 0, cardinalities, visited, plus)\n .map(e => modifyCardinality(e, feature.cardinality, cardinalities));\n } else if (ast.isAlternatives(feature) || ast.isUnorderedGroup(feature)) {\n return feature.elements.flatMap(e => findFirstFeaturesInternal({\n next: {\n feature: e,\n type,\n property: next.property\n },\n cardinalities,\n visited,\n plus\n }))\n .map(e => modifyCardinality(e, feature.cardinality, cardinalities));\n } else if (ast.isAssignment(feature)) {\n const assignmentNext = {\n feature: feature.terminal,\n type,\n property: next.property ?? feature.feature\n };\n return findFirstFeaturesInternal({ next: assignmentNext, cardinalities, visited, plus })\n .map(e => modifyCardinality(e, feature.cardinality, cardinalities));\n } else if (ast.isAction(feature)) {\n return findNextFeaturesInternal({\n next: {\n feature,\n type: getTypeName(feature),\n property: next.property ?? feature.feature\n },\n cardinalities,\n visited,\n plus\n });\n } else if (ast.isRuleCall(feature) && ast.isParserRule(feature.rule.ref)) {\n const rule = feature.rule.ref;\n const ruleCallNext = {\n feature: rule.definition,\n type: rule.fragment || rule.dataType ? undefined : (getExplicitRuleType(rule) ?? rule.name),\n property: next.property\n };\n return findFirstFeaturesInternal({ next: ruleCallNext, cardinalities, visited, plus })\n .map(e => modifyCardinality(e, feature.cardinality, cardinalities));\n } else {\n return [next];\n }\n}\n\n/**\n * Modifying the cardinality is necessary to identify which features are coming from an optional feature.\n * Those features should be optional as well.\n * @param next The next feature that could be made optionally.\n * @param cardinality The cardinality of the calling (parent) object.\n * @returns A new feature that could be now optional (`?` or `*`).\n */\nfunction modifyCardinality(next: NextFeature, cardinality: Cardinality, cardinalities: Map): NextFeature {\n cardinalities.set(next.feature, cardinality);\n return next;\n}\n\nfunction findNextFeaturesInGroup(next: NextFeature, index: number, cardinalities: Map, visited: Set, plus: Set): NextFeature[] {\n const features: NextFeature[] = [];\n let firstFeature: NextFeature;\n while (index < next.feature.elements.length) {\n const feature = next.feature.elements[index++];\n firstFeature = {\n feature,\n type: next.type\n };\n features.push(...findFirstFeaturesInternal({\n next: firstFeature,\n cardinalities,\n visited,\n plus\n }));\n if (!isOptionalCardinality(firstFeature.feature.cardinality ?? cardinalities.get(firstFeature.feature), firstFeature.feature)) {\n break;\n }\n }\n return features;\n}\n\ninterface InterpretationContext {\n tokens: IToken[]\n stacks: NextFeature[][]\n}\n\nfunction interpretTokens(context: InterpretationContext): void {\n for (const token of context.tokens) {\n const nextFeatureStacks = findNextFeatureStacks(context.stacks, token);\n context.stacks = nextFeatureStacks;\n }\n}\n\nfunction findNextFeatureStacks(stacks: NextFeature[][], token?: IToken): NextFeature[][] {\n const newStacks: NextFeature[][] = [];\n for (const stack of stacks) {\n newStacks.push(...interpretStackToken(stack, token));\n }\n return newStacks;\n}\n\nfunction interpretStackToken(stack: NextFeature[], token?: IToken): NextFeature[][] {\n const cardinalities = new Map();\n const plus = new Set(stack.map(e => e.feature).filter(isPlusFeature));\n const newStacks: NextFeature[][] = [];\n while (stack.length > 0) {\n const top = stack.pop()!;\n const allNextFeatures = findNextFeaturesInternal({\n next: top,\n cardinalities,\n plus,\n visited: new Set()\n }).filter(next => token ? featureMatches(next.feature, token) : true);\n for (const nextFeature of allNextFeatures) {\n newStacks.push([...stack, nextFeature]);\n }\n if (!allNextFeatures.every(e => isOptionalCardinality(e.feature.cardinality, e.feature) || isOptionalCardinality(cardinalities.get(e.feature)))) {\n break;\n }\n }\n return newStacks;\n}\n\nfunction isPlusFeature(feature: ast.AbstractElement): boolean {\n if (feature.cardinality === '+') {\n return true;\n }\n const assignment = getContainerOfType(feature, ast.isAssignment);\n if (assignment && assignment.cardinality === '+') {\n return true;\n }\n return false;\n}\n\nfunction featureMatches(feature: ast.AbstractElement, token: IToken): boolean {\n if (ast.isKeyword(feature)) {\n const content = feature.value;\n return content === token.image;\n } else if (ast.isRuleCall(feature)) {\n return ruleMatches(feature.rule.ref, token);\n } else if (ast.isCrossReference(feature)) {\n const crossRefTerminal = getCrossReferenceTerminal(feature);\n if (crossRefTerminal) {\n return featureMatches(crossRefTerminal, token);\n }\n }\n return false;\n}\n\nfunction ruleMatches(rule: ast.AbstractRule | undefined, token: IToken): boolean {\n if (ast.isParserRule(rule)) {\n const ruleFeatures = findFirstFeatures(rule.definition);\n return ruleFeatures.some(e => featureMatches(e.feature, token));\n } else if (ast.isTerminalRule(rule)) {\n // We have to take keywords into account\n // e.g. most keywords are valid IDs as well\n // Only return 'true' if this terminal does not match a keyword. TODO\n return terminalRegex(rule).test(token.image);\n } else {\n return false;\n }\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem, CallHierarchyOutgoingCall, CallHierarchyOutgoingCallsParams, CallHierarchyPrepareParams, } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport type { Stream } from '../utils/stream.js';\nimport type { ReferenceDescription } from '../workspace/ast-descriptions.js';\nimport type { LangiumDocument, LangiumDocuments } from '../workspace/documents.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport { SymbolKind } from 'vscode-languageserver';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\nimport { URI } from '../utils/uri-utils.js';\n\n/**\n * Language-specific service for handling call hierarchy requests.\n */\nexport interface CallHierarchyProvider {\n prepareCallHierarchy(document: LangiumDocument, params: CallHierarchyPrepareParams, cancelToken?: CancellationToken): MaybePromise;\n\n incomingCalls(params: CallHierarchyIncomingCallsParams, cancelToken?: CancellationToken): MaybePromise;\n\n outgoingCalls(params: CallHierarchyOutgoingCallsParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport abstract class AbstractCallHierarchyProvider implements CallHierarchyProvider {\n protected readonly grammarConfig: GrammarConfig;\n protected readonly nameProvider: NameProvider;\n protected readonly documents: LangiumDocuments;\n protected readonly references: References;\n\n constructor(services: LangiumServices) {\n this.grammarConfig = services.parser.GrammarConfig;\n this.nameProvider = services.references.NameProvider;\n this.documents = services.shared.workspace.LangiumDocuments;\n this.references = services.references.References;\n }\n\n prepareCallHierarchy(document: LangiumDocument, params: CallHierarchyPrepareParams): MaybePromise {\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.position),\n this.grammarConfig.nameRegexp\n );\n if (!targetNode) {\n return undefined;\n }\n\n const declarationNode = this.references.findDeclarationNode(targetNode);\n if (!declarationNode) {\n return undefined;\n }\n\n return this.getCallHierarchyItems(declarationNode.astNode, document);\n }\n\n protected getCallHierarchyItems(targetNode: AstNode, document: LangiumDocument): CallHierarchyItem[] | undefined {\n const nameNode = this.nameProvider.getNameNode(targetNode);\n const name = this.nameProvider.getName(targetNode);\n if (!nameNode || !targetNode.$cstNode || name === undefined) {\n return undefined;\n }\n\n return [{\n kind: SymbolKind.Method,\n name,\n range: targetNode.$cstNode.range,\n selectionRange: nameNode.range,\n uri: document.uri.toString(),\n ...this.getCallHierarchyItem(targetNode)\n }];\n }\n\n protected getCallHierarchyItem(_targetNode: AstNode): Partial | undefined {\n return undefined;\n }\n\n async incomingCalls(params: CallHierarchyIncomingCallsParams): Promise {\n const document = await this.documents.getOrCreateDocument(URI.parse(params.item.uri));\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.item.range.start),\n this.grammarConfig.nameRegexp\n );\n if (!targetNode) {\n return undefined;\n }\n\n const references = this.references.findReferences(\n targetNode.astNode,\n {\n includeDeclaration: false\n }\n );\n return this.getIncomingCalls(targetNode.astNode, references);\n }\n\n /**\n * Override this method to collect the incoming calls for your language\n */\n protected abstract getIncomingCalls(node: AstNode, references: Stream): MaybePromise;\n\n async outgoingCalls(params: CallHierarchyOutgoingCallsParams): Promise {\n const document = await this.documents.getOrCreateDocument(URI.parse(params.item.uri));\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.item.range.start),\n this.grammarConfig.nameRegexp\n );\n if (!targetNode) {\n return undefined;\n }\n return this.getOutgoingCalls(targetNode.astNode);\n }\n\n /**\n * Override this method to collect the outgoing calls for your language\n */\n protected abstract getOutgoingCalls(node: AstNode): MaybePromise;\n}\n", "// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n", "// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n", "// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};", "__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))", "// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\n// !!!!!\n// SEE https://github.com/microsoft/vscode/blob/master/src/vs/base/common/platform.ts\n// !!!!!\n\ndeclare const process: { platform: 'win32' };\ndeclare const navigator: { userAgent: string };\n\nexport let isWindows: boolean;\n\nif (typeof process === 'object') {\n\tisWindows = process.platform === 'win32';\n} else if (typeof navigator === 'object') {\n\tlet userAgent = navigator.userAgent;\n\tisWindows = userAgent.indexOf('Windows') >= 0;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n\nimport { CharCode } from './charCode'\nimport { isWindows } from './platform';\n\nconst _schemePattern = /^\\w[\\w\\d+.-]*$/;\nconst _singleSlashStart = /^\\//;\nconst _doubleSlashStart = /^\\/\\//;\n\nfunction _validateUri(ret: URI, _strict?: boolean): void {\n\n\t// scheme, must be set\n\tif (!ret.scheme && _strict) {\n\t\tthrow new Error(`[UriError]: Scheme is missing: {scheme: \"\", authority: \"${ret.authority}\", path: \"${ret.path}\", query: \"${ret.query}\", fragment: \"${ret.fragment}\"}`);\n\t}\n\n\t// scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n\t// ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n\tif (ret.scheme && !_schemePattern.test(ret.scheme)) {\n\t\tthrow new Error('[UriError]: Scheme contains illegal characters.');\n\t}\n\n\t// path, http://tools.ietf.org/html/rfc3986#section-3.3\n\t// If a URI contains an authority component, then the path component\n\t// must either be empty or begin with a slash (\"/\") character. If a URI\n\t// does not contain an authority component, then the path cannot begin\n\t// with two slash characters (\"//\").\n\tif (ret.path) {\n\t\tif (ret.authority) {\n\t\t\tif (!_singleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n\t\t\t}\n\t\t} else {\n\t\t\tif (_doubleSlashStart.test(ret.path)) {\n\t\t\t\tthrow new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n\t\t\t}\n\t\t}\n\t}\n}\n\n// for a while we allowed uris *without* schemes and this is the migration\n// for them, e.g. an uri without scheme and without strict-mode warns and falls\n// back to the file-scheme. that should cause the least carnage and still be a\n// clear warning\nfunction _schemeFix(scheme: string, _strict: boolean): string {\n\tif (!scheme && !_strict) {\n\t\treturn 'file';\n\t}\n\treturn scheme;\n}\n\n// implements a bit of https://tools.ietf.org/html/rfc3986#section-5\nfunction _referenceResolution(scheme: string, path: string): string {\n\n\t// the slash-character is our 'default base' as we don't\n\t// support constructing URIs relative to other URIs. This\n\t// also means that we alter and potentially break paths.\n\t// see https://tools.ietf.org/html/rfc3986#section-5.1.4\n\tswitch (scheme) {\n\t\tcase 'https':\n\t\tcase 'http':\n\t\tcase 'file':\n\t\t\tif (!path) {\n\t\t\t\tpath = _slash;\n\t\t\t} else if (path[0] !== _slash) {\n\t\t\t\tpath = _slash + path;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn path;\n}\n\nconst _empty = '';\nconst _slash = '/';\nconst _regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n\n/**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component parts\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * ```txt\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n * ```\n */\nexport class URI implements UriComponents {\n\n\tstatic isUri(thing: any): thing is URI {\n\t\tif (thing instanceof URI) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing) {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing).authority === 'string'\n\t\t\t&& typeof (thing).fragment === 'string'\n\t\t\t&& typeof (thing).path === 'string'\n\t\t\t&& typeof (thing).query === 'string'\n\t\t\t&& typeof (thing).scheme === 'string'\n\t\t\t&& typeof (thing).fsPath === 'string'\n\t\t\t&& typeof (thing).with === 'function'\n\t\t\t&& typeof (thing).toString === 'function';\n\t}\n\n\t/**\n\t * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.\n\t * The part before the first colon.\n\t */\n\treadonly scheme: string;\n\n\t/**\n\t * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.\n\t * The part between the first double slashes and the next slash.\n\t */\n\treadonly authority: string;\n\n\t/**\n\t * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly path: string;\n\n\t/**\n\t * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly query: string;\n\n\t/**\n\t * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.\n\t */\n\treadonly fragment: string;\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(components: UriComponents);\n\n\t/**\n\t * @internal\n\t */\n\tprotected constructor(schemeOrData: string | UriComponents, authority?: string, path?: string, query?: string, fragment?: string, _strict: boolean = false) {\n\n\t\tif (typeof schemeOrData === 'object') {\n\t\t\tthis.scheme = schemeOrData.scheme || _empty;\n\t\t\tthis.authority = schemeOrData.authority || _empty;\n\t\t\tthis.path = schemeOrData.path || _empty;\n\t\t\tthis.query = schemeOrData.query || _empty;\n\t\t\tthis.fragment = schemeOrData.fragment || _empty;\n\t\t\t// no validation because it's this URI\n\t\t\t// that creates uri components.\n\t\t\t// _validateUri(this);\n\t\t} else {\n\t\t\tthis.scheme = _schemeFix(schemeOrData, _strict);\n\t\t\tthis.authority = authority || _empty;\n\t\t\tthis.path = _referenceResolution(this.scheme, path || _empty);\n\t\t\tthis.query = query || _empty;\n\t\t\tthis.fragment = fragment || _empty;\n\n\t\t\t_validateUri(this, _strict);\n\t\t}\n\t}\n\n\t// ---- filesystem path -----------------------\n\n\t/**\n\t * Returns a string representing the corresponding file system path of this URI.\n\t * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the\n\t * platform specific path separator.\n\t *\n\t * * Will *not* validate the path for invalid characters and semantics.\n\t * * Will *not* look at the scheme of this URI.\n\t * * The result shall *not* be used for display purposes but for accessing a file on disk.\n\t *\n\t *\n\t * The *difference* to `URI#path` is the use of the platform specific separator and the handling\n\t * of UNC paths. See the below sample of a file-uri with an authority (UNC path).\n\t *\n\t * ```ts\n\t\tconst u = URI.parse('file://server/c$/folder/file.txt')\n\t\tu.authority === 'server'\n\t\tu.path === '/shares/c$/file.txt'\n\t\tu.fsPath === '\\\\server\\c$\\folder\\file.txt'\n\t```\n\t *\n\t * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,\n\t * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working\n\t * with URIs that represent files on disk (`file` scheme).\n\t */\n\tget fsPath(): string {\n\t\t// if (this.scheme !== 'file') {\n\t\t// \tconsole.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);\n\t\t// }\n\t\treturn uriToFsPath(this, false);\n\t}\n\n\t// ---- modify to new -------------------------\n\n\twith(change: { scheme?: string; authority?: string | null; path?: string | null; query?: string | null; fragment?: string | null }): URI {\n\n\t\tif (!change) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet { scheme, authority, path, query, fragment } = change;\n\t\tif (scheme === undefined) {\n\t\t\tscheme = this.scheme;\n\t\t} else if (scheme === null) {\n\t\t\tscheme = _empty;\n\t\t}\n\t\tif (authority === undefined) {\n\t\t\tauthority = this.authority;\n\t\t} else if (authority === null) {\n\t\t\tauthority = _empty;\n\t\t}\n\t\tif (path === undefined) {\n\t\t\tpath = this.path;\n\t\t} else if (path === null) {\n\t\t\tpath = _empty;\n\t\t}\n\t\tif (query === undefined) {\n\t\t\tquery = this.query;\n\t\t} else if (query === null) {\n\t\t\tquery = _empty;\n\t\t}\n\t\tif (fragment === undefined) {\n\t\t\tfragment = this.fragment;\n\t\t} else if (fragment === null) {\n\t\t\tfragment = _empty;\n\t\t}\n\n\t\tif (scheme === this.scheme\n\t\t\t&& authority === this.authority\n\t\t\t&& path === this.path\n\t\t\t&& query === this.query\n\t\t\t&& fragment === this.fragment) {\n\n\t\t\treturn this;\n\t\t}\n\n\t\treturn new Uri(scheme, authority, path, query, fragment);\n\t}\n\n\t// ---- parse & validate ------------------------\n\n\t/**\n\t * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,\n\t * `file:///usr/home`, or `scheme:with/path`.\n\t *\n\t * @param value A string which represents an URI (see `URI#toString`).\n\t */\n\tstatic parse(value: string, _strict: boolean = false): URI {\n\t\tconst match = _regexp.exec(value);\n\t\tif (!match) {\n\t\t\treturn new Uri(_empty, _empty, _empty, _empty, _empty);\n\t\t}\n\t\treturn new Uri(\n\t\t\tmatch[2] || _empty,\n\t\t\tpercentDecode(match[4] || _empty),\n\t\t\tpercentDecode(match[5] || _empty),\n\t\t\tpercentDecode(match[7] || _empty),\n\t\t\tpercentDecode(match[9] || _empty),\n\t\t\t_strict\n\t\t);\n\t}\n\n\t/**\n\t * Creates a new URI from a file system path, e.g. `c:\\my\\files`,\n\t * `/usr/home`, or `\\\\server\\share\\some\\path`.\n\t *\n\t * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument\n\t * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**\n\t * `URI.parse('file://' + path)` because the path might contain characters that are\n\t * interpreted (# and ?). See the following sample:\n\t * ```ts\n\tconst good = URI.file('/coding/c#/project1');\n\tgood.scheme === 'file';\n\tgood.path === '/coding/c#/project1';\n\tgood.fragment === '';\n\tconst bad = URI.parse('file://' + '/coding/c#/project1');\n\tbad.scheme === 'file';\n\tbad.path === '/coding/c'; // path is now broken\n\tbad.fragment === '/project1';\n\t```\n\t *\n\t * @param path A file system path (see `URI#fsPath`)\n\t */\n\tstatic file(path: string): URI {\n\n\t\tlet authority = _empty;\n\n\t\t// normalize to fwd-slashes on windows,\n\t\t// on other systems bwd-slashes are valid\n\t\t// filename character, eg /f\\oo/ba\\r.txt\n\t\tif (isWindows) {\n\t\t\tpath = path.replace(/\\\\/g, _slash);\n\t\t}\n\n\t\t// check for authority as used in UNC shares\n\t\t// or use the path as given\n\t\tif (path[0] === _slash && path[1] === _slash) {\n\t\t\tconst idx = path.indexOf(_slash, 2);\n\t\t\tif (idx === -1) {\n\t\t\t\tauthority = path.substring(2);\n\t\t\t\tpath = _slash;\n\t\t\t} else {\n\t\t\t\tauthority = path.substring(2, idx);\n\t\t\t\tpath = path.substring(idx) || _slash;\n\t\t\t}\n\t\t}\n\n\t\treturn new Uri('file', authority, path, _empty, _empty);\n\t}\n\n\tstatic from(components: { scheme: string; authority?: string; path?: string; query?: string; fragment?: string }): URI {\n\t\tconst result = new Uri(\n\t\t\tcomponents.scheme,\n\t\t\tcomponents.authority,\n\t\t\tcomponents.path,\n\t\t\tcomponents.query,\n\t\t\tcomponents.fragment,\n\t\t);\n\t\t_validateUri(result, true);\n\t\treturn result;\n\t}\n\n\t// ---- printing/externalize ---------------------------\n\n\t/**\n\t * Creates a string representation for this URI. It's guaranteed that calling\n\t * `URI.parse` with the result of this function creates an URI which is equal\n\t * to this URI.\n\t *\n\t * * The result shall *not* be used for display purposes but for externalization or transport.\n\t * * The result will be encoded using the percentage encoding and encoding happens mostly\n\t * ignore the scheme-specific encoding rules.\n\t *\n\t * @param skipEncoding Do not encode the result, default is `false`\n\t */\n\ttoString(skipEncoding: boolean = false): string {\n\t\treturn _asFormatted(this, skipEncoding);\n\t}\n\n\ttoJSON(): UriComponents {\n\t\treturn this;\n\t}\n\n\tstatic revive(data: UriComponents | URI): URI;\n\tstatic revive(data: UriComponents | URI | undefined): URI | undefined;\n\tstatic revive(data: UriComponents | URI | null): URI | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null;\n\tstatic revive(data: UriComponents | URI | undefined | null): URI | undefined | null {\n\t\tif (!data) {\n\t\t\treturn data;\n\t\t} else if (data instanceof URI) {\n\t\t\treturn data;\n\t\t} else {\n\t\t\tconst result = new Uri(data);\n\t\t\tresult._formatted = (data).external;\n\t\t\tresult._fsPath = (data)._sep === _pathSepMarker ? (data).fsPath : null;\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\nexport interface UriComponents {\n\tscheme: string;\n\tauthority: string;\n\tpath: string;\n\tquery: string;\n\tfragment: string;\n}\n\ninterface UriState extends UriComponents {\n\t$mid: number;\n\texternal: string;\n\tfsPath: string;\n\t_sep: 1 | undefined;\n}\n\nconst _pathSepMarker = isWindows ? 1 : undefined;\n\n// This class exists so that URI is compatible with vscode.Uri (API).\nclass Uri extends URI {\n\n\t_formatted: string | null = null;\n\t_fsPath: string | null = null;\n\n\toverride get fsPath(): string {\n\t\tif (!this._fsPath) {\n\t\t\tthis._fsPath = uriToFsPath(this, false);\n\t\t}\n\t\treturn this._fsPath;\n\t}\n\n\toverride toString(skipEncoding: boolean = false): string {\n\t\tif (!skipEncoding) {\n\t\t\tif (!this._formatted) {\n\t\t\t\tthis._formatted = _asFormatted(this, false);\n\t\t\t}\n\t\t\treturn this._formatted;\n\t\t} else {\n\t\t\t// we don't cache that\n\t\t\treturn _asFormatted(this, true);\n\t\t}\n\t}\n\n\toverride toJSON(): UriComponents {\n\t\tconst res = {\n\t\t\t$mid: 1\n\t\t};\n\t\t// cached state\n\t\tif (this._fsPath) {\n\t\t\tres.fsPath = this._fsPath;\n\t\t\tres._sep = _pathSepMarker;\n\t\t}\n\t\tif (this._formatted) {\n\t\t\tres.external = this._formatted;\n\t\t}\n\t\t// uri components\n\t\tif (this.path) {\n\t\t\tres.path = this.path;\n\t\t}\n\t\tif (this.scheme) {\n\t\t\tres.scheme = this.scheme;\n\t\t}\n\t\tif (this.authority) {\n\t\t\tres.authority = this.authority;\n\t\t}\n\t\tif (this.query) {\n\t\t\tres.query = this.query;\n\t\t}\n\t\tif (this.fragment) {\n\t\t\tres.fragment = this.fragment;\n\t\t}\n\t\treturn res;\n\t}\n}\n\n// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2\nconst encodeTable: { [ch: number]: string } = {\n\t[CharCode.Colon]: '%3A', // gen-delims\n\t[CharCode.Slash]: '%2F',\n\t[CharCode.QuestionMark]: '%3F',\n\t[CharCode.Hash]: '%23',\n\t[CharCode.OpenSquareBracket]: '%5B',\n\t[CharCode.CloseSquareBracket]: '%5D',\n\t[CharCode.AtSign]: '%40',\n\n\t[CharCode.ExclamationMark]: '%21', // sub-delims\n\t[CharCode.DollarSign]: '%24',\n\t[CharCode.Ampersand]: '%26',\n\t[CharCode.SingleQuote]: '%27',\n\t[CharCode.OpenParen]: '%28',\n\t[CharCode.CloseParen]: '%29',\n\t[CharCode.Asterisk]: '%2A',\n\t[CharCode.Plus]: '%2B',\n\t[CharCode.Comma]: '%2C',\n\t[CharCode.Semicolon]: '%3B',\n\t[CharCode.Equals]: '%3D',\n\n\t[CharCode.Space]: '%20',\n};\n\nfunction encodeURIComponentFast(uriComponent: string, isPath: boolean, isAuthority: boolean): string {\n\tlet res: string | undefined = undefined;\n\tlet nativeEncodePos = -1;\n\n\tfor (let pos = 0; pos < uriComponent.length; pos++) {\n\t\tconst code = uriComponent.charCodeAt(pos);\n\n\t\t// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3\n\t\tif (\n\t\t\t(code >= CharCode.a && code <= CharCode.z)\n\t\t\t|| (code >= CharCode.A && code <= CharCode.Z)\n\t\t\t|| (code >= CharCode.Digit0 && code <= CharCode.Digit9)\n\t\t\t|| code === CharCode.Dash\n\t\t\t|| code === CharCode.Period\n\t\t\t|| code === CharCode.Underline\n\t\t\t|| code === CharCode.Tilde\n\t\t\t|| (isPath && code === CharCode.Slash)\n\t\t\t|| (isAuthority && code === CharCode.OpenSquareBracket)\n\t\t\t|| (isAuthority && code === CharCode.CloseSquareBracket)\n\t\t\t|| (isAuthority && code === CharCode.Colon)\n\t\t) {\n\t\t\t// check if we are delaying native encode\n\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\tnativeEncodePos = -1;\n\t\t\t}\n\t\t\t// check if we write into a new string (by default we try to return the param)\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += uriComponent.charAt(pos);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// encoding needed, we need to allocate a new string\n\t\t\tif (res === undefined) {\n\t\t\t\tres = uriComponent.substr(0, pos);\n\t\t\t}\n\n\t\t\t// check with default table first\n\t\t\tconst escaped = encodeTable[code];\n\t\t\tif (escaped !== undefined) {\n\n\t\t\t\t// check if we are delaying native encode\n\t\t\t\tif (nativeEncodePos !== -1) {\n\t\t\t\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));\n\t\t\t\t\tnativeEncodePos = -1;\n\t\t\t\t}\n\n\t\t\t\t// append escaped variant to result\n\t\t\t\tres += escaped;\n\n\t\t\t} else if (nativeEncodePos === -1) {\n\t\t\t\t// use native encode only when needed\n\t\t\t\tnativeEncodePos = pos;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nativeEncodePos !== -1) {\n\t\tres += encodeURIComponent(uriComponent.substring(nativeEncodePos));\n\t}\n\n\treturn res !== undefined ? res : uriComponent;\n}\n\nfunction encodeURIComponentMinimal(path: string): string {\n\tlet res: string | undefined = undefined;\n\tfor (let pos = 0; pos < path.length; pos++) {\n\t\tconst code = path.charCodeAt(pos);\n\t\tif (code === CharCode.Hash || code === CharCode.QuestionMark) {\n\t\t\tif (res === undefined) {\n\t\t\t\tres = path.substr(0, pos);\n\t\t\t}\n\t\t\tres += encodeTable[code];\n\t\t} else {\n\t\t\tif (res !== undefined) {\n\t\t\t\tres += path[pos];\n\t\t\t}\n\t\t}\n\t}\n\treturn res !== undefined ? res : path;\n}\n\n/**\n * Compute `fsPath` for the given uri\n */\nexport function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string {\n\n\tlet value: string;\n\tif (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {\n\t\t// unc path: file://shares/c$/far/boo\n\t\tvalue = `//${uri.authority}${uri.path}`;\n\t} else if (\n\t\turi.path.charCodeAt(0) === CharCode.Slash\n\t\t&& (uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z || uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)\n\t\t&& uri.path.charCodeAt(2) === CharCode.Colon\n\t) {\n\t\tif (!keepDriveLetterCasing) {\n\t\t\t// windows drive letter: file:///c:/far/boo\n\t\t\tvalue = uri.path[1].toLowerCase() + uri.path.substr(2);\n\t\t} else {\n\t\t\tvalue = uri.path.substr(1);\n\t\t}\n\t} else {\n\t\t// other path\n\t\tvalue = uri.path;\n\t}\n\tif (isWindows) {\n\t\tvalue = value.replace(/\\//g, '\\\\');\n\t}\n\treturn value;\n}\n\n/**\n * Create the external version of a uri\n */\nfunction _asFormatted(uri: URI, skipEncoding: boolean): string {\n\n\tconst encoder = !skipEncoding\n\t\t? encodeURIComponentFast\n\t\t: encodeURIComponentMinimal;\n\n\tlet res = '';\n\tlet { scheme, authority, path, query, fragment } = uri;\n\tif (scheme) {\n\t\tres += scheme;\n\t\tres += ':';\n\t}\n\tif (authority || scheme === 'file') {\n\t\tres += _slash;\n\t\tres += _slash;\n\t}\n\tif (authority) {\n\t\tlet idx = authority.indexOf('@');\n\t\tif (idx !== -1) {\n\t\t\t// @\n\t\t\tconst userinfo = authority.substr(0, idx);\n\t\t\tauthority = authority.substr(idx + 1);\n\t\t\tidx = userinfo.lastIndexOf(':');\n\t\t\tif (idx === -1) {\n\t\t\t\tres += encoder(userinfo, false, false);\n\t\t\t} else {\n\t\t\t\t// :@\n\t\t\t\tres += encoder(userinfo.substr(0, idx), false, false);\n\t\t\t\tres += ':';\n\t\t\t\tres += encoder(userinfo.substr(idx + 1), false, true);\n\t\t\t}\n\t\t\tres += '@';\n\t\t}\n\t\tauthority = authority.toLowerCase();\n\t\tidx = authority.lastIndexOf(':');\n\t\tif (idx === -1) {\n\t\t\tres += encoder(authority, false, true);\n\t\t} else {\n\t\t\t// :\n\t\t\tres += encoder(authority.substr(0, idx), false, true);\n\t\t\tres += authority.substr(idx);\n\t\t}\n\t}\n\tif (path) {\n\t\t// lower-case windows drive letters in /C:/fff or C:/fff\n\t\tif (path.length >= 3 && path.charCodeAt(0) === CharCode.Slash && path.charCodeAt(2) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(1);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t} else if (path.length >= 2 && path.charCodeAt(1) === CharCode.Colon) {\n\t\t\tconst code = path.charCodeAt(0);\n\t\t\tif (code >= CharCode.A && code <= CharCode.Z) {\n\t\t\t\tpath = `${String.fromCharCode(code + 32)}:${path.substr(2)}`; // \"/c:\".length === 3\n\t\t\t}\n\t\t}\n\t\t// encode the rest of the path\n\t\tres += encoder(path, true, false);\n\t}\n\tif (query) {\n\t\tres += '?';\n\t\tres += encoder(query, false, false);\n\t}\n\tif (fragment) {\n\t\tres += '#';\n\t\tres += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;\n\t}\n\treturn res;\n}\n\n// --- decode\n\nfunction decodeURIComponentGraceful(str: string): string {\n\ttry {\n\t\treturn decodeURIComponent(str);\n\t} catch {\n\t\tif (str.length > 3) {\n\t\t\treturn str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));\n\t\t} else {\n\t\t\treturn str;\n\t\t}\n\t}\n}\n\nconst _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;\n\nfunction percentDecode(str: string): string {\n\tif (!str.match(_rEncodedAsHex)) {\n\t\treturn str;\n\t}\n\treturn str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));\n}\n\n/**\n * Mapped-type that replaces all occurrences of URI with UriComponents\n */\nexport type UriDto = { [K in keyof T]: T[K] extends URI\n\t? UriComponents\n\t: UriDto };\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n'use strict';\n\nimport { CharCode } from './charCode';\nimport { URI } from './uri';\nimport * as nodePath from 'path';\n\nconst posixPath = nodePath.posix || nodePath;\nconst slash = '/';\n\nexport namespace Utils {\n\n /**\n * Joins one or more input paths to the path of URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved.\n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are preserved.\n * \n * @param uri The input URI.\n * @param paths The paths to be joined with the path of URI.\n * @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function joinPath(uri: URI, ...paths: string[]): URI {\n return uri.with({ path: posixPath.join(uri.path, ...paths) });\n }\n\n\n /**\n * Resolves one or more paths against the path of a URI. \n * '/' is used as the directory separation character. \n * \n * The resolved path will be normalized. That means:\n * - all '..' and '.' segments are resolved. \n * - multiple, sequential occurences of '/' are replaced by a single instance of '/'.\n * - trailing separators are removed.\n * \n * @param uri The input URI.\n * @param paths The paths to resolve against the path of URI.\n * @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.\n */\n export function resolvePath(uri: URI, ...paths: string[]): URI {\n let path = uri.path; \n let slashAdded = false;\n if (path[0] !== slash) {\n path = slash + path; // make the path abstract: for posixPath.resolve the first segments has to be absolute or cwd is used.\n slashAdded = true;\n }\n let resolvedPath = posixPath.resolve(path, ...paths);\n if (slashAdded && resolvedPath[0] === slash && !uri.authority) {\n resolvedPath = resolvedPath.substring(1);\n }\n return uri.with({ path: resolvedPath });\n }\n\n /**\n * Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The orignal URI is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The last segment of the URIs path.\n */\n export function dirname(uri: URI): URI {\n if (uri.path.length === 0 || uri.path === slash) {\n return uri;\n }\n let path = posixPath.dirname(uri.path);\n if (path.length === 1 && path.charCodeAt(0) === CharCode.Period) {\n path = '';\n }\n return uri.with({ path });\n }\n\n /**\n * Returns the last segment of the path of a URI, similar to the Unix basename command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The base name of the URIs path.\n */\n export function basename(uri: URI): string {\n return posixPath.basename(uri.path);\n }\n\n /**\n * Returns the extension name of the path of a URI, similar to the Unix extname command. \n * In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.\n * The empty string is returned if the URIs path is empty or does not contain any path segments.\n * \n * @param uri The input URI.\n * @return The extension name of the URIs path.\n */\n export function extname(uri: URI): string {\n return posixPath.extname(uri.path);\n }\n}", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { URI, Utils } from 'vscode-uri';\n\nexport { URI };\n\nexport namespace UriUtils {\n\n export const basename = Utils.basename;\n export const dirname = Utils.dirname;\n export const extname = Utils.extname;\n export const joinPath = Utils.joinPath;\n export const resolvePath = Utils.resolvePath;\n\n export function equals(a?: URI | string, b?: URI | string): boolean {\n return a?.toString() === b?.toString();\n }\n\n export function relative(from: URI | string, to: URI | string): string {\n const fromPath = typeof from === 'string' ? from : from.path;\n const toPath = typeof to === 'string' ? to : to.path;\n const fromParts = fromPath.split('/').filter(e => e.length > 0);\n const toParts = toPath.split('/').filter(e => e.length > 0);\n let i = 0;\n for (; i < fromParts.length; i++) {\n if (fromParts[i] !== toParts[i]) {\n break;\n }\n }\n const backPart = '../'.repeat(fromParts.length - i);\n const toPart = toParts.slice(i).join('/');\n return backPart + toPart;\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { DefinitionParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { CstNode } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport { LocationLink } from 'vscode-languageserver';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\n\n/**\n * Language-specific service for handling go to definition requests.\n */\nexport interface DefinitionProvider {\n /**\n * Handle a go to definition request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getDefinition(document: LangiumDocument, params: DefinitionParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport interface GoToLink {\n source: CstNode\n target: CstNode\n targetDocument: LangiumDocument\n}\n\nexport class DefaultDefinitionProvider implements DefinitionProvider {\n\n protected readonly nameProvider: NameProvider;\n protected readonly references: References;\n protected readonly grammarConfig: GrammarConfig;\n\n constructor(services: LangiumServices) {\n this.nameProvider = services.references.NameProvider;\n this.references = services.references.References;\n this.grammarConfig = services.parser.GrammarConfig;\n }\n\n getDefinition(document: LangiumDocument, params: DefinitionParams): MaybePromise {\n const rootNode = document.parseResult.value;\n if (rootNode.$cstNode) {\n const cst = rootNode.$cstNode;\n const sourceCstNode = findDeclarationNodeAtOffset(cst, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp);\n if (sourceCstNode) {\n return this.collectLocationLinks(sourceCstNode, params);\n }\n }\n return undefined;\n }\n\n protected collectLocationLinks(sourceCstNode: CstNode, _params: DefinitionParams): MaybePromise {\n const goToLink = this.findLink(sourceCstNode);\n if (goToLink) {\n return [LocationLink.create(\n goToLink.targetDocument.textDocument.uri,\n (goToLink.target.astNode.$cstNode ?? goToLink.target).range,\n goToLink.target.range,\n goToLink.source.range\n )];\n }\n return undefined;\n }\n\n protected findLink(source: CstNode): GoToLink | undefined {\n const target = this.references.findDeclarationNode(source);\n if (target?.astNode) {\n const targetDocument = getDocument(target.astNode);\n if (target && targetDocument) {\n return { source, target, targetDocument };\n }\n }\n return undefined;\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n******************************************************************************/\n\nimport { type Connection, TextDocuments } from 'vscode-languageserver';\nimport { createDefaultCoreModule, createDefaultSharedCoreModule, type DefaultCoreModuleContext, type DefaultSharedCoreModuleContext } from '../default-module.js';\nimport { Module } from '../dependency-injection.js';\nimport type { LangiumDefaultCoreServices, LangiumDefaultSharedCoreServices } from '../services.js';\nimport { TextDocument } from '../workspace/documents.js';\nimport { DefaultCompletionProvider } from './completion/completion-provider.js';\nimport { DefaultDefinitionProvider } from './definition-provider.js';\nimport { DefaultDocumentHighlightProvider } from './document-highlight-provider.js';\nimport { DefaultDocumentSymbolProvider } from './document-symbol-provider.js';\nimport { DefaultDocumentUpdateHandler } from './document-update-handler.js';\nimport { DefaultFoldingRangeProvider } from './folding-range-provider.js';\nimport { DefaultFuzzyMatcher } from './fuzzy-matcher.js';\nimport { MultilineCommentHoverProvider } from './hover-provider.js';\nimport { DefaultLanguageServer } from './language-server.js';\nimport type { LangiumLSPServices, LangiumServices, LangiumSharedLSPServices, LangiumSharedServices } from './lsp-services.js';\nimport { DefaultNodeKindProvider } from './node-kind-provider.js';\nimport { DefaultReferencesProvider } from './references-provider.js';\nimport { DefaultRenameProvider } from './rename-provider.js';\nimport { DefaultWorkspaceSymbolProvider } from './workspace-symbol-provider.js';\n\n/**\n * Context required for creating the default language-specific dependency injection module.\n */\nexport interface DefaultModuleContext extends DefaultCoreModuleContext {\n shared: LangiumSharedServices;\n}\n\n/**\n * Creates a dependency injection module configuring the default Core & LSP services for a Langium-based language implementation.\n * This is a set of services that are dedicated to a specific language.\n */\nexport function createDefaultModule(context: DefaultModuleContext): Module {\n return Module.merge(\n createDefaultCoreModule(context),\n createDefaultLSPModule(context)\n );\n}\n\n/**\n * Creates a dependency injection module configuring the default LSP services.\n * This is a set of services that are dedicated to a specific language.\n */\nexport function createDefaultLSPModule(context: DefaultModuleContext): Module {\n return {\n lsp: {\n CompletionProvider: (services) => new DefaultCompletionProvider(services),\n DocumentSymbolProvider: (services) => new DefaultDocumentSymbolProvider(services),\n HoverProvider: (services) => new MultilineCommentHoverProvider(services),\n FoldingRangeProvider: (services) => new DefaultFoldingRangeProvider(services),\n ReferencesProvider: (services) => new DefaultReferencesProvider(services),\n DefinitionProvider: (services) => new DefaultDefinitionProvider(services),\n DocumentHighlightProvider: (services) => new DefaultDocumentHighlightProvider(services),\n RenameProvider: (services) => new DefaultRenameProvider(services)\n },\n shared: () => context.shared\n };\n}\n\nexport interface DefaultSharedModuleContext extends DefaultSharedCoreModuleContext {\n /**\n * Represents an abstract language server connection\n */\n connection?: Connection;\n}\n\n/**\n * Creates a dependency injection module configuring the default core & LSP services shared among languages supported by a Langium-based language server.\n * This is the set of services that are shared between multiple languages.\n */\nexport function createDefaultSharedModule(context: DefaultSharedModuleContext): Module {\n return Module.merge(\n createDefaultSharedCoreModule(context),\n createDefaultSharedLSPModule(context)\n );\n}\n\n/**\n * Creates a dependency injection module configuring the default shared LSP services.\n * This is the set of services that are shared between multiple languages.\n */\nexport function createDefaultSharedLSPModule(context: DefaultSharedModuleContext): Module {\n return {\n lsp: {\n Connection: () => context.connection,\n LanguageServer: (services) => new DefaultLanguageServer(services),\n DocumentUpdateHandler: (services) => new DefaultDocumentUpdateHandler(services),\n WorkspaceSymbolProvider: (services) => new DefaultWorkspaceSymbolProvider(services),\n NodeKindProvider: () => new DefaultNodeKindProvider(),\n FuzzyMatcher: () => new DefaultFuzzyMatcher(),\n },\n workspace: {\n TextDocuments: () => new TextDocuments(TextDocument)\n }\n };\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport { DefaultNameRegexp } from '../utils/cst-utils.js';\nimport { isCommentTerminal, terminalRegex } from '../utils/grammar-utils.js';\nimport { isMultilineComment } from '../utils/regexp-utils.js';\nimport { isTerminalRule } from './generated/ast.js';\n\nexport interface GrammarConfig {\n /**\n * Lists all rule names which are classified as multiline comment rules\n */\n multilineCommentRules: string[]\n /**\n * A regular expression which matches characters of names\n */\n nameRegexp: RegExp\n}\n\n/**\n * Create the default grammar configuration (used by `createDefaultModule`). This can be overridden in a\n * language-specific module.\n */\nexport function createGrammarConfig(services: LangiumCoreServices): GrammarConfig {\n const rules: string[] = [];\n const grammar = services.Grammar;\n for (const rule of grammar.rules) {\n if (isTerminalRule(rule) && isCommentTerminal(rule) && isMultilineComment(terminalRegex(rule))) {\n rules.push(rule.name);\n }\n }\n return {\n multilineCommentRules: rules,\n nameRegexp: DefaultNameRegexp\n };\n}\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n", "/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n", "/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n", "import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n", "import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n", "import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n", "/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nexport default identity;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "import isObject from './isObject.js';\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nexport default baseCreate;\n", "/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nexport default apply;\n", "/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nexport default noop;\n", "/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n", "/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nexport default shortOut;\n", "/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nexport default constant;\n", "import getNative from './_getNative.js';\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nexport default defineProperty;\n", "import constant from './constant.js';\nimport defineProperty from './_defineProperty.js';\nimport identity from './identity.js';\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nexport default baseSetToString;\n", "import baseSetToString from './_baseSetToString.js';\nimport shortOut from './_shortOut.js';\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nexport default setToString;\n", "/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nexport default arrayEach;\n", "/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nexport default baseFindIndex;\n", "/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nexport default baseIsNaN;\n", "/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nexport default strictIndexOf;\n", "import baseFindIndex from './_baseFindIndex.js';\nimport baseIsNaN from './_baseIsNaN.js';\nimport strictIndexOf from './_strictIndexOf.js';\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nexport default baseIndexOf;\n", "import baseIndexOf from './_baseIndexOf.js';\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nexport default arrayIncludes;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "import defineProperty from './_defineProperty.js';\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nexport default baseAssignValue;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nexport default assignValue;\n", "import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nexport default copyObject;\n", "import apply from './_apply.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nexport default overRest;\n", "import identity from './identity.js';\nimport overRest from './_overRest.js';\nimport setToString from './_setToString.js';\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nexport default baseRest;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n", "import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nexport default createAssigner;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "import assignValue from './_assignValue.js';\nimport copyObject from './_copyObject.js';\nimport createAssigner from './_createAssigner.js';\nimport isArrayLike from './isArrayLike.js';\nimport isPrototype from './_isPrototype.js';\nimport keys from './keys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\nvar assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n});\n\nexport default assign;\n", "/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default nativeKeysIn;\n", "import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeysIn;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n", "import isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nexport default isKey;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nexport default memoize;\n", "import memoize from './memoize.js';\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nexport default memoizeCapped;\n", "import memoizeCapped from './_memoizeCapped.js';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nexport default stringToPath;\n", "import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n", "import isArray from './isArray.js';\nimport isKey from './_isKey.js';\nimport stringToPath from './_stringToPath.js';\nimport toString from './toString.js';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nexport default castPath;\n", "import isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default toKey;\n", "import castPath from './_castPath.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nexport default baseGet;\n", "import baseGet from './_baseGet.js';\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nexport default get;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import Symbol from './_Symbol.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nexport default isFlattenable;\n", "import arrayPush from './_arrayPush.js';\nimport isFlattenable from './_isFlattenable.js';\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nexport default baseFlatten;\n", "import baseFlatten from './_baseFlatten.js';\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nexport default flatten;\n", "import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n", "/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nexport default baseSlice;\n", "/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nexport default arrayReduce;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "import copyObject from './_copyObject.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nexport default baseAssign;\n", "import copyObject from './_copyObject.js';\nimport keysIn from './keysIn.js';\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nexport default baseAssignIn;\n", "import root from './_root.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nexport default cloneBuffer;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import copyObject from './_copyObject.js';\nimport getSymbols from './_getSymbols.js';\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nexport default copySymbols;\n", "import arrayPush from './_arrayPush.js';\nimport getPrototype from './_getPrototype.js';\nimport getSymbols from './_getSymbols.js';\nimport stubArray from './stubArray.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nexport default getSymbolsIn;\n", "import copyObject from './_copyObject.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nexport default copySymbolsIn;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nexport default getAllKeysIn;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nexport default initCloneArray;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "import Uint8Array from './_Uint8Array.js';\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nexport default cloneArrayBuffer;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nexport default cloneDataView;\n", "/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nexport default cloneRegExp;\n", "import Symbol from './_Symbol.js';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nexport default cloneSymbol;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nexport default cloneTypedArray;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\nimport cloneDataView from './_cloneDataView.js';\nimport cloneRegExp from './_cloneRegExp.js';\nimport cloneSymbol from './_cloneSymbol.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nexport default initCloneByTag;\n", "import baseCreate from './_baseCreate.js';\nimport getPrototype from './_getPrototype.js';\nimport isPrototype from './_isPrototype.js';\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nexport default initCloneObject;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nexport default baseIsMap;\n", "import baseIsMap from './_baseIsMap.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nexport default isMap;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nexport default baseIsSet;\n", "import baseIsSet from './_baseIsSet.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nexport default isSet;\n", "import Stack from './_Stack.js';\nimport arrayEach from './_arrayEach.js';\nimport assignValue from './_assignValue.js';\nimport baseAssign from './_baseAssign.js';\nimport baseAssignIn from './_baseAssignIn.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport copyArray from './_copyArray.js';\nimport copySymbols from './_copySymbols.js';\nimport copySymbolsIn from './_copySymbolsIn.js';\nimport getAllKeys from './_getAllKeys.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\nimport getTag from './_getTag.js';\nimport initCloneArray from './_initCloneArray.js';\nimport initCloneByTag from './_initCloneByTag.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isMap from './isMap.js';\nimport isObject from './isObject.js';\nimport isSet from './isSet.js';\nimport keys from './keys.js';\nimport keysIn from './keysIn.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nexport default baseClone;\n", "import baseClone from './_baseClone.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n}\n\nexport default clone;\n", "/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default compact;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import Stack from './_Stack.js';\nimport baseIsEqual from './_baseIsEqual.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nexport default baseIsMatch;\n", "import isObject from './isObject.js';\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nexport default isStrictComparable;\n", "import isStrictComparable from './_isStrictComparable.js';\nimport keys from './keys.js';\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nexport default getMatchData;\n", "/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nexport default matchesStrictComparable;\n", "import baseIsMatch from './_baseIsMatch.js';\nimport getMatchData from './_getMatchData.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nexport default baseMatches;\n", "/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nexport default baseHasIn;\n", "import castPath from './_castPath.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isIndex from './_isIndex.js';\nimport isLength from './isLength.js';\nimport toKey from './_toKey.js';\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nexport default hasPath;\n", "import baseHasIn from './_baseHasIn.js';\nimport hasPath from './_hasPath.js';\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nexport default hasIn;\n", "import baseIsEqual from './_baseIsEqual.js';\nimport get from './get.js';\nimport hasIn from './hasIn.js';\nimport isKey from './_isKey.js';\nimport isStrictComparable from './_isStrictComparable.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\nimport toKey from './_toKey.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nexport default baseMatchesProperty;\n", "/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nexport default baseProperty;\n", "import baseGet from './_baseGet.js';\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nexport default basePropertyDeep;\n", "import baseProperty from './_baseProperty.js';\nimport basePropertyDeep from './_basePropertyDeep.js';\nimport isKey from './_isKey.js';\nimport toKey from './_toKey.js';\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nexport default property;\n", "import baseMatches from './_baseMatches.js';\nimport baseMatchesProperty from './_baseMatchesProperty.js';\nimport identity from './identity.js';\nimport isArray from './isArray.js';\nimport property from './property.js';\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nexport default baseIteratee;\n", "/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n", "/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nexport default createBaseFor;\n", "import createBaseFor from './_createBaseFor.js';\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nexport default baseFor;\n", "import baseFor from './_baseFor.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nexport default baseForOwn;\n", "import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n", "import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n", "import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n", "import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n", "import baseRest from './_baseRest.js';\nimport eq from './eq.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport keysIn from './keysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n});\n\nexport default defaults;\n", "import isArrayLike from './isArrayLike.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\nexport default isArrayLikeObject;\n", "/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nexport default arrayIncludesWith;\n", "import SetCache from './_SetCache.js';\nimport arrayIncludes from './_arrayIncludes.js';\nimport arrayIncludesWith from './_arrayIncludesWith.js';\nimport arrayMap from './_arrayMap.js';\nimport baseUnary from './_baseUnary.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\nfunction baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n}\n\nexport default baseDifference;\n", "import baseDifference from './_baseDifference.js';\nimport baseFlatten from './_baseFlatten.js';\nimport baseRest from './_baseRest.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\n\n/**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\nvar difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n});\n\nexport default difference;\n", "/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nexport default last;\n", "import baseSlice from './_baseSlice.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\nfunction drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n}\n\nexport default drop;\n", "import baseSlice from './_baseSlice.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\nfunction dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n}\n\nexport default dropRight;\n", "import identity from './identity.js';\n\n/**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\nfunction castFunction(value) {\n return typeof value == 'function' ? value : identity;\n}\n\nexport default castFunction;\n", "import arrayEach from './_arrayEach.js';\nimport baseEach from './_baseEach.js';\nimport castFunction from './_castFunction.js';\nimport isArray from './isArray.js';\n\n/**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, castFunction(iteratee));\n}\n\nexport default forEach;\n", "/**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\nfunction arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n}\n\nexport default arrayEvery;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\nfunction baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n}\n\nexport default baseEvery;\n", "import arrayEvery from './_arrayEvery.js';\nimport baseEvery from './_baseEvery.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\nfunction every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default every;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n}\n\nexport default baseFilter;\n", "import arrayFilter from './_arrayFilter.js';\nimport baseFilter from './_baseFilter.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\nfunction filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default filter;\n", "import baseIteratee from './_baseIteratee.js';\nimport isArrayLike from './isArrayLike.js';\nimport keys from './keys.js';\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nexport default createFind;\n", "import baseFindIndex from './_baseFindIndex.js';\nimport baseIteratee from './_baseIteratee.js';\nimport toInteger from './toInteger.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\nfunction findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, baseIteratee(predicate, 3), index);\n}\n\nexport default findIndex;\n", "import createFind from './_createFind.js';\nimport findIndex from './findIndex.js';\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nexport default find;\n", "/**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\nfunction head(array) {\n return (array && array.length) ? array[0] : undefined;\n}\n\nexport default head;\n", "import baseEach from './_baseEach.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nexport default baseMap;\n", "import arrayMap from './_arrayMap.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseMap from './_baseMap.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nexport default map;\n", "import baseFlatten from './_baseFlatten.js';\nimport map from './map.js';\n\n/**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\nfunction flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n}\n\nexport default flatMap;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport createAggregator from './_createAggregator.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\nvar groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n});\n\nexport default groupBy;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n}\n\nexport default baseHas;\n", "import baseHas from './_baseHas.js';\nimport hasPath from './_hasPath.js';\n\n/**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\nfunction has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n}\n\nexport default has;\n", "import baseGetTag from './_baseGetTag.js';\nimport isArray from './isArray.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nexport default isString;\n", "import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n", "import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n", "import baseIndexOf from './_baseIndexOf.js';\nimport isArrayLike from './isArrayLike.js';\nimport isString from './isString.js';\nimport toInteger from './toInteger.js';\nimport values from './values.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\nfunction includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n}\n\nexport default includes;\n", "import baseIndexOf from './_baseIndexOf.js';\nimport toInteger from './toInteger.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\nfunction indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n}\n\nexport default indexOf;\n", "import baseKeys from './_baseKeys.js';\nimport getTag from './_getTag.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLike from './isArrayLike.js';\nimport isBuffer from './isBuffer.js';\nimport isPrototype from './_isPrototype.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nexport default isEmpty;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar regexpTag = '[object RegExp]';\n\n/**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\nfunction baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n}\n\nexport default baseIsRegExp;\n", "import baseIsRegExp from './_baseIsRegExp.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;\n\n/**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\nvar isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\nexport default isRegExp;\n", "/**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\nfunction isUndefined(value) {\n return value === undefined;\n}\n\nexport default isUndefined;\n", "/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nexport default baseLt;\n", "import isSymbol from './isSymbol.js';\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nexport default baseExtremum;\n", "import baseExtremum from './_baseExtremum.js';\nimport baseLt from './_baseLt.js';\nimport identity from './identity.js';\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nexport default min;\n", "/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\nfunction negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n}\n\nexport default negate;\n", "import assignValue from './_assignValue.js';\nimport castPath from './_castPath.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nexport default baseSet;\n", "import baseGet from './_baseGet.js';\nimport baseSet from './_baseSet.js';\nimport castPath from './_castPath.js';\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nexport default basePickBy;\n", "import arrayMap from './_arrayMap.js';\nimport baseIteratee from './_baseIteratee.js';\nimport basePickBy from './_basePickBy.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\nfunction pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = baseIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n}\n\nexport default pickBy;\n", "/**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\nfunction baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n}\n\nexport default baseReduce;\n", "import arrayReduce from './_arrayReduce.js';\nimport baseEach from './_baseEach.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseReduce from './_baseReduce.js';\nimport isArray from './isArray.js';\n\n/**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\nfunction reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n}\n\nexport default reduce;\n", "import arrayFilter from './_arrayFilter.js';\nimport baseFilter from './_baseFilter.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\nimport negate from './negate.js';\n\n/**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\nfunction reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(baseIteratee(predicate, 3)));\n}\n\nexport default reject;\n", "import baseEach from './_baseEach.js';\n\n/**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n}\n\nexport default baseSome;\n", "import arraySome from './_arraySome.js';\nimport baseIteratee from './_baseIteratee.js';\nimport baseSome from './_baseSome.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\nfunction some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, baseIteratee(predicate, 3));\n}\n\nexport default some;\n", "import Set from './_Set.js';\nimport noop from './noop.js';\nimport setToArray from './_setToArray.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nexport default createSet;\n", "import SetCache from './_SetCache.js';\nimport arrayIncludes from './_arrayIncludes.js';\nimport arrayIncludesWith from './_arrayIncludesWith.js';\nimport cacheHas from './_cacheHas.js';\nimport createSet from './_createSet.js';\nimport setToArray from './_setToArray.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nexport default baseUniq;\n", "import baseUniq from './_baseUniq.js';\n\n/**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\nfunction uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n}\n\nexport default uniq;\n", "import baseIteratee from './_baseIteratee.js';\nimport baseUniq from './_baseUniq.js';\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];\n}\n\nexport default uniqBy;\n", "export function PRINT_ERROR(msg: string) {\n /* istanbul ignore else - can't override global.console in node.js */\n if (console && console.error) {\n console.error(`Error: ${msg}`);\n }\n}\n\nexport function PRINT_WARNING(msg: string) {\n /* istanbul ignore else - can't override global.console in node.js*/\n if (console && console.warn) {\n // TODO: modify docs accordingly\n console.warn(`Warning: ${msg}`);\n }\n}\n", "export function timer(func: () => T): { time: number; value: T } {\n const start = new Date().getTime();\n const val = func();\n const end = new Date().getTime();\n const total = end - start;\n return { time: total, value: val };\n}\n", "// based on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216\nexport function toFastProperties(toBecomeFast: any) {\n function FakeConstructor() {}\n\n // If our object is used as a constructor, it would receive\n FakeConstructor.prototype = toBecomeFast;\n const fakeInstance = new (FakeConstructor as any)();\n\n function fakeAccess() {\n return typeof fakeInstance.bar;\n }\n\n // help V8 understand this is a \"real\" prototype by actually using\n // the fake instance.\n fakeAccess();\n fakeAccess();\n\n // Always true condition to suppress the Firefox warning of unreachable\n // code after a return statement.\n if (1) return toBecomeFast;\n\n // Eval prevents optimization of this method (even though this is dead code)\n // - https://esbuild.github.io/content-types/#direct-eval\n /* istanbul ignore next */\n // tslint:disable-next-line\n (0, eval)(toBecomeFast);\n}\n", "import { assign, forEach, isRegExp, isString, map, pickBy } from \"lodash-es\";\nimport type {\n IGASTVisitor,\n IProduction,\n IProductionWithOccurrence,\n ISerializedGast,\n TokenType,\n} from \"@chevrotain/types\";\n\n// TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\nfunction tokenLabel(tokType: TokenType): string {\n if (hasTokenLabel(tokType)) {\n return tokType.LABEL;\n } else {\n return tokType.name;\n }\n}\n\n// TODO: duplicated code to avoid extracting another sub-package -- how to avoid?\nfunction hasTokenLabel(\n obj: TokenType,\n): obj is TokenType & Pick, \"LABEL\"> {\n return isString(obj.LABEL) && obj.LABEL !== \"\";\n}\n\nexport abstract class AbstractProduction\n implements IProduction\n{\n public get definition(): T[] {\n return this._definition;\n }\n public set definition(value: T[]) {\n this._definition = value;\n }\n\n constructor(protected _definition: T[]) {}\n\n accept(visitor: IGASTVisitor): void {\n visitor.visit(this);\n forEach(this.definition, (prod) => {\n prod.accept(visitor);\n });\n }\n}\n\nexport class NonTerminal\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public nonTerminalName!: string;\n public label?: string;\n public referencedRule!: Rule;\n public idx: number = 1;\n\n constructor(options: {\n nonTerminalName: string;\n label?: string;\n referencedRule?: Rule;\n idx?: number;\n }) {\n super([]);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n\n set definition(definition: IProduction[]) {\n // immutable\n }\n\n get definition(): IProduction[] {\n if (this.referencedRule !== undefined) {\n return this.referencedRule.definition;\n }\n return [];\n }\n\n accept(visitor: IGASTVisitor): void {\n visitor.visit(this);\n // don't visit children of a reference, we will get cyclic infinite loops if we do so\n }\n}\n\nexport class Rule extends AbstractProduction {\n public name!: string;\n public orgText: string = \"\";\n\n constructor(options: {\n name: string;\n definition: IProduction[];\n orgText?: string;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class Alternative extends AbstractProduction {\n public ignoreAmbiguities: boolean = false;\n\n constructor(options: {\n definition: IProduction[];\n ignoreAmbiguities?: boolean;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class Option\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public idx: number = 1;\n public maxLookahead?: number;\n\n constructor(options: {\n definition: IProduction[];\n idx?: number;\n maxLookahead?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class RepetitionMandatory\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public idx: number = 1;\n public maxLookahead?: number;\n\n constructor(options: {\n definition: IProduction[];\n idx?: number;\n maxLookahead?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class RepetitionMandatoryWithSeparator\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public separator!: TokenType;\n public idx: number = 1;\n public maxLookahead?: number;\n\n constructor(options: {\n definition: IProduction[];\n separator: TokenType;\n idx?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class Repetition\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public separator!: TokenType;\n public idx: number = 1;\n public maxLookahead?: number;\n\n constructor(options: {\n definition: IProduction[];\n idx?: number;\n maxLookahead?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class RepetitionWithSeparator\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public separator!: TokenType;\n public idx: number = 1;\n public maxLookahead?: number;\n\n constructor(options: {\n definition: IProduction[];\n separator: TokenType;\n idx?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class Alternation\n extends AbstractProduction\n implements IProductionWithOccurrence\n{\n public idx: number = 1;\n public ignoreAmbiguities: boolean = false;\n public hasPredicates: boolean = false;\n public maxLookahead?: number;\n\n public get definition(): Alternative[] {\n return this._definition;\n }\n public set definition(value: Alternative[]) {\n this._definition = value;\n }\n\n constructor(options: {\n definition: Alternative[];\n idx?: number;\n ignoreAmbiguities?: boolean;\n hasPredicates?: boolean;\n maxLookahead?: number;\n }) {\n super(options.definition);\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n}\n\nexport class Terminal implements IProductionWithOccurrence {\n public terminalType!: TokenType;\n public label?: string;\n public idx: number = 1;\n\n constructor(options: {\n terminalType: TokenType;\n label?: string;\n idx?: number;\n }) {\n assign(\n this,\n pickBy(options, (v) => v !== undefined),\n );\n }\n\n accept(visitor: IGASTVisitor): void {\n visitor.visit(this);\n }\n}\n\nexport interface ISerializedBasic extends ISerializedGast {\n type:\n | \"Alternative\"\n | \"Option\"\n | \"RepetitionMandatory\"\n | \"Repetition\"\n | \"Alternation\";\n idx?: number;\n}\n\nexport interface ISerializedGastRule extends ISerializedGast {\n type: \"Rule\";\n name: string;\n orgText: string;\n}\n\nexport interface ISerializedNonTerminal extends ISerializedGast {\n type: \"NonTerminal\";\n name: string;\n label?: string;\n idx: number;\n}\n\nexport interface ISerializedTerminal extends ISerializedGast {\n type: \"Terminal\";\n name: string;\n terminalLabel?: string;\n label?: string;\n pattern?: string;\n idx: number;\n}\n\nexport interface ISerializedTerminalWithSeparator extends ISerializedGast {\n type: \"RepetitionMandatoryWithSeparator\" | \"RepetitionWithSeparator\";\n idx: number;\n separator: ISerializedTerminal;\n}\n\nexport type ISerializedGastAny =\n | ISerializedBasic\n | ISerializedGastRule\n | ISerializedNonTerminal\n | ISerializedTerminal\n | ISerializedTerminalWithSeparator;\n\nexport function serializeGrammar(topRules: Rule[]): ISerializedGast[] {\n return map(topRules, serializeProduction);\n}\n\nexport function serializeProduction(node: IProduction): ISerializedGast {\n function convertDefinition(definition: IProduction[]): ISerializedGast[] {\n return map(definition, serializeProduction);\n }\n /* istanbul ignore else */\n if (node instanceof NonTerminal) {\n const serializedNonTerminal: ISerializedNonTerminal = {\n type: \"NonTerminal\",\n name: node.nonTerminalName,\n idx: node.idx,\n };\n\n if (isString(node.label)) {\n serializedNonTerminal.label = node.label;\n }\n\n return serializedNonTerminal;\n } else if (node instanceof Alternative) {\n return {\n type: \"Alternative\",\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof Option) {\n return {\n type: \"Option\",\n idx: node.idx,\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof RepetitionMandatory) {\n return {\n type: \"RepetitionMandatory\",\n idx: node.idx,\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof RepetitionMandatoryWithSeparator) {\n return {\n type: \"RepetitionMandatoryWithSeparator\",\n idx: node.idx,\n separator: (\n serializeProduction(new Terminal({ terminalType: node.separator }))\n ),\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof RepetitionWithSeparator) {\n return {\n type: \"RepetitionWithSeparator\",\n idx: node.idx,\n separator: (\n serializeProduction(new Terminal({ terminalType: node.separator }))\n ),\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof Repetition) {\n return {\n type: \"Repetition\",\n idx: node.idx,\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof Alternation) {\n return {\n type: \"Alternation\",\n idx: node.idx,\n definition: convertDefinition(node.definition),\n };\n } else if (node instanceof Terminal) {\n const serializedTerminal = {\n type: \"Terminal\",\n name: node.terminalType.name,\n label: tokenLabel(node.terminalType),\n idx: node.idx,\n };\n\n if (isString(node.label)) {\n serializedTerminal.terminalLabel = node.label;\n }\n\n const pattern = node.terminalType.PATTERN;\n if (node.terminalType.PATTERN) {\n serializedTerminal.pattern = isRegExp(pattern)\n ? (pattern).source\n : pattern;\n }\n\n return serializedTerminal;\n } else if (node instanceof Rule) {\n return {\n type: \"Rule\",\n name: node.name,\n orgText: node.orgText,\n definition: convertDefinition(node.definition),\n };\n /* c8 ignore next 3 */\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n", "import {\n Alternation,\n Alternative,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Rule,\n Terminal,\n} from \"./model.js\";\nimport type { IProduction } from \"@chevrotain/types\";\n\nexport abstract class GAstVisitor {\n public visit(node: IProduction): any {\n const nodeAny: any = node;\n switch (nodeAny.constructor) {\n case NonTerminal:\n return this.visitNonTerminal(nodeAny);\n case Alternative:\n return this.visitAlternative(nodeAny);\n case Option:\n return this.visitOption(nodeAny);\n case RepetitionMandatory:\n return this.visitRepetitionMandatory(nodeAny);\n case RepetitionMandatoryWithSeparator:\n return this.visitRepetitionMandatoryWithSeparator(nodeAny);\n case RepetitionWithSeparator:\n return this.visitRepetitionWithSeparator(nodeAny);\n case Repetition:\n return this.visitRepetition(nodeAny);\n case Alternation:\n return this.visitAlternation(nodeAny);\n case Terminal:\n return this.visitTerminal(nodeAny);\n case Rule:\n return this.visitRule(nodeAny);\n /* c8 ignore next 2 */\n default:\n throw Error(\"non exhaustive match\");\n }\n }\n\n /* c8 ignore next */\n public visitNonTerminal(node: NonTerminal): any {}\n\n /* c8 ignore next */\n public visitAlternative(node: Alternative): any {}\n\n /* c8 ignore next */\n public visitOption(node: Option): any {}\n\n /* c8 ignore next */\n public visitRepetition(node: Repetition): any {}\n\n /* c8 ignore next */\n public visitRepetitionMandatory(node: RepetitionMandatory): any {}\n\n /* c8 ignore next 3 */\n public visitRepetitionMandatoryWithSeparator(\n node: RepetitionMandatoryWithSeparator,\n ): any {}\n\n /* c8 ignore next */\n public visitRepetitionWithSeparator(node: RepetitionWithSeparator): any {}\n\n /* c8 ignore next */\n public visitAlternation(node: Alternation): any {}\n\n /* c8 ignore next */\n public visitTerminal(node: Terminal): any {}\n\n /* c8 ignore next */\n public visitRule(node: Rule): any {}\n}\n", "import { every, includes, some } from \"lodash-es\";\nimport {\n AbstractProduction,\n Alternation,\n Alternative,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Rule,\n Terminal,\n} from \"./model.js\";\nimport type { IProduction, IProductionWithOccurrence } from \"@chevrotain/types\";\n\nexport function isSequenceProd(\n prod: IProduction,\n): prod is { definition: IProduction[] } & IProduction {\n return (\n prod instanceof Alternative ||\n prod instanceof Option ||\n prod instanceof Repetition ||\n prod instanceof RepetitionMandatory ||\n prod instanceof RepetitionMandatoryWithSeparator ||\n prod instanceof RepetitionWithSeparator ||\n prod instanceof Terminal ||\n prod instanceof Rule\n );\n}\n\nexport function isOptionalProd(\n prod: IProduction,\n alreadyVisited: NonTerminal[] = [],\n): boolean {\n const isDirectlyOptional =\n prod instanceof Option ||\n prod instanceof Repetition ||\n prod instanceof RepetitionWithSeparator;\n if (isDirectlyOptional) {\n return true;\n }\n\n // note that this can cause infinite loop if one optional empty TOP production has a cyclic dependency with another\n // empty optional top rule\n // may be indirectly optional ((A?B?C?) | (D?E?F?))\n if (prod instanceof Alternation) {\n // for OR its enough for just one of the alternatives to be optional\n return some((prod).definition, (subProd: IProduction) => {\n return isOptionalProd(subProd, alreadyVisited);\n });\n } else if (prod instanceof NonTerminal && includes(alreadyVisited, prod)) {\n // avoiding stack overflow due to infinite recursion\n return false;\n } else if (prod instanceof AbstractProduction) {\n if (prod instanceof NonTerminal) {\n alreadyVisited.push(prod);\n }\n return every(\n (prod).definition,\n (subProd: IProduction) => {\n return isOptionalProd(subProd, alreadyVisited);\n },\n );\n } else {\n return false;\n }\n}\n\nexport function isBranchingProd(\n prod: IProduction,\n): prod is { definition: IProduction[] } & IProduction {\n return prod instanceof Alternation;\n}\n\nexport function getProductionDslName(prod: IProductionWithOccurrence): string {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n return \"SUBRULE\";\n } else if (prod instanceof Option) {\n return \"OPTION\";\n } else if (prod instanceof Alternation) {\n return \"OR\";\n } else if (prod instanceof RepetitionMandatory) {\n return \"AT_LEAST_ONE\";\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n return \"AT_LEAST_ONE_SEP\";\n } else if (prod instanceof RepetitionWithSeparator) {\n return \"MANY_SEP\";\n } else if (prod instanceof Repetition) {\n return \"MANY\";\n } else if (prod instanceof Terminal) {\n return \"CONSUME\";\n /* c8 ignore next 3 */\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n", "import { drop, forEach } from \"lodash-es\";\nimport {\n Alternation,\n Alternative,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Terminal,\n} from \"@chevrotain/gast\";\nimport { IProduction } from \"@chevrotain/types\";\n\n/**\n * A Grammar Walker that computes the \"remaining\" grammar \"after\" a productions in the grammar.\n */\nexport abstract class RestWalker {\n walk(prod: { definition: IProduction[] }, prevRest: any[] = []): void {\n forEach(prod.definition, (subProd: IProduction, index) => {\n const currRest = drop(prod.definition, index + 1);\n /* istanbul ignore else */\n if (subProd instanceof NonTerminal) {\n this.walkProdRef(subProd, currRest, prevRest);\n } else if (subProd instanceof Terminal) {\n this.walkTerminal(subProd, currRest, prevRest);\n } else if (subProd instanceof Alternative) {\n this.walkFlat(subProd, currRest, prevRest);\n } else if (subProd instanceof Option) {\n this.walkOption(subProd, currRest, prevRest);\n } else if (subProd instanceof RepetitionMandatory) {\n this.walkAtLeastOne(subProd, currRest, prevRest);\n } else if (subProd instanceof RepetitionMandatoryWithSeparator) {\n this.walkAtLeastOneSep(subProd, currRest, prevRest);\n } else if (subProd instanceof RepetitionWithSeparator) {\n this.walkManySep(subProd, currRest, prevRest);\n } else if (subProd instanceof Repetition) {\n this.walkMany(subProd, currRest, prevRest);\n } else if (subProd instanceof Alternation) {\n this.walkOr(subProd, currRest, prevRest);\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n }\n\n walkTerminal(\n terminal: Terminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {}\n\n walkProdRef(\n refProd: NonTerminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {}\n\n walkFlat(\n flatProd: Alternative,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABCDEF => after the D the rest is EF\n const fullOrRest = currRest.concat(prevRest);\n this.walk(flatProd, fullOrRest);\n }\n\n walkOption(\n optionProd: Option,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC(DE)?F => after the (DE)? the rest is F\n const fullOrRest = currRest.concat(prevRest);\n this.walk(optionProd, fullOrRest);\n }\n\n walkAtLeastOne(\n atLeastOneProd: RepetitionMandatory,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC(DE)+F => after the (DE)+ the rest is (DE)?F\n const fullAtLeastOneRest: IProduction[] = [\n new Option({ definition: atLeastOneProd.definition }),\n ].concat(currRest, prevRest);\n this.walk(atLeastOneProd, fullAtLeastOneRest);\n }\n\n walkAtLeastOneSep(\n atLeastOneSepProd: RepetitionMandatoryWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC DE(,DE)* F => after the (,DE)+ the rest is (,DE)?F\n const fullAtLeastOneSepRest = restForRepetitionWithSeparator(\n atLeastOneSepProd,\n currRest,\n prevRest,\n );\n this.walk(atLeastOneSepProd, fullAtLeastOneSepRest);\n }\n\n walkMany(\n manyProd: Repetition,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC(DE)*F => after the (DE)* the rest is (DE)?F\n const fullManyRest: IProduction[] = [\n new Option({ definition: manyProd.definition }),\n ].concat(currRest, prevRest);\n this.walk(manyProd, fullManyRest);\n }\n\n walkManySep(\n manySepProd: RepetitionWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC (DE(,DE)*)? F => after the (,DE)* the rest is (,DE)?F\n const fullManySepRest = restForRepetitionWithSeparator(\n manySepProd,\n currRest,\n prevRest,\n );\n this.walk(manySepProd, fullManySepRest);\n }\n\n walkOr(\n orProd: Alternation,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // ABC(D|E|F)G => when finding the (D|E|F) the rest is G\n const fullOrRest = currRest.concat(prevRest);\n // walk all different alternatives\n forEach(orProd.definition, (alt) => {\n // wrapping each alternative in a single definition wrapper\n // to avoid errors in computing the rest of that alternative in the invocation to computeInProdFollows\n // (otherwise for OR([alt1,alt2]) alt2 will be considered in 'rest' of alt1\n const prodWrapper = new Alternative({ definition: [alt] });\n this.walk(prodWrapper, fullOrRest);\n });\n }\n}\n\nfunction restForRepetitionWithSeparator(\n repSepProd: RepetitionWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n) {\n const repSepRest = [\n new Option({\n definition: [\n new Terminal({ terminalType: repSepProd.separator }) as IProduction,\n ].concat(repSepProd.definition),\n }) as IProduction,\n ];\n const fullRepSepRest: IProduction[] = repSepRest.concat(currRest, prevRest);\n return fullRepSepRest;\n}\n", "import { flatten, map, uniq } from \"lodash-es\";\nimport {\n isBranchingProd,\n isOptionalProd,\n isSequenceProd,\n NonTerminal,\n Terminal,\n} from \"@chevrotain/gast\";\nimport { IProduction, TokenType } from \"@chevrotain/types\";\n\nexport function first(prod: IProduction): TokenType[] {\n /* istanbul ignore else */\n if (prod instanceof NonTerminal) {\n // this could in theory cause infinite loops if\n // (1) prod A refs prod B.\n // (2) prod B refs prod A\n // (3) AB can match the empty set\n // in other words a cycle where everything is optional so the first will keep\n // looking ahead for the next optional part and will never exit\n // currently there is no safeguard for this unique edge case because\n // (1) not sure a grammar in which this can happen is useful for anything (productive)\n return first((prod).referencedRule);\n } else if (prod instanceof Terminal) {\n return firstForTerminal(prod);\n } else if (isSequenceProd(prod)) {\n return firstForSequence(prod);\n } else if (isBranchingProd(prod)) {\n return firstForBranching(prod);\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n\nexport function firstForSequence(prod: {\n definition: IProduction[];\n}): TokenType[] {\n let firstSet: TokenType[] = [];\n const seq = prod.definition;\n let nextSubProdIdx = 0;\n let hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n let currSubProd;\n // so we enter the loop at least once (if the definition is not empty\n let isLastInnerProdOptional = true;\n // scan a sequence until it's end or until we have found a NONE optional production in it\n while (hasInnerProdsRemaining && isLastInnerProdOptional) {\n currSubProd = seq[nextSubProdIdx];\n isLastInnerProdOptional = isOptionalProd(currSubProd);\n firstSet = firstSet.concat(first(currSubProd));\n nextSubProdIdx = nextSubProdIdx + 1;\n hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n }\n\n return uniq(firstSet);\n}\n\nexport function firstForBranching(prod: {\n definition: IProduction[];\n}): TokenType[] {\n const allAlternativesFirsts: TokenType[][] = map(\n prod.definition,\n (innerProd) => {\n return first(innerProd);\n },\n );\n return uniq(flatten(allAlternativesFirsts));\n}\n\nexport function firstForTerminal(terminal: Terminal): TokenType[] {\n return [terminal.terminalType];\n}\n", "// TODO: can this be removed? where is it used?\nexport const IN = \"_~IN~_\";\n", "import { RestWalker } from \"./rest.js\";\nimport { first } from \"./first.js\";\nimport { assign, forEach } from \"lodash-es\";\nimport { IN } from \"../constants.js\";\nimport { Alternative, NonTerminal, Rule, Terminal } from \"@chevrotain/gast\";\nimport { IProduction, TokenType } from \"@chevrotain/types\";\n\n// This ResyncFollowsWalker computes all of the follows required for RESYNC\n// (skipping reference production).\nexport class ResyncFollowsWalker extends RestWalker {\n public follows: Record = {};\n\n constructor(private topProd: Rule) {\n super();\n }\n\n startWalking(): Record {\n this.walk(this.topProd);\n return this.follows;\n }\n\n walkTerminal(\n terminal: Terminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // do nothing! just like in the public sector after 13:00\n }\n\n walkProdRef(\n refProd: NonTerminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n const followName =\n buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) +\n this.topProd.name;\n const fullRest: IProduction[] = currRest.concat(prevRest);\n const restProd = new Alternative({ definition: fullRest });\n const t_in_topProd_follows = first(restProd);\n this.follows[followName] = t_in_topProd_follows;\n }\n}\n\nexport function computeAllProdsFollows(\n topProductions: Rule[],\n): Record {\n const reSyncFollows = {};\n\n forEach(topProductions, (topProd) => {\n const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking();\n assign(reSyncFollows, currRefsFollow);\n });\n return reSyncFollows;\n}\n\nexport function buildBetweenProdsFollowPrefix(\n inner: Rule,\n occurenceInParent: number,\n): string {\n return inner.name + occurenceInParent + IN;\n}\n\nexport function buildInProdFollowPrefix(terminal: Terminal): string {\n const terminalName = terminal.terminalType.name;\n return terminalName + terminal.idx + IN;\n}\n", "import {\n Alternative,\n Assertion,\n Atom,\n Disjunction,\n RegExpParser,\n RegExpPattern,\n} from \"@chevrotain/regexp-to-ast\";\n\nlet regExpAstCache: { [regex: string]: RegExpPattern } = {};\nconst regExpParser = new RegExpParser();\n\n// this should be moved to regexp-to-ast\nexport type ASTNode =\n | RegExpPattern\n | Disjunction\n | Alternative\n | Assertion\n | Atom;\n\nexport function getRegExpAst(regExp: RegExp): RegExpPattern {\n const regExpStr = regExp.toString();\n if (regExpAstCache.hasOwnProperty(regExpStr)) {\n return regExpAstCache[regExpStr];\n } else {\n const regExpAst = regExpParser.pattern(regExpStr);\n regExpAstCache[regExpStr] = regExpAst;\n return regExpAst;\n }\n}\n\nexport function clearRegExpParserCache() {\n regExpAstCache = {};\n}\n", "import {\n Alternative,\n Atom,\n BaseRegExpVisitor,\n Character,\n Disjunction,\n Group,\n Set,\n} from \"@chevrotain/regexp-to-ast\";\nimport { every, find, forEach, includes, isArray, values } from \"lodash-es\";\nimport { PRINT_ERROR, PRINT_WARNING } from \"@chevrotain/utils\";\nimport { ASTNode, getRegExpAst } from \"./reg_exp_parser.js\";\nimport { charCodeToOptimizedIndex, minOptimizationVal } from \"./lexer.js\";\n\nconst complementErrorMessage =\n \"Complement Sets are not supported for first char optimization\";\nexport const failedOptimizationPrefixMsg =\n 'Unable to use \"first char\" lexer optimizations:\\n';\n\nexport function getOptimizedStartCodesIndices(\n regExp: RegExp,\n ensureOptimizations = false,\n): number[] {\n try {\n const ast = getRegExpAst(regExp);\n const firstChars = firstCharOptimizedIndices(\n ast.value,\n {},\n ast.flags.ignoreCase,\n );\n return firstChars;\n } catch (e) {\n /* istanbul ignore next */\n // Testing this relies on the regexp-to-ast library having a bug... */\n // TODO: only the else branch needs to be ignored, try to fix with newer prettier / tsc\n if (e.message === complementErrorMessage) {\n if (ensureOptimizations) {\n PRINT_WARNING(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to optimize: < ${regExp.toString()} >\\n` +\n \"\\tComplement Sets cannot be automatically optimized.\\n\" +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n \"\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.\",\n );\n }\n } else {\n let msgSuffix = \"\";\n if (ensureOptimizations) {\n msgSuffix =\n \"\\n\\tThis will disable the lexer's first char optimizations.\\n\" +\n \"\\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.\";\n }\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}\\n` +\n `\\tFailed parsing: < ${regExp.toString()} >\\n` +\n `\\tUsing the @chevrotain/regexp-to-ast library\\n` +\n \"\\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues\" +\n msgSuffix,\n );\n }\n }\n\n return [];\n}\n\nexport function firstCharOptimizedIndices(\n ast: ASTNode,\n result: { [charCode: number]: number },\n ignoreCase: boolean,\n): number[] {\n switch (ast.type) {\n case \"Disjunction\":\n for (let i = 0; i < ast.value.length; i++) {\n firstCharOptimizedIndices(ast.value[i], result, ignoreCase);\n }\n break;\n case \"Alternative\":\n const terms = ast.value;\n for (let i = 0; i < terms.length; i++) {\n const term = terms[i];\n\n // skip terms that cannot effect the first char results\n switch (term.type) {\n case \"EndAnchor\":\n // A group back reference cannot affect potential starting char.\n // because if a back reference is the first production than automatically\n // the group being referenced has had to come BEFORE so its codes have already been added\n case \"GroupBackReference\":\n // assertions do not affect potential starting codes\n case \"Lookahead\":\n case \"NegativeLookahead\":\n case \"StartAnchor\":\n case \"WordBoundary\":\n case \"NonWordBoundary\":\n continue;\n }\n\n const atom = term;\n switch (atom.type) {\n case \"Character\":\n addOptimizedIdxToResult(atom.value, result, ignoreCase);\n break;\n case \"Set\":\n if (atom.complement === true) {\n throw Error(complementErrorMessage);\n }\n forEach(atom.value, (code) => {\n if (typeof code === \"number\") {\n addOptimizedIdxToResult(code, result, ignoreCase);\n } else {\n // range\n const range = code as any;\n // cannot optimize when ignoreCase is\n if (ignoreCase === true) {\n for (\n let rangeCode = range.from;\n rangeCode <= range.to;\n rangeCode++\n ) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase);\n }\n }\n // Optimization (2 orders of magnitude less work for very large ranges)\n else {\n // handle unoptimized values\n for (\n let rangeCode = range.from;\n rangeCode <= range.to && rangeCode < minOptimizationVal;\n rangeCode++\n ) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase);\n }\n\n // Less common charCode where we optimize for faster init time, by using larger \"buckets\"\n if (range.to >= minOptimizationVal) {\n const minUnOptVal =\n range.from >= minOptimizationVal\n ? range.from\n : minOptimizationVal;\n const maxUnOptVal = range.to;\n const minOptIdx = charCodeToOptimizedIndex(minUnOptVal);\n const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal);\n\n for (\n let currOptIdx = minOptIdx;\n currOptIdx <= maxOptIdx;\n currOptIdx++\n ) {\n result[currOptIdx] = currOptIdx;\n }\n }\n }\n }\n });\n break;\n case \"Group\":\n firstCharOptimizedIndices(atom.value, result, ignoreCase);\n break;\n /* istanbul ignore next */\n default:\n throw Error(\"Non Exhaustive Match\");\n }\n\n // reached a mandatory production, no more **start** codes can be found on this alternative\n const isOptionalQuantifier =\n atom.quantifier !== undefined && atom.quantifier.atLeast === 0;\n if (\n // A group may be optional due to empty contents /(?:)/\n // or if everything inside it is optional /((a)?)/\n (atom.type === \"Group\" && isWholeOptional(atom) === false) ||\n // If this term is not a group it may only be optional if it has an optional quantifier\n (atom.type !== \"Group\" && isOptionalQuantifier === false)\n ) {\n break;\n }\n }\n break;\n /* istanbul ignore next */\n default:\n throw Error(\"non exhaustive match!\");\n }\n\n // console.log(Object.keys(result).length)\n return values(result);\n}\n\nfunction addOptimizedIdxToResult(\n code: number,\n result: { [charCode: number]: number },\n ignoreCase: boolean,\n) {\n const optimizedCharIdx = charCodeToOptimizedIndex(code);\n result[optimizedCharIdx] = optimizedCharIdx;\n\n if (ignoreCase === true) {\n handleIgnoreCase(code, result);\n }\n}\n\nfunction handleIgnoreCase(\n code: number,\n result: { [charCode: number]: number },\n) {\n const char = String.fromCharCode(code);\n const upperChar = char.toUpperCase();\n /* istanbul ignore else */\n if (upperChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0));\n result[optimizedCharIdx] = optimizedCharIdx;\n } else {\n const lowerChar = char.toLowerCase();\n if (lowerChar !== char) {\n const optimizedCharIdx = charCodeToOptimizedIndex(\n lowerChar.charCodeAt(0),\n );\n result[optimizedCharIdx] = optimizedCharIdx;\n }\n }\n}\n\nfunction findCode(setNode: Set, targetCharCodes: number[]) {\n return find(setNode.value, (codeOrRange) => {\n if (typeof codeOrRange === \"number\") {\n return includes(targetCharCodes, codeOrRange);\n } else {\n // range\n const range = codeOrRange;\n return (\n find(\n targetCharCodes,\n (targetCode) => range.from <= targetCode && targetCode <= range.to,\n ) !== undefined\n );\n }\n });\n}\n\nfunction isWholeOptional(ast: any): boolean {\n const quantifier = (ast as Atom).quantifier;\n if (quantifier && quantifier.atLeast === 0) {\n return true;\n }\n\n if (!ast.value) {\n return false;\n }\n\n return isArray(ast.value)\n ? every(ast.value, isWholeOptional)\n : isWholeOptional(ast.value);\n}\n\nclass CharCodeFinder extends BaseRegExpVisitor {\n found: boolean = false;\n\n constructor(private targetCharCodes: number[]) {\n super();\n }\n\n visitChildren(node: ASTNode) {\n // No need to keep looking...\n if (this.found === true) {\n return;\n }\n\n // switch lookaheads as they do not actually consume any characters thus\n // finding a charCode at lookahead context does not mean that regexp can actually contain it in a match.\n switch (node.type) {\n case \"Lookahead\":\n this.visitLookahead(node);\n return;\n case \"NegativeLookahead\":\n this.visitNegativeLookahead(node);\n return;\n }\n\n super.visitChildren(node);\n }\n\n visitCharacter(node: Character) {\n if (includes(this.targetCharCodes, node.value)) {\n this.found = true;\n }\n }\n\n visitSet(node: Set) {\n if (node.complement) {\n if (findCode(node, this.targetCharCodes) === undefined) {\n this.found = true;\n }\n } else {\n if (findCode(node, this.targetCharCodes) !== undefined) {\n this.found = true;\n }\n }\n }\n}\n\nexport function canMatchCharCode(\n charCodes: number[],\n pattern: RegExp | string,\n) {\n if (pattern instanceof RegExp) {\n const ast = getRegExpAst(pattern);\n const charCodeFinder = new CharCodeFinder(charCodes);\n charCodeFinder.visit(ast);\n return charCodeFinder.found;\n } else {\n return (\n find(pattern, (char) => {\n return includes(charCodes, (char).charCodeAt(0));\n }) !== undefined\n );\n }\n}\n", "import { BaseRegExpVisitor } from \"@chevrotain/regexp-to-ast\";\nimport {\n IRegExpExec,\n Lexer,\n LexerDefinitionErrorType,\n} from \"./lexer_public.js\";\nimport {\n compact,\n defaults,\n difference,\n filter,\n find,\n first,\n flatten,\n forEach,\n has,\n includes,\n indexOf,\n isArray,\n isEmpty,\n isFunction,\n isRegExp,\n isString,\n isUndefined,\n keys,\n map,\n reduce,\n reject,\n values,\n} from \"lodash-es\";\nimport { PRINT_ERROR } from \"@chevrotain/utils\";\nimport {\n canMatchCharCode,\n failedOptimizationPrefixMsg,\n getOptimizedStartCodesIndices,\n} from \"./reg_exp.js\";\nimport {\n ILexerDefinitionError,\n ILineTerminatorsTester,\n IMultiModeLexerDefinition,\n IToken,\n TokenType,\n} from \"@chevrotain/types\";\nimport { getRegExpAst } from \"./reg_exp_parser.js\";\n\nconst PATTERN = \"PATTERN\";\nexport const DEFAULT_MODE = \"defaultMode\";\nexport const MODES = \"modes\";\n\nexport interface IPatternConfig {\n pattern: IRegExpExec | string;\n longerAlt: number[] | undefined;\n canLineTerminator: boolean;\n isCustom: boolean;\n short: number | false;\n group: string | undefined | false;\n push: string | undefined;\n pop: boolean;\n tokenType: TokenType;\n tokenTypeIdx: number;\n}\n\nexport interface IAnalyzeResult {\n patternIdxToConfig: IPatternConfig[];\n charCodeToPatternIdxToConfig: { [charCode: number]: IPatternConfig[] };\n emptyGroups: { [groupName: string]: IToken[] };\n hasCustom: boolean;\n canBeOptimized: boolean;\n}\n\nexport let SUPPORT_STICKY =\n typeof (new RegExp(\"(?:)\")).sticky === \"boolean\";\n\nexport function disableSticky() {\n SUPPORT_STICKY = false;\n}\n\nexport function enableSticky() {\n SUPPORT_STICKY = true;\n}\n\nexport function analyzeTokenTypes(\n tokenTypes: TokenType[],\n options: {\n positionTracking?: \"full\" | \"onlyStart\" | \"onlyOffset\";\n ensureOptimizations?: boolean;\n lineTerminatorCharacters?: (number | string)[];\n // TODO: should `useSticky` be an argument here?\n useSticky?: boolean;\n safeMode?: boolean;\n tracer?: (msg: string, action: () => void) => void;\n },\n): IAnalyzeResult {\n options = defaults(options, {\n useSticky: SUPPORT_STICKY,\n debug: false as boolean,\n safeMode: false as boolean,\n positionTracking: \"full\",\n lineTerminatorCharacters: [\"\\r\", \"\\n\"],\n tracer: (msg: string, action: Function) => action(),\n });\n\n const tracer = options.tracer!;\n\n tracer(\"initCharCodeToOptimizedIndexMap\", () => {\n initCharCodeToOptimizedIndexMap();\n });\n\n let onlyRelevantTypes: TokenType[];\n tracer(\"Reject Lexer.NA\", () => {\n onlyRelevantTypes = reject(tokenTypes, (currType) => {\n return currType[PATTERN] === Lexer.NA;\n });\n });\n\n let hasCustom = false;\n let allTransformedPatterns: (IRegExpExec | string)[];\n tracer(\"Transform Patterns\", () => {\n hasCustom = false;\n allTransformedPatterns = map(\n onlyRelevantTypes,\n (currType): IRegExpExec | string => {\n const currPattern = currType[PATTERN];\n\n /* istanbul ignore else */\n if (isRegExp(currPattern)) {\n const regExpSource = currPattern.source;\n if (\n regExpSource.length === 1 &&\n // only these regExp meta characters which can appear in a length one regExp\n regExpSource !== \"^\" &&\n regExpSource !== \"$\" &&\n regExpSource !== \".\" &&\n !currPattern.ignoreCase\n ) {\n return regExpSource;\n } else if (\n regExpSource.length === 2 &&\n regExpSource[0] === \"\\\\\" &&\n // not a meta character\n !includes(\n [\n \"d\",\n \"D\",\n \"s\",\n \"S\",\n \"t\",\n \"r\",\n \"n\",\n \"t\",\n \"0\",\n \"c\",\n \"b\",\n \"B\",\n \"f\",\n \"v\",\n \"w\",\n \"W\",\n ],\n regExpSource[1],\n )\n ) {\n // escaped meta Characters: /\\+/ /\\[/\n // or redundant escaping: /\\a/\n // without the escaping \"\\\"\n return regExpSource[1];\n } else {\n return options.useSticky\n ? addStickyFlag(currPattern)\n : addStartOfInput(currPattern);\n }\n } else if (isFunction(currPattern)) {\n hasCustom = true;\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return { exec: currPattern };\n } else if (typeof currPattern === \"object\") {\n hasCustom = true;\n // ICustomPattern\n return currPattern;\n } else if (typeof currPattern === \"string\") {\n if (currPattern.length === 1) {\n return currPattern;\n } else {\n const escapedRegExpString = currPattern.replace(\n /[\\\\^$.*+?()[\\]{}|]/g,\n \"\\\\$&\",\n );\n const wrappedRegExp = new RegExp(escapedRegExpString);\n return options.useSticky\n ? addStickyFlag(wrappedRegExp)\n : addStartOfInput(wrappedRegExp);\n }\n } else {\n throw Error(\"non exhaustive match\");\n }\n },\n );\n });\n\n let patternIdxToType: number[];\n let patternIdxToGroup: (string | undefined | false)[];\n let patternIdxToLongerAltIdxArr: (number[] | undefined)[];\n let patternIdxToPushMode: (string | undefined)[];\n let patternIdxToPopMode: boolean[];\n tracer(\"misc mapping\", () => {\n patternIdxToType = map(\n onlyRelevantTypes,\n (currType) => currType.tokenTypeIdx!,\n );\n\n patternIdxToGroup = map(onlyRelevantTypes, (clazz: any) => {\n const groupName = clazz.GROUP;\n /* istanbul ignore next */\n if (groupName === Lexer.SKIPPED) {\n return undefined;\n } else if (isString(groupName)) {\n return groupName;\n } else if (isUndefined(groupName)) {\n return false;\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n\n patternIdxToLongerAltIdxArr = map(onlyRelevantTypes, (clazz: any) => {\n const longerAltType = clazz.LONGER_ALT;\n\n if (longerAltType) {\n const longerAltIdxArr = isArray(longerAltType)\n ? map(longerAltType, (type: any) => indexOf(onlyRelevantTypes, type))\n : [indexOf(onlyRelevantTypes, longerAltType)];\n return longerAltIdxArr;\n }\n });\n\n patternIdxToPushMode = map(\n onlyRelevantTypes,\n (clazz: any) => clazz.PUSH_MODE,\n );\n\n patternIdxToPopMode = map(onlyRelevantTypes, (clazz: any) =>\n has(clazz, \"POP_MODE\"),\n );\n });\n\n let patternIdxToCanLineTerminator: boolean[];\n tracer(\"Line Terminator Handling\", () => {\n const lineTerminatorCharCodes = getCharCodes(\n options.lineTerminatorCharacters!,\n );\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => false);\n if (options.positionTracking !== \"onlyOffset\") {\n patternIdxToCanLineTerminator = map(onlyRelevantTypes, (tokType) => {\n if (has(tokType, \"LINE_BREAKS\")) {\n return !!tokType.LINE_BREAKS;\n } else {\n return (\n checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false &&\n canMatchCharCode(\n lineTerminatorCharCodes,\n tokType.PATTERN as RegExp | string,\n )\n );\n }\n });\n }\n });\n\n let patternIdxToIsCustom: boolean[];\n let patternIdxToShort: (number | false)[];\n let emptyGroups!: { [groupName: string]: IToken[] };\n let patternIdxToConfig!: IPatternConfig[];\n tracer(\"Misc Mapping #2\", () => {\n patternIdxToIsCustom = map(onlyRelevantTypes, isCustomPattern);\n patternIdxToShort = map(allTransformedPatterns, isShortPattern);\n\n emptyGroups = reduce(\n onlyRelevantTypes,\n (acc, clazz: any) => {\n const groupName = clazz.GROUP;\n if (isString(groupName) && !(groupName === Lexer.SKIPPED)) {\n acc[groupName] = [];\n }\n return acc;\n },\n {} as { [groupName: string]: IToken[] },\n );\n\n patternIdxToConfig = map(\n allTransformedPatterns,\n (x, idx): IPatternConfig => {\n return {\n pattern: allTransformedPatterns[idx],\n longerAlt: patternIdxToLongerAltIdxArr[idx],\n canLineTerminator: patternIdxToCanLineTerminator[idx],\n isCustom: patternIdxToIsCustom[idx],\n short: patternIdxToShort[idx],\n group: patternIdxToGroup[idx],\n push: patternIdxToPushMode[idx],\n pop: patternIdxToPopMode[idx],\n tokenTypeIdx: patternIdxToType[idx],\n tokenType: onlyRelevantTypes[idx],\n };\n },\n );\n });\n\n let canBeOptimized = true;\n let charCodeToPatternIdxToConfig: { [charCode: number]: IPatternConfig[] } =\n [];\n\n if (!options.safeMode) {\n tracer(\"First Char Optimization\", () => {\n charCodeToPatternIdxToConfig = reduce(\n onlyRelevantTypes,\n (result, currTokType, idx) => {\n if (typeof currTokType.PATTERN === \"string\") {\n const charCode = currTokType.PATTERN.charCodeAt(0);\n const optimizedIdx = charCodeToOptimizedIndex(charCode);\n addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]);\n } else if (isArray(currTokType.START_CHARS_HINT)) {\n let lastOptimizedIdx: number;\n forEach(currTokType.START_CHARS_HINT, (charOrInt) => {\n const charCode =\n typeof charOrInt === \"string\"\n ? charOrInt.charCodeAt(0)\n : charOrInt;\n const currOptimizedIdx = charCodeToOptimizedIndex(charCode);\n // Avoid adding the config multiple times\n /* istanbul ignore else */\n // - Difficult to check this scenario effects as it is only a performance\n // optimization that does not change correctness\n if (lastOptimizedIdx !== currOptimizedIdx) {\n lastOptimizedIdx = currOptimizedIdx;\n addToMapOfArrays(\n result,\n currOptimizedIdx,\n patternIdxToConfig[idx],\n );\n }\n });\n } else if (isRegExp(currTokType.PATTERN)) {\n if (currTokType.PATTERN.unicode) {\n canBeOptimized = false;\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tUnable to analyze < ${currTokType.PATTERN.toString()} > pattern.\\n` +\n \"\\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\\n\" +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n \"\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE\",\n );\n }\n } else {\n const optimizedCodes = getOptimizedStartCodesIndices(\n currTokType.PATTERN,\n options.ensureOptimizations,\n );\n /* istanbul ignore if */\n // start code will only be empty given an empty regExp or failure of regexp-to-ast library\n // the first should be a different validation and the second cannot be tested.\n if (isEmpty(optimizedCodes)) {\n // we cannot understand what codes may start possible matches\n // The optimization correctness requires knowing start codes for ALL patterns.\n // Not actually sure this is an error, no debug message\n canBeOptimized = false;\n }\n forEach(optimizedCodes, (code) => {\n addToMapOfArrays(result, code, patternIdxToConfig[idx]);\n });\n }\n } else {\n if (options.ensureOptimizations) {\n PRINT_ERROR(\n `${failedOptimizationPrefixMsg}` +\n `\\tTokenType: <${currTokType.name}> is using a custom token pattern without providing parameter.\\n` +\n \"\\tThis will disable the lexer's first char optimizations.\\n\" +\n \"\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE\",\n );\n }\n canBeOptimized = false;\n }\n\n return result;\n },\n [] as { [charCode: number]: IPatternConfig[] },\n );\n });\n }\n\n return {\n emptyGroups: emptyGroups,\n patternIdxToConfig: patternIdxToConfig,\n charCodeToPatternIdxToConfig: charCodeToPatternIdxToConfig,\n hasCustom: hasCustom,\n canBeOptimized: canBeOptimized,\n };\n}\n\nexport function validatePatterns(\n tokenTypes: TokenType[],\n validModesNames: string[],\n): ILexerDefinitionError[] {\n let errors: ILexerDefinitionError[] = [];\n\n const missingResult = findMissingPatterns(tokenTypes);\n errors = errors.concat(missingResult.errors);\n\n const invalidResult = findInvalidPatterns(missingResult.valid);\n const validTokenTypes = invalidResult.valid;\n errors = errors.concat(invalidResult.errors);\n\n errors = errors.concat(validateRegExpPattern(validTokenTypes));\n\n errors = errors.concat(findInvalidGroupType(validTokenTypes));\n\n errors = errors.concat(\n findModesThatDoNotExist(validTokenTypes, validModesNames),\n );\n\n errors = errors.concat(findUnreachablePatterns(validTokenTypes));\n\n return errors;\n}\n\nfunction validateRegExpPattern(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n let errors: ILexerDefinitionError[] = [];\n const withRegExpPatterns = filter(tokenTypes, (currTokType) =>\n isRegExp(currTokType[PATTERN]),\n );\n\n errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns));\n\n errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns));\n\n errors = errors.concat(findUnsupportedFlags(withRegExpPatterns));\n\n errors = errors.concat(findDuplicatePatterns(withRegExpPatterns));\n\n errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns));\n\n return errors;\n}\n\nexport interface ILexerFilterResult {\n errors: ILexerDefinitionError[];\n valid: TokenType[];\n}\n\nexport function findMissingPatterns(\n tokenTypes: TokenType[],\n): ILexerFilterResult {\n const tokenTypesWithMissingPattern = filter(tokenTypes, (currType) => {\n return !has(currType, PATTERN);\n });\n\n const errors = map(tokenTypesWithMissingPattern, (currType) => {\n return {\n message:\n \"Token Type: ->\" +\n currType.name +\n \"<- missing static 'PATTERN' property\",\n type: LexerDefinitionErrorType.MISSING_PATTERN,\n tokenTypes: [currType],\n };\n });\n\n const valid = difference(tokenTypes, tokenTypesWithMissingPattern);\n return { errors, valid };\n}\n\nexport function findInvalidPatterns(\n tokenTypes: TokenType[],\n): ILexerFilterResult {\n const tokenTypesWithInvalidPattern = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN];\n return (\n !isRegExp(pattern) &&\n !isFunction(pattern) &&\n !has(pattern, \"exec\") &&\n !isString(pattern)\n );\n });\n\n const errors = map(tokenTypesWithInvalidPattern, (currType) => {\n return {\n message:\n \"Token Type: ->\" +\n currType.name +\n \"<- static 'PATTERN' can only be a RegExp, a\" +\n \" Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.\",\n type: LexerDefinitionErrorType.INVALID_PATTERN,\n tokenTypes: [currType],\n };\n });\n\n const valid = difference(tokenTypes, tokenTypesWithInvalidPattern);\n return { errors, valid };\n}\n\nconst end_of_input = /[^\\\\][$]/;\n\nexport function findEndOfInputAnchor(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n class EndAnchorFinder extends BaseRegExpVisitor {\n found = false;\n\n visitEndAnchor(node: unknown) {\n this.found = true;\n }\n }\n\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN;\n\n try {\n const regexpAst = getRegExpAst(pattern as RegExp);\n const endAnchorVisitor = new EndAnchorFinder();\n endAnchorVisitor.visit(regexpAst);\n\n return endAnchorVisitor.found;\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return end_of_input.test((pattern as RegExp).source);\n }\n });\n\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n \"Unexpected RegExp Anchor Error:\\n\" +\n \"\\tToken Type: ->\" +\n currType.name +\n \"<- static 'PATTERN' cannot contain end of input anchor '$'\\n\" +\n \"\\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\" +\n \"\\tfor details.\",\n type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n };\n });\n\n return errors;\n}\n\nexport function findEmptyMatchRegExps(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n const matchesEmptyString = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN as RegExp;\n return pattern.test(\"\");\n });\n\n const errors = map(matchesEmptyString, (currType) => {\n return {\n message:\n \"Token Type: ->\" +\n currType.name +\n \"<- static 'PATTERN' must not match an empty string\",\n type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,\n tokenTypes: [currType],\n };\n });\n\n return errors;\n}\n\nconst start_of_input = /[^\\\\[][\\^]|^\\^/;\n\nexport function findStartOfInputAnchor(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n class StartAnchorFinder extends BaseRegExpVisitor {\n found = false;\n\n visitStartAnchor(node: unknown) {\n this.found = true;\n }\n }\n\n const invalidRegex = filter(tokenTypes, (currType) => {\n const pattern = currType.PATTERN as RegExp;\n try {\n const regexpAst = getRegExpAst(pattern);\n const startAnchorVisitor = new StartAnchorFinder();\n startAnchorVisitor.visit(regexpAst);\n\n return startAnchorVisitor.found;\n } catch (e) {\n // old behavior in case of runtime exceptions with regexp-to-ast.\n /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/\n return start_of_input.test(pattern.source);\n }\n });\n\n const errors = map(invalidRegex, (currType) => {\n return {\n message:\n \"Unexpected RegExp Anchor Error:\\n\" +\n \"\\tToken Type: ->\" +\n currType.name +\n \"<- static 'PATTERN' cannot contain start of input anchor '^'\\n\" +\n \"\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\" +\n \"\\tfor details.\",\n type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,\n tokenTypes: [currType],\n };\n });\n\n return errors;\n}\n\nexport function findUnsupportedFlags(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n const invalidFlags = filter(tokenTypes, (currType) => {\n const pattern = currType[PATTERN];\n return pattern instanceof RegExp && (pattern.multiline || pattern.global);\n });\n\n const errors = map(invalidFlags, (currType) => {\n return {\n message:\n \"Token Type: ->\" +\n currType.name +\n \"<- static 'PATTERN' may NOT contain global('g') or multiline('m')\",\n type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,\n tokenTypes: [currType],\n };\n });\n\n return errors;\n}\n\n// This can only test for identical duplicate RegExps, not semantically equivalent ones.\nexport function findDuplicatePatterns(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n const found: TokenType[] = [];\n let identicalPatterns = map(tokenTypes, (outerType: any) => {\n return reduce(\n tokenTypes,\n (result, innerType) => {\n if (\n outerType.PATTERN.source === (innerType.PATTERN as RegExp).source &&\n !includes(found, innerType) &&\n innerType.PATTERN !== Lexer.NA\n ) {\n // this avoids duplicates in the result, each Token Type may only appear in one \"set\"\n // in essence we are creating Equivalence classes on equality relation.\n found.push(innerType);\n result.push(innerType);\n return result;\n }\n return result;\n },\n [] as TokenType[],\n );\n });\n\n identicalPatterns = compact(identicalPatterns);\n\n const duplicatePatterns = filter(identicalPatterns, (currIdenticalSet) => {\n return currIdenticalSet.length > 1;\n });\n\n const errors = map(duplicatePatterns, (setOfIdentical: any) => {\n const tokenTypeNames = map(setOfIdentical, (currType: any) => {\n return currType.name;\n });\n\n const dupPatternSrc = (first(setOfIdentical)).PATTERN;\n return {\n message:\n `The same RegExp pattern ->${dupPatternSrc}<-` +\n `has been used in all of the following Token Types: ${tokenTypeNames.join(\n \", \",\n )} <-`,\n type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,\n tokenTypes: setOfIdentical,\n };\n });\n\n return errors;\n}\n\nexport function findInvalidGroupType(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n const invalidTypes = filter(tokenTypes, (clazz: any) => {\n if (!has(clazz, \"GROUP\")) {\n return false;\n }\n const group = clazz.GROUP;\n\n return group !== Lexer.SKIPPED && group !== Lexer.NA && !isString(group);\n });\n\n const errors = map(invalidTypes, (currType) => {\n return {\n message:\n \"Token Type: ->\" +\n currType.name +\n \"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String\",\n type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,\n tokenTypes: [currType],\n };\n });\n\n return errors;\n}\n\nexport function findModesThatDoNotExist(\n tokenTypes: TokenType[],\n validModes: string[],\n): ILexerDefinitionError[] {\n const invalidModes = filter(tokenTypes, (clazz: any) => {\n return (\n clazz.PUSH_MODE !== undefined && !includes(validModes, clazz.PUSH_MODE)\n );\n });\n\n const errors = map(invalidModes, (tokType) => {\n const msg =\n `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-` +\n `which does not exist`;\n return {\n message: msg,\n type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,\n tokenTypes: [tokType],\n };\n });\n\n return errors;\n}\n\nexport function findUnreachablePatterns(\n tokenTypes: TokenType[],\n): ILexerDefinitionError[] {\n const errors: ILexerDefinitionError[] = [];\n\n const canBeTested = reduce(\n tokenTypes,\n (result, tokType, idx) => {\n const pattern = tokType.PATTERN;\n\n if (pattern === Lexer.NA) {\n return result;\n }\n\n // a more comprehensive validation for all forms of regExps would require\n // deeper regExp analysis capabilities\n if (isString(pattern)) {\n result.push({ str: pattern, idx, tokenType: tokType });\n } else if (isRegExp(pattern) && noMetaChar(pattern)) {\n result.push({ str: pattern.source, idx, tokenType: tokType });\n }\n return result;\n },\n [] as { str: string; idx: number; tokenType: TokenType }[],\n );\n\n forEach(tokenTypes, (tokType, testIdx) => {\n forEach(canBeTested, ({ str, idx, tokenType }) => {\n if (testIdx < idx && testTokenType(str, tokType.PATTERN)) {\n const msg =\n `Token: ->${tokenType.name}<- can never be matched.\\n` +\n `Because it appears AFTER the Token Type ->${tokType.name}<-` +\n `in the lexer's definition.\\n` +\n `See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;\n errors.push({\n message: msg,\n type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,\n tokenTypes: [tokType, tokenType],\n });\n }\n });\n });\n\n return errors;\n}\n\nfunction testTokenType(str: string, pattern: any): boolean {\n /* istanbul ignore else */\n if (isRegExp(pattern)) {\n const regExpArray = pattern.exec(str);\n return regExpArray !== null && regExpArray.index === 0;\n } else if (isFunction(pattern)) {\n // maintain the API of custom patterns\n return pattern(str, 0, [], {});\n } else if (has(pattern, \"exec\")) {\n // maintain the API of custom patterns\n return pattern.exec(str, 0, [], {});\n } else if (typeof pattern === \"string\") {\n return pattern === str;\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n\nfunction noMetaChar(regExp: RegExp): boolean {\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n const metaChars = [\n \".\",\n \"\\\\\",\n \"[\",\n \"]\",\n \"|\",\n \"^\",\n \"$\",\n \"(\",\n \")\",\n \"?\",\n \"*\",\n \"+\",\n \"{\",\n ];\n return (\n find(metaChars, (char) => regExp.source.indexOf(char) !== -1) === undefined\n );\n}\n\nexport function addStartOfInput(pattern: RegExp): RegExp {\n const flags = pattern.ignoreCase ? \"i\" : \"\";\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`^(?:${pattern.source})`, flags);\n}\n\nexport function addStickyFlag(pattern: RegExp): RegExp {\n const flags = pattern.ignoreCase ? \"iy\" : \"y\";\n // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.\n // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)\n return new RegExp(`${pattern.source}`, flags);\n}\n\nexport function performRuntimeChecks(\n lexerDefinition: IMultiModeLexerDefinition,\n trackLines: boolean,\n lineTerminatorCharacters: (number | string)[],\n): ILexerDefinitionError[] {\n const errors: ILexerDefinitionError[] = [];\n\n // some run time checks to help the end users.\n if (!has(lexerDefinition, DEFAULT_MODE)) {\n errors.push({\n message:\n \"A MultiMode Lexer cannot be initialized without a <\" +\n DEFAULT_MODE +\n \"> property in its definition\\n\",\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE,\n });\n }\n if (!has(lexerDefinition, MODES)) {\n errors.push({\n message:\n \"A MultiMode Lexer cannot be initialized without a <\" +\n MODES +\n \"> property in its definition\\n\",\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY,\n });\n }\n\n if (\n has(lexerDefinition, MODES) &&\n has(lexerDefinition, DEFAULT_MODE) &&\n !has(lexerDefinition.modes, lexerDefinition.defaultMode)\n ) {\n errors.push({\n message:\n `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>` +\n `which does not exist\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST,\n });\n }\n\n if (has(lexerDefinition, MODES)) {\n forEach(lexerDefinition.modes, (currModeValue, currModeName) => {\n forEach(currModeValue, (currTokType, currIdx) => {\n if (isUndefined(currTokType)) {\n errors.push({\n message:\n `A Lexer cannot be initialized using an undefined Token Type. Mode:` +\n `<${currModeName}> at index: <${currIdx}>\\n`,\n type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED,\n });\n } else if (has(currTokType, \"LONGER_ALT\")) {\n const longerAlt = isArray(currTokType.LONGER_ALT)\n ? currTokType.LONGER_ALT\n : [currTokType.LONGER_ALT];\n forEach(longerAlt, (currLongerAlt) => {\n if (\n !isUndefined(currLongerAlt) &&\n !includes(currModeValue, currLongerAlt)\n ) {\n errors.push({\n message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\\n`,\n type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE,\n });\n }\n });\n }\n });\n });\n }\n\n return errors;\n}\n\nexport function performWarningRuntimeChecks(\n lexerDefinition: IMultiModeLexerDefinition,\n trackLines: boolean,\n lineTerminatorCharacters: (number | string)[],\n): ILexerDefinitionError[] {\n const warnings = [];\n let hasAnyLineBreak = false;\n const allTokenTypes = compact(flatten(values(lexerDefinition.modes)));\n\n const concreteTokenTypes = reject(\n allTokenTypes,\n (currType) => currType[PATTERN] === Lexer.NA,\n );\n const terminatorCharCodes = getCharCodes(lineTerminatorCharacters);\n if (trackLines) {\n forEach(concreteTokenTypes, (tokType) => {\n const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes);\n if (currIssue !== false) {\n const message = buildLineBreakIssueMessage(tokType, currIssue);\n const warningDescriptor = {\n message,\n type: currIssue.issue,\n tokenType: tokType,\n };\n warnings.push(warningDescriptor);\n } else {\n // we don't want to attempt to scan if the user explicitly specified the line_breaks option.\n if (has(tokType, \"LINE_BREAKS\")) {\n if (tokType.LINE_BREAKS === true) {\n hasAnyLineBreak = true;\n }\n } else {\n if (\n canMatchCharCode(terminatorCharCodes, tokType.PATTERN as RegExp)\n ) {\n hasAnyLineBreak = true;\n }\n }\n }\n });\n }\n\n if (trackLines && !hasAnyLineBreak) {\n warnings.push({\n message:\n \"Warning: No LINE_BREAKS Found.\\n\" +\n \"\\tThis Lexer has been defined to track line and column information,\\n\" +\n \"\\tBut none of the Token Types can be identified as matching a line terminator.\\n\" +\n \"\\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \\n\" +\n \"\\tfor details.\",\n type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS,\n });\n }\n return warnings;\n}\n\nexport function cloneEmptyGroups(emptyGroups: {\n [groupName: string]: IToken;\n}): { [groupName: string]: IToken } {\n const clonedResult: any = {};\n const groupKeys = keys(emptyGroups);\n\n forEach(groupKeys, (currKey) => {\n const currGroupValue = emptyGroups[currKey];\n\n /* istanbul ignore else */\n if (isArray(currGroupValue)) {\n clonedResult[currKey] = [];\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n\n return clonedResult;\n}\n\n// TODO: refactor to avoid duplication\nexport function isCustomPattern(tokenType: TokenType): boolean {\n const pattern = tokenType.PATTERN;\n /* istanbul ignore else */\n if (isRegExp(pattern)) {\n return false;\n } else if (isFunction(pattern)) {\n // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object\n return true;\n } else if (has(pattern, \"exec\")) {\n // ICustomPattern\n return true;\n } else if (isString(pattern)) {\n return false;\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n\nexport function isShortPattern(pattern: any): number | false {\n if (isString(pattern) && pattern.length === 1) {\n return pattern.charCodeAt(0);\n } else {\n return false;\n }\n}\n\n/**\n * Faster than using a RegExp for default newline detection during lexing.\n */\nexport const LineTerminatorOptimizedTester: ILineTerminatorsTester = {\n // implements /\\n|\\r\\n?/g.test\n test: function (text) {\n const len = text.length;\n for (let i = this.lastIndex; i < len; i++) {\n const c = text.charCodeAt(i);\n if (c === 10) {\n this.lastIndex = i + 1;\n return true;\n } else if (c === 13) {\n if (text.charCodeAt(i + 1) === 10) {\n this.lastIndex = i + 2;\n } else {\n this.lastIndex = i + 1;\n }\n return true;\n }\n }\n return false;\n },\n\n lastIndex: 0,\n};\n\nfunction checkLineBreaksIssues(\n tokType: TokenType,\n lineTerminatorCharCodes: number[],\n):\n | {\n issue:\n | LexerDefinitionErrorType.IDENTIFY_TERMINATOR\n | LexerDefinitionErrorType.CUSTOM_LINE_BREAK;\n errMsg?: string;\n }\n | false {\n if (has(tokType, \"LINE_BREAKS\")) {\n // if the user explicitly declared the line_breaks option we will respect their choice\n // and assume it is correct.\n return false;\n } else {\n /* istanbul ignore else */\n if (isRegExp(tokType.PATTERN)) {\n try {\n // TODO: why is the casting suddenly needed?\n canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN as RegExp);\n } catch (e) {\n /* istanbul ignore next - to test this we would have to mock to throw an error */\n return {\n issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,\n errMsg: (e as Error).message,\n };\n }\n return false;\n } else if (isString(tokType.PATTERN)) {\n // string literal patterns can always be analyzed to detect line terminator usage\n return false;\n } else if (isCustomPattern(tokType)) {\n // custom token types\n return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK };\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n}\n\nexport function buildLineBreakIssueMessage(\n tokType: TokenType,\n details: {\n issue:\n | LexerDefinitionErrorType.IDENTIFY_TERMINATOR\n | LexerDefinitionErrorType.CUSTOM_LINE_BREAK;\n errMsg?: string;\n },\n): string {\n /* istanbul ignore else */\n if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {\n return (\n \"Warning: unable to identify line terminator usage in pattern.\\n\" +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n `\\t Root cause: ${details.errMsg}.\\n` +\n \"\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR\"\n );\n } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {\n return (\n \"Warning: A Custom Token Pattern should specify the option.\\n\" +\n `\\tThe problem is in the <${tokType.name}> Token Type\\n` +\n \"\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK\"\n );\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n\nfunction getCharCodes(charsOrCodes: (number | string)[]): number[] {\n const charCodes = map(charsOrCodes, (numOrString) => {\n if (isString(numOrString)) {\n return numOrString.charCodeAt(0);\n } else {\n return numOrString;\n }\n });\n\n return charCodes;\n}\n\nfunction addToMapOfArrays(\n map: Record,\n key: number,\n value: T,\n): void {\n if (map[key] === undefined) {\n map[key] = [value];\n } else {\n map[key].push(value);\n }\n}\n\nexport const minOptimizationVal = 256;\n\n/**\n * We are mapping charCode above ASCI (256) into buckets each in the size of 256.\n * This is because ASCI are the most common start chars so each one of those will get its own\n * possible token configs vector.\n *\n * Tokens starting with charCodes \"above\" ASCI are uncommon, so we can \"afford\"\n * to place these into buckets of possible token configs, What we gain from\n * this is avoiding the case of creating an optimization 'charCodeToPatternIdxToConfig'\n * which would contain 10,000+ arrays of small size (e.g unicode Identifiers scenario).\n * Our 'charCodeToPatternIdxToConfig' max size will now be:\n * 256 + (2^16 / 2^8) - 1 === 511\n *\n * note the hack for fast division integer part extraction\n * See: https://stackoverflow.com/a/4228528\n */\nlet charCodeToOptimizedIdxMap: number[] = [];\nexport function charCodeToOptimizedIndex(charCode: number): number {\n return charCode < minOptimizationVal\n ? charCode\n : charCodeToOptimizedIdxMap[charCode];\n}\n\n/**\n * This is a compromise between cold start / hot running performance\n * Creating this array takes ~3ms on a modern machine,\n * But if we perform the computation at runtime as needed the CSS Lexer benchmark\n * performance degrades by ~10%\n *\n * TODO: Perhaps it should be lazy initialized only if a charCode > 255 is used.\n */\nfunction initCharCodeToOptimizedIndexMap() {\n if (isEmpty(charCodeToOptimizedIdxMap)) {\n charCodeToOptimizedIdxMap = new Array(65536);\n for (let i = 0; i < 65536; i++) {\n charCodeToOptimizedIdxMap[i] = i > 255 ? 255 + ~~(i / 255) : i;\n }\n }\n}\n", "import {\n clone,\n compact,\n difference,\n flatten,\n forEach,\n has,\n includes,\n isArray,\n isEmpty,\n map,\n} from \"lodash-es\";\nimport { IToken, TokenType } from \"@chevrotain/types\";\n\nexport function tokenStructuredMatcher(\n tokInstance: IToken,\n tokConstructor: TokenType,\n) {\n const instanceType = tokInstance.tokenTypeIdx;\n if (instanceType === tokConstructor.tokenTypeIdx) {\n return true;\n } else {\n return (\n tokConstructor.isParent === true &&\n tokConstructor.categoryMatchesMap![instanceType] === true\n );\n }\n}\n\n// Optimized tokenMatcher in case our grammar does not use token categories\n// Being so tiny it is much more likely to be in-lined and this avoid the function call overhead\nexport function tokenStructuredMatcherNoCategories(\n token: IToken,\n tokType: TokenType,\n) {\n return token.tokenTypeIdx === tokType.tokenTypeIdx;\n}\n\nexport let tokenShortNameIdx = 1;\nexport const tokenIdxToClass: { [tokenIdx: number]: TokenType } = {};\n\nexport function augmentTokenTypes(tokenTypes: TokenType[]): void {\n // collect the parent Token Types as well.\n const tokenTypesAndParents = expandCategories(tokenTypes);\n\n // add required tokenType and categoryMatches properties\n assignTokenDefaultProps(tokenTypesAndParents);\n\n // fill up the categoryMatches\n assignCategoriesMapProp(tokenTypesAndParents);\n assignCategoriesTokensProp(tokenTypesAndParents);\n\n forEach(tokenTypesAndParents, (tokType) => {\n tokType.isParent = tokType.categoryMatches!.length > 0;\n });\n}\n\nexport function expandCategories(tokenTypes: TokenType[]): TokenType[] {\n let result = clone(tokenTypes);\n\n let categories = tokenTypes;\n let searching = true;\n while (searching) {\n categories = compact(\n flatten(map(categories, (currTokType) => currTokType.CATEGORIES)),\n );\n\n const newCategories = difference(categories, result);\n\n result = result.concat(newCategories);\n\n if (isEmpty(newCategories)) {\n searching = false;\n } else {\n categories = newCategories;\n }\n }\n return result;\n}\n\nexport function assignTokenDefaultProps(tokenTypes: TokenType[]): void {\n forEach(tokenTypes, (currTokType) => {\n if (!hasShortKeyProperty(currTokType)) {\n tokenIdxToClass[tokenShortNameIdx] = currTokType;\n (currTokType).tokenTypeIdx = tokenShortNameIdx++;\n }\n\n // CATEGORIES? : TokenType | TokenType[]\n if (\n hasCategoriesProperty(currTokType) &&\n !isArray(currTokType.CATEGORIES)\n // &&\n // !isUndefined(currTokType.CATEGORIES.PATTERN)\n ) {\n currTokType.CATEGORIES = [currTokType.CATEGORIES as unknown as TokenType];\n }\n\n if (!hasCategoriesProperty(currTokType)) {\n currTokType.CATEGORIES = [];\n }\n\n if (!hasExtendingTokensTypesProperty(currTokType)) {\n currTokType.categoryMatches = [];\n }\n\n if (!hasExtendingTokensTypesMapProperty(currTokType)) {\n currTokType.categoryMatchesMap = {};\n }\n });\n}\n\nexport function assignCategoriesTokensProp(tokenTypes: TokenType[]): void {\n forEach(tokenTypes, (currTokType) => {\n // avoid duplications\n currTokType.categoryMatches = [];\n forEach(currTokType.categoryMatchesMap!, (val, key) => {\n currTokType.categoryMatches!.push(\n tokenIdxToClass[key as unknown as number].tokenTypeIdx!,\n );\n });\n });\n}\n\nexport function assignCategoriesMapProp(tokenTypes: TokenType[]): void {\n forEach(tokenTypes, (currTokType) => {\n singleAssignCategoriesToksMap([], currTokType);\n });\n}\n\nexport function singleAssignCategoriesToksMap(\n path: TokenType[],\n nextNode: TokenType,\n): void {\n forEach(path, (pathNode) => {\n nextNode.categoryMatchesMap![pathNode.tokenTypeIdx!] = true;\n });\n\n forEach(nextNode.CATEGORIES, (nextCategory) => {\n const newPath = path.concat(nextNode);\n // avoids infinite loops due to cyclic categories.\n if (!includes(newPath, nextCategory)) {\n singleAssignCategoriesToksMap(newPath, nextCategory);\n }\n });\n}\n\nexport function hasShortKeyProperty(tokType: TokenType): boolean {\n return has(tokType, \"tokenTypeIdx\");\n}\n\nexport function hasCategoriesProperty(tokType: TokenType): boolean {\n return has(tokType, \"CATEGORIES\");\n}\n\nexport function hasExtendingTokensTypesProperty(tokType: TokenType): boolean {\n return has(tokType, \"categoryMatches\");\n}\n\nexport function hasExtendingTokensTypesMapProperty(\n tokType: TokenType,\n): boolean {\n return has(tokType, \"categoryMatchesMap\");\n}\n\nexport function isTokenType(tokType: TokenType): boolean {\n return has(tokType, \"tokenTypeIdx\");\n}\n", "import { ILexerErrorMessageProvider, IToken } from \"@chevrotain/types\";\n\nexport const defaultLexerErrorProvider: ILexerErrorMessageProvider = {\n buildUnableToPopLexerModeMessage(token: IToken): string {\n return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`;\n },\n\n buildUnexpectedCharactersMessage(\n fullText: string,\n startOffset: number,\n length: number,\n line?: number,\n column?: number,\n ): string {\n return (\n `unexpected character: ->${fullText.charAt(\n startOffset,\n )}<- at offset: ${startOffset},` + ` skipped ${length} characters.`\n );\n },\n};\n", "import {\n analyzeTokenTypes,\n charCodeToOptimizedIndex,\n cloneEmptyGroups,\n DEFAULT_MODE,\n IAnalyzeResult,\n IPatternConfig,\n LineTerminatorOptimizedTester,\n performRuntimeChecks,\n performWarningRuntimeChecks,\n SUPPORT_STICKY,\n validatePatterns,\n} from \"./lexer.js\";\nimport {\n assign,\n clone,\n forEach,\n identity,\n isArray,\n isEmpty,\n isUndefined,\n keys,\n last,\n map,\n noop,\n reduce,\n reject,\n} from \"lodash-es\";\nimport { PRINT_WARNING, timer, toFastProperties } from \"@chevrotain/utils\";\nimport { augmentTokenTypes } from \"./tokens.js\";\nimport {\n CustomPatternMatcherFunc,\n CustomPatternMatcherReturn,\n ILexerConfig,\n ILexerDefinitionError,\n ILexingError,\n IMultiModeLexerDefinition,\n IToken,\n TokenType,\n} from \"@chevrotain/types\";\nimport { defaultLexerErrorProvider } from \"./lexer_errors_public.js\";\nimport { clearRegExpParserCache } from \"./reg_exp_parser.js\";\n\nexport interface ILexingResult {\n tokens: IToken[];\n groups: { [groupName: string]: IToken[] };\n errors: ILexingError[];\n}\n\nexport enum LexerDefinitionErrorType {\n MISSING_PATTERN,\n INVALID_PATTERN,\n EOI_ANCHOR_FOUND,\n UNSUPPORTED_FLAGS_FOUND,\n DUPLICATE_PATTERNS_FOUND,\n INVALID_GROUP_TYPE_FOUND,\n PUSH_MODE_DOES_NOT_EXIST,\n MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE,\n MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY,\n MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST,\n LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED,\n SOI_ANCHOR_FOUND,\n EMPTY_MATCH_PATTERN,\n NO_LINE_BREAKS_FLAGS,\n UNREACHABLE_PATTERN,\n IDENTIFY_TERMINATOR,\n CUSTOM_LINE_BREAK,\n MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE,\n}\n\nexport interface IRegExpExec {\n exec: CustomPatternMatcherFunc;\n}\n\nconst DEFAULT_LEXER_CONFIG: Required = {\n deferDefinitionErrorsHandling: false,\n positionTracking: \"full\",\n lineTerminatorsPattern: /\\n|\\r\\n?/g,\n lineTerminatorCharacters: [\"\\n\", \"\\r\"],\n ensureOptimizations: false,\n safeMode: false,\n errorMessageProvider: defaultLexerErrorProvider,\n traceInitPerf: false,\n skipValidations: false,\n recoveryEnabled: true,\n};\n\nObject.freeze(DEFAULT_LEXER_CONFIG);\n\nexport class Lexer {\n public static SKIPPED =\n \"This marks a skipped Token pattern, this means each token identified by it will\" +\n \"be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.\";\n\n public static NA = /NOT_APPLICABLE/;\n public lexerDefinitionErrors: ILexerDefinitionError[] = [];\n public lexerDefinitionWarning: ILexerDefinitionError[] = [];\n\n protected patternIdxToConfig: Record = {};\n protected charCodeToPatternIdxToConfig: {\n [modeName: string]: { [charCode: number]: IPatternConfig[] };\n } = {};\n\n protected modes: string[] = [];\n protected defaultMode!: string;\n protected emptyGroups: { [groupName: string]: IToken } = {};\n\n private config: Required;\n private trackStartLines: boolean = true;\n private trackEndLines: boolean = true;\n private hasCustom: boolean = false;\n private canModeBeOptimized: Record = {};\n\n private traceInitPerf!: boolean | number;\n private traceInitMaxIdent!: number;\n private traceInitIndent: number;\n\n constructor(\n protected lexerDefinition: TokenType[] | IMultiModeLexerDefinition,\n config: ILexerConfig = DEFAULT_LEXER_CONFIG,\n ) {\n if (typeof config === \"boolean\") {\n throw Error(\n \"The second argument to the Lexer constructor is now an ILexerConfig Object.\\n\" +\n \"a boolean 2nd argument is no longer supported\",\n );\n }\n\n // todo: defaults func?\n this.config = assign({}, DEFAULT_LEXER_CONFIG, config) as any;\n\n const traceInitVal = this.config.traceInitPerf;\n if (traceInitVal === true) {\n this.traceInitMaxIdent = Infinity;\n this.traceInitPerf = true;\n } else if (typeof traceInitVal === \"number\") {\n this.traceInitMaxIdent = traceInitVal;\n this.traceInitPerf = true;\n }\n this.traceInitIndent = -1;\n\n this.TRACE_INIT(\"Lexer Constructor\", () => {\n let actualDefinition!: IMultiModeLexerDefinition;\n let hasOnlySingleMode = true;\n this.TRACE_INIT(\"Lexer Config handling\", () => {\n if (\n this.config.lineTerminatorsPattern ===\n DEFAULT_LEXER_CONFIG.lineTerminatorsPattern\n ) {\n // optimized built-in implementation for the defaults definition of lineTerminators\n this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester;\n } else {\n if (\n this.config.lineTerminatorCharacters ===\n DEFAULT_LEXER_CONFIG.lineTerminatorCharacters\n ) {\n throw Error(\n \"Error: Missing property on the Lexer config.\\n\" +\n \"\\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS\",\n );\n }\n }\n\n if (config.safeMode && config.ensureOptimizations) {\n throw Error(\n '\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.',\n );\n }\n\n this.trackStartLines = /full|onlyStart/i.test(\n this.config.positionTracking,\n );\n this.trackEndLines = /full/i.test(this.config.positionTracking);\n\n // Convert SingleModeLexerDefinition into a IMultiModeLexerDefinition.\n if (isArray(lexerDefinition)) {\n actualDefinition = {\n modes: { defaultMode: clone(lexerDefinition) },\n defaultMode: DEFAULT_MODE,\n };\n } else {\n // no conversion needed, input should already be a IMultiModeLexerDefinition\n hasOnlySingleMode = false;\n actualDefinition = clone(lexerDefinition);\n }\n });\n\n if (this.config.skipValidations === false) {\n this.TRACE_INIT(\"performRuntimeChecks\", () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n performRuntimeChecks(\n actualDefinition,\n this.trackStartLines,\n this.config.lineTerminatorCharacters,\n ),\n );\n });\n\n this.TRACE_INIT(\"performWarningRuntimeChecks\", () => {\n this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(\n performWarningRuntimeChecks(\n actualDefinition,\n this.trackStartLines,\n this.config.lineTerminatorCharacters,\n ),\n );\n });\n }\n\n // for extra robustness to avoid throwing an none informative error message\n actualDefinition.modes = actualDefinition.modes\n ? actualDefinition.modes\n : {};\n\n // an error of undefined TokenTypes will be detected in \"performRuntimeChecks\" above.\n // this transformation is to increase robustness in the case of partially invalid lexer definition.\n forEach(actualDefinition.modes, (currModeValue, currModeName) => {\n actualDefinition.modes[currModeName] = reject(\n currModeValue,\n (currTokType) => isUndefined(currTokType),\n );\n });\n\n const allModeNames = keys(actualDefinition.modes);\n\n forEach(\n actualDefinition.modes,\n (currModDef: TokenType[], currModName) => {\n this.TRACE_INIT(`Mode: <${currModName}> processing`, () => {\n this.modes.push(currModName);\n\n if (this.config.skipValidations === false) {\n this.TRACE_INIT(`validatePatterns`, () => {\n this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(\n validatePatterns(currModDef, allModeNames),\n );\n });\n }\n\n // If definition errors were encountered, the analysis phase may fail unexpectedly/\n // Considering a lexer with definition errors may never be used, there is no point\n // to performing the analysis anyhow...\n if (isEmpty(this.lexerDefinitionErrors)) {\n augmentTokenTypes(currModDef);\n\n let currAnalyzeResult!: IAnalyzeResult;\n this.TRACE_INIT(`analyzeTokenTypes`, () => {\n currAnalyzeResult = analyzeTokenTypes(currModDef, {\n lineTerminatorCharacters:\n this.config.lineTerminatorCharacters,\n positionTracking: config.positionTracking,\n ensureOptimizations: config.ensureOptimizations,\n safeMode: config.safeMode,\n tracer: this.TRACE_INIT,\n });\n });\n\n this.patternIdxToConfig[currModName] =\n currAnalyzeResult.patternIdxToConfig;\n\n this.charCodeToPatternIdxToConfig[currModName] =\n currAnalyzeResult.charCodeToPatternIdxToConfig;\n\n this.emptyGroups = assign(\n {},\n this.emptyGroups,\n currAnalyzeResult.emptyGroups,\n ) as any;\n\n this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom;\n\n this.canModeBeOptimized[currModName] =\n currAnalyzeResult.canBeOptimized;\n }\n });\n },\n );\n\n this.defaultMode = actualDefinition.defaultMode;\n\n if (\n !isEmpty(this.lexerDefinitionErrors) &&\n !this.config.deferDefinitionErrorsHandling\n ) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message;\n });\n const allErrMessagesString = allErrMessages.join(\n \"-----------------------\\n\",\n );\n throw new Error(\n \"Errors detected in definition of Lexer:\\n\" + allErrMessagesString,\n );\n }\n\n // Only print warning if there are no errors, This will avoid pl\n forEach(this.lexerDefinitionWarning, (warningDescriptor) => {\n PRINT_WARNING(warningDescriptor.message);\n });\n\n this.TRACE_INIT(\"Choosing sub-methods implementations\", () => {\n // Choose the relevant internal implementations for this specific parser.\n // These implementations should be in-lined by the JavaScript engine\n // to provide optimal performance in each scenario.\n if (SUPPORT_STICKY) {\n this.chopInput = identity;\n this.match = this.matchWithTest;\n } else {\n this.updateLastIndex = noop;\n this.match = this.matchWithExec;\n }\n\n if (hasOnlySingleMode) {\n this.handleModes = noop;\n }\n\n if (this.trackStartLines === false) {\n this.computeNewColumn = identity;\n }\n\n if (this.trackEndLines === false) {\n this.updateTokenEndLineColumnLocation = noop;\n }\n\n if (/full/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createFullToken;\n } else if (/onlyStart/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createStartOnlyToken;\n } else if (/onlyOffset/i.test(this.config.positionTracking)) {\n this.createTokenInstance = this.createOffsetOnlyToken;\n } else {\n throw Error(\n `Invalid config option: \"${this.config.positionTracking}\"`,\n );\n }\n\n if (this.hasCustom) {\n this.addToken = this.addTokenUsingPush;\n this.handlePayload = this.handlePayloadWithCustom;\n } else {\n this.addToken = this.addTokenUsingMemberAccess;\n this.handlePayload = this.handlePayloadNoCustom;\n }\n });\n\n this.TRACE_INIT(\"Failed Optimization Warnings\", () => {\n const unOptimizedModes = reduce(\n this.canModeBeOptimized,\n (cannotBeOptimized, canBeOptimized, modeName) => {\n if (canBeOptimized === false) {\n cannotBeOptimized.push(modeName);\n }\n return cannotBeOptimized;\n },\n [] as string[],\n );\n\n if (config.ensureOptimizations && !isEmpty(unOptimizedModes)) {\n throw Error(\n `Lexer Modes: < ${unOptimizedModes.join(\n \", \",\n )} > cannot be optimized.\\n` +\n '\\t Disable the \"ensureOptimizations\" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\\n' +\n \"\\t Or inspect the console log for details on how to resolve these issues.\",\n );\n }\n });\n\n this.TRACE_INIT(\"clearRegExpParserCache\", () => {\n clearRegExpParserCache();\n });\n\n this.TRACE_INIT(\"toFastProperties\", () => {\n toFastProperties(this);\n });\n });\n }\n\n public tokenize(\n text: string,\n initialMode: string = this.defaultMode,\n ): ILexingResult {\n if (!isEmpty(this.lexerDefinitionErrors)) {\n const allErrMessages = map(this.lexerDefinitionErrors, (error) => {\n return error.message;\n });\n const allErrMessagesString = allErrMessages.join(\n \"-----------------------\\n\",\n );\n throw new Error(\n \"Unable to Tokenize because Errors detected in definition of Lexer:\\n\" +\n allErrMessagesString,\n );\n }\n\n return this.tokenizeInternal(text, initialMode);\n }\n\n // There is quite a bit of duplication between this and \"tokenizeInternalLazy\"\n // This is intentional due to performance considerations.\n // this method also used quite a bit of `!` none null assertions because it is too optimized\n // for `tsc` to always understand it is \"safe\"\n private tokenizeInternal(text: string, initialMode: string): ILexingResult {\n let i,\n j,\n k,\n matchAltImage,\n longerAlt,\n matchedImage: string | null,\n payload,\n altPayload,\n imageLength,\n group,\n tokType,\n newToken: IToken,\n errLength,\n droppedChar,\n msg,\n match;\n const orgText = text;\n const orgLength = orgText.length;\n let offset = 0;\n let matchedTokensIndex = 0;\n // initializing the tokensArray to the \"guessed\" size.\n // guessing too little will still reduce the number of array re-sizes on pushes.\n // guessing too large (Tested by guessing x4 too large) may cost a bit more of memory\n // but would still have a faster runtime by avoiding (All but one) array resizing.\n const guessedNumberOfTokens = this.hasCustom\n ? 0 // will break custom token pattern APIs the matchedTokens array will contain undefined elements.\n : Math.floor(text.length / 10);\n const matchedTokens = new Array(guessedNumberOfTokens);\n const errors: ILexingError[] = [];\n let line = this.trackStartLines ? 1 : undefined;\n let column = this.trackStartLines ? 1 : undefined;\n const groups: any = cloneEmptyGroups(this.emptyGroups);\n const trackLines = this.trackStartLines;\n const lineTerminatorPattern = this.config.lineTerminatorsPattern;\n\n let currModePatternsLength = 0;\n let patternIdxToConfig: IPatternConfig[] = [];\n let currCharCodeToPatternIdxToConfig: {\n [charCode: number]: IPatternConfig[];\n } = [];\n\n const modeStack: string[] = [];\n\n const emptyArray: IPatternConfig[] = [];\n Object.freeze(emptyArray);\n let getPossiblePatterns!: (charCode: number) => IPatternConfig[];\n\n function getPossiblePatternsSlow() {\n return patternIdxToConfig;\n }\n\n function getPossiblePatternsOptimized(charCode: number): IPatternConfig[] {\n const optimizedCharIdx = charCodeToOptimizedIndex(charCode);\n const possiblePatterns =\n currCharCodeToPatternIdxToConfig[optimizedCharIdx];\n if (possiblePatterns === undefined) {\n return emptyArray;\n } else {\n return possiblePatterns;\n }\n }\n\n const pop_mode = (popToken: IToken) => {\n // TODO: perhaps avoid this error in the edge case there is no more input?\n if (\n modeStack.length === 1 &&\n // if we have both a POP_MODE and a PUSH_MODE this is in-fact a \"transition\"\n // So no error should occur.\n popToken.tokenType.PUSH_MODE === undefined\n ) {\n // if we try to pop the last mode there lexer will no longer have ANY mode.\n // thus the pop is ignored, an error will be created and the lexer will continue parsing in the previous mode.\n const msg =\n this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(\n popToken,\n );\n\n errors.push({\n offset: popToken.startOffset,\n line: popToken.startLine,\n column: popToken.startColumn,\n length: popToken.image.length,\n message: msg,\n });\n } else {\n modeStack.pop();\n const newMode = last(modeStack)!;\n patternIdxToConfig = this.patternIdxToConfig[newMode];\n currCharCodeToPatternIdxToConfig =\n this.charCodeToPatternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n const modeCanBeOptimized =\n this.canModeBeOptimized[newMode] && this.config.safeMode === false;\n\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized;\n } else {\n getPossiblePatterns = getPossiblePatternsSlow;\n }\n }\n };\n\n function push_mode(this: Lexer, newMode: string) {\n modeStack.push(newMode);\n currCharCodeToPatternIdxToConfig =\n this.charCodeToPatternIdxToConfig[newMode];\n\n patternIdxToConfig = this.patternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n\n currModePatternsLength = patternIdxToConfig.length;\n const modeCanBeOptimized =\n this.canModeBeOptimized[newMode] && this.config.safeMode === false;\n\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized;\n } else {\n getPossiblePatterns = getPossiblePatternsSlow;\n }\n }\n\n // this pattern seems to avoid a V8 de-optimization, although that de-optimization does not\n // seem to matter performance wise.\n push_mode.call(this, initialMode);\n\n let currConfig!: IPatternConfig;\n\n const recoveryEnabled = this.config.recoveryEnabled;\n\n while (offset < orgLength) {\n matchedImage = null;\n\n const nextCharCode = orgText.charCodeAt(offset);\n const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode);\n const chosenPatternsLength = chosenPatternIdxToConfig.length;\n\n for (i = 0; i < chosenPatternsLength; i++) {\n currConfig = chosenPatternIdxToConfig[i];\n const currPattern = currConfig.pattern;\n payload = null;\n\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short;\n if (singleCharCode !== false) {\n if (nextCharCode === singleCharCode) {\n // single character string\n matchedImage = currPattern as string;\n }\n } else if (currConfig.isCustom === true) {\n match = (currPattern as IRegExpExec).exec(\n orgText,\n offset,\n matchedTokens,\n groups,\n );\n if (match !== null) {\n matchedImage = match[0];\n if ((match as CustomPatternMatcherReturn).payload !== undefined) {\n payload = (match as CustomPatternMatcherReturn).payload;\n }\n } else {\n matchedImage = null;\n }\n } else {\n this.updateLastIndex(currPattern as RegExp, offset);\n matchedImage = this.match(currPattern as RegExp, text, offset);\n }\n\n if (matchedImage !== null) {\n // even though this pattern matched we must try a another longer alternative.\n // this can be used to prioritize keywords over identifiers\n longerAlt = currConfig.longerAlt;\n if (longerAlt !== undefined) {\n // TODO: micro optimize, avoid extra prop access\n // by saving/linking longerAlt on the original config?\n const longerAltLength = longerAlt.length;\n for (k = 0; k < longerAltLength; k++) {\n const longerAltConfig = patternIdxToConfig[longerAlt[k]];\n const longerAltPattern = longerAltConfig.pattern;\n altPayload = null;\n\n // single Char can never be a longer alt so no need to test it.\n // manually in-lined because > 600 chars won't be in-lined in V8\n if (longerAltConfig.isCustom === true) {\n match = (longerAltPattern as IRegExpExec).exec(\n orgText,\n offset,\n matchedTokens,\n groups,\n );\n if (match !== null) {\n matchAltImage = match[0];\n if (\n (match as CustomPatternMatcherReturn).payload !== undefined\n ) {\n altPayload = (match as CustomPatternMatcherReturn).payload;\n }\n } else {\n matchAltImage = null;\n }\n } else {\n this.updateLastIndex(longerAltPattern as RegExp, offset);\n matchAltImage = this.match(\n longerAltPattern as RegExp,\n text,\n offset,\n );\n }\n\n if (matchAltImage && matchAltImage.length > matchedImage.length) {\n matchedImage = matchAltImage;\n payload = altPayload;\n currConfig = longerAltConfig;\n // Exit the loop early after matching one of the longer alternatives\n // The first matched alternative takes precedence\n break;\n }\n }\n }\n break;\n }\n }\n\n // successful match\n if (matchedImage !== null) {\n imageLength = matchedImage.length;\n group = currConfig.group;\n if (group !== undefined) {\n tokType = currConfig.tokenTypeIdx;\n // TODO: \"offset + imageLength\" and the new column may be computed twice in case of \"full\" location information inside\n // createFullToken method\n newToken = this.createTokenInstance(\n matchedImage,\n offset,\n tokType,\n currConfig.tokenType,\n line,\n column,\n imageLength,\n );\n\n this.handlePayload(newToken, payload);\n\n // TODO: optimize NOOP in case there are no special groups?\n if (group === false) {\n matchedTokensIndex = this.addToken(\n matchedTokens,\n matchedTokensIndex,\n newToken,\n );\n } else {\n groups[group].push(newToken);\n }\n }\n text = this.chopInput(text, imageLength);\n offset = offset + imageLength;\n\n // TODO: with newlines the column may be assigned twice\n column = this.computeNewColumn(column!, imageLength);\n\n if (trackLines === true && currConfig.canLineTerminator === true) {\n let numOfLTsInMatch = 0;\n let foundTerminator;\n let lastLTEndOffset: number;\n lineTerminatorPattern.lastIndex = 0;\n do {\n foundTerminator = lineTerminatorPattern.test(matchedImage);\n if (foundTerminator === true) {\n lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;\n numOfLTsInMatch++;\n }\n } while (foundTerminator === true);\n\n if (numOfLTsInMatch !== 0) {\n line = line! + numOfLTsInMatch;\n column = imageLength - lastLTEndOffset!;\n this.updateTokenEndLineColumnLocation(\n newToken!,\n group!,\n lastLTEndOffset!,\n numOfLTsInMatch,\n line,\n column,\n imageLength,\n );\n }\n }\n // will be NOOP if no modes present\n this.handleModes(currConfig, pop_mode, push_mode, newToken!);\n } else {\n // error recovery, drop characters until we identify a valid token's start point\n const errorStartOffset = offset;\n const errorLine = line;\n const errorColumn = column;\n let foundResyncPoint = recoveryEnabled === false;\n\n while (foundResyncPoint === false && offset < orgLength) {\n // Identity Func (when sticky flag is enabled)\n text = this.chopInput(text, 1);\n offset++;\n for (j = 0; j < currModePatternsLength; j++) {\n const currConfig = patternIdxToConfig[j];\n const currPattern = currConfig.pattern;\n\n // manually in-lined because > 600 chars won't be in-lined in V8\n const singleCharCode = currConfig.short;\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n // single character string\n foundResyncPoint = true;\n }\n } else if (currConfig.isCustom === true) {\n foundResyncPoint =\n (currPattern as IRegExpExec).exec(\n orgText,\n offset,\n matchedTokens,\n groups,\n ) !== null;\n } else {\n this.updateLastIndex(currPattern as RegExp, offset);\n foundResyncPoint = (currPattern as RegExp).exec(text) !== null;\n }\n\n if (foundResyncPoint === true) {\n break;\n }\n }\n }\n\n errLength = offset - errorStartOffset;\n column = this.computeNewColumn(column!, errLength);\n // at this point we either re-synced or reached the end of the input text\n msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(\n orgText,\n errorStartOffset,\n errLength,\n errorLine,\n errorColumn,\n );\n errors.push({\n offset: errorStartOffset,\n line: errorLine,\n column: errorColumn,\n length: errLength,\n message: msg,\n });\n\n if (recoveryEnabled === false) {\n break;\n }\n }\n }\n\n // if we do have custom patterns which push directly into the\n // TODO: custom tokens should not push directly??\n if (!this.hasCustom) {\n // if we guessed a too large size for the tokens array this will shrink it to the right size.\n matchedTokens.length = matchedTokensIndex;\n }\n\n return {\n tokens: matchedTokens,\n groups: groups,\n errors: errors,\n };\n }\n\n private handleModes(\n config: IPatternConfig,\n pop_mode: (tok: IToken) => void,\n push_mode: (this: Lexer, pushMode: string) => void,\n newToken: IToken,\n ) {\n if (config.pop === true) {\n // need to save the PUSH_MODE property as if the mode is popped\n // patternIdxToPopMode is updated to reflect the new mode after popping the stack\n const pushMode = config.push;\n pop_mode(newToken);\n if (pushMode !== undefined) {\n push_mode.call(this, pushMode);\n }\n } else if (config.push !== undefined) {\n push_mode.call(this, config.push);\n }\n }\n\n private chopInput(text: string, length: number): string {\n return text.substring(length);\n }\n\n private updateLastIndex(regExp: RegExp, newLastIndex: number): void {\n regExp.lastIndex = newLastIndex;\n }\n\n // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler\n private updateTokenEndLineColumnLocation(\n newToken: IToken,\n group: string | false,\n lastLTIdx: number,\n numOfLTsInMatch: number,\n line: number,\n column: number,\n imageLength: number,\n ): void {\n let lastCharIsLT, fixForEndingInLT;\n if (group !== undefined) {\n // a none skipped multi line Token, need to update endLine/endColumn\n lastCharIsLT = lastLTIdx === imageLength - 1;\n fixForEndingInLT = lastCharIsLT ? -1 : 0;\n if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {\n // if a token ends in a LT that last LT only affects the line numbering of following Tokens\n newToken.endLine = line + fixForEndingInLT;\n // the last LT in a token does not affect the endColumn either as the [columnStart ... columnEnd)\n // inclusive to exclusive range.\n newToken.endColumn = column - 1 + -fixForEndingInLT;\n }\n // else single LT in the last character of a token, no need to modify the endLine/EndColumn\n }\n }\n\n private computeNewColumn(oldColumn: number, imageLength: number) {\n return oldColumn + imageLength;\n }\n\n // Place holder, will be replaced by the correct variant according to the locationTracking option at runtime.\n /* istanbul ignore next - place holder */\n private createTokenInstance!: (...args: any[]) => IToken;\n\n private createOffsetOnlyToken(\n image: string,\n startOffset: number,\n tokenTypeIdx: number,\n tokenType: TokenType,\n ) {\n return {\n image,\n startOffset,\n tokenTypeIdx,\n tokenType,\n };\n }\n\n private createStartOnlyToken(\n image: string,\n startOffset: number,\n tokenTypeIdx: number,\n tokenType: TokenType,\n startLine: number,\n startColumn: number,\n ) {\n return {\n image,\n startOffset,\n startLine,\n startColumn,\n tokenTypeIdx,\n tokenType,\n };\n }\n\n private createFullToken(\n image: string,\n startOffset: number,\n tokenTypeIdx: number,\n tokenType: TokenType,\n startLine: number,\n startColumn: number,\n imageLength: number,\n ): IToken {\n return {\n image,\n startOffset,\n endOffset: startOffset + imageLength - 1,\n startLine,\n endLine: startLine,\n startColumn,\n endColumn: startColumn + imageLength - 1,\n tokenTypeIdx,\n tokenType,\n };\n }\n\n // Place holder, will be replaced by the correct variant according to the locationTracking option at runtime.\n /* istanbul ignore next - place holder */\n private addToken!: (\n tokenVector: IToken[],\n index: number,\n tokenToAdd: IToken,\n ) => number;\n\n private addTokenUsingPush(\n tokenVector: IToken[],\n index: number,\n tokenToAdd: IToken,\n ): number {\n tokenVector.push(tokenToAdd);\n return index;\n }\n\n private addTokenUsingMemberAccess(\n tokenVector: IToken[],\n index: number,\n tokenToAdd: IToken,\n ): number {\n tokenVector[index] = tokenToAdd;\n index++;\n return index;\n }\n\n // Place holder, will be replaced by the correct variant according to the hasCustom flag option at runtime.\n private handlePayload: (token: IToken, payload: any) => void;\n\n private handlePayloadNoCustom(token: IToken, payload: any): void {}\n\n private handlePayloadWithCustom(token: IToken, payload: any): void {\n if (payload !== null) {\n token.payload = payload;\n }\n }\n\n // place holder to be replaced with chosen alternative at runtime\n private match!: (\n pattern: RegExp,\n text: string,\n offset: number,\n ) => string | null;\n\n private matchWithTest(\n pattern: RegExp,\n text: string,\n offset: number,\n ): string | null {\n const found = pattern.test(text);\n if (found === true) {\n return text.substring(offset, pattern.lastIndex);\n }\n return null;\n }\n\n private matchWithExec(pattern: RegExp, text: string): string | null {\n const regExpArray = pattern.exec(text);\n return regExpArray !== null ? regExpArray[0] : null;\n }\n\n // Duplicated from the parser's perf trace trait to allow future extraction\n // of the lexer to a separate package.\n TRACE_INIT = (phaseDesc: string, phaseImpl: () => T): T => {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++;\n const indent = new Array(this.traceInitIndent + 1).join(\"\\t\");\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`);\n }\n const { time, value } = timer(phaseImpl);\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log;\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`);\n }\n this.traceInitIndent--;\n return value;\n } else {\n return phaseImpl();\n }\n };\n}\n", "import { has, isString, isUndefined } from \"lodash-es\";\nimport { Lexer } from \"./lexer_public.js\";\nimport { augmentTokenTypes, tokenStructuredMatcher } from \"./tokens.js\";\nimport { IToken, ITokenConfig, TokenType } from \"@chevrotain/types\";\n\nexport function tokenLabel(tokType: TokenType): string {\n if (hasTokenLabel(tokType)) {\n return tokType.LABEL;\n } else {\n return tokType.name;\n }\n}\n\nexport function tokenName(tokType: TokenType): string {\n return tokType.name;\n}\n\nexport function hasTokenLabel(\n obj: TokenType,\n): obj is TokenType & Pick, \"LABEL\"> {\n return isString(obj.LABEL) && obj.LABEL !== \"\";\n}\n\nconst PARENT = \"parent\";\nconst CATEGORIES = \"categories\";\nconst LABEL = \"label\";\nconst GROUP = \"group\";\nconst PUSH_MODE = \"push_mode\";\nconst POP_MODE = \"pop_mode\";\nconst LONGER_ALT = \"longer_alt\";\nconst LINE_BREAKS = \"line_breaks\";\nconst START_CHARS_HINT = \"start_chars_hint\";\n\nexport function createToken(config: ITokenConfig): TokenType {\n return createTokenInternal(config);\n}\n\nfunction createTokenInternal(config: ITokenConfig): TokenType {\n const pattern = config.pattern;\n\n const tokenType: TokenType = {};\n tokenType.name = config.name;\n\n if (!isUndefined(pattern)) {\n tokenType.PATTERN = pattern;\n }\n\n if (has(config, PARENT)) {\n throw (\n \"The parent property is no longer supported.\\n\" +\n \"See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.\"\n );\n }\n\n if (has(config, CATEGORIES)) {\n // casting to ANY as this will be fixed inside `augmentTokenTypes``\n tokenType.CATEGORIES = config[CATEGORIES];\n }\n\n augmentTokenTypes([tokenType]);\n\n if (has(config, LABEL)) {\n tokenType.LABEL = config[LABEL];\n }\n\n if (has(config, GROUP)) {\n tokenType.GROUP = config[GROUP];\n }\n\n if (has(config, POP_MODE)) {\n tokenType.POP_MODE = config[POP_MODE];\n }\n\n if (has(config, PUSH_MODE)) {\n tokenType.PUSH_MODE = config[PUSH_MODE];\n }\n\n if (has(config, LONGER_ALT)) {\n tokenType.LONGER_ALT = config[LONGER_ALT];\n }\n\n if (has(config, LINE_BREAKS)) {\n tokenType.LINE_BREAKS = config[LINE_BREAKS];\n }\n\n if (has(config, START_CHARS_HINT)) {\n tokenType.START_CHARS_HINT = config[START_CHARS_HINT];\n }\n\n return tokenType;\n}\n\nexport const EOF = createToken({ name: \"EOF\", pattern: Lexer.NA });\naugmentTokenTypes([EOF]);\n\nexport function createTokenInstance(\n tokType: TokenType,\n image: string,\n startOffset: number,\n endOffset: number,\n startLine: number,\n endLine: number,\n startColumn: number,\n endColumn: number,\n): IToken {\n return {\n image,\n startOffset,\n endOffset,\n startLine,\n endLine,\n startColumn,\n endColumn,\n tokenTypeIdx: (tokType).tokenTypeIdx,\n tokenType: tokType,\n };\n}\n\nexport function tokenMatcher(token: IToken, tokType: TokenType): boolean {\n return tokenStructuredMatcher(token, tokType);\n}\n", "import { hasTokenLabel, tokenLabel } from \"../scan/tokens_public.js\";\nimport { first, map, reduce } from \"lodash-es\";\nimport {\n Alternation,\n getProductionDslName,\n NonTerminal,\n Rule,\n Terminal,\n} from \"@chevrotain/gast\";\nimport {\n IParserErrorMessageProvider,\n IProductionWithOccurrence,\n TokenType,\n} from \"@chevrotain/types\";\nimport {\n IGrammarResolverErrorMessageProvider,\n IGrammarValidatorErrorMessageProvider,\n} from \"./grammar/types.js\";\n\nexport const defaultParserErrorProvider: IParserErrorMessageProvider = {\n buildMismatchTokenMessage({ expected, actual, previous, ruleName }): string {\n const hasLabel = hasTokenLabel(expected);\n const expectedMsg = hasLabel\n ? `--> ${tokenLabel(expected)} <--`\n : `token of type --> ${expected.name} <--`;\n\n const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`;\n\n return msg;\n },\n\n buildNotAllInputParsedMessage({ firstRedundant, ruleName }): string {\n return \"Redundant input, expecting EOF but found: \" + firstRedundant.image;\n },\n\n buildNoViableAltMessage({\n expectedPathsPerAlt,\n actual,\n previous,\n customUserDescription,\n ruleName,\n }): string {\n const errPrefix = \"Expecting: \";\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = first(actual)!.image;\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\";\n\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix;\n } else {\n const allLookAheadPaths = reduce(\n expectedPathsPerAlt,\n (result, currAltPaths) => result.concat(currAltPaths),\n [] as TokenType[][],\n );\n const nextValidTokenSequences = map(\n allLookAheadPaths,\n (currPath) =>\n `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(\n \", \",\n )}]`,\n );\n const nextValidSequenceItems = map(\n nextValidTokenSequences,\n (itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`,\n );\n const calculatedDescription = `one of these possible Token sequences:\\n${nextValidSequenceItems.join(\n \"\\n\",\n )}`;\n\n return errPrefix + calculatedDescription + errSuffix;\n }\n },\n\n buildEarlyExitMessage({\n expectedIterationPaths,\n actual,\n customUserDescription,\n ruleName,\n }): string {\n const errPrefix = \"Expecting: \";\n // TODO: issue: No Viable Alternative Error may have incomplete details. #502\n const actualText = first(actual)!.image;\n const errSuffix = \"\\nbut found: '\" + actualText + \"'\";\n\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix;\n } else {\n const nextValidTokenSequences = map(\n expectedIterationPaths,\n (currPath) =>\n `[${map(currPath, (currTokenType) => tokenLabel(currTokenType)).join(\n \",\",\n )}]`,\n );\n const calculatedDescription =\n `expecting at least one iteration which starts with one of these possible Token sequences::\\n ` +\n `<${nextValidTokenSequences.join(\" ,\")}>`;\n\n return errPrefix + calculatedDescription + errSuffix;\n }\n },\n};\n\nObject.freeze(defaultParserErrorProvider);\n\nexport const defaultGrammarResolverErrorProvider: IGrammarResolverErrorMessageProvider =\n {\n buildRuleNotFoundError(\n topLevelRule: Rule,\n undefinedRule: NonTerminal,\n ): string {\n const msg =\n \"Invalid grammar, reference to a rule which is not defined: ->\" +\n undefinedRule.nonTerminalName +\n \"<-\\n\" +\n \"inside top level rule: ->\" +\n topLevelRule.name +\n \"<-\";\n return msg;\n },\n };\n\nexport const defaultGrammarValidatorErrorProvider: IGrammarValidatorErrorMessageProvider =\n {\n buildDuplicateFoundError(\n topLevelRule: Rule,\n duplicateProds: IProductionWithOccurrence[],\n ): string {\n function getExtraProductionArgument(\n prod: IProductionWithOccurrence,\n ): string {\n if (prod instanceof Terminal) {\n return prod.terminalType.name;\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName;\n } else {\n return \"\";\n }\n }\n\n const topLevelName = topLevelRule.name;\n const duplicateProd = first(duplicateProds)!;\n const index = duplicateProd.idx;\n const dslName = getProductionDslName(duplicateProd);\n const extraArgument = getExtraProductionArgument(duplicateProd);\n\n const hasExplicitIndex = index > 0;\n let msg = `->${dslName}${hasExplicitIndex ? index : \"\"}<- ${\n extraArgument ? `with argument: ->${extraArgument}<-` : \"\"\n }\n appears more than once (${\n duplicateProds.length\n } times) in the top level rule: ->${topLevelName}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;\n\n // white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...\n msg = msg.replace(/[ \\t]+/g, \" \");\n msg = msg.replace(/\\s\\s+/g, \"\\n\");\n\n return msg;\n },\n\n buildNamespaceConflictError(rule: Rule): string {\n const errMsg =\n `Namespace conflict found in grammar.\\n` +\n `The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.\\n` +\n `To resolve this make sure each Terminal and Non-Terminal names are unique\\n` +\n `This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\\n` +\n `and Non-Terminal names start with a lower case letter.`;\n\n return errMsg;\n },\n\n buildAlternationPrefixAmbiguityError(options: {\n topLevelRule: Rule;\n prefixPath: TokenType[];\n ambiguityIndices: number[];\n alternation: Alternation;\n }): string {\n const pathMsg = map(options.prefixPath, (currTok) =>\n tokenLabel(currTok),\n ).join(\", \");\n const occurrence =\n options.alternation.idx === 0 ? \"\" : options.alternation.idx;\n const errMsg =\n `Ambiguous alternatives: <${options.ambiguityIndices.join(\n \" ,\",\n )}> due to common lookahead prefix\\n` +\n `in inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n` +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\\n` +\n `For Further details.`;\n\n return errMsg;\n },\n\n buildAlternationAmbiguityError(options: {\n topLevelRule: Rule;\n prefixPath: TokenType[];\n ambiguityIndices: number[];\n alternation: Alternation;\n }): string {\n const pathMsg = map(options.prefixPath, (currtok) =>\n tokenLabel(currtok),\n ).join(\", \");\n const occurrence =\n options.alternation.idx === 0 ? \"\" : options.alternation.idx;\n let currMessage =\n `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(\n \" ,\",\n )}> in ` +\n ` inside <${options.topLevelRule.name}> Rule,\\n` +\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n`;\n\n currMessage =\n currMessage +\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\\n` +\n `For Further details.`;\n return currMessage;\n },\n\n buildEmptyRepetitionError(options: {\n topLevelRule: Rule;\n repetition: IProductionWithOccurrence;\n }): string {\n let dslName = getProductionDslName(options.repetition);\n if (options.repetition.idx !== 0) {\n dslName += options.repetition.idx;\n }\n\n const errMsg =\n `The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\\n` +\n `This could lead to an infinite loop.`;\n\n return errMsg;\n },\n\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildTokenNameError(options: {\n tokenType: TokenType;\n expectedPattern: RegExp;\n }): string {\n /* istanbul ignore next */\n return \"deprecated\";\n },\n\n buildEmptyAlternationError(options: {\n topLevelRule: Rule;\n alternation: Alternation;\n emptyChoiceIdx: number;\n }): string {\n const errMsg =\n `Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}>` +\n ` in inside <${options.topLevelRule.name}> Rule.\\n` +\n `Only the last alternative may be an empty alternative.`;\n\n return errMsg;\n },\n\n buildTooManyAlternativesError(options: {\n topLevelRule: Rule;\n alternation: Alternation;\n }): string {\n const errMsg =\n `An Alternation cannot have more than 256 alternatives:\\n` +\n ` inside <${\n options.topLevelRule.name\n }> Rule.\\n has ${\n options.alternation.definition.length + 1\n } alternatives.`;\n\n return errMsg;\n },\n\n buildLeftRecursionError(options: {\n topLevelRule: Rule;\n leftRecursionPath: Rule[];\n }): string {\n const ruleName = options.topLevelRule.name;\n const pathNames = map(\n options.leftRecursionPath,\n (currRule) => currRule.name,\n );\n const leftRecursivePath = `${ruleName} --> ${pathNames\n .concat([ruleName])\n .join(\" --> \")}`;\n const errMsg =\n `Left Recursion found in grammar.\\n` +\n `rule: <${ruleName}> can be invoked from itself (directly or indirectly)\\n` +\n `without consuming any Tokens. The grammar path that causes this is: \\n ${leftRecursivePath}\\n` +\n ` To fix this refactor your grammar to remove the left recursion.\\n` +\n `see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`;\n\n return errMsg;\n },\n\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildInvalidRuleNameError(options: {\n topLevelRule: Rule;\n expectedPattern: RegExp;\n }): string {\n /* istanbul ignore next */\n return \"deprecated\";\n },\n\n buildDuplicateRuleNameError(options: {\n topLevelRule: Rule | string;\n grammarName: string;\n }): string {\n let ruleName;\n if (options.topLevelRule instanceof Rule) {\n ruleName = options.topLevelRule.name;\n } else {\n ruleName = options.topLevelRule;\n }\n\n const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`;\n\n return errMsg;\n },\n };\n", "import {\n IParserUnresolvedRefDefinitionError,\n ParserDefinitionErrorType,\n} from \"../parser/parser.js\";\nimport { forEach, values } from \"lodash-es\";\nimport { GAstVisitor, NonTerminal, Rule } from \"@chevrotain/gast\";\nimport {\n IGrammarResolverErrorMessageProvider,\n IParserDefinitionError,\n} from \"./types.js\";\n\nexport function resolveGrammar(\n topLevels: Record,\n errMsgProvider: IGrammarResolverErrorMessageProvider,\n): IParserDefinitionError[] {\n const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider);\n refResolver.resolveRefs();\n return refResolver.errors;\n}\n\nexport class GastRefResolverVisitor extends GAstVisitor {\n public errors: IParserUnresolvedRefDefinitionError[] = [];\n private currTopLevel: Rule;\n\n constructor(\n private nameToTopRule: Record,\n private errMsgProvider: IGrammarResolverErrorMessageProvider,\n ) {\n super();\n }\n\n public resolveRefs(): void {\n forEach(values(this.nameToTopRule), (prod) => {\n this.currTopLevel = prod;\n prod.accept(this);\n });\n }\n\n public visitNonTerminal(node: NonTerminal): void {\n const ref = this.nameToTopRule[node.nonTerminalName];\n\n if (!ref) {\n const msg = this.errMsgProvider.buildRuleNotFoundError(\n this.currTopLevel,\n node,\n );\n this.errors.push({\n message: msg,\n type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,\n ruleName: this.currTopLevel.name,\n unresolvedRefName: node.nonTerminalName,\n });\n } else {\n node.referencedRule = ref;\n }\n }\n}\n", "import {\n clone,\n drop,\n dropRight,\n first as _first,\n forEach,\n isEmpty,\n last,\n} from \"lodash-es\";\nimport { first } from \"./first.js\";\nimport { RestWalker } from \"./rest.js\";\nimport { TokenMatcher } from \"../parser/parser.js\";\nimport {\n Alternation,\n Alternative,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Rule,\n Terminal,\n} from \"@chevrotain/gast\";\nimport {\n IGrammarPath,\n IProduction,\n ISyntacticContentAssistPath,\n IToken,\n ITokenGrammarPath,\n TokenType,\n} from \"@chevrotain/types\";\n\nexport abstract class AbstractNextPossibleTokensWalker extends RestWalker {\n protected possibleTokTypes: TokenType[] = [];\n protected ruleStack: string[];\n protected occurrenceStack: number[];\n\n protected nextProductionName = \"\";\n protected nextProductionOccurrence = 0;\n protected found = false;\n protected isAtEndOfPath = false;\n\n constructor(\n protected topProd: Rule,\n protected path: IGrammarPath,\n ) {\n super();\n }\n\n startWalking(): TokenType[] {\n this.found = false;\n\n if (this.path.ruleStack[0] !== this.topProd.name) {\n throw Error(\"The path does not start with the walker's top Rule!\");\n }\n\n // immutable for the win\n this.ruleStack = clone(this.path.ruleStack).reverse(); // intelij bug requires assertion\n this.occurrenceStack = clone(this.path.occurrenceStack).reverse(); // intelij bug requires assertion\n\n // already verified that the first production is valid, we now seek the 2nd production\n this.ruleStack.pop();\n this.occurrenceStack.pop();\n\n this.updateExpectedNext();\n this.walk(this.topProd);\n\n return this.possibleTokTypes;\n }\n\n walk(\n prod: { definition: IProduction[] },\n prevRest: IProduction[] = [],\n ): void {\n // stop scanning once we found the path\n if (!this.found) {\n super.walk(prod, prevRest);\n }\n }\n\n walkProdRef(\n refProd: NonTerminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n // found the next production, need to keep walking in it\n if (\n refProd.referencedRule.name === this.nextProductionName &&\n refProd.idx === this.nextProductionOccurrence\n ) {\n const fullRest = currRest.concat(prevRest);\n this.updateExpectedNext();\n this.walk(refProd.referencedRule, fullRest);\n }\n }\n\n updateExpectedNext(): void {\n // need to consume the Terminal\n if (isEmpty(this.ruleStack)) {\n // must reset nextProductionXXX to avoid walking down another Top Level production while what we are\n // really seeking is the last Terminal...\n this.nextProductionName = \"\";\n this.nextProductionOccurrence = 0;\n this.isAtEndOfPath = true;\n } else {\n this.nextProductionName = this.ruleStack.pop()!;\n this.nextProductionOccurrence = this.occurrenceStack.pop()!;\n }\n }\n}\n\nexport class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker {\n private nextTerminalName = \"\";\n private nextTerminalOccurrence = 0;\n\n constructor(\n topProd: Rule,\n protected path: ITokenGrammarPath,\n ) {\n super(topProd, path);\n this.nextTerminalName = this.path.lastTok.name;\n this.nextTerminalOccurrence = this.path.lastTokOccurrence;\n }\n\n walkTerminal(\n terminal: Terminal,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (\n this.isAtEndOfPath &&\n terminal.terminalType.name === this.nextTerminalName &&\n terminal.idx === this.nextTerminalOccurrence &&\n !this.found\n ) {\n const fullRest = currRest.concat(prevRest);\n const restProd = new Alternative({ definition: fullRest });\n this.possibleTokTypes = first(restProd);\n this.found = true;\n }\n }\n}\n\nexport type AlternativesFirstTokens = TokenType[][];\n\nexport interface IFirstAfterRepetition {\n token: TokenType | undefined;\n occurrence: number | undefined;\n isEndOfRule: boolean | undefined;\n}\n\n/**\n * This walker only \"walks\" a single \"TOP\" level in the Grammar Ast, this means\n * it never \"follows\" production refs\n */\nexport class AbstractNextTerminalAfterProductionWalker extends RestWalker {\n protected result: IFirstAfterRepetition = {\n token: undefined,\n occurrence: undefined,\n isEndOfRule: undefined,\n };\n\n constructor(\n protected topRule: Rule,\n protected occurrence: number,\n ) {\n super();\n }\n\n startWalking(): IFirstAfterRepetition {\n this.walk(this.topRule);\n return this.result;\n }\n}\n\nexport class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker {\n walkMany(\n manyProd: Repetition,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (manyProd.idx === this.occurrence) {\n const firstAfterMany = _first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterMany === undefined;\n if (firstAfterMany instanceof Terminal) {\n this.result.token = firstAfterMany.terminalType;\n this.result.occurrence = firstAfterMany.idx;\n }\n } else {\n super.walkMany(manyProd, currRest, prevRest);\n }\n }\n}\n\nexport class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkManySep(\n manySepProd: RepetitionWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (manySepProd.idx === this.occurrence) {\n const firstAfterManySep = _first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterManySep === undefined;\n if (firstAfterManySep instanceof Terminal) {\n this.result.token = firstAfterManySep.terminalType;\n this.result.occurrence = firstAfterManySep.idx;\n }\n } else {\n super.walkManySep(manySepProd, currRest, prevRest);\n }\n }\n}\n\nexport class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOne(\n atLeastOneProd: RepetitionMandatory,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (atLeastOneProd.idx === this.occurrence) {\n const firstAfterAtLeastOne = _first(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterAtLeastOne === undefined;\n if (firstAfterAtLeastOne instanceof Terminal) {\n this.result.token = firstAfterAtLeastOne.terminalType;\n this.result.occurrence = firstAfterAtLeastOne.idx;\n }\n } else {\n super.walkAtLeastOne(atLeastOneProd, currRest, prevRest);\n }\n }\n}\n\n// TODO: reduce code duplication in the AfterWalkers\nexport class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker {\n walkAtLeastOneSep(\n atleastOneSepProd: RepetitionMandatoryWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (atleastOneSepProd.idx === this.occurrence) {\n const firstAfterfirstAfterAtLeastOneSep = _first(\n currRest.concat(prevRest),\n );\n this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === undefined;\n if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) {\n this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType;\n this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx;\n }\n } else {\n super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest);\n }\n }\n}\n\nexport interface PartialPathAndSuffixes {\n partialPath: TokenType[];\n suffixDef: IProduction[];\n}\n\nexport function possiblePathsFrom(\n targetDef: IProduction[],\n maxLength: number,\n currPath: TokenType[] = [],\n): PartialPathAndSuffixes[] {\n // avoid side effects\n currPath = clone(currPath);\n let result: PartialPathAndSuffixes[] = [];\n let i = 0;\n\n // TODO: avoid inner funcs\n function remainingPathWith(nextDef: IProduction[]) {\n return nextDef.concat(drop(targetDef, i + 1));\n }\n\n // TODO: avoid inner funcs\n function getAlternativesForProd(definition: IProduction[]) {\n const alternatives = possiblePathsFrom(\n remainingPathWith(definition),\n maxLength,\n currPath,\n );\n return result.concat(alternatives);\n }\n\n /**\n * Mandatory productions will halt the loop as the paths computed from their recursive calls will already contain the\n * following (rest) of the targetDef.\n *\n * For optional productions (Option/Repetition/...) the loop will continue to represent the paths that do not include the\n * the optional production.\n */\n while (currPath.length < maxLength && i < targetDef.length) {\n const prod = targetDef[i];\n\n /* istanbul ignore else */\n if (prod instanceof Alternative) {\n return getAlternativesForProd(prod.definition);\n } else if (prod instanceof NonTerminal) {\n return getAlternativesForProd(prod.definition);\n } else if (prod instanceof Option) {\n result = getAlternativesForProd(prod.definition);\n } else if (prod instanceof RepetitionMandatory) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ]);\n return getAlternativesForProd(newDef);\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n const newDef = [\n new Alternative({ definition: prod.definition }),\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(\n prod.definition,\n ),\n }),\n ];\n return getAlternativesForProd(newDef);\n } else if (prod instanceof RepetitionWithSeparator) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: [new Terminal({ terminalType: prod.separator })].concat(\n prod.definition,\n ),\n }),\n ]);\n result = getAlternativesForProd(newDef);\n } else if (prod instanceof Repetition) {\n const newDef = prod.definition.concat([\n new Repetition({\n definition: prod.definition,\n }),\n ]);\n result = getAlternativesForProd(newDef);\n } else if (prod instanceof Alternation) {\n forEach(prod.definition, (currAlt) => {\n // TODO: this is a limited check for empty alternatives\n // It would prevent a common case of infinite loops during parser initialization.\n // However **in-directly** empty alternatives may still cause issues.\n if (isEmpty(currAlt.definition) === false) {\n result = getAlternativesForProd(currAlt.definition);\n }\n });\n return result;\n } else if (prod instanceof Terminal) {\n currPath.push(prod.terminalType);\n } else {\n throw Error(\"non exhaustive match\");\n }\n\n i++;\n }\n result.push({\n partialPath: currPath,\n suffixDef: drop(targetDef, i),\n });\n\n return result;\n}\n\ninterface IPathToExamine {\n idx: number;\n def: IProduction[];\n ruleStack: string[];\n occurrenceStack: number[];\n}\n\nexport function nextPossibleTokensAfter(\n initialDef: IProduction[],\n tokenVector: IToken[],\n tokMatcher: TokenMatcher,\n maxLookAhead: number,\n): ISyntacticContentAssistPath[] {\n const EXIT_NON_TERMINAL: any = \"EXIT_NONE_TERMINAL\";\n // to avoid creating a new Array each time.\n const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL];\n const EXIT_ALTERNATIVE: any = \"EXIT_ALTERNATIVE\";\n let foundCompletePath = false;\n\n const tokenVectorLength = tokenVector.length;\n const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1;\n\n const result: ISyntacticContentAssistPath[] = [];\n\n const possiblePaths: IPathToExamine[] = [];\n possiblePaths.push({\n idx: -1,\n def: initialDef,\n ruleStack: [],\n occurrenceStack: [],\n });\n\n while (!isEmpty(possiblePaths)) {\n const currPath = possiblePaths.pop()!;\n\n // skip alternatives if no more results can be found (assuming deterministic grammar with fixed lookahead)\n if (currPath === EXIT_ALTERNATIVE) {\n if (\n foundCompletePath &&\n last(possiblePaths)!.idx <= minimalAlternativesIndex\n ) {\n // remove irrelevant alternative\n possiblePaths.pop();\n }\n continue;\n }\n\n const currDef = currPath.def;\n const currIdx = currPath.idx;\n const currRuleStack = currPath.ruleStack;\n const currOccurrenceStack = currPath.occurrenceStack;\n\n // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT\n if (isEmpty(currDef)) {\n continue;\n }\n\n const prod = currDef[0];\n /* istanbul ignore else */\n if (prod === EXIT_NON_TERMINAL) {\n const nextPath = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: dropRight(currRuleStack),\n occurrenceStack: dropRight(currOccurrenceStack),\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof Terminal) {\n /* istanbul ignore else */\n if (currIdx < tokenVectorLength - 1) {\n const nextIdx = currIdx + 1;\n const actualToken = tokenVector[nextIdx];\n if (tokMatcher!(actualToken, prod.terminalType)) {\n const nextPath = {\n idx: nextIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPath);\n }\n // end of the line\n } else if (currIdx === tokenVectorLength - 1) {\n // IGNORE ABOVE ELSE\n result.push({\n nextTokenType: prod.terminalType,\n nextTokenOccurrence: prod.idx,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n });\n foundCompletePath = true;\n } else {\n throw Error(\"non exhaustive match\");\n }\n } else if (prod instanceof NonTerminal) {\n const newRuleStack = clone(currRuleStack);\n newRuleStack.push(prod.nonTerminalName);\n\n const newOccurrenceStack = clone(currOccurrenceStack);\n newOccurrenceStack.push(prod.idx);\n\n const nextPath = {\n idx: currIdx,\n def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop(currDef)),\n ruleStack: newRuleStack,\n occurrenceStack: newOccurrenceStack,\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof Option) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n\n const nextPathWith = {\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof RepetitionMandatory) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const secondIteration = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n });\n const nextDef = prod.definition.concat([secondIteration], drop(currDef));\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\n // TODO:(THE NEW operators here take a while...) (convert once?)\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n });\n const secondIteration = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n });\n const nextDef = prod.definition.concat([secondIteration], drop(currDef));\n const nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof RepetitionWithSeparator) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n\n const separatorGast = new Terminal({\n terminalType: prod.separator,\n });\n const nthRepetition = new Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx,\n });\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef));\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof Repetition) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n const nextPathWithout = {\n idx: currIdx,\n def: drop(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWithout);\n // required marker to avoid backtracking paths whose higher priority alternatives already matched\n possiblePaths.push(EXIT_ALTERNATIVE);\n\n // TODO: an empty repetition will cause infinite loops here, will the parser detect this in selfAnalysis?\n const nthRepetition = new Repetition({\n definition: prod.definition,\n idx: prod.idx,\n });\n const nextDef = prod.definition.concat([nthRepetition], drop(currDef));\n const nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof Alternation) {\n // the order of alternatives is meaningful, FILO (Last path will be traversed first).\n for (let i = prod.definition.length - 1; i >= 0; i--) {\n const currAlt: any = prod.definition[i];\n const currAltPath = {\n idx: currIdx,\n def: currAlt.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n };\n possiblePaths.push(currAltPath);\n possiblePaths.push(EXIT_ALTERNATIVE);\n }\n } else if (prod instanceof Alternative) {\n possiblePaths.push({\n idx: currIdx,\n def: prod.definition.concat(drop(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack,\n });\n } else if (prod instanceof Rule) {\n // last because we should only encounter at most a single one of these per invocation.\n possiblePaths.push(\n expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack),\n );\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n return result;\n}\n\nfunction expandTopLevelRule(\n topRule: Rule,\n currIdx: number,\n currRuleStack: string[],\n currOccurrenceStack: number[],\n): IPathToExamine {\n const newRuleStack = clone(currRuleStack);\n newRuleStack.push(topRule.name);\n\n const newCurrOccurrenceStack = clone(currOccurrenceStack);\n // top rule is always assumed to have been called with occurrence index 1\n newCurrOccurrenceStack.push(1);\n\n return {\n idx: currIdx,\n def: topRule.definition,\n ruleStack: newRuleStack,\n occurrenceStack: newCurrOccurrenceStack,\n };\n}\n", "import { every, flatten, forEach, has, isEmpty, map, reduce } from \"lodash-es\";\nimport { possiblePathsFrom } from \"./interpreter.js\";\nimport { RestWalker } from \"./rest.js\";\nimport { Predicate, TokenMatcher } from \"../parser/parser.js\";\nimport {\n tokenStructuredMatcher,\n tokenStructuredMatcherNoCategories,\n} from \"../../scan/tokens.js\";\nimport {\n Alternation,\n Alternative as AlternativeGAST,\n GAstVisitor,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n} from \"@chevrotain/gast\";\nimport {\n BaseParser,\n IOrAlt,\n IProduction,\n IProductionWithOccurrence,\n LookaheadProductionType,\n LookaheadSequence,\n Rule,\n TokenType,\n} from \"@chevrotain/types\";\n\nexport enum PROD_TYPE {\n OPTION,\n REPETITION,\n REPETITION_MANDATORY,\n REPETITION_MANDATORY_WITH_SEPARATOR,\n REPETITION_WITH_SEPARATOR,\n ALTERNATION,\n}\n\nexport function getProdType(\n prod: IProduction | LookaheadProductionType,\n): PROD_TYPE {\n /* istanbul ignore else */\n if (prod instanceof Option || prod === \"Option\") {\n return PROD_TYPE.OPTION;\n } else if (prod instanceof Repetition || prod === \"Repetition\") {\n return PROD_TYPE.REPETITION;\n } else if (\n prod instanceof RepetitionMandatory ||\n prod === \"RepetitionMandatory\"\n ) {\n return PROD_TYPE.REPETITION_MANDATORY;\n } else if (\n prod instanceof RepetitionMandatoryWithSeparator ||\n prod === \"RepetitionMandatoryWithSeparator\"\n ) {\n return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;\n } else if (\n prod instanceof RepetitionWithSeparator ||\n prod === \"RepetitionWithSeparator\"\n ) {\n return PROD_TYPE.REPETITION_WITH_SEPARATOR;\n } else if (prod instanceof Alternation || prod === \"Alternation\") {\n return PROD_TYPE.ALTERNATION;\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\n\nexport function getLookaheadPaths(options: {\n occurrence: number;\n rule: Rule;\n prodType: LookaheadProductionType;\n maxLookahead: number;\n}): LookaheadSequence[] {\n const { occurrence, rule, prodType, maxLookahead } = options;\n const type = getProdType(prodType);\n if (type === PROD_TYPE.ALTERNATION) {\n return getLookaheadPathsForOr(occurrence, rule, maxLookahead);\n } else {\n return getLookaheadPathsForOptionalProd(\n occurrence,\n rule,\n type,\n maxLookahead,\n );\n }\n}\n\nexport function buildLookaheadFuncForOr(\n occurrence: number,\n ruleGrammar: Rule,\n maxLookahead: number,\n hasPredicates: boolean,\n dynamicTokensEnabled: boolean,\n laFuncBuilder: Function,\n): (orAlts?: IOrAlt[]) => number | undefined {\n const lookAheadPaths = getLookaheadPathsForOr(\n occurrence,\n ruleGrammar,\n maxLookahead,\n );\n\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher;\n\n return laFuncBuilder(\n lookAheadPaths,\n hasPredicates,\n tokenMatcher,\n dynamicTokensEnabled,\n );\n}\n\n/**\n * When dealing with an Optional production (OPTION/MANY/2nd iteration of AT_LEAST_ONE/...) we need to compare\n * the lookahead \"inside\" the production and the lookahead immediately \"after\" it in the same top level rule (context free).\n *\n * Example: given a production:\n * ABC(DE)?DF\n *\n * The optional '(DE)?' should only be entered if we see 'DE'. a single Token 'D' is not sufficient to distinguish between the two\n * alternatives.\n *\n * @returns A Lookahead function which will return true IFF the parser should parse the Optional production.\n */\nexport function buildLookaheadFuncForOptionalProd(\n occurrence: number,\n ruleGrammar: Rule,\n k: number,\n dynamicTokensEnabled: boolean,\n prodType: PROD_TYPE,\n lookaheadBuilder: (\n lookAheadSequence: LookaheadSequence,\n tokenMatcher: TokenMatcher,\n dynamicTokensEnabled: boolean,\n ) => () => boolean,\n): () => boolean {\n const lookAheadPaths = getLookaheadPathsForOptionalProd(\n occurrence,\n ruleGrammar,\n prodType,\n k,\n );\n\n const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher;\n\n return lookaheadBuilder(\n lookAheadPaths[0],\n tokenMatcher,\n dynamicTokensEnabled,\n );\n}\n\nexport type Alternative = TokenType[][];\n\nexport function buildAlternativesLookAheadFunc(\n alts: LookaheadSequence[],\n hasPredicates: boolean,\n tokenMatcher: TokenMatcher,\n dynamicTokensEnabled: boolean,\n): (orAlts: IOrAlt[]) => number | undefined {\n const numOfAlts = alts.length;\n const areAllOneTokenLookahead = every(alts, (currAlt) => {\n return every(currAlt, (currPath) => {\n return currPath.length === 1;\n });\n });\n\n // This version takes into account the predicates as well.\n if (hasPredicates) {\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (\n this: BaseParser,\n orAlts: IOrAlt[],\n ): number | undefined {\n // unfortunately the predicates must be extracted every single time\n // as they cannot be cached due to references to parameters(vars) which are no longer valid.\n // note that in the common case of no predicates, no cpu time will be wasted on this (see else block)\n const predicates: (Predicate | undefined)[] = map(\n orAlts,\n (currAlt) => currAlt.GATE,\n );\n\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t];\n const currNumOfPaths = currAlt.length;\n\n const currPredicate = predicates[t];\n if (currPredicate !== undefined && currPredicate.call(this) === false) {\n // if the predicate does not match there is no point in checking the paths\n continue;\n }\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j];\n const currPathLength = currPath.length;\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1);\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t;\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined;\n };\n } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead. These Optimizations cannot work if dynamically defined Tokens are used.\n const singleTokenAlts = map(alts, (currAlt) => {\n return flatten(currAlt);\n });\n\n const choiceToAlt = reduce(\n singleTokenAlts,\n (result, currAlt, idx) => {\n forEach(currAlt, (currTokType) => {\n if (!has(result, currTokType.tokenTypeIdx!)) {\n result[currTokType.tokenTypeIdx!] = idx;\n }\n forEach(currTokType.categoryMatches!, (currExtendingType) => {\n if (!has(result, currExtendingType)) {\n result[currExtendingType] = idx;\n }\n });\n });\n return result;\n },\n {} as Record,\n );\n\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (this: BaseParser): number {\n const nextToken = this.LA(1);\n return choiceToAlt[nextToken.tokenTypeIdx];\n };\n } else {\n // optimized lookahead without needing to check the predicates at all.\n // this causes code duplication which is intentional to improve performance.\n /**\n * @returns {number} - The chosen alternative index\n */\n return function (this: BaseParser): number | undefined {\n for (let t = 0; t < numOfAlts; t++) {\n const currAlt = alts[t];\n const currNumOfPaths = currAlt.length;\n nextPath: for (let j = 0; j < currNumOfPaths; j++) {\n const currPath = currAlt[j];\n const currPathLength = currPath.length;\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1);\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n // this will also work for an empty ALT as the loop will be skipped\n return t;\n }\n // none of the paths for the current alternative matched\n // try the next alternative\n }\n // none of the alternatives could be matched\n return undefined;\n };\n }\n}\n\nexport function buildSingleAlternativeLookaheadFunction(\n alt: LookaheadSequence,\n tokenMatcher: TokenMatcher,\n dynamicTokensEnabled: boolean,\n): () => boolean {\n const areAllOneTokenLookahead = every(alt, (currPath) => {\n return currPath.length === 1;\n });\n\n const numOfPaths = alt.length;\n\n // optimized (common) case of all the lookaheads paths requiring only\n // a single token lookahead.\n if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n const singleTokensTypes = flatten(alt);\n\n if (\n singleTokensTypes.length === 1 &&\n isEmpty((singleTokensTypes[0]).categoryMatches)\n ) {\n const expectedTokenType = singleTokensTypes[0];\n const expectedTokenUniqueKey = (expectedTokenType).tokenTypeIdx;\n\n return function (this: BaseParser): boolean {\n return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey;\n };\n } else {\n const choiceToAlt = reduce(\n singleTokensTypes,\n (result, currTokType, idx) => {\n result[currTokType.tokenTypeIdx!] = true;\n forEach(currTokType.categoryMatches!, (currExtendingType) => {\n result[currExtendingType] = true;\n });\n return result;\n },\n [] as boolean[],\n );\n\n return function (this: BaseParser): boolean {\n const nextToken = this.LA(1);\n return choiceToAlt[nextToken.tokenTypeIdx] === true;\n };\n }\n } else {\n return function (this: BaseParser): boolean {\n nextPath: for (let j = 0; j < numOfPaths; j++) {\n const currPath = alt[j];\n const currPathLength = currPath.length;\n for (let i = 0; i < currPathLength; i++) {\n const nextToken = this.LA(i + 1);\n if (tokenMatcher(nextToken, currPath[i]) === false) {\n // mismatch in current path\n // try the next pth\n continue nextPath;\n }\n }\n // found a full path that matches.\n return true;\n }\n\n // none of the paths matched\n return false;\n };\n }\n}\n\nclass RestDefinitionFinderWalker extends RestWalker {\n private restDef: IProduction[];\n\n constructor(\n private topProd: Rule,\n private targetOccurrence: number,\n private targetProdType: PROD_TYPE,\n ) {\n super();\n }\n\n startWalking(): IProduction[] {\n this.walk(this.topProd);\n return this.restDef;\n }\n\n private checkIsTarget(\n node: IProductionWithOccurrence,\n expectedProdType: PROD_TYPE,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): boolean {\n if (\n node.idx === this.targetOccurrence &&\n this.targetProdType === expectedProdType\n ) {\n this.restDef = currRest.concat(prevRest);\n return true;\n }\n // performance optimization, do not iterate over the entire Grammar ast after we have found the target\n return false;\n }\n\n walkOption(\n optionProd: Option,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {\n super.walkOption(optionProd, currRest, prevRest);\n }\n }\n\n walkAtLeastOne(\n atLeastOneProd: RepetitionMandatory,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (\n !this.checkIsTarget(\n atLeastOneProd,\n PROD_TYPE.REPETITION_MANDATORY,\n currRest,\n prevRest,\n )\n ) {\n super.walkOption(atLeastOneProd, currRest, prevRest);\n }\n }\n\n walkAtLeastOneSep(\n atLeastOneSepProd: RepetitionMandatoryWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (\n !this.checkIsTarget(\n atLeastOneSepProd,\n PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,\n currRest,\n prevRest,\n )\n ) {\n super.walkOption(atLeastOneSepProd, currRest, prevRest);\n }\n }\n\n walkMany(\n manyProd: Repetition,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (\n !this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)\n ) {\n super.walkOption(manyProd, currRest, prevRest);\n }\n }\n\n walkManySep(\n manySepProd: RepetitionWithSeparator,\n currRest: IProduction[],\n prevRest: IProduction[],\n ): void {\n if (\n !this.checkIsTarget(\n manySepProd,\n PROD_TYPE.REPETITION_WITH_SEPARATOR,\n currRest,\n prevRest,\n )\n ) {\n super.walkOption(manySepProd, currRest, prevRest);\n }\n }\n}\n\n/**\n * Returns the definition of a target production in a top level level rule.\n */\nclass InsideDefinitionFinderVisitor extends GAstVisitor {\n public result: IProduction[] = [];\n\n constructor(\n private targetOccurrence: number,\n private targetProdType: PROD_TYPE,\n private targetRef?: any,\n ) {\n super();\n }\n\n private checkIsTarget(\n node: { definition: IProduction[] } & IProductionWithOccurrence,\n expectedProdName: PROD_TYPE,\n ): void {\n if (\n node.idx === this.targetOccurrence &&\n this.targetProdType === expectedProdName &&\n (this.targetRef === undefined || node === this.targetRef)\n ) {\n this.result = node.definition;\n }\n }\n\n public visitOption(node: Option): void {\n this.checkIsTarget(node, PROD_TYPE.OPTION);\n }\n\n public visitRepetition(node: Repetition): void {\n this.checkIsTarget(node, PROD_TYPE.REPETITION);\n }\n\n public visitRepetitionMandatory(node: RepetitionMandatory): void {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY);\n }\n\n public visitRepetitionMandatoryWithSeparator(\n node: RepetitionMandatoryWithSeparator,\n ): void {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR);\n }\n\n public visitRepetitionWithSeparator(node: RepetitionWithSeparator): void {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR);\n }\n\n public visitAlternation(node: Alternation): void {\n this.checkIsTarget(node, PROD_TYPE.ALTERNATION);\n }\n}\n\nfunction initializeArrayOfArrays(size: number): any[][] {\n const result = new Array(size);\n for (let i = 0; i < size; i++) {\n result[i] = [];\n }\n return result;\n}\n\n/**\n * A sort of hash function between a Path in the grammar and a string.\n * Note that this returns multiple \"hashes\" to support the scenario of token categories.\n * - A single path with categories may match multiple **actual** paths.\n */\nfunction pathToHashKeys(path: TokenType[]): string[] {\n let keys = [\"\"];\n for (let i = 0; i < path.length; i++) {\n const tokType = path[i];\n const longerKeys = [];\n for (let j = 0; j < keys.length; j++) {\n const currShorterKey = keys[j];\n longerKeys.push(currShorterKey + \"_\" + tokType.tokenTypeIdx);\n for (let t = 0; t < tokType.categoryMatches!.length; t++) {\n const categoriesKeySuffix = \"_\" + tokType.categoryMatches![t];\n longerKeys.push(currShorterKey + categoriesKeySuffix);\n }\n }\n keys = longerKeys;\n }\n return keys;\n}\n\n/**\n * Imperative style due to being called from a hot spot\n */\nfunction isUniquePrefixHash(\n altKnownPathsKeys: Record[],\n searchPathKeys: string[],\n idx: number,\n): boolean {\n for (\n let currAltIdx = 0;\n currAltIdx < altKnownPathsKeys.length;\n currAltIdx++\n ) {\n // We only want to test vs the other alternatives\n if (currAltIdx === idx) {\n continue;\n }\n const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx];\n for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {\n const searchKey = searchPathKeys[searchIdx];\n if (otherAltKnownPathsKeys[searchKey] === true) {\n return false;\n }\n }\n }\n // None of the SearchPathKeys were found in any of the other alternatives\n return true;\n}\n\nexport function lookAheadSequenceFromAlternatives(\n altsDefs: IProduction[],\n k: number,\n): LookaheadSequence[] {\n const partialAlts = map(altsDefs, (currAlt) =>\n possiblePathsFrom([currAlt], 1),\n );\n const finalResult = initializeArrayOfArrays(partialAlts.length);\n const altsHashes = map(partialAlts, (currAltPaths) => {\n const dict: { [key: string]: boolean } = {};\n forEach(currAltPaths, (item) => {\n const keys = pathToHashKeys(item.partialPath);\n forEach(keys, (currKey) => {\n dict[currKey] = true;\n });\n });\n return dict;\n });\n let newData = partialAlts;\n\n // maxLookahead loop\n for (let pathLength = 1; pathLength <= k; pathLength++) {\n const currDataset = newData;\n newData = initializeArrayOfArrays(currDataset.length);\n\n // alternatives loop\n for (let altIdx = 0; altIdx < currDataset.length; altIdx++) {\n const currAltPathsAndSuffixes = currDataset[altIdx];\n // paths in current alternative loop\n for (\n let currPathIdx = 0;\n currPathIdx < currAltPathsAndSuffixes.length;\n currPathIdx++\n ) {\n const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath;\n const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef;\n const prefixKeys = pathToHashKeys(currPathPrefix);\n const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx);\n // End of the line for this path.\n if (isUnique || isEmpty(suffixDef) || currPathPrefix.length === k) {\n const currAltResult = finalResult[altIdx];\n // TODO: Can we implement a containsPath using Maps/Dictionaries?\n if (containsPath(currAltResult, currPathPrefix) === false) {\n currAltResult.push(currPathPrefix);\n // Update all new keys for the current path.\n for (let j = 0; j < prefixKeys.length; j++) {\n const currKey = prefixKeys[j];\n altsHashes[altIdx][currKey] = true;\n }\n }\n }\n // Expand longer paths\n else {\n const newPartialPathsAndSuffixes = possiblePathsFrom(\n suffixDef,\n pathLength + 1,\n currPathPrefix,\n );\n newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes);\n\n // Update keys for new known paths\n forEach(newPartialPathsAndSuffixes, (item) => {\n const prefixKeys = pathToHashKeys(item.partialPath);\n forEach(prefixKeys, (key) => {\n altsHashes[altIdx][key] = true;\n });\n });\n }\n }\n }\n }\n\n return finalResult;\n}\n\nexport function getLookaheadPathsForOr(\n occurrence: number,\n ruleGrammar: Rule,\n k: number,\n orProd?: Alternation,\n): LookaheadSequence[] {\n const visitor = new InsideDefinitionFinderVisitor(\n occurrence,\n PROD_TYPE.ALTERNATION,\n orProd,\n );\n ruleGrammar.accept(visitor);\n return lookAheadSequenceFromAlternatives(visitor.result, k);\n}\n\nexport function getLookaheadPathsForOptionalProd(\n occurrence: number,\n ruleGrammar: Rule,\n prodType: PROD_TYPE,\n k: number,\n): LookaheadSequence[] {\n const insideDefVisitor = new InsideDefinitionFinderVisitor(\n occurrence,\n prodType,\n );\n ruleGrammar.accept(insideDefVisitor);\n const insideDef = insideDefVisitor.result;\n\n const afterDefWalker = new RestDefinitionFinderWalker(\n ruleGrammar,\n occurrence,\n prodType,\n );\n const afterDef = afterDefWalker.startWalking();\n\n const insideFlat = new AlternativeGAST({ definition: insideDef });\n const afterFlat = new AlternativeGAST({ definition: afterDef });\n\n return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k);\n}\n\nexport function containsPath(\n alternative: Alternative,\n searchPath: TokenType[],\n): boolean {\n compareOtherPath: for (let i = 0; i < alternative.length; i++) {\n const otherPath = alternative[i];\n if (otherPath.length !== searchPath.length) {\n continue;\n }\n for (let j = 0; j < otherPath.length; j++) {\n const searchTok = searchPath[j];\n const otherTok = otherPath[j];\n\n const matchingTokens =\n searchTok === otherTok ||\n otherTok.categoryMatchesMap![searchTok.tokenTypeIdx!] !== undefined;\n if (matchingTokens === false) {\n continue compareOtherPath;\n }\n }\n return true;\n }\n\n return false;\n}\n\nexport function isStrictPrefixOfPath(\n prefix: TokenType[],\n other: TokenType[],\n): boolean {\n return (\n prefix.length < other.length &&\n every(prefix, (tokType, idx) => {\n const otherTokType = other[idx];\n return (\n tokType === otherTokType ||\n otherTokType.categoryMatchesMap![tokType.tokenTypeIdx!]\n );\n })\n );\n}\n\nexport function areTokenCategoriesNotUsed(\n lookAheadPaths: LookaheadSequence[],\n): boolean {\n return every(lookAheadPaths, (singleAltPaths) =>\n every(singleAltPaths, (singlePath) =>\n every(singlePath, (token) => isEmpty(token.categoryMatches!)),\n ),\n );\n}\n", "import {\n clone,\n compact,\n difference,\n drop,\n dropRight,\n filter,\n first,\n flatMap,\n flatten,\n forEach,\n groupBy,\n includes,\n isEmpty,\n map,\n pickBy,\n reduce,\n reject,\n values,\n} from \"lodash-es\";\nimport {\n IParserAmbiguousAlternativesDefinitionError,\n IParserDuplicatesDefinitionError,\n IParserEmptyAlternativeDefinitionError,\n ParserDefinitionErrorType,\n} from \"../parser/parser.js\";\nimport {\n Alternation,\n Alternative as AlternativeGAST,\n GAstVisitor,\n getProductionDslName,\n isOptionalProd,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Terminal,\n} from \"@chevrotain/gast\";\nimport {\n Alternative,\n containsPath,\n getLookaheadPathsForOptionalProd,\n getLookaheadPathsForOr,\n getProdType,\n isStrictPrefixOfPath,\n} from \"./lookahead.js\";\nimport { nextPossibleTokensAfter } from \"./interpreter.js\";\nimport {\n ILookaheadStrategy,\n IProduction,\n IProductionWithOccurrence,\n Rule,\n TokenType,\n} from \"@chevrotain/types\";\nimport {\n IGrammarValidatorErrorMessageProvider,\n IParserDefinitionError,\n} from \"./types.js\";\nimport { tokenStructuredMatcher } from \"../../scan/tokens.js\";\n\nexport function validateLookahead(options: {\n lookaheadStrategy: ILookaheadStrategy;\n rules: Rule[];\n tokenTypes: TokenType[];\n grammarName: string;\n}): IParserDefinitionError[] {\n const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({\n rules: options.rules,\n tokenTypes: options.tokenTypes,\n grammarName: options.grammarName,\n });\n return map(lookaheadValidationErrorMessages, (errorMessage) => ({\n type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION,\n ...errorMessage,\n }));\n}\n\nexport function validateGrammar(\n topLevels: Rule[],\n tokenTypes: TokenType[],\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n grammarName: string,\n): IParserDefinitionError[] {\n const duplicateErrors: IParserDefinitionError[] = flatMap(\n topLevels,\n (currTopLevel) =>\n validateDuplicateProductions(currTopLevel, errMsgProvider),\n );\n\n const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(\n topLevels,\n tokenTypes,\n errMsgProvider,\n );\n\n const tooManyAltsErrors = flatMap(topLevels, (curRule) =>\n validateTooManyAlts(curRule, errMsgProvider),\n );\n\n const duplicateRulesError = flatMap(topLevels, (curRule) =>\n validateRuleDoesNotAlreadyExist(\n curRule,\n topLevels,\n grammarName,\n errMsgProvider,\n ),\n );\n\n return duplicateErrors.concat(\n termsNamespaceConflictErrors,\n tooManyAltsErrors,\n duplicateRulesError,\n );\n}\n\nfunction validateDuplicateProductions(\n topLevelRule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserDuplicatesDefinitionError[] {\n const collectorVisitor = new OccurrenceValidationCollector();\n topLevelRule.accept(collectorVisitor);\n const allRuleProductions = collectorVisitor.allProductions;\n\n const productionGroups = groupBy(\n allRuleProductions,\n identifyProductionForDuplicates,\n );\n\n const duplicates: any = pickBy(productionGroups, (currGroup) => {\n return currGroup.length > 1;\n });\n\n const errors = map(values(duplicates), (currDuplicates: any) => {\n const firstProd: any = first(currDuplicates);\n const msg = errMsgProvider.buildDuplicateFoundError(\n topLevelRule,\n currDuplicates,\n );\n const dslName = getProductionDslName(firstProd);\n const defError: IParserDuplicatesDefinitionError = {\n message: msg,\n type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,\n ruleName: topLevelRule.name,\n dslName: dslName,\n occurrence: firstProd.idx,\n };\n\n const param = getExtraProductionArgument(firstProd);\n if (param) {\n defError.parameter = param;\n }\n\n return defError;\n });\n return errors;\n}\n\nexport function identifyProductionForDuplicates(\n prod: IProductionWithOccurrence,\n): string {\n return `${getProductionDslName(prod)}_#_${\n prod.idx\n }_#_${getExtraProductionArgument(prod)}`;\n}\n\nfunction getExtraProductionArgument(prod: IProductionWithOccurrence): string {\n if (prod instanceof Terminal) {\n return prod.terminalType.name;\n } else if (prod instanceof NonTerminal) {\n return prod.nonTerminalName;\n } else {\n return \"\";\n }\n}\n\nexport class OccurrenceValidationCollector extends GAstVisitor {\n public allProductions: IProductionWithOccurrence[] = [];\n\n public visitNonTerminal(subrule: NonTerminal): void {\n this.allProductions.push(subrule);\n }\n\n public visitOption(option: Option): void {\n this.allProductions.push(option);\n }\n\n public visitRepetitionWithSeparator(manySep: RepetitionWithSeparator): void {\n this.allProductions.push(manySep);\n }\n\n public visitRepetitionMandatory(atLeastOne: RepetitionMandatory): void {\n this.allProductions.push(atLeastOne);\n }\n\n public visitRepetitionMandatoryWithSeparator(\n atLeastOneSep: RepetitionMandatoryWithSeparator,\n ): void {\n this.allProductions.push(atLeastOneSep);\n }\n\n public visitRepetition(many: Repetition): void {\n this.allProductions.push(many);\n }\n\n public visitAlternation(or: Alternation): void {\n this.allProductions.push(or);\n }\n\n public visitTerminal(terminal: Terminal): void {\n this.allProductions.push(terminal);\n }\n}\n\nexport function validateRuleDoesNotAlreadyExist(\n rule: Rule,\n allRules: Rule[],\n className: string,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserDefinitionError[] {\n const errors = [];\n const occurrences = reduce(\n allRules,\n (result, curRule) => {\n if (curRule.name === rule.name) {\n return result + 1;\n }\n return result;\n },\n 0,\n );\n if (occurrences > 1) {\n const errMsg = errMsgProvider.buildDuplicateRuleNameError({\n topLevelRule: rule,\n grammarName: className,\n });\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: rule.name,\n });\n }\n\n return errors;\n}\n\n// TODO: is there anyway to get only the rule names of rules inherited from the super grammars?\n// This is not part of the IGrammarErrorProvider because the validation cannot be performed on\n// The grammar structure, only at runtime.\nexport function validateRuleIsOverridden(\n ruleName: string,\n definedRulesNames: string[],\n className: string,\n): IParserDefinitionError[] {\n const errors = [];\n let errMsg;\n\n if (!includes(definedRulesNames, ruleName)) {\n errMsg =\n `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-` +\n `as it is not defined in any of the super grammars `;\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,\n ruleName: ruleName,\n });\n }\n\n return errors;\n}\n\nexport function validateNoLeftRecursion(\n topRule: Rule,\n currRule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n path: Rule[] = [],\n): IParserDefinitionError[] {\n const errors: IParserDefinitionError[] = [];\n const nextNonTerminals = getFirstNoneTerminal(currRule.definition);\n if (isEmpty(nextNonTerminals)) {\n return [];\n } else {\n const ruleName = topRule.name;\n const foundLeftRecursion = includes(nextNonTerminals, topRule);\n if (foundLeftRecursion) {\n errors.push({\n message: errMsgProvider.buildLeftRecursionError({\n topLevelRule: topRule,\n leftRecursionPath: path,\n }),\n type: ParserDefinitionErrorType.LEFT_RECURSION,\n ruleName: ruleName,\n });\n }\n\n // we are only looking for cyclic paths leading back to the specific topRule\n // other cyclic paths are ignored, we still need this difference to avoid infinite loops...\n const validNextSteps = difference(nextNonTerminals, path.concat([topRule]));\n const errorsFromNextSteps = flatMap(validNextSteps, (currRefRule) => {\n const newPath = clone(path);\n newPath.push(currRefRule);\n return validateNoLeftRecursion(\n topRule,\n currRefRule,\n errMsgProvider,\n newPath,\n );\n });\n\n return errors.concat(errorsFromNextSteps);\n }\n}\n\nexport function getFirstNoneTerminal(definition: IProduction[]): Rule[] {\n let result: Rule[] = [];\n if (isEmpty(definition)) {\n return result;\n }\n const firstProd = first(definition);\n\n /* istanbul ignore else */\n if (firstProd instanceof NonTerminal) {\n result.push(firstProd.referencedRule);\n } else if (\n firstProd instanceof AlternativeGAST ||\n firstProd instanceof Option ||\n firstProd instanceof RepetitionMandatory ||\n firstProd instanceof RepetitionMandatoryWithSeparator ||\n firstProd instanceof RepetitionWithSeparator ||\n firstProd instanceof Repetition\n ) {\n result = result.concat(\n getFirstNoneTerminal(firstProd.definition),\n );\n } else if (firstProd instanceof Alternation) {\n // each sub definition in alternation is a FLAT\n result = flatten(\n map(firstProd.definition, (currSubDef) =>\n getFirstNoneTerminal((currSubDef).definition),\n ),\n );\n } else if (firstProd instanceof Terminal) {\n // nothing to see, move along\n } else {\n throw Error(\"non exhaustive match\");\n }\n\n const isFirstOptional = isOptionalProd(firstProd);\n const hasMore = definition.length > 1;\n if (isFirstOptional && hasMore) {\n const rest = drop(definition);\n return result.concat(getFirstNoneTerminal(rest));\n } else {\n return result;\n }\n}\n\nclass OrCollector extends GAstVisitor {\n public alternations: Alternation[] = [];\n\n public visitAlternation(node: Alternation): void {\n this.alternations.push(node);\n }\n}\n\nexport function validateEmptyOrAlternative(\n topLevelRule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserEmptyAlternativeDefinitionError[] {\n const orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n const ors = orCollector.alternations;\n\n const errors = flatMap(\n ors,\n (currOr) => {\n const exceptLast = dropRight(currOr.definition);\n return flatMap(exceptLast, (currAlternative, currAltIdx) => {\n const possibleFirstInAlt = nextPossibleTokensAfter(\n [currAlternative],\n [],\n tokenStructuredMatcher,\n 1,\n );\n if (isEmpty(possibleFirstInAlt)) {\n return [\n {\n message: errMsgProvider.buildEmptyAlternationError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n emptyChoiceIdx: currAltIdx,\n }),\n type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n alternative: currAltIdx + 1,\n },\n ];\n } else {\n return [];\n }\n });\n },\n );\n\n return errors;\n}\n\nexport function validateAmbiguousAlternationAlternatives(\n topLevelRule: Rule,\n globalMaxLookahead: number,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserAmbiguousAlternativesDefinitionError[] {\n const orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n let ors = orCollector.alternations;\n\n // New Handling of ignoring ambiguities\n // - https://github.com/chevrotain/chevrotain/issues/869\n ors = reject(ors, (currOr) => currOr.ignoreAmbiguities === true);\n\n const errors = flatMap(ors, (currOr: Alternation) => {\n const currOccurrence = currOr.idx;\n const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead;\n const alternatives = getLookaheadPathsForOr(\n currOccurrence,\n topLevelRule,\n actualMaxLookahead,\n currOr,\n );\n const altsAmbiguityErrors = checkAlternativesAmbiguities(\n alternatives,\n currOr,\n topLevelRule,\n errMsgProvider,\n );\n const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(\n alternatives,\n currOr,\n topLevelRule,\n errMsgProvider,\n );\n\n return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors);\n });\n\n return errors;\n}\n\nexport class RepetitionCollector extends GAstVisitor {\n public allProductions: (IProductionWithOccurrence & {\n maxLookahead?: number;\n })[] = [];\n\n public visitRepetitionWithSeparator(manySep: RepetitionWithSeparator): void {\n this.allProductions.push(manySep);\n }\n\n public visitRepetitionMandatory(atLeastOne: RepetitionMandatory): void {\n this.allProductions.push(atLeastOne);\n }\n\n public visitRepetitionMandatoryWithSeparator(\n atLeastOneSep: RepetitionMandatoryWithSeparator,\n ): void {\n this.allProductions.push(atLeastOneSep);\n }\n\n public visitRepetition(many: Repetition): void {\n this.allProductions.push(many);\n }\n}\n\nexport function validateTooManyAlts(\n topLevelRule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserDefinitionError[] {\n const orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n const ors = orCollector.alternations;\n\n const errors = flatMap(ors, (currOr) => {\n if (currOr.definition.length > 255) {\n return [\n {\n message: errMsgProvider.buildTooManyAlternativesError({\n topLevelRule: topLevelRule,\n alternation: currOr,\n }),\n type: ParserDefinitionErrorType.TOO_MANY_ALTS,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n },\n ];\n } else {\n return [];\n }\n });\n\n return errors;\n}\n\nexport function validateSomeNonEmptyLookaheadPath(\n topLevelRules: Rule[],\n maxLookahead: number,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserDefinitionError[] {\n const errors: IParserDefinitionError[] = [];\n forEach(topLevelRules, (currTopRule) => {\n const collectorVisitor = new RepetitionCollector();\n currTopRule.accept(collectorVisitor);\n const allRuleProductions = collectorVisitor.allProductions;\n forEach(allRuleProductions, (currProd) => {\n const prodType = getProdType(currProd);\n const actualMaxLookahead = currProd.maxLookahead || maxLookahead;\n const currOccurrence = currProd.idx;\n const paths = getLookaheadPathsForOptionalProd(\n currOccurrence,\n currTopRule,\n prodType,\n actualMaxLookahead,\n );\n const pathsInsideProduction = paths[0];\n if (isEmpty(flatten(pathsInsideProduction))) {\n const errMsg = errMsgProvider.buildEmptyRepetitionError({\n topLevelRule: currTopRule,\n repetition: currProd,\n });\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,\n ruleName: currTopRule.name,\n });\n }\n });\n });\n\n return errors;\n}\n\nexport interface IAmbiguityDescriptor {\n alts: number[];\n path: TokenType[];\n}\n\nfunction checkAlternativesAmbiguities(\n alternatives: Alternative[],\n alternation: Alternation,\n rule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserAmbiguousAlternativesDefinitionError[] {\n const foundAmbiguousPaths: Alternative = [];\n const identicalAmbiguities = reduce(\n alternatives,\n (result, currAlt, currAltIdx) => {\n // ignore (skip) ambiguities with this alternative\n if (alternation.definition[currAltIdx].ignoreAmbiguities === true) {\n return result;\n }\n\n forEach(currAlt, (currPath) => {\n const altsCurrPathAppearsIn = [currAltIdx];\n forEach(alternatives, (currOtherAlt, currOtherAltIdx) => {\n if (\n currAltIdx !== currOtherAltIdx &&\n containsPath(currOtherAlt, currPath) &&\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[currOtherAltIdx].ignoreAmbiguities !== true\n ) {\n altsCurrPathAppearsIn.push(currOtherAltIdx);\n }\n });\n\n if (\n altsCurrPathAppearsIn.length > 1 &&\n !containsPath(foundAmbiguousPaths, currPath)\n ) {\n foundAmbiguousPaths.push(currPath);\n result.push({\n alts: altsCurrPathAppearsIn,\n path: currPath,\n });\n }\n });\n return result;\n },\n [] as { alts: number[]; path: TokenType[] }[],\n );\n\n const currErrors = map(identicalAmbiguities, (currAmbDescriptor) => {\n const ambgIndices = map(\n currAmbDescriptor.alts,\n (currAltIdx) => currAltIdx + 1,\n );\n\n const currMessage = errMsgProvider.buildAlternationAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbDescriptor.path,\n });\n\n return {\n message: currMessage,\n type: ParserDefinitionErrorType.AMBIGUOUS_ALTS,\n ruleName: rule.name,\n occurrence: alternation.idx,\n alternatives: currAmbDescriptor.alts,\n };\n });\n\n return currErrors;\n}\n\nexport function checkPrefixAlternativesAmbiguities(\n alternatives: Alternative[],\n alternation: Alternation,\n rule: Rule,\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserAmbiguousAlternativesDefinitionError[] {\n // flatten\n const pathsAndIndices = reduce(\n alternatives,\n (result, currAlt, idx) => {\n const currPathsAndIdx = map(currAlt, (currPath) => {\n return { idx: idx, path: currPath };\n });\n return result.concat(currPathsAndIdx);\n },\n [] as { idx: number; path: TokenType[] }[],\n );\n\n const errors = compact(\n flatMap(pathsAndIndices, (currPathAndIdx) => {\n const alternativeGast = alternation.definition[currPathAndIdx.idx];\n // ignore (skip) ambiguities with this alternative\n if (alternativeGast.ignoreAmbiguities === true) {\n return [];\n }\n const targetIdx = currPathAndIdx.idx;\n const targetPath = currPathAndIdx.path;\n\n const prefixAmbiguitiesPathsAndIndices = filter(\n pathsAndIndices,\n (searchPathAndIdx) => {\n // prefix ambiguity can only be created from lower idx (higher priority) path\n return (\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[searchPathAndIdx.idx].ignoreAmbiguities !==\n true &&\n searchPathAndIdx.idx < targetIdx &&\n // checking for strict prefix because identical lookaheads\n // will be be detected using a different validation.\n isStrictPrefixOfPath(searchPathAndIdx.path, targetPath)\n );\n },\n );\n\n const currPathPrefixErrors = map(\n prefixAmbiguitiesPathsAndIndices,\n (currAmbPathAndIdx): IParserAmbiguousAlternativesDefinitionError => {\n const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1];\n const occurrence = alternation.idx === 0 ? \"\" : alternation.idx;\n\n const message = errMsgProvider.buildAlternationPrefixAmbiguityError({\n topLevelRule: rule,\n alternation: alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbPathAndIdx.path,\n });\n return {\n message: message,\n type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,\n ruleName: rule.name,\n occurrence: occurrence,\n alternatives: ambgIndices,\n };\n },\n );\n\n return currPathPrefixErrors;\n }),\n );\n\n return errors;\n}\n\nfunction checkTerminalAndNoneTerminalsNameSpace(\n topLevels: Rule[],\n tokenTypes: TokenType[],\n errMsgProvider: IGrammarValidatorErrorMessageProvider,\n): IParserDefinitionError[] {\n const errors: IParserDefinitionError[] = [];\n\n const tokenNames = map(tokenTypes, (currToken) => currToken.name);\n\n forEach(topLevels, (currRule) => {\n const currRuleName = currRule.name;\n if (includes(tokenNames, currRuleName)) {\n const errMsg = errMsgProvider.buildNamespaceConflictError(currRule);\n\n errors.push({\n message: errMsg,\n type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,\n ruleName: currRuleName,\n });\n }\n });\n\n return errors;\n}\n", "import { Rule } from \"@chevrotain/gast\";\nimport { defaults, forEach } from \"lodash-es\";\nimport { resolveGrammar as orgResolveGrammar } from \"../resolver.js\";\nimport { validateGrammar as orgValidateGrammar } from \"../checks.js\";\nimport {\n defaultGrammarResolverErrorProvider,\n defaultGrammarValidatorErrorProvider,\n} from \"../../errors_public.js\";\nimport { TokenType } from \"@chevrotain/types\";\nimport {\n IGrammarResolverErrorMessageProvider,\n IGrammarValidatorErrorMessageProvider,\n IParserDefinitionError,\n} from \"../types.js\";\n\ntype ResolveGrammarOpts = {\n rules: Rule[];\n errMsgProvider?: IGrammarResolverErrorMessageProvider;\n};\nexport function resolveGrammar(\n options: ResolveGrammarOpts,\n): IParserDefinitionError[] {\n const actualOptions: Required = defaults(options, {\n errMsgProvider: defaultGrammarResolverErrorProvider,\n });\n\n const topRulesTable: { [ruleName: string]: Rule } = {};\n forEach(options.rules, (rule) => {\n topRulesTable[rule.name] = rule;\n });\n return orgResolveGrammar(topRulesTable, actualOptions.errMsgProvider);\n}\n\nexport function validateGrammar(options: {\n rules: Rule[];\n tokenTypes: TokenType[];\n grammarName: string;\n errMsgProvider: IGrammarValidatorErrorMessageProvider;\n}): IParserDefinitionError[] {\n options = defaults(options, {\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n });\n\n return orgValidateGrammar(\n options.rules,\n options.tokenTypes,\n options.errMsgProvider,\n options.grammarName,\n );\n}\n", "import { includes } from \"lodash-es\";\nimport {\n IRecognitionException,\n IRecognizerContext,\n IToken,\n} from \"@chevrotain/types\";\n\nconst MISMATCHED_TOKEN_EXCEPTION = \"MismatchedTokenException\";\nconst NO_VIABLE_ALT_EXCEPTION = \"NoViableAltException\";\nconst EARLY_EXIT_EXCEPTION = \"EarlyExitException\";\nconst NOT_ALL_INPUT_PARSED_EXCEPTION = \"NotAllInputParsedException\";\n\nconst RECOGNITION_EXCEPTION_NAMES = [\n MISMATCHED_TOKEN_EXCEPTION,\n NO_VIABLE_ALT_EXCEPTION,\n EARLY_EXIT_EXCEPTION,\n NOT_ALL_INPUT_PARSED_EXCEPTION,\n];\n\nObject.freeze(RECOGNITION_EXCEPTION_NAMES);\n\n// hacks to bypass no support for custom Errors in javascript/typescript\nexport function isRecognitionException(error: Error) {\n // can't do instanceof on hacked custom js exceptions\n return includes(RECOGNITION_EXCEPTION_NAMES, error.name);\n}\n\nabstract class RecognitionException\n extends Error\n implements IRecognitionException\n{\n context: IRecognizerContext;\n resyncedTokens: IToken[] = [];\n\n protected constructor(\n message: string,\n public token: IToken,\n ) {\n super(message);\n\n // fix prototype chain when typescript target is ES5\n Object.setPrototypeOf(this, new.target.prototype);\n\n /* istanbul ignore next - V8 workaround to remove constructor from stacktrace when typescript target is ES5 */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\nexport class MismatchedTokenException extends RecognitionException {\n constructor(\n message: string,\n token: IToken,\n public previousToken: IToken,\n ) {\n super(message, token);\n this.name = MISMATCHED_TOKEN_EXCEPTION;\n }\n}\n\nexport class NoViableAltException extends RecognitionException {\n constructor(\n message: string,\n token: IToken,\n public previousToken: IToken,\n ) {\n super(message, token);\n this.name = NO_VIABLE_ALT_EXCEPTION;\n }\n}\n\nexport class NotAllInputParsedException extends RecognitionException {\n constructor(message: string, token: IToken) {\n super(message, token);\n this.name = NOT_ALL_INPUT_PARSED_EXCEPTION;\n }\n}\n\nexport class EarlyExitException extends RecognitionException {\n constructor(\n message: string,\n token: IToken,\n public previousToken: IToken,\n ) {\n super(message, token);\n this.name = EARLY_EXIT_EXCEPTION;\n }\n}\n", "import {\n createTokenInstance,\n EOF,\n tokenMatcher,\n} from \"../../../scan/tokens_public.js\";\nimport {\n AbstractNextTerminalAfterProductionWalker,\n IFirstAfterRepetition,\n} from \"../../grammar/interpreter.js\";\nimport {\n clone,\n dropRight,\n find,\n flatten,\n has,\n includes,\n isEmpty,\n map,\n} from \"lodash-es\";\nimport {\n IParserConfig,\n IToken,\n ITokenGrammarPath,\n TokenType,\n} from \"@chevrotain/types\";\nimport { MismatchedTokenException } from \"../../exceptions_public.js\";\nimport { IN } from \"../../constants.js\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser.js\";\n\nexport const EOF_FOLLOW_KEY: any = {};\n\nexport interface IFollowKey {\n ruleName: string;\n idxInCallingRule: number;\n inRule: string;\n}\n\nexport const IN_RULE_RECOVERY_EXCEPTION = \"InRuleRecoveryException\";\n\nexport class InRuleRecoveryException extends Error {\n constructor(message: string) {\n super(message);\n this.name = IN_RULE_RECOVERY_EXCEPTION;\n }\n}\n\n/**\n * This trait is responsible for the error recovery and fault tolerant logic\n */\nexport class Recoverable {\n recoveryEnabled: boolean;\n firstAfterRepMap: Record;\n resyncFollows: Record;\n\n initRecoverable(config: IParserConfig) {\n this.firstAfterRepMap = {};\n this.resyncFollows = {};\n\n this.recoveryEnabled = has(config, \"recoveryEnabled\")\n ? (config.recoveryEnabled as boolean) // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.recoveryEnabled;\n\n // performance optimization, NOOP will be inlined which\n // effectively means that this optional feature does not exist\n // when not used.\n if (this.recoveryEnabled) {\n this.attemptInRepetitionRecovery = attemptInRepetitionRecovery;\n }\n }\n\n public getTokenToInsert(tokType: TokenType): IToken {\n const tokToInsert = createTokenInstance(\n tokType,\n \"\",\n NaN,\n NaN,\n NaN,\n NaN,\n NaN,\n NaN,\n );\n tokToInsert.isInsertedInRecovery = true;\n return tokToInsert;\n }\n\n public canTokenTypeBeInsertedInRecovery(tokType: TokenType): boolean {\n return true;\n }\n\n public canTokenTypeBeDeletedInRecovery(tokType: TokenType): boolean {\n return true;\n }\n\n tryInRepetitionRecovery(\n this: MixedInParser,\n grammarRule: Function,\n grammarRuleArgs: any[],\n lookAheadFunc: () => boolean,\n expectedTokType: TokenType,\n ): void {\n // TODO: can the resyncTokenType be cached?\n const reSyncTokType = this.findReSyncTokenType();\n const savedLexerState = this.exportLexerState();\n const resyncedTokens: IToken[] = [];\n let passedResyncPoint = false;\n\n const nextTokenWithoutResync = this.LA(1);\n let currToken = this.LA(1);\n\n const generateErrorMessage = () => {\n const previousToken = this.LA(0);\n // we are preemptively re-syncing before an error has been detected, therefor we must reproduce\n // the error that would have been thrown\n const msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: expectedTokType,\n actual: nextTokenWithoutResync,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n });\n const error = new MismatchedTokenException(\n msg,\n nextTokenWithoutResync,\n this.LA(0),\n );\n // the first token here will be the original cause of the error, this is not part of the resyncedTokens property.\n error.resyncedTokens = dropRight(resyncedTokens);\n this.SAVE_ERROR(error);\n };\n\n while (!passedResyncPoint) {\n // re-synced to a point where we can safely exit the repetition/\n if (this.tokenMatcher(currToken, expectedTokType)) {\n generateErrorMessage();\n return; // must return here to avoid reverting the inputIdx\n } else if (lookAheadFunc.call(this)) {\n // we skipped enough tokens so we can resync right back into another iteration of the repetition grammar rule\n generateErrorMessage();\n // recursive invocation in other to support multiple re-syncs in the same top level repetition grammar rule\n grammarRule.apply(this, grammarRuleArgs);\n return; // must return here to avoid reverting the inputIdx\n } else if (this.tokenMatcher(currToken, reSyncTokType)) {\n passedResyncPoint = true;\n } else {\n currToken = this.SKIP_TOKEN();\n this.addToResyncTokens(currToken, resyncedTokens);\n }\n }\n\n // we were unable to find a CLOSER point to resync inside the Repetition, reset the state.\n // The parsing exception we were trying to prevent will happen in the NEXT parsing step. it may be handled by\n // \"between rules\" resync recovery later in the flow.\n this.importLexerState(savedLexerState);\n }\n\n shouldInRepetitionRecoveryBeTried(\n this: MixedInParser,\n expectTokAfterLastMatch: TokenType,\n nextTokIdx: number,\n notStuck: boolean | undefined,\n ): boolean {\n // Edge case of arriving from a MANY repetition which is stuck\n // Attempting recovery in this case could cause an infinite loop\n if (notStuck === false) {\n return false;\n }\n\n // no need to recover, next token is what we expect...\n if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {\n return false;\n }\n\n // error recovery is disabled during backtracking as it can make the parser ignore a valid grammar path\n // and prefer some backtracking path that includes recovered errors.\n if (this.isBackTracking()) {\n return false;\n }\n\n // if we can perform inRule recovery (single token insertion or deletion) we always prefer that recovery algorithm\n // because if it works, it makes the least amount of changes to the input stream (greedy algorithm)\n //noinspection RedundantIfStatementJS\n if (\n this.canPerformInRuleRecovery(\n expectTokAfterLastMatch,\n this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx),\n )\n ) {\n return false;\n }\n\n return true;\n }\n\n // Error Recovery functionality\n getFollowsForInRuleRecovery(\n this: MixedInParser,\n tokType: TokenType,\n tokIdxInRule: number,\n ): TokenType[] {\n const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule);\n const follows = this.getNextPossibleTokenTypes(grammarPath);\n return follows;\n }\n\n tryInRuleRecovery(\n this: MixedInParser,\n expectedTokType: TokenType,\n follows: TokenType[],\n ): IToken {\n if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {\n const tokToInsert = this.getTokenToInsert(expectedTokType);\n return tokToInsert;\n }\n\n if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {\n const nextTok = this.SKIP_TOKEN();\n this.consumeToken();\n return nextTok;\n }\n\n throw new InRuleRecoveryException(\"sad sad panda\");\n }\n\n canPerformInRuleRecovery(\n this: MixedInParser,\n expectedToken: TokenType,\n follows: TokenType[],\n ): boolean {\n return (\n this.canRecoverWithSingleTokenInsertion(expectedToken, follows) ||\n this.canRecoverWithSingleTokenDeletion(expectedToken)\n );\n }\n\n canRecoverWithSingleTokenInsertion(\n this: MixedInParser,\n expectedTokType: TokenType,\n follows: TokenType[],\n ): boolean {\n if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {\n return false;\n }\n\n // must know the possible following tokens to perform single token insertion\n if (isEmpty(follows)) {\n return false;\n }\n\n const mismatchedTok = this.LA(1);\n const isMisMatchedTokInFollows =\n find(follows, (possibleFollowsTokType: TokenType) => {\n return this.tokenMatcher(mismatchedTok, possibleFollowsTokType);\n }) !== undefined;\n\n return isMisMatchedTokInFollows;\n }\n\n canRecoverWithSingleTokenDeletion(\n this: MixedInParser,\n expectedTokType: TokenType,\n ): boolean {\n if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {\n return false;\n }\n\n const isNextTokenWhatIsExpected = this.tokenMatcher(\n this.LA(2),\n expectedTokType,\n );\n return isNextTokenWhatIsExpected;\n }\n\n isInCurrentRuleReSyncSet(\n this: MixedInParser,\n tokenTypeIdx: TokenType,\n ): boolean {\n const followKey = this.getCurrFollowKey();\n const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey);\n return includes(currentRuleReSyncSet, tokenTypeIdx);\n }\n\n findReSyncTokenType(this: MixedInParser): TokenType {\n const allPossibleReSyncTokTypes = this.flattenFollowSet();\n // this loop will always terminate as EOF is always in the follow stack and also always (virtually) in the input\n let nextToken = this.LA(1);\n let k = 2;\n while (true) {\n const foundMatch = find(allPossibleReSyncTokTypes, (resyncTokType) => {\n const canMatch = tokenMatcher(nextToken, resyncTokType);\n return canMatch;\n });\n if (foundMatch !== undefined) {\n return foundMatch;\n }\n nextToken = this.LA(k);\n k++;\n }\n }\n\n getCurrFollowKey(this: MixedInParser): IFollowKey {\n // the length is at least one as we always add the ruleName to the stack before invoking the rule.\n if (this.RULE_STACK.length === 1) {\n return EOF_FOLLOW_KEY;\n }\n const currRuleShortName = this.getLastExplicitRuleShortName();\n const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex();\n const prevRuleShortName = this.getPreviousExplicitRuleShortName();\n\n return {\n ruleName: this.shortRuleNameToFullName(currRuleShortName),\n idxInCallingRule: currRuleIdx,\n inRule: this.shortRuleNameToFullName(prevRuleShortName),\n };\n }\n\n buildFullFollowKeyStack(this: MixedInParser): IFollowKey[] {\n const explicitRuleStack = this.RULE_STACK;\n const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK;\n\n return map(explicitRuleStack, (ruleName, idx) => {\n if (idx === 0) {\n return EOF_FOLLOW_KEY;\n }\n return {\n ruleName: this.shortRuleNameToFullName(ruleName),\n idxInCallingRule: explicitOccurrenceStack[idx],\n inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]),\n };\n });\n }\n\n flattenFollowSet(this: MixedInParser): TokenType[] {\n const followStack = map(this.buildFullFollowKeyStack(), (currKey) => {\n return this.getFollowSetFromFollowKey(currKey);\n });\n return flatten(followStack);\n }\n\n getFollowSetFromFollowKey(\n this: MixedInParser,\n followKey: IFollowKey,\n ): TokenType[] {\n if (followKey === EOF_FOLLOW_KEY) {\n return [EOF];\n }\n\n const followName =\n followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule;\n\n return this.resyncFollows[followName];\n }\n\n // It does not make any sense to include a virtual EOF token in the list of resynced tokens\n // as EOF does not really exist and thus does not contain any useful information (line/column numbers)\n addToResyncTokens(\n this: MixedInParser,\n token: IToken,\n resyncTokens: IToken[],\n ): IToken[] {\n if (!this.tokenMatcher(token, EOF)) {\n resyncTokens.push(token);\n }\n return resyncTokens;\n }\n\n reSyncTo(this: MixedInParser, tokType: TokenType): IToken[] {\n const resyncedTokens: IToken[] = [];\n let nextTok = this.LA(1);\n while (this.tokenMatcher(nextTok, tokType) === false) {\n nextTok = this.SKIP_TOKEN();\n this.addToResyncTokens(nextTok, resyncedTokens);\n }\n // the last token is not part of the error.\n return dropRight(resyncedTokens);\n }\n\n attemptInRepetitionRecovery(\n this: MixedInParser,\n prodFunc: Function,\n args: any[],\n lookaheadFunc: () => boolean,\n dslMethodIdx: number,\n prodOccurrence: number,\n nextToksWalker: typeof AbstractNextTerminalAfterProductionWalker,\n notStuck?: boolean,\n ): void {\n // by default this is a NO-OP\n // The actual implementation is with the function(not method) below\n }\n\n getCurrentGrammarPath(\n this: MixedInParser,\n tokType: TokenType,\n tokIdxInRule: number,\n ): ITokenGrammarPath {\n const pathRuleStack: string[] = this.getHumanReadableRuleStack();\n const pathOccurrenceStack: number[] = clone(this.RULE_OCCURRENCE_STACK);\n const grammarPath: any = {\n ruleStack: pathRuleStack,\n occurrenceStack: pathOccurrenceStack,\n lastTok: tokType,\n lastTokOccurrence: tokIdxInRule,\n };\n\n return grammarPath;\n }\n getHumanReadableRuleStack(this: MixedInParser): string[] {\n return map(this.RULE_STACK, (currShortName) =>\n this.shortRuleNameToFullName(currShortName),\n );\n }\n}\n\nexport function attemptInRepetitionRecovery(\n this: MixedInParser,\n prodFunc: Function,\n args: any[],\n lookaheadFunc: () => boolean,\n dslMethodIdx: number,\n prodOccurrence: number,\n nextToksWalker: typeof AbstractNextTerminalAfterProductionWalker,\n notStuck?: boolean,\n): void {\n const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence);\n let firstAfterRepInfo = this.firstAfterRepMap[key];\n if (firstAfterRepInfo === undefined) {\n const currRuleName = this.getCurrRuleFullName();\n const ruleGrammar = this.getGAstProductions()[currRuleName];\n const walker: AbstractNextTerminalAfterProductionWalker =\n new nextToksWalker(ruleGrammar, prodOccurrence);\n firstAfterRepInfo = walker.startWalking();\n this.firstAfterRepMap[key] = firstAfterRepInfo;\n }\n\n let expectTokAfterLastMatch = firstAfterRepInfo.token;\n let nextTokIdx = firstAfterRepInfo.occurrence;\n const isEndOfRule = firstAfterRepInfo.isEndOfRule;\n\n // special edge case of a TOP most repetition after which the input should END.\n // this will force an attempt for inRule recovery in that scenario.\n if (\n this.RULE_STACK.length === 1 &&\n isEndOfRule &&\n expectTokAfterLastMatch === undefined\n ) {\n expectTokAfterLastMatch = EOF;\n nextTokIdx = 1;\n }\n\n // We don't have anything to re-sync to...\n // this condition was extracted from `shouldInRepetitionRecoveryBeTried` to act as a type-guard\n if (expectTokAfterLastMatch === undefined || nextTokIdx === undefined) {\n return;\n }\n\n if (\n this.shouldInRepetitionRecoveryBeTried(\n expectTokAfterLastMatch,\n nextTokIdx,\n notStuck,\n )\n ) {\n // TODO: performance optimization: instead of passing the original args here, we modify\n // the args param (or create a new one) and make sure the lookahead func is explicitly provided\n // to avoid searching the cache for it once more.\n this.tryInRepetitionRecovery(\n prodFunc,\n args,\n lookaheadFunc,\n expectTokAfterLastMatch,\n );\n }\n}\n", "// Lookahead keys are 32Bit integers in the form\n// TTTTTTTT-ZZZZZZZZZZZZ-YYYY-XXXXXXXX\n// XXXX -> Occurrence Index bitmap.\n// YYYY -> DSL Method Type bitmap.\n// ZZZZZZZZZZZZZZZ -> Rule short Index bitmap.\n// TTTTTTTTT -> alternation alternative index bitmap\n\nexport const BITS_FOR_METHOD_TYPE = 4;\nexport const BITS_FOR_OCCURRENCE_IDX = 8;\nexport const BITS_FOR_RULE_IDX = 12;\n// TODO: validation, this means that there may at most 2^8 --> 256 alternatives for an alternation.\nexport const BITS_FOR_ALT_IDX = 8;\n\n// short string used as part of mapping keys.\n// being short improves the performance when composing KEYS for maps out of these\n// The 5 - 8 bits (16 possible values, are reserved for the DSL method indices)\nexport const OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX;\nexport const OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX;\nexport const MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX;\nexport const AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX;\nexport const MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX;\nexport const AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX;\n\n// this actually returns a number, but it is always used as a string (object prop key)\nexport function getKeyForAutomaticLookahead(\n ruleIdx: number,\n dslMethodIdx: number,\n occurrence: number,\n): number {\n return occurrence | dslMethodIdx | ruleIdx;\n}\n\nconst BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;\n", "import {\n ILookaheadStrategy,\n ILookaheadValidationError,\n IOrAlt,\n OptionalProductionType,\n Rule,\n TokenType,\n} from \"@chevrotain/types\";\nimport { flatMap, isEmpty } from \"lodash-es\";\nimport { defaultGrammarValidatorErrorProvider } from \"../errors_public.js\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser/parser.js\";\nimport {\n validateAmbiguousAlternationAlternatives,\n validateEmptyOrAlternative,\n validateNoLeftRecursion,\n validateSomeNonEmptyLookaheadPath,\n} from \"./checks.js\";\nimport {\n buildAlternativesLookAheadFunc,\n buildLookaheadFuncForOptionalProd,\n buildLookaheadFuncForOr,\n buildSingleAlternativeLookaheadFunction,\n getProdType,\n} from \"./lookahead.js\";\nimport { IParserDefinitionError } from \"./types.js\";\n\nexport class LLkLookaheadStrategy implements ILookaheadStrategy {\n readonly maxLookahead: number;\n\n constructor(options?: { maxLookahead?: number }) {\n this.maxLookahead =\n options?.maxLookahead ?? DEFAULT_PARSER_CONFIG.maxLookahead;\n }\n\n validate(options: {\n rules: Rule[];\n tokenTypes: TokenType[];\n grammarName: string;\n }): ILookaheadValidationError[] {\n const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);\n\n if (isEmpty(leftRecursionErrors)) {\n const emptyAltErrors = this.validateEmptyOrAlternatives(options.rules);\n const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(\n options.rules,\n this.maxLookahead,\n );\n const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(\n options.rules,\n this.maxLookahead,\n );\n const allErrors = [\n ...leftRecursionErrors,\n ...emptyAltErrors,\n ...ambiguousAltsErrors,\n ...emptyRepetitionErrors,\n ];\n return allErrors;\n }\n return leftRecursionErrors;\n }\n\n validateNoLeftRecursion(rules: Rule[]): IParserDefinitionError[] {\n return flatMap(rules, (currTopRule) =>\n validateNoLeftRecursion(\n currTopRule,\n currTopRule,\n defaultGrammarValidatorErrorProvider,\n ),\n );\n }\n\n validateEmptyOrAlternatives(rules: Rule[]): IParserDefinitionError[] {\n return flatMap(rules, (currTopRule) =>\n validateEmptyOrAlternative(\n currTopRule,\n defaultGrammarValidatorErrorProvider,\n ),\n );\n }\n\n validateAmbiguousAlternationAlternatives(\n rules: Rule[],\n maxLookahead: number,\n ): IParserDefinitionError[] {\n return flatMap(rules, (currTopRule) =>\n validateAmbiguousAlternationAlternatives(\n currTopRule,\n maxLookahead,\n defaultGrammarValidatorErrorProvider,\n ),\n );\n }\n\n validateSomeNonEmptyLookaheadPath(\n rules: Rule[],\n maxLookahead: number,\n ): IParserDefinitionError[] {\n return validateSomeNonEmptyLookaheadPath(\n rules,\n maxLookahead,\n defaultGrammarValidatorErrorProvider,\n );\n }\n\n buildLookaheadForAlternation(options: {\n prodOccurrence: number;\n rule: Rule;\n maxLookahead: number;\n hasPredicates: boolean;\n dynamicTokensEnabled: boolean;\n }): (orAlts?: IOrAlt[] | undefined) => number | undefined {\n return buildLookaheadFuncForOr(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.hasPredicates,\n options.dynamicTokensEnabled,\n buildAlternativesLookAheadFunc,\n );\n }\n\n buildLookaheadForOptional(options: {\n prodOccurrence: number;\n prodType: OptionalProductionType;\n rule: Rule;\n maxLookahead: number;\n dynamicTokensEnabled: boolean;\n }): () => boolean {\n return buildLookaheadFuncForOptionalProd(\n options.prodOccurrence,\n options.rule,\n options.maxLookahead,\n options.dynamicTokensEnabled,\n getProdType(options.prodType),\n buildSingleAlternativeLookaheadFunction,\n );\n }\n}\n", "import { forEach, has } from \"lodash-es\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser.js\";\nimport {\n ILookaheadStrategy,\n IParserConfig,\n OptionalProductionType,\n} from \"@chevrotain/types\";\nimport {\n AT_LEAST_ONE_IDX,\n AT_LEAST_ONE_SEP_IDX,\n getKeyForAutomaticLookahead,\n MANY_IDX,\n MANY_SEP_IDX,\n OPTION_IDX,\n OR_IDX,\n} from \"../../grammar/keys.js\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport {\n Alternation,\n GAstVisitor,\n getProductionDslName,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Rule,\n} from \"@chevrotain/gast\";\nimport { LLkLookaheadStrategy } from \"../../grammar/llk_lookahead.js\";\n\n/**\n * Trait responsible for the lookahead related utilities and optimizations.\n */\nexport class LooksAhead {\n maxLookahead: number;\n lookAheadFuncsCache: any;\n dynamicTokensEnabled: boolean;\n lookaheadStrategy: ILookaheadStrategy;\n\n initLooksAhead(config: IParserConfig) {\n this.dynamicTokensEnabled = has(config, \"dynamicTokensEnabled\")\n ? (config.dynamicTokensEnabled as boolean) // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;\n\n this.maxLookahead = has(config, \"maxLookahead\")\n ? (config.maxLookahead as number) // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.maxLookahead;\n\n this.lookaheadStrategy = has(config, \"lookaheadStrategy\")\n ? (config.lookaheadStrategy as ILookaheadStrategy) // assumes end user provides the correct config value/type\n : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead });\n\n this.lookAheadFuncsCache = new Map();\n }\n\n preComputeLookaheadFunctions(this: MixedInParser, rules: Rule[]): void {\n forEach(rules, (currRule) => {\n this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => {\n const {\n alternation,\n repetition,\n option,\n repetitionMandatory,\n repetitionMandatoryWithSeparator,\n repetitionWithSeparator,\n } = collectMethods(currRule);\n\n forEach(alternation, (currProd) => {\n const prodIdx = currProd.idx === 0 ? \"\" : currProd.idx;\n this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({\n prodOccurrence: currProd.idx,\n rule: currRule,\n maxLookahead: currProd.maxLookahead || this.maxLookahead,\n hasPredicates: currProd.hasPredicates,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n });\n\n const key = getKeyForAutomaticLookahead(\n this.fullRuleNameToShort[currRule.name],\n OR_IDX,\n currProd.idx,\n );\n this.setLaFuncCache(key, laFunc);\n });\n });\n\n forEach(repetition, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_IDX,\n \"Repetition\",\n currProd.maxLookahead,\n getProductionDslName(currProd),\n );\n });\n\n forEach(option, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n OPTION_IDX,\n \"Option\",\n currProd.maxLookahead,\n getProductionDslName(currProd),\n );\n });\n\n forEach(repetitionMandatory, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_IDX,\n \"RepetitionMandatory\",\n currProd.maxLookahead,\n getProductionDslName(currProd),\n );\n });\n\n forEach(repetitionMandatoryWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n AT_LEAST_ONE_SEP_IDX,\n \"RepetitionMandatoryWithSeparator\",\n currProd.maxLookahead,\n getProductionDslName(currProd),\n );\n });\n\n forEach(repetitionWithSeparator, (currProd) => {\n this.computeLookaheadFunc(\n currRule,\n currProd.idx,\n MANY_SEP_IDX,\n \"RepetitionWithSeparator\",\n currProd.maxLookahead,\n getProductionDslName(currProd),\n );\n });\n });\n });\n }\n\n computeLookaheadFunc(\n this: MixedInParser,\n rule: Rule,\n prodOccurrence: number,\n prodKey: number,\n prodType: OptionalProductionType,\n prodMaxLookahead: number | undefined,\n dslMethodName: string,\n ): void {\n this.TRACE_INIT(\n `${dslMethodName}${prodOccurrence === 0 ? \"\" : prodOccurrence}`,\n () => {\n const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({\n prodOccurrence,\n rule,\n maxLookahead: prodMaxLookahead || this.maxLookahead,\n dynamicTokensEnabled: this.dynamicTokensEnabled,\n prodType,\n });\n const key = getKeyForAutomaticLookahead(\n this.fullRuleNameToShort[rule.name],\n prodKey,\n prodOccurrence,\n );\n this.setLaFuncCache(key, laFunc);\n },\n );\n }\n\n // this actually returns a number, but it is always used as a string (object prop key)\n getKeyForAutomaticLookahead(\n this: MixedInParser,\n dslMethodIdx: number,\n occurrence: number,\n ): number {\n const currRuleShortName: any = this.getLastExplicitRuleShortName();\n return getKeyForAutomaticLookahead(\n currRuleShortName,\n dslMethodIdx,\n occurrence,\n );\n }\n\n getLaFuncFromCache(this: MixedInParser, key: number): Function {\n return this.lookAheadFuncsCache.get(key);\n }\n\n /* istanbul ignore next */\n setLaFuncCache(this: MixedInParser, key: number, value: Function): void {\n this.lookAheadFuncsCache.set(key, value);\n }\n}\n\nclass DslMethodsCollectorVisitor extends GAstVisitor {\n public dslMethods: {\n option: Option[];\n alternation: Alternation[];\n repetition: Repetition[];\n repetitionWithSeparator: RepetitionWithSeparator[];\n repetitionMandatory: RepetitionMandatory[];\n repetitionMandatoryWithSeparator: RepetitionMandatoryWithSeparator[];\n } = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n };\n\n reset() {\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: [],\n };\n }\n\n public visitOption(option: Option): void {\n this.dslMethods.option.push(option);\n }\n\n public visitRepetitionWithSeparator(manySep: RepetitionWithSeparator): void {\n this.dslMethods.repetitionWithSeparator.push(manySep);\n }\n\n public visitRepetitionMandatory(atLeastOne: RepetitionMandatory): void {\n this.dslMethods.repetitionMandatory.push(atLeastOne);\n }\n\n public visitRepetitionMandatoryWithSeparator(\n atLeastOneSep: RepetitionMandatoryWithSeparator,\n ): void {\n this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep);\n }\n\n public visitRepetition(many: Repetition): void {\n this.dslMethods.repetition.push(many);\n }\n\n public visitAlternation(or: Alternation): void {\n this.dslMethods.alternation.push(or);\n }\n}\n\nconst collectorVisitor = new DslMethodsCollectorVisitor();\nexport function collectMethods(rule: Rule): {\n option: Option[];\n alternation: Alternation[];\n repetition: Repetition[];\n repetitionWithSeparator: RepetitionWithSeparator[];\n repetitionMandatory: RepetitionMandatory[];\n repetitionMandatoryWithSeparator: RepetitionMandatoryWithSeparator[];\n} {\n collectorVisitor.reset();\n rule.accept(collectorVisitor);\n const dslMethods = collectorVisitor.dslMethods;\n // avoid uncleaned references\n collectorVisitor.reset();\n return dslMethods;\n}\n", "import { CstNode, CstNodeLocation, IToken } from \"@chevrotain/types\";\n\n/**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\nexport function setNodeLocationOnlyOffset(\n currNodeLocation: CstNodeLocation,\n newLocationInfo: Required>,\n): void {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (both start/end offsets exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset;\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n }\n // Once the startOffset has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset! < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n }\n}\n\n/**\n * This nodeLocation tracking is not efficient and should only be used\n * when error recovery is enabled or the Token Vector contains virtual Tokens\n * (e.g, Python Indent/Outdent)\n * As it executes the calculation for every single terminal/nonTerminal\n * and does not rely on the fact the token vector is **sorted**\n */\nexport function setNodeLocationFull(\n currNodeLocation: CstNodeLocation,\n newLocationInfo: CstNodeLocation,\n): void {\n // First (valid) update for this cst node\n if (isNaN(currNodeLocation.startOffset) === true) {\n // assumption1: Token location information is either NaN or a valid number\n // assumption2: Token location information is fully valid if it exist\n // (all start/end props exist and are numbers).\n currNodeLocation.startOffset = newLocationInfo.startOffset;\n currNodeLocation.startColumn = newLocationInfo.startColumn;\n currNodeLocation.startLine = newLocationInfo.startLine;\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n currNodeLocation.endColumn = newLocationInfo.endColumn;\n currNodeLocation.endLine = newLocationInfo.endLine;\n }\n // Once the start props has been updated with a valid number it should never receive\n // any farther updates as the Token vector is sorted.\n // We still have to check this this condition for every new possible location info\n // because with error recovery enabled we may encounter invalid tokens (NaN location props)\n else if (currNodeLocation.endOffset! < newLocationInfo.endOffset! === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n currNodeLocation.endColumn = newLocationInfo.endColumn;\n currNodeLocation.endLine = newLocationInfo.endLine;\n }\n}\n\nexport function addTerminalToCst(\n node: CstNode,\n token: IToken,\n tokenTypeName: string,\n): void {\n if (node.children[tokenTypeName] === undefined) {\n node.children[tokenTypeName] = [token];\n } else {\n node.children[tokenTypeName].push(token);\n }\n}\n\nexport function addNoneTerminalToCst(\n node: CstNode,\n ruleName: string,\n ruleResult: any,\n): void {\n if (node.children[ruleName] === undefined) {\n node.children[ruleName] = [ruleResult];\n } else {\n node.children[ruleName].push(ruleResult);\n }\n}\n", "const NAME = \"name\";\n\nexport function defineNameProp(obj: {}, nameValue: string): void {\n Object.defineProperty(obj, NAME, {\n enumerable: false,\n configurable: true,\n writable: false,\n value: nameValue,\n });\n}\n", "import {\n compact,\n filter,\n forEach,\n isArray,\n isEmpty,\n isFunction,\n isUndefined,\n keys,\n map,\n} from \"lodash-es\";\nimport { defineNameProp } from \"../../lang/lang_extensions.js\";\nimport { CstNode, ICstVisitor } from \"@chevrotain/types\";\n\nexport function defaultVisit(ctx: any, param: IN): void {\n const childrenNames = keys(ctx);\n const childrenNamesLength = childrenNames.length;\n for (let i = 0; i < childrenNamesLength; i++) {\n const currChildName = childrenNames[i];\n const currChildArray = ctx[currChildName];\n const currChildArrayLength = currChildArray.length;\n for (let j = 0; j < currChildArrayLength; j++) {\n const currChild: any = currChildArray[j];\n // distinction between Tokens Children and CstNode children\n if (currChild.tokenTypeIdx === undefined) {\n this[currChild.name](currChild.children, param);\n }\n }\n }\n // defaultVisit does not support generic out param\n}\n\nexport function createBaseSemanticVisitorConstructor(\n grammarName: string,\n ruleNames: string[],\n): {\n new (...args: any[]): ICstVisitor;\n} {\n const derivedConstructor: any = function () {};\n\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + \"BaseSemantics\");\n\n const semanticProto = {\n visit: function (cstNode: CstNode | CstNode[], param: any) {\n // enables writing more concise visitor methods when CstNode has only a single child\n if (isArray(cstNode)) {\n // A CST Node's children dictionary can never have empty arrays as values\n // If a key is defined there will be at least one element in the corresponding value array.\n cstNode = cstNode[0];\n }\n\n // enables passing optional CstNodes concisely.\n if (isUndefined(cstNode)) {\n return undefined;\n }\n\n return this[cstNode.name](cstNode.children, param);\n },\n\n validateVisitor: function () {\n const semanticDefinitionErrors = validateVisitor(this, ruleNames);\n if (!isEmpty(semanticDefinitionErrors)) {\n const errorMessages = map(\n semanticDefinitionErrors,\n (currDefError) => currDefError.msg,\n );\n throw Error(\n `Errors Detected in CST Visitor <${this.constructor.name}>:\\n\\t` +\n `${errorMessages.join(\"\\n\\n\").replace(/\\n/g, \"\\n\\t\")}`,\n );\n }\n },\n };\n\n derivedConstructor.prototype = semanticProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n\n derivedConstructor._RULE_NAMES = ruleNames;\n\n return derivedConstructor;\n}\n\nexport function createBaseVisitorConstructorWithDefaults(\n grammarName: string,\n ruleNames: string[],\n baseConstructor: Function,\n): {\n new (...args: any[]): ICstVisitor;\n} {\n const derivedConstructor: any = function () {};\n\n // can be overwritten according to:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/\n // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname\n defineNameProp(derivedConstructor, grammarName + \"BaseSemanticsWithDefaults\");\n\n const withDefaultsProto = Object.create(baseConstructor.prototype);\n forEach(ruleNames, (ruleName) => {\n withDefaultsProto[ruleName] = defaultVisit;\n });\n\n derivedConstructor.prototype = withDefaultsProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n\n return derivedConstructor;\n}\n\nexport enum CstVisitorDefinitionError {\n REDUNDANT_METHOD,\n MISSING_METHOD,\n}\n\nexport interface IVisitorDefinitionError {\n msg: string;\n type: CstVisitorDefinitionError;\n methodName: string;\n}\n\nexport function validateVisitor(\n visitorInstance: ICstVisitor,\n ruleNames: string[],\n): IVisitorDefinitionError[] {\n const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames);\n\n return missingErrors;\n}\n\nexport function validateMissingCstMethods(\n visitorInstance: ICstVisitor,\n ruleNames: string[],\n): IVisitorDefinitionError[] {\n const missingRuleNames = filter(ruleNames, (currRuleName) => {\n return isFunction((visitorInstance as any)[currRuleName]) === false;\n });\n\n const errors: IVisitorDefinitionError[] = map(\n missingRuleNames,\n (currRuleName) => {\n return {\n msg: `Missing visitor method: <${currRuleName}> on ${(\n visitorInstance.constructor.name\n )} CST Visitor.`,\n type: CstVisitorDefinitionError.MISSING_METHOD,\n methodName: currRuleName,\n };\n },\n );\n\n return compact(errors);\n}\n", "import {\n addNoneTerminalToCst,\n addTerminalToCst,\n setNodeLocationFull,\n setNodeLocationOnlyOffset,\n} from \"../../cst/cst.js\";\nimport { has, isUndefined, keys, noop } from \"lodash-es\";\nimport {\n createBaseSemanticVisitorConstructor,\n createBaseVisitorConstructorWithDefaults,\n} from \"../../cst/cst_visitor.js\";\nimport {\n CstNode,\n CstNodeLocation,\n ICstVisitor,\n IParserConfig,\n IToken,\n nodeLocationTrackingOptions,\n} from \"@chevrotain/types\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser.js\";\n\n/**\n * This trait is responsible for the CST building logic.\n */\nexport class TreeBuilder {\n outputCst: boolean;\n CST_STACK: CstNode[];\n baseCstVisitorConstructor: Function;\n baseCstVisitorWithDefaultsConstructor: Function;\n\n // dynamically assigned Methods\n setNodeLocationFromNode: (\n nodeLocation: CstNodeLocation,\n locationInformation: CstNodeLocation,\n ) => void;\n setNodeLocationFromToken: (\n nodeLocation: CstNodeLocation,\n locationInformation: CstNodeLocation,\n ) => void;\n cstPostRule: (this: MixedInParser, ruleCstNode: CstNode) => void;\n\n setInitialNodeLocation: (cstNode: CstNode) => void;\n nodeLocationTracking: nodeLocationTrackingOptions;\n\n initTreeBuilder(this: MixedInParser, config: IParserConfig) {\n this.CST_STACK = [];\n\n // outputCst is no longer exposed/defined in the pubic API\n this.outputCst = (config as any).outputCst;\n\n this.nodeLocationTracking = has(config, \"nodeLocationTracking\")\n ? (config.nodeLocationTracking as nodeLocationTrackingOptions) // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.nodeLocationTracking;\n\n if (!this.outputCst) {\n this.cstInvocationStateUpdate = noop;\n this.cstFinallyStateUpdate = noop;\n this.cstPostTerminal = noop;\n this.cstPostNonTerminal = noop;\n this.cstPostRule = noop;\n } else {\n if (/full/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationFull;\n this.setNodeLocationFromNode = setNodeLocationFull;\n this.cstPostRule = noop;\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery;\n } else {\n this.setNodeLocationFromToken = noop;\n this.setNodeLocationFromNode = noop;\n this.cstPostRule = this.cstPostRuleFull;\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular;\n }\n } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = setNodeLocationOnlyOffset;\n this.setNodeLocationFromNode = setNodeLocationOnlyOffset;\n this.cstPostRule = noop;\n this.setInitialNodeLocation =\n this.setInitialNodeLocationOnlyOffsetRecovery;\n } else {\n this.setNodeLocationFromToken = noop;\n this.setNodeLocationFromNode = noop;\n this.cstPostRule = this.cstPostRuleOnlyOffset;\n this.setInitialNodeLocation =\n this.setInitialNodeLocationOnlyOffsetRegular;\n }\n } else if (/none/i.test(this.nodeLocationTracking)) {\n this.setNodeLocationFromToken = noop;\n this.setNodeLocationFromNode = noop;\n this.cstPostRule = noop;\n this.setInitialNodeLocation = noop;\n } else {\n throw Error(\n `Invalid config option: \"${config.nodeLocationTracking}\"`,\n );\n }\n }\n }\n\n setInitialNodeLocationOnlyOffsetRecovery(\n this: MixedInParser,\n cstNode: any,\n ): void {\n cstNode.location = {\n startOffset: NaN,\n endOffset: NaN,\n };\n }\n\n setInitialNodeLocationOnlyOffsetRegular(\n this: MixedInParser,\n cstNode: any,\n ): void {\n cstNode.location = {\n // without error recovery the starting Location of a new CstNode is guaranteed\n // To be the next Token's startOffset (for valid inputs).\n // For invalid inputs there won't be any CSTOutput so this potential\n // inaccuracy does not matter\n startOffset: this.LA(1).startOffset,\n endOffset: NaN,\n };\n }\n\n setInitialNodeLocationFullRecovery(this: MixedInParser, cstNode: any): void {\n cstNode.location = {\n startOffset: NaN,\n startLine: NaN,\n startColumn: NaN,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n };\n }\n\n /**\n * @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work\n\n * @param cstNode\n */\n setInitialNodeLocationFullRegular(this: MixedInParser, cstNode: any): void {\n const nextToken = this.LA(1);\n cstNode.location = {\n startOffset: nextToken.startOffset,\n startLine: nextToken.startLine,\n startColumn: nextToken.startColumn,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN,\n };\n }\n\n cstInvocationStateUpdate(this: MixedInParser, fullRuleName: string): void {\n const cstNode: CstNode = {\n name: fullRuleName,\n children: Object.create(null),\n };\n\n this.setInitialNodeLocation(cstNode);\n this.CST_STACK.push(cstNode);\n }\n\n cstFinallyStateUpdate(this: MixedInParser): void {\n this.CST_STACK.pop();\n }\n\n cstPostRuleFull(this: MixedInParser, ruleCstNode: CstNode): void {\n // casts to `required` are safe because `cstPostRuleFull` should only be invoked when full location is enabled\n const prevToken = this.LA(0) as Required;\n const loc = ruleCstNode.location as Required;\n\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset;\n loc.endLine = prevToken.endLine;\n loc.endColumn = prevToken.endColumn;\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN;\n loc.startLine = NaN;\n loc.startColumn = NaN;\n }\n }\n\n cstPostRuleOnlyOffset(this: MixedInParser, ruleCstNode: CstNode): void {\n const prevToken = this.LA(0);\n // `location' is not null because `cstPostRuleOnlyOffset` will only be invoked when location tracking is enabled.\n const loc = ruleCstNode.location!;\n\n // If this condition is true it means we consumed at least one Token\n // In this CstNode.\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset;\n }\n // \"empty\" CstNode edge case\n else {\n loc.startOffset = NaN;\n }\n }\n\n cstPostTerminal(\n this: MixedInParser,\n key: string,\n consumedToken: IToken,\n ): void {\n const rootCst = this.CST_STACK[this.CST_STACK.length - 1];\n addTerminalToCst(rootCst, consumedToken, key);\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromToken(rootCst.location!, consumedToken);\n }\n\n cstPostNonTerminal(\n this: MixedInParser,\n ruleCstResult: CstNode,\n ruleName: string,\n ): void {\n const preCstNode = this.CST_STACK[this.CST_STACK.length - 1];\n addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult);\n // This is only used when **both** error recovery and CST Output are enabled.\n this.setNodeLocationFromNode(preCstNode.location!, ruleCstResult.location!);\n }\n\n getBaseCstVisitorConstructor(\n this: MixedInParser,\n ): {\n new (...args: any[]): ICstVisitor;\n } {\n if (isUndefined(this.baseCstVisitorConstructor)) {\n const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(\n this.className,\n keys(this.gastProductionsCache),\n );\n this.baseCstVisitorConstructor = newBaseCstVisitorConstructor;\n return newBaseCstVisitorConstructor;\n }\n\n return this.baseCstVisitorConstructor;\n }\n\n getBaseCstVisitorConstructorWithDefaults(\n this: MixedInParser,\n ): {\n new (...args: any[]): ICstVisitor;\n } {\n if (isUndefined(this.baseCstVisitorWithDefaultsConstructor)) {\n const newConstructor = createBaseVisitorConstructorWithDefaults(\n this.className,\n keys(this.gastProductionsCache),\n this.getBaseCstVisitorConstructor(),\n );\n this.baseCstVisitorWithDefaultsConstructor = newConstructor;\n return newConstructor;\n }\n\n return this.baseCstVisitorWithDefaultsConstructor;\n }\n\n getLastExplicitRuleShortName(this: MixedInParser): number {\n const ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 1];\n }\n\n getPreviousExplicitRuleShortName(this: MixedInParser): number {\n const ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 2];\n }\n\n getLastExplicitRuleOccurrenceIndex(this: MixedInParser): number {\n const occurrenceStack = this.RULE_OCCURRENCE_STACK;\n return occurrenceStack[occurrenceStack.length - 1];\n }\n}\n", "import { END_OF_FILE } from \"../parser.js\";\nimport { IToken } from \"@chevrotain/types\";\nimport { MixedInParser } from \"./parser_traits.js\";\n\n/**\n * Trait responsible abstracting over the interaction with Lexer output (Token vector).\n *\n * This could be generalized to support other kinds of lexers, e.g.\n * - Just in Time Lexing / Lexer-Less parsing.\n * - Streaming Lexer.\n */\nexport class LexerAdapter {\n tokVector: IToken[];\n tokVectorLength: number;\n currIdx: number;\n\n initLexerAdapter() {\n this.tokVector = [];\n this.tokVectorLength = 0;\n this.currIdx = -1;\n }\n\n set input(newInput: IToken[]) {\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n if (this.selfAnalysisDone !== true) {\n throw Error(\n `Missing invocation at the end of the Parser's constructor.`,\n );\n }\n // @ts-ignore - `this parameter` not supported in setters/getters\n // - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters\n this.reset();\n this.tokVector = newInput;\n this.tokVectorLength = newInput.length;\n }\n\n get input(): IToken[] {\n return this.tokVector;\n }\n\n // skips a token and returns the next token\n SKIP_TOKEN(this: MixedInParser): IToken {\n if (this.currIdx <= this.tokVector.length - 2) {\n this.consumeToken();\n return this.LA(1);\n } else {\n return END_OF_FILE;\n }\n }\n\n // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers\n // or lexers dependent on parser context.\n LA(this: MixedInParser, howMuch: number): IToken {\n const soughtIdx = this.currIdx + howMuch;\n if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {\n return END_OF_FILE;\n } else {\n return this.tokVector[soughtIdx];\n }\n }\n\n consumeToken(this: MixedInParser) {\n this.currIdx++;\n }\n\n exportLexerState(this: MixedInParser): number {\n return this.currIdx;\n }\n\n importLexerState(this: MixedInParser, newState: number) {\n this.currIdx = newState;\n }\n\n resetLexerState(this: MixedInParser): void {\n this.currIdx = -1;\n }\n\n moveToTerminatedState(this: MixedInParser): void {\n this.currIdx = this.tokVector.length - 1;\n }\n\n getLexerPosition(this: MixedInParser): number {\n return this.exportLexerState();\n }\n}\n", "import {\n AtLeastOneSepMethodOpts,\n ConsumeMethodOpts,\n DSLMethodOpts,\n DSLMethodOptsWithErr,\n GrammarAction,\n IOrAlt,\n IRuleConfig,\n ISerializedGast,\n IToken,\n ManySepMethodOpts,\n OrMethodOpts,\n SubruleMethodOpts,\n TokenType,\n} from \"@chevrotain/types\";\nimport { includes, values } from \"lodash-es\";\nimport { isRecognitionException } from \"../../exceptions_public.js\";\nimport { DEFAULT_RULE_CONFIG, ParserDefinitionErrorType } from \"../parser.js\";\nimport { defaultGrammarValidatorErrorProvider } from \"../../errors_public.js\";\nimport { validateRuleIsOverridden } from \"../../grammar/checks.js\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport { Rule, serializeGrammar } from \"@chevrotain/gast\";\nimport { IParserDefinitionError } from \"../../grammar/types.js\";\nimport { ParserMethodInternal } from \"../types.js\";\n\n/**\n * This trait is responsible for implementing the public API\n * for defining Chevrotain parsers, i.e:\n * - CONSUME\n * - RULE\n * - OPTION\n * - ...\n */\nexport class RecognizerApi {\n ACTION(this: MixedInParser, impl: () => T): T {\n return impl.call(this);\n }\n\n consume(\n this: MixedInParser,\n idx: number,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, idx, options);\n }\n\n subrule(\n this: MixedInParser,\n idx: number,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, idx, options);\n }\n\n option(\n this: MixedInParser,\n idx: number,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, idx);\n }\n\n or(\n this: MixedInParser,\n idx: number,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): any {\n return this.orInternal(altsOrOpts, idx);\n }\n\n many(\n this: MixedInParser,\n idx: number,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n return this.manyInternal(idx, actionORMethodDef);\n }\n\n atLeastOne(\n this: MixedInParser,\n idx: number,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n return this.atLeastOneInternal(idx, actionORMethodDef);\n }\n\n CONSUME(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 0, options);\n }\n\n CONSUME1(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 1, options);\n }\n\n CONSUME2(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 2, options);\n }\n\n CONSUME3(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 3, options);\n }\n\n CONSUME4(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 4, options);\n }\n\n CONSUME5(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 5, options);\n }\n\n CONSUME6(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 6, options);\n }\n\n CONSUME7(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 7, options);\n }\n\n CONSUME8(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 8, options);\n }\n\n CONSUME9(\n this: MixedInParser,\n tokType: TokenType,\n options?: ConsumeMethodOpts,\n ): IToken {\n return this.consumeInternal(tokType, 9, options);\n }\n\n SUBRULE(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 0, options);\n }\n\n SUBRULE1(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 1, options);\n }\n\n SUBRULE2(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 2, options);\n }\n\n SUBRULE3(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 3, options);\n }\n\n SUBRULE4(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 4, options);\n }\n\n SUBRULE5(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 5, options);\n }\n\n SUBRULE6(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 6, options);\n }\n\n SUBRULE7(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 7, options);\n }\n\n SUBRULE8(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 8, options);\n }\n\n SUBRULE9(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n options?: SubruleMethodOpts,\n ): R {\n return this.subruleInternal(ruleToCall, 9, options);\n }\n\n OPTION(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 0);\n }\n\n OPTION1(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 1);\n }\n\n OPTION2(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 2);\n }\n\n OPTION3(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 3);\n }\n\n OPTION4(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 4);\n }\n\n OPTION5(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 5);\n }\n\n OPTION6(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 6);\n }\n\n OPTION7(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 7);\n }\n\n OPTION8(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 8);\n }\n\n OPTION9(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): OUT | undefined {\n return this.optionInternal(actionORMethodDef, 9);\n }\n\n OR(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 0);\n }\n\n OR1(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 1);\n }\n\n OR2(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 2);\n }\n\n OR3(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 3);\n }\n\n OR4(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 4);\n }\n\n OR5(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 5);\n }\n\n OR6(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 6);\n }\n\n OR7(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 7);\n }\n\n OR8(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 8);\n }\n\n OR9(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n ): T {\n return this.orInternal(altsOrOpts, 9);\n }\n\n MANY(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(0, actionORMethodDef);\n }\n\n MANY1(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(1, actionORMethodDef);\n }\n\n MANY2(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(2, actionORMethodDef);\n }\n\n MANY3(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(3, actionORMethodDef);\n }\n\n MANY4(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(4, actionORMethodDef);\n }\n\n MANY5(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(5, actionORMethodDef);\n }\n\n MANY6(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(6, actionORMethodDef);\n }\n\n MANY7(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(7, actionORMethodDef);\n }\n\n MANY8(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(8, actionORMethodDef);\n }\n\n MANY9(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n this.manyInternal(9, actionORMethodDef);\n }\n\n MANY_SEP(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(0, options);\n }\n\n MANY_SEP1(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(1, options);\n }\n\n MANY_SEP2(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(2, options);\n }\n\n MANY_SEP3(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(3, options);\n }\n\n MANY_SEP4(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(4, options);\n }\n\n MANY_SEP5(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(5, options);\n }\n\n MANY_SEP6(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(6, options);\n }\n\n MANY_SEP7(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(7, options);\n }\n\n MANY_SEP8(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(8, options);\n }\n\n MANY_SEP9(this: MixedInParser, options: ManySepMethodOpts): void {\n this.manySepFirstInternal(9, options);\n }\n\n AT_LEAST_ONE(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(0, actionORMethodDef);\n }\n\n AT_LEAST_ONE1(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n return this.atLeastOneInternal(1, actionORMethodDef);\n }\n\n AT_LEAST_ONE2(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(2, actionORMethodDef);\n }\n\n AT_LEAST_ONE3(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(3, actionORMethodDef);\n }\n\n AT_LEAST_ONE4(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(4, actionORMethodDef);\n }\n\n AT_LEAST_ONE5(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(5, actionORMethodDef);\n }\n\n AT_LEAST_ONE6(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(6, actionORMethodDef);\n }\n\n AT_LEAST_ONE7(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(7, actionORMethodDef);\n }\n\n AT_LEAST_ONE8(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(8, actionORMethodDef);\n }\n\n AT_LEAST_ONE9(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n this.atLeastOneInternal(9, actionORMethodDef);\n }\n\n AT_LEAST_ONE_SEP(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(0, options);\n }\n\n AT_LEAST_ONE_SEP1(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(1, options);\n }\n\n AT_LEAST_ONE_SEP2(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(2, options);\n }\n\n AT_LEAST_ONE_SEP3(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(3, options);\n }\n\n AT_LEAST_ONE_SEP4(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(4, options);\n }\n\n AT_LEAST_ONE_SEP5(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(5, options);\n }\n\n AT_LEAST_ONE_SEP6(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(6, options);\n }\n\n AT_LEAST_ONE_SEP7(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(7, options);\n }\n\n AT_LEAST_ONE_SEP8(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(8, options);\n }\n\n AT_LEAST_ONE_SEP9(\n this: MixedInParser,\n options: AtLeastOneSepMethodOpts,\n ): void {\n this.atLeastOneSepFirstInternal(9, options);\n }\n\n RULE(\n this: MixedInParser,\n name: string,\n implementation: (...implArgs: any[]) => T,\n config: IRuleConfig = DEFAULT_RULE_CONFIG,\n ): (idxInCallingRule?: number, ...args: any[]) => T | any {\n if (includes(this.definedRulesNames, name)) {\n const errMsg =\n defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({\n topLevelRule: name,\n grammarName: this.className,\n });\n\n const error = {\n message: errMsg,\n type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: name,\n };\n this.definitionErrors.push(error);\n }\n\n this.definedRulesNames.push(name);\n\n const ruleImplementation = this.defineRule(name, implementation, config);\n (this as any)[name] = ruleImplementation;\n return ruleImplementation;\n }\n\n OVERRIDE_RULE(\n this: MixedInParser,\n name: string,\n impl: (...implArgs: any[]) => T,\n config: IRuleConfig = DEFAULT_RULE_CONFIG,\n ): (idxInCallingRule?: number, ...args: any[]) => T {\n const ruleErrors: IParserDefinitionError[] = validateRuleIsOverridden(\n name,\n this.definedRulesNames,\n this.className,\n );\n this.definitionErrors = this.definitionErrors.concat(ruleErrors);\n\n const ruleImplementation = this.defineRule(name, impl, config);\n (this as any)[name] = ruleImplementation;\n return ruleImplementation;\n }\n\n BACKTRACK(\n this: MixedInParser,\n grammarRule: (...args: any[]) => T,\n args?: any[],\n ): () => boolean {\n return function () {\n // save org state\n this.isBackTrackingStack.push(1);\n const orgState = this.saveRecogState();\n try {\n grammarRule.apply(this, args);\n // if no exception was thrown we have succeed parsing the rule.\n return true;\n } catch (e) {\n if (isRecognitionException(e)) {\n return false;\n } else {\n throw e;\n }\n } finally {\n this.reloadRecogState(orgState);\n this.isBackTrackingStack.pop();\n }\n };\n }\n\n // GAST export APIs\n public getGAstProductions(this: MixedInParser): Record {\n return this.gastProductionsCache;\n }\n\n public getSerializedGastProductions(this: MixedInParser): ISerializedGast[] {\n return serializeGrammar(values(this.gastProductionsCache));\n }\n}\n", "import {\n AtLeastOneSepMethodOpts,\n ConsumeMethodOpts,\n DSLMethodOpts,\n DSLMethodOptsWithErr,\n GrammarAction,\n IOrAlt,\n IParserConfig,\n IRuleConfig,\n IToken,\n ManySepMethodOpts,\n OrMethodOpts,\n ParserMethod,\n SubruleMethodOpts,\n TokenType,\n TokenTypeDictionary,\n TokenVocabulary,\n} from \"@chevrotain/types\";\nimport {\n clone,\n every,\n flatten,\n has,\n isArray,\n isEmpty,\n isObject,\n reduce,\n uniq,\n values,\n} from \"lodash-es\";\nimport {\n AT_LEAST_ONE_IDX,\n AT_LEAST_ONE_SEP_IDX,\n BITS_FOR_METHOD_TYPE,\n BITS_FOR_OCCURRENCE_IDX,\n MANY_IDX,\n MANY_SEP_IDX,\n OPTION_IDX,\n OR_IDX,\n} from \"../../grammar/keys.js\";\nimport {\n isRecognitionException,\n MismatchedTokenException,\n NotAllInputParsedException,\n} from \"../../exceptions_public.js\";\nimport { PROD_TYPE } from \"../../grammar/lookahead.js\";\nimport {\n AbstractNextTerminalAfterProductionWalker,\n NextTerminalAfterAtLeastOneSepWalker,\n NextTerminalAfterAtLeastOneWalker,\n NextTerminalAfterManySepWalker,\n NextTerminalAfterManyWalker,\n} from \"../../grammar/interpreter.js\";\nimport { DEFAULT_RULE_CONFIG, IParserState, TokenMatcher } from \"../parser.js\";\nimport { IN_RULE_RECOVERY_EXCEPTION } from \"./recoverable.js\";\nimport { EOF } from \"../../../scan/tokens_public.js\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport {\n augmentTokenTypes,\n isTokenType,\n tokenStructuredMatcher,\n tokenStructuredMatcherNoCategories,\n} from \"../../../scan/tokens.js\";\nimport { Rule } from \"@chevrotain/gast\";\nimport { ParserMethodInternal } from \"../types.js\";\n\n/**\n * This trait is responsible for the runtime parsing engine\n * Used by the official API (recognizer_api.ts)\n */\nexport class RecognizerEngine {\n isBackTrackingStack: boolean[];\n className: string;\n RULE_STACK: number[];\n RULE_OCCURRENCE_STACK: number[];\n definedRulesNames: string[];\n tokensMap: { [fqn: string]: TokenType };\n gastProductionsCache: Record;\n shortRuleNameToFull: Record;\n fullRuleNameToShort: Record;\n // The shortName Index must be coded \"after\" the first 8bits to enable building unique lookahead keys\n ruleShortNameIdx: number;\n tokenMatcher: TokenMatcher;\n subruleIdx: number;\n\n initRecognizerEngine(\n tokenVocabulary: TokenVocabulary,\n config: IParserConfig,\n ) {\n this.className = this.constructor.name;\n // TODO: would using an ES6 Map or plain object be faster (CST building scenario)\n this.shortRuleNameToFull = {};\n this.fullRuleNameToShort = {};\n this.ruleShortNameIdx = 256;\n this.tokenMatcher = tokenStructuredMatcherNoCategories;\n this.subruleIdx = 0;\n\n this.definedRulesNames = [];\n this.tokensMap = {};\n this.isBackTrackingStack = [];\n this.RULE_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n this.gastProductionsCache = {};\n\n if (has(config, \"serializedGrammar\")) {\n throw Error(\n \"The Parser's configuration can no longer contain a property.\\n\" +\n \"\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\\n\" +\n \"\\tFor Further details.\",\n );\n }\n\n if (isArray(tokenVocabulary)) {\n // This only checks for Token vocabularies provided as arrays.\n // That is good enough because the main objective is to detect users of pre-V4.0 APIs\n // rather than all edge cases of empty Token vocabularies.\n if (isEmpty(tokenVocabulary as any[])) {\n throw Error(\n \"A Token Vocabulary cannot be empty.\\n\" +\n \"\\tNote that the first argument for the parser constructor\\n\" +\n \"\\tis no longer a Token vector (since v4.0).\",\n );\n }\n\n if (typeof (tokenVocabulary as any[])[0].startOffset === \"number\") {\n throw Error(\n \"The Parser constructor no longer accepts a token vector as the first argument.\\n\" +\n \"\\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\\n\" +\n \"\\tFor Further details.\",\n );\n }\n }\n\n if (isArray(tokenVocabulary)) {\n this.tokensMap = reduce(\n tokenVocabulary,\n (acc, tokType: TokenType) => {\n acc[tokType.name] = tokType;\n return acc;\n },\n {} as { [tokenName: string]: TokenType },\n );\n } else if (\n has(tokenVocabulary, \"modes\") &&\n every(flatten(values((tokenVocabulary).modes)), isTokenType)\n ) {\n const allTokenTypes = flatten(values((tokenVocabulary).modes));\n const uniqueTokens = uniq(allTokenTypes);\n this.tokensMap = reduce(\n uniqueTokens,\n (acc, tokType: TokenType) => {\n acc[tokType.name] = tokType;\n return acc;\n },\n {} as { [tokenName: string]: TokenType },\n );\n } else if (isObject(tokenVocabulary)) {\n this.tokensMap = clone(tokenVocabulary as TokenTypeDictionary);\n } else {\n throw new Error(\n \" argument must be An Array of Token constructors,\" +\n \" A dictionary of Token constructors or an IMultiModeLexerDefinition\",\n );\n }\n\n // always add EOF to the tokenNames -> constructors map. it is useful to assure all the input has been\n // parsed with a clear error message (\"expecting EOF but found ...\")\n this.tokensMap[\"EOF\"] = EOF;\n\n const allTokenTypes = has(tokenVocabulary, \"modes\")\n ? flatten(values((tokenVocabulary).modes))\n : values(tokenVocabulary);\n const noTokenCategoriesUsed = every(allTokenTypes, (tokenConstructor) =>\n isEmpty(tokenConstructor.categoryMatches),\n );\n\n this.tokenMatcher = noTokenCategoriesUsed\n ? tokenStructuredMatcherNoCategories\n : tokenStructuredMatcher;\n\n // Because ES2015+ syntax should be supported for creating Token classes\n // We cannot assume that the Token classes were created using the \"extendToken\" utilities\n // Therefore we must augment the Token classes both on Lexer initialization and on Parser initialization\n augmentTokenTypes(values(this.tokensMap));\n }\n\n defineRule(\n this: MixedInParser,\n ruleName: string,\n impl: (...args: ARGS) => R,\n config: IRuleConfig,\n ): ParserMethodInternal {\n if (this.selfAnalysisDone) {\n throw Error(\n `Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called'\\n` +\n `Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`,\n );\n }\n const resyncEnabled: boolean = has(config, \"resyncEnabled\")\n ? (config.resyncEnabled as boolean) // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.resyncEnabled;\n const recoveryValueFunc = has(config, \"recoveryValueFunc\")\n ? (config.recoveryValueFunc as () => R) // assumes end user provides the correct config value/type\n : DEFAULT_RULE_CONFIG.recoveryValueFunc;\n\n // performance optimization: Use small integers as keys for the longer human readable \"full\" rule names.\n // this greatly improves Map access time (as much as 8% for some performance benchmarks).\n const shortName =\n this.ruleShortNameIdx << (BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX);\n\n this.ruleShortNameIdx++;\n this.shortRuleNameToFull[shortName] = ruleName;\n this.fullRuleNameToShort[ruleName] = shortName;\n\n let invokeRuleWithTry: ParserMethod;\n\n // Micro optimization, only check the condition **once** on rule definition\n // instead of **every single** rule invocation.\n if (this.outputCst === true) {\n invokeRuleWithTry = function invokeRuleWithTry(\n this: MixedInParser,\n ...args: ARGS\n ): R {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);\n impl.apply(this, args);\n const cst = this.CST_STACK[this.CST_STACK.length - 1];\n this.cstPostRule(cst);\n return cst as unknown as R;\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc) as R;\n } finally {\n this.ruleFinallyStateUpdate();\n }\n };\n } else {\n invokeRuleWithTry = function invokeRuleWithTryCst(\n this: MixedInParser,\n ...args: ARGS\n ): R {\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);\n return impl.apply(this, args);\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc) as R;\n } finally {\n this.ruleFinallyStateUpdate();\n }\n };\n }\n\n const wrappedGrammarRule: ParserMethodInternal = Object.assign(\n invokeRuleWithTry as any,\n { ruleName, originalGrammarAction: impl },\n );\n\n return wrappedGrammarRule;\n }\n\n invokeRuleCatch(\n this: MixedInParser,\n e: Error,\n resyncEnabledConfig: boolean,\n recoveryValueFunc: Function,\n ): unknown {\n const isFirstInvokedRule = this.RULE_STACK.length === 1;\n // note the reSync is always enabled for the first rule invocation, because we must always be able to\n // reSync with EOF and just output some INVALID ParseTree\n // during backtracking reSync recovery is disabled, otherwise we can't be certain the backtracking\n // path is really the most valid one\n const reSyncEnabled =\n resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled;\n\n if (isRecognitionException(e)) {\n const recogError: any = e;\n if (reSyncEnabled) {\n const reSyncTokType = this.findReSyncTokenType();\n if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {\n recogError.resyncedTokens = this.reSyncTo(reSyncTokType);\n if (this.outputCst) {\n const partialCstResult: any =\n this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n return partialCstResult;\n } else {\n return recoveryValueFunc(e);\n }\n } else {\n if (this.outputCst) {\n const partialCstResult: any =\n this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n recogError.partialCstResult = partialCstResult;\n }\n // to be handled Further up the call stack\n throw recogError;\n }\n } else if (isFirstInvokedRule) {\n // otherwise a Redundant input error will be created as well and we cannot guarantee that this is indeed the case\n this.moveToTerminatedState();\n // the parser should never throw one of its own errors outside its flow.\n // even if error recovery is disabled\n return recoveryValueFunc(e);\n } else {\n // to be recovered Further up the call stack\n throw recogError;\n }\n } else {\n // some other Error type which we don't know how to handle (for example a built in JavaScript Error)\n throw e;\n }\n }\n\n // Implementation of parsing DSL\n optionInternal(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n occurrence: number,\n ): OUT | undefined {\n const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence);\n return this.optionInternalLogic(actionORMethodDef, occurrence, key);\n }\n\n optionInternalLogic(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n occurrence: number,\n key: number,\n ): OUT | undefined {\n let lookAheadFunc = this.getLaFuncFromCache(key);\n let action: GrammarAction;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n const predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc;\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n\n if (lookAheadFunc.call(this) === true) {\n return action.call(this);\n }\n return undefined;\n }\n\n atLeastOneInternal(\n this: MixedInParser,\n prodOccurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n const laKey = this.getKeyForAutomaticLookahead(\n AT_LEAST_ONE_IDX,\n prodOccurrence,\n );\n return this.atLeastOneInternalLogic(\n prodOccurrence,\n actionORMethodDef,\n laKey,\n );\n }\n\n atLeastOneInternalLogic(\n this: MixedInParser,\n prodOccurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n key: number,\n ): void {\n let lookAheadFunc = this.getLaFuncFromCache(key);\n let action;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n const predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookAheadFunc;\n lookAheadFunc = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n\n if ((lookAheadFunc).call(this) === true) {\n let notStuck = this.doSingleRepetition(action);\n while (\n (lookAheadFunc).call(this) === true &&\n notStuck === true\n ) {\n notStuck = this.doSingleRepetition(action);\n }\n } else {\n throw this.raiseEarlyExitException(\n prodOccurrence,\n PROD_TYPE.REPETITION_MANDATORY,\n (>actionORMethodDef).ERR_MSG,\n );\n }\n\n // note that while it may seem that this can cause an error because by using a recursive call to\n // AT_LEAST_ONE we change the grammar to AT_LEAST_TWO, AT_LEAST_THREE ... , the possible recursive call\n // from the tryInRepetitionRecovery(...) will only happen IFF there really are TWO/THREE/.... items.\n\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.atLeastOneInternal,\n [prodOccurrence, actionORMethodDef],\n lookAheadFunc,\n AT_LEAST_ONE_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneWalker,\n );\n }\n\n atLeastOneSepFirstInternal(\n this: MixedInParser,\n prodOccurrence: number,\n options: AtLeastOneSepMethodOpts,\n ): void {\n const laKey = this.getKeyForAutomaticLookahead(\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n );\n this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey);\n }\n\n atLeastOneSepFirstInternalLogic(\n this: MixedInParser,\n prodOccurrence: number,\n options: AtLeastOneSepMethodOpts,\n key: number,\n ): void {\n const action = options.DEF;\n const separator = options.SEP;\n\n const firstIterationLookaheadFunc = this.getLaFuncFromCache(key);\n\n // 1st iteration\n if (firstIterationLookaheadFunc.call(this) === true) {\n (>action).call(this);\n\n // TODO: Optimization can move this function construction into \"attemptInRepetitionRecovery\"\n // because it is only needed in error recovery scenarios.\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator);\n };\n\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator);\n // No need for checking infinite loop here due to consuming the separator.\n (>action).call(this);\n }\n\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n NextTerminalAfterAtLeastOneSepWalker,\n ],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterAtLeastOneSepWalker,\n );\n } else {\n throw this.raiseEarlyExitException(\n prodOccurrence,\n PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,\n options.ERR_MSG,\n );\n }\n }\n\n manyInternal(\n this: MixedInParser,\n prodOccurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence);\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey);\n }\n\n manyInternalLogic(\n this: MixedInParser,\n prodOccurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n key: number,\n ) {\n let lookaheadFunction = this.getLaFuncFromCache(key);\n let action;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n const predicate = actionORMethodDef.GATE;\n // predicate present\n if (predicate !== undefined) {\n const orgLookaheadFunction = lookaheadFunction;\n lookaheadFunction = () => {\n return predicate.call(this) && orgLookaheadFunction.call(this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n\n let notStuck = true;\n while (lookaheadFunction.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action);\n }\n\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.manyInternal,\n [prodOccurrence, actionORMethodDef],\n lookaheadFunction,\n MANY_IDX,\n prodOccurrence,\n NextTerminalAfterManyWalker,\n // The notStuck parameter is only relevant when \"attemptInRepetitionRecovery\"\n // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]\n // An infinite loop cannot occur as:\n // - Either the lookahead is guaranteed to consume something (Single Token Separator)\n // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).\n notStuck,\n );\n }\n\n manySepFirstInternal(\n this: MixedInParser,\n prodOccurrence: number,\n options: ManySepMethodOpts,\n ): void {\n const laKey = this.getKeyForAutomaticLookahead(\n MANY_SEP_IDX,\n prodOccurrence,\n );\n this.manySepFirstInternalLogic(prodOccurrence, options, laKey);\n }\n\n manySepFirstInternalLogic(\n this: MixedInParser,\n prodOccurrence: number,\n options: ManySepMethodOpts,\n key: number,\n ): void {\n const action = options.DEF;\n const separator = options.SEP;\n const firstIterationLaFunc = this.getLaFuncFromCache(key);\n\n // 1st iteration\n if (firstIterationLaFunc.call(this) === true) {\n action.call(this);\n\n const separatorLookAheadFunc = () => {\n return this.tokenMatcher(this.LA(1), separator);\n };\n // 2nd..nth iterations\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator);\n // No need for checking infinite loop here due to consuming the separator.\n action.call(this);\n }\n\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n NextTerminalAfterManySepWalker,\n ],\n separatorLookAheadFunc,\n MANY_SEP_IDX,\n prodOccurrence,\n NextTerminalAfterManySepWalker,\n );\n }\n }\n\n repetitionSepSecondInternal(\n this: MixedInParser,\n prodOccurrence: number,\n separator: TokenType,\n separatorLookAheadFunc: () => boolean,\n action: GrammarAction,\n nextTerminalAfterWalker: typeof AbstractNextTerminalAfterProductionWalker,\n ): void {\n while (separatorLookAheadFunc()) {\n // note that this CONSUME will never enter recovery because\n // the separatorLookAheadFunc checks that the separator really does exist.\n this.CONSUME(separator);\n action.call(this);\n }\n\n // we can only arrive to this function after an error\n // has occurred (hence the name 'second') so the following\n // IF will always be entered, its possible to remove it...\n // however it is kept to avoid confusion and be consistent.\n // Performance optimization: \"attemptInRepetitionRecovery\" will be defined as NOOP unless recovery is enabled\n /* istanbul ignore else */\n this.attemptInRepetitionRecovery(\n this.repetitionSepSecondInternal,\n [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n nextTerminalAfterWalker,\n ],\n separatorLookAheadFunc,\n AT_LEAST_ONE_SEP_IDX,\n prodOccurrence,\n nextTerminalAfterWalker,\n );\n }\n\n doSingleRepetition(this: MixedInParser, action: Function): any {\n const beforeIteration = this.getLexerPosition();\n action.call(this);\n const afterIteration = this.getLexerPosition();\n\n // This boolean will indicate if this repetition progressed\n // or if we are \"stuck\" (potential infinite loop in the repetition).\n return afterIteration > beforeIteration;\n }\n\n orInternal(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n occurrence: number,\n ): T {\n const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence);\n const alts = isArray(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;\n\n const laFunc = this.getLaFuncFromCache(laKey);\n const altIdxToTake = laFunc.call(this, alts);\n if (altIdxToTake !== undefined) {\n const chosenAlternative: any = alts[altIdxToTake];\n return chosenAlternative.ALT.call(this);\n }\n this.raiseNoAltException(\n occurrence,\n (altsOrOpts as OrMethodOpts).ERR_MSG,\n );\n }\n\n ruleFinallyStateUpdate(this: MixedInParser): void {\n this.RULE_STACK.pop();\n this.RULE_OCCURRENCE_STACK.pop();\n\n // NOOP when cst is disabled\n this.cstFinallyStateUpdate();\n\n if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {\n const firstRedundantTok = this.LA(1);\n const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({\n firstRedundant: firstRedundantTok,\n ruleName: this.getCurrRuleFullName(),\n });\n this.SAVE_ERROR(\n new NotAllInputParsedException(errMsg, firstRedundantTok),\n );\n }\n }\n\n subruleInternal(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n idx: number,\n options?: SubruleMethodOpts,\n ): R {\n let ruleResult;\n try {\n const args = options !== undefined ? options.ARGS : undefined;\n this.subruleIdx = idx;\n ruleResult = ruleToCall.apply(this, args);\n this.cstPostNonTerminal(\n ruleResult,\n options !== undefined && options.LABEL !== undefined\n ? options.LABEL\n : ruleToCall.ruleName,\n );\n return ruleResult;\n } catch (e) {\n throw this.subruleInternalError(e, options, ruleToCall.ruleName);\n }\n }\n\n subruleInternalError(\n this: MixedInParser,\n e: any,\n options: SubruleMethodOpts | undefined,\n ruleName: string,\n ): void {\n if (isRecognitionException(e) && e.partialCstResult !== undefined) {\n this.cstPostNonTerminal(\n e.partialCstResult,\n options !== undefined && options.LABEL !== undefined\n ? options.LABEL\n : ruleName,\n );\n\n delete e.partialCstResult;\n }\n throw e;\n }\n\n consumeInternal(\n this: MixedInParser,\n tokType: TokenType,\n idx: number,\n options: ConsumeMethodOpts | undefined,\n ): IToken {\n let consumedToken!: IToken;\n try {\n const nextToken = this.LA(1);\n if (this.tokenMatcher(nextToken, tokType) === true) {\n this.consumeToken();\n consumedToken = nextToken;\n } else {\n this.consumeInternalError(tokType, nextToken, options);\n }\n } catch (eFromConsumption) {\n consumedToken = this.consumeInternalRecovery(\n tokType,\n idx,\n eFromConsumption,\n );\n }\n\n this.cstPostTerminal(\n options !== undefined && options.LABEL !== undefined\n ? options.LABEL\n : tokType.name,\n consumedToken,\n );\n return consumedToken;\n }\n\n consumeInternalError(\n this: MixedInParser,\n tokType: TokenType,\n nextToken: IToken,\n options: ConsumeMethodOpts | undefined,\n ): void {\n let msg;\n const previousToken = this.LA(0);\n if (options !== undefined && options.ERR_MSG) {\n msg = options.ERR_MSG;\n } else {\n msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: tokType,\n actual: nextToken,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName(),\n });\n }\n throw this.SAVE_ERROR(\n new MismatchedTokenException(msg, nextToken, previousToken),\n );\n }\n\n consumeInternalRecovery(\n this: MixedInParser,\n tokType: TokenType,\n idx: number,\n eFromConsumption: Error,\n ): IToken {\n // no recovery allowed during backtracking, otherwise backtracking may recover invalid syntax and accept it\n // but the original syntax could have been parsed successfully without any backtracking + recovery\n if (\n this.recoveryEnabled &&\n // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?\n eFromConsumption.name === \"MismatchedTokenException\" &&\n !this.isBackTracking()\n ) {\n const follows = this.getFollowsForInRuleRecovery(tokType, idx);\n try {\n return this.tryInRuleRecovery(tokType, follows);\n } catch (eFromInRuleRecovery) {\n if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {\n // failed in RuleRecovery.\n // throw the original error in order to trigger reSync error recovery\n throw eFromConsumption;\n } else {\n throw eFromInRuleRecovery;\n }\n }\n } else {\n throw eFromConsumption;\n }\n }\n\n saveRecogState(this: MixedInParser): IParserState {\n // errors is a getter which will clone the errors array\n const savedErrors = this.errors;\n const savedRuleStack = clone(this.RULE_STACK);\n return {\n errors: savedErrors,\n lexerState: this.exportLexerState(),\n RULE_STACK: savedRuleStack,\n CST_STACK: this.CST_STACK,\n };\n }\n\n reloadRecogState(this: MixedInParser, newState: IParserState) {\n this.errors = newState.errors;\n this.importLexerState(newState.lexerState);\n this.RULE_STACK = newState.RULE_STACK;\n }\n\n ruleInvocationStateUpdate(\n this: MixedInParser,\n shortName: number,\n fullName: string,\n idxInCallingRule: number,\n ): void {\n this.RULE_OCCURRENCE_STACK.push(idxInCallingRule);\n this.RULE_STACK.push(shortName);\n // NOOP when cst is disabled\n this.cstInvocationStateUpdate(fullName);\n }\n\n isBackTracking(this: MixedInParser): boolean {\n return this.isBackTrackingStack.length !== 0;\n }\n\n getCurrRuleFullName(this: MixedInParser): string {\n const shortName = this.getLastExplicitRuleShortName();\n return this.shortRuleNameToFull[shortName];\n }\n\n shortRuleNameToFullName(this: MixedInParser, shortName: number) {\n return this.shortRuleNameToFull[shortName];\n }\n\n public isAtEndOfInput(this: MixedInParser): boolean {\n return this.tokenMatcher(this.LA(1), EOF);\n }\n\n public reset(this: MixedInParser): void {\n this.resetLexerState();\n this.subruleIdx = 0;\n this.isBackTrackingStack = [];\n this.errors = [];\n this.RULE_STACK = [];\n // TODO: extract a specific reset for TreeBuilder trait\n this.CST_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n }\n}\n", "import {\n IParserConfig,\n IParserErrorMessageProvider,\n IRecognitionException,\n} from \"@chevrotain/types\";\nimport {\n EarlyExitException,\n isRecognitionException,\n NoViableAltException,\n} from \"../../exceptions_public.js\";\nimport { clone, has } from \"lodash-es\";\nimport {\n getLookaheadPathsForOptionalProd,\n getLookaheadPathsForOr,\n PROD_TYPE,\n} from \"../../grammar/lookahead.js\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser.js\";\n\n/**\n * Trait responsible for runtime parsing errors.\n */\nexport class ErrorHandler {\n _errors: IRecognitionException[];\n errorMessageProvider: IParserErrorMessageProvider;\n\n initErrorHandler(config: IParserConfig) {\n this._errors = [];\n this.errorMessageProvider = has(config, \"errorMessageProvider\")\n ? (config.errorMessageProvider as IParserErrorMessageProvider) // assumes end user provides the correct config value/type\n : DEFAULT_PARSER_CONFIG.errorMessageProvider;\n }\n\n SAVE_ERROR(\n this: MixedInParser,\n error: IRecognitionException,\n ): IRecognitionException {\n if (isRecognitionException(error)) {\n error.context = {\n ruleStack: this.getHumanReadableRuleStack(),\n ruleOccurrenceStack: clone(this.RULE_OCCURRENCE_STACK),\n };\n this._errors.push(error);\n return error;\n } else {\n throw Error(\n \"Trying to save an Error which is not a RecognitionException\",\n );\n }\n }\n\n get errors(): IRecognitionException[] {\n return clone(this._errors);\n }\n\n set errors(newErrors: IRecognitionException[]) {\n this._errors = newErrors;\n }\n\n // TODO: consider caching the error message computed information\n raiseEarlyExitException(\n this: MixedInParser,\n occurrence: number,\n prodType: PROD_TYPE,\n userDefinedErrMsg: string | undefined,\n ): never {\n const ruleName = this.getCurrRuleFullName();\n const ruleGrammar = this.getGAstProductions()[ruleName];\n const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(\n occurrence,\n ruleGrammar,\n prodType,\n this.maxLookahead,\n );\n const insideProdPaths = lookAheadPathsPerAlternative[0];\n const actualTokens = [];\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i));\n }\n const msg = this.errorMessageProvider.buildEarlyExitMessage({\n expectedIterationPaths: insideProdPaths,\n actual: actualTokens,\n previous: this.LA(0),\n customUserDescription: userDefinedErrMsg,\n ruleName: ruleName,\n });\n\n throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0)));\n }\n\n // TODO: consider caching the error message computed information\n raiseNoAltException(\n this: MixedInParser,\n occurrence: number,\n errMsgTypes: string | undefined,\n ): never {\n const ruleName = this.getCurrRuleFullName();\n const ruleGrammar = this.getGAstProductions()[ruleName];\n // TODO: getLookaheadPathsForOr can be slow for large enough maxLookahead and certain grammars, consider caching ?\n const lookAheadPathsPerAlternative = getLookaheadPathsForOr(\n occurrence,\n ruleGrammar,\n this.maxLookahead,\n );\n\n const actualTokens = [];\n for (let i = 1; i <= this.maxLookahead; i++) {\n actualTokens.push(this.LA(i));\n }\n const previousToken = this.LA(0);\n\n const errMsg = this.errorMessageProvider.buildNoViableAltMessage({\n expectedPathsPerAlt: lookAheadPathsPerAlternative,\n actual: actualTokens,\n previous: previousToken,\n customUserDescription: errMsgTypes,\n ruleName: this.getCurrRuleFullName(),\n });\n\n throw this.SAVE_ERROR(\n new NoViableAltException(errMsg, this.LA(1), previousToken),\n );\n }\n}\n", "import {\n ISyntacticContentAssistPath,\n IToken,\n ITokenGrammarPath,\n TokenType,\n} from \"@chevrotain/types\";\nimport {\n NextAfterTokenWalker,\n nextPossibleTokensAfter,\n} from \"../../grammar/interpreter.js\";\nimport { first, isUndefined } from \"lodash-es\";\nimport { MixedInParser } from \"./parser_traits.js\";\n\nexport class ContentAssist {\n initContentAssist() {}\n\n public computeContentAssist(\n this: MixedInParser,\n startRuleName: string,\n precedingInput: IToken[],\n ): ISyntacticContentAssistPath[] {\n const startRuleGast = this.gastProductionsCache[startRuleName];\n\n if (isUndefined(startRuleGast)) {\n throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`);\n }\n\n return nextPossibleTokensAfter(\n [startRuleGast],\n precedingInput,\n this.tokenMatcher,\n this.maxLookahead,\n );\n }\n\n // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...\n // TODO: should this be more explicitly part of the public API?\n public getNextPossibleTokenTypes(\n this: MixedInParser,\n grammarPath: ITokenGrammarPath,\n ): TokenType[] {\n const topRuleName = first(grammarPath.ruleStack)!;\n const gastProductions = this.getGAstProductions();\n const topProduction = gastProductions[topRuleName];\n const nextPossibleTokenTypes = new NextAfterTokenWalker(\n topProduction,\n grammarPath,\n ).startWalking();\n return nextPossibleTokenTypes;\n }\n}\n", "import {\n AtLeastOneSepMethodOpts,\n ConsumeMethodOpts,\n CstNode,\n DSLMethodOpts,\n DSLMethodOptsWithErr,\n GrammarAction,\n IOrAlt,\n IParserConfig,\n IProduction,\n IToken,\n ManySepMethodOpts,\n OrMethodOpts,\n SubruleMethodOpts,\n TokenType,\n} from \"@chevrotain/types\";\nimport {\n forEach,\n has,\n isArray,\n isFunction,\n last as peek,\n some,\n} from \"lodash-es\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport {\n Alternation,\n Alternative,\n NonTerminal,\n Option,\n Repetition,\n RepetitionMandatory,\n RepetitionMandatoryWithSeparator,\n RepetitionWithSeparator,\n Rule,\n Terminal,\n} from \"@chevrotain/gast\";\nimport { Lexer } from \"../../../scan/lexer_public.js\";\nimport {\n augmentTokenTypes,\n hasShortKeyProperty,\n} from \"../../../scan/tokens.js\";\nimport {\n createToken,\n createTokenInstance,\n} from \"../../../scan/tokens_public.js\";\nimport { END_OF_FILE } from \"../parser.js\";\nimport { BITS_FOR_OCCURRENCE_IDX } from \"../../grammar/keys.js\";\nimport { ParserMethodInternal } from \"../types.js\";\n\ntype ProdWithDef = IProduction & { definition?: IProduction[] };\nconst RECORDING_NULL_OBJECT = {\n description: \"This Object indicates the Parser is during Recording Phase\",\n};\nObject.freeze(RECORDING_NULL_OBJECT);\n\nconst HANDLE_SEPARATOR = true;\nconst MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1;\n\nconst RFT = createToken({ name: \"RECORDING_PHASE_TOKEN\", pattern: Lexer.NA });\naugmentTokenTypes([RFT]);\nconst RECORDING_PHASE_TOKEN = createTokenInstance(\n RFT,\n \"This IToken indicates the Parser is in Recording Phase\\n\\t\" +\n \"\" +\n \"See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details\",\n // Using \"-1\" instead of NaN (as in EOF) because an actual number is less likely to\n // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n);\nObject.freeze(RECORDING_PHASE_TOKEN);\n\nconst RECORDING_PHASE_CSTNODE: CstNode = {\n name:\n \"This CSTNode indicates the Parser is in Recording Phase\\n\\t\" +\n \"See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details\",\n children: {},\n};\n\n/**\n * This trait handles the creation of the GAST structure for Chevrotain Grammars\n */\nexport class GastRecorder {\n recordingProdStack: ProdWithDef[];\n RECORDING_PHASE: boolean;\n\n initGastRecorder(this: MixedInParser, config: IParserConfig): void {\n this.recordingProdStack = [];\n this.RECORDING_PHASE = false;\n }\n\n enableRecording(this: MixedInParser): void {\n this.RECORDING_PHASE = true;\n\n this.TRACE_INIT(\"Enable Recording\", () => {\n /**\n * Warning Dark Voodoo Magic upcoming!\n * We are \"replacing\" the public parsing DSL methods API\n * With **new** alternative implementations on the Parser **instance**\n *\n * So far this is the only way I've found to avoid performance regressions during parsing time.\n * - Approx 30% performance regression was measured on Chrome 75 Canary when attempting to replace the \"internal\"\n * implementations directly instead.\n */\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : \"\";\n this[`CONSUME${idx}` as \"CONSUME\"] = function (arg1, arg2) {\n return this.consumeInternalRecord(arg1, i, arg2);\n };\n this[`SUBRULE${idx}` as \"SUBRULE\"] = function (arg1, arg2) {\n return this.subruleInternalRecord(arg1, i, arg2) as any;\n };\n this[`OPTION${idx}` as \"OPTION\"] = function (arg1) {\n return this.optionInternalRecord(arg1, i);\n };\n this[`OR${idx}` as \"OR\"] = function (arg1) {\n return this.orInternalRecord(arg1, i);\n };\n this[`MANY${idx}` as \"MANY\"] = function (arg1) {\n this.manyInternalRecord(i, arg1);\n };\n this[`MANY_SEP${idx}` as \"MANY_SEP\"] = function (arg1) {\n this.manySepFirstInternalRecord(i, arg1);\n };\n this[`AT_LEAST_ONE${idx}` as \"AT_LEAST_ONE\"] = function (arg1) {\n this.atLeastOneInternalRecord(i, arg1);\n };\n this[`AT_LEAST_ONE_SEP${idx}` as \"AT_LEAST_ONE_SEP\"] = function (arg1) {\n this.atLeastOneSepFirstInternalRecord(i, arg1);\n };\n }\n\n // DSL methods with the idx(suffix) as an argument\n this[`consume`] = function (idx, arg1, arg2) {\n return this.consumeInternalRecord(arg1, idx, arg2);\n };\n this[`subrule`] = function (idx, arg1, arg2) {\n return this.subruleInternalRecord(arg1, idx, arg2) as any;\n };\n this[`option`] = function (idx, arg1) {\n return this.optionInternalRecord(arg1, idx);\n };\n this[`or`] = function (idx, arg1) {\n return this.orInternalRecord(arg1, idx);\n };\n this[`many`] = function (idx, arg1) {\n this.manyInternalRecord(idx, arg1);\n };\n this[`atLeastOne`] = function (idx, arg1) {\n this.atLeastOneInternalRecord(idx, arg1);\n };\n\n this.ACTION = this.ACTION_RECORD;\n this.BACKTRACK = this.BACKTRACK_RECORD;\n this.LA = this.LA_RECORD;\n });\n }\n\n disableRecording(this: MixedInParser) {\n this.RECORDING_PHASE = false;\n // By deleting these **instance** properties, any future invocation\n // will be deferred to the original methods on the **prototype** object\n // This seems to get rid of any incorrect optimizations that V8 may\n // do during the recording phase.\n this.TRACE_INIT(\"Deleting Recording methods\", () => {\n const that: any = this;\n\n for (let i = 0; i < 10; i++) {\n const idx = i > 0 ? i : \"\";\n delete that[`CONSUME${idx}`];\n delete that[`SUBRULE${idx}`];\n delete that[`OPTION${idx}`];\n delete that[`OR${idx}`];\n delete that[`MANY${idx}`];\n delete that[`MANY_SEP${idx}`];\n delete that[`AT_LEAST_ONE${idx}`];\n delete that[`AT_LEAST_ONE_SEP${idx}`];\n }\n\n delete that[`consume`];\n delete that[`subrule`];\n delete that[`option`];\n delete that[`or`];\n delete that[`many`];\n delete that[`atLeastOne`];\n\n delete that.ACTION;\n delete that.BACKTRACK;\n delete that.LA;\n });\n }\n\n // Parser methods are called inside an ACTION?\n // Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?\n // @ts-expect-error -- noop place holder\n ACTION_RECORD(this: MixedInParser, impl: () => T): T {\n // NO-OP during recording\n }\n\n // Executing backtracking logic will break our recording logic assumptions\n BACKTRACK_RECORD(\n grammarRule: (...args: any[]) => T,\n args?: any[],\n ): () => boolean {\n return () => true;\n }\n\n // LA is part of the official API and may be used for custom lookahead logic\n // by end users who may forget to wrap it in ACTION or inside a GATE\n LA_RECORD(howMuch: number): IToken {\n // We cannot use the RECORD_PHASE_TOKEN here because someone may depend\n // On LA return EOF at the end of the input so an infinite loop may occur.\n return END_OF_FILE;\n }\n\n topLevelRuleRecord(name: string, def: Function): Rule {\n try {\n const newTopLevelRule = new Rule({ definition: [], name: name });\n newTopLevelRule.name = name;\n this.recordingProdStack.push(newTopLevelRule);\n def.call(this);\n this.recordingProdStack.pop();\n return newTopLevelRule;\n } catch (originalError) {\n if (originalError.KNOWN_RECORDER_ERROR !== true) {\n try {\n originalError.message =\n originalError.message +\n '\\n\\t This error was thrown during the \"grammar recording phase\" For more info see:\\n\\t' +\n \"https://chevrotain.io/docs/guide/internals.html#grammar-recording\";\n } catch (mutabilityError) {\n // We may not be able to modify the original error object\n throw originalError;\n }\n }\n throw originalError;\n }\n }\n\n // Implementation of parsing DSL\n optionInternalRecord(\n this: MixedInParser,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n occurrence: number,\n ): OUT {\n return recordProd.call(this, Option, actionORMethodDef, occurrence);\n }\n\n atLeastOneInternalRecord(\n this: MixedInParser,\n occurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOptsWithErr,\n ): void {\n recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence);\n }\n\n atLeastOneSepFirstInternalRecord(\n this: MixedInParser,\n occurrence: number,\n options: AtLeastOneSepMethodOpts,\n ): void {\n recordProd.call(\n this,\n RepetitionMandatoryWithSeparator,\n options,\n occurrence,\n HANDLE_SEPARATOR,\n );\n }\n\n manyInternalRecord(\n this: MixedInParser,\n occurrence: number,\n actionORMethodDef: GrammarAction | DSLMethodOpts,\n ): void {\n recordProd.call(this, Repetition, actionORMethodDef, occurrence);\n }\n\n manySepFirstInternalRecord(\n this: MixedInParser,\n occurrence: number,\n options: ManySepMethodOpts,\n ): void {\n recordProd.call(\n this,\n RepetitionWithSeparator,\n options,\n occurrence,\n HANDLE_SEPARATOR,\n );\n }\n\n orInternalRecord(\n this: MixedInParser,\n altsOrOpts: IOrAlt[] | OrMethodOpts,\n occurrence: number,\n ): T {\n return recordOrProd.call(this, altsOrOpts, occurrence);\n }\n\n subruleInternalRecord(\n this: MixedInParser,\n ruleToCall: ParserMethodInternal,\n occurrence: number,\n options?: SubruleMethodOpts,\n ): R | CstNode {\n assertMethodIdxIsValid(occurrence);\n if (!ruleToCall || has(ruleToCall, \"ruleName\") === false) {\n const error: any = new Error(\n ` argument is invalid` +\n ` expecting a Parser method reference but got: <${JSON.stringify(\n ruleToCall,\n )}>` +\n `\\n inside top level rule: <${\n (this.recordingProdStack[0]).name\n }>`,\n );\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n\n const prevProd: any = peek(this.recordingProdStack);\n const ruleName = ruleToCall.ruleName;\n const newNoneTerminal = new NonTerminal({\n idx: occurrence,\n nonTerminalName: ruleName,\n label: options?.LABEL,\n // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created\n referencedRule: undefined,\n });\n prevProd.definition.push(newNoneTerminal);\n\n return this.outputCst\n ? RECORDING_PHASE_CSTNODE\n : RECORDING_NULL_OBJECT;\n }\n\n consumeInternalRecord(\n this: MixedInParser,\n tokType: TokenType,\n occurrence: number,\n options?: ConsumeMethodOpts,\n ): IToken {\n assertMethodIdxIsValid(occurrence);\n if (!hasShortKeyProperty(tokType)) {\n const error: any = new Error(\n ` argument is invalid` +\n ` expecting a TokenType reference but got: <${JSON.stringify(\n tokType,\n )}>` +\n `\\n inside top level rule: <${\n (this.recordingProdStack[0]).name\n }>`,\n );\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n const prevProd: any = peek(this.recordingProdStack);\n const newNoneTerminal = new Terminal({\n idx: occurrence,\n terminalType: tokType,\n label: options?.LABEL,\n });\n prevProd.definition.push(newNoneTerminal);\n\n return RECORDING_PHASE_TOKEN;\n }\n}\n\nfunction recordProd(\n prodConstructor: any,\n mainProdArg: any,\n occurrence: number,\n handleSep: boolean = false,\n): any {\n assertMethodIdxIsValid(occurrence);\n const prevProd: any = peek(this.recordingProdStack);\n const grammarAction = isFunction(mainProdArg) ? mainProdArg : mainProdArg.DEF;\n\n const newProd = new prodConstructor({ definition: [], idx: occurrence });\n if (handleSep) {\n newProd.separator = mainProdArg.SEP;\n }\n if (has(mainProdArg, \"MAX_LOOKAHEAD\")) {\n newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;\n }\n\n this.recordingProdStack.push(newProd);\n grammarAction.call(this);\n prevProd.definition.push(newProd);\n this.recordingProdStack.pop();\n\n return RECORDING_NULL_OBJECT;\n}\n\nfunction recordOrProd(mainProdArg: any, occurrence: number): any {\n assertMethodIdxIsValid(occurrence);\n const prevProd: any = peek(this.recordingProdStack);\n // Only an array of alternatives\n const hasOptions = isArray(mainProdArg) === false;\n const alts: IOrAlt[] =\n hasOptions === false ? mainProdArg : mainProdArg.DEF;\n\n const newOrProd = new Alternation({\n definition: [],\n idx: occurrence,\n ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true,\n });\n if (has(mainProdArg, \"MAX_LOOKAHEAD\")) {\n newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;\n }\n\n const hasPredicates = some(alts, (currAlt: any) => isFunction(currAlt.GATE));\n newOrProd.hasPredicates = hasPredicates;\n\n prevProd.definition.push(newOrProd);\n\n forEach(alts, (currAlt) => {\n const currAltFlat = new Alternative({ definition: [] });\n newOrProd.definition.push(currAltFlat);\n if (has(currAlt, \"IGNORE_AMBIGUITIES\")) {\n currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES as boolean; // assumes end user provides the correct config value/type\n }\n // **implicit** ignoreAmbiguities due to usage of gate\n else if (has(currAlt, \"GATE\")) {\n currAltFlat.ignoreAmbiguities = true;\n }\n this.recordingProdStack.push(currAltFlat);\n currAlt.ALT.call(this);\n this.recordingProdStack.pop();\n });\n return RECORDING_NULL_OBJECT;\n}\n\nfunction getIdxSuffix(idx: number): string {\n return idx === 0 ? \"\" : `${idx}`;\n}\n\nfunction assertMethodIdxIsValid(idx: number): void {\n if (idx < 0 || idx > MAX_METHOD_IDX) {\n const error: any = new Error(\n // The stack trace will contain all the needed details\n `Invalid DSL Method idx value: <${idx}>\\n\\t` +\n `Idx value must be a none negative value smaller than ${\n MAX_METHOD_IDX + 1\n }`,\n );\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n}\n", "import { IParserConfig } from \"@chevrotain/types\";\nimport { has } from \"lodash-es\";\nimport { timer } from \"@chevrotain/utils\";\nimport { MixedInParser } from \"./parser_traits.js\";\nimport { DEFAULT_PARSER_CONFIG } from \"../parser.js\";\n\n/**\n * Trait responsible for runtime parsing errors.\n */\nexport class PerformanceTracer {\n traceInitPerf: boolean | number;\n traceInitMaxIdent: number;\n traceInitIndent: number;\n\n initPerformanceTracer(config: IParserConfig) {\n if (has(config, \"traceInitPerf\")) {\n const userTraceInitPerf = config.traceInitPerf;\n const traceIsNumber = typeof userTraceInitPerf === \"number\";\n this.traceInitMaxIdent = traceIsNumber\n ? userTraceInitPerf\n : Infinity;\n this.traceInitPerf = traceIsNumber\n ? userTraceInitPerf > 0\n : (userTraceInitPerf as boolean); // assumes end user provides the correct config value/type\n } else {\n this.traceInitMaxIdent = 0;\n this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf;\n }\n\n this.traceInitIndent = -1;\n }\n\n TRACE_INIT(this: MixedInParser, phaseDesc: string, phaseImpl: () => T): T {\n // No need to optimize this using NOOP pattern because\n // It is not called in a hot spot...\n if (this.traceInitPerf === true) {\n this.traceInitIndent++;\n const indent = new Array(this.traceInitIndent + 1).join(\"\\t\");\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(`${indent}--> <${phaseDesc}>`);\n }\n const { time, value } = timer(phaseImpl);\n /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */\n const traceMethod = time > 10 ? console.warn : console.log;\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`);\n }\n this.traceInitIndent--;\n return value;\n } else {\n return phaseImpl();\n }\n }\n}\n", "export function applyMixins(derivedCtor: any, baseCtors: any[]) {\n baseCtors.forEach((baseCtor) => {\n const baseProto = baseCtor.prototype;\n Object.getOwnPropertyNames(baseProto).forEach((propName) => {\n if (propName === \"constructor\") {\n return;\n }\n\n const basePropDescriptor = Object.getOwnPropertyDescriptor(\n baseProto,\n propName,\n );\n // Handle Accessors\n if (\n basePropDescriptor &&\n (basePropDescriptor.get || basePropDescriptor.set)\n ) {\n Object.defineProperty(\n derivedCtor.prototype,\n propName,\n basePropDescriptor,\n );\n } else {\n derivedCtor.prototype[propName] = baseCtor.prototype[propName];\n }\n });\n });\n}\n", "import { clone, forEach, has, isEmpty, map, values } from \"lodash-es\";\nimport { toFastProperties } from \"@chevrotain/utils\";\nimport { computeAllProdsFollows } from \"../grammar/follow.js\";\nimport { createTokenInstance, EOF } from \"../../scan/tokens_public.js\";\nimport {\n defaultGrammarValidatorErrorProvider,\n defaultParserErrorProvider,\n} from \"../errors_public.js\";\nimport {\n resolveGrammar,\n validateGrammar,\n} from \"../grammar/gast/gast_resolver_public.js\";\nimport {\n CstNode,\n IParserConfig,\n IRecognitionException,\n IRuleConfig,\n IToken,\n TokenType,\n TokenVocabulary,\n} from \"@chevrotain/types\";\nimport { Recoverable } from \"./traits/recoverable.js\";\nimport { LooksAhead } from \"./traits/looksahead.js\";\nimport { TreeBuilder } from \"./traits/tree_builder.js\";\nimport { LexerAdapter } from \"./traits/lexer_adapter.js\";\nimport { RecognizerApi } from \"./traits/recognizer_api.js\";\nimport { RecognizerEngine } from \"./traits/recognizer_engine.js\";\n\nimport { ErrorHandler } from \"./traits/error_handler.js\";\nimport { MixedInParser } from \"./traits/parser_traits.js\";\nimport { ContentAssist } from \"./traits/context_assist.js\";\nimport { GastRecorder } from \"./traits/gast_recorder.js\";\nimport { PerformanceTracer } from \"./traits/perf_tracer.js\";\nimport { applyMixins } from \"./utils/apply_mixins.js\";\nimport { IParserDefinitionError } from \"../grammar/types.js\";\nimport { Rule } from \"@chevrotain/gast\";\nimport { IParserConfigInternal, ParserMethodInternal } from \"./types.js\";\nimport { validateLookahead } from \"../grammar/checks.js\";\n\nexport const END_OF_FILE = createTokenInstance(\n EOF,\n \"\",\n NaN,\n NaN,\n NaN,\n NaN,\n NaN,\n NaN,\n);\nObject.freeze(END_OF_FILE);\n\nexport type TokenMatcher = (token: IToken, tokType: TokenType) => boolean;\n\nexport const DEFAULT_PARSER_CONFIG: Required<\n Omit\n> = Object.freeze({\n recoveryEnabled: false,\n maxLookahead: 3,\n dynamicTokensEnabled: false,\n outputCst: true,\n errorMessageProvider: defaultParserErrorProvider,\n nodeLocationTracking: \"none\",\n traceInitPerf: false,\n skipValidations: false,\n});\n\nexport const DEFAULT_RULE_CONFIG: Required> = Object.freeze({\n recoveryValueFunc: () => undefined,\n resyncEnabled: true,\n});\n\nexport enum ParserDefinitionErrorType {\n INVALID_RULE_NAME = 0,\n DUPLICATE_RULE_NAME = 1,\n INVALID_RULE_OVERRIDE = 2,\n DUPLICATE_PRODUCTIONS = 3,\n UNRESOLVED_SUBRULE_REF = 4,\n LEFT_RECURSION = 5,\n NONE_LAST_EMPTY_ALT = 6,\n AMBIGUOUS_ALTS = 7,\n CONFLICT_TOKENS_RULES_NAMESPACE = 8,\n INVALID_TOKEN_NAME = 9,\n NO_NON_EMPTY_LOOKAHEAD = 10,\n AMBIGUOUS_PREFIX_ALTS = 11,\n TOO_MANY_ALTS = 12,\n CUSTOM_LOOKAHEAD_VALIDATION = 13,\n}\n\nexport interface IParserDuplicatesDefinitionError\n extends IParserDefinitionError {\n dslName: string;\n occurrence: number;\n parameter?: string;\n}\n\nexport interface IParserEmptyAlternativeDefinitionError\n extends IParserDefinitionError {\n occurrence: number;\n alternative: number;\n}\n\nexport interface IParserAmbiguousAlternativesDefinitionError\n extends IParserDefinitionError {\n occurrence: number | string;\n alternatives: number[];\n}\n\nexport interface IParserUnresolvedRefDefinitionError\n extends IParserDefinitionError {\n unresolvedRefName: string;\n}\n\nexport interface IParserState {\n errors: IRecognitionException[];\n lexerState: any;\n RULE_STACK: number[];\n CST_STACK: CstNode[];\n}\n\nexport type Predicate = () => boolean;\n\nexport function EMPTY_ALT(): () => undefined;\nexport function EMPTY_ALT(value: T): () => T;\nexport function EMPTY_ALT(value: any = undefined) {\n return function () {\n return value;\n };\n}\n\nexport class Parser {\n // Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected.\n // (normally during the parser's constructor).\n // This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors,\n // for example: duplicate rule names, referencing an unresolved subrule, ect...\n // This flag should not be enabled during normal usage, it is used in special situations, for example when\n // needing to display the parser definition errors in some GUI(online playground).\n static DEFER_DEFINITION_ERRORS_HANDLING: boolean = false;\n\n /**\n * @deprecated use the **instance** method with the same name instead\n */\n static performSelfAnalysis(parserInstance: Parser): void {\n throw Error(\n \"The **static** `performSelfAnalysis` method has been deprecated.\" +\n \"\\t\\nUse the **instance** method with the same name instead.\",\n );\n }\n\n public performSelfAnalysis(this: MixedInParser): void {\n this.TRACE_INIT(\"performSelfAnalysis\", () => {\n let defErrorsMsgs;\n\n this.selfAnalysisDone = true;\n const className = this.className;\n\n this.TRACE_INIT(\"toFastProps\", () => {\n // Without this voodoo magic the parser would be x3-x4 slower\n // It seems it is better to invoke `toFastProperties` **before**\n // Any manipulations of the `this` object done during the recording phase.\n toFastProperties(this);\n });\n\n this.TRACE_INIT(\"Grammar Recording\", () => {\n try {\n this.enableRecording();\n // Building the GAST\n forEach(this.definedRulesNames, (currRuleName) => {\n const wrappedRule = (this as any)[\n currRuleName\n ] as ParserMethodInternal;\n const originalGrammarAction = wrappedRule[\"originalGrammarAction\"];\n let recordedRuleGast!: Rule;\n this.TRACE_INIT(`${currRuleName} Rule`, () => {\n recordedRuleGast = this.topLevelRuleRecord(\n currRuleName,\n originalGrammarAction,\n );\n });\n this.gastProductionsCache[currRuleName] = recordedRuleGast;\n });\n } finally {\n this.disableRecording();\n }\n });\n\n let resolverErrors: IParserDefinitionError[] = [];\n this.TRACE_INIT(\"Grammar Resolving\", () => {\n resolverErrors = resolveGrammar({\n rules: values(this.gastProductionsCache),\n });\n this.definitionErrors = this.definitionErrors.concat(resolverErrors);\n });\n\n this.TRACE_INIT(\"Grammar Validations\", () => {\n // only perform additional grammar validations IFF no resolving errors have occurred.\n // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations.\n if (isEmpty(resolverErrors) && this.skipValidations === false) {\n const validationErrors = validateGrammar({\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n errMsgProvider: defaultGrammarValidatorErrorProvider,\n grammarName: className,\n });\n const lookaheadValidationErrors = validateLookahead({\n lookaheadStrategy: this.lookaheadStrategy,\n rules: values(this.gastProductionsCache),\n tokenTypes: values(this.tokensMap),\n grammarName: className,\n });\n this.definitionErrors = this.definitionErrors.concat(\n validationErrors,\n lookaheadValidationErrors,\n );\n }\n });\n\n // this analysis may fail if the grammar is not perfectly valid\n if (isEmpty(this.definitionErrors)) {\n // The results of these computations are not needed unless error recovery is enabled.\n if (this.recoveryEnabled) {\n this.TRACE_INIT(\"computeAllProdsFollows\", () => {\n const allFollows = computeAllProdsFollows(\n values(this.gastProductionsCache),\n );\n this.resyncFollows = allFollows;\n });\n }\n\n this.TRACE_INIT(\"ComputeLookaheadFunctions\", () => {\n this.lookaheadStrategy.initialize?.({\n rules: values(this.gastProductionsCache),\n });\n this.preComputeLookaheadFunctions(values(this.gastProductionsCache));\n });\n }\n\n if (\n !Parser.DEFER_DEFINITION_ERRORS_HANDLING &&\n !isEmpty(this.definitionErrors)\n ) {\n defErrorsMsgs = map(\n this.definitionErrors,\n (defError) => defError.message,\n );\n throw new Error(\n `Parser Definition Errors detected:\\n ${defErrorsMsgs.join(\n \"\\n-------------------------------\\n\",\n )}`,\n );\n }\n });\n }\n\n definitionErrors: IParserDefinitionError[] = [];\n selfAnalysisDone = false;\n protected skipValidations: boolean;\n\n constructor(tokenVocabulary: TokenVocabulary, config: IParserConfig) {\n const that: MixedInParser = this as any;\n that.initErrorHandler(config);\n that.initLexerAdapter();\n that.initLooksAhead(config);\n that.initRecognizerEngine(tokenVocabulary, config);\n that.initRecoverable(config);\n that.initTreeBuilder(config);\n that.initContentAssist();\n that.initGastRecorder(config);\n that.initPerformanceTracer(config);\n\n if (has(config, \"ignoredIssues\")) {\n throw new Error(\n \"The IParserConfig property has been deprecated.\\n\\t\" +\n \"Please use the flag on the relevant DSL method instead.\\n\\t\" +\n \"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\\n\\t\" +\n \"For further details.\",\n );\n }\n\n this.skipValidations = has(config, \"skipValidations\")\n ? (config.skipValidations as boolean) // casting assumes the end user passing the correct type\n : DEFAULT_PARSER_CONFIG.skipValidations;\n }\n}\n\napplyMixins(Parser, [\n Recoverable,\n LooksAhead,\n TreeBuilder,\n LexerAdapter,\n RecognizerEngine,\n RecognizerApi,\n ErrorHandler,\n ContentAssist,\n GastRecorder,\n PerformanceTracer,\n]);\n\nexport class CstParser extends Parser {\n constructor(\n tokenVocabulary: TokenVocabulary,\n config: IParserConfigInternal = DEFAULT_PARSER_CONFIG,\n ) {\n const configClone = clone(config);\n configClone.outputCst = true;\n super(tokenVocabulary, configClone);\n }\n}\n\nexport class EmbeddedActionsParser extends Parser {\n constructor(\n tokenVocabulary: TokenVocabulary,\n config: IParserConfigInternal = DEFAULT_PARSER_CONFIG,\n ) {\n const configClone = clone(config);\n configClone.outputCst = false;\n super(tokenVocabulary, configClone);\n }\n}\n", "/******************************************************************************\r\n * Copyright 2022 TypeFox GmbH\r\n * This program and the accompanying materials are made available under the\r\n * terms of the MIT License, which is available in the project root.\r\n ******************************************************************************/\r\n\r\nimport map from \"lodash-es/map.js\"\r\nimport filter from \"lodash-es/filter.js\"\r\nimport {\r\n IProduction,\r\n IProductionWithOccurrence,\r\n TokenType,\r\n Alternation,\r\n NonTerminal,\r\n Rule,\r\n Option,\r\n RepetitionMandatory,\r\n Repetition,\r\n Terminal,\r\n Alternative,\r\n RepetitionWithSeparator,\r\n RepetitionMandatoryWithSeparator,\r\n LookaheadProductionType\r\n} from \"chevrotain\"\r\n\r\nexport function buildATNKey(rule: Rule, type: LookaheadProductionType, occurrence: number): string {\r\n return `${rule.name}_${type}_${occurrence}`;\r\n}\r\n\r\nexport interface ATN {\r\n decisionMap: Record\r\n states: ATNState[]\r\n decisionStates: DecisionState[]\r\n ruleToStartState: Map\r\n ruleToStopState: Map\r\n}\r\n\r\nexport const ATN_INVALID_TYPE = 0\r\nexport const ATN_BASIC = 1\r\nexport const ATN_RULE_START = 2\r\nexport const ATN_PLUS_BLOCK_START = 4\r\nexport const ATN_STAR_BLOCK_START = 5\r\n// Currently unused as the ATN is not used for lexing\r\nexport const ATN_TOKEN_START = 6\r\nexport const ATN_RULE_STOP = 7\r\nexport const ATN_BLOCK_END = 8\r\nexport const ATN_STAR_LOOP_BACK = 9\r\nexport const ATN_STAR_LOOP_ENTRY = 10\r\nexport const ATN_PLUS_LOOP_BACK = 11\r\nexport const ATN_LOOP_END = 12\r\n\r\nexport type ATNState =\r\n | BasicState\r\n | BasicBlockStartState\r\n | PlusBlockStartState\r\n | PlusLoopbackState\r\n | StarBlockStartState\r\n | StarLoopbackState\r\n | StarLoopEntryState\r\n | BlockEndState\r\n | RuleStartState\r\n | RuleStopState\r\n | LoopEndState\r\n\r\nexport interface ATNBaseState {\r\n atn: ATN\r\n production: IProductionWithOccurrence\r\n stateNumber: number\r\n rule: Rule\r\n epsilonOnlyTransitions: boolean\r\n transitions: Transition[]\r\n nextTokenWithinRule: number[]\r\n}\r\n\r\nexport interface BasicState extends ATNBaseState {\r\n type: typeof ATN_BASIC\r\n}\r\n\r\nexport interface BlockStartState extends DecisionState {\r\n end: BlockEndState\r\n}\r\n\r\nexport interface BasicBlockStartState extends BlockStartState {\r\n type: typeof ATN_BASIC\r\n}\r\n\r\nexport interface PlusBlockStartState extends BlockStartState {\r\n loopback: PlusLoopbackState\r\n type: typeof ATN_PLUS_BLOCK_START\r\n}\r\n\r\nexport interface PlusLoopbackState extends DecisionState {\r\n type: typeof ATN_PLUS_LOOP_BACK\r\n}\r\n\r\nexport interface StarBlockStartState extends BlockStartState {\r\n type: typeof ATN_STAR_BLOCK_START\r\n}\r\n\r\nexport interface StarLoopbackState extends ATNBaseState {\r\n type: typeof ATN_STAR_LOOP_BACK\r\n}\r\n\r\nexport interface StarLoopEntryState extends DecisionState {\r\n loopback: StarLoopbackState\r\n type: typeof ATN_STAR_LOOP_ENTRY\r\n}\r\n\r\nexport interface BlockEndState extends ATNBaseState {\r\n start: BlockStartState\r\n type: typeof ATN_BLOCK_END\r\n}\r\n\r\nexport interface DecisionState extends ATNBaseState {\r\n decision: number\r\n}\r\n\r\nexport interface LoopEndState extends ATNBaseState {\r\n loopback: ATNState\r\n type: typeof ATN_LOOP_END\r\n}\r\n\r\nexport interface RuleStartState extends ATNBaseState {\r\n stop: RuleStopState\r\n type: typeof ATN_RULE_START\r\n}\r\n\r\nexport interface RuleStopState extends ATNBaseState {\r\n type: typeof ATN_RULE_STOP\r\n}\r\n\r\nexport interface Transition {\r\n target: ATNState\r\n isEpsilon(): boolean\r\n}\r\n\r\nexport abstract class AbstractTransition implements Transition {\r\n target: ATNState\r\n\r\n constructor(target: ATNState) {\r\n this.target = target\r\n }\r\n\r\n isEpsilon() {\r\n return false\r\n }\r\n}\r\n\r\nexport class AtomTransition extends AbstractTransition {\r\n tokenType: TokenType\r\n\r\n constructor(target: ATNState, tokenType: TokenType) {\r\n super(target)\r\n this.tokenType = tokenType\r\n }\r\n}\r\n\r\nexport class EpsilonTransition extends AbstractTransition {\r\n constructor(target: ATNState) {\r\n super(target)\r\n }\r\n\r\n isEpsilon() {\r\n return true\r\n }\r\n}\r\n\r\nexport class RuleTransition extends AbstractTransition {\r\n rule: Rule\r\n followState: ATNState\r\n\r\n constructor(ruleStart: RuleStartState, rule: Rule, followState: ATNState) {\r\n super(ruleStart)\r\n this.rule = rule\r\n this.followState = followState\r\n }\r\n\r\n isEpsilon() {\r\n return true\r\n }\r\n}\r\n\r\ninterface ATNHandle {\r\n left: ATNState\r\n right: ATNState\r\n}\r\n\r\nexport function createATN(rules: Rule[]): ATN {\r\n const atn: ATN = {\r\n decisionMap: {},\r\n decisionStates: [],\r\n ruleToStartState: new Map(),\r\n ruleToStopState: new Map(),\r\n states: []\r\n }\r\n createRuleStartAndStopATNStates(atn, rules)\r\n const ruleLength = rules.length\r\n for (let i = 0; i < ruleLength; i++) {\r\n const rule = rules[i]\r\n const ruleBlock = block(atn, rule, rule)\r\n if (ruleBlock === undefined) {\r\n continue\r\n }\r\n buildRuleHandle(atn, rule, ruleBlock)\r\n }\r\n return atn\r\n}\r\n\r\nfunction createRuleStartAndStopATNStates(atn: ATN, rules: Rule[]): void {\r\n const ruleLength = rules.length\r\n for (let i = 0; i < ruleLength; i++) {\r\n const rule = rules[i]\r\n const start = newState(atn, rule, undefined, {\r\n type: ATN_RULE_START\r\n })\r\n const stop = newState(atn, rule, undefined, {\r\n type: ATN_RULE_STOP\r\n })\r\n start.stop = stop\r\n atn.ruleToStartState.set(rule, start)\r\n atn.ruleToStopState.set(rule, stop)\r\n }\r\n}\r\n\r\nfunction atom(\r\n atn: ATN,\r\n rule: Rule,\r\n production: IProduction\r\n): ATNHandle | undefined {\r\n if (production instanceof Terminal) {\r\n return tokenRef(atn, rule, production.terminalType, production)\r\n } else if (production instanceof NonTerminal) {\r\n return ruleRef(atn, rule, production)\r\n } else if (production instanceof Alternation) {\r\n return alternation(atn, rule, production)\r\n } else if (production instanceof Option) {\r\n return option(atn, rule, production)\r\n } else if (production instanceof Repetition) {\r\n return repetition(atn, rule, production)\r\n } else if (production instanceof RepetitionWithSeparator) {\r\n return repetitionSep(atn, rule, production)\r\n } else if (production instanceof RepetitionMandatory) {\r\n return repetitionMandatory(atn, rule, production)\r\n } else if (production instanceof RepetitionMandatoryWithSeparator) {\r\n return repetitionMandatorySep(atn, rule, production)\r\n } else {\r\n return block(atn, rule, production as Alternative)\r\n }\r\n}\r\n\r\nfunction repetition(atn: ATN, rule: Rule, repetition: Repetition): ATNHandle {\r\n const starState = newState(atn, rule, repetition, {\r\n type: ATN_STAR_BLOCK_START\r\n })\r\n defineDecisionState(atn, starState)\r\n const handle = makeAlts(\r\n atn,\r\n rule,\r\n starState,\r\n repetition,\r\n block(atn, rule, repetition)\r\n )\r\n return star(atn, rule, repetition, handle)\r\n}\r\n\r\nfunction repetitionSep(\r\n atn: ATN,\r\n rule: Rule,\r\n repetition: RepetitionWithSeparator\r\n): ATNHandle {\r\n const starState = newState(atn, rule, repetition, {\r\n type: ATN_STAR_BLOCK_START\r\n })\r\n defineDecisionState(atn, starState)\r\n const handle = makeAlts(\r\n atn,\r\n rule,\r\n starState,\r\n repetition,\r\n block(atn, rule, repetition)\r\n )\r\n const sep = tokenRef(atn, rule, repetition.separator, repetition)\r\n return star(atn, rule, repetition, handle, sep)\r\n}\r\n\r\nfunction repetitionMandatory(\r\n atn: ATN,\r\n rule: Rule,\r\n repetition: RepetitionMandatory\r\n): ATNHandle {\r\n const plusState = newState(atn, rule, repetition, {\r\n type: ATN_PLUS_BLOCK_START\r\n })\r\n defineDecisionState(atn, plusState)\r\n const handle = makeAlts(\r\n atn,\r\n rule,\r\n plusState,\r\n repetition,\r\n block(atn, rule, repetition)\r\n )\r\n return plus(atn, rule, repetition, handle)\r\n}\r\n\r\nfunction repetitionMandatorySep(\r\n atn: ATN,\r\n rule: Rule,\r\n repetition: RepetitionMandatoryWithSeparator\r\n): ATNHandle {\r\n const plusState = newState(atn, rule, repetition, {\r\n type: ATN_PLUS_BLOCK_START\r\n })\r\n defineDecisionState(atn, plusState)\r\n const handle = makeAlts(\r\n atn,\r\n rule,\r\n plusState,\r\n repetition,\r\n block(atn, rule, repetition)\r\n )\r\n const sep = tokenRef(atn, rule, repetition.separator, repetition)\r\n return plus(atn, rule, repetition, handle, sep)\r\n}\r\n\r\nfunction alternation(\r\n atn: ATN,\r\n rule: Rule,\r\n alternation: Alternation\r\n): ATNHandle {\r\n const start = newState(atn, rule, alternation, {\r\n type: ATN_BASIC\r\n })\r\n defineDecisionState(atn, start)\r\n const alts = map(alternation.definition, (e) => atom(atn, rule, e))\r\n const handle = makeAlts(atn, rule, start, alternation, ...alts)\r\n return handle\r\n}\r\n\r\nfunction option(atn: ATN, rule: Rule, option: Option): ATNHandle {\r\n const start = newState(atn, rule, option, {\r\n type: ATN_BASIC\r\n })\r\n defineDecisionState(atn, start)\r\n const handle = makeAlts(atn, rule, start, option, block(atn, rule, option))\r\n return optional(atn, rule, option, handle)\r\n}\r\n\r\nfunction block(\r\n atn: ATN,\r\n rule: Rule,\r\n block: { definition: IProduction[] }\r\n): ATNHandle | undefined {\r\n const handles = filter(\r\n map(block.definition, (e) => atom(atn, rule, e)),\r\n (e) => e !== undefined\r\n ) as ATNHandle[]\r\n if (handles.length === 1) {\r\n return handles[0]\r\n } else if (handles.length === 0) {\r\n return undefined\r\n } else {\r\n return makeBlock(atn, handles)\r\n }\r\n}\r\n\r\nfunction plus(\r\n atn: ATN,\r\n rule: Rule,\r\n plus: IProductionWithOccurrence,\r\n handle: ATNHandle,\r\n sep?: ATNHandle\r\n): ATNHandle {\r\n const blkStart = handle.left as PlusBlockStartState\r\n const blkEnd = handle.right\r\n\r\n const loop = newState(atn, rule, plus, {\r\n type: ATN_PLUS_LOOP_BACK\r\n })\r\n defineDecisionState(atn, loop)\r\n const end = newState(atn, rule, plus, {\r\n type: ATN_LOOP_END\r\n })\r\n blkStart.loopback = loop\r\n end.loopback = loop\r\n atn.decisionMap[buildATNKey(rule, sep ? 'RepetitionMandatoryWithSeparator' : 'RepetitionMandatory', plus.idx)] = loop;\r\n epsilon(blkEnd, loop) // block can see loop back\r\n\r\n // Depending on whether we have a separator we put the exit transition at index 1 or 0\r\n // This influences the chosen option in the lookahead DFA\r\n if (sep === undefined) {\r\n epsilon(loop, blkStart) // loop back to start\r\n epsilon(loop, end) // exit\r\n } else {\r\n epsilon(loop, end) // exit\r\n // loop back to start with separator\r\n epsilon(loop, sep.left)\r\n epsilon(sep.right, blkStart)\r\n }\r\n\r\n return {\r\n left: blkStart,\r\n right: end\r\n }\r\n}\r\n\r\nfunction star(\r\n atn: ATN,\r\n rule: Rule,\r\n star: IProductionWithOccurrence,\r\n handle: ATNHandle,\r\n sep?: ATNHandle\r\n): ATNHandle {\r\n const start = handle.left\r\n const end = handle.right\r\n\r\n const entry = newState(atn, rule, star, {\r\n type: ATN_STAR_LOOP_ENTRY\r\n })\r\n defineDecisionState(atn, entry)\r\n const loopEnd = newState(atn, rule, star, {\r\n type: ATN_LOOP_END\r\n })\r\n const loop = newState(atn, rule, star, {\r\n type: ATN_STAR_LOOP_BACK\r\n })\r\n entry.loopback = loop\r\n loopEnd.loopback = loop\r\n\r\n epsilon(entry, start) // loop enter edge (alt 2)\r\n epsilon(entry, loopEnd) // bypass loop edge (alt 1)\r\n epsilon(end, loop) // block end hits loop back\r\n\r\n if (sep !== undefined) {\r\n epsilon(loop, loopEnd) // end loop\r\n // loop back to start of handle using separator\r\n epsilon(loop, sep.left)\r\n epsilon(sep.right, start)\r\n } else {\r\n epsilon(loop, entry) // loop back to entry/exit decision\r\n }\r\n\r\n atn.decisionMap[buildATNKey(rule, sep ? 'RepetitionWithSeparator' : 'Repetition', star.idx)] = entry;\r\n return {\r\n left: entry,\r\n right: loopEnd\r\n }\r\n}\r\n\r\nfunction optional(atn: ATN, rule: Rule, optional: Option, handle: ATNHandle): ATNHandle {\r\n const start = handle.left as DecisionState\r\n const end = handle.right\r\n\r\n epsilon(start, end)\r\n\r\n atn.decisionMap[buildATNKey(rule, 'Option', optional.idx)] = start;\r\n return handle\r\n}\r\n\r\nfunction defineDecisionState(atn: ATN, state: DecisionState): number {\r\n atn.decisionStates.push(state)\r\n state.decision = atn.decisionStates.length - 1\r\n return state.decision\r\n}\r\n\r\nfunction makeAlts(\r\n atn: ATN,\r\n rule: Rule,\r\n start: BlockStartState,\r\n production: IProductionWithOccurrence,\r\n ...alts: (ATNHandle | undefined)[]\r\n): ATNHandle {\r\n const end = newState(atn, rule, production, {\r\n type: ATN_BLOCK_END,\r\n start\r\n })\r\n start.end = end\r\n for (const alt of alts) {\r\n if (alt !== undefined) {\r\n // hook alts up to decision block\r\n epsilon(start, alt.left)\r\n epsilon(alt.right, end)\r\n } else {\r\n epsilon(start, end)\r\n }\r\n }\r\n\r\n const handle: ATNHandle = {\r\n left: start as ATNState,\r\n right: end\r\n }\r\n atn.decisionMap[buildATNKey(rule, getProdType(production), production.idx)] = start\r\n return handle\r\n}\r\n\r\nfunction getProdType(production: IProduction): LookaheadProductionType {\r\n if (production instanceof Alternation) {\r\n return 'Alternation';\r\n } else if (production instanceof Option) {\r\n return 'Option';\r\n } else if (production instanceof Repetition) {\r\n return 'Repetition';\r\n } else if (production instanceof RepetitionWithSeparator) {\r\n return 'RepetitionWithSeparator';\r\n } else if (production instanceof RepetitionMandatory) {\r\n return 'RepetitionMandatory';\r\n } else if (production instanceof RepetitionMandatoryWithSeparator) {\r\n return 'RepetitionMandatoryWithSeparator';\r\n } else {\r\n throw new Error('Invalid production type encountered');\r\n }\r\n}\r\n\r\nfunction makeBlock(atn: ATN, alts: ATNHandle[]): ATNHandle {\r\n const altsLength = alts.length\r\n for (let i = 0; i < altsLength - 1; i++) {\r\n const handle = alts[i]\r\n let transition: Transition | undefined\r\n if (handle.left.transitions.length === 1) {\r\n transition = handle.left.transitions[0]\r\n }\r\n const isRuleTransition = transition instanceof RuleTransition\r\n const ruleTransition = transition as RuleTransition\r\n const next = alts[i + 1].left\r\n if (\r\n handle.left.type === ATN_BASIC &&\r\n handle.right.type === ATN_BASIC &&\r\n transition !== undefined &&\r\n ((isRuleTransition && ruleTransition.followState === handle.right) ||\r\n transition.target === handle.right)\r\n ) {\r\n // we can avoid epsilon edge to next element\r\n if (isRuleTransition) {\r\n ruleTransition.followState = next\r\n } else {\r\n transition.target = next\r\n }\r\n removeState(atn, handle.right) // we skipped over this state\r\n } else {\r\n // need epsilon if previous block's right end node is complex\r\n epsilon(handle.right, next)\r\n }\r\n }\r\n\r\n const first = alts[0]\r\n const last = alts[altsLength - 1]\r\n return {\r\n left: first.left,\r\n right: last.right\r\n }\r\n}\r\n\r\nfunction tokenRef(\r\n atn: ATN,\r\n rule: Rule,\r\n tokenType: TokenType,\r\n production: IProductionWithOccurrence\r\n): ATNHandle {\r\n const left = newState(atn, rule, production, {\r\n type: ATN_BASIC\r\n })\r\n const right = newState(atn, rule, production, {\r\n type: ATN_BASIC\r\n })\r\n addTransition(left, new AtomTransition(right, tokenType))\r\n return {\r\n left,\r\n right\r\n }\r\n}\r\n\r\nfunction ruleRef(\r\n atn: ATN,\r\n currentRule: Rule,\r\n nonTerminal: NonTerminal\r\n): ATNHandle {\r\n const rule = nonTerminal.referencedRule\r\n const start = atn.ruleToStartState.get(rule)!\r\n const left = newState(atn, currentRule, nonTerminal, {\r\n type: ATN_BASIC\r\n })\r\n const right = newState(atn, currentRule, nonTerminal, {\r\n type: ATN_BASIC\r\n })\r\n\r\n const call = new RuleTransition(start, rule, right)\r\n addTransition(left, call)\r\n\r\n return {\r\n left,\r\n right\r\n }\r\n}\r\n\r\nfunction buildRuleHandle(atn: ATN, rule: Rule, block: ATNHandle): ATNHandle {\r\n const start = atn.ruleToStartState.get(rule)!\r\n epsilon(start, block.left)\r\n const stop = atn.ruleToStopState.get(rule)!\r\n epsilon(block.right, stop)\r\n const handle: ATNHandle = {\r\n left: start,\r\n right: stop\r\n }\r\n return handle\r\n}\r\n\r\nfunction epsilon(a: ATNBaseState, b: ATNBaseState): void {\r\n const transition = new EpsilonTransition(b as ATNState)\r\n addTransition(a, transition)\r\n}\r\n\r\nfunction newState(\r\n atn: ATN,\r\n rule: Rule,\r\n production: IProductionWithOccurrence | undefined,\r\n partial: Partial\r\n): T {\r\n const t: T = {\r\n atn,\r\n production,\r\n epsilonOnlyTransitions: false,\r\n rule,\r\n transitions: [],\r\n nextTokenWithinRule: [],\r\n stateNumber: atn.states.length,\r\n ...partial\r\n } as unknown as T\r\n atn.states.push(t)\r\n return t\r\n}\r\n\r\nfunction addTransition(state: ATNBaseState, transition: Transition) {\r\n // A single ATN state can only contain epsilon transitions or non-epsilon transitions\r\n // Because they are never mixed, only setting the property for the first transition is fine\r\n if (state.transitions.length === 0) {\r\n state.epsilonOnlyTransitions = transition.isEpsilon()\r\n }\r\n state.transitions.push(transition)\r\n}\r\n\r\nfunction removeState(atn: ATN, state: ATNState): void {\r\n atn.states.splice(atn.states.indexOf(state), 1)\r\n}\r\n", "/******************************************************************************\r\n * Copyright 2022 TypeFox GmbH\r\n * This program and the accompanying materials are made available under the\r\n * terms of the MIT License, which is available in the project root.\r\n ******************************************************************************/\r\n\r\nimport map from \"lodash-es/map.js\"\r\nimport { ATNState, DecisionState } from \"./atn.js\"\r\n\r\nexport interface DFA {\r\n start?: DFAState\r\n states: Record\r\n decision: number\r\n atnStartState: DecisionState\r\n}\r\n\r\nexport interface DFAState {\r\n configs: ATNConfigSet\r\n edges: Record\r\n isAcceptState: boolean\r\n prediction: number\r\n}\r\n\r\nexport const DFA_ERROR = {} as DFAState\r\n\r\nexport interface ATNConfig {\r\n state: ATNState\r\n alt: number\r\n stack: ATNState[]\r\n}\r\n\r\nexport class ATNConfigSet {\r\n private map: Record = {}\r\n private configs: ATNConfig[] = []\r\n\r\n uniqueAlt: number | undefined\r\n\r\n get size(): number {\r\n return this.configs.length\r\n }\r\n\r\n finalize(): void {\r\n // Empties the map to free up memory\r\n this.map = {}\r\n }\r\n\r\n add(config: ATNConfig): void {\r\n const key = getATNConfigKey(config)\r\n // Only add configs which don't exist in our map already\r\n // While this does not influence the actual algorithm, adding them anyway would massively increase memory consumption\r\n if (!(key in this.map)) {\r\n this.map[key] = this.configs.length\r\n this.configs.push(config)\r\n }\r\n }\r\n\r\n get elements(): readonly ATNConfig[] {\r\n return this.configs\r\n }\r\n\r\n get alts(): number[] {\r\n return map(this.configs, (e) => e.alt)\r\n }\r\n\r\n get key(): string {\r\n let value = \"\"\r\n for (const k in this.map) {\r\n value += k + \":\"\r\n }\r\n return value\r\n }\r\n}\r\n\r\nexport function getATNConfigKey(config: ATNConfig, alt = true) {\r\n return `${alt ? `a${config.alt}` : \"\"}s${\r\n config.state.stateNumber\r\n }:${config.stack.map((e) => e.stateNumber.toString()).join(\"_\")}`\r\n}\r\n", "/******************************************************************************\r\n * Copyright 2022 TypeFox GmbH\r\n * This program and the accompanying materials are made available under the\r\n * terms of the MIT License, which is available in the project root.\r\n ******************************************************************************/\r\n\r\nimport {\r\n IToken,\r\n TokenType,\r\n tokenMatcher,\r\n tokenLabel,\r\n Rule,\r\n IProductionWithOccurrence,\r\n NonTerminal,\r\n Alternation,\r\n Option,\r\n RepetitionMandatory,\r\n RepetitionMandatoryWithSeparator,\r\n RepetitionWithSeparator,\r\n Repetition,\r\n Terminal,\r\n BaseParser,\r\n LLkLookaheadStrategy,\r\n ILookaheadValidationError,\r\n IOrAlt,\r\n getLookaheadPaths,\r\n OptionalProductionType\r\n} from \"chevrotain\";\r\nimport {\r\n ATN,\r\n ATNState,\r\n ATN_RULE_STOP,\r\n AtomTransition,\r\n buildATNKey,\r\n createATN,\r\n DecisionState,\r\n EpsilonTransition,\r\n RuleTransition,\r\n Transition\r\n} from \"./atn.js\";\r\nimport {\r\n ATNConfig,\r\n ATNConfigSet,\r\n DFA,\r\n DFAState,\r\n DFA_ERROR,\r\n getATNConfigKey\r\n} from \"./dfa.js\";\r\nimport min from \"lodash-es/min.js\";\r\nimport flatMap from \"lodash-es/flatMap.js\";\r\nimport uniqBy from \"lodash-es/uniqBy.js\";\r\nimport map from \"lodash-es/map.js\";\r\nimport flatten from \"lodash-es/flatten.js\";\r\nimport forEach from \"lodash-es/forEach.js\";\r\nimport isEmpty from \"lodash-es/isEmpty.js\";\r\nimport reduce from \"lodash-es/reduce.js\";\r\n\r\ntype DFACache = (predicateSet: PredicateSet) => DFA\r\n\r\nexport type AmbiguityReport = (message: string) => void;\r\n\r\nfunction createDFACache(startState: DecisionState, decision: number): DFACache {\r\n const map: Record = {}\r\n return (predicateSet) => {\r\n const key = predicateSet.toString()\r\n let existing = map[key]\r\n if (existing !== undefined) {\r\n return existing\r\n } else {\r\n existing = {\r\n atnStartState: startState,\r\n decision,\r\n states: {}\r\n }\r\n map[key] = existing\r\n return existing\r\n }\r\n }\r\n}\r\n\r\nclass PredicateSet {\r\n private predicates: boolean[] = []\r\n\r\n is(index: number): boolean {\r\n return index >= this.predicates.length || this.predicates[index]\r\n }\r\n\r\n set(index: number, value: boolean) {\r\n this.predicates[index] = value\r\n }\r\n\r\n toString(): string {\r\n let value = \"\"\r\n const size = this.predicates.length\r\n for (let i = 0; i < size; i++) {\r\n value += this.predicates[i] === true ? \"1\" : \"0\"\r\n }\r\n return value\r\n }\r\n}\r\n\r\ninterface AdaptivePredictError {\r\n tokenPath: IToken[]\r\n possibleTokenTypes: TokenType[]\r\n actualToken: IToken\r\n}\r\n\r\nconst EMPTY_PREDICATES = new PredicateSet()\r\n\r\nexport interface LLStarLookaheadOptions {\r\n logging?: AmbiguityReport\r\n}\r\n\r\nexport class LLStarLookaheadStrategy extends LLkLookaheadStrategy {\r\n\r\n private atn: ATN;\r\n private dfas: DFACache[];\r\n private logging: AmbiguityReport;\r\n\r\n constructor(options?: LLStarLookaheadOptions) {\r\n super();\r\n this.logging = options?.logging ?? ((message) => console.log(message));\r\n }\r\n\r\n override initialize(options: { rules: Rule[] }): void {\r\n this.atn = createATN(options.rules);\r\n this.dfas = initATNSimulator(this.atn);\r\n }\r\n\r\n override validateAmbiguousAlternationAlternatives(): ILookaheadValidationError[] {\r\n return [];\r\n }\r\n\r\n override validateEmptyOrAlternatives(): ILookaheadValidationError[] {\r\n return [];\r\n }\r\n\r\n override buildLookaheadForAlternation(options: {\r\n prodOccurrence: number;\r\n rule: Rule;\r\n maxLookahead: number;\r\n hasPredicates: boolean;\r\n dynamicTokensEnabled: boolean\r\n }): (this: BaseParser, orAlts?: IOrAlt[] | undefined) => number | undefined {\r\n const { prodOccurrence, rule, hasPredicates, dynamicTokensEnabled } = options;\r\n const dfas = this.dfas;\r\n const logging = this.logging;\r\n const key = buildATNKey(rule, 'Alternation', prodOccurrence);\r\n const decisionState = this.atn.decisionMap[key];\r\n const decisionIndex = decisionState.decision;\r\n const partialAlts: (TokenType | undefined)[][] = map(\r\n getLookaheadPaths({\r\n maxLookahead: 1,\r\n occurrence: prodOccurrence,\r\n prodType: \"Alternation\",\r\n rule: rule\r\n }),\r\n (currAlt) => map(currAlt, (path) => path[0])\r\n )\r\n\r\n if (isLL1Sequence(partialAlts, false) && !dynamicTokensEnabled) {\r\n const choiceToAlt = reduce(\r\n partialAlts,\r\n (result, currAlt, idx) => {\r\n forEach(currAlt, (currTokType) => {\r\n if (currTokType) {\r\n result[currTokType.tokenTypeIdx!] = idx\r\n forEach(currTokType.categoryMatches!, (currExtendingType) => {\r\n result[currExtendingType] = idx\r\n })\r\n }\r\n })\r\n return result\r\n },\r\n {} as Record\r\n )\r\n\r\n if (hasPredicates) {\r\n return function (this: BaseParser, orAlts) {\r\n const nextToken = this.LA(1)\r\n const prediction: number | undefined = choiceToAlt[nextToken.tokenTypeIdx]\r\n if (orAlts !== undefined && prediction !== undefined) {\r\n const gate = orAlts[prediction]?.GATE\r\n if (gate !== undefined && gate.call(this) === false) {\r\n return undefined;\r\n }\r\n }\r\n return prediction\r\n }\r\n } else {\r\n return function (this: BaseParser): number | undefined {\r\n const nextToken = this.LA(1)\r\n return choiceToAlt[nextToken.tokenTypeIdx];\r\n }\r\n }\r\n } else if (hasPredicates) {\r\n return function (this: BaseParser, orAlts) {\r\n const predicates = new PredicateSet()\r\n const length = orAlts === undefined ? 0 : orAlts.length\r\n for (let i = 0; i < length; i++) {\r\n const gate = orAlts?.[i].GATE\r\n predicates.set(i, gate === undefined || gate.call(this))\r\n }\r\n const result = adaptivePredict.call(this, dfas, decisionIndex, predicates, logging);\r\n return typeof result === 'number' ? result : undefined;\r\n }\r\n } else {\r\n return function (this: BaseParser) {\r\n const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging);\r\n return typeof result === 'number' ? result : undefined;\r\n }\r\n }\r\n }\r\n\r\n override buildLookaheadForOptional(options: {\r\n prodOccurrence: number;\r\n prodType: OptionalProductionType;\r\n rule: Rule;\r\n maxLookahead: number;\r\n dynamicTokensEnabled: boolean\r\n }): (this: BaseParser) => boolean {\r\n const { prodOccurrence, rule, prodType, dynamicTokensEnabled } = options;\r\n const dfas = this.dfas;\r\n const logging = this.logging;\r\n const key = buildATNKey(rule, prodType, prodOccurrence);\r\n const decisionState = this.atn.decisionMap[key];\r\n const decisionIndex = decisionState.decision;\r\n const alts = map(\r\n getLookaheadPaths({\r\n maxLookahead: 1,\r\n occurrence: prodOccurrence,\r\n prodType,\r\n rule\r\n }),\r\n (e) => {\r\n return map(e, (g) => g[0])\r\n }\r\n )\r\n \r\n if (isLL1Sequence(alts) && alts[0][0] && !dynamicTokensEnabled) {\r\n const alt = alts[0]\r\n const singleTokensTypes = flatten(alt)\r\n \r\n if (\r\n singleTokensTypes.length === 1 &&\r\n isEmpty(singleTokensTypes[0].categoryMatches)\r\n ) {\r\n const expectedTokenType = singleTokensTypes[0]\r\n const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx\r\n \r\n return function (this: BaseParser): boolean {\r\n return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey\r\n }\r\n } else {\r\n const choiceToAlt = reduce(\r\n singleTokensTypes,\r\n (result, currTokType) => {\r\n if (currTokType !== undefined) {\r\n result[currTokType.tokenTypeIdx!] = true\r\n forEach(currTokType.categoryMatches, (currExtendingType) => {\r\n result[currExtendingType] = true\r\n })\r\n }\r\n return result\r\n },\r\n {} as Record\r\n )\r\n \r\n return function (this: BaseParser): boolean {\r\n const nextToken = this.LA(1)\r\n return choiceToAlt[nextToken.tokenTypeIdx] === true\r\n }\r\n }\r\n }\r\n return function (this: BaseParser) {\r\n const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging)\r\n return typeof result === \"object\" ? false : result === 0;\r\n }\r\n }\r\n\r\n}\r\n\r\nfunction isLL1Sequence(sequences: (TokenType | undefined)[][], allowEmpty = true): boolean {\r\n const fullSet = new Set()\r\n\r\n for (const alt of sequences) {\r\n const altSet = new Set()\r\n for (const tokType of alt) {\r\n if (tokType === undefined) {\r\n if (allowEmpty) {\r\n // Epsilon production encountered\r\n break\r\n } else {\r\n return false;\r\n }\r\n }\r\n const indices = [tokType.tokenTypeIdx!].concat(tokType.categoryMatches!)\r\n for (const index of indices) {\r\n if (fullSet.has(index)) {\r\n if (!altSet.has(index)) {\r\n return false\r\n }\r\n } else {\r\n fullSet.add(index)\r\n altSet.add(index)\r\n }\r\n }\r\n }\r\n }\r\n return true\r\n}\r\n\r\nfunction initATNSimulator(atn: ATN): DFACache[] {\r\n const decisionLength = atn.decisionStates.length\r\n const decisionToDFA: DFACache[] = Array(decisionLength)\r\n for (let i = 0; i < decisionLength; i++) {\r\n decisionToDFA[i] = createDFACache(atn.decisionStates[i], i)\r\n }\r\n return decisionToDFA;\r\n}\r\n\r\nfunction adaptivePredict(\r\n this: BaseParser,\r\n dfaCaches: DFACache[],\r\n decision: number,\r\n predicateSet: PredicateSet,\r\n logging: AmbiguityReport\r\n): number | AdaptivePredictError {\r\n const dfa = dfaCaches[decision](predicateSet)\r\n let start = dfa.start\r\n if (start === undefined) {\r\n const closure = computeStartState(dfa.atnStartState as ATNState)\r\n start = addDFAState(dfa, newDFAState(closure))\r\n dfa.start = start\r\n }\r\n\r\n const alt = performLookahead.apply(this, [dfa, start, predicateSet, logging])\r\n return alt\r\n}\r\n\r\nfunction performLookahead(\r\n this: BaseParser,\r\n dfa: DFA,\r\n s0: DFAState,\r\n predicateSet: PredicateSet,\r\n logging: AmbiguityReport\r\n): number | AdaptivePredictError {\r\n let previousD = s0\r\n\r\n let i = 1\r\n const path: IToken[] = []\r\n let t = this.LA(i++)\r\n\r\n while (true) {\r\n let d = getExistingTargetState(previousD, t)\r\n if (d === undefined) {\r\n d = computeLookaheadTarget.apply(this, [dfa, previousD, t, i, predicateSet, logging])\r\n }\r\n\r\n if (d === DFA_ERROR) {\r\n return buildAdaptivePredictError(path, previousD, t)\r\n }\r\n\r\n if (d.isAcceptState === true) {\r\n return d.prediction\r\n }\r\n\r\n previousD = d\r\n path.push(t)\r\n t = this.LA(i++)\r\n }\r\n}\r\n\r\nfunction computeLookaheadTarget(\r\n this: BaseParser,\r\n dfa: DFA,\r\n previousD: DFAState,\r\n token: IToken,\r\n lookahead: number,\r\n predicateSet: PredicateSet,\r\n logging: AmbiguityReport\r\n): DFAState {\r\n const reach = computeReachSet(previousD.configs, token, predicateSet)\r\n if (reach.size === 0) {\r\n addDFAEdge(dfa, previousD, token, DFA_ERROR)\r\n return DFA_ERROR\r\n }\r\n\r\n let newState = newDFAState(reach)\r\n const predictedAlt = getUniqueAlt(reach, predicateSet)\r\n\r\n if (predictedAlt !== undefined) {\r\n newState.isAcceptState = true\r\n newState.prediction = predictedAlt\r\n newState.configs.uniqueAlt = predictedAlt\r\n } else if (hasConflictTerminatingPrediction(reach)) {\r\n const prediction = min(reach.alts)!\r\n newState.isAcceptState = true\r\n newState.prediction = prediction\r\n newState.configs.uniqueAlt = prediction\r\n reportLookaheadAmbiguity.apply(this, [dfa, lookahead, reach.alts, logging])\r\n }\r\n\r\n newState = addDFAEdge(dfa, previousD, token, newState)\r\n return newState\r\n}\r\n\r\nfunction reportLookaheadAmbiguity(\r\n this: BaseParser,\r\n dfa: DFA,\r\n lookahead: number,\r\n ambiguityIndices: number[],\r\n logging: AmbiguityReport\r\n) {\r\n const prefixPath: TokenType[] = []\r\n for (let i = 1; i <= lookahead; i++) {\r\n prefixPath.push(this.LA(i).tokenType)\r\n }\r\n const atnState = dfa.atnStartState\r\n const topLevelRule = atnState.rule\r\n const production = atnState.production\r\n const message = buildAmbiguityError({\r\n topLevelRule,\r\n ambiguityIndices,\r\n production,\r\n prefixPath\r\n })\r\n logging(message)\r\n}\r\n\r\nfunction buildAmbiguityError(options: {\r\n topLevelRule: Rule\r\n prefixPath: TokenType[]\r\n ambiguityIndices: number[]\r\n production: IProductionWithOccurrence\r\n}): string {\r\n const pathMsg = map(options.prefixPath, (currtok) =>\r\n tokenLabel(currtok)\r\n ).join(\", \")\r\n const occurrence =\r\n options.production.idx === 0 ? \"\" : options.production.idx\r\n let currMessage =\r\n `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(\r\n \", \"\r\n )}> in <${getProductionDslName(options.production)}${occurrence}>` +\r\n ` inside <${options.topLevelRule.name}> Rule,\\n` +\r\n `<${pathMsg}> may appears as a prefix path in all these alternatives.\\n`\r\n\r\n currMessage =\r\n currMessage +\r\n `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\\n` +\r\n `For Further details.`\r\n return currMessage\r\n}\r\n\r\nfunction getProductionDslName(prod: IProductionWithOccurrence): string {\r\n if (prod instanceof NonTerminal) {\r\n return \"SUBRULE\"\r\n } else if (prod instanceof Option) {\r\n return \"OPTION\"\r\n } else if (prod instanceof Alternation) {\r\n return \"OR\"\r\n } else if (prod instanceof RepetitionMandatory) {\r\n return \"AT_LEAST_ONE\"\r\n } else if (prod instanceof RepetitionMandatoryWithSeparator) {\r\n return \"AT_LEAST_ONE_SEP\"\r\n } else if (prod instanceof RepetitionWithSeparator) {\r\n return \"MANY_SEP\"\r\n } else if (prod instanceof Repetition) {\r\n return \"MANY\"\r\n } else if (prod instanceof Terminal) {\r\n return \"CONSUME\"\r\n } else {\r\n throw Error(\"non exhaustive match\")\r\n }\r\n}\r\n\r\nfunction buildAdaptivePredictError(\r\n path: IToken[],\r\n previous: DFAState,\r\n current: IToken\r\n): AdaptivePredictError {\r\n const nextTransitions = flatMap(\r\n previous.configs.elements,\r\n (e) => e.state.transitions\r\n )\r\n const nextTokenTypes = uniqBy(\r\n nextTransitions\r\n .filter((e): e is AtomTransition => e instanceof AtomTransition)\r\n .map((e) => e.tokenType),\r\n (e) => e.tokenTypeIdx\r\n )\r\n return {\r\n actualToken: current,\r\n possibleTokenTypes: nextTokenTypes,\r\n tokenPath: path\r\n }\r\n}\r\n\r\nfunction getExistingTargetState(\r\n state: DFAState,\r\n token: IToken\r\n): DFAState | undefined {\r\n return state.edges[token.tokenTypeIdx]\r\n}\r\n\r\nfunction computeReachSet(\r\n configs: ATNConfigSet,\r\n token: IToken,\r\n predicateSet: PredicateSet\r\n): ATNConfigSet {\r\n const intermediate = new ATNConfigSet()\r\n const skippedStopStates: ATNConfig[] = []\r\n\r\n for (const c of configs.elements) {\r\n if (predicateSet.is(c.alt) === false) {\r\n continue\r\n }\r\n if (c.state.type === ATN_RULE_STOP) {\r\n skippedStopStates.push(c)\r\n continue\r\n }\r\n const transitionLength = c.state.transitions.length\r\n for (let i = 0; i < transitionLength; i++) {\r\n const transition = c.state.transitions[i]\r\n const target = getReachableTarget(transition, token)\r\n if (target !== undefined) {\r\n intermediate.add({\r\n state: target,\r\n alt: c.alt,\r\n stack: c.stack\r\n })\r\n }\r\n }\r\n }\r\n\r\n let reach: ATNConfigSet | undefined\r\n\r\n if (skippedStopStates.length === 0 && intermediate.size === 1) {\r\n reach = intermediate\r\n }\r\n\r\n if (reach === undefined) {\r\n reach = new ATNConfigSet()\r\n for (const c of intermediate.elements) {\r\n closure(c, reach)\r\n }\r\n }\r\n\r\n if (skippedStopStates.length > 0 && !hasConfigInRuleStopState(reach)) {\r\n for (const c of skippedStopStates) {\r\n reach.add(c)\r\n }\r\n }\r\n\r\n return reach\r\n}\r\n\r\nfunction getReachableTarget(\r\n transition: Transition,\r\n token: IToken\r\n): ATNState | undefined {\r\n if (\r\n transition instanceof AtomTransition &&\r\n tokenMatcher(token, transition.tokenType)\r\n ) {\r\n return transition.target\r\n }\r\n return undefined\r\n}\r\n\r\nfunction getUniqueAlt(\r\n configs: ATNConfigSet,\r\n predicateSet: PredicateSet\r\n): number | undefined {\r\n let alt: number | undefined\r\n for (const c of configs.elements) {\r\n if (predicateSet.is(c.alt) === true) {\r\n if (alt === undefined) {\r\n alt = c.alt\r\n } else if (alt !== c.alt) {\r\n return undefined\r\n }\r\n }\r\n }\r\n return alt\r\n}\r\n\r\nfunction newDFAState(closure: ATNConfigSet): DFAState {\r\n return {\r\n configs: closure,\r\n edges: {},\r\n isAcceptState: false,\r\n prediction: -1\r\n }\r\n}\r\n\r\nfunction addDFAEdge(\r\n dfa: DFA,\r\n from: DFAState,\r\n token: IToken,\r\n to: DFAState\r\n): DFAState {\r\n to = addDFAState(dfa, to)\r\n from.edges[token.tokenTypeIdx] = to\r\n return to\r\n}\r\n\r\nfunction addDFAState(dfa: DFA, state: DFAState): DFAState {\r\n if (state === DFA_ERROR) {\r\n return state\r\n }\r\n // Repetitions have the same config set\r\n // Therefore, storing the key of the config in a map allows us to create a loop in our DFA\r\n const mapKey = state.configs.key\r\n const existing = dfa.states[mapKey]\r\n if (existing !== undefined) {\r\n return existing\r\n }\r\n state.configs.finalize()\r\n dfa.states[mapKey] = state\r\n return state\r\n}\r\n\r\nfunction computeStartState(atnState: ATNState): ATNConfigSet {\r\n const configs = new ATNConfigSet()\r\n\r\n const numberOfTransitions = atnState.transitions.length\r\n for (let i = 0; i < numberOfTransitions; i++) {\r\n const target = atnState.transitions[i].target\r\n const config: ATNConfig = {\r\n state: target,\r\n alt: i,\r\n stack: []\r\n }\r\n closure(config, configs)\r\n }\r\n\r\n return configs\r\n}\r\n\r\nfunction closure(config: ATNConfig, configs: ATNConfigSet): void {\r\n const p = config.state\r\n\r\n if (p.type === ATN_RULE_STOP) {\r\n if (config.stack.length > 0) {\r\n const atnStack = [...config.stack]\r\n const followState = atnStack.pop()!\r\n const followConfig: ATNConfig = {\r\n state: followState,\r\n alt: config.alt,\r\n stack: atnStack\r\n }\r\n closure(followConfig, configs)\r\n } else {\r\n // Dipping into outer context, simply add the config\r\n // This will stop computation once every config is at the rule stop state\r\n configs.add(config)\r\n }\r\n return\r\n }\r\n\r\n if (!p.epsilonOnlyTransitions) {\r\n configs.add(config)\r\n }\r\n\r\n const transitionLength = p.transitions.length\r\n for (let i = 0; i < transitionLength; i++) {\r\n const transition = p.transitions[i]\r\n const c = getEpsilonTarget(config, transition)\r\n\r\n if (c !== undefined) {\r\n closure(c, configs)\r\n }\r\n }\r\n}\r\n\r\nfunction getEpsilonTarget(\r\n config: ATNConfig,\r\n transition: Transition\r\n): ATNConfig | undefined {\r\n if (transition instanceof EpsilonTransition) {\r\n return {\r\n state: transition.target,\r\n alt: config.alt,\r\n stack: config.stack\r\n }\r\n } else if (transition instanceof RuleTransition) {\r\n const stack = [...config.stack, transition.followState]\r\n return {\r\n state: transition.target,\r\n alt: config.alt,\r\n stack\r\n }\r\n }\r\n return undefined\r\n}\r\n\r\nfunction hasConfigInRuleStopState(configs: ATNConfigSet): boolean {\r\n for (const c of configs.elements) {\r\n if (c.state.type === ATN_RULE_STOP) {\r\n return true\r\n }\r\n }\r\n return false\r\n}\r\n\r\nfunction allConfigsInRuleStopStates(configs: ATNConfigSet): boolean {\r\n for (const c of configs.elements) {\r\n if (c.state.type !== ATN_RULE_STOP) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\nfunction hasConflictTerminatingPrediction(configs: ATNConfigSet): boolean {\r\n if (allConfigsInRuleStopStates(configs)) {\r\n return true\r\n }\r\n const altSets = getConflictingAltSets(configs.elements)\r\n const heuristic =\r\n hasConflictingAltSet(altSets) && !hasStateAssociatedWithOneAlt(altSets)\r\n return heuristic\r\n}\r\n\r\nfunction getConflictingAltSets(\r\n configs: readonly ATNConfig[]\r\n): Map> {\r\n const configToAlts = new Map>()\r\n for (const c of configs) {\r\n const key = getATNConfigKey(c, false)\r\n let alts = configToAlts.get(key)\r\n if (alts === undefined) {\r\n alts = {}\r\n configToAlts.set(key, alts)\r\n }\r\n alts[c.alt] = true\r\n }\r\n return configToAlts\r\n}\r\n\r\nfunction hasConflictingAltSet(\r\n altSets: Map>\r\n): boolean {\r\n for (const value of Array.from(altSets.values())) {\r\n if (Object.keys(value).length > 1) {\r\n return true\r\n }\r\n }\r\n return false\r\n}\r\n\r\nfunction hasStateAssociatedWithOneAlt(\r\n altSets: Map>\r\n): boolean {\r\n for (const value of Array.from(altSets.values())) {\r\n if (Object.keys(value).length === 1) {\r\n return true\r\n }\r\n }\r\n return false\r\n}\r\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nexport var DocumentUri;\n(function (DocumentUri) {\n function is(value) {\n return typeof value === 'string';\n }\n DocumentUri.is = is;\n})(DocumentUri || (DocumentUri = {}));\nexport var URI;\n(function (URI) {\n function is(value) {\n return typeof value === 'string';\n }\n URI.is = is;\n})(URI || (URI = {}));\nexport var integer;\n(function (integer) {\n integer.MIN_VALUE = -2147483648;\n integer.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;\n }\n integer.is = is;\n})(integer || (integer = {}));\nexport var uinteger;\n(function (uinteger) {\n uinteger.MIN_VALUE = 0;\n uinteger.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;\n }\n uinteger.is = is;\n})(uinteger || (uinteger = {}));\n/**\n * The Position namespace provides helper functions to work with\n * {@link Position} literals.\n */\nexport var Position;\n(function (Position) {\n /**\n * Creates a new Position literal from the given line and character.\n * @param line The position's line.\n * @param character The position's character.\n */\n function create(line, character) {\n if (line === Number.MAX_VALUE) {\n line = uinteger.MAX_VALUE;\n }\n if (character === Number.MAX_VALUE) {\n character = uinteger.MAX_VALUE;\n }\n return { line, character };\n }\n Position.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Position} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);\n }\n Position.is = is;\n})(Position || (Position = {}));\n/**\n * The Range namespace provides helper functions to work with\n * {@link Range} literals.\n */\nexport var Range;\n(function (Range) {\n function create(one, two, three, four) {\n if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {\n return { start: Position.create(one, two), end: Position.create(three, four) };\n }\n else if (Position.is(one) && Position.is(two)) {\n return { start: one, end: two };\n }\n else {\n throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);\n }\n }\n Range.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Range} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }\n Range.is = is;\n})(Range || (Range = {}));\n/**\n * The Location namespace provides helper functions to work with\n * {@link Location} literals.\n */\nexport var Location;\n(function (Location) {\n /**\n * Creates a Location literal.\n * @param uri The location's uri.\n * @param range The location's range.\n */\n function create(uri, range) {\n return { uri, range };\n }\n Location.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Location} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\n }\n Location.is = is;\n})(Location || (Location = {}));\n/**\n * The LocationLink namespace provides helper functions to work with\n * {@link LocationLink} literals.\n */\nexport var LocationLink;\n(function (LocationLink) {\n /**\n * Creates a LocationLink literal.\n * @param targetUri The definition's uri.\n * @param targetRange The full range of the definition.\n * @param targetSelectionRange The span of the symbol definition at the target.\n * @param originSelectionRange The span of the symbol being defined in the originating source file.\n */\n function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\n return { targetUri, targetRange, targetSelectionRange, originSelectionRange };\n }\n LocationLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link LocationLink} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\n && Range.is(candidate.targetSelectionRange)\n && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\n }\n LocationLink.is = is;\n})(LocationLink || (LocationLink = {}));\n/**\n * The Color namespace provides helper functions to work with\n * {@link Color} literals.\n */\nexport var Color;\n(function (Color) {\n /**\n * Creates a new Color literal.\n */\n function create(red, green, blue, alpha) {\n return {\n red,\n green,\n blue,\n alpha,\n };\n }\n Color.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Color} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1)\n && Is.numberRange(candidate.green, 0, 1)\n && Is.numberRange(candidate.blue, 0, 1)\n && Is.numberRange(candidate.alpha, 0, 1);\n }\n Color.is = is;\n})(Color || (Color = {}));\n/**\n * The ColorInformation namespace provides helper functions to work with\n * {@link ColorInformation} literals.\n */\nexport var ColorInformation;\n(function (ColorInformation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(range, color) {\n return {\n range,\n color,\n };\n }\n ColorInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);\n }\n ColorInformation.is = is;\n})(ColorInformation || (ColorInformation = {}));\n/**\n * The Color namespace provides helper functions to work with\n * {@link ColorPresentation} literals.\n */\nexport var ColorPresentation;\n(function (ColorPresentation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(label, textEdit, additionalTextEdits) {\n return {\n label,\n textEdit,\n additionalTextEdits,\n };\n }\n ColorPresentation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label)\n && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\n && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\n }\n ColorPresentation.is = is;\n})(ColorPresentation || (ColorPresentation = {}));\n/**\n * A set of predefined range kinds.\n */\nexport var FoldingRangeKind;\n(function (FoldingRangeKind) {\n /**\n * Folding range for a comment\n */\n FoldingRangeKind.Comment = 'comment';\n /**\n * Folding range for an import or include\n */\n FoldingRangeKind.Imports = 'imports';\n /**\n * Folding range for a region (e.g. `#region`)\n */\n FoldingRangeKind.Region = 'region';\n})(FoldingRangeKind || (FoldingRangeKind = {}));\n/**\n * The folding range namespace provides helper functions to work with\n * {@link FoldingRange} literals.\n */\nexport var FoldingRange;\n(function (FoldingRange) {\n /**\n * Creates a new FoldingRange literal.\n */\n function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {\n const result = {\n startLine,\n endLine\n };\n if (Is.defined(startCharacter)) {\n result.startCharacter = startCharacter;\n }\n if (Is.defined(endCharacter)) {\n result.endCharacter = endCharacter;\n }\n if (Is.defined(kind)) {\n result.kind = kind;\n }\n if (Is.defined(collapsedText)) {\n result.collapsedText = collapsedText;\n }\n return result;\n }\n FoldingRange.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FoldingRange} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)\n && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))\n && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))\n && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\n }\n FoldingRange.is = is;\n})(FoldingRange || (FoldingRange = {}));\n/**\n * The DiagnosticRelatedInformation namespace provides helper functions to work with\n * {@link DiagnosticRelatedInformation} literals.\n */\nexport var DiagnosticRelatedInformation;\n(function (DiagnosticRelatedInformation) {\n /**\n * Creates a new DiagnosticRelatedInformation literal.\n */\n function create(location, message) {\n return {\n location,\n message\n };\n }\n DiagnosticRelatedInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DiagnosticRelatedInformation} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\n }\n DiagnosticRelatedInformation.is = is;\n})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\n/**\n * The diagnostic's severity.\n */\nexport var DiagnosticSeverity;\n(function (DiagnosticSeverity) {\n /**\n * Reports an error.\n */\n DiagnosticSeverity.Error = 1;\n /**\n * Reports a warning.\n */\n DiagnosticSeverity.Warning = 2;\n /**\n * Reports an information.\n */\n DiagnosticSeverity.Information = 3;\n /**\n * Reports a hint.\n */\n DiagnosticSeverity.Hint = 4;\n})(DiagnosticSeverity || (DiagnosticSeverity = {}));\n/**\n * The diagnostic tags.\n *\n * @since 3.15.0\n */\nexport var DiagnosticTag;\n(function (DiagnosticTag) {\n /**\n * Unused or unnecessary code.\n *\n * Clients are allowed to render diagnostics with this tag faded out instead of having\n * an error squiggle.\n */\n DiagnosticTag.Unnecessary = 1;\n /**\n * Deprecated or obsolete code.\n *\n * Clients are allowed to rendered diagnostics with this tag strike through.\n */\n DiagnosticTag.Deprecated = 2;\n})(DiagnosticTag || (DiagnosticTag = {}));\n/**\n * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.\n *\n * @since 3.16.0\n */\nexport var CodeDescription;\n(function (CodeDescription) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.href);\n }\n CodeDescription.is = is;\n})(CodeDescription || (CodeDescription = {}));\n/**\n * The Diagnostic namespace provides helper functions to work with\n * {@link Diagnostic} literals.\n */\nexport var Diagnostic;\n(function (Diagnostic) {\n /**\n * Creates a new Diagnostic literal.\n */\n function create(range, message, severity, code, source, relatedInformation) {\n let result = { range, message };\n if (Is.defined(severity)) {\n result.severity = severity;\n }\n if (Is.defined(code)) {\n result.code = code;\n }\n if (Is.defined(source)) {\n result.source = source;\n }\n if (Is.defined(relatedInformation)) {\n result.relatedInformation = relatedInformation;\n }\n return result;\n }\n Diagnostic.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Diagnostic} interface.\n */\n function is(value) {\n var _a;\n let candidate = value;\n return Is.defined(candidate)\n && Range.is(candidate.range)\n && Is.string(candidate.message)\n && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\n && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\n && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))\n && (Is.string(candidate.source) || Is.undefined(candidate.source))\n && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\n }\n Diagnostic.is = is;\n})(Diagnostic || (Diagnostic = {}));\n/**\n * The Command namespace provides helper functions to work with\n * {@link Command} literals.\n */\nexport var Command;\n(function (Command) {\n /**\n * Creates a new Command literal.\n */\n function create(title, command, ...args) {\n let result = { title, command };\n if (Is.defined(args) && args.length > 0) {\n result.arguments = args;\n }\n return result;\n }\n Command.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Command} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\n }\n Command.is = is;\n})(Command || (Command = {}));\n/**\n * The TextEdit namespace provides helper function to create replace,\n * insert and delete edits more easily.\n */\nexport var TextEdit;\n(function (TextEdit) {\n /**\n * Creates a replace text edit.\n * @param range The range of text to be replaced.\n * @param newText The new text.\n */\n function replace(range, newText) {\n return { range, newText };\n }\n TextEdit.replace = replace;\n /**\n * Creates an insert text edit.\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n */\n function insert(position, newText) {\n return { range: { start: position, end: position }, newText };\n }\n TextEdit.insert = insert;\n /**\n * Creates a delete text edit.\n * @param range The range of text to be deleted.\n */\n function del(range) {\n return { range, newText: '' };\n }\n TextEdit.del = del;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate)\n && Is.string(candidate.newText)\n && Range.is(candidate.range);\n }\n TextEdit.is = is;\n})(TextEdit || (TextEdit = {}));\nexport var ChangeAnnotation;\n(function (ChangeAnnotation) {\n function create(label, needsConfirmation, description) {\n const result = { label };\n if (needsConfirmation !== undefined) {\n result.needsConfirmation = needsConfirmation;\n }\n if (description !== undefined) {\n result.description = description;\n }\n return result;\n }\n ChangeAnnotation.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label) &&\n (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n ChangeAnnotation.is = is;\n})(ChangeAnnotation || (ChangeAnnotation = {}));\nexport var ChangeAnnotationIdentifier;\n(function (ChangeAnnotationIdentifier) {\n function is(value) {\n const candidate = value;\n return Is.string(candidate);\n }\n ChangeAnnotationIdentifier.is = is;\n})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));\nexport var AnnotatedTextEdit;\n(function (AnnotatedTextEdit) {\n /**\n * Creates an annotated replace text edit.\n *\n * @param range The range of text to be replaced.\n * @param newText The new text.\n * @param annotation The annotation.\n */\n function replace(range, newText, annotation) {\n return { range, newText, annotationId: annotation };\n }\n AnnotatedTextEdit.replace = replace;\n /**\n * Creates an annotated insert text edit.\n *\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n * @param annotation The annotation.\n */\n function insert(position, newText, annotation) {\n return { range: { start: position, end: position }, newText, annotationId: annotation };\n }\n AnnotatedTextEdit.insert = insert;\n /**\n * Creates an annotated delete text edit.\n *\n * @param range The range of text to be deleted.\n * @param annotation The annotation.\n */\n function del(range, annotation) {\n return { range, newText: '', annotationId: annotation };\n }\n AnnotatedTextEdit.del = del;\n function is(value) {\n const candidate = value;\n return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n AnnotatedTextEdit.is = is;\n})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));\n/**\n * The TextDocumentEdit namespace provides helper function to create\n * an edit that manipulates a text document.\n */\nexport var TextDocumentEdit;\n(function (TextDocumentEdit) {\n /**\n * Creates a new `TextDocumentEdit`\n */\n function create(textDocument, edits) {\n return { textDocument, edits };\n }\n TextDocumentEdit.create = create;\n function is(value) {\n let candidate = value;\n return Is.defined(candidate)\n && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)\n && Array.isArray(candidate.edits);\n }\n TextDocumentEdit.is = is;\n})(TextDocumentEdit || (TextDocumentEdit = {}));\nexport var CreateFile;\n(function (CreateFile) {\n function create(uri, options, annotation) {\n let result = {\n kind: 'create',\n uri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n CreateFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n CreateFile.is = is;\n})(CreateFile || (CreateFile = {}));\nexport var RenameFile;\n(function (RenameFile) {\n function create(oldUri, newUri, options, annotation) {\n let result = {\n kind: 'rename',\n oldUri,\n newUri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n RenameFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n RenameFile.is = is;\n})(RenameFile || (RenameFile = {}));\nexport var DeleteFile;\n(function (DeleteFile) {\n function create(uri, options, annotation) {\n let result = {\n kind: 'delete',\n uri\n };\n if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n DeleteFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n DeleteFile.is = is;\n})(DeleteFile || (DeleteFile = {}));\nexport var WorkspaceEdit;\n(function (WorkspaceEdit) {\n function is(value) {\n let candidate = value;\n return candidate &&\n (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&\n (candidate.documentChanges === undefined || candidate.documentChanges.every((change) => {\n if (Is.string(change.kind)) {\n return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\n }\n else {\n return TextDocumentEdit.is(change);\n }\n }));\n }\n WorkspaceEdit.is = is;\n})(WorkspaceEdit || (WorkspaceEdit = {}));\nclass TextEditChangeImpl {\n constructor(edits, changeAnnotations) {\n this.edits = edits;\n this.changeAnnotations = changeAnnotations;\n }\n insert(position, newText, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.insert(position, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.insert(position, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.insert(position, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n replace(range, newText, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.replace(range, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.replace(range, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.replace(range, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n delete(range, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.del(range);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.del(range, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.del(range, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n add(edit) {\n this.edits.push(edit);\n }\n all() {\n return this.edits;\n }\n clear() {\n this.edits.splice(0, this.edits.length);\n }\n assertChangeAnnotations(value) {\n if (value === undefined) {\n throw new Error(`Text edit change is not configured to manage change annotations.`);\n }\n }\n}\n/**\n * A helper class\n */\nclass ChangeAnnotations {\n constructor(annotations) {\n this._annotations = annotations === undefined ? Object.create(null) : annotations;\n this._counter = 0;\n this._size = 0;\n }\n all() {\n return this._annotations;\n }\n get size() {\n return this._size;\n }\n manage(idOrAnnotation, annotation) {\n let id;\n if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {\n id = idOrAnnotation;\n }\n else {\n id = this.nextId();\n annotation = idOrAnnotation;\n }\n if (this._annotations[id] !== undefined) {\n throw new Error(`Id ${id} is already in use.`);\n }\n if (annotation === undefined) {\n throw new Error(`No annotation provided for id ${id}`);\n }\n this._annotations[id] = annotation;\n this._size++;\n return id;\n }\n nextId() {\n this._counter++;\n return this._counter.toString();\n }\n}\n/**\n * A workspace change helps constructing changes to a workspace.\n */\nexport class WorkspaceChange {\n constructor(workspaceEdit) {\n this._textEditChanges = Object.create(null);\n if (workspaceEdit !== undefined) {\n this._workspaceEdit = workspaceEdit;\n if (workspaceEdit.documentChanges) {\n this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);\n workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n workspaceEdit.documentChanges.forEach((change) => {\n if (TextDocumentEdit.is(change)) {\n const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations);\n this._textEditChanges[change.textDocument.uri] = textEditChange;\n }\n });\n }\n else if (workspaceEdit.changes) {\n Object.keys(workspaceEdit.changes).forEach((key) => {\n const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\n this._textEditChanges[key] = textEditChange;\n });\n }\n }\n else {\n this._workspaceEdit = {};\n }\n }\n /**\n * Returns the underlying {@link WorkspaceEdit} literal\n * use to be returned from a workspace edit operation like rename.\n */\n get edit() {\n this.initDocumentChanges();\n if (this._changeAnnotations !== undefined) {\n if (this._changeAnnotations.size === 0) {\n this._workspaceEdit.changeAnnotations = undefined;\n }\n else {\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n }\n return this._workspaceEdit;\n }\n getTextEditChange(key) {\n if (OptionalVersionedTextDocumentIdentifier.is(key)) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n const textDocument = { uri: key.uri, version: key.version };\n let result = this._textEditChanges[textDocument.uri];\n if (!result) {\n const edits = [];\n const textDocumentEdit = {\n textDocument,\n edits\n };\n this._workspaceEdit.documentChanges.push(textDocumentEdit);\n result = new TextEditChangeImpl(edits, this._changeAnnotations);\n this._textEditChanges[textDocument.uri] = result;\n }\n return result;\n }\n else {\n this.initChanges();\n if (this._workspaceEdit.changes === undefined) {\n throw new Error('Workspace edit is not configured for normal text edit changes.');\n }\n let result = this._textEditChanges[key];\n if (!result) {\n let edits = [];\n this._workspaceEdit.changes[key] = edits;\n result = new TextEditChangeImpl(edits);\n this._textEditChanges[key] = result;\n }\n return result;\n }\n }\n initDocumentChanges() {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._changeAnnotations = new ChangeAnnotations();\n this._workspaceEdit.documentChanges = [];\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n }\n initChanges() {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._workspaceEdit.changes = Object.create(null);\n }\n }\n createFile(uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = CreateFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = CreateFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n renameFile(oldUri, newUri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = RenameFile.create(oldUri, newUri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = RenameFile.create(oldUri, newUri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n deleteFile(uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = DeleteFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = DeleteFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n}\n/**\n * The TextDocumentIdentifier namespace provides helper functions to work with\n * {@link TextDocumentIdentifier} literals.\n */\nexport var TextDocumentIdentifier;\n(function (TextDocumentIdentifier) {\n /**\n * Creates a new TextDocumentIdentifier literal.\n * @param uri The document's uri.\n */\n function create(uri) {\n return { uri };\n }\n TextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri);\n }\n TextDocumentIdentifier.is = is;\n})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\n/**\n * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link VersionedTextDocumentIdentifier} literals.\n */\nexport var VersionedTextDocumentIdentifier;\n(function (VersionedTextDocumentIdentifier) {\n /**\n * Creates a new VersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri, version };\n }\n VersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link VersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);\n }\n VersionedTextDocumentIdentifier.is = is;\n})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\n/**\n * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link OptionalVersionedTextDocumentIdentifier} literals.\n */\nexport var OptionalVersionedTextDocumentIdentifier;\n(function (OptionalVersionedTextDocumentIdentifier) {\n /**\n * Creates a new OptionalVersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri, version };\n }\n OptionalVersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link OptionalVersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));\n }\n OptionalVersionedTextDocumentIdentifier.is = is;\n})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));\n/**\n * The TextDocumentItem namespace provides helper functions to work with\n * {@link TextDocumentItem} literals.\n */\nexport var TextDocumentItem;\n(function (TextDocumentItem) {\n /**\n * Creates a new TextDocumentItem literal.\n * @param uri The document's uri.\n * @param languageId The document's language identifier.\n * @param version The document's version number.\n * @param text The document's text.\n */\n function create(uri, languageId, version, text) {\n return { uri, languageId, version, text };\n }\n TextDocumentItem.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentItem} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);\n }\n TextDocumentItem.is = is;\n})(TextDocumentItem || (TextDocumentItem = {}));\n/**\n * Describes the content type that a client supports in various\n * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\n *\n * Please note that `MarkupKinds` must not start with a `$`. This kinds\n * are reserved for internal usage.\n */\nexport var MarkupKind;\n(function (MarkupKind) {\n /**\n * Plain text is supported as a content format\n */\n MarkupKind.PlainText = 'plaintext';\n /**\n * Markdown is supported as a content format\n */\n MarkupKind.Markdown = 'markdown';\n /**\n * Checks whether the given value is a value of the {@link MarkupKind} type.\n */\n function is(value) {\n const candidate = value;\n return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\n }\n MarkupKind.is = is;\n})(MarkupKind || (MarkupKind = {}));\nexport var MarkupContent;\n(function (MarkupContent) {\n /**\n * Checks whether the given value conforms to the {@link MarkupContent} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\n }\n MarkupContent.is = is;\n})(MarkupContent || (MarkupContent = {}));\n/**\n * The kind of a completion entry.\n */\nexport var CompletionItemKind;\n(function (CompletionItemKind) {\n CompletionItemKind.Text = 1;\n CompletionItemKind.Method = 2;\n CompletionItemKind.Function = 3;\n CompletionItemKind.Constructor = 4;\n CompletionItemKind.Field = 5;\n CompletionItemKind.Variable = 6;\n CompletionItemKind.Class = 7;\n CompletionItemKind.Interface = 8;\n CompletionItemKind.Module = 9;\n CompletionItemKind.Property = 10;\n CompletionItemKind.Unit = 11;\n CompletionItemKind.Value = 12;\n CompletionItemKind.Enum = 13;\n CompletionItemKind.Keyword = 14;\n CompletionItemKind.Snippet = 15;\n CompletionItemKind.Color = 16;\n CompletionItemKind.File = 17;\n CompletionItemKind.Reference = 18;\n CompletionItemKind.Folder = 19;\n CompletionItemKind.EnumMember = 20;\n CompletionItemKind.Constant = 21;\n CompletionItemKind.Struct = 22;\n CompletionItemKind.Event = 23;\n CompletionItemKind.Operator = 24;\n CompletionItemKind.TypeParameter = 25;\n})(CompletionItemKind || (CompletionItemKind = {}));\n/**\n * Defines whether the insert text in a completion item should be interpreted as\n * plain text or a snippet.\n */\nexport var InsertTextFormat;\n(function (InsertTextFormat) {\n /**\n * The primary text to be inserted is treated as a plain string.\n */\n InsertTextFormat.PlainText = 1;\n /**\n * The primary text to be inserted is treated as a snippet.\n *\n * A snippet can define tab stops and placeholders with `$1`, `$2`\n * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\n * the end of the snippet. Placeholders with equal identifiers are linked,\n * that is typing in one will update others too.\n *\n * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax\n */\n InsertTextFormat.Snippet = 2;\n})(InsertTextFormat || (InsertTextFormat = {}));\n/**\n * Completion item tags are extra annotations that tweak the rendering of a completion\n * item.\n *\n * @since 3.15.0\n */\nexport var CompletionItemTag;\n(function (CompletionItemTag) {\n /**\n * Render a completion as obsolete, usually using a strike-out.\n */\n CompletionItemTag.Deprecated = 1;\n})(CompletionItemTag || (CompletionItemTag = {}));\n/**\n * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.\n *\n * @since 3.16.0\n */\nexport var InsertReplaceEdit;\n(function (InsertReplaceEdit) {\n /**\n * Creates a new insert / replace edit\n */\n function create(newText, insert, replace) {\n return { newText, insert, replace };\n }\n InsertReplaceEdit.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InsertReplaceEdit} interface.\n */\n function is(value) {\n const candidate = value;\n return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);\n }\n InsertReplaceEdit.is = is;\n})(InsertReplaceEdit || (InsertReplaceEdit = {}));\n/**\n * How whitespace and indentation is handled during completion\n * item insertion.\n *\n * @since 3.16.0\n */\nexport var InsertTextMode;\n(function (InsertTextMode) {\n /**\n * The insertion or replace strings is taken as it is. If the\n * value is multi line the lines below the cursor will be\n * inserted using the indentation defined in the string value.\n * The client will not apply any kind of adjustments to the\n * string.\n */\n InsertTextMode.asIs = 1;\n /**\n * The editor adjusts leading whitespace of new lines so that\n * they match the indentation up to the cursor of the line for\n * which the item is accepted.\n *\n * Consider a line like this: <2tabs><3tabs>foo. Accepting a\n * multi line completion item is indented using 2 tabs and all\n * following lines inserted will be indented using 2 tabs as well.\n */\n InsertTextMode.adjustIndentation = 2;\n})(InsertTextMode || (InsertTextMode = {}));\nexport var CompletionItemLabelDetails;\n(function (CompletionItemLabelDetails) {\n function is(value) {\n const candidate = value;\n return candidate && (Is.string(candidate.detail) || candidate.detail === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n CompletionItemLabelDetails.is = is;\n})(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));\n/**\n * The CompletionItem namespace provides functions to deal with\n * completion items.\n */\nexport var CompletionItem;\n(function (CompletionItem) {\n /**\n * Create a completion item and seed it with a label.\n * @param label The completion item's label\n */\n function create(label) {\n return { label };\n }\n CompletionItem.create = create;\n})(CompletionItem || (CompletionItem = {}));\n/**\n * The CompletionList namespace provides functions to deal with\n * completion lists.\n */\nexport var CompletionList;\n(function (CompletionList) {\n /**\n * Creates a new completion list.\n *\n * @param items The completion items.\n * @param isIncomplete The list is not complete.\n */\n function create(items, isIncomplete) {\n return { items: items ? items : [], isIncomplete: !!isIncomplete };\n }\n CompletionList.create = create;\n})(CompletionList || (CompletionList = {}));\nexport var MarkedString;\n(function (MarkedString) {\n /**\n * Creates a marked string from plain text.\n *\n * @param plainText The plain text.\n */\n function fromPlainText(plainText) {\n return plainText.replace(/[\\\\`*_{}[\\]()#+\\-.!]/g, '\\\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n }\n MarkedString.fromPlainText = fromPlainText;\n /**\n * Checks whether the given value conforms to the {@link MarkedString} type.\n */\n function is(value) {\n const candidate = value;\n return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\n }\n MarkedString.is = is;\n})(MarkedString || (MarkedString = {}));\nexport var Hover;\n(function (Hover) {\n /**\n * Checks whether the given value conforms to the {@link Hover} interface.\n */\n function is(value) {\n let candidate = value;\n return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\n MarkedString.is(candidate.contents) ||\n Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));\n }\n Hover.is = is;\n})(Hover || (Hover = {}));\n/**\n * The ParameterInformation namespace provides helper functions to work with\n * {@link ParameterInformation} literals.\n */\nexport var ParameterInformation;\n(function (ParameterInformation) {\n /**\n * Creates a new parameter information literal.\n *\n * @param label A label string.\n * @param documentation A doc string.\n */\n function create(label, documentation) {\n return documentation ? { label, documentation } : { label };\n }\n ParameterInformation.create = create;\n})(ParameterInformation || (ParameterInformation = {}));\n/**\n * The SignatureInformation namespace provides helper functions to work with\n * {@link SignatureInformation} literals.\n */\nexport var SignatureInformation;\n(function (SignatureInformation) {\n function create(label, documentation, ...parameters) {\n let result = { label };\n if (Is.defined(documentation)) {\n result.documentation = documentation;\n }\n if (Is.defined(parameters)) {\n result.parameters = parameters;\n }\n else {\n result.parameters = [];\n }\n return result;\n }\n SignatureInformation.create = create;\n})(SignatureInformation || (SignatureInformation = {}));\n/**\n * A document highlight kind.\n */\nexport var DocumentHighlightKind;\n(function (DocumentHighlightKind) {\n /**\n * A textual occurrence.\n */\n DocumentHighlightKind.Text = 1;\n /**\n * Read-access of a symbol, like reading a variable.\n */\n DocumentHighlightKind.Read = 2;\n /**\n * Write-access of a symbol, like writing to a variable.\n */\n DocumentHighlightKind.Write = 3;\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\n/**\n * DocumentHighlight namespace to provide helper functions to work with\n * {@link DocumentHighlight} literals.\n */\nexport var DocumentHighlight;\n(function (DocumentHighlight) {\n /**\n * Create a DocumentHighlight object.\n * @param range The range the highlight applies to.\n * @param kind The highlight kind\n */\n function create(range, kind) {\n let result = { range };\n if (Is.number(kind)) {\n result.kind = kind;\n }\n return result;\n }\n DocumentHighlight.create = create;\n})(DocumentHighlight || (DocumentHighlight = {}));\n/**\n * A symbol kind.\n */\nexport var SymbolKind;\n(function (SymbolKind) {\n SymbolKind.File = 1;\n SymbolKind.Module = 2;\n SymbolKind.Namespace = 3;\n SymbolKind.Package = 4;\n SymbolKind.Class = 5;\n SymbolKind.Method = 6;\n SymbolKind.Property = 7;\n SymbolKind.Field = 8;\n SymbolKind.Constructor = 9;\n SymbolKind.Enum = 10;\n SymbolKind.Interface = 11;\n SymbolKind.Function = 12;\n SymbolKind.Variable = 13;\n SymbolKind.Constant = 14;\n SymbolKind.String = 15;\n SymbolKind.Number = 16;\n SymbolKind.Boolean = 17;\n SymbolKind.Array = 18;\n SymbolKind.Object = 19;\n SymbolKind.Key = 20;\n SymbolKind.Null = 21;\n SymbolKind.EnumMember = 22;\n SymbolKind.Struct = 23;\n SymbolKind.Event = 24;\n SymbolKind.Operator = 25;\n SymbolKind.TypeParameter = 26;\n})(SymbolKind || (SymbolKind = {}));\n/**\n * Symbol tags are extra annotations that tweak the rendering of a symbol.\n *\n * @since 3.16\n */\nexport var SymbolTag;\n(function (SymbolTag) {\n /**\n * Render a symbol as obsolete, usually using a strike-out.\n */\n SymbolTag.Deprecated = 1;\n})(SymbolTag || (SymbolTag = {}));\nexport var SymbolInformation;\n(function (SymbolInformation) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the location of the symbol.\n * @param uri The resource of the location of symbol.\n * @param containerName The name of the symbol containing the symbol.\n */\n function create(name, kind, range, uri, containerName) {\n let result = {\n name,\n kind,\n location: { uri, range }\n };\n if (containerName) {\n result.containerName = containerName;\n }\n return result;\n }\n SymbolInformation.create = create;\n})(SymbolInformation || (SymbolInformation = {}));\nexport var WorkspaceSymbol;\n(function (WorkspaceSymbol) {\n /**\n * Create a new workspace symbol.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param uri The resource of the location of the symbol.\n * @param range An options range of the location.\n * @returns A WorkspaceSymbol.\n */\n function create(name, kind, uri, range) {\n return range !== undefined\n ? { name, kind, location: { uri, range } }\n : { name, kind, location: { uri } };\n }\n WorkspaceSymbol.create = create;\n})(WorkspaceSymbol || (WorkspaceSymbol = {}));\nexport var DocumentSymbol;\n(function (DocumentSymbol) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param detail The detail of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the symbol.\n * @param selectionRange The selectionRange of the symbol.\n * @param children Children of the symbol.\n */\n function create(name, detail, kind, range, selectionRange, children) {\n let result = {\n name,\n detail,\n kind,\n range,\n selectionRange\n };\n if (children !== undefined) {\n result.children = children;\n }\n return result;\n }\n DocumentSymbol.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentSymbol} interface.\n */\n function is(value) {\n let candidate = value;\n return candidate &&\n Is.string(candidate.name) && Is.number(candidate.kind) &&\n Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\n (candidate.detail === undefined || Is.string(candidate.detail)) &&\n (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&\n (candidate.children === undefined || Array.isArray(candidate.children)) &&\n (candidate.tags === undefined || Array.isArray(candidate.tags));\n }\n DocumentSymbol.is = is;\n})(DocumentSymbol || (DocumentSymbol = {}));\n/**\n * A set of predefined code action kinds\n */\nexport var CodeActionKind;\n(function (CodeActionKind) {\n /**\n * Empty kind.\n */\n CodeActionKind.Empty = '';\n /**\n * Base kind for quickfix actions: 'quickfix'\n */\n CodeActionKind.QuickFix = 'quickfix';\n /**\n * Base kind for refactoring actions: 'refactor'\n */\n CodeActionKind.Refactor = 'refactor';\n /**\n * Base kind for refactoring extraction actions: 'refactor.extract'\n *\n * Example extract actions:\n *\n * - Extract method\n * - Extract function\n * - Extract variable\n * - Extract interface from class\n * - ...\n */\n CodeActionKind.RefactorExtract = 'refactor.extract';\n /**\n * Base kind for refactoring inline actions: 'refactor.inline'\n *\n * Example inline actions:\n *\n * - Inline function\n * - Inline variable\n * - Inline constant\n * - ...\n */\n CodeActionKind.RefactorInline = 'refactor.inline';\n /**\n * Base kind for refactoring rewrite actions: 'refactor.rewrite'\n *\n * Example rewrite actions:\n *\n * - Convert JavaScript function to class\n * - Add or remove parameter\n * - Encapsulate field\n * - Make method static\n * - Move method to base class\n * - ...\n */\n CodeActionKind.RefactorRewrite = 'refactor.rewrite';\n /**\n * Base kind for source actions: `source`\n *\n * Source code actions apply to the entire file.\n */\n CodeActionKind.Source = 'source';\n /**\n * Base kind for an organize imports source action: `source.organizeImports`\n */\n CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\n /**\n * Base kind for auto-fix source actions: `source.fixAll`.\n *\n * Fix all actions automatically fix errors that have a clear fix that do not require user input.\n * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\n *\n * @since 3.15.0\n */\n CodeActionKind.SourceFixAll = 'source.fixAll';\n})(CodeActionKind || (CodeActionKind = {}));\n/**\n * The reason why code actions were requested.\n *\n * @since 3.17.0\n */\nexport var CodeActionTriggerKind;\n(function (CodeActionTriggerKind) {\n /**\n * Code actions were explicitly requested by the user or by an extension.\n */\n CodeActionTriggerKind.Invoked = 1;\n /**\n * Code actions were requested automatically.\n *\n * This typically happens when current selection in a file changes, but can\n * also be triggered when file content changes.\n */\n CodeActionTriggerKind.Automatic = 2;\n})(CodeActionTriggerKind || (CodeActionTriggerKind = {}));\n/**\n * The CodeActionContext namespace provides helper functions to work with\n * {@link CodeActionContext} literals.\n */\nexport var CodeActionContext;\n(function (CodeActionContext) {\n /**\n * Creates a new CodeActionContext literal.\n */\n function create(diagnostics, only, triggerKind) {\n let result = { diagnostics };\n if (only !== undefined && only !== null) {\n result.only = only;\n }\n if (triggerKind !== undefined && triggerKind !== null) {\n result.triggerKind = triggerKind;\n }\n return result;\n }\n CodeActionContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeActionContext} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is)\n && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string))\n && (candidate.triggerKind === undefined || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);\n }\n CodeActionContext.is = is;\n})(CodeActionContext || (CodeActionContext = {}));\nexport var CodeAction;\n(function (CodeAction) {\n function create(title, kindOrCommandOrEdit, kind) {\n let result = { title };\n let checkKind = true;\n if (typeof kindOrCommandOrEdit === 'string') {\n checkKind = false;\n result.kind = kindOrCommandOrEdit;\n }\n else if (Command.is(kindOrCommandOrEdit)) {\n result.command = kindOrCommandOrEdit;\n }\n else {\n result.edit = kindOrCommandOrEdit;\n }\n if (checkKind && kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n CodeAction.create = create;\n function is(value) {\n let candidate = value;\n return candidate && Is.string(candidate.title) &&\n (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\n (candidate.kind === undefined || Is.string(candidate.kind)) &&\n (candidate.edit !== undefined || candidate.command !== undefined) &&\n (candidate.command === undefined || Command.is(candidate.command)) &&\n (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&\n (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));\n }\n CodeAction.is = is;\n})(CodeAction || (CodeAction = {}));\n/**\n * The CodeLens namespace provides helper functions to work with\n * {@link CodeLens} literals.\n */\nexport var CodeLens;\n(function (CodeLens) {\n /**\n * Creates a new CodeLens literal.\n */\n function create(range, data) {\n let result = { range };\n if (Is.defined(data)) {\n result.data = data;\n }\n return result;\n }\n CodeLens.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeLens} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\n }\n CodeLens.is = is;\n})(CodeLens || (CodeLens = {}));\n/**\n * The FormattingOptions namespace provides helper functions to work with\n * {@link FormattingOptions} literals.\n */\nexport var FormattingOptions;\n(function (FormattingOptions) {\n /**\n * Creates a new FormattingOptions literal.\n */\n function create(tabSize, insertSpaces) {\n return { tabSize, insertSpaces };\n }\n FormattingOptions.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FormattingOptions} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\n }\n FormattingOptions.is = is;\n})(FormattingOptions || (FormattingOptions = {}));\n/**\n * The DocumentLink namespace provides helper functions to work with\n * {@link DocumentLink} literals.\n */\nexport var DocumentLink;\n(function (DocumentLink) {\n /**\n * Creates a new DocumentLink literal.\n */\n function create(range, target, data) {\n return { range, target, data };\n }\n DocumentLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentLink} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\n }\n DocumentLink.is = is;\n})(DocumentLink || (DocumentLink = {}));\n/**\n * The SelectionRange namespace provides helper function to work with\n * SelectionRange literals.\n */\nexport var SelectionRange;\n(function (SelectionRange) {\n /**\n * Creates a new SelectionRange\n * @param range the range.\n * @param parent an optional parent.\n */\n function create(range, parent) {\n return { range, parent };\n }\n SelectionRange.create = create;\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\n }\n SelectionRange.is = is;\n})(SelectionRange || (SelectionRange = {}));\n/**\n * A set of predefined token types. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\nexport var SemanticTokenTypes;\n(function (SemanticTokenTypes) {\n SemanticTokenTypes[\"namespace\"] = \"namespace\";\n /**\n * Represents a generic type. Acts as a fallback for types which can't be mapped to\n * a specific type like class or enum.\n */\n SemanticTokenTypes[\"type\"] = \"type\";\n SemanticTokenTypes[\"class\"] = \"class\";\n SemanticTokenTypes[\"enum\"] = \"enum\";\n SemanticTokenTypes[\"interface\"] = \"interface\";\n SemanticTokenTypes[\"struct\"] = \"struct\";\n SemanticTokenTypes[\"typeParameter\"] = \"typeParameter\";\n SemanticTokenTypes[\"parameter\"] = \"parameter\";\n SemanticTokenTypes[\"variable\"] = \"variable\";\n SemanticTokenTypes[\"property\"] = \"property\";\n SemanticTokenTypes[\"enumMember\"] = \"enumMember\";\n SemanticTokenTypes[\"event\"] = \"event\";\n SemanticTokenTypes[\"function\"] = \"function\";\n SemanticTokenTypes[\"method\"] = \"method\";\n SemanticTokenTypes[\"macro\"] = \"macro\";\n SemanticTokenTypes[\"keyword\"] = \"keyword\";\n SemanticTokenTypes[\"modifier\"] = \"modifier\";\n SemanticTokenTypes[\"comment\"] = \"comment\";\n SemanticTokenTypes[\"string\"] = \"string\";\n SemanticTokenTypes[\"number\"] = \"number\";\n SemanticTokenTypes[\"regexp\"] = \"regexp\";\n SemanticTokenTypes[\"operator\"] = \"operator\";\n /**\n * @since 3.17.0\n */\n SemanticTokenTypes[\"decorator\"] = \"decorator\";\n})(SemanticTokenTypes || (SemanticTokenTypes = {}));\n/**\n * A set of predefined token modifiers. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\nexport var SemanticTokenModifiers;\n(function (SemanticTokenModifiers) {\n SemanticTokenModifiers[\"declaration\"] = \"declaration\";\n SemanticTokenModifiers[\"definition\"] = \"definition\";\n SemanticTokenModifiers[\"readonly\"] = \"readonly\";\n SemanticTokenModifiers[\"static\"] = \"static\";\n SemanticTokenModifiers[\"deprecated\"] = \"deprecated\";\n SemanticTokenModifiers[\"abstract\"] = \"abstract\";\n SemanticTokenModifiers[\"async\"] = \"async\";\n SemanticTokenModifiers[\"modification\"] = \"modification\";\n SemanticTokenModifiers[\"documentation\"] = \"documentation\";\n SemanticTokenModifiers[\"defaultLibrary\"] = \"defaultLibrary\";\n})(SemanticTokenModifiers || (SemanticTokenModifiers = {}));\n/**\n * @since 3.16.0\n */\nexport var SemanticTokens;\n(function (SemanticTokens) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\n Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\n }\n SemanticTokens.is = is;\n})(SemanticTokens || (SemanticTokens = {}));\n/**\n * The InlineValueText namespace provides functions to deal with InlineValueTexts.\n *\n * @since 3.17.0\n */\nexport var InlineValueText;\n(function (InlineValueText) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, text) {\n return { range, text };\n }\n InlineValueText.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);\n }\n InlineValueText.is = is;\n})(InlineValueText || (InlineValueText = {}));\n/**\n * The InlineValueVariableLookup namespace provides functions to deal with InlineValueVariableLookups.\n *\n * @since 3.17.0\n */\nexport var InlineValueVariableLookup;\n(function (InlineValueVariableLookup) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, variableName, caseSensitiveLookup) {\n return { range, variableName, caseSensitiveLookup };\n }\n InlineValueVariableLookup.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup)\n && (Is.string(candidate.variableName) || candidate.variableName === undefined);\n }\n InlineValueVariableLookup.is = is;\n})(InlineValueVariableLookup || (InlineValueVariableLookup = {}));\n/**\n * The InlineValueEvaluatableExpression namespace provides functions to deal with InlineValueEvaluatableExpression.\n *\n * @since 3.17.0\n */\nexport var InlineValueEvaluatableExpression;\n(function (InlineValueEvaluatableExpression) {\n /**\n * Creates a new InlineValueEvaluatableExpression literal.\n */\n function create(range, expression) {\n return { range, expression };\n }\n InlineValueEvaluatableExpression.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range)\n && (Is.string(candidate.expression) || candidate.expression === undefined);\n }\n InlineValueEvaluatableExpression.is = is;\n})(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));\n/**\n * The InlineValueContext namespace provides helper functions to work with\n * {@link InlineValueContext} literals.\n *\n * @since 3.17.0\n */\nexport var InlineValueContext;\n(function (InlineValueContext) {\n /**\n * Creates a new InlineValueContext literal.\n */\n function create(frameId, stoppedLocation) {\n return { frameId, stoppedLocation };\n }\n InlineValueContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InlineValueContext} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.defined(candidate) && Range.is(value.stoppedLocation);\n }\n InlineValueContext.is = is;\n})(InlineValueContext || (InlineValueContext = {}));\n/**\n * Inlay hint kinds.\n *\n * @since 3.17.0\n */\nexport var InlayHintKind;\n(function (InlayHintKind) {\n /**\n * An inlay hint that for a type annotation.\n */\n InlayHintKind.Type = 1;\n /**\n * An inlay hint that is for a parameter.\n */\n InlayHintKind.Parameter = 2;\n function is(value) {\n return value === 1 || value === 2;\n }\n InlayHintKind.is = is;\n})(InlayHintKind || (InlayHintKind = {}));\nexport var InlayHintLabelPart;\n(function (InlayHintLabelPart) {\n function create(value) {\n return { value };\n }\n InlayHintLabelPart.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.location === undefined || Location.is(candidate.location))\n && (candidate.command === undefined || Command.is(candidate.command));\n }\n InlayHintLabelPart.is = is;\n})(InlayHintLabelPart || (InlayHintLabelPart = {}));\nexport var InlayHint;\n(function (InlayHint) {\n function create(position, label, kind) {\n const result = { position, label };\n if (kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n InlayHint.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.position)\n && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is))\n && (candidate.kind === undefined || InlayHintKind.is(candidate.kind))\n && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft))\n && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight));\n }\n InlayHint.is = is;\n})(InlayHint || (InlayHint = {}));\nexport var StringValue;\n(function (StringValue) {\n function createSnippet(value) {\n return { kind: 'snippet', value };\n }\n StringValue.createSnippet = createSnippet;\n})(StringValue || (StringValue = {}));\nexport var InlineCompletionItem;\n(function (InlineCompletionItem) {\n function create(insertText, filterText, range, command) {\n return { insertText, filterText, range, command };\n }\n InlineCompletionItem.create = create;\n})(InlineCompletionItem || (InlineCompletionItem = {}));\nexport var InlineCompletionList;\n(function (InlineCompletionList) {\n function create(items) {\n return { items };\n }\n InlineCompletionList.create = create;\n})(InlineCompletionList || (InlineCompletionList = {}));\n/**\n * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.\n *\n * @since 3.18.0\n * @proposed\n */\nexport var InlineCompletionTriggerKind;\n(function (InlineCompletionTriggerKind) {\n /**\n * Completion was triggered explicitly by a user gesture.\n */\n InlineCompletionTriggerKind.Invoked = 0;\n /**\n * Completion was triggered automatically while editing.\n */\n InlineCompletionTriggerKind.Automatic = 1;\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\nexport var SelectedCompletionInfo;\n(function (SelectedCompletionInfo) {\n function create(range, text) {\n return { range, text };\n }\n SelectedCompletionInfo.create = create;\n})(SelectedCompletionInfo || (SelectedCompletionInfo = {}));\nexport var InlineCompletionContext;\n(function (InlineCompletionContext) {\n function create(triggerKind, selectedCompletionInfo) {\n return { triggerKind, selectedCompletionInfo };\n }\n InlineCompletionContext.create = create;\n})(InlineCompletionContext || (InlineCompletionContext = {}));\nexport var WorkspaceFolder;\n(function (WorkspaceFolder) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);\n }\n WorkspaceFolder.is = is;\n})(WorkspaceFolder || (WorkspaceFolder = {}));\nexport const EOL = ['\\n', '\\r\\n', '\\r'];\n/**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\nexport var TextDocument;\n(function (TextDocument) {\n /**\n * Creates a new ITextDocument literal from the given uri and content.\n * @param uri The document's uri.\n * @param languageId The document's language Id.\n * @param version The document's version.\n * @param content The document's content.\n */\n function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }\n TextDocument.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ITextDocument} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)\n && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\n }\n TextDocument.is = is;\n function applyEdits(document, edits) {\n let text = document.getText();\n let sortedEdits = mergeSort(edits, (a, b) => {\n let diff = a.range.start.line - b.range.start.line;\n if (diff === 0) {\n return a.range.start.character - b.range.start.character;\n }\n return diff;\n });\n let lastModifiedOffset = text.length;\n for (let i = sortedEdits.length - 1; i >= 0; i--) {\n let e = sortedEdits[i];\n let startOffset = document.offsetAt(e.range.start);\n let endOffset = document.offsetAt(e.range.end);\n if (endOffset <= lastModifiedOffset) {\n text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\n }\n else {\n throw new Error('Overlapping edit');\n }\n lastModifiedOffset = startOffset;\n }\n return text;\n }\n TextDocument.applyEdits = applyEdits;\n function mergeSort(data, compare) {\n if (data.length <= 1) {\n // sorted\n return data;\n }\n const p = (data.length / 2) | 0;\n const left = data.slice(0, p);\n const right = data.slice(p);\n mergeSort(left, compare);\n mergeSort(right, compare);\n let leftIdx = 0;\n let rightIdx = 0;\n let i = 0;\n while (leftIdx < left.length && rightIdx < right.length) {\n let ret = compare(left[leftIdx], right[rightIdx]);\n if (ret <= 0) {\n // smaller_equal -> take left to preserve order\n data[i++] = left[leftIdx++];\n }\n else {\n // greater -> take right\n data[i++] = right[rightIdx++];\n }\n }\n while (leftIdx < left.length) {\n data[i++] = left[leftIdx++];\n }\n while (rightIdx < right.length) {\n data[i++] = right[rightIdx++];\n }\n return data;\n }\n})(TextDocument || (TextDocument = {}));\n/**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\nclass FullTextDocument {\n constructor(uri, languageId, version, content) {\n this._uri = uri;\n this._languageId = languageId;\n this._version = version;\n this._content = content;\n this._lineOffsets = undefined;\n }\n get uri() {\n return this._uri;\n }\n get languageId() {\n return this._languageId;\n }\n get version() {\n return this._version;\n }\n getText(range) {\n if (range) {\n let start = this.offsetAt(range.start);\n let end = this.offsetAt(range.end);\n return this._content.substring(start, end);\n }\n return this._content;\n }\n update(event, version) {\n this._content = event.text;\n this._version = version;\n this._lineOffsets = undefined;\n }\n getLineOffsets() {\n if (this._lineOffsets === undefined) {\n let lineOffsets = [];\n let text = this._content;\n let isLineStart = true;\n for (let i = 0; i < text.length; i++) {\n if (isLineStart) {\n lineOffsets.push(i);\n isLineStart = false;\n }\n let ch = text.charAt(i);\n isLineStart = (ch === '\\r' || ch === '\\n');\n if (ch === '\\r' && i + 1 < text.length && text.charAt(i + 1) === '\\n') {\n i++;\n }\n }\n if (isLineStart && text.length > 0) {\n lineOffsets.push(text.length);\n }\n this._lineOffsets = lineOffsets;\n }\n return this._lineOffsets;\n }\n positionAt(offset) {\n offset = Math.max(Math.min(offset, this._content.length), 0);\n let lineOffsets = this.getLineOffsets();\n let low = 0, high = lineOffsets.length;\n if (high === 0) {\n return Position.create(0, offset);\n }\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n if (lineOffsets[mid] > offset) {\n high = mid;\n }\n else {\n low = mid + 1;\n }\n }\n // low is the least x for which the line offset is larger than the current offset\n // or array.length if no line offset is larger than the current offset\n let line = low - 1;\n return Position.create(line, offset - lineOffsets[line]);\n }\n offsetAt(position) {\n let lineOffsets = this.getLineOffsets();\n if (position.line >= lineOffsets.length) {\n return this._content.length;\n }\n else if (position.line < 0) {\n return 0;\n }\n let lineOffset = lineOffsets[position.line];\n let nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\n return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\n }\n get lineCount() {\n return this.getLineOffsets().length;\n }\n}\nvar Is;\n(function (Is) {\n const toString = Object.prototype.toString;\n function defined(value) {\n return typeof value !== 'undefined';\n }\n Is.defined = defined;\n function undefined(value) {\n return typeof value === 'undefined';\n }\n Is.undefined = undefined;\n function boolean(value) {\n return value === true || value === false;\n }\n Is.boolean = boolean;\n function string(value) {\n return toString.call(value) === '[object String]';\n }\n Is.string = string;\n function number(value) {\n return toString.call(value) === '[object Number]';\n }\n Is.number = number;\n function numberRange(value, min, max) {\n return toString.call(value) === '[object Number]' && min <= value && value <= max;\n }\n Is.numberRange = numberRange;\n function integer(value) {\n return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;\n }\n Is.integer = integer;\n function uinteger(value) {\n return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;\n }\n Is.uinteger = uinteger;\n function func(value) {\n return toString.call(value) === '[object Function]';\n }\n Is.func = func;\n function objectLiteral(value) {\n // Strictly speaking class instances pass this check as well. Since the LSP\n // doesn't use classes we ignore this for now. If we do we need to add something\n // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\n return value !== null && typeof value === 'object';\n }\n Is.objectLiteral = objectLiteral;\n function typedArray(value, check) {\n return Array.isArray(value) && value.every(check);\n }\n Is.typedArray = typedArray;\n})(Is || (Is = {}));\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { IToken, TokenType } from 'chevrotain';\nimport type { Range } from 'vscode-languageserver-types';\nimport type { AbstractElement } from '../languages/generated/ast.js';\nimport type { AstNode, CompositeCstNode, CstNode, LeafCstNode, RootCstNode } from '../syntax-tree.js';\nimport { Position } from 'vscode-languageserver-types';\nimport { isCompositeCstNode } from '../syntax-tree.js';\nimport { tokenToRange } from '../utils/cst-utils.js';\n\nexport class CstNodeBuilder {\n\n private rootNode!: RootCstNodeImpl;\n private nodeStack: CompositeCstNodeImpl[] = [];\n\n private get current(): CompositeCstNodeImpl {\n return this.nodeStack[this.nodeStack.length - 1];\n }\n\n buildRootNode(input: string): RootCstNode {\n this.rootNode = new RootCstNodeImpl(input);\n this.rootNode.root = this.rootNode;\n this.nodeStack = [this.rootNode];\n return this.rootNode;\n }\n\n buildCompositeNode(feature: AbstractElement): CompositeCstNode {\n const compositeNode = new CompositeCstNodeImpl();\n compositeNode.grammarSource = feature;\n compositeNode.root = this.rootNode;\n this.current.content.push(compositeNode);\n this.nodeStack.push(compositeNode);\n return compositeNode;\n }\n\n buildLeafNode(token: IToken, feature: AbstractElement): LeafCstNode {\n const leafNode = new LeafCstNodeImpl(token.startOffset, token.image.length, tokenToRange(token), token.tokenType, false);\n leafNode.grammarSource = feature;\n leafNode.root = this.rootNode;\n this.current.content.push(leafNode);\n return leafNode;\n }\n\n removeNode(node: CstNode): void {\n const parent = node.container;\n if (parent) {\n const index = parent.content.indexOf(node);\n if (index >= 0) {\n parent.content.splice(index, 1);\n }\n }\n }\n\n construct(item: { $type: string | symbol | undefined, $cstNode: CstNode }): void {\n const current: CstNode = this.current;\n // The specified item could be a datatype ($type is symbol) or a fragment ($type is undefined)\n // Only if the $type is a string, we actually assign the element\n if (typeof item.$type === 'string') {\n this.current.astNode = item;\n }\n item.$cstNode = current;\n const node = this.nodeStack.pop();\n // Empty composite nodes are not valid\n // Simply remove the node from the tree\n if (node?.content.length === 0) {\n this.removeNode(node);\n }\n }\n\n addHiddenTokens(hiddenTokens: IToken[]): void {\n for (const token of hiddenTokens) {\n const hiddenNode = new LeafCstNodeImpl(token.startOffset, token.image.length, tokenToRange(token), token.tokenType, true);\n hiddenNode.root = this.rootNode;\n this.addHiddenToken(this.rootNode, hiddenNode);\n }\n }\n\n private addHiddenToken(node: CompositeCstNode, token: LeafCstNode): void {\n const { offset: tokenStart, end: tokenEnd } = token;\n\n for (let i = 0; i < node.content.length; i++) {\n const child = node.content[i];\n const { offset: childStart, end: childEnd } = child;\n if (isCompositeCstNode(child) && tokenStart > childStart && tokenEnd < childEnd) {\n this.addHiddenToken(child, token);\n return;\n } else if (tokenEnd <= childStart) {\n node.content.splice(i, 0, token);\n return;\n }\n }\n\n // We know that we haven't found a suited position for the token\n // So we simply add it to the end of the current node\n node.content.push(token);\n }\n}\n\nexport abstract class AbstractCstNode implements CstNode {\n abstract get offset(): number;\n abstract get length(): number;\n abstract get end(): number;\n abstract get range(): Range;\n\n container?: CompositeCstNode;\n grammarSource: AbstractElement;\n root: RootCstNode;\n private _astNode?: AstNode;\n\n /** @deprecated use `container` instead. */\n get parent(): CompositeCstNode | undefined {\n return this.container;\n }\n\n /** @deprecated use `grammarSource` instead. */\n get feature(): AbstractElement {\n return this.grammarSource;\n }\n\n get hidden(): boolean {\n return false;\n }\n\n get astNode(): AstNode {\n const node = typeof this._astNode?.$type === 'string' ? this._astNode : this.container?.astNode;\n if (!node) {\n throw new Error('This node has no associated AST element');\n }\n return node;\n }\n\n set astNode(value: AstNode) {\n this._astNode = value;\n }\n\n /** @deprecated use `astNode` instead. */\n get element(): AstNode {\n return this.astNode;\n }\n\n get text(): string {\n return this.root.fullText.substring(this.offset, this.end);\n }\n}\n\nexport class LeafCstNodeImpl extends AbstractCstNode implements LeafCstNode {\n get offset(): number {\n return this._offset;\n }\n\n get length(): number {\n return this._length;\n }\n\n get end(): number {\n return this._offset + this._length;\n }\n\n override get hidden(): boolean {\n return this._hidden;\n }\n\n get tokenType(): TokenType {\n return this._tokenType;\n }\n\n get range(): Range {\n return this._range;\n }\n\n private _hidden: boolean;\n private _offset: number;\n private _length: number;\n private _range: Range;\n private _tokenType: TokenType;\n\n constructor(offset: number, length: number, range: Range, tokenType: TokenType, hidden = false) {\n super();\n this._hidden = hidden;\n this._offset = offset;\n this._tokenType = tokenType;\n this._length = length;\n this._range = range;\n }\n}\n\nexport class CompositeCstNodeImpl extends AbstractCstNode implements CompositeCstNode {\n readonly content: CstNode[] = new CstNodeContainer(this);\n private _rangeCache?: Range;\n\n /** @deprecated use `content` instead. */\n get children(): CstNode[] {\n return this.content;\n }\n\n get offset(): number {\n return this.firstNonHiddenNode?.offset ?? 0;\n }\n\n get length(): number {\n return this.end - this.offset;\n }\n\n get end(): number {\n return this.lastNonHiddenNode?.end ?? 0;\n }\n\n get range(): Range {\n const firstNode = this.firstNonHiddenNode;\n const lastNode = this.lastNonHiddenNode;\n if (firstNode && lastNode) {\n if (this._rangeCache === undefined) {\n const { range: firstRange } = firstNode;\n const { range: lastRange } = lastNode;\n this._rangeCache = { start: firstRange.start, end: lastRange.end.line < firstRange.start.line ? firstRange.start : lastRange.end };\n }\n return this._rangeCache;\n } else {\n return { start: Position.create(0, 0), end: Position.create(0, 0) };\n }\n }\n\n private get firstNonHiddenNode(): CstNode | undefined {\n for (const child of this.content) {\n if (!child.hidden) {\n return child;\n }\n }\n return this.content[0];\n }\n\n private get lastNonHiddenNode(): CstNode | undefined {\n for (let i = this.content.length - 1; i >= 0; i--) {\n const child = this.content[i];\n if (!child.hidden) {\n return child;\n }\n }\n return this.content[this.content.length - 1];\n }\n}\n\nclass CstNodeContainer extends Array {\n readonly parent: CompositeCstNode;\n\n constructor(parent: CompositeCstNode) {\n super();\n this.parent = parent;\n Object.setPrototypeOf(this, CstNodeContainer.prototype);\n }\n\n override push(...items: CstNode[]): number {\n this.addParents(items);\n return super.push(...items);\n }\n\n override unshift(...items: CstNode[]): number {\n this.addParents(items);\n return super.unshift(...items);\n }\n\n override splice(start: number, count: number, ...items: CstNode[]): CstNode[] {\n this.addParents(items);\n return super.splice(start, count, ...items);\n }\n\n private addParents(items: CstNode[]): void {\n for (const item of items) {\n (item).container = this.parent;\n }\n }\n}\n\nexport class RootCstNodeImpl extends CompositeCstNodeImpl implements RootCstNode {\n private _text = '';\n\n override get text(): string {\n return this._text.substring(this.offset, this.end);\n }\n\n get fullText(): string {\n return this._text;\n }\n\n constructor(input?: string) {\n super();\n this._text = input ?? '';\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DSLMethodOpts, ILexingError, IOrAlt, IParserErrorMessageProvider, IRecognitionException, IToken, TokenType, TokenVocabulary } from 'chevrotain';\nimport type { AbstractElement, Action, Assignment, ParserRule } from '../languages/generated/ast.js';\nimport type { Linker } from '../references/linker.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstReflection, CompositeCstNode, CstNode } from '../syntax-tree.js';\nimport type { Lexer } from './lexer.js';\nimport type { IParserConfig } from './parser-config.js';\nimport type { ValueConverter } from './value-converter.js';\nimport { defaultParserErrorProvider, EmbeddedActionsParser, LLkLookaheadStrategy } from 'chevrotain';\nimport { LLStarLookaheadStrategy } from 'chevrotain-allstar';\nimport { isAssignment, isCrossReference, isKeyword } from '../languages/generated/ast.js';\nimport { getTypeName, isDataTypeRule } from '../utils/grammar-utils.js';\nimport { assignMandatoryProperties, getContainerOfType, linkContentToContainer } from '../utils/ast-utils.js';\nimport { CstNodeBuilder } from './cst-node-builder.js';\n\nexport type ParseResult = {\n value: T,\n parserErrors: IRecognitionException[],\n lexerErrors: ILexingError[]\n}\n\nexport const DatatypeSymbol = Symbol('Datatype');\n\ninterface DataTypeNode {\n $cstNode: CompositeCstNode\n /** Instead of a string, this node is uniquely identified by the `Datatype` symbol */\n $type: symbol\n /** Used as a storage for all parsed terminals, keywords and sub-datatype rules */\n value: string\n}\n\nfunction isDataTypeNode(node: { $type: string | symbol | undefined }): node is DataTypeNode {\n return node.$type === DatatypeSymbol;\n}\n\ntype RuleResult = (args: Args) => any;\n\ntype Args = Record;\n\ntype RuleImpl = (args: Args) => any;\n\ninterface AssignmentElement {\n assignment?: Assignment\n isCrossRef: boolean\n}\n\nexport interface BaseParser {\n rule(rule: ParserRule, impl: RuleImpl): RuleResult;\n alternatives(idx: number, choices: Array>): void;\n optional(idx: number, callback: DSLMethodOpts): void;\n many(idx: number, callback: DSLMethodOpts): void;\n atLeastOne(idx: number, callback: DSLMethodOpts): void;\n consume(idx: number, tokenType: TokenType, feature: AbstractElement): void;\n subrule(idx: number, rule: RuleResult, feature: AbstractElement, args: Args): void;\n action($type: string, action: Action): void;\n construct(): unknown;\n isRecording(): boolean;\n get unorderedGroups(): Map;\n getRuleStack(): number[];\n}\n\nconst ruleSuffix = '\\u200B';\nconst withRuleSuffix = (name: string): string => name.endsWith(ruleSuffix) ? name : name + ruleSuffix;\n\nexport abstract class AbstractLangiumParser implements BaseParser {\n\n protected readonly lexer: Lexer;\n protected readonly wrapper: ChevrotainWrapper;\n protected _unorderedGroups: Map = new Map();\n\n constructor(services: LangiumCoreServices) {\n this.lexer = services.parser.Lexer;\n const tokens = this.lexer.definition;\n this.wrapper = new ChevrotainWrapper(tokens, {\n ...services.parser.ParserConfig,\n errorMessageProvider: services.parser.ParserErrorMessageProvider\n });\n }\n\n alternatives(idx: number, choices: Array>): void {\n this.wrapper.wrapOr(idx, choices);\n }\n\n optional(idx: number, callback: DSLMethodOpts): void {\n this.wrapper.wrapOption(idx, callback);\n }\n\n many(idx: number, callback: DSLMethodOpts): void {\n this.wrapper.wrapMany(idx, callback);\n }\n\n atLeastOne(idx: number, callback: DSLMethodOpts): void {\n this.wrapper.wrapAtLeastOne(idx, callback);\n }\n\n abstract rule(rule: ParserRule, impl: RuleImpl): RuleResult;\n abstract consume(idx: number, tokenType: TokenType, feature: AbstractElement): void;\n abstract subrule(idx: number, rule: RuleResult, feature: AbstractElement, args: Args): void;\n abstract action($type: string, action: Action): void;\n abstract construct(): unknown;\n\n isRecording(): boolean {\n return this.wrapper.IS_RECORDING;\n }\n\n get unorderedGroups(): Map {\n return this._unorderedGroups;\n }\n\n getRuleStack(): number[] {\n return (this.wrapper as any).RULE_STACK;\n }\n\n finalize(): void {\n this.wrapper.wrapSelfAnalysis();\n }\n}\n\nexport class LangiumParser extends AbstractLangiumParser {\n private readonly linker: Linker;\n private readonly converter: ValueConverter;\n private readonly astReflection: AstReflection;\n private readonly nodeBuilder = new CstNodeBuilder();\n private stack: any[] = [];\n private mainRule!: RuleResult;\n private assignmentMap = new Map();\n\n private get current(): any {\n return this.stack[this.stack.length - 1];\n }\n\n constructor(services: LangiumCoreServices) {\n super(services);\n this.linker = services.references.Linker;\n this.converter = services.parser.ValueConverter;\n this.astReflection = services.shared.AstReflection;\n }\n\n rule(rule: ParserRule, impl: RuleImpl): RuleResult {\n const type = rule.fragment ? undefined : isDataTypeRule(rule) ? DatatypeSymbol : getTypeName(rule);\n const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(type, impl).bind(this));\n if (rule.entry) {\n this.mainRule = ruleMethod;\n }\n return ruleMethod;\n }\n\n parse(input: string): ParseResult {\n this.nodeBuilder.buildRootNode(input);\n const lexerResult = this.lexer.tokenize(input);\n this.wrapper.input = lexerResult.tokens;\n const result = this.mainRule.call(this.wrapper, {});\n this.nodeBuilder.addHiddenTokens(lexerResult.hidden);\n this.unorderedGroups.clear();\n return {\n value: result,\n lexerErrors: lexerResult.errors,\n parserErrors: this.wrapper.errors\n };\n }\n\n private startImplementation($type: string | symbol | undefined, implementation: RuleImpl): RuleImpl {\n return (args) => {\n if (!this.isRecording()) {\n const node: any = { $type };\n this.stack.push(node);\n if ($type === DatatypeSymbol) {\n node.value = '';\n }\n }\n let result: unknown;\n try {\n result = implementation(args);\n } catch (err) {\n result = undefined;\n }\n if (!this.isRecording() && result === undefined) {\n result = this.construct();\n }\n return result;\n };\n }\n\n consume(idx: number, tokenType: TokenType, feature: AbstractElement): void {\n const token = this.wrapper.wrapConsume(idx, tokenType);\n if (!this.isRecording() && this.isValidToken(token)) {\n const leafNode = this.nodeBuilder.buildLeafNode(token, feature);\n const { assignment, isCrossRef } = this.getAssignment(feature);\n const current = this.current;\n if (assignment) {\n const convertedValue = isKeyword(feature) ? token.image : this.converter.convert(token.image, leafNode);\n this.assign(assignment.operator, assignment.feature, convertedValue, leafNode, isCrossRef);\n } else if (isDataTypeNode(current)) {\n let text = token.image;\n if (!isKeyword(feature)) {\n text = this.converter.convert(text, leafNode).toString();\n }\n current.value += text;\n }\n }\n }\n\n /**\n * Most consumed parser tokens are valid. However there are two cases in which they are not valid:\n *\n * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed\n * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders.\n */\n private isValidToken(token: IToken): boolean {\n return !token.isInsertedInRecovery && !isNaN(token.startOffset) && typeof token.endOffset === 'number' && !isNaN(token.endOffset);\n }\n\n subrule(idx: number, rule: RuleResult, feature: AbstractElement, args: Args): void {\n let cstNode: CompositeCstNode | undefined;\n if (!this.isRecording()) {\n cstNode = this.nodeBuilder.buildCompositeNode(feature);\n }\n const subruleResult = this.wrapper.wrapSubrule(idx, rule, args) as any;\n if (!this.isRecording() && cstNode && cstNode.length > 0) {\n this.performSubruleAssignment(subruleResult, feature, cstNode);\n }\n }\n\n private performSubruleAssignment(result: any, feature: AbstractElement, cstNode: CompositeCstNode): void {\n const { assignment, isCrossRef } = this.getAssignment(feature);\n if (assignment) {\n this.assign(assignment.operator, assignment.feature, result, cstNode, isCrossRef);\n } else if (!assignment) {\n // If we call a subrule without an assignment we either:\n // 1. append the result of the subrule (data type rule)\n // 2. override the current object with the newly parsed object\n // If the current element is an AST node and the result of the subrule\n // is a data type rule, we can safely discard the results.\n const current = this.current;\n if (isDataTypeNode(current)) {\n current.value += result.toString();\n } else if (typeof result === 'object' && result) {\n const resultKind = result.$type;\n const object = this.assignWithoutOverride(result, current);\n if (resultKind) {\n object.$type = resultKind;\n }\n const newItem = object;\n this.stack.pop();\n this.stack.push(newItem);\n }\n }\n }\n\n action($type: string, action: Action): void {\n if (!this.isRecording()) {\n let last = this.current;\n // This branch is used for left recursive grammar rules.\n // Those don't call `construct` before another action.\n // Therefore, we need to call it here.\n if (!last.$cstNode && action.feature && action.operator) {\n last = this.construct(false);\n const feature = last.$cstNode.feature;\n this.nodeBuilder.buildCompositeNode(feature);\n }\n const newItem = { $type };\n this.stack.pop();\n this.stack.push(newItem);\n if (action.feature && action.operator) {\n this.assign(action.operator, action.feature, last, last.$cstNode, false);\n }\n }\n }\n\n construct(pop = true): unknown {\n if (this.isRecording()) {\n return undefined;\n }\n const obj = this.current;\n linkContentToContainer(obj);\n this.nodeBuilder.construct(obj);\n if (pop) {\n this.stack.pop();\n }\n if (isDataTypeNode(obj)) {\n return this.converter.convert(obj.value, obj.$cstNode);\n } else {\n assignMandatoryProperties(this.astReflection, obj);\n }\n return obj;\n }\n\n private getAssignment(feature: AbstractElement): AssignmentElement {\n if (!this.assignmentMap.has(feature)) {\n const assignment = getContainerOfType(feature, isAssignment);\n this.assignmentMap.set(feature, {\n assignment: assignment,\n isCrossRef: assignment ? isCrossReference(assignment.terminal) : false\n });\n }\n return this.assignmentMap.get(feature)!;\n }\n\n private assign(operator: string, feature: string, value: unknown, cstNode: CstNode, isCrossRef: boolean): void {\n const obj = this.current;\n let item: unknown;\n if (isCrossRef && typeof value === 'string') {\n item = this.linker.buildReference(obj, feature, cstNode, value);\n } else {\n item = value;\n }\n switch (operator) {\n case '=': {\n obj[feature] = item;\n break;\n }\n case '?=': {\n obj[feature] = true;\n break;\n }\n case '+=': {\n if (!Array.isArray(obj[feature])) {\n obj[feature] = [];\n }\n obj[feature].push(item);\n }\n }\n }\n\n private assignWithoutOverride(target: any, source: any): any {\n for (const [name, existingValue] of Object.entries(source)) {\n const newValue = target[name];\n if (newValue === undefined) {\n target[name] = existingValue;\n } else if (Array.isArray(newValue) && Array.isArray(existingValue)) {\n existingValue.push(...newValue);\n target[name] = existingValue;\n }\n }\n return target;\n }\n\n get definitionErrors(): IParserDefinitionError[] {\n return this.wrapper.definitionErrors;\n }\n}\n\nexport interface IParserDefinitionError {\n message: string\n type: number\n ruleName?: string\n}\n\nexport abstract class AbstractParserErrorMessageProvider implements IParserErrorMessageProvider {\n\n buildMismatchTokenMessage(options: {\n expected: TokenType\n actual: IToken\n previous: IToken\n ruleName: string\n }): string {\n return defaultParserErrorProvider.buildMismatchTokenMessage(options);\n }\n\n buildNotAllInputParsedMessage(options: {\n firstRedundant: IToken\n ruleName: string\n }): string {\n return defaultParserErrorProvider.buildNotAllInputParsedMessage(options);\n }\n\n buildNoViableAltMessage(options: {\n expectedPathsPerAlt: TokenType[][][]\n actual: IToken[]\n previous: IToken\n customUserDescription: string\n ruleName: string\n }): string {\n return defaultParserErrorProvider.buildNoViableAltMessage(options);\n }\n\n buildEarlyExitMessage(options: {\n expectedIterationPaths: TokenType[][]\n actual: IToken[]\n previous: IToken\n customUserDescription: string\n ruleName: string\n }): string {\n return defaultParserErrorProvider.buildEarlyExitMessage(options);\n }\n\n}\n\nexport class LangiumParserErrorMessageProvider extends AbstractParserErrorMessageProvider {\n\n override buildMismatchTokenMessage({ expected, actual }: {\n expected: TokenType\n actual: IToken\n previous: IToken\n ruleName: string\n }): string {\n const expectedMsg = expected.LABEL\n ? '`' + expected.LABEL + '`'\n : expected.name.endsWith(':KW')\n ? `keyword '${expected.name.substring(0, expected.name.length - 3)}'`\n : `token of type '${expected.name}'`;\n return `Expecting ${expectedMsg} but found \\`${actual.image}\\`.`;\n }\n\n override buildNotAllInputParsedMessage({ firstRedundant }: {\n firstRedundant: IToken\n ruleName: string\n }): string {\n return `Expecting end of file but found \\`${firstRedundant.image}\\`.`;\n }\n}\n\nexport interface CompletionParserResult {\n tokens: IToken[]\n elementStack: AbstractElement[]\n tokenIndex: number\n}\n\nexport class LangiumCompletionParser extends AbstractLangiumParser {\n private mainRule!: RuleResult;\n private tokens: IToken[] = [];\n\n private elementStack: AbstractElement[] = [];\n private lastElementStack: AbstractElement[] = [];\n private nextTokenIndex = 0;\n private stackSize = 0;\n\n action(): void {\n // NOOP\n }\n\n construct(): unknown {\n // NOOP\n return undefined;\n }\n\n parse(input: string): CompletionParserResult {\n this.resetState();\n const tokens = this.lexer.tokenize(input);\n this.tokens = tokens.tokens;\n this.wrapper.input = [...this.tokens];\n this.mainRule.call(this.wrapper, {});\n this.unorderedGroups.clear();\n return {\n tokens: this.tokens,\n elementStack: [...this.lastElementStack],\n tokenIndex: this.nextTokenIndex\n };\n }\n\n rule(rule: ParserRule, impl: RuleImpl): RuleResult {\n const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(impl).bind(this));\n if (rule.entry) {\n this.mainRule = ruleMethod;\n }\n return ruleMethod;\n }\n\n private resetState(): void {\n this.elementStack = [];\n this.lastElementStack = [];\n this.nextTokenIndex = 0;\n this.stackSize = 0;\n }\n\n private startImplementation(implementation: RuleImpl): RuleImpl {\n return (args) => {\n const size = this.keepStackSize();\n try {\n implementation(args);\n } finally {\n this.resetStackSize(size);\n }\n };\n }\n\n private removeUnexpectedElements(): void {\n this.elementStack.splice(this.stackSize);\n }\n\n keepStackSize(): number {\n const size = this.elementStack.length;\n this.stackSize = size;\n return size;\n }\n\n resetStackSize(size: number): void {\n this.removeUnexpectedElements();\n this.stackSize = size;\n }\n\n consume(idx: number, tokenType: TokenType, feature: AbstractElement): void {\n this.wrapper.wrapConsume(idx, tokenType);\n if (!this.isRecording()) {\n this.lastElementStack = [...this.elementStack, feature];\n this.nextTokenIndex = this.currIdx + 1;\n }\n }\n\n subrule(idx: number, rule: RuleResult, feature: AbstractElement, args: Args): void {\n this.before(feature);\n this.wrapper.wrapSubrule(idx, rule, args);\n this.after(feature);\n }\n\n before(element: AbstractElement): void {\n if (!this.isRecording()) {\n this.elementStack.push(element);\n }\n }\n\n after(element: AbstractElement): void {\n if (!this.isRecording()) {\n const index = this.elementStack.lastIndexOf(element);\n if (index >= 0) {\n this.elementStack.splice(index);\n }\n }\n }\n\n get currIdx(): number {\n return (this.wrapper as any).currIdx;\n }\n}\n\nconst defaultConfig: IParserConfig = {\n recoveryEnabled: true,\n nodeLocationTracking: 'full',\n skipValidations: true,\n errorMessageProvider: new LangiumParserErrorMessageProvider()\n};\n\n/**\n * This class wraps the embedded actions parser of chevrotain and exposes protected methods.\n * This way, we can build the `LangiumParser` as a composition.\n */\nclass ChevrotainWrapper extends EmbeddedActionsParser {\n\n // This array is set in the base implementation of Chevrotain.\n definitionErrors: IParserDefinitionError[];\n\n constructor(tokens: TokenVocabulary, config?: IParserConfig) {\n const useDefaultLookahead = config && 'maxLookahead' in config;\n super(tokens, {\n ...defaultConfig,\n lookaheadStrategy: useDefaultLookahead\n ? new LLkLookaheadStrategy({ maxLookahead: config.maxLookahead })\n : new LLStarLookaheadStrategy(),\n ...config,\n });\n }\n\n get IS_RECORDING(): boolean {\n return this.RECORDING_PHASE;\n }\n\n DEFINE_RULE(name: string, impl: RuleImpl): RuleResult {\n return this.RULE(name, impl);\n }\n\n wrapSelfAnalysis(): void {\n this.performSelfAnalysis();\n }\n\n wrapConsume(idx: number, tokenType: TokenType): IToken {\n return this.consume(idx, tokenType);\n }\n\n wrapSubrule(idx: number, rule: RuleResult, args: Args): unknown {\n return this.subrule(idx, rule, {\n ARGS: [args]\n });\n }\n\n wrapOr(idx: number, choices: Array>): void {\n this.or(idx, choices);\n }\n\n wrapOption(idx: number, callback: DSLMethodOpts): void {\n this.option(idx, callback);\n }\n\n wrapMany(idx: number, callback: DSLMethodOpts): void {\n this.many(idx, callback);\n }\n\n wrapAtLeastOne(idx: number, callback: DSLMethodOpts): void {\n this.atLeastOne(idx, callback);\n }\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { IOrAlt, TokenType, TokenTypeDictionary } from 'chevrotain';\nimport type { AbstractElement, Action, Alternatives, Condition, CrossReference, Grammar, Group, Keyword, NamedArgument, ParserRule, RuleCall, UnorderedGroup } from '../languages/generated/ast.js';\nimport type { BaseParser } from './langium-parser.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport type { Cardinality } from '../utils/grammar-utils.js';\nimport { EMPTY_ALT, EOF } from 'chevrotain';\nimport { isAction, isAlternatives, isEndOfFile, isAssignment, isConjunction, isCrossReference, isDisjunction, isGroup, isKeyword, isNegation, isParameterReference, isParserRule, isRuleCall, isTerminalRule, isUnorderedGroup, isBooleanLiteral } from '../languages/generated/ast.js';\nimport { assertUnreachable, ErrorWithLocation } from '../utils/errors.js';\nimport { stream } from '../utils/stream.js';\nimport { findNameAssignment, getAllReachableRules, getTypeName } from '../utils/grammar-utils.js';\n\ntype RuleContext = {\n optional: number,\n consume: number,\n subrule: number,\n many: number,\n or: number\n} & ParserContext;\n\ntype ParserContext = {\n parser: BaseParser\n tokens: TokenTypeDictionary\n rules: Map\n ruleNames: Map\n}\n\ntype Rule = (args: Args) => unknown;\n\ntype Args = Record;\n\ntype Predicate = (args: Args) => boolean;\n\ntype Method = (args: Args) => void;\n\nexport function createParser(grammar: Grammar, parser: T, tokens: TokenTypeDictionary): T {\n const rules = new Map();\n const parserContext: ParserContext = {\n parser,\n tokens,\n rules,\n ruleNames: new Map()\n };\n buildRules(parserContext, grammar);\n return parser;\n}\n\nfunction buildRules(parserContext: ParserContext, grammar: Grammar): void {\n const reachable = getAllReachableRules(grammar, false);\n const parserRules = stream(grammar.rules).filter(isParserRule).filter(rule => reachable.has(rule));\n for (const rule of parserRules) {\n const ctx: RuleContext = {\n ...parserContext,\n consume: 1,\n optional: 1,\n subrule: 1,\n many: 1,\n or: 1\n };\n ctx.rules.set(\n rule.name,\n parserContext.parser.rule(rule, buildElement(ctx, rule.definition))\n );\n }\n}\n\nfunction buildElement(ctx: RuleContext, element: AbstractElement, ignoreGuard = false): Method {\n let method: Method;\n if (isKeyword(element)) {\n method = buildKeyword(ctx, element);\n } else if (isAction(element)) {\n method = buildAction(ctx, element);\n } else if (isAssignment(element)) {\n method = buildElement(ctx, element.terminal);\n } else if (isCrossReference(element)) {\n method = buildCrossReference(ctx, element);\n } else if (isRuleCall(element)) {\n method = buildRuleCall(ctx, element);\n } else if (isAlternatives(element)) {\n method = buildAlternatives(ctx, element);\n } else if (isUnorderedGroup(element)) {\n method = buildUnorderedGroup(ctx, element);\n } else if (isGroup(element)) {\n method = buildGroup(ctx, element);\n } else if(isEndOfFile(element)) {\n const idx = ctx.consume++;\n method = () => ctx.parser.consume(idx, EOF, element);\n } else {\n throw new ErrorWithLocation(element.$cstNode, `Unexpected element type: ${element.$type}`);\n }\n return wrap(ctx, ignoreGuard ? undefined : getGuardCondition(element), method, element.cardinality);\n}\n\nfunction buildAction(ctx: RuleContext, action: Action): Method {\n const actionType = getTypeName(action);\n return () => ctx.parser.action(actionType, action);\n}\n\nfunction buildRuleCall(ctx: RuleContext, ruleCall: RuleCall): Method {\n const rule = ruleCall.rule.ref;\n if (isParserRule(rule)) {\n const idx = ctx.subrule++;\n const predicate = ruleCall.arguments.length > 0 ? buildRuleCallPredicate(rule, ruleCall.arguments) : () => ({});\n return (args) => ctx.parser.subrule(idx, getRule(ctx, rule), ruleCall, predicate(args));\n } else if (isTerminalRule(rule)) {\n const idx = ctx.consume++;\n const method = getToken(ctx, rule.name);\n return () => ctx.parser.consume(idx, method, ruleCall);\n } else if (!rule) {\n throw new ErrorWithLocation(ruleCall.$cstNode, `Undefined rule type: ${ruleCall.$type}`);\n } else {\n assertUnreachable(rule);\n }\n}\n\nfunction buildRuleCallPredicate(rule: ParserRule, namedArgs: NamedArgument[]): (args: Args) => Args {\n const predicates = namedArgs.map(e => buildPredicate(e.value));\n return (args) => {\n const ruleArgs: Args = {};\n for (let i = 0; i < predicates.length; i++) {\n const ruleTarget = rule.parameters[i];\n const predicate = predicates[i];\n ruleArgs[ruleTarget.name] = predicate(args);\n }\n return ruleArgs;\n };\n}\n\ninterface PredicatedMethod {\n ALT: Method,\n GATE?: Predicate\n}\n\nfunction buildPredicate(condition: Condition): Predicate {\n if (isDisjunction(condition)) {\n const left = buildPredicate(condition.left);\n const right = buildPredicate(condition.right);\n return (args) => (left(args) || right(args));\n } else if (isConjunction(condition)) {\n const left = buildPredicate(condition.left);\n const right = buildPredicate(condition.right);\n return (args) => (left(args) && right(args));\n } else if (isNegation(condition)) {\n const value = buildPredicate(condition.value);\n return (args) => !value(args);\n } else if (isParameterReference(condition)) {\n const name = condition.parameter.ref!.name;\n return (args) => args !== undefined && args[name] === true;\n } else if (isBooleanLiteral(condition)) {\n const value = Boolean(condition.true);\n return () => value;\n }\n assertUnreachable(condition);\n}\n\nfunction buildAlternatives(ctx: RuleContext, alternatives: Alternatives): Method {\n if (alternatives.elements.length === 1) {\n return buildElement(ctx, alternatives.elements[0]);\n } else {\n const methods: PredicatedMethod[] = [];\n\n for (const element of alternatives.elements) {\n const predicatedMethod: PredicatedMethod = {\n // Since we handle the guard condition in the alternative already\n // We can ignore the group guard condition inside\n ALT: buildElement(ctx, element, true)\n };\n const guard = getGuardCondition(element);\n if (guard) {\n predicatedMethod.GATE = buildPredicate(guard);\n }\n methods.push(predicatedMethod);\n }\n\n const idx = ctx.or++;\n return (args) => ctx.parser.alternatives(idx, methods.map(method => {\n const alt: IOrAlt = {\n ALT: () => method.ALT(args)\n };\n const gate = method.GATE;\n if (gate) {\n alt.GATE = () => gate(args);\n }\n return alt;\n }));\n }\n}\n\nfunction buildUnorderedGroup(ctx: RuleContext, group: UnorderedGroup): Method {\n if (group.elements.length === 1) {\n return buildElement(ctx, group.elements[0]);\n }\n const methods: PredicatedMethod[] = [];\n\n for (const element of group.elements) {\n const predicatedMethod: PredicatedMethod = {\n // Since we handle the guard condition in the alternative already\n // We can ignore the group guard condition inside\n ALT: buildElement(ctx, element, true)\n };\n const guard = getGuardCondition(element);\n if (guard) {\n predicatedMethod.GATE = buildPredicate(guard);\n }\n methods.push(predicatedMethod);\n }\n\n const orIdx = ctx.or++;\n\n const idFunc = (groupIdx: number, lParser: BaseParser) => {\n const stackId = lParser.getRuleStack().join('-');\n return `uGroup_${groupIdx}_${stackId}`;\n };\n const alternatives: Method = (args) => ctx.parser.alternatives(orIdx, methods.map((method, idx) => {\n const alt: IOrAlt = { ALT: () => true };\n const parser = ctx.parser;\n alt.ALT = () => {\n method.ALT(args);\n if (!parser.isRecording()) {\n const key = idFunc(orIdx, parser);\n if (!parser.unorderedGroups.get(key)) {\n // init after clear state\n parser.unorderedGroups.set(key, []);\n }\n const groupState = parser.unorderedGroups.get(key)!;\n if (typeof groupState?.[idx] === 'undefined') {\n // Not accessed yet\n groupState[idx] = true;\n }\n }\n };\n const gate = method.GATE;\n if (gate) {\n alt.GATE = () => gate(args);\n } else {\n alt.GATE = () => {\n const trackedAlternatives = parser.unorderedGroups.get(idFunc(orIdx, parser));\n const allow = !trackedAlternatives?.[idx];\n return allow;\n };\n }\n return alt;\n }));\n const wrapped = wrap(ctx, getGuardCondition(group), alternatives, '*');\n return (args) => {\n wrapped(args);\n if (!ctx.parser.isRecording()) {\n ctx.parser.unorderedGroups.delete(idFunc(orIdx, ctx.parser));\n }\n };\n}\n\nfunction buildGroup(ctx: RuleContext, group: Group): Method {\n const methods = group.elements.map(e => buildElement(ctx, e));\n return (args) => methods.forEach(method => method(args));\n}\n\nfunction getGuardCondition(element: AbstractElement): Condition | undefined {\n if (isGroup(element)) {\n return element.guardCondition;\n }\n return undefined;\n}\n\nfunction buildCrossReference(ctx: RuleContext, crossRef: CrossReference, terminal = crossRef.terminal): Method {\n if (!terminal) {\n if (!crossRef.type.ref) {\n throw new Error('Could not resolve reference to type: ' + crossRef.type.$refText);\n }\n const assignment = findNameAssignment(crossRef.type.ref);\n const assignTerminal = assignment?.terminal;\n if (!assignTerminal) {\n throw new Error('Could not find name assignment for type: ' + getTypeName(crossRef.type.ref));\n }\n return buildCrossReference(ctx, crossRef, assignTerminal);\n } else if (isRuleCall(terminal) && isParserRule(terminal.rule.ref)) {\n const idx = ctx.subrule++;\n return (args) => ctx.parser.subrule(idx, getRule(ctx, terminal.rule.ref as ParserRule), crossRef, args);\n } else if (isRuleCall(terminal) && isTerminalRule(terminal.rule.ref)) {\n const idx = ctx.consume++;\n const terminalRule = getToken(ctx, terminal.rule.ref.name);\n return () => ctx.parser.consume(idx, terminalRule, crossRef);\n } else if (isKeyword(terminal)) {\n const idx = ctx.consume++;\n const keyword = getToken(ctx, terminal.value);\n return () => ctx.parser.consume(idx, keyword, crossRef);\n }\n else {\n throw new Error('Could not build cross reference parser');\n }\n}\n\nfunction buildKeyword(ctx: RuleContext, keyword: Keyword): Method {\n const idx = ctx.consume++;\n const token = ctx.tokens[keyword.value];\n if (!token) {\n throw new Error('Could not find token for keyword: ' + keyword.value);\n }\n return () => ctx.parser.consume(idx, token, keyword);\n}\n\nfunction wrap(ctx: RuleContext, guard: Condition | undefined, method: Method, cardinality: Cardinality): Method {\n const gate = guard && buildPredicate(guard);\n\n if (!cardinality) {\n if (gate) {\n const idx = ctx.or++;\n return (args) => ctx.parser.alternatives(idx, [\n {\n ALT: () => method(args),\n GATE: () => gate(args)\n },\n {\n ALT: EMPTY_ALT(),\n GATE: () => !gate(args)\n }\n ]);\n } else {\n return method;\n }\n }\n\n if (cardinality === '*') {\n const idx = ctx.many++;\n return (args) => ctx.parser.many(idx, {\n DEF: () => method(args),\n GATE: gate ? () => gate(args) : undefined\n });\n } else if (cardinality === '+') {\n const idx = ctx.many++;\n if (gate) {\n const orIdx = ctx.or++;\n // In the case of a guard condition for the `+` group\n // We combine it with an empty alternative\n // If the condition returns true, it needs to parse at least a single iteration\n // If its false, it is not allowed to parse anything\n return (args) => ctx.parser.alternatives(orIdx, [\n {\n ALT: () => ctx.parser.atLeastOne(idx, {\n DEF: () => method(args)\n }),\n GATE: () => gate(args)\n },\n {\n ALT: EMPTY_ALT(),\n GATE: () => !gate(args)\n }\n ]);\n } else {\n return (args) => ctx.parser.atLeastOne(idx, {\n DEF: () => method(args),\n });\n }\n } else if (cardinality === '?') {\n const idx = ctx.optional++;\n return (args) => ctx.parser.optional(idx, {\n DEF: () => method(args),\n GATE: gate ? () => gate(args) : undefined\n });\n } else {\n assertUnreachable(cardinality);\n }\n}\n\nfunction getRule(ctx: ParserContext, element: ParserRule | AbstractElement): Rule {\n const name = getRuleName(ctx, element);\n const rule = ctx.rules.get(name);\n if (!rule) throw new Error(`Rule \"${name}\" not found.\"`);\n return rule;\n}\n\nfunction getRuleName(ctx: ParserContext, element: ParserRule | AbstractElement): string {\n if (isParserRule(element)) {\n return element.name;\n } else if (ctx.ruleNames.has(element)) {\n return ctx.ruleNames.get(element)!;\n } else {\n let item: AstNode = element;\n let parent: AstNode = item.$container!;\n let ruleName: string = element.$type;\n while (!isParserRule(parent)) {\n if (isGroup(parent) || isAlternatives(parent) || isUnorderedGroup(parent)) {\n const index = parent.elements.indexOf(item as AbstractElement);\n ruleName = index.toString() + ':' + ruleName;\n }\n item = parent;\n parent = parent.$container!;\n }\n const rule = parent as ParserRule;\n ruleName = rule.name + ':' + ruleName;\n ctx.ruleNames.set(element, ruleName);\n return ruleName;\n }\n}\n\nfunction getToken(ctx: ParserContext, name: string): TokenType {\n const token = ctx.tokens[name];\n if (!token) throw new Error(`Token \"${name}\" not found.\"`);\n return token;\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport { LangiumCompletionParser } from './langium-parser.js';\nimport { createParser } from './parser-builder-base.js';\n\nexport function createCompletionParser(services: LangiumCoreServices): LangiumCompletionParser {\n const grammar = services.Grammar;\n const lexer = services.parser.Lexer;\n const parser = new LangiumCompletionParser(services);\n createParser(grammar, parser, lexer.definition);\n parser.finalize();\n return parser;\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport { LangiumParser } from './langium-parser.js';\nimport { createParser } from './parser-builder-base.js';\n\n/**\n * Create and finalize a Langium parser. The parser rules are derived from the grammar, which is\n * available at `services.Grammar`.\n */\nexport function createLangiumParser(services: LangiumCoreServices): LangiumParser {\n const parser = prepareLangiumParser(services);\n parser.finalize();\n return parser;\n}\n\n/**\n * Create a Langium parser without finalizing it. This is used to extract more detailed error\n * information when the parser is initially validated.\n */\nexport function prepareLangiumParser(services: LangiumCoreServices): LangiumParser {\n const grammar = services.Grammar;\n const lexer = services.parser.Lexer;\n const parser = new LangiumParser(services);\n return createParser(grammar, parser, lexer.definition);\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CustomPatternMatcherFunc, TokenPattern, TokenType, TokenVocabulary } from 'chevrotain';\nimport type { AbstractRule, Grammar, Keyword, TerminalRule } from '../languages/generated/ast.js';\nimport type { Stream } from '../utils/stream.js';\nimport { Lexer } from 'chevrotain';\nimport { isKeyword, isParserRule, isTerminalRule } from '../languages/generated/ast.js';\nimport { streamAllContents } from '../utils/ast-utils.js';\nimport { getAllReachableRules, terminalRegex } from '../utils/grammar-utils.js';\nimport { getCaseInsensitivePattern, isWhitespace, partialMatches } from '../utils/regexp-utils.js';\nimport { stream } from '../utils/stream.js';\n\nexport interface TokenBuilderOptions {\n caseInsensitive?: boolean\n}\n\nexport interface TokenBuilder {\n buildTokens(grammar: Grammar, options?: TokenBuilderOptions): TokenVocabulary;\n}\n\nexport class DefaultTokenBuilder implements TokenBuilder {\n\n buildTokens(grammar: Grammar, options?: TokenBuilderOptions): TokenVocabulary {\n const reachableRules = stream(getAllReachableRules(grammar, false));\n const terminalTokens: TokenType[] = this.buildTerminalTokens(reachableRules);\n const tokens: TokenType[] = this.buildKeywordTokens(reachableRules, terminalTokens, options);\n\n terminalTokens.forEach(terminalToken => {\n const pattern = terminalToken.PATTERN;\n if (typeof pattern === 'object' && pattern && 'test' in pattern && isWhitespace(pattern)) {\n tokens.unshift(terminalToken);\n } else {\n tokens.push(terminalToken);\n }\n });\n // We don't need to add the EOF token explicitly.\n // It is automatically available at the end of the token stream.\n return tokens;\n }\n\n protected buildTerminalTokens(rules: Stream): TokenType[] {\n return rules.filter(isTerminalRule).filter(e => !e.fragment)\n .map(terminal => this.buildTerminalToken(terminal)).toArray();\n }\n\n protected buildTerminalToken(terminal: TerminalRule): TokenType {\n const regex = terminalRegex(terminal);\n const pattern = this.requiresCustomPattern(regex) ? this.regexPatternFunction(regex) : regex;\n const tokenType: TokenType = {\n name: terminal.name,\n PATTERN: pattern,\n LINE_BREAKS: true\n };\n if (terminal.hidden) {\n // Only skip tokens that are able to accept whitespace\n tokenType.GROUP = isWhitespace(regex) ? Lexer.SKIPPED : 'hidden';\n }\n return tokenType;\n }\n\n protected requiresCustomPattern(regex: RegExp): boolean {\n if (regex.flags.includes('u')) {\n // Unicode regexes are not supported by Chevrotain.\n return true;\n } else if (regex.source.includes('?<=') || regex.source.includes('? {\n stickyRegex.lastIndex = offset;\n const execResult = stickyRegex.exec(text);\n return execResult;\n };\n }\n\n protected buildKeywordTokens(rules: Stream, terminalTokens: TokenType[], options?: TokenBuilderOptions): TokenType[] {\n return rules\n // We filter by parser rules, since keywords in terminal rules get transformed into regex and are not actual tokens\n .filter(isParserRule)\n .flatMap(rule => streamAllContents(rule).filter(isKeyword))\n .distinct(e => e.value).toArray()\n // Sort keywords by descending length\n .sort((a, b) => b.value.length - a.value.length)\n .map(keyword => this.buildKeywordToken(keyword, terminalTokens, Boolean(options?.caseInsensitive)));\n }\n\n protected buildKeywordToken(keyword: Keyword, terminalTokens: TokenType[], caseInsensitive: boolean): TokenType {\n return {\n name: keyword.value,\n PATTERN: this.buildKeywordPattern(keyword, caseInsensitive),\n LONGER_ALT: this.findLongerAlt(keyword, terminalTokens)\n };\n }\n\n protected buildKeywordPattern(keyword: Keyword, caseInsensitive: boolean): TokenPattern {\n return caseInsensitive ?\n new RegExp(getCaseInsensitivePattern(keyword.value)) :\n keyword.value;\n }\n\n protected findLongerAlt(keyword: Keyword, terminalTokens: TokenType[]): TokenType[] {\n return terminalTokens.reduce((longerAlts: TokenType[], token) => {\n const pattern = token?.PATTERN as RegExp;\n if (pattern?.source && partialMatches('^' + pattern.source + '$', keyword.value)) {\n longerAlts.push(token);\n }\n return longerAlts;\n }, []);\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { AbstractElement, AbstractRule } from '../languages/generated/ast.js';\nimport type { CstNode } from '../syntax-tree.js';\nimport { isCrossReference, isRuleCall } from '../languages/generated/ast.js';\nimport { getCrossReferenceTerminal, getRuleType } from '../utils/grammar-utils.js';\n\n/**\n * Language-specific service for converting string values from the source text format into a value to be held in the AST.\n */\nexport interface ValueConverter {\n /**\n * Converts a string value from the source text format into a value to be held in the AST.\n */\n convert(input: string, cstNode: CstNode): ValueType;\n}\n\nexport type ValueType = string | number | boolean | bigint | Date;\n\nexport class DefaultValueConverter implements ValueConverter {\n\n convert(input: string, cstNode: CstNode): ValueType {\n let feature: AbstractElement | undefined = cstNode.grammarSource;\n if (isCrossReference(feature)) {\n feature = getCrossReferenceTerminal(feature);\n }\n if (isRuleCall(feature)) {\n const rule = feature.rule.ref;\n if (!rule) {\n throw new Error('This cst node was not parsed by a rule.');\n }\n return this.runConverter(rule, input, cstNode);\n }\n return input;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected runConverter(rule: AbstractRule, input: string, cstNode: CstNode): ValueType {\n switch (rule.name.toUpperCase()) {\n case 'INT': return ValueConverter.convertInt(input);\n case 'STRING': return ValueConverter.convertString(input);\n case 'ID': return ValueConverter.convertID(input);\n }\n switch (getRuleType(rule)?.toLowerCase()) {\n case 'number': return ValueConverter.convertNumber(input);\n case 'boolean': return ValueConverter.convertBoolean(input);\n case 'bigint': return ValueConverter.convertBigint(input);\n case 'date': return ValueConverter.convertDate(input);\n default: return input;\n }\n }\n}\n\nexport namespace ValueConverter {\n\n export function convertString(input: string): string {\n let result = '';\n for (let i = 1; i < input.length - 1; i++) {\n const c = input.charAt(i);\n if (c === '\\\\') {\n const c1 = input.charAt(++i);\n result += convertEscapeCharacter(c1);\n } else {\n result += c;\n }\n }\n return result;\n }\n\n function convertEscapeCharacter(char: string): string {\n switch (char) {\n case 'b': return '\\b';\n case 'f': return '\\f';\n case 'n': return '\\n';\n case 'r': return '\\r';\n case 't': return '\\t';\n case 'v': return '\\v';\n case '0': return '\\0';\n default: return char;\n }\n }\n\n export function convertID(input: string): string {\n if (input.charAt(0) === '^') {\n return input.substring(1);\n } else {\n return input;\n }\n }\n\n export function convertInt(input: string): number {\n return parseInt(input);\n }\n\n export function convertBigint(input: string): bigint {\n return BigInt(input);\n }\n\n export function convertDate(input: string): Date {\n return new Date(input);\n }\n\n export function convertNumber(input: string): number {\n return Number(input);\n }\n\n export function convertBoolean(input: string): boolean {\n return input.toLowerCase() === 'true';\n }\n\n}\n", "/******************************************************************************\n * Copyright 2024 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n// eslint-disable-next-line no-restricted-imports\nexport * from 'vscode-jsonrpc/lib/common/cancellation.js';\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { CancellationToken, CancellationTokenSource, type AbstractCancellationTokenSource } from '../utils/cancellation.js';\n\nexport type MaybePromise = T | Promise\n\n/**\n * Delays the execution of the current code to the next tick of the event loop.\n * Don't call this method directly in a tight loop to prevent too many promises from being created.\n */\nexport function delayNextTick(): Promise {\n return new Promise(resolve => {\n // In case we are running in a non-node environment, `setImmediate` isn't available.\n // Using `setTimeout` of the browser API accomplishes the same result.\n if (typeof setImmediate === 'undefined') {\n setTimeout(resolve, 0);\n } else {\n setImmediate(resolve);\n }\n });\n}\n\nlet lastTick = 0;\nlet globalInterruptionPeriod = 10;\n\n/**\n * Reset the global interruption period and create a cancellation token source.\n */\nexport function startCancelableOperation(): AbstractCancellationTokenSource {\n lastTick = Date.now();\n return new CancellationTokenSource();\n}\n\n/**\n * Change the period duration for `interruptAndCheck` to the given number of milliseconds.\n * The default value is 10ms.\n */\nexport function setInterruptionPeriod(period: number): void {\n globalInterruptionPeriod = period;\n}\n\n/**\n * This symbol may be thrown in an asynchronous context by any Langium service that receives\n * a `CancellationToken`. This means that the promise returned by such a service is rejected with\n * this symbol as rejection reason.\n */\nexport const OperationCancelled = Symbol('OperationCancelled');\n\n/**\n * Use this in a `catch` block to check whether the thrown object indicates that the operation\n * has been cancelled.\n */\nexport function isOperationCancelled(err: unknown): err is typeof OperationCancelled {\n return err === OperationCancelled;\n}\n\n/**\n * This function does two things:\n * 1. Check the elapsed time since the last call to this function or to `startCancelableOperation`. If the predefined\n * period (configured with `setInterruptionPeriod`) is exceeded, execution is delayed with `delayNextTick`.\n * 2. If the predefined period is not met yet or execution is resumed after an interruption, the given cancellation\n * token is checked, and if cancellation is requested, `OperationCanceled` is thrown.\n *\n * All services in Langium that receive a `CancellationToken` may potentially call this function, so the\n * `CancellationToken` must be caught (with an `async` try-catch block or a `catch` callback attached to\n * the promise) to avoid that event being exposed as an error.\n */\nexport async function interruptAndCheck(token: CancellationToken): Promise {\n if (token === CancellationToken.None) {\n // Early exit in case cancellation was disabled by the caller\n return;\n }\n const current = Date.now();\n if (current - lastTick >= globalInterruptionPeriod) {\n lastTick = current;\n await delayNextTick();\n }\n if (token.isCancellationRequested) {\n throw OperationCancelled;\n }\n}\n\n/**\n * Simple implementation of the deferred pattern.\n * An object that exposes a promise and functions to resolve and reject it.\n */\nexport class Deferred {\n resolve: (value: T) => this;\n reject: (err?: unknown) => this;\n\n promise = new Promise((resolve, reject) => {\n this.resolve = (arg) => {\n resolve(arg);\n return this;\n };\n this.reject = (err) => {\n reject(err);\n return this;\n };\n });\n}\n", "/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nclass FullTextDocument {\n constructor(uri, languageId, version, content) {\n this._uri = uri;\n this._languageId = languageId;\n this._version = version;\n this._content = content;\n this._lineOffsets = undefined;\n }\n get uri() {\n return this._uri;\n }\n get languageId() {\n return this._languageId;\n }\n get version() {\n return this._version;\n }\n getText(range) {\n if (range) {\n const start = this.offsetAt(range.start);\n const end = this.offsetAt(range.end);\n return this._content.substring(start, end);\n }\n return this._content;\n }\n update(changes, version) {\n for (let change of changes) {\n if (FullTextDocument.isIncremental(change)) {\n // makes sure start is before end\n const range = getWellformedRange(change.range);\n // update content\n const startOffset = this.offsetAt(range.start);\n const endOffset = this.offsetAt(range.end);\n this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);\n // update the offsets\n const startLine = Math.max(range.start.line, 0);\n const endLine = Math.max(range.end.line, 0);\n let lineOffsets = this._lineOffsets;\n const addedLineOffsets = computeLineOffsets(change.text, false, startOffset);\n if (endLine - startLine === addedLineOffsets.length) {\n for (let i = 0, len = addedLineOffsets.length; i < len; i++) {\n lineOffsets[i + startLine + 1] = addedLineOffsets[i];\n }\n }\n else {\n if (addedLineOffsets.length < 10000) {\n lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets);\n }\n else { // avoid too many arguments for splice\n this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));\n }\n }\n const diff = change.text.length - (endOffset - startOffset);\n if (diff !== 0) {\n for (let i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {\n lineOffsets[i] = lineOffsets[i] + diff;\n }\n }\n }\n else if (FullTextDocument.isFull(change)) {\n this._content = change.text;\n this._lineOffsets = undefined;\n }\n else {\n throw new Error('Unknown change event received');\n }\n }\n this._version = version;\n }\n getLineOffsets() {\n if (this._lineOffsets === undefined) {\n this._lineOffsets = computeLineOffsets(this._content, true);\n }\n return this._lineOffsets;\n }\n positionAt(offset) {\n offset = Math.max(Math.min(offset, this._content.length), 0);\n let lineOffsets = this.getLineOffsets();\n let low = 0, high = lineOffsets.length;\n if (high === 0) {\n return { line: 0, character: offset };\n }\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n if (lineOffsets[mid] > offset) {\n high = mid;\n }\n else {\n low = mid + 1;\n }\n }\n // low is the least x for which the line offset is larger than the current offset\n // or array.length if no line offset is larger than the current offset\n let line = low - 1;\n return { line, character: offset - lineOffsets[line] };\n }\n offsetAt(position) {\n let lineOffsets = this.getLineOffsets();\n if (position.line >= lineOffsets.length) {\n return this._content.length;\n }\n else if (position.line < 0) {\n return 0;\n }\n let lineOffset = lineOffsets[position.line];\n let nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\n return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\n }\n get lineCount() {\n return this.getLineOffsets().length;\n }\n static isIncremental(event) {\n let candidate = event;\n return candidate !== undefined && candidate !== null &&\n typeof candidate.text === 'string' && candidate.range !== undefined &&\n (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');\n }\n static isFull(event) {\n let candidate = event;\n return candidate !== undefined && candidate !== null &&\n typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;\n }\n}\nexport var TextDocument;\n(function (TextDocument) {\n /**\n * Creates a new text document.\n *\n * @param uri The document's uri.\n * @param languageId The document's language Id.\n * @param version The document's initial version number.\n * @param content The document's content.\n */\n function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }\n TextDocument.create = create;\n /**\n * Updates a TextDocument by modifying its content.\n *\n * @param document the document to update. Only documents created by TextDocument.create are valid inputs.\n * @param changes the changes to apply to the document.\n * @param version the changes version for the document.\n * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.\n *\n */\n function update(document, changes, version) {\n if (document instanceof FullTextDocument) {\n document.update(changes, version);\n return document;\n }\n else {\n throw new Error('TextDocument.update: document must be created by TextDocument.create');\n }\n }\n TextDocument.update = update;\n function applyEdits(document, edits) {\n let text = document.getText();\n let sortedEdits = mergeSort(edits.map(getWellformedEdit), (a, b) => {\n let diff = a.range.start.line - b.range.start.line;\n if (diff === 0) {\n return a.range.start.character - b.range.start.character;\n }\n return diff;\n });\n let lastModifiedOffset = 0;\n const spans = [];\n for (const e of sortedEdits) {\n let startOffset = document.offsetAt(e.range.start);\n if (startOffset < lastModifiedOffset) {\n throw new Error('Overlapping edit');\n }\n else if (startOffset > lastModifiedOffset) {\n spans.push(text.substring(lastModifiedOffset, startOffset));\n }\n if (e.newText.length) {\n spans.push(e.newText);\n }\n lastModifiedOffset = document.offsetAt(e.range.end);\n }\n spans.push(text.substr(lastModifiedOffset));\n return spans.join('');\n }\n TextDocument.applyEdits = applyEdits;\n})(TextDocument || (TextDocument = {}));\nfunction mergeSort(data, compare) {\n if (data.length <= 1) {\n // sorted\n return data;\n }\n const p = (data.length / 2) | 0;\n const left = data.slice(0, p);\n const right = data.slice(p);\n mergeSort(left, compare);\n mergeSort(right, compare);\n let leftIdx = 0;\n let rightIdx = 0;\n let i = 0;\n while (leftIdx < left.length && rightIdx < right.length) {\n let ret = compare(left[leftIdx], right[rightIdx]);\n if (ret <= 0) {\n // smaller_equal -> take left to preserve order\n data[i++] = left[leftIdx++];\n }\n else {\n // greater -> take right\n data[i++] = right[rightIdx++];\n }\n }\n while (leftIdx < left.length) {\n data[i++] = left[leftIdx++];\n }\n while (rightIdx < right.length) {\n data[i++] = right[rightIdx++];\n }\n return data;\n}\nfunction computeLineOffsets(text, isAtLineStart, textOffset = 0) {\n const result = isAtLineStart ? [textOffset] : [];\n for (let i = 0; i < text.length; i++) {\n let ch = text.charCodeAt(i);\n if (ch === 13 /* CharCode.CarriageReturn */ || ch === 10 /* CharCode.LineFeed */) {\n if (ch === 13 /* CharCode.CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* CharCode.LineFeed */) {\n i++;\n }\n result.push(textOffset + i + 1);\n }\n }\n return result;\n}\nfunction getWellformedRange(range) {\n const start = range.start;\n const end = range.end;\n if (start.line > end.line || (start.line === end.line && start.character > end.character)) {\n return { start: end, end: start };\n }\n return range;\n}\nfunction getWellformedEdit(textEdit) {\n const range = getWellformedRange(textEdit.range);\n if (range !== textEdit.range) {\n return { newText: textEdit.newText, range };\n }\n return textEdit;\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/**\n * Re-export 'TextDocument' from 'vscode-languageserver-textdocument' for convenience,\n * including both type _and_ symbol (namespace), as we here and there also refer to the symbol,\n * the overhead is very small, just a few kilobytes.\n * Everything else of that package (at the time contributing) is also defined\n * in 'vscode-languageserver-protocol' or 'vscode-languageserver-types'.\n */\nexport { TextDocument } from 'vscode-languageserver-textdocument';\n\nimport type { Diagnostic, Range } from 'vscode-languageserver-types';\nimport type { FileSystemProvider } from './file-system-provider.js';\nimport type { ParseResult } from '../parser/langium-parser.js';\nimport type { ServiceRegistry } from '../service-registry.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription, Mutable, Reference } from '../syntax-tree.js';\nimport type { MultiMap } from '../utils/collections.js';\nimport type { Stream } from '../utils/stream.js';\nimport { TextDocument } from './documents.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { stream } from '../utils/stream.js';\nimport { URI } from '../utils/uri-utils.js';\n\n/**\n * A Langium document holds the parse result (AST and CST) and any additional state that is derived\n * from the AST, e.g. the result of scope precomputation.\n */\nexport interface LangiumDocument {\n /** The Uniform Resource Identifier (URI) of the document */\n readonly uri: URI;\n /** The text document used to convert between offsets and positions */\n readonly textDocument: TextDocument;\n /** The current state of the document */\n state: DocumentState;\n /** The parse result holds the Abstract Syntax Tree (AST) and potentially also parser / lexer errors */\n parseResult: ParseResult;\n /** Result of the scope precomputation phase */\n precomputedScopes?: PrecomputedScopes;\n /** An array of all cross-references found in the AST while linking */\n references: Reference[];\n /** Result of the validation phase */\n diagnostics?: Diagnostic[]\n}\n\n/**\n * A document is subject to several phases that are run in predefined order. Any state value implies that\n * smaller state values are finished as well.\n */\nexport enum DocumentState {\n /**\n * The text content has changed and needs to be parsed again. The AST held by this outdated\n * document instance is no longer valid.\n */\n Changed = 0,\n /**\n * An AST has been created from the text content. The document structure can be traversed,\n * but cross-references cannot be resolved yet. If necessary, the structure can be manipulated\n * at this stage as a preprocessing step.\n */\n Parsed = 1,\n /**\n * The `IndexManager` service has processed AST nodes of this document. This means the\n * exported symbols are available in the global scope and can be resolved from other documents.\n */\n IndexedContent = 2,\n /**\n * The `ScopeComputation` service has processed this document. This means the local symbols\n * are stored in a MultiMap so they can be looked up by the `ScopeProvider` service.\n * Once a document has reached this state, you may follow every reference - it will lazily\n * resolve its `ref` property and yield either the target AST node or `undefined` in case\n * the target is not in scope.\n */\n ComputedScopes = 3,\n /**\n * The `Linker` service has processed this document. All outgoing references have been\n * resolved or marked as erroneous.\n */\n Linked = 4,\n /**\n * The `IndexManager` service has processed AST node references of this document. This is\n * necessary to determine which documents are affected by a change in one of the workspace\n * documents.\n */\n IndexedReferences = 5,\n /**\n * The `DocumentValidator` service has processed this document. The language server listens\n * to the results of this phase and sends diagnostics to the client.\n */\n Validated = 6\n}\n\n/**\n * Result of the scope precomputation phase (`ScopeComputation` service).\n * It maps every AST node to the set of symbols that are visible in the subtree of that node.\n */\nexport type PrecomputedScopes = MultiMap\n\nexport interface DocumentSegment {\n readonly range: Range\n readonly offset: number\n readonly length: number\n readonly end: number\n}\n\n/**\n * Surrogate definition of the `TextDocuments` interface from the `vscode-languageserver` package.\n * No implementation object is expected to be offered by `LangiumCoreServices`, but only by `LangiumLSPServices`.\n */\nexport type TextDocumentProvider = {\n get(uri: string): TextDocument | undefined\n}\n\n/**\n * Shared service for creating `LangiumDocument` instances.\n *\n * Register a custom implementation if special (additional) behavior is required for your language(s).\n * Note: If you specialize {@link fromString} or {@link fromTextDocument} you probably might want to\n * specialize {@link update}, too!\n */\nexport interface LangiumDocumentFactory {\n /**\n * Create a Langium document from a `TextDocument` (usually associated with a file).\n */\n fromTextDocument(textDocument: TextDocument, uri?: URI): LangiumDocument;\n /**\n * Create a Langium document from a `TextDocument` asynchronously. This action can be cancelled if a cancellable parser implementation has been provided.\n */\n fromTextDocument(textDocument: TextDocument, uri: URI | undefined, cancellationToken: CancellationToken): Promise>;\n\n /**\n * Create an Langium document from an in-memory string.\n */\n fromString(text: string, uri: URI): LangiumDocument;\n /**\n * Create a Langium document from an in-memory string asynchronously. This action can be cancelled if a cancellable parser implementation has been provided.\n */\n fromString(text: string, uri: URI, cancellationToken: CancellationToken): Promise>;\n\n /**\n * Create an Langium document from a model that has been constructed in memory.\n */\n fromModel(model: T, uri: URI): LangiumDocument;\n\n /**\n * Create an Langium document from a specified `URI`. The factory will use the `FileSystemAccess` service to read the file.\n */\n fromUri(uri: URI, cancellationToken?: CancellationToken): Promise>;\n\n /**\n * Update the given document after changes in the corresponding textual representation.\n * Method is called by the document builder after it has been requested to build an existing\n * document and the document's state is {@link DocumentState.Changed}.\n * The text parsing is expected to be done the same way as in {@link fromTextDocument}\n * and {@link fromString}.\n */\n update(document: LangiumDocument, cancellationToken: CancellationToken): Promise>\n}\n\nexport class DefaultLangiumDocumentFactory implements LangiumDocumentFactory {\n\n protected readonly serviceRegistry: ServiceRegistry;\n protected readonly textDocuments?: TextDocumentProvider;\n protected readonly fileSystemProvider: FileSystemProvider;\n\n constructor(services: LangiumSharedCoreServices) {\n this.serviceRegistry = services.ServiceRegistry;\n this.textDocuments = services.workspace.TextDocuments;\n this.fileSystemProvider = services.workspace.FileSystemProvider;\n }\n\n async fromUri(uri: URI, cancellationToken = CancellationToken.None): Promise> {\n const content = await this.fileSystemProvider.readFile(uri);\n return this.createAsync(uri, content, cancellationToken);\n }\n\n fromTextDocument(textDocument: TextDocument, uri?: URI): LangiumDocument;\n fromTextDocument(textDocument: TextDocument, uri: URI | undefined, cancellationToken: CancellationToken): Promise>;\n fromTextDocument(textDocument: TextDocument, uri?: URI, cancellationToken?: CancellationToken): LangiumDocument | Promise> {\n uri = uri ?? URI.parse(textDocument.uri);\n if (cancellationToken) {\n return this.createAsync(uri, textDocument, cancellationToken);\n } else {\n return this.create(uri, textDocument);\n }\n }\n\n fromString(text: string, uri: URI): LangiumDocument;\n fromString(text: string, uri: URI, cancellationToken: CancellationToken): Promise>;\n fromString(text: string, uri: URI, cancellationToken?: CancellationToken): LangiumDocument | Promise> {\n if (cancellationToken) {\n return this.createAsync(uri, text, cancellationToken);\n } else {\n return this.create(uri, text);\n }\n }\n\n fromModel(model: T, uri: URI): LangiumDocument {\n return this.create(uri, { $model: model });\n }\n\n protected create(uri: URI, content: string | TextDocument | { $model: T }): LangiumDocument {\n if (typeof content === 'string') {\n const parseResult = this.parse(uri, content);\n return this.createLangiumDocument(parseResult, uri, undefined, content);\n\n } else if ('$model' in content) {\n const parseResult = { value: content.$model, parserErrors: [], lexerErrors: [] };\n return this.createLangiumDocument(parseResult, uri);\n\n } else {\n const parseResult = this.parse(uri, content.getText());\n return this.createLangiumDocument(parseResult, uri, content);\n }\n }\n\n protected async createAsync(uri: URI, content: string | TextDocument, cancelToken: CancellationToken): Promise> {\n if (typeof content === 'string') {\n const parseResult = await this.parseAsync(uri, content, cancelToken);\n return this.createLangiumDocument(parseResult, uri, undefined, content);\n } else {\n const parseResult = await this.parseAsync(uri, content.getText(), cancelToken);\n return this.createLangiumDocument(parseResult, uri, content);\n }\n }\n\n /**\n * Create a LangiumDocument from a given parse result.\n *\n * A TextDocument is created on demand if it is not provided as argument here. Usually this\n * should not be necessary because the main purpose of the TextDocument is to convert between\n * text ranges and offsets, which is done solely in LSP request handling.\n *\n * With the introduction of {@link update} below this method is supposed to be mainly called\n * during workspace initialization and on addition/recognition of new files, while changes in\n * existing documents are processed via {@link update}.\n */\n protected createLangiumDocument(parseResult: ParseResult, uri: URI, textDocument?: TextDocument, text?: string): LangiumDocument {\n let document: LangiumDocument;\n if (textDocument) {\n document = {\n parseResult,\n uri,\n state: DocumentState.Parsed,\n references: [],\n textDocument\n };\n } else {\n const textDocumentGetter = this.createTextDocumentGetter(uri, text);\n document = {\n parseResult,\n uri,\n state: DocumentState.Parsed,\n references: [],\n get textDocument() {\n return textDocumentGetter();\n }\n };\n }\n (parseResult.value as Mutable).$document = document;\n return document;\n }\n\n async update(document: Mutable>, cancellationToken: CancellationToken): Promise> {\n // The CST full text property contains the original text that was used to create the AST.\n const oldText = document.parseResult.value.$cstNode?.root.fullText;\n const textDocument = this.textDocuments?.get(document.uri.toString());\n const text = textDocument ? textDocument.getText() : await this.fileSystemProvider.readFile(document.uri);\n\n if (textDocument) {\n Object.defineProperty(\n document,\n 'textDocument',\n {\n value: textDocument\n }\n );\n } else {\n const textDocumentGetter = this.createTextDocumentGetter(document.uri, text);\n Object.defineProperty(\n document,\n 'textDocument',\n {\n get: textDocumentGetter\n }\n );\n }\n\n // Some of these documents can be pretty large, so parsing them again can be quite expensive.\n // Therefore, we only parse if the text has actually changed.\n if (oldText !== text) {\n document.parseResult = await this.parseAsync(document.uri, text, cancellationToken);\n (document.parseResult.value as Mutable).$document = document;\n }\n document.state = DocumentState.Parsed;\n return document;\n }\n\n protected parse(uri: URI, text: string): ParseResult {\n const services = this.serviceRegistry.getServices(uri);\n return services.parser.LangiumParser.parse(text);\n }\n\n protected parseAsync(uri: URI, text: string, cancellationToken: CancellationToken): Promise> {\n const services = this.serviceRegistry.getServices(uri);\n return services.parser.AsyncParser.parse(text, cancellationToken);\n }\n\n protected createTextDocumentGetter(uri: URI, text?: string): () => TextDocument {\n const serviceRegistry = this.serviceRegistry;\n let textDoc: TextDocument | undefined = undefined;\n return () => {\n return textDoc ??= TextDocument.create(\n uri.toString(), serviceRegistry.getServices(uri).LanguageMetaData.languageId, 0, text ?? ''\n );\n };\n }\n}\n\n/**\n * Shared service for managing Langium documents.\n */\nexport interface LangiumDocuments {\n\n /**\n * A stream of all documents managed under this service.\n */\n readonly all: Stream\n\n /**\n * Manage a new document under this service.\n * @throws an error if a document with the same URI is already present.\n */\n addDocument(document: LangiumDocument): void;\n\n /**\n * Retrieve the document with the given URI, if present. Otherwise returns `undefined`.\n */\n getDocument(uri: URI): LangiumDocument | undefined;\n\n /**\n * Retrieve the document with the given URI. If not present, a new one will be created using the file system access.\n * The new document will be added to the list of documents managed under this service.\n */\n getOrCreateDocument(uri: URI, cancellationToken?: CancellationToken): Promise;\n\n /**\n * Creates a new document with the given URI and text content.\n * The new document is automatically added to this service and can be retrieved using {@link getDocument}.\n *\n * @throws an error if a document with the same URI is already present.\n */\n createDocument(uri: URI, text: string): LangiumDocument;\n\n /**\n * Creates a new document with the given URI and text content asynchronously.\n * The process can be interrupted with a cancellation token.\n * The new document is automatically added to this service and can be retrieved using {@link getDocument}.\n *\n * @throws an error if a document with the same URI is already present.\n */\n createDocument(uri: URI, text: string, cancellationToken: CancellationToken): Promise;\n\n /**\n * Returns `true` if a document with the given URI is managed under this service.\n */\n hasDocument(uri: URI): boolean;\n\n /**\n * Flag the document with the given URI as `Changed`, if present, meaning that its content\n * is no longer valid. The content (parseResult) stays untouched, while internal data may\n * be dropped to reduce memory footprint.\n *\n * @returns the affected {@link LangiumDocument} if existing for convenience\n */\n invalidateDocument(uri: URI): LangiumDocument | undefined;\n\n /**\n * Remove the document with the given URI, if present, and mark it as `Changed`, meaning\n * that its content is no longer valid. The next call to `getOrCreateDocument` with the same\n * URI will create a new document instance.\n *\n * @returns the affected {@link LangiumDocument} if existing for convenience\n */\n deleteDocument(uri: URI): LangiumDocument | undefined;\n}\n\nexport class DefaultLangiumDocuments implements LangiumDocuments {\n\n protected readonly langiumDocumentFactory: LangiumDocumentFactory;\n\n protected readonly documentMap: Map = new Map();\n\n constructor(services: LangiumSharedCoreServices) {\n this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;\n }\n\n get all(): Stream {\n return stream(this.documentMap.values());\n }\n\n addDocument(document: LangiumDocument): void {\n const uriString = document.uri.toString();\n if (this.documentMap.has(uriString)) {\n throw new Error(`A document with the URI '${uriString}' is already present.`);\n }\n this.documentMap.set(uriString, document);\n }\n\n getDocument(uri: URI): LangiumDocument | undefined {\n const uriString = uri.toString();\n return this.documentMap.get(uriString);\n }\n\n async getOrCreateDocument(uri: URI, cancellationToken?: CancellationToken): Promise {\n let document = this.getDocument(uri);\n if (document) {\n return document;\n }\n document = await this.langiumDocumentFactory.fromUri(uri, cancellationToken);\n this.addDocument(document);\n return document;\n }\n\n createDocument(uri: URI, text: string): LangiumDocument;\n createDocument(uri: URI, text: string, cancellationToken: CancellationToken): Promise;\n createDocument(uri: URI, text: string, cancellationToken?: CancellationToken): LangiumDocument | Promise {\n if (cancellationToken) {\n return this.langiumDocumentFactory.fromString(text, uri, cancellationToken).then(document => {\n this.addDocument(document);\n return document;\n });\n } else {\n const document = this.langiumDocumentFactory.fromString(text, uri);\n this.addDocument(document);\n return document;\n }\n }\n\n hasDocument(uri: URI): boolean {\n return this.documentMap.has(uri.toString());\n }\n\n invalidateDocument(uri: URI): LangiumDocument | undefined {\n const uriString = uri.toString();\n const langiumDoc = this.documentMap.get(uriString);\n if (langiumDoc) {\n langiumDoc.state = DocumentState.Changed;\n langiumDoc.precomputedScopes = undefined;\n langiumDoc.references = [];\n langiumDoc.diagnostics = undefined;\n }\n return langiumDoc;\n }\n\n deleteDocument(uri: URI): LangiumDocument | undefined {\n const uriString = uri.toString();\n const langiumDoc = this.documentMap.get(uriString);\n if (langiumDoc) {\n langiumDoc.state = DocumentState.Changed;\n this.documentMap.delete(uriString);\n }\n return langiumDoc;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription, AstReflection, CstNode, LinkingError, Reference, ReferenceInfo } from '../syntax-tree.js';\nimport type { AstNodeLocator } from '../workspace/ast-node-locator.js';\nimport type { LangiumDocument, LangiumDocuments } from '../workspace/documents.js';\nimport type { ScopeProvider } from './scope-provider.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { isAstNode, isAstNodeDescription, isLinkingError } from '../syntax-tree.js';\nimport { getDocument, streamAst, streamReferences } from '../utils/ast-utils.js';\nimport { interruptAndCheck } from '../utils/promise-utils.js';\nimport { DocumentState } from '../workspace/documents.js';\n\n/**\n * Language-specific service for resolving cross-references in the AST.\n */\nexport interface Linker {\n\n /**\n * Links all cross-references within the specified document. The default implementation loads only target\n * elements from documents that are present in the `LangiumDocuments` service. The linked references are\n * stored in the document's `references` property.\n *\n * @param document A LangiumDocument that shall be linked.\n * @param cancelToken A token for cancelling the operation.\n */\n link(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n\n /**\n * Unlinks all references within the specified document and removes them from the list of `references`.\n *\n * @param document A LangiumDocument that shall be unlinked.\n */\n unlink(document: LangiumDocument): void;\n\n /**\n * Determines a candidate AST node description for linking the given reference.\n *\n * @param node The AST node containing the reference.\n * @param refId The reference identifier used to build a scope.\n * @param reference The actual reference to resolve.\n */\n getCandidate(refInfo: ReferenceInfo): AstNodeDescription | LinkingError;\n\n /**\n * Creates a cross reference node being aware of its containing AstNode, the corresponding CstNode,\n * the cross reference text denoting the target AstNode being already extracted of the document text,\n * as well as the unique cross reference identifier.\n *\n * Default behavior:\n * - The returned Reference's 'ref' property pointing to the target AstNode is populated lazily on its\n * first visit.\n * - If the target AstNode cannot be resolved on the first visit, an error indicator will be installed\n * and further resolution attempts will *not* be performed.\n *\n * @param node The containing AST node\n * @param refNode The corresponding CST node\n * @param refId The cross reference identifier like ':'\n * @param refText The cross reference text denoting the target AstNode\n * @returns the desired Reference node, whose behavior wrt. resolving the cross reference is implementation specific.\n */\n buildReference(node: AstNode, property: string, refNode: CstNode | undefined, refText: string): Reference;\n\n}\n\ninterface DefaultReference extends Reference {\n _ref?: AstNode | LinkingError;\n _nodeDescription?: AstNodeDescription;\n}\n\nexport class DefaultLinker implements Linker {\n protected readonly reflection: AstReflection;\n protected readonly scopeProvider: ScopeProvider;\n protected readonly astNodeLocator: AstNodeLocator;\n protected readonly langiumDocuments: () => LangiumDocuments;\n\n constructor(services: LangiumCoreServices) {\n this.reflection = services.shared.AstReflection;\n this.langiumDocuments = () => services.shared.workspace.LangiumDocuments;\n this.scopeProvider = services.references.ScopeProvider;\n this.astNodeLocator = services.workspace.AstNodeLocator;\n }\n\n async link(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n for (const node of streamAst(document.parseResult.value)) {\n await interruptAndCheck(cancelToken);\n streamReferences(node).forEach(ref => this.doLink(ref, document));\n }\n }\n\n protected doLink(refInfo: ReferenceInfo, document: LangiumDocument): void {\n const ref = refInfo.reference as DefaultReference;\n // The reference may already have been resolved lazily by accessing its `ref` property.\n if (ref._ref === undefined) {\n try {\n const description = this.getCandidate(refInfo);\n if (isLinkingError(description)) {\n ref._ref = description;\n } else {\n ref._nodeDescription = description;\n if (this.langiumDocuments().hasDocument(description.documentUri)) {\n // The target document is already loaded\n const linkedNode = this.loadAstNode(description);\n ref._ref = linkedNode ?? this.createLinkingError(refInfo, description);\n }\n }\n } catch (err) {\n ref._ref = {\n ...refInfo,\n message: `An error occurred while resolving reference to '${ref.$refText}': ${err}`\n };\n }\n }\n // Add the reference to the document's array of references\n document.references.push(ref);\n }\n\n unlink(document: LangiumDocument): void {\n for (const ref of document.references) {\n delete (ref as DefaultReference)._ref;\n delete (ref as DefaultReference)._nodeDescription;\n }\n document.references = [];\n }\n\n getCandidate(refInfo: ReferenceInfo): AstNodeDescription | LinkingError {\n const scope = this.scopeProvider.getScope(refInfo);\n const description = scope.getElement(refInfo.reference.$refText);\n return description ?? this.createLinkingError(refInfo);\n }\n\n buildReference(node: AstNode, property: string, refNode: CstNode | undefined, refText: string): Reference {\n // See behavior description in doc of Linker, update that on changes in here.\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const linker = this;\n const reference: DefaultReference = {\n $refNode: refNode,\n $refText: refText,\n\n get ref() {\n if (isAstNode(this._ref)) {\n // Most frequent case: the target is already resolved.\n return this._ref;\n } else if (isAstNodeDescription(this._nodeDescription)) {\n // A candidate has been found before, but it is not loaded yet.\n const linkedNode = linker.loadAstNode(this._nodeDescription);\n this._ref = linkedNode ??\n linker.createLinkingError({ reference, container: node, property }, this._nodeDescription);\n } else if (this._ref === undefined) {\n // The reference has not been linked yet, so do that now.\n const refData = linker.getLinkedNode({ reference, container: node, property });\n if (refData.error && getDocument(node).state < DocumentState.ComputedScopes) {\n // Document scope is not ready, don't set `this._ref` so linker can retry later.\n return undefined;\n }\n this._ref = refData.node ?? refData.error;\n this._nodeDescription = refData.descr;\n }\n return isAstNode(this._ref) ? this._ref : undefined;\n },\n get $nodeDescription() {\n return this._nodeDescription;\n },\n get error() {\n return isLinkingError(this._ref) ? this._ref : undefined;\n }\n };\n return reference;\n }\n\n protected getLinkedNode(refInfo: ReferenceInfo): { node?: AstNode, descr?: AstNodeDescription, error?: LinkingError } {\n try {\n const description = this.getCandidate(refInfo);\n if (isLinkingError(description)) {\n return { error: description };\n }\n const linkedNode = this.loadAstNode(description);\n if (linkedNode) {\n return { node: linkedNode, descr: description };\n }\n else {\n return {\n descr: description,\n error:\n this.createLinkingError(refInfo, description)\n };\n }\n } catch (err) {\n return {\n error: {\n ...refInfo,\n message: `An error occurred while resolving reference to '${refInfo.reference.$refText}': ${err}`\n }\n };\n }\n }\n\n protected loadAstNode(nodeDescription: AstNodeDescription): AstNode | undefined {\n if (nodeDescription.node) {\n return nodeDescription.node;\n }\n const doc = this.langiumDocuments().getDocument(nodeDescription.documentUri);\n if (!doc) {\n return undefined;\n }\n return this.astNodeLocator.getAstNode(doc.parseResult.value, nodeDescription.path);\n }\n\n protected createLinkingError(refInfo: ReferenceInfo, targetDescription?: AstNodeDescription): LinkingError {\n // Check whether the document is sufficiently processed by the DocumentBuilder. If not, this is a hint for a bug\n // in the language implementation.\n const document = getDocument(refInfo.container);\n if (document.state < DocumentState.ComputedScopes) {\n console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document.uri}).`);\n }\n const referenceType = this.reflection.getReferenceType(refInfo);\n return {\n ...refInfo,\n message: `Could not resolve reference to ${referenceType} named '${refInfo.reference.$refText}'.`,\n targetDescription\n };\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { AstNode, CstNode } from '../syntax-tree.js';\nimport { findNodeForProperty } from '../utils/grammar-utils.js';\n\nexport interface NamedAstNode extends AstNode {\n name: string;\n}\n\nexport function isNamed(node: AstNode): node is NamedAstNode {\n return typeof (node as NamedAstNode).name === 'string';\n}\n\n/**\n * Utility service for retrieving the `name` of an `AstNode` or the `CstNode` containing a `name`.\n */\nexport interface NameProvider {\n /**\n * Returns the `name` of a given AstNode.\n * @param node Specified `AstNode` whose name node shall be retrieved.\n */\n getName(node: AstNode): string | undefined;\n /**\n * Returns the `CstNode` which contains the parsed value of the `name` assignment.\n * @param node Specified `AstNode` whose name node shall be retrieved.\n */\n getNameNode(node: AstNode): CstNode | undefined;\n}\n\nexport class DefaultNameProvider implements NameProvider {\n getName(node: AstNode): string | undefined {\n if (isNamed(node)) {\n return node.name;\n }\n return undefined;\n }\n\n getNameNode(node: AstNode): CstNode | undefined {\n return findNodeForProperty(node.$cstNode, 'name');\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, CstNode, GenericAstNode } from '../syntax-tree.js';\nimport type { Stream } from '../utils/stream.js';\nimport type { ReferenceDescription } from '../workspace/ast-descriptions.js';\nimport type { AstNodeLocator } from '../workspace/ast-node-locator.js';\nimport type { IndexManager } from '../workspace/index-manager.js';\nimport type { NameProvider } from './name-provider.js';\nimport type { URI } from '../utils/uri-utils.js';\nimport { findAssignment } from '../utils/grammar-utils.js';\nimport { isReference } from '../syntax-tree.js';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { isChildNode, toDocumentSegment } from '../utils/cst-utils.js';\nimport { stream } from '../utils/stream.js';\nimport { UriUtils } from '../utils/uri-utils.js';\n\n/**\n * Language-specific service for finding references and declaration of a given `CstNode`.\n */\nexport interface References {\n\n /**\n * If the CstNode is a reference node the target CstNode will be returned.\n * If the CstNode is a significant node of the CstNode this CstNode will be returned.\n *\n * @param sourceCstNode CstNode that points to a AstNode\n */\n findDeclaration(sourceCstNode: CstNode): AstNode | undefined;\n\n /**\n * If the CstNode is a reference node the target CstNode will be returned.\n * If the CstNode is a significant node of the CstNode this CstNode will be returned.\n *\n * @param sourceCstNode CstNode that points to a AstNode\n */\n findDeclarationNode(sourceCstNode: CstNode): CstNode | undefined;\n\n /**\n * Finds all references to the target node as references (local references) or reference descriptions.\n *\n * @param targetNode Specified target node whose references should be returned\n */\n findReferences(targetNode: AstNode, options: FindReferencesOptions): Stream;\n}\n\nexport interface FindReferencesOptions {\n /**\n * @deprecated Since v1.2.0. Please use `documentUri` instead.\n */\n onlyLocal?: boolean;\n /**\n * When set, the `findReferences` method will only return references/declarations from the specified document.\n */\n documentUri?: URI;\n /**\n * Whether the returned list of references should include the declaration.\n */\n includeDeclaration?: boolean;\n}\n\nexport class DefaultReferences implements References {\n protected readonly nameProvider: NameProvider;\n protected readonly index: IndexManager;\n protected readonly nodeLocator: AstNodeLocator;\n\n constructor(services: LangiumCoreServices) {\n this.nameProvider = services.references.NameProvider;\n this.index = services.shared.workspace.IndexManager;\n this.nodeLocator = services.workspace.AstNodeLocator;\n }\n\n findDeclaration(sourceCstNode: CstNode): AstNode | undefined {\n if (sourceCstNode) {\n const assignment = findAssignment(sourceCstNode);\n const nodeElem = sourceCstNode.astNode;\n if (assignment && nodeElem) {\n const reference = (nodeElem as GenericAstNode)[assignment.feature];\n\n if (isReference(reference)) {\n return reference.ref;\n } else if (Array.isArray(reference)) {\n for (const ref of reference) {\n if (isReference(ref) && ref.$refNode\n && ref.$refNode.offset <= sourceCstNode.offset\n && ref.$refNode.end >= sourceCstNode.end) {\n return ref.ref;\n }\n }\n }\n }\n if (nodeElem) {\n const nameNode = this.nameProvider.getNameNode(nodeElem);\n // Only return the targeted node in case the targeted cst node is the name node or part of it\n if (nameNode && (nameNode === sourceCstNode || isChildNode(sourceCstNode, nameNode))) {\n return nodeElem;\n }\n }\n }\n return undefined;\n }\n\n findDeclarationNode(sourceCstNode: CstNode): CstNode | undefined {\n const astNode = this.findDeclaration(sourceCstNode);\n if (astNode?.$cstNode) {\n const targetNode = this.nameProvider.getNameNode(astNode);\n return targetNode ?? astNode.$cstNode;\n }\n return undefined;\n }\n\n findReferences(targetNode: AstNode, options: FindReferencesOptions): Stream {\n const refs: ReferenceDescription[] = [];\n if (options.includeDeclaration) {\n const ref = this.getReferenceToSelf(targetNode);\n if (ref) {\n refs.push(ref);\n }\n }\n let indexReferences = this.index.findAllReferences(targetNode, this.nodeLocator.getAstNodePath(targetNode));\n if (options.documentUri) {\n indexReferences = indexReferences.filter(ref => UriUtils.equals(ref.sourceUri, options.documentUri));\n }\n refs.push(...indexReferences);\n return stream(refs);\n }\n\n protected getReferenceToSelf(targetNode: AstNode): ReferenceDescription | undefined {\n const nameNode = this.nameProvider.getNameNode(targetNode);\n if (nameNode) {\n const doc = getDocument(targetNode);\n const path = this.nodeLocator.getAstNodePath(targetNode);\n return {\n sourceUri: doc.uri,\n sourcePath: path,\n targetUri: doc.uri,\n targetPath: path,\n segment: toDocumentSegment(nameNode),\n local: true\n };\n }\n return undefined;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Stream } from './stream.js';\nimport { Reduction, stream } from './stream.js';\n\n/**\n * A multimap is a variation of a Map that has potentially multiple values for every key.\n */\nexport class MultiMap {\n\n private map = new Map();\n\n constructor()\n constructor(elements: Array<[K, V]>)\n constructor(elements?: Array<[K, V]>) {\n if (elements) {\n for (const [key, value] of elements) {\n this.add(key, value);\n }\n }\n }\n\n /**\n * The total number of values in the multimap.\n */\n get size(): number {\n return Reduction.sum(stream(this.map.values()).map(a => a.length));\n }\n\n /**\n * Clear all entries in the multimap.\n */\n clear(): void {\n this.map.clear();\n }\n\n /**\n * Operates differently depending on whether a `value` is given:\n * * With a value, this method deletes the specific key / value pair from the multimap.\n * * Without a value, all values associated with the given key are deleted.\n *\n * @returns `true` if a value existed and has been removed, or `false` if the specified\n * key / value does not exist.\n */\n delete(key: K, value?: V): boolean {\n if (value === undefined) {\n return this.map.delete(key);\n } else {\n const values = this.map.get(key);\n if (values) {\n const index = values.indexOf(value);\n if (index >= 0) {\n if (values.length === 1) {\n this.map.delete(key);\n } else {\n values.splice(index, 1);\n }\n return true;\n }\n }\n return false;\n }\n }\n\n /**\n * Returns an array of all values associated with the given key. If no value exists,\n * an empty array is returned.\n *\n * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a\n * value and `delete` to remove a value from the multimap.\n */\n get(key: K): readonly V[] {\n return this.map.get(key) ?? [];\n }\n\n /**\n * Operates differently depending on whether a `value` is given:\n * * With a value, this method returns `true` if the specific key / value pair is present in the multimap.\n * * Without a value, this method returns `true` if the given key is present in the multimap.\n */\n has(key: K, value?: V): boolean {\n if (value === undefined) {\n return this.map.has(key);\n } else {\n const values = this.map.get(key);\n if (values) {\n return values.indexOf(value) >= 0;\n }\n return false;\n }\n }\n\n /**\n * Add the given key / value pair to the multimap.\n */\n add(key: K, value: V): this {\n if (this.map.has(key)) {\n this.map.get(key)!.push(value);\n } else {\n this.map.set(key, [value]);\n }\n return this;\n }\n\n /**\n * Add the given set of key / value pairs to the multimap.\n */\n addAll(key: K, values: Iterable): this {\n if (this.map.has(key)) {\n this.map.get(key)!.push(...values);\n } else {\n this.map.set(key, Array.from(values));\n }\n return this;\n }\n\n /**\n * Invokes the given callback function for every key / value pair in the multimap.\n */\n forEach(callbackfn: (value: V, key: K, map: this) => void): void {\n this.map.forEach((array, key) =>\n array.forEach(value => callbackfn(value, key, this))\n );\n }\n\n /**\n * Returns an iterator of key, value pairs for every entry in the map.\n */\n [Symbol.iterator](): Iterator<[K, V]> {\n return this.entries().iterator();\n }\n\n /**\n * Returns a stream of key, value pairs for every entry in the map.\n */\n entries(): Stream<[K, V]> {\n return stream(this.map.entries())\n .flatMap(([key, array]) => array.map(value => [key, value] as [K, V]));\n }\n\n /**\n * Returns a stream of keys in the map.\n */\n keys(): Stream {\n return stream(this.map.keys());\n }\n\n /**\n * Returns a stream of values in the map.\n */\n values(): Stream {\n return stream(this.map.values()).flat();\n }\n\n /**\n * Returns a stream of key, value set pairs for every key in the map.\n */\n entriesGroupedByKey(): Stream<[K, V[]]> {\n return stream(this.map.entries());\n }\n\n}\n\nexport class BiMap {\n\n private map = new Map();\n private inverse = new Map();\n\n get size(): number {\n return this.map.size;\n }\n\n constructor()\n constructor(elements: Array<[K, V]>)\n constructor(elements?: Array<[K, V]>) {\n if (elements) {\n for (const [key, value] of elements) {\n this.set(key, value);\n }\n }\n }\n\n clear(): void {\n this.map.clear();\n this.inverse.clear();\n }\n\n set(key: K, value: V): this {\n this.map.set(key, value);\n this.inverse.set(value, key);\n return this;\n }\n\n get(key: K): V | undefined {\n return this.map.get(key);\n }\n\n getKey(value: V): K | undefined {\n return this.inverse.get(value);\n }\n\n delete(key: K): boolean {\n const value = this.map.get(key);\n if (value !== undefined) {\n this.map.delete(key);\n this.inverse.delete(value);\n return true;\n }\n return false;\n }\n}\n", "/******************************************************************************\n * Copyright 2021-2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription } from '../syntax-tree.js';\nimport type { AstNodeDescriptionProvider } from '../workspace/ast-descriptions.js';\nimport type { LangiumDocument, PrecomputedScopes } from '../workspace/documents.js';\nimport type { NameProvider } from './name-provider.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { streamAllContents, streamContents } from '../utils/ast-utils.js';\nimport { MultiMap } from '../utils/collections.js';\nimport { interruptAndCheck } from '../utils/promise-utils.js';\n\n/**\n * Language-specific service for precomputing global and local scopes. The service methods are executed\n * as the first and second phase in the `DocumentBuilder`.\n */\nexport interface ScopeComputation {\n\n /**\n * Creates descriptions of all AST nodes that shall be exported into the _global_ scope from the given\n * document. These descriptions are gathered by the `IndexManager` and stored in the global index so\n * they can be referenced from other documents.\n *\n * _Note:_ You should not resolve any cross-references in this service method. Cross-reference resolution\n * depends on the scope computation phase to be completed (`computeScope` method), which runs after the\n * initial indexing where this method is used.\n *\n * @param document The document from which to gather exported AST nodes.\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n computeExports(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n\n /**\n * Precomputes the _local_ scopes for a document, which are necessary for the default way of\n * resolving references to symbols in the same document. The result is a multimap assigning a\n * set of AST node descriptions to every level of the AST. These data are used by the `ScopeProvider`\n * service to determine which target nodes are visible in the context of a specific cross-reference.\n *\n * _Note:_ You should not resolve any cross-references in this service method. Cross-reference\n * resolution depends on the scope computation phase to be completed.\n *\n * @param document The document in which to compute scopes.\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n computeLocalScopes(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n\n}\n\n/**\n * The default scope computation creates and collectes descriptions of the AST nodes to be exported into the\n * _global_ scope from the given document. By default those are the document's root AST node and its directly\n * contained child nodes.\n *\n * Besides, it gathers all AST nodes that have a name (according to the `NameProvider` service) and includes them\n * in the local scope of their particular container nodes. As a result, for every cross-reference in the AST,\n * target elements from the same level (siblings) and further up towards the root (parents and siblings of parents)\n * are visible. Elements being nested inside lower levels (children, children of siblings and parents' siblings)\n * are _invisible_ by default, but that can be changed by customizing this service.\n */\nexport class DefaultScopeComputation implements ScopeComputation {\n\n protected readonly nameProvider: NameProvider;\n protected readonly descriptions: AstNodeDescriptionProvider;\n\n constructor(services: LangiumCoreServices) {\n this.nameProvider = services.references.NameProvider;\n this.descriptions = services.workspace.AstNodeDescriptionProvider;\n }\n\n async computeExports(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n return this.computeExportsForNode(document.parseResult.value, document, undefined, cancelToken);\n }\n\n /**\n * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children.\n * The list of children to be considered is determined by the function parameter {@link children}.\n * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported.\n *\n * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list.\n * @param document The document containing the AST node to be exported.\n * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}.\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution.\n * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index.\n */\n async computeExportsForNode(parentNode: AstNode, document: LangiumDocument, children: (root: AstNode) => Iterable = streamContents, cancelToken: CancellationToken = CancellationToken.None): Promise {\n const exports: AstNodeDescription[] = [];\n\n this.exportNode(parentNode, exports, document);\n for (const node of children(parentNode)) {\n await interruptAndCheck(cancelToken);\n this.exportNode(node, exports, document);\n }\n return exports;\n }\n\n /**\n * Add a single node to the list of exports if it has a name. Override this method to change how\n * symbols are exported, e.g. by modifying their exported name.\n */\n protected exportNode(node: AstNode, exports: AstNodeDescription[], document: LangiumDocument): void {\n const name = this.nameProvider.getName(node);\n if (name) {\n exports.push(this.descriptions.createDescription(node, name, document));\n }\n }\n\n async computeLocalScopes(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n const rootNode = document.parseResult.value;\n const scopes = new MultiMap();\n // Here we navigate the full AST - local scopes shall be available in the whole document\n for (const node of streamAllContents(rootNode)) {\n await interruptAndCheck(cancelToken);\n this.processNode(node, document, scopes);\n }\n return scopes;\n }\n\n /**\n * Process a single node during scopes computation. The default implementation makes the node visible\n * in the subtree of its container (if the node has a name). Override this method to change this,\n * e.g. by increasing the visibility to a higher level in the AST.\n */\n protected processNode(node: AstNode, document: LangiumDocument, scopes: PrecomputedScopes): void {\n const container = node.$container;\n if (container) {\n const name = this.nameProvider.getName(node);\n if (name) {\n scopes.add(container, this.descriptions.createDescription(node, name, document));\n }\n }\n }\n\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { AstNodeDescription } from '../syntax-tree.js';\nimport type { Stream } from '../utils/stream.js';\nimport { EMPTY_STREAM, stream } from '../utils/stream.js';\n\n/**\n * A scope describes what target elements are visible from a specific cross-reference context.\n */\nexport interface Scope {\n\n /**\n * Find a target element matching the given name. If no element is found, `undefined` is returned.\n * If multiple matching elements are present, the selection of the returned element should be done\n * according to the semantics of your language. Usually it is the element that is most closely defined.\n *\n * @param name Name of the cross-reference target as it appears in the source text.\n */\n getElement(name: string): AstNodeDescription | undefined;\n\n /**\n * Create a stream of all elements in the scope. This is used to compute completion proposals to be\n * shown in the editor.\n */\n getAllElements(): Stream;\n\n}\n\nexport interface ScopeOptions {\n caseInsensitive?: boolean;\n}\n\n/**\n * The default scope implementation is based on a `Stream`. It has an optional _outer scope_ describing\n * the next level of elements, which are queried when a target element is not found in the stream provided\n * to this scope.\n */\nexport class StreamScope implements Scope {\n readonly elements: Stream;\n readonly outerScope?: Scope;\n readonly caseInsensitive: boolean;\n\n constructor(elements: Stream, outerScope?: Scope, options?: ScopeOptions) {\n this.elements = elements;\n this.outerScope = outerScope;\n this.caseInsensitive = options?.caseInsensitive ?? false;\n }\n\n getAllElements(): Stream {\n if (this.outerScope) {\n return this.elements.concat(this.outerScope.getAllElements());\n } else {\n return this.elements;\n }\n }\n\n getElement(name: string): AstNodeDescription | undefined {\n const local = this.caseInsensitive\n ? this.elements.find(e => e.name.toLowerCase() === name.toLowerCase())\n : this.elements.find(e => e.name === name);\n if (local) {\n return local;\n }\n if (this.outerScope) {\n return this.outerScope.getElement(name);\n }\n return undefined;\n }\n}\n\nexport class MapScope implements Scope {\n readonly elements: Map;\n readonly outerScope?: Scope;\n readonly caseInsensitive: boolean;\n\n constructor(elements: Iterable, outerScope?: Scope, options?: ScopeOptions) {\n this.elements = new Map();\n this.caseInsensitive = options?.caseInsensitive ?? false;\n for (const element of elements) {\n const name = this.caseInsensitive\n ? element.name.toLowerCase()\n : element.name;\n this.elements.set(name, element);\n }\n this.outerScope = outerScope;\n }\n\n getElement(name: string): AstNodeDescription | undefined {\n const localName = this.caseInsensitive ? name.toLowerCase() : name;\n const local = this.elements.get(localName);\n if (local) {\n return local;\n }\n if (this.outerScope) {\n return this.outerScope.getElement(name);\n }\n return undefined;\n }\n\n getAllElements(): Stream {\n let elementStream = stream(this.elements.values());\n if (this.outerScope) {\n elementStream = elementStream.concat(this.outerScope.getAllElements());\n }\n return elementStream;\n }\n\n}\n\nexport const EMPTY_SCOPE: Scope = {\n getElement(): undefined {\n return undefined;\n },\n getAllElements(): Stream {\n return EMPTY_STREAM;\n }\n};\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Disposable } from './disposable.js';\nimport type { URI } from './uri-utils.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\n\nexport abstract class DisposableCache implements Disposable {\n\n protected toDispose: Disposable[] = [];\n protected isDisposed = false;\n\n onDispose(disposable: Disposable): void {\n this.toDispose.push(disposable);\n }\n\n dispose(): void {\n this.throwIfDisposed();\n this.clear();\n this.isDisposed = true;\n this.toDispose.forEach(disposable => disposable.dispose());\n }\n\n protected throwIfDisposed(): void {\n if (this.isDisposed) {\n throw new Error('This cache has already been disposed');\n }\n }\n\n abstract clear(): void;\n}\n\nexport class SimpleCache extends DisposableCache {\n protected readonly cache = new Map();\n\n has(key: K): boolean {\n this.throwIfDisposed();\n return this.cache.has(key);\n }\n\n set(key: K, value: V): void {\n this.throwIfDisposed();\n this.cache.set(key, value);\n }\n\n get(key: K): V | undefined;\n get(key: K, provider: () => V): V;\n get(key: K, provider?: () => V): V | undefined {\n this.throwIfDisposed();\n if (this.cache.has(key)) {\n return this.cache.get(key);\n } else if (provider) {\n const value = provider();\n this.cache.set(key, value);\n return value;\n } else {\n return undefined;\n }\n }\n\n delete(key: K): boolean {\n this.throwIfDisposed();\n return this.cache.delete(key);\n }\n\n clear(): void {\n this.throwIfDisposed();\n this.cache.clear();\n }\n}\n\nexport class ContextCache extends DisposableCache {\n\n private readonly cache = new Map>();\n private readonly converter: (input: Context) => ContextKey | Context;\n\n constructor(converter?: (input: Context) => ContextKey) {\n super();\n this.converter = converter ?? (value => value);\n }\n\n has(contextKey: Context, key: Key): boolean {\n this.throwIfDisposed();\n return this.cacheForContext(contextKey).has(key);\n }\n\n set(contextKey: Context, key: Key, value: Value): void {\n this.throwIfDisposed();\n this.cacheForContext(contextKey).set(key, value);\n }\n\n get(contextKey: Context, key: Key): Value | undefined;\n get(contextKey: Context, key: Key, provider: () => Value): Value;\n get(contextKey: Context, key: Key, provider?: () => Value): Value | undefined {\n this.throwIfDisposed();\n const contextCache = this.cacheForContext(contextKey);\n if (contextCache.has(key)) {\n return contextCache.get(key);\n } else if (provider) {\n const value = provider();\n contextCache.set(key, value);\n return value;\n } else {\n return undefined;\n }\n }\n\n delete(contextKey: Context, key: Key): boolean {\n this.throwIfDisposed();\n return this.cacheForContext(contextKey).delete(key);\n }\n\n clear(): void;\n clear(contextKey: Context): void;\n clear(contextKey?: Context): void {\n this.throwIfDisposed();\n if (contextKey) {\n const mapKey = this.converter(contextKey);\n this.cache.delete(mapKey);\n } else {\n this.cache.clear();\n }\n }\n\n protected cacheForContext(contextKey: Context): Map {\n const mapKey = this.converter(contextKey);\n let documentCache = this.cache.get(mapKey);\n if (!documentCache) {\n documentCache = new Map();\n this.cache.set(mapKey, documentCache);\n }\n return documentCache;\n }\n}\n\n/**\n * Every key/value pair in this cache is scoped to a document.\n * If this document is changed or deleted, all associated key/value pairs are deleted.\n */\nexport class DocumentCache extends ContextCache {\n constructor(sharedServices: LangiumSharedCoreServices) {\n super(uri => uri.toString());\n this.onDispose(sharedServices.workspace.DocumentBuilder.onUpdate((changed, deleted) => {\n const allUris = changed.concat(deleted);\n for (const uri of allUris) {\n this.clear(uri);\n }\n }));\n }\n}\n\n/**\n * Every key/value pair in this cache is scoped to the whole workspace.\n * If any document in the workspace changes, the whole cache is evicted.\n */\nexport class WorkspaceCache extends SimpleCache {\n constructor(sharedServices: LangiumSharedCoreServices) {\n super();\n this.onDispose(sharedServices.workspace.DocumentBuilder.onUpdate(() => {\n this.clear();\n }));\n }\n}\n", "/******************************************************************************\n * Copyright 2021-2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription, AstReflection, ReferenceInfo } from '../syntax-tree.js';\nimport type { Stream } from '../utils/stream.js';\nimport type { AstNodeDescriptionProvider } from '../workspace/ast-descriptions.js';\nimport type { IndexManager } from '../workspace/index-manager.js';\nimport type { NameProvider } from './name-provider.js';\nimport type { Scope, ScopeOptions} from './scope.js';\nimport { MapScope, StreamScope } from './scope.js';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { stream } from '../utils/stream.js';\nimport { WorkspaceCache } from '../utils/caching.js';\n\n/**\n * Language-specific service for determining the scope of target elements visible in a specific cross-reference context.\n */\nexport interface ScopeProvider {\n\n /**\n * Return a scope describing what elements are visible for the given AST node and cross-reference\n * identifier.\n *\n * @param context Information about the reference for which a scope is requested.\n */\n getScope(context: ReferenceInfo): Scope;\n\n}\n\nexport class DefaultScopeProvider implements ScopeProvider {\n\n protected readonly reflection: AstReflection;\n protected readonly nameProvider: NameProvider;\n protected readonly descriptions: AstNodeDescriptionProvider;\n protected readonly indexManager: IndexManager;\n\n protected readonly globalScopeCache: WorkspaceCache;\n\n constructor(services: LangiumCoreServices) {\n this.reflection = services.shared.AstReflection;\n this.nameProvider = services.references.NameProvider;\n this.descriptions = services.workspace.AstNodeDescriptionProvider;\n this.indexManager = services.shared.workspace.IndexManager;\n this.globalScopeCache = new WorkspaceCache(services.shared);\n }\n\n getScope(context: ReferenceInfo): Scope {\n const scopes: Array> = [];\n const referenceType = this.reflection.getReferenceType(context);\n\n const precomputed = getDocument(context.container).precomputedScopes;\n if (precomputed) {\n let currentNode: AstNode | undefined = context.container;\n do {\n const allDescriptions = precomputed.get(currentNode);\n if (allDescriptions.length > 0) {\n scopes.push(stream(allDescriptions).filter(\n desc => this.reflection.isSubtype(desc.type, referenceType)));\n }\n currentNode = currentNode.$container;\n } while (currentNode);\n }\n\n let result: Scope = this.getGlobalScope(referenceType, context);\n for (let i = scopes.length - 1; i >= 0; i--) {\n result = this.createScope(scopes[i], result);\n }\n return result;\n }\n\n /**\n * Create a scope for the given collection of AST node descriptions.\n */\n protected createScope(elements: Iterable, outerScope?: Scope, options?: ScopeOptions): Scope {\n return new StreamScope(stream(elements), outerScope, options);\n }\n\n /**\n * Create a scope for the given collection of AST nodes, which need to be transformed into respective\n * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services.\n */\n protected createScopeForNodes(elements: Iterable, outerScope?: Scope, options?: ScopeOptions): Scope {\n const s = stream(elements).map(e => {\n const name = this.nameProvider.getName(e);\n if (name) {\n return this.descriptions.createDescription(e, name);\n }\n return undefined;\n }).nonNullable();\n return new StreamScope(s, outerScope, options);\n }\n\n /**\n * Create a global scope filtered for the given reference type.\n */\n protected getGlobalScope(referenceType: string, _context: ReferenceInfo): Scope {\n return this.globalScopeCache.get(referenceType, () => new MapScope(this.indexManager.allElements(referenceType)));\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { URI } from 'vscode-uri';\nimport type { CommentProvider } from '../documentation/comment-provider.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, CstNode, GenericAstNode, Mutable, Reference } from '../syntax-tree.js';\nimport { isAstNode, isReference } from '../syntax-tree.js';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { findNodesForProperty } from '../utils/grammar-utils.js';\nimport type { AstNodeLocator } from '../workspace/ast-node-locator.js';\nimport type { DocumentSegment, LangiumDocument, LangiumDocuments } from '../workspace/documents.js';\n\nexport interface JsonSerializeOptions {\n /** The space parameter for `JSON.stringify`, controlling whether and how to pretty-print the output. */\n space?: string | number;\n /** Whether to include the `$refText` property for references (the name used to identify the target node). */\n refText?: boolean;\n /** Whether to include the `$sourceText` property, which holds the full source text from which an AST node was parsed. */\n sourceText?: boolean;\n /** Whether to include the `$textRegion` property, which holds information to trace AST node properties to their respective source text regions. */\n textRegions?: boolean;\n /** Whether to include the `$comment` property, which holds comments according to the CommentProvider service. */\n comments?: boolean;\n /** The replacer parameter for `JSON.stringify`; the default replacer given as parameter should be used to apply basic replacements. */\n replacer?: (key: string, value: unknown, defaultReplacer: (key: string, value: unknown) => unknown) => unknown\n /** Used to convert and serialize URIs when the target of a cross-reference is in a different document. */\n uriConverter?: (uri: URI, reference: Reference) => string\n}\n\nexport interface JsonDeserializeOptions {\n /** Used to parse and convert URIs when the target of a cross-reference is in a different document. */\n uriConverter?: (uri: string) => URI\n}\n\n/**\n * {@link AstNode}s that may carry information on their definition area within the DSL text.\n */\nexport interface AstNodeWithTextRegion extends AstNode {\n $sourceText?: string;\n $textRegion?: AstNodeRegionWithAssignments;\n}\n\n/**\n * {@link AstNode}s that may carry a semantically relevant comment.\n */\nexport interface AstNodeWithComment extends AstNode {\n $comment?: string;\n}\n\nexport function isAstNodeWithComment(node: AstNode): node is AstNodeWithComment {\n return typeof (node as AstNodeWithComment).$comment === 'string';\n}\n\n/**\n * A {@DocumentSegment} representing the definition area of an AstNode within the DSL text.\n * Usually contains text region information on all assigned property values of the AstNode,\n * and may contain the defining file's URI as string.\n */\nexport interface AstNodeRegionWithAssignments extends DocumentSegment {\n /**\n * A record containing an entry for each assigned property of the AstNode.\n * The key is equal to the property name and the value is an array of the property values'\n * text regions, regardless of whether the property is a single value or list property.\n */\n assignments?: Record;\n /**\n * The AstNode defining file's URI as string\n */\n documentURI?: string;\n}\n\n/**\n * Utility service for transforming an `AstNode` into a JSON string and vice versa.\n */\nexport interface JsonSerializer {\n /**\n * Serialize an `AstNode` into a JSON `string`.\n * @param node The `AstNode` to be serialized.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\n serialize(node: AstNode, options?: JsonSerializeOptions): string;\n /**\n * Deserialize (parse) a JSON `string` into an `AstNode`.\n */\n deserialize(content: string, options?: JsonDeserializeOptions): T;\n}\n\n/**\n * A cross-reference in the serialized JSON representation of an AstNode.\n */\ninterface IntermediateReference {\n /** URI pointing to the target element. This is either `#${path}` if the target is in the same document, or `${documentURI}#${path}` otherwise. */\n $ref?: string\n /** The actual text used to look up the reference target in the surrounding scope. */\n $refText?: string\n /** If any problem occurred while resolving the reference, it is described by this property. */\n $error?: string\n}\n\nfunction isIntermediateReference(obj: unknown): obj is IntermediateReference {\n return typeof obj === 'object' && !!obj && ('$ref' in obj || '$error' in obj);\n}\n\nexport class DefaultJsonSerializer implements JsonSerializer {\n\n /** The set of AstNode properties to be ignored by the serializer. */\n ignoreProperties = new Set(['$container', '$containerProperty', '$containerIndex', '$document', '$cstNode']);\n\n /** The document that is currently processed by the serializer; this is used by the replacer function. */\n protected currentDocument: LangiumDocument | undefined;\n\n protected readonly langiumDocuments: LangiumDocuments;\n protected readonly astNodeLocator: AstNodeLocator;\n protected readonly nameProvider: NameProvider;\n protected readonly commentProvider: CommentProvider;\n\n constructor(services: LangiumCoreServices) {\n this.langiumDocuments = services.shared.workspace.LangiumDocuments;\n this.astNodeLocator = services.workspace.AstNodeLocator;\n this.nameProvider = services.references.NameProvider;\n this.commentProvider = services.documentation.CommentProvider;\n }\n\n serialize(node: AstNode, options: JsonSerializeOptions = {}): string {\n const specificReplacer = options?.replacer;\n const defaultReplacer = (key: string, value: unknown) => this.replacer(key, value, options);\n const replacer = specificReplacer ? (key: string, value: unknown) => specificReplacer(key, value, defaultReplacer) : defaultReplacer;\n\n try {\n this.currentDocument = getDocument(node);\n return JSON.stringify(node, replacer, options?.space);\n } finally {\n this.currentDocument = undefined;\n }\n }\n\n deserialize(content: string, options: JsonDeserializeOptions = {}): T {\n const root = JSON.parse(content);\n this.linkNode(root, root, options);\n return root;\n }\n\n protected replacer(key: string, value: unknown, { refText, sourceText, textRegions, comments, uriConverter }: JsonSerializeOptions): unknown {\n if (this.ignoreProperties.has(key)) {\n return undefined;\n } else if (isReference(value)) {\n const refValue = value.ref;\n const $refText = refText ? value.$refText : undefined;\n if (refValue) {\n const targetDocument = getDocument(refValue);\n let targetUri = '';\n if (this.currentDocument && this.currentDocument !== targetDocument) {\n if (uriConverter) {\n targetUri = uriConverter(targetDocument.uri, value);\n } else {\n targetUri = targetDocument.uri.toString();\n }\n }\n const targetPath = this.astNodeLocator.getAstNodePath(refValue);\n return {\n $ref: `${targetUri}#${targetPath}`,\n $refText\n } satisfies IntermediateReference;\n } else {\n return {\n $error: value.error?.message ?? 'Could not resolve reference',\n $refText\n } satisfies IntermediateReference;\n }\n } else if (isAstNode(value)) {\n let astNode: AstNodeWithTextRegion | undefined = undefined;\n if (textRegions) {\n astNode = this.addAstNodeRegionWithAssignmentsTo({ ...value });\n if ((!key || value.$document) && astNode?.$textRegion) {\n // The document URI is added to the root node of the resulting JSON tree\n astNode.$textRegion.documentURI = this.currentDocument?.uri.toString();\n }\n }\n if (sourceText && !key) {\n astNode ??= { ...value };\n astNode.$sourceText = value.$cstNode?.text;\n }\n if (comments) {\n astNode ??= { ...value };\n const comment = this.commentProvider.getComment(value);\n if (comment) {\n (astNode as AstNodeWithComment).$comment = comment.replace(/\\r/g, '');\n }\n }\n return astNode ?? value;\n } else {\n return value;\n }\n }\n\n protected addAstNodeRegionWithAssignmentsTo(node: AstNodeWithTextRegion) {\n const createDocumentSegment: (cstNode: CstNode) => AstNodeRegionWithAssignments = cstNode => {\n offset: cstNode.offset,\n end: cstNode.end,\n length: cstNode.length,\n range: cstNode.range,\n };\n\n if (node.$cstNode) {\n const textRegion = node.$textRegion = createDocumentSegment(node.$cstNode);\n const assignments: Record = textRegion.assignments = {};\n\n Object.keys(node).filter(key => !key.startsWith('$')).forEach(key => {\n const propertyAssignments = findNodesForProperty(node.$cstNode, key).map(createDocumentSegment);\n if (propertyAssignments.length !== 0) {\n assignments[key] = propertyAssignments;\n }\n });\n\n return node;\n }\n return undefined;\n }\n\n protected linkNode(node: GenericAstNode, root: AstNode, options: JsonDeserializeOptions, container?: AstNode, containerProperty?: string, containerIndex?: number) {\n for (const [propertyName, item] of Object.entries(node)) {\n if (Array.isArray(item)) {\n for (let index = 0; index < item.length; index++) {\n const element = item[index];\n if (isIntermediateReference(element)) {\n item[index] = this.reviveReference(node, propertyName, root, element, options);\n } else if (isAstNode(element)) {\n this.linkNode(element as GenericAstNode, root, options, node, propertyName, index);\n }\n }\n } else if (isIntermediateReference(item)) {\n node[propertyName] = this.reviveReference(node, propertyName, root, item, options);\n } else if (isAstNode(item)) {\n this.linkNode(item as GenericAstNode, root, options, node, propertyName);\n }\n }\n const mutable = node as Mutable;\n mutable.$container = container;\n mutable.$containerProperty = containerProperty;\n mutable.$containerIndex = containerIndex;\n }\n\n protected reviveReference(container: AstNode, property: string, root: AstNode, reference: IntermediateReference, options: JsonDeserializeOptions): Reference | undefined {\n let refText = reference.$refText;\n let error = reference.$error;\n if (reference.$ref) {\n const ref = this.getRefNode(root, reference.$ref, options.uriConverter);\n if (isAstNode(ref)) {\n if (!refText) {\n refText = this.nameProvider.getName(ref);\n }\n return {\n $refText: refText ?? '',\n ref\n };\n } else {\n error = ref;\n }\n }\n if (error) {\n const ref: Mutable = {\n $refText: refText ?? ''\n };\n ref.error = {\n container,\n property,\n message: error,\n reference: ref\n };\n return ref;\n } else {\n return undefined;\n }\n }\n\n protected getRefNode(root: AstNode, uri: string, uriConverter?: (uri: string) => URI): AstNode | string {\n try {\n const fragmentIndex = uri.indexOf('#');\n if (fragmentIndex === 0) {\n const node = this.astNodeLocator.getAstNode(root, uri.substring(1));\n if (!node) {\n return 'Could not resolve path: ' + uri;\n }\n return node;\n }\n if (fragmentIndex < 0) {\n const documentUri = uriConverter ? uriConverter(uri) : URI.parse(uri);\n const document = this.langiumDocuments.getDocument(documentUri);\n if (!document) {\n return 'Could not find document for URI: ' + uri;\n }\n return document.parseResult.value;\n }\n const documentUri = uriConverter ? uriConverter(uri.substring(0, fragmentIndex)) : URI.parse(uri.substring(0, fragmentIndex));\n const document = this.langiumDocuments.getDocument(documentUri);\n if (!document) {\n return 'Could not find document for URI: ' + uri;\n }\n if (fragmentIndex === uri.length - 1) {\n return document.parseResult.value;\n }\n const node = this.astNodeLocator.getAstNode(document.parseResult.value, uri.substring(fragmentIndex + 1));\n if (!node) {\n return 'Could not resolve URI: ' + uri;\n }\n return node;\n } catch (err) {\n return String(err);\n }\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from './services.js';\nimport { UriUtils, type URI } from './utils/uri-utils.js';\n\n/**\n * The service registry provides access to the language-specific {@link LangiumCoreServices} optionally including LSP-related services.\n * These are resolved via the URI of a text document.\n */\nexport interface ServiceRegistry {\n\n /**\n * Register a language via its injected services.\n */\n register(language: LangiumCoreServices): void;\n\n /**\n * Retrieve the language-specific services for the given URI. In case only one language is\n * registered, it may be used regardless of the URI format.\n */\n getServices(uri: URI): LangiumCoreServices;\n\n /**\n * The full set of registered language services.\n */\n readonly all: readonly LangiumCoreServices[];\n}\n\n/**\n * Generic registry for Langium services, but capable of being used with extending service sets as well (such as the lsp-complete LangiumCoreServices set)\n */\nexport class DefaultServiceRegistry implements ServiceRegistry {\n\n protected singleton?: LangiumCoreServices;\n protected map?: Record;\n\n register(language: LangiumCoreServices): void {\n if (!this.singleton && !this.map) {\n // This is the first language to be registered; store it as singleton.\n this.singleton = language;\n return;\n }\n if (!this.map) {\n this.map = {};\n if (this.singleton) {\n // Move the previous singleton instance to the new map.\n for (const ext of this.singleton.LanguageMetaData.fileExtensions) {\n this.map[ext] = this.singleton;\n }\n this.singleton = undefined;\n }\n }\n // Store the language services in the map.\n for (const ext of language.LanguageMetaData.fileExtensions) {\n if (this.map[ext] !== undefined && this.map[ext] !== language) {\n console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${language.LanguageMetaData.languageId}'.`);\n }\n this.map[ext] = language;\n }\n }\n\n getServices(uri: URI): LangiumCoreServices {\n if (this.singleton !== undefined) {\n return this.singleton;\n }\n if (this.map === undefined) {\n throw new Error('The service registry is empty. Use `register` to register the services of a language.');\n }\n const ext = UriUtils.extname(uri);\n const services = this.map[ext];\n if (!services) {\n throw new Error(`The service registry contains no services for the extension '${ext}'.`);\n }\n return services;\n }\n\n get all(): readonly LangiumCoreServices[] {\n if (this.singleton !== undefined) {\n return [this.singleton];\n }\n if (this.map !== undefined) {\n return Object.values(this.map);\n }\n return [];\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CodeDescription, DiagnosticRelatedInformation, DiagnosticTag, integer, Range } from 'vscode-languageserver-types';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstReflection, Properties } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { Stream } from '../utils/stream.js';\nimport type { DocumentSegment } from '../workspace/documents.js';\nimport { MultiMap } from '../utils/collections.js';\nimport { isOperationCancelled } from '../utils/promise-utils.js';\nimport { stream } from '../utils/stream.js';\n\nexport type DiagnosticInfo> = {\n /** The AST node to which the diagnostic is attached. */\n node: N;\n /** If a property name is given, the diagnostic is restricted to the corresponding text region. */\n property?: P;\n /** If the value of a keyword is given, the diagnostic will appear at its corresponding text region */\n keyword?: string;\n /** In case of a multi-value property (array), an index can be given to select a specific element. */\n index?: number;\n /** If you want to create a diagnostic independent to any property, use the range property. */\n range?: Range;\n /** The diagnostic's code, which usually appear in the user interface. */\n code?: integer | string;\n /** An optional property to describe the error code. */\n codeDescription?: CodeDescription;\n /** Additional metadata about the diagnostic. */\n tags?: DiagnosticTag[];\n /** An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property. */\n relatedInformation?: DiagnosticRelatedInformation[];\n /** A data entry field that is preserved between a `textDocument/publishDiagnostics` notification and `textDocument/codeAction` request. */\n data?: unknown;\n}\n\n/**\n * Shape of information commonly used in the `data` field of diagnostics.\n */\nexport interface DiagnosticData {\n /** Diagnostic code for identifying which code action to apply. This code is _not_ shown in the user interface. */\n code: string\n /** Specifies where to apply the code action in the form of a `DocumentSegment`. */\n actionSegment?: DocumentSegment\n /** Specifies where to apply the code action in the form of a `Range`. */\n actionRange?: Range\n}\n\n/**\n * Create DiagnosticData for a given diagnostic code. The result can be put into the `data` field of a DiagnosticInfo.\n */\nexport function diagnosticData(code: string): DiagnosticData {\n return { code };\n}\n\nexport type ValidationAcceptor = (severity: 'error' | 'warning' | 'info' | 'hint', message: string, info: DiagnosticInfo) => void\n\nexport type ValidationCheck = (node: T, accept: ValidationAcceptor, cancelToken: CancellationToken) => MaybePromise;\n\n/**\n * A utility type for associating non-primitive AST types to corresponding validation checks. For example:\n *\n * ```ts\n * const checks: ValidationChecks = {\n * State: validator.checkStateNameStartsWithCapital\n * };\n * ```\n *\n * If an AST type does not extend AstNode, e.g. if it describes a union of string literals, that type's name must not occur as a key in objects of type `ValidationCheck<...>`.\n *\n * @param T a type definition mapping language specific type names (keys) to the corresponding types (values)\n */\nexport type ValidationChecks = {\n [K in keyof T]?: T[K] extends AstNode ? ValidationCheck | Array> : never\n} & {\n AstNode?: ValidationCheck | Array>;\n}\n\n/**\n * `fast` checks can be executed after every document change (i.e. as the user is typing). If a check\n * is too slow it can delay the response to document changes, yielding bad user experience. By marking\n * it as `slow`, it will be skipped for normal as-you-type validation. Then it's up to you when to\n * schedule these long-running checks: after the fast checks are done, or after saving a document,\n * or with an explicit command, etc.\n *\n * `built-in` checks are errors produced by the lexer, the parser, or the linker. They cannot be used\n * for custom validation checks.\n */\nexport type ValidationCategory = 'fast' | 'slow' | 'built-in'\n\nexport namespace ValidationCategory {\n export const all: readonly ValidationCategory[] = ['fast', 'slow', 'built-in'];\n}\n\ntype ValidationCheckEntry = {\n check: ValidationCheck\n category: ValidationCategory\n}\n\n/**\n * Manages a set of `ValidationCheck`s to be applied when documents are validated.\n */\nexport class ValidationRegistry {\n private readonly entries = new MultiMap();\n private readonly reflection: AstReflection;\n\n constructor(services: LangiumCoreServices) {\n this.reflection = services.shared.AstReflection;\n }\n\n /**\n * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function)\n * or an array of validation checks.\n *\n * @param checksRecord Set of validation checks to register.\n * @param category Optional category for the validation checks (defaults to `'fast'`).\n * @param thisObj Optional object to be used as `this` when calling the validation check functions.\n */\n register(checksRecord: ValidationChecks, thisObj: ThisParameterType = this, category: ValidationCategory = 'fast'): void {\n if (category === 'built-in') {\n throw new Error(\"The 'built-in' category is reserved for lexer, parser, and linker errors.\");\n }\n for (const [type, ch] of Object.entries(checksRecord)) {\n const callbacks = ch as ValidationCheck | ValidationCheck[];\n if (Array.isArray(callbacks)) {\n for (const check of callbacks) {\n const entry: ValidationCheckEntry = {\n check: this.wrapValidationException(check, thisObj),\n category\n };\n this.addEntry(type, entry);\n }\n } else if (typeof callbacks === 'function') {\n const entry: ValidationCheckEntry = {\n check: this.wrapValidationException(callbacks, thisObj),\n category\n };\n this.addEntry(type, entry);\n }\n }\n }\n\n protected wrapValidationException(check: ValidationCheck, thisObj: unknown): ValidationCheck {\n return async (node, accept, cancelToken) => {\n try {\n await check.call(thisObj, node, accept, cancelToken);\n } catch (err) {\n if (isOperationCancelled(err)) {\n throw err;\n }\n console.error('An error occurred during validation:', err);\n const message = err instanceof Error ? err.message : String(err);\n if (err instanceof Error && err.stack) {\n console.error(err.stack);\n }\n accept('error', 'An error occurred during validation: ' + message, { node });\n }\n };\n }\n\n protected addEntry(type: string, entry: ValidationCheckEntry): void {\n if (type === 'AstNode') {\n this.entries.add('AstNode', entry);\n return;\n }\n for (const subtype of this.reflection.getAllSubTypes(type)) {\n this.entries.add(subtype, entry);\n }\n }\n\n getChecks(type: string, categories?: ValidationCategory[]): Stream {\n let checks = stream(this.entries.get(type))\n .concat(this.entries.get('AstNode'));\n if (categories) {\n checks = checks.filter(entry => categories.includes(entry.category));\n }\n return checks.map(entry => entry.check);\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { MismatchedTokenException } from 'chevrotain';\nimport type { DiagnosticSeverity, Position, Range, Diagnostic } from 'vscode-languageserver-types';\nimport type { LanguageMetaData } from '../languages/language-meta-data.js';\nimport type { ParseResult } from '../parser/langium-parser.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, CstNode } from '../syntax-tree.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport type { DiagnosticData, DiagnosticInfo, ValidationAcceptor, ValidationCategory, ValidationRegistry } from './validation-registry.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { findNodeForKeyword, findNodeForProperty } from '../utils/grammar-utils.js';\nimport { streamAst } from '../utils/ast-utils.js';\nimport { tokenToRange } from '../utils/cst-utils.js';\nimport { interruptAndCheck, isOperationCancelled } from '../utils/promise-utils.js';\nimport { diagnosticData } from './validation-registry.js';\n\nexport interface ValidationOptions {\n /**\n * If this is set, only the checks associated with these categories are executed; otherwise\n * all checks are executed. The default category if not specified to the registry is `'fast'`.\n */\n categories?: ValidationCategory[];\n /** If true, no further diagnostics are reported if there are lexing errors. */\n stopAfterLexingErrors?: boolean\n /** If true, no further diagnostics are reported if there are parsing errors. */\n stopAfterParsingErrors?: boolean\n /** If true, no further diagnostics are reported if there are linking errors. */\n stopAfterLinkingErrors?: boolean\n}\n\n/**\n * Language-specific service for validating `LangiumDocument`s.\n */\nexport interface DocumentValidator {\n /**\n * Validates the whole specified document.\n *\n * @param document specified document to validate\n * @param options options to control the validation process\n * @param cancelToken allows to cancel the current operation\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n validateDocument(document: LangiumDocument, options?: ValidationOptions, cancelToken?: CancellationToken): Promise;\n}\n\nexport class DefaultDocumentValidator implements DocumentValidator {\n\n protected readonly validationRegistry: ValidationRegistry;\n protected readonly metadata: LanguageMetaData;\n\n constructor(services: LangiumCoreServices) {\n this.validationRegistry = services.validation.ValidationRegistry;\n this.metadata = services.LanguageMetaData;\n }\n\n async validateDocument(document: LangiumDocument, options: ValidationOptions = {}, cancelToken = CancellationToken.None): Promise {\n const parseResult = document.parseResult;\n const diagnostics: Diagnostic[] = [];\n\n await interruptAndCheck(cancelToken);\n\n if (!options.categories || options.categories.includes('built-in')) {\n this.processLexingErrors(parseResult, diagnostics, options);\n if (options.stopAfterLexingErrors && diagnostics.some(d => d.data?.code === DocumentValidator.LexingError)) {\n return diagnostics;\n }\n\n this.processParsingErrors(parseResult, diagnostics, options);\n if (options.stopAfterParsingErrors && diagnostics.some(d => d.data?.code === DocumentValidator.ParsingError)) {\n return diagnostics;\n }\n\n this.processLinkingErrors(document, diagnostics, options);\n if (options.stopAfterLinkingErrors && diagnostics.some(d => d.data?.code === DocumentValidator.LinkingError)) {\n return diagnostics;\n }\n }\n\n // Process custom validations\n try {\n diagnostics.push(...await this.validateAst(parseResult.value, options, cancelToken));\n } catch (err) {\n if (isOperationCancelled(err)) {\n throw err;\n }\n console.error('An error occurred during validation:', err);\n }\n\n await interruptAndCheck(cancelToken);\n\n return diagnostics;\n }\n\n protected processLexingErrors(parseResult: ParseResult, diagnostics: Diagnostic[], _options: ValidationOptions): void {\n for (const lexerError of parseResult.lexerErrors) {\n const diagnostic: Diagnostic = {\n severity: toDiagnosticSeverity('error'),\n range: {\n start: {\n line: lexerError.line! - 1,\n character: lexerError.column! - 1\n },\n end: {\n line: lexerError.line! - 1,\n character: lexerError.column! + lexerError.length - 1\n }\n },\n message: lexerError.message,\n data: diagnosticData(DocumentValidator.LexingError),\n source: this.getSource()\n };\n diagnostics.push(diagnostic);\n }\n }\n\n protected processParsingErrors(parseResult: ParseResult, diagnostics: Diagnostic[], _options: ValidationOptions): void {\n for (const parserError of parseResult.parserErrors) {\n let range: Range | undefined = undefined;\n // We can run into the chevrotain error recovery here\n // The token contained in the parser error might be automatically inserted\n // In this case every position value will be `NaN`\n if (isNaN(parserError.token.startOffset)) {\n // Some special parser error types contain a `previousToken`\n // We can simply append our diagnostic to that token\n if ('previousToken' in parserError) {\n const token = (parserError as MismatchedTokenException).previousToken;\n if (!isNaN(token.startOffset)) {\n const position: Position = { line: token.endLine! - 1, character: token.endColumn! };\n range = { start: position, end: position};\n } else {\n // No valid prev token. Might be empty document or containing only hidden tokens.\n // Point to document start\n const position: Position = { line: 0, character: 0 };\n range = { start: position, end: position};\n }\n }\n } else {\n range = tokenToRange(parserError.token);\n }\n if (range) {\n const diagnostic: Diagnostic = {\n severity: toDiagnosticSeverity('error'),\n range,\n message: parserError.message,\n data: diagnosticData(DocumentValidator.ParsingError),\n source: this.getSource()\n };\n diagnostics.push(diagnostic);\n }\n }\n }\n\n protected processLinkingErrors(document: LangiumDocument, diagnostics: Diagnostic[], _options: ValidationOptions): void {\n for (const reference of document.references) {\n const linkingError = reference.error;\n if (linkingError) {\n const info: DiagnosticInfo = {\n node: linkingError.container,\n property: linkingError.property,\n index: linkingError.index,\n data: {\n code: DocumentValidator.LinkingError,\n containerType: linkingError.container.$type,\n property: linkingError.property,\n refText: linkingError.reference.$refText\n } satisfies LinkingErrorData\n };\n diagnostics.push(this.toDiagnostic('error', linkingError.message, info));\n }\n }\n }\n\n protected async validateAst(rootNode: AstNode, options: ValidationOptions, cancelToken = CancellationToken.None): Promise {\n const validationItems: Diagnostic[] = [];\n const acceptor: ValidationAcceptor = (severity: 'error' | 'warning' | 'info' | 'hint', message: string, info: DiagnosticInfo) => {\n validationItems.push(this.toDiagnostic(severity, message, info));\n };\n\n await Promise.all(streamAst(rootNode).map(async node => {\n await interruptAndCheck(cancelToken);\n const checks = this.validationRegistry.getChecks(node.$type, options.categories);\n for (const check of checks) {\n await check(node, acceptor, cancelToken);\n }\n }));\n return validationItems;\n }\n\n protected toDiagnostic(severity: 'error' | 'warning' | 'info' | 'hint', message: string, info: DiagnosticInfo): Diagnostic {\n return {\n message,\n range: getDiagnosticRange(info),\n severity: toDiagnosticSeverity(severity),\n code: info.code,\n codeDescription: info.codeDescription,\n tags: info.tags,\n relatedInformation: info.relatedInformation,\n data: info.data,\n source: this.getSource()\n };\n }\n\n protected getSource(): string | undefined {\n return this.metadata.languageId;\n }\n}\n\nexport function getDiagnosticRange(info: DiagnosticInfo): Range {\n if (info.range) {\n return info.range;\n }\n let cstNode: CstNode | undefined;\n if (typeof info.property === 'string') {\n cstNode = findNodeForProperty(info.node.$cstNode, info.property, info.index);\n } else if (typeof info.keyword === 'string') {\n cstNode = findNodeForKeyword(info.node.$cstNode, info.keyword, info.index);\n }\n cstNode ??= info.node.$cstNode;\n if (!cstNode) {\n return {\n start: { line: 0, character: 0 },\n end: { line: 0, character: 0 }\n };\n }\n return cstNode.range;\n}\n\nexport function toDiagnosticSeverity(severity: 'error' | 'warning' | 'info' | 'hint'): DiagnosticSeverity {\n switch (severity) {\n case 'error':\n return 1; // according to vscode-languageserver-types/lib/esm/main.js#DiagnosticSeverity.Error\n case 'warning':\n return 2; // according to vscode-languageserver-types/lib/esm/main.js#DiagnosticSeverity.Warning\n case 'info':\n return 3; // according to vscode-languageserver-types/lib/esm/main.js#DiagnosticSeverity.Information\n case 'hint':\n return 4; // according to vscode-languageserver-types/lib/esm/main.js#DiagnosticSeverity.Hint\n default:\n throw new Error('Invalid diagnostic severity: ' + severity);\n }\n}\n\nexport namespace DocumentValidator {\n export const LexingError = 'lexing-error';\n export const ParsingError = 'parsing-error';\n export const LinkingError = 'linking-error';\n}\n\nexport interface LinkingErrorData extends DiagnosticData {\n containerType: string\n property: string\n refText: string\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { URI } from '../utils/uri-utils.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription, ReferenceInfo } from '../syntax-tree.js';\nimport type { AstNodeLocator } from './ast-node-locator.js';\nimport type { DocumentSegment, LangiumDocument } from './documents.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { isLinkingError } from '../syntax-tree.js';\nimport { getDocument, streamAst, streamReferences } from '../utils/ast-utils.js';\nimport { toDocumentSegment } from '../utils/cst-utils.js';\nimport { interruptAndCheck } from '../utils/promise-utils.js';\nimport { UriUtils } from '../utils/uri-utils.js';\n\n/**\n * Language-specific service for creating descriptions of AST nodes to be used for cross-reference resolutions.\n */\nexport interface AstNodeDescriptionProvider {\n\n /**\n * Create a description for the given AST node. This service method is typically used while indexing\n * the contents of a document and during scope computation.\n *\n * @param node An AST node.\n * @param name The name to be used to refer to the AST node. By default, this is determined by the\n * `NameProvider` service, but alternative names may be provided according to the semantics\n * of your language.\n * @param document The document containing the AST node. If omitted, it is taken from the root AST node.\n */\n createDescription(node: AstNode, name: string | undefined, document?: LangiumDocument): AstNodeDescription;\n\n}\n\nexport class DefaultAstNodeDescriptionProvider implements AstNodeDescriptionProvider {\n\n protected readonly astNodeLocator: AstNodeLocator;\n protected readonly nameProvider: NameProvider;\n\n constructor(services: LangiumCoreServices) {\n this.astNodeLocator = services.workspace.AstNodeLocator;\n this.nameProvider = services.references.NameProvider;\n }\n\n createDescription(node: AstNode, name: string | undefined, document: LangiumDocument = getDocument(node)): AstNodeDescription {\n name ??= this.nameProvider.getName(node);\n const path = this.astNodeLocator.getAstNodePath(node);\n if (!name) {\n throw new Error(`Node at path ${path} has no name.`);\n }\n let nameNodeSegment: DocumentSegment | undefined;\n const nameSegmentGetter = () => nameNodeSegment ??= toDocumentSegment(this.nameProvider.getNameNode(node) ?? node.$cstNode);\n return {\n node,\n name,\n get nameSegment() {\n return nameSegmentGetter();\n },\n selectionSegment: toDocumentSegment(node.$cstNode),\n type: node.$type,\n documentUri: document.uri,\n path\n };\n }\n\n}\n\n/**\n * Describes a cross-reference within a document or between two documents.\n */\nexport interface ReferenceDescription {\n /** URI of the document that holds a reference */\n sourceUri: URI\n /** Path to AstNode that holds a reference */\n sourcePath: string\n /** Target document uri */\n targetUri: URI\n /** Path to the target AstNode inside the document */\n targetPath: string\n /** Segment of the reference text. */\n segment: DocumentSegment\n /** Marks a local reference i.e. a cross reference inside a document. */\n local?: boolean\n}\n\n/**\n * Language-specific service to create descriptions of all cross-references in a document. These are used by the `IndexManager`\n * to determine which documents are affected and should be rebuilt when a document is changed.\n */\nexport interface ReferenceDescriptionProvider {\n /**\n * Create descriptions of all cross-references found in the given document. These descriptions are\n * gathered by the `IndexManager` and stored in the global index so they can be considered when\n * a document change is reported by the client.\n *\n * @param document The document in which to gather cross-references.\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n createDescriptions(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n}\n\nexport class DefaultReferenceDescriptionProvider implements ReferenceDescriptionProvider {\n\n protected readonly nodeLocator: AstNodeLocator;\n\n constructor(services: LangiumCoreServices) {\n this.nodeLocator = services.workspace.AstNodeLocator;\n }\n\n async createDescriptions(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n const descr: ReferenceDescription[] = [];\n const rootNode = document.parseResult.value;\n for (const astNode of streamAst(rootNode)) {\n await interruptAndCheck(cancelToken);\n streamReferences(astNode).filter(refInfo => !isLinkingError(refInfo)).forEach(refInfo => {\n // TODO: Consider logging a warning or throw an exception when DocumentState is < than Linked\n const description = this.createDescription(refInfo);\n if (description) {\n descr.push(description);\n }\n });\n }\n return descr;\n }\n\n protected createDescription(refInfo: ReferenceInfo): ReferenceDescription | undefined {\n const targetNodeDescr = refInfo.reference.$nodeDescription;\n const refCstNode = refInfo.reference.$refNode;\n if (!targetNodeDescr || !refCstNode) {\n return undefined;\n }\n const docUri = getDocument(refInfo.container).uri;\n return {\n sourceUri: docUri,\n sourcePath: this.nodeLocator.getAstNodePath(refInfo.container),\n targetUri: targetNodeDescr.documentUri,\n targetPath: targetNodeDescr.path,\n segment: toDocumentSegment(refCstNode),\n local: UriUtils.equals(targetNodeDescr.documentUri, docUri)\n };\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { AstNode } from '../syntax-tree.js';\n\n/**\n * Language-specific service for locating an `AstNode` in a document.\n */\nexport interface AstNodeLocator {\n\n /**\n * Creates a path represented by a `string` that identifies an `AstNode` inside its document.\n * It must be possible to retrieve exactly the same `AstNode` from the document using this path.\n *\n * @param node The `AstNode` for which to create the path.\n * @returns a path represented by a `string` that identifies `node` inside its document.\n * @see AstNodeLocator.getAstNode\n */\n getAstNodePath(node: AstNode): string;\n\n /**\n * Locates an `AstNode` inside another node by following the given path.\n *\n * @param node Parent element.\n * @param path Describes how to locate the `AstNode` inside the given `node`.\n * @returns The `AstNode` located under the given path, or `undefined` if the path cannot be resolved.\n * @see AstNodeLocator.getAstNodePath\n */\n getAstNode(node: AstNode, path: string): T | undefined;\n\n}\n\nexport class DefaultAstNodeLocator implements AstNodeLocator {\n protected segmentSeparator = '/';\n protected indexSeparator = '@';\n\n getAstNodePath(node: AstNode): string {\n if (node.$container) {\n const containerPath = this.getAstNodePath(node.$container);\n const newSegment = this.getPathSegment(node);\n const nodePath = containerPath + this.segmentSeparator + newSegment;\n return nodePath;\n }\n return '';\n }\n\n protected getPathSegment({ $containerProperty, $containerIndex }: AstNode): string {\n if (!$containerProperty) {\n throw new Error(\"Missing '$containerProperty' in AST node.\");\n }\n if ($containerIndex !== undefined) {\n return $containerProperty + this.indexSeparator + $containerIndex;\n }\n return $containerProperty;\n }\n\n getAstNode(node: AstNode, path: string): T | undefined {\n const segments = path.split(this.segmentSeparator);\n return segments.reduce((previousValue, currentValue) => {\n if (!previousValue || currentValue.length === 0) {\n return previousValue;\n }\n const propertyIndex = currentValue.indexOf(this.indexSeparator);\n if (propertyIndex > 0) {\n const property = currentValue.substring(0, propertyIndex);\n const arrayIndex = parseInt(currentValue.substring(propertyIndex + 1));\n const array = (previousValue as unknown as Record)[property];\n return array?.[arrayIndex];\n }\n return (previousValue as unknown as Record)[currentValue];\n }, node) as T;\n }\n\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { ConfigurationItem, DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions, InitializeParams, InitializedParams } from 'vscode-languageserver-protocol';\nimport type { ServiceRegistry } from '../service-registry.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\nimport { Deferred } from '../utils/promise-utils.js';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport interface ConfigurationProvider {\n\n /**\n * A promise that resolves when the configuration provider is ready to be used.\n */\n readonly ready: Promise;\n\n /**\n * When used in a language server context, this method is called when the server receives\n * the `initialize` request.\n */\n initialize(params: InitializeParams): void;\n\n /**\n * When used in a language server context, this method is called when the server receives\n * the `initialized` notification.\n */\n initialized(params: ConfigurationInitializedParams): Promise;\n\n /**\n * Returns a configuration value stored for the given language.\n *\n * @param language The language id\n * @param configuration Configuration name\n */\n getConfiguration(language: string, configuration: string): Promise;\n\n /**\n * Updates the cached configurations using the `change` notification parameters.\n *\n * @param change The parameters of a change configuration notification.\n * `settings` property of the change object could be expressed as `Record>`\n */\n updateConfiguration(change: DidChangeConfigurationParams): void;\n}\n\nexport interface ConfigurationInitializedParams extends InitializedParams {\n register?: (params: DidChangeConfigurationRegistrationOptions) => void,\n fetchConfiguration?: (configuration: ConfigurationItem[]) => Promise\n}\n\n/**\n * Base configuration provider for building up other configuration providers\n */\nexport class DefaultConfigurationProvider implements ConfigurationProvider {\n\n protected readonly serviceRegistry: ServiceRegistry;\n protected readonly _ready = new Deferred();\n protected settings: Record> = {};\n protected workspaceConfig = false;\n\n constructor(services: LangiumSharedCoreServices) {\n this.serviceRegistry = services.ServiceRegistry;\n }\n\n get ready(): Promise {\n return this._ready.promise;\n }\n\n initialize(params: InitializeParams): void {\n this.workspaceConfig = params.capabilities.workspace?.configuration ?? false;\n }\n\n async initialized(params: ConfigurationInitializedParams): Promise {\n if (this.workspaceConfig) {\n if (params.register) {\n // params.register(...) is a function to be provided by the calling language server for the sake of\n // decoupling this implementation from the concrete LSP implementations, specifically the LSP Connection\n\n const languages = this.serviceRegistry.all;\n params.register({\n // Listen to configuration changes for all languages\n section: languages.map(lang => this.toSectionName(lang.LanguageMetaData.languageId))\n });\n }\n\n if (params.fetchConfiguration) {\n // params.fetchConfiguration(...) is a function to be provided by the calling language server for the sake of\n // decoupling this implementation from the concrete LSP implementations, specifically the LSP Connection\n const configToUpdate = this.serviceRegistry.all.map(lang => {\n // Fetch the configuration changes for all languages\n section: this.toSectionName(lang.LanguageMetaData.languageId)\n });\n\n // get workspace configurations (default scope URI)\n const configs = await params.fetchConfiguration(configToUpdate);\n configToUpdate.forEach((conf, idx) => {\n this.updateSectionConfiguration(conf.section!, configs[idx]);\n });\n }\n }\n this._ready.resolve();\n }\n\n /**\n * Updates the cached configurations using the `change` notification parameters.\n *\n * @param change The parameters of a change configuration notification.\n * `settings` property of the change object could be expressed as `Record>`\n */\n updateConfiguration(change: DidChangeConfigurationParams): void {\n if (!change.settings) {\n return;\n }\n Object.keys(change.settings).forEach(section => {\n this.updateSectionConfiguration(section, change.settings[section]);\n });\n }\n\n protected updateSectionConfiguration(section: string, configuration: any): void {\n this.settings[section] = configuration;\n }\n\n /**\n * Returns a configuration value stored for the given language.\n *\n * @param language The language id\n * @param configuration Configuration name\n */\n async getConfiguration(language: string, configuration: string): Promise {\n await this.ready;\n\n const sectionName = this.toSectionName(language);\n if (this.settings[sectionName]) {\n return this.settings[sectionName][configuration];\n }\n }\n\n protected toSectionName(languageId: string): string {\n return `${languageId}`;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nexport interface Disposable {\n /**\n * Dispose this object.\n */\n dispose(): void;\n}\n\nexport interface AsyncDisposable {\n /**\n * Dispose this object.\n */\n dispose(): Promise;\n}\n\nexport namespace Disposable {\n export function create(callback: () => Promise): AsyncDisposable;\n export function create(callback: () => void): Disposable;\n export function create(callback: () => void | Promise): Disposable | AsyncDisposable {\n return {\n dispose: async () => await callback()\n };\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { Disposable } from '../utils/disposable.js';\nimport type { ServiceRegistry } from '../service-registry.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { Deferred } from '../utils/promise-utils.js';\nimport type { ValidationOptions } from '../validation/document-validator.js';\nimport type { IndexManager } from '../workspace/index-manager.js';\nimport type { LangiumDocument, LangiumDocuments, LangiumDocumentFactory } from './documents.js';\nimport { MultiMap } from '../utils/collections.js';\nimport { OperationCancelled, interruptAndCheck } from '../utils/promise-utils.js';\nimport { stream } from '../utils/stream.js';\nimport type { URI } from '../utils/uri-utils.js';\nimport { ValidationCategory } from '../validation/validation-registry.js';\nimport { DocumentState } from './documents.js';\n\nexport interface BuildOptions {\n /**\n * Control the validation phase with this option:\n * - `true` enables all validation checks and forces revalidating the documents\n * - `false` or `undefined` disables all validation checks\n * - An object runs only the necessary validation checks; the `categories` property restricts this to a specific subset\n */\n validation?: boolean | ValidationOptions\n}\n\nexport interface DocumentBuildState {\n /** Whether a document has completed its last build process. */\n completed: boolean\n /** The options used for the last build process. */\n options: BuildOptions\n /** Additional information about the last build result. */\n result?: {\n validationChecks?: ValidationCategory[]\n }\n}\n\n/**\n * Shared-service for building and updating `LangiumDocument`s.\n */\nexport interface DocumentBuilder {\n\n /** The options used for rebuilding documents after an update. */\n updateBuildOptions: BuildOptions;\n\n /**\n * Execute all necessary build steps for the given documents.\n *\n * @param documents Set of documents to be built.\n * @param options Options for the document builder.\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n build(documents: Array>, options?: BuildOptions, cancelToken?: CancellationToken): Promise;\n\n /**\n * This method is called when a document change is detected. It updates the state of all\n * affected documents, including those with references to the changed ones, so they are rebuilt.\n *\n * @param changed URIs of changed or created documents\n * @param deleted URIs of deleted documents\n * @param cancelToken allows to cancel the current operation\n * @throws `OperationCancelled` if cancellation is detected during execution\n */\n update(changed: URI[], deleted: URI[], cancelToken?: CancellationToken): Promise;\n\n /**\n * Notify the given callback when a document update was triggered, but before any document\n * is rebuilt. Listeners to this event should not perform any long-running task.\n */\n onUpdate(callback: DocumentUpdateListener): Disposable;\n\n /**\n * Notify the given callback when a set of documents has been built reaching a desired target state.\n */\n onBuildPhase(targetState: DocumentState, callback: DocumentBuildListener): Disposable;\n\n /**\n * Wait until the workspace has reached the specified state for all documents.\n *\n * @param state The desired state. The promise won't resolve until all documents have reached this state\n * @param cancelToken Optionally allows to cancel the wait operation, disposing any listeners in the process\n * @throws `OperationCancelled` if cancellation has been requested before the state has been reached\n */\n waitUntil(state: DocumentState, cancelToken?: CancellationToken): Promise;\n\n /**\n * Wait until the document specified by the {@link uri} has reached the specified state.\n *\n * @param state The desired state. The promise won't resolve until the document has reached this state.\n * @param uri The specified URI that points to the document. If the URI does not exist, the promise will resolve once the workspace has reached the specified state.\n * @param cancelToken Optionally allows to cancel the wait operation, disposing any listeners in the process.\n * @return The URI of the document that has reached the desired state, or `undefined` if the document does not exist.\n * @throws `OperationCancelled` if cancellation has been requested before the state has been reached\n */\n waitUntil(state: DocumentState, uri?: URI, cancelToken?: CancellationToken): Promise;\n}\n\nexport type DocumentUpdateListener = (changed: URI[], deleted: URI[]) => void | Promise\nexport type DocumentBuildListener = (built: LangiumDocument[], cancelToken: CancellationToken) => void | Promise\nexport class DefaultDocumentBuilder implements DocumentBuilder {\n\n updateBuildOptions: BuildOptions = {\n // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category)\n validation: {\n categories: ['built-in', 'fast']\n }\n };\n\n protected readonly langiumDocuments: LangiumDocuments;\n protected readonly langiumDocumentFactory: LangiumDocumentFactory;\n protected readonly indexManager: IndexManager;\n protected readonly serviceRegistry: ServiceRegistry;\n protected readonly updateListeners: DocumentUpdateListener[] = [];\n protected readonly buildPhaseListeners = new MultiMap();\n protected readonly buildState = new Map();\n protected readonly documentBuildWaiters = new Map>();\n protected currentState = DocumentState.Changed;\n\n constructor(services: LangiumSharedCoreServices) {\n this.langiumDocuments = services.workspace.LangiumDocuments;\n this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;\n this.indexManager = services.workspace.IndexManager;\n this.serviceRegistry = services.ServiceRegistry;\n }\n\n async build(documents: Array>, options: BuildOptions = {}, cancelToken = CancellationToken.None): Promise {\n for (const document of documents) {\n const key = document.uri.toString();\n if (document.state === DocumentState.Validated) {\n if (typeof options.validation === 'boolean' && options.validation) {\n // Force re-running all validation checks\n document.state = DocumentState.IndexedReferences;\n document.diagnostics = undefined;\n this.buildState.delete(key);\n } else if (typeof options.validation === 'object') {\n const buildState = this.buildState.get(key);\n const previousCategories = buildState?.result?.validationChecks;\n if (previousCategories) {\n // Validation with explicit options was requested for a document that has already been partly validated.\n // In this case, we need to merge the previous validation categories with the new ones.\n const newCategories = options.validation.categories ?? ValidationCategory.all as ValidationCategory[];\n const categories = newCategories.filter(c => !previousCategories.includes(c));\n if (categories.length > 0) {\n this.buildState.set(key, {\n completed: false,\n options: {\n validation: {\n ...options.validation,\n categories\n }\n },\n result: buildState.result\n });\n document.state = DocumentState.IndexedReferences;\n }\n }\n }\n } else {\n // Default: forget any previous build options\n this.buildState.delete(key);\n }\n }\n this.currentState = DocumentState.Changed;\n await this.emitUpdate(documents.map(e => e.uri), []);\n await this.buildDocuments(documents, options, cancelToken);\n }\n\n async update(changed: URI[], deleted: URI[], cancelToken = CancellationToken.None): Promise {\n this.currentState = DocumentState.Changed;\n // Remove all metadata of documents that are reported as deleted\n for (const deletedUri of deleted) {\n this.langiumDocuments.deleteDocument(deletedUri);\n this.buildState.delete(deletedUri.toString());\n this.indexManager.remove(deletedUri);\n }\n // Set the state of all changed documents to `Changed` so they are completely rebuilt\n for (const changedUri of changed) {\n const invalidated = this.langiumDocuments.invalidateDocument(changedUri);\n if (!invalidated) {\n // We create an unparsed, invalid document.\n // This will be parsed as soon as we reach the first document builder phase.\n // This allows to cancel the parsing process later in case we need it.\n const newDocument = this.langiumDocumentFactory.fromModel({ $type: 'INVALID' }, changedUri);\n newDocument.state = DocumentState.Changed;\n this.langiumDocuments.addDocument(newDocument);\n }\n this.buildState.delete(changedUri.toString());\n }\n // Set the state of all documents that should be relinked to `ComputedScopes` (if not already lower)\n const allChangedUris = stream(changed).concat(deleted).map(uri => uri.toString()).toSet();\n this.langiumDocuments.all\n .filter(doc => !allChangedUris.has(doc.uri.toString()) && this.shouldRelink(doc, allChangedUris))\n .forEach(doc => {\n const linker = this.serviceRegistry.getServices(doc.uri).references.Linker;\n linker.unlink(doc);\n doc.state = Math.min(doc.state, DocumentState.ComputedScopes);\n doc.diagnostics = undefined;\n });\n // Notify listeners of the update\n await this.emitUpdate(changed, deleted);\n // Only allow interrupting the execution after all state changes are done\n await interruptAndCheck(cancelToken);\n\n // Collect all documents that we should rebuild\n const rebuildDocuments = this.langiumDocuments.all\n .filter(doc =>\n // This includes those that were reported as changed and those that we selected for relinking\n doc.state < DocumentState.Linked\n // This includes those for which a previous build has been cancelled\n || !this.buildState.get(doc.uri.toString())?.completed\n )\n .toArray();\n await this.buildDocuments(rebuildDocuments, this.updateBuildOptions, cancelToken);\n }\n\n protected async emitUpdate(changed: URI[], deleted: URI[]): Promise {\n await Promise.all(this.updateListeners.map(listener => listener(changed, deleted)));\n }\n\n /**\n * Check whether the given document should be relinked after changes were found in the given URIs.\n */\n protected shouldRelink(document: LangiumDocument, changedUris: Set): boolean {\n // Relink documents with linking errors -- maybe those references can be resolved now\n if (document.references.some(ref => ref.error !== undefined)) {\n return true;\n }\n // Check whether the document is affected by any of the changed URIs\n return this.indexManager.isAffected(document, changedUris);\n }\n\n onUpdate(callback: DocumentUpdateListener): Disposable {\n this.updateListeners.push(callback);\n return Disposable.create(() => {\n const index = this.updateListeners.indexOf(callback);\n if (index >= 0) {\n this.updateListeners.splice(index, 1);\n }\n });\n }\n\n /**\n * Build the given documents by stepping through all build phases. If a document's state indicates\n * that a certain build phase is already done, the phase is skipped for that document.\n */\n protected async buildDocuments(documents: LangiumDocument[], options: BuildOptions, cancelToken: CancellationToken): Promise {\n this.prepareBuild(documents, options);\n // 0. Parse content\n await this.runCancelable(documents, DocumentState.Parsed, cancelToken, doc =>\n this.langiumDocumentFactory.update(doc, cancelToken)\n );\n // 1. Index content\n await this.runCancelable(documents, DocumentState.IndexedContent, cancelToken, doc =>\n this.indexManager.updateContent(doc, cancelToken)\n );\n // 2. Compute scopes\n await this.runCancelable(documents, DocumentState.ComputedScopes, cancelToken, async doc => {\n const scopeComputation = this.serviceRegistry.getServices(doc.uri).references.ScopeComputation;\n doc.precomputedScopes = await scopeComputation.computeLocalScopes(doc, cancelToken);\n });\n // 3. Linking\n await this.runCancelable(documents, DocumentState.Linked, cancelToken, doc => {\n const linker = this.serviceRegistry.getServices(doc.uri).references.Linker;\n return linker.link(doc, cancelToken);\n });\n // 4. Index references\n await this.runCancelable(documents, DocumentState.IndexedReferences, cancelToken, doc =>\n this.indexManager.updateReferences(doc, cancelToken)\n );\n // 5. Validation\n const toBeValidated = documents.filter(doc => this.shouldValidate(doc));\n await this.runCancelable(toBeValidated, DocumentState.Validated, cancelToken, doc =>\n this.validate(doc, cancelToken)\n );\n\n // If we've made it to this point without being cancelled, we can mark the build state as completed.\n for (const doc of documents) {\n const state = this.buildState.get(doc.uri.toString());\n if (state) {\n state.completed = true;\n }\n }\n }\n\n protected prepareBuild(documents: LangiumDocument[], options: BuildOptions): void {\n for (const doc of documents) {\n const key = doc.uri.toString();\n const state = this.buildState.get(key);\n // If the document has no previous build state, we set it. If it has one, but it's already marked\n // as completed, we overwrite it. If the previous build was not completed, we keep its state\n // and continue where it was cancelled.\n if (!state || state.completed) {\n this.buildState.set(key, {\n completed: false,\n options,\n result: state?.result\n });\n }\n }\n }\n\n protected async runCancelable(documents: LangiumDocument[], targetState: DocumentState, cancelToken: CancellationToken,\n callback: (document: LangiumDocument) => MaybePromise): Promise {\n const filtered = documents.filter(e => e.state < targetState);\n for (const document of filtered) {\n await interruptAndCheck(cancelToken);\n await callback(document);\n document.state = targetState;\n }\n await this.notifyBuildPhase(filtered, targetState, cancelToken);\n this.currentState = targetState;\n }\n\n onBuildPhase(targetState: DocumentState, callback: DocumentBuildListener): Disposable {\n this.buildPhaseListeners.add(targetState, callback);\n return Disposable.create(() => {\n this.buildPhaseListeners.delete(targetState, callback);\n });\n }\n\n waitUntil(state: DocumentState, cancelToken?: CancellationToken): Promise;\n waitUntil(state: DocumentState, uri?: URI, cancelToken?: CancellationToken): Promise;\n waitUntil(state: DocumentState, uriOrToken?: URI | CancellationToken, cancelToken?: CancellationToken): Promise {\n let uri: URI | undefined = undefined;\n if (uriOrToken && 'path' in uriOrToken) {\n uri = uriOrToken;\n } else {\n cancelToken = uriOrToken;\n }\n cancelToken ??= CancellationToken.None;\n if (uri) {\n const document = this.langiumDocuments.getDocument(uri);\n if (document && document.state > state) {\n return Promise.resolve(uri);\n }\n }\n if (this.currentState >= state) {\n return Promise.resolve(undefined);\n } else if (cancelToken.isCancellationRequested) {\n return Promise.reject(OperationCancelled);\n }\n return new Promise((resolve, reject) => {\n const buildDisposable = this.onBuildPhase(state, () => {\n buildDisposable.dispose();\n cancelDisposable.dispose();\n if (uri) {\n const document = this.langiumDocuments.getDocument(uri);\n resolve(document?.uri);\n } else {\n resolve(undefined);\n }\n });\n const cancelDisposable = cancelToken!.onCancellationRequested(() => {\n buildDisposable.dispose();\n cancelDisposable.dispose();\n reject(OperationCancelled);\n });\n });\n }\n\n protected async notifyBuildPhase(documents: LangiumDocument[], state: DocumentState, cancelToken: CancellationToken): Promise {\n if (documents.length === 0) {\n // Don't notify when no document has been processed\n return;\n }\n const listeners = this.buildPhaseListeners.get(state);\n for (const listener of listeners) {\n await interruptAndCheck(cancelToken);\n await listener(documents, cancelToken);\n }\n }\n\n /**\n * Determine whether the given document should be validated during a build. The default\n * implementation checks the `validation` property of the build options. If it's set to `true`\n * or a `ValidationOptions` object, the document is included in the validation phase.\n */\n protected shouldValidate(document: LangiumDocument): boolean {\n return Boolean(this.getBuildOptions(document).validation);\n }\n\n /**\n * Run validation checks on the given document and store the resulting diagnostics in the document.\n * If the document already contains diagnostics, the new ones are added to the list.\n */\n protected async validate(document: LangiumDocument, cancelToken: CancellationToken): Promise {\n const validator = this.serviceRegistry.getServices(document.uri).validation.DocumentValidator;\n const validationSetting = this.getBuildOptions(document).validation;\n const options = typeof validationSetting === 'object' ? validationSetting : undefined;\n const diagnostics = await validator.validateDocument(document, options, cancelToken);\n if (document.diagnostics) {\n document.diagnostics.push(...diagnostics);\n } else {\n document.diagnostics = diagnostics;\n }\n\n // Store information about the executed validation in the build state\n const state = this.buildState.get(document.uri.toString());\n if (state) {\n state.result ??= {};\n const newCategories = options?.categories ?? ValidationCategory.all;\n if (state.result.validationChecks) {\n state.result.validationChecks.push(...newCategories);\n } else {\n state.result.validationChecks = [...newCategories];\n }\n }\n }\n\n protected getBuildOptions(document: LangiumDocument): BuildOptions {\n return this.buildState.get(document.uri.toString())?.options ?? {};\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { ServiceRegistry } from '../service-registry.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription, AstReflection } from '../syntax-tree.js';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { ContextCache } from '../utils/caching.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport type { Stream } from '../utils/stream.js';\nimport { stream } from '../utils/stream.js';\nimport type { URI } from '../utils/uri-utils.js';\nimport { UriUtils } from '../utils/uri-utils.js';\nimport type { ReferenceDescription } from './ast-descriptions.js';\nimport type { LangiumDocument, LangiumDocuments } from './documents.js';\n\n/**\n * The index manager is responsible for keeping metadata about symbols and cross-references\n * in the workspace. It is used to look up symbols in the global scope, mostly during linking\n * and completion. This service is shared between all languages of a language server.\n */\nexport interface IndexManager {\n\n /**\n * Removes the specified document URI from the index.\n * Necessary when documents are deleted and not referenceable anymore.\n *\n * @param uri The URI of the document for which index data shall be removed\n */\n remove(uri: URI): void;\n\n /**\n * Updates the information about the exportable content of a document inside the index.\n *\n * @param document Document to be updated\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n updateContent(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n\n /**\n * Updates the information about the cross-references of a document inside the index.\n *\n * @param document Document to be updated\n * @param cancelToken Indicates when to cancel the current operation.\n * @throws `OperationCanceled` if a user action occurs during execution\n */\n updateReferences(document: LangiumDocument, cancelToken?: CancellationToken): Promise;\n\n /**\n * Determine whether the given document could be affected by changes of the documents\n * identified by the given URIs (second parameter). The document is typically regarded as\n * affected if it contains a reference to any of the changed files.\n *\n * @param document Document to check whether it's affected\n * @param changedUris URIs of the changed documents\n */\n isAffected(document: LangiumDocument, changedUris: Set): boolean;\n\n /**\n * Compute a list of all exported elements, optionally filtered using a type identifier and document URIs.\n *\n * @param nodeType The type to filter with, or `undefined` to return descriptions of all types.\n * @param uris If specified, only returns elements from the given URIs.\n * @returns a `Stream` containing all globally visible nodes (of a given type).\n */\n allElements(nodeType?: string, uris?: Set): Stream;\n\n /**\n * Returns all known references that are pointing to the given `targetNode`.\n *\n * @param targetNode the `AstNode` to look up references for\n * @param astNodePath the path that points to the `targetNode` inside the document. See also `AstNodeLocator`\n *\n * @returns a `Stream` of references that are targeting the `targetNode`\n */\n findAllReferences(targetNode: AstNode, astNodePath: string): Stream;\n\n}\n\nexport class DefaultIndexManager implements IndexManager {\n\n protected readonly serviceRegistry: ServiceRegistry;\n protected readonly documents: LangiumDocuments;\n protected readonly astReflection: AstReflection;\n\n /**\n * The symbol index stores all `AstNodeDescription` items exported by a document.\n * The key used in this map is the string representation of the specific document URI.\n */\n protected readonly symbolIndex = new Map();\n /**\n * This is a cache for the `allElements()` method.\n * It caches the descriptions from `symbolIndex` grouped by types.\n */\n protected readonly symbolByTypeIndex = new ContextCache();\n /**\n * This index keeps track of all `ReferenceDescription` items exported by a document.\n * This is used to compute which elements are affected by a document change\n * and for finding references to an AST node.\n */\n protected readonly referenceIndex = new Map();\n\n constructor(services: LangiumSharedCoreServices) {\n this.documents = services.workspace.LangiumDocuments;\n this.serviceRegistry = services.ServiceRegistry;\n this.astReflection = services.AstReflection;\n }\n\n findAllReferences(targetNode: AstNode, astNodePath: string): Stream {\n const targetDocUri = getDocument(targetNode).uri;\n const result: ReferenceDescription[] = [];\n this.referenceIndex.forEach(docRefs => {\n docRefs.forEach(refDescr => {\n if (UriUtils.equals(refDescr.targetUri, targetDocUri) && refDescr.targetPath === astNodePath) {\n result.push(refDescr);\n }\n });\n });\n return stream(result);\n }\n\n allElements(nodeType?: string, uris?: Set): Stream {\n let documentUris = stream(this.symbolIndex.keys());\n if (uris) {\n documentUris = documentUris.filter(uri => !uris || uris.has(uri));\n }\n return documentUris\n .map(uri => this.getFileDescriptions(uri, nodeType))\n .flat();\n }\n\n protected getFileDescriptions(uri: string, nodeType?: string): AstNodeDescription[] {\n if (!nodeType) {\n return this.symbolIndex.get(uri) ?? [];\n }\n const descriptions = this.symbolByTypeIndex.get(uri, nodeType, () => {\n const allFileDescriptions = this.symbolIndex.get(uri) ?? [];\n return allFileDescriptions.filter(e => this.astReflection.isSubtype(e.type, nodeType));\n });\n return descriptions;\n }\n\n remove(uri: URI): void {\n const uriString = uri.toString();\n this.symbolIndex.delete(uriString);\n this.symbolByTypeIndex.clear(uriString);\n this.referenceIndex.delete(uriString);\n }\n\n async updateContent(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n const services = this.serviceRegistry.getServices(document.uri);\n const exports = await services.references.ScopeComputation.computeExports(document, cancelToken);\n const uri = document.uri.toString();\n this.symbolIndex.set(uri, exports);\n this.symbolByTypeIndex.clear(uri);\n }\n\n async updateReferences(document: LangiumDocument, cancelToken = CancellationToken.None): Promise {\n const services = this.serviceRegistry.getServices(document.uri);\n const indexData = await services.workspace.ReferenceDescriptionProvider.createDescriptions(document, cancelToken);\n this.referenceIndex.set(document.uri.toString(), indexData);\n }\n\n isAffected(document: LangiumDocument, changedUris: Set): boolean {\n const references = this.referenceIndex.get(document.uri.toString());\n if (!references) {\n return false;\n }\n return references.some(ref => !ref.local && changedUris.has(ref.targetUri.toString()));\n }\n\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { InitializeParams, InitializedParams } from 'vscode-languageserver-protocol';\nimport type { WorkspaceFolder } from 'vscode-languageserver-types';\nimport type { ServiceRegistry } from '../service-registry.js';\nimport type { LangiumSharedCoreServices } from '../services.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { Deferred, interruptAndCheck } from '../utils/promise-utils.js';\nimport { URI, UriUtils } from '../utils/uri-utils.js';\nimport type { BuildOptions, DocumentBuilder } from './document-builder.js';\nimport type { LangiumDocument, LangiumDocuments } from './documents.js';\nimport type { FileSystemNode, FileSystemProvider } from './file-system-provider.js';\nimport type { WorkspaceLock } from './workspace-lock.js';\n\n// export type WorkspaceFolder from 'vscode-languageserver-types' for convenience,\n// is supposed to avoid confusion as 'WorkspaceFolder' might accidentally be imported via 'vscode-languageclient'\nexport type { WorkspaceFolder };\n\n/**\n * The workspace manager is responsible for finding source files in the workspace.\n * This service is shared between all languages of a language server.\n */\nexport interface WorkspaceManager {\n\n /** The options used for the initial workspace build. */\n initialBuildOptions: BuildOptions | undefined;\n\n /**\n * A promise that resolves when the workspace manager is ready to be used.\n * Use this to ensure that the workspace manager has finished its initialization.\n */\n readonly ready: Promise;\n\n /**\n * When used in a language server context, this method is called when the server receives\n * the `initialize` request.\n */\n initialize(params: InitializeParams): void;\n\n /**\n * When used in a language server context, this method is called when the server receives\n * the `initialized` notification.\n */\n initialized(params: InitializedParams): Promise;\n\n /**\n * Does the initial indexing of workspace folders.\n * Collects information about exported and referenced AstNodes in\n * each language file and stores it locally.\n *\n * @param folders The set of workspace folders to be indexed.\n */\n initializeWorkspace(folders: WorkspaceFolder[], cancelToken?: CancellationToken): Promise;\n\n}\n\nexport class DefaultWorkspaceManager implements WorkspaceManager {\n\n initialBuildOptions: BuildOptions = {};\n\n protected readonly serviceRegistry: ServiceRegistry;\n protected readonly langiumDocuments: LangiumDocuments;\n protected readonly documentBuilder: DocumentBuilder;\n protected readonly fileSystemProvider: FileSystemProvider;\n protected readonly mutex: WorkspaceLock;\n protected readonly _ready = new Deferred();\n protected folders?: WorkspaceFolder[];\n\n constructor(services: LangiumSharedCoreServices) {\n this.serviceRegistry = services.ServiceRegistry;\n this.langiumDocuments = services.workspace.LangiumDocuments;\n this.documentBuilder = services.workspace.DocumentBuilder;\n this.fileSystemProvider = services.workspace.FileSystemProvider;\n this.mutex = services.workspace.WorkspaceLock;\n }\n\n get ready(): Promise {\n return this._ready.promise;\n }\n\n initialize(params: InitializeParams): void {\n this.folders = params.workspaceFolders ?? undefined;\n }\n\n initialized(_params: InitializedParams): Promise {\n // Initialize the workspace even if there are no workspace folders\n // We still want to load additional documents (language library or similar) during initialization\n return this.mutex.write(token => this.initializeWorkspace(this.folders ?? [], token));\n }\n\n async initializeWorkspace(folders: WorkspaceFolder[], cancelToken = CancellationToken.None): Promise {\n const documents = await this.performStartup(folders);\n // Only after creating all documents do we check whether we need to cancel the initialization\n // The document builder will later pick up on all unprocessed documents\n await interruptAndCheck(cancelToken);\n await this.documentBuilder.build(documents, this.initialBuildOptions, cancelToken);\n }\n\n /**\n * Performs the uninterruptable startup sequence of the workspace manager.\n * This methods loads all documents in the workspace and other documents and returns them.\n */\n protected async performStartup(folders: WorkspaceFolder[]): Promise {\n const fileExtensions = this.serviceRegistry.all.flatMap(e => e.LanguageMetaData.fileExtensions);\n const documents: LangiumDocument[] = [];\n const collector = (document: LangiumDocument) => {\n documents.push(document);\n if (!this.langiumDocuments.hasDocument(document.uri)) {\n this.langiumDocuments.addDocument(document);\n }\n };\n // Even though we don't await the initialization of the workspace manager,\n // we can still assume that all library documents and file documents are loaded by the time we start building documents.\n // The mutex prevents anything from performing a workspace build until we check the cancellation token\n await this.loadAdditionalDocuments(folders, collector);\n await Promise.all(\n folders.map(wf => [wf, this.getRootFolder(wf)] as [WorkspaceFolder, URI])\n .map(async entry => this.traverseFolder(...entry, fileExtensions, collector))\n );\n this._ready.resolve();\n return documents;\n }\n\n /**\n * Load all additional documents that shall be visible in the context of the given workspace\n * folders and add them to the collector. This can be used to include built-in libraries of\n * your language, which can be either loaded from provided files or constructed in memory.\n */\n protected loadAdditionalDocuments(_folders: WorkspaceFolder[], _collector: (document: LangiumDocument) => void): Promise {\n return Promise.resolve();\n }\n\n /**\n * Determine the root folder of the source documents in the given workspace folder.\n * The default implementation returns the URI of the workspace folder, but you can override\n * this to return a subfolder like `src` instead.\n */\n protected getRootFolder(workspaceFolder: WorkspaceFolder): URI {\n return URI.parse(workspaceFolder.uri);\n }\n\n /**\n * Traverse the file system folder identified by the given URI and its subfolders. All\n * contained files that match the file extensions are added to the collector.\n */\n protected async traverseFolder(workspaceFolder: WorkspaceFolder, folderPath: URI, fileExtensions: string[], collector: (document: LangiumDocument) => void): Promise {\n const content = await this.fileSystemProvider.readDirectory(folderPath);\n await Promise.all(content.map(async entry => {\n if (this.includeEntry(workspaceFolder, entry, fileExtensions)) {\n if (entry.isDirectory) {\n await this.traverseFolder(workspaceFolder, entry.uri, fileExtensions, collector);\n } else if (entry.isFile) {\n const document = await this.langiumDocuments.getOrCreateDocument(entry.uri);\n collector(document);\n }\n }\n }));\n }\n\n /**\n * Determine whether the given folder entry shall be included while indexing the workspace.\n */\n protected includeEntry(_workspaceFolder: WorkspaceFolder, entry: FileSystemNode, fileExtensions: string[]): boolean {\n const name = UriUtils.basename(entry.uri);\n if (name.startsWith('.')) {\n return false;\n }\n if (entry.isDirectory) {\n return name !== 'node_modules' && name !== 'out';\n } else if (entry.isFile) {\n const extname = UriUtils.extname(entry.uri);\n return fileExtensions.includes(extname);\n }\n return false;\n }\n\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { ILexingError, IMultiModeLexerDefinition, IToken, TokenType, TokenTypeDictionary, TokenVocabulary } from 'chevrotain';\nimport type { LangiumCoreServices } from '../services.js';\nimport { Lexer as ChevrotainLexer } from 'chevrotain';\n\nexport interface LexerResult {\n /**\n * A list of all tokens that were lexed from the input.\n *\n * Note that Langium requires the optional properties\n * `startLine`, `startColumn`, `endOffset`, `endLine` and `endColumn` to be set on each token.\n */\n tokens: IToken[];\n /**\n * Contains hidden tokens, usually comments.\n */\n hidden: IToken[];\n errors: ILexingError[];\n}\n\nexport interface Lexer {\n readonly definition: TokenTypeDictionary;\n tokenize(text: string): LexerResult;\n}\n\nexport class DefaultLexer implements Lexer {\n\n protected chevrotainLexer: ChevrotainLexer;\n protected tokenTypes: TokenTypeDictionary;\n\n constructor(services: LangiumCoreServices) {\n const tokens = services.parser.TokenBuilder.buildTokens(services.Grammar, {\n caseInsensitive: services.LanguageMetaData.caseInsensitive\n });\n this.tokenTypes = this.toTokenTypeDictionary(tokens);\n const lexerTokens = isTokenTypeDictionary(tokens) ? Object.values(tokens) : tokens;\n this.chevrotainLexer = new ChevrotainLexer(lexerTokens, {\n positionTracking: 'full'\n });\n }\n\n get definition(): TokenTypeDictionary {\n return this.tokenTypes;\n }\n\n tokenize(text: string): LexerResult {\n const chevrotainResult = this.chevrotainLexer.tokenize(text);\n return {\n tokens: chevrotainResult.tokens,\n errors: chevrotainResult.errors,\n hidden: chevrotainResult.groups.hidden ?? []\n };\n }\n\n protected toTokenTypeDictionary(buildTokens: TokenVocabulary): TokenTypeDictionary {\n if (isTokenTypeDictionary(buildTokens)) return buildTokens;\n const tokens = isIMultiModeLexerDefinition(buildTokens) ? Object.values(buildTokens.modes).flat() : buildTokens;\n const res: TokenTypeDictionary = {};\n tokens.forEach(token => res[token.name] = token);\n return res;\n }\n}\n\n/**\n * Returns a check whether the given TokenVocabulary is TokenType array\n */\nexport function isTokenTypeArray(tokenVocabulary: TokenVocabulary): tokenVocabulary is TokenType[] {\n return Array.isArray(tokenVocabulary) && (tokenVocabulary.length === 0 || 'name' in tokenVocabulary[0]);\n}\n\n/**\n * Returns a check whether the given TokenVocabulary is IMultiModeLexerDefinition\n */\nexport function isIMultiModeLexerDefinition(tokenVocabulary: TokenVocabulary): tokenVocabulary is IMultiModeLexerDefinition {\n return tokenVocabulary && 'modes' in tokenVocabulary && 'defaultMode' in tokenVocabulary;\n}\n\n/**\n * Returns a check whether the given TokenVocabulary is TokenTypeDictionary\n */\nexport function isTokenTypeDictionary(tokenVocabulary: TokenVocabulary): tokenVocabulary is TokenTypeDictionary {\n return !isTokenTypeArray(tokenVocabulary) && !isIMultiModeLexerDefinition(tokenVocabulary);\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { Position, Range } from 'vscode-languageserver-types';\nimport type { CstNode } from '../syntax-tree.js';\nimport { NEWLINE_REGEXP, escapeRegExp } from '../utils/regexp-utils.js';\nimport { URI } from '../utils/uri-utils.js';\n\nexport interface JSDocComment extends JSDocValue {\n readonly elements: JSDocElement[]\n getTag(name: string): JSDocTag | undefined\n getTags(name: string): JSDocTag[]\n}\n\nexport type JSDocElement = JSDocParagraph | JSDocTag;\n\nexport type JSDocInline = JSDocTag | JSDocLine;\n\nexport interface JSDocValue {\n /**\n * Represents the range that this JSDoc element occupies.\n * If the JSDoc was parsed from a `CstNode`, the range will represent the location in the source document.\n */\n readonly range: Range\n /**\n * Renders this JSDoc element to a plain text representation.\n */\n toString(): string\n /**\n * Renders this JSDoc element to a markdown representation.\n *\n * @param options Rendering options to customize the markdown result.\n */\n toMarkdown(options?: JSDocRenderOptions): string\n}\n\nexport interface JSDocParagraph extends JSDocValue {\n readonly inlines: JSDocInline[]\n}\n\nexport interface JSDocLine extends JSDocValue {\n readonly text: string\n}\n\nexport interface JSDocTag extends JSDocValue {\n readonly name: string\n readonly content: JSDocParagraph\n readonly inline: boolean\n}\n\nexport interface JSDocParseOptions {\n /**\n * The start symbol of your comment format. Defaults to `/**`.\n */\n readonly start?: RegExp | string\n /**\n * The symbol that start a line of your comment format. Defaults to `*`.\n */\n readonly line?: RegExp | string\n /**\n * The end symbol of your comment format. Defaults to `*\\/`.\n */\n readonly end?: RegExp | string\n}\n\nexport interface JSDocRenderOptions {\n /**\n * Determines the style for rendering tags. Defaults to `italic`.\n */\n tag?: 'plain' | 'italic' | 'bold' | 'bold-italic'\n /**\n * Determines the default for rendering `@link` tags. Defaults to `plain`.\n */\n link?: 'code' | 'plain'\n /**\n * Custom tag rendering function.\n * Return a markdown formatted tag or `undefined` to fall back to the default rendering.\n */\n renderTag?(tag: JSDocTag): string | undefined\n /**\n * Custom link rendering function. Accepts a link target and a display value for the link.\n * Return a markdown formatted link with the format `[$display]($link)` or `undefined` if the link is not a valid target.\n */\n renderLink?(link: string, display: string): string | undefined\n}\n\n/**\n * Parses a JSDoc from a `CstNode` containing a comment.\n *\n * @param node A `CstNode` from a parsed Langium document.\n * @param options Parsing options specialized to your language. See {@link JSDocParseOptions}.\n */\nexport function parseJSDoc(node: CstNode, options?: JSDocParseOptions): JSDocComment;\n/**\n * Parses a JSDoc from a string comment.\n *\n * @param content A string containing the source of the JSDoc comment.\n * @param start The start position the comment occupies in the source document.\n * @param options Parsing options specialized to your language. See {@link JSDocParseOptions}.\n */\nexport function parseJSDoc(content: string, start?: Position, options?: JSDocParseOptions): JSDocComment;\nexport function parseJSDoc(node: CstNode | string, start?: Position | JSDocParseOptions, options?: JSDocParseOptions): JSDocComment {\n let opts: JSDocParseOptions | undefined;\n let position: Position | undefined;\n if (typeof node === 'string') {\n position = start as Position | undefined;\n opts = options as JSDocParseOptions | undefined;\n } else {\n position = node.range.start;\n opts = start as JSDocParseOptions | undefined;\n }\n if (!position) {\n position = Position.create(0, 0);\n }\n\n const lines = getLines(node);\n const normalizedOptions = normalizeOptions(opts);\n\n const tokens = tokenize({\n lines,\n position,\n options: normalizedOptions\n });\n\n return parseJSDocComment({\n index: 0,\n tokens,\n position\n });\n}\n\nexport function isJSDoc(node: CstNode | string, options?: JSDocParseOptions): boolean {\n const normalizedOptions = normalizeOptions(options);\n const lines = getLines(node);\n if (lines.length === 0) {\n return false;\n }\n\n const first = lines[0];\n const last = lines[lines.length - 1];\n const firstRegex = normalizedOptions.start;\n const lastRegex = normalizedOptions.end;\n\n return Boolean(firstRegex?.exec(first)) && Boolean(lastRegex?.exec(last));\n}\n\nfunction getLines(node: CstNode | string): string[] {\n let content = '';\n if (typeof node === 'string') {\n content = node;\n } else {\n content = node.text;\n }\n const lines = content.split(NEWLINE_REGEXP);\n return lines;\n}\n\n// Tokenization\n\ninterface JSDocToken {\n type: 'text' | 'tag' | 'inline-tag' | 'break'\n content: string\n range: Range\n}\n\nconst tagRegex = /\\s*(@([\\p{L}][\\p{L}\\p{N}]*)?)/uy;\nconst inlineTagRegex = /\\{(@[\\p{L}][\\p{L}\\p{N}]*)(\\s*)([^\\r\\n}]+)?\\}/gu;\n\nfunction tokenize(context: TokenizationContext): JSDocToken[] {\n const tokens: JSDocToken[] = [];\n let currentLine = context.position.line;\n let currentCharacter = context.position.character;\n for (let i = 0; i < context.lines.length; i++) {\n const first = i === 0;\n const last = i === context.lines.length - 1;\n let line = context.lines[i];\n let index = 0;\n\n if (first && context.options.start) {\n const match = context.options.start?.exec(line);\n if (match) {\n index = match.index + match[0].length;\n }\n } else {\n const match = context.options.line?.exec(line);\n if (match) {\n index = match.index + match[0].length;\n }\n }\n if (last) {\n const match = context.options.end?.exec(line);\n if (match) {\n line = line.substring(0, match.index);\n }\n }\n\n line = line.substring(0, lastCharacter(line));\n const whitespaceEnd = skipWhitespace(line, index);\n\n if (whitespaceEnd >= line.length) {\n // Only create a break token when we already have previous tokens\n if (tokens.length > 0) {\n const position = Position.create(currentLine, currentCharacter);\n tokens.push({\n type: 'break',\n content: '',\n range: Range.create(position, position)\n });\n }\n } else {\n tagRegex.lastIndex = index;\n const tagMatch = tagRegex.exec(line);\n if (tagMatch) {\n const fullMatch = tagMatch[0];\n const value = tagMatch[1];\n const start = Position.create(currentLine, currentCharacter + index);\n const end = Position.create(currentLine, currentCharacter + index + fullMatch.length);\n tokens.push({\n type: 'tag',\n content: value,\n range: Range.create(start, end)\n });\n index += fullMatch.length;\n index = skipWhitespace(line, index);\n }\n\n if (index < line.length) {\n const rest = line.substring(index);\n const inlineTagMatches = Array.from(rest.matchAll(inlineTagRegex));\n tokens.push(...buildInlineTokens(inlineTagMatches, rest, currentLine, currentCharacter + index));\n }\n }\n\n currentLine++;\n currentCharacter = 0;\n }\n\n // Remove last break token if there is one\n if (tokens.length > 0 && tokens[tokens.length - 1].type === 'break') {\n return tokens.slice(0, -1);\n }\n\n return tokens;\n}\n\nfunction buildInlineTokens(tags: RegExpMatchArray[], line: string, lineIndex: number, characterIndex: number): JSDocToken[] {\n const tokens: JSDocToken[] = [];\n\n if (tags.length === 0) {\n const start = Position.create(lineIndex, characterIndex);\n const end = Position.create(lineIndex, characterIndex + line.length);\n tokens.push({\n type: 'text',\n content: line,\n range: Range.create(start, end)\n });\n } else {\n let lastIndex = 0;\n for (const match of tags) {\n const matchIndex = match.index!;\n const startContent = line.substring(lastIndex, matchIndex);\n if (startContent.length > 0) {\n tokens.push({\n type: 'text',\n content: line.substring(lastIndex, matchIndex),\n range: Range.create(\n Position.create(lineIndex, lastIndex + characterIndex),\n Position.create(lineIndex, matchIndex + characterIndex)\n )\n });\n }\n let offset = startContent.length + 1;\n const tagName = match[1];\n tokens.push({\n type: 'inline-tag',\n content: tagName,\n range: Range.create(\n Position.create(lineIndex, lastIndex + offset + characterIndex),\n Position.create(lineIndex, lastIndex + offset + tagName.length + characterIndex)\n )\n });\n offset += tagName.length;\n if (match.length === 4) {\n offset += match[2].length;\n const value = match[3];\n tokens.push({\n type: 'text',\n content: value,\n range: Range.create(\n Position.create(lineIndex, lastIndex + offset + characterIndex),\n Position.create(lineIndex, lastIndex + offset + value.length + characterIndex)\n )\n });\n } else {\n tokens.push({\n type: 'text',\n content: '',\n range: Range.create(\n Position.create(lineIndex, lastIndex + offset + characterIndex),\n Position.create(lineIndex, lastIndex + offset + characterIndex)\n )\n });\n }\n lastIndex = matchIndex + match[0].length;\n }\n const endContent = line.substring(lastIndex);\n if (endContent.length > 0) {\n tokens.push({\n type: 'text',\n content: endContent,\n range: Range.create(\n Position.create(lineIndex, lastIndex + characterIndex),\n Position.create(lineIndex, lastIndex + characterIndex + endContent.length)\n )\n });\n }\n }\n\n return tokens;\n}\n\nconst nonWhitespaceRegex = /\\S/;\nconst whitespaceEndRegex = /\\s*$/;\n\nfunction skipWhitespace(line: string, index: number): number {\n const match = line.substring(index).match(nonWhitespaceRegex);\n if (match) {\n return index + match.index!;\n } else {\n return line.length;\n }\n}\n\nfunction lastCharacter(line: string): number | undefined {\n const match = line.match(whitespaceEndRegex);\n if (match && typeof match.index === 'number') {\n return match.index;\n }\n return undefined;\n}\n\n// Parsing\n\nfunction parseJSDocComment(context: ParseContext): JSDocComment {\n const startPosition: Position = Position.create(context.position.line, context.position.character);\n if (context.tokens.length === 0) {\n return new JSDocCommentImpl([], Range.create(startPosition, startPosition));\n }\n const elements: JSDocElement[] = [];\n while (context.index < context.tokens.length) {\n const element = parseJSDocElement(context, elements[elements.length - 1]);\n if (element) {\n elements.push(element);\n }\n }\n const start = elements[0]?.range.start ?? startPosition;\n const end = elements[elements.length - 1]?.range.end ?? startPosition;\n return new JSDocCommentImpl(elements, Range.create(start, end));\n}\n\nfunction parseJSDocElement(context: ParseContext, last?: JSDocElement): JSDocElement | undefined {\n const next = context.tokens[context.index];\n if (next.type === 'tag') {\n return parseJSDocTag(context, false);\n } else if (next.type === 'text' || next.type === 'inline-tag') {\n return parseJSDocText(context);\n } else {\n appendEmptyLine(next, last);\n context.index++;\n return undefined;\n }\n}\n\nfunction appendEmptyLine(token: JSDocToken, element?: JSDocElement): void {\n if (element) {\n const line = new JSDocLineImpl('', token.range);\n if ('inlines' in element) {\n element.inlines.push(line);\n } else {\n element.content.inlines.push(line);\n }\n }\n}\n\nfunction parseJSDocText(context: ParseContext): JSDocParagraph {\n let token = context.tokens[context.index];\n const firstToken = token;\n let lastToken = token;\n const lines: JSDocInline[] = [];\n while (token && token.type !== 'break' && token.type !== 'tag') {\n lines.push(parseJSDocInline(context));\n lastToken = token;\n token = context.tokens[context.index];\n }\n return new JSDocTextImpl(lines, Range.create(firstToken.range.start, lastToken.range.end));\n}\n\nfunction parseJSDocInline(context: ParseContext): JSDocInline {\n const token = context.tokens[context.index];\n if (token.type === 'inline-tag') {\n return parseJSDocTag(context, true);\n } else {\n return parseJSDocLine(context);\n }\n}\n\nfunction parseJSDocTag(context: ParseContext, inline: boolean): JSDocTag {\n const tagToken = context.tokens[context.index++];\n const name = tagToken.content.substring(1);\n const nextToken = context.tokens[context.index];\n if (nextToken?.type === 'text') {\n if (inline) {\n const docLine = parseJSDocLine(context);\n return new JSDocTagImpl(\n name,\n new JSDocTextImpl([docLine], docLine.range),\n inline,\n Range.create(tagToken.range.start, docLine.range.end)\n );\n } else {\n const textDoc = parseJSDocText(context);\n return new JSDocTagImpl(\n name,\n textDoc,\n inline,\n Range.create(tagToken.range.start, textDoc.range.end)\n );\n }\n } else {\n const range = tagToken.range;\n return new JSDocTagImpl(name, new JSDocTextImpl([], range), inline, range);\n }\n}\n\nfunction parseJSDocLine(context: ParseContext): JSDocLine {\n const token = context.tokens[context.index++];\n return new JSDocLineImpl(token.content, token.range);\n}\n\ninterface NormalizedOptions {\n start?: RegExp\n end?: RegExp\n line?: RegExp\n}\n\ninterface TokenizationContext {\n position: Position\n lines: string[]\n options: NormalizedOptions\n}\n\ninterface ParseContext {\n position: Position\n tokens: JSDocToken[]\n index: number\n}\n\nfunction normalizeOptions(options?: JSDocParseOptions): NormalizedOptions {\n if (!options) {\n return normalizeOptions({\n start: '/**',\n end: '*/',\n line: '*'\n });\n }\n const { start, end, line } = options;\n return {\n start: normalizeOption(start, true),\n end: normalizeOption(end, false),\n line: normalizeOption(line, true)\n };\n}\n\nfunction normalizeOption(option: RegExp | string | undefined, start: boolean): RegExp | undefined {\n if (typeof option === 'string' || typeof option === 'object') {\n const escaped = typeof option === 'string' ? escapeRegExp(option) : option.source;\n if (start) {\n return new RegExp(`^\\\\s*${escaped}`);\n } else {\n return new RegExp(`\\\\s*${escaped}\\\\s*$`);\n }\n } else {\n return option;\n }\n}\n\nclass JSDocCommentImpl implements JSDocComment {\n\n readonly elements: JSDocElement[];\n readonly range: Range;\n\n constructor(elements: JSDocElement[], range: Range) {\n this.elements = elements;\n this.range = range;\n }\n\n getTag(name: string): JSDocTag | undefined {\n return this.getAllTags().find(e => e.name === name);\n }\n\n getTags(name: string): JSDocTag[] {\n return this.getAllTags().filter(e => e.name === name);\n }\n\n private getAllTags(): JSDocTag[] {\n return this.elements.filter((e): e is JSDocTag => 'name' in e);\n }\n\n toString(): string {\n let value = '';\n for (const element of this.elements) {\n if (value.length === 0) {\n value = element.toString();\n } else {\n const text = element.toString();\n value += fillNewlines(value) + text;\n }\n }\n return value.trim();\n }\n\n toMarkdown(options?: JSDocRenderOptions): string {\n let value = '';\n for (const element of this.elements) {\n if (value.length === 0) {\n value = element.toMarkdown(options);\n } else {\n const text = element.toMarkdown(options);\n value += fillNewlines(value) + text;\n }\n }\n return value.trim();\n }\n}\n\nclass JSDocTagImpl implements JSDocTag {\n name: string;\n content: JSDocParagraph;\n range: Range;\n inline: boolean;\n\n constructor(name: string, content: JSDocParagraph, inline: boolean, range: Range) {\n this.name = name;\n this.content = content;\n this.inline = inline;\n this.range = range;\n }\n\n toString(): string {\n let text = `@${this.name}`;\n const content = this.content.toString();\n if (this.content.inlines.length === 1) {\n text = `${text} ${content}`;\n } else if (this.content.inlines.length > 1) {\n text = `${text}\\n${content}`;\n }\n if (this.inline) {\n // Inline tags are surrounded by curly braces\n return `{${text}}`;\n } else {\n return text;\n }\n }\n\n toMarkdown(options?: JSDocRenderOptions): string {\n return options?.renderTag?.(this) ?? this.toMarkdownDefault(options);\n }\n\n private toMarkdownDefault(options?: JSDocRenderOptions): string {\n const content = this.content.toMarkdown(options);\n if (this.inline) {\n const rendered = renderInlineTag(this.name, content, options ?? {});\n if (typeof rendered === 'string') {\n return rendered;\n }\n }\n let marker = '';\n if (options?.tag === 'italic' || options?.tag === undefined) {\n marker = '*';\n } else if (options?.tag === 'bold') {\n marker = '**';\n } else if (options?.tag === 'bold-italic') {\n marker = '***';\n }\n let text = `${marker}@${this.name}${marker}`;\n if (this.content.inlines.length === 1) {\n text = `${text} \u2014 ${content}`;\n } else if (this.content.inlines.length > 1) {\n text = `${text}\\n${content}`;\n }\n if (this.inline) {\n // Inline tags are surrounded by curly braces\n return `{${text}}`;\n } else {\n return text;\n }\n }\n}\n\nfunction renderInlineTag(tag: string, content: string, options: JSDocRenderOptions): string | undefined {\n if (tag === 'linkplain' || tag === 'linkcode' || tag === 'link') {\n const index = content.indexOf(' ');\n let display = content;\n if (index > 0) {\n const displayStart = skipWhitespace(content, index);\n display = content.substring(displayStart);\n content = content.substring(0, index);\n }\n if (tag === 'linkcode' || (tag === 'link' && options.link === 'code')) {\n // Surround the display value in a markdown inline code block\n display = `\\`${display}\\``;\n }\n const renderedLink = options.renderLink?.(content, display) ?? renderLinkDefault(content, display);\n return renderedLink;\n }\n return undefined;\n}\n\nfunction renderLinkDefault(content: string, display: string): string {\n try {\n URI.parse(content, true);\n return `[${display}](${content})`;\n } catch {\n return content;\n }\n}\n\nclass JSDocTextImpl implements JSDocParagraph {\n inlines: JSDocInline[];\n range: Range;\n\n constructor(lines: JSDocInline[], range: Range) {\n this.inlines = lines;\n this.range = range;\n }\n\n toString(): string {\n let text = '';\n for (let i = 0; i < this.inlines.length; i++) {\n const inline = this.inlines[i];\n const next = this.inlines[i + 1];\n text += inline.toString();\n if (next && next.range.start.line > inline.range.start.line) {\n text += '\\n';\n }\n }\n return text;\n }\n\n toMarkdown(options?: JSDocRenderOptions): string {\n let text = '';\n for (let i = 0; i < this.inlines.length; i++) {\n const inline = this.inlines[i];\n const next = this.inlines[i + 1];\n text += inline.toMarkdown(options);\n if (next && next.range.start.line > inline.range.start.line) {\n text += '\\n';\n }\n }\n return text;\n }\n}\n\nclass JSDocLineImpl implements JSDocLine {\n text: string;\n range: Range;\n\n constructor(text: string, range: Range) {\n this.text = text;\n this.range = range;\n }\n\n toString(): string {\n return this.text;\n }\n toMarkdown(): string {\n return this.text;\n }\n\n}\n\nfunction fillNewlines(text: string): string {\n if (text.endsWith('\\n')) {\n return '\\n';\n } else {\n return '\\n\\n';\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode, AstNodeDescription } from '../syntax-tree.js';\nimport type { IndexManager } from '../workspace/index-manager.js';\nimport type { CommentProvider } from './comment-provider.js';\nimport type { JSDocTag } from './jsdoc.js';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { isJSDoc, parseJSDoc } from './jsdoc.js';\n\n/**\n * Provides documentation for AST nodes.\n */\nexport interface DocumentationProvider {\n /**\n * Returns a markdown documentation string for the specified AST node.\n *\n * The default implementation `JSDocDocumentationProvider` will inspect the comment associated with the specified node.\n */\n getDocumentation(node: AstNode): string | undefined;\n}\n\nexport class JSDocDocumentationProvider implements DocumentationProvider {\n\n protected readonly indexManager: IndexManager;\n protected readonly commentProvider: CommentProvider;\n\n constructor(services: LangiumCoreServices) {\n this.indexManager = services.shared.workspace.IndexManager;\n this.commentProvider = services.documentation.CommentProvider;\n }\n\n getDocumentation(node: AstNode): string | undefined {\n const comment = this.commentProvider.getComment(node);\n if (comment && isJSDoc(comment)) {\n const parsedJSDoc = parseJSDoc(comment);\n return parsedJSDoc.toMarkdown({\n renderLink: (link, display) => {\n return this.documentationLinkRenderer(node, link, display);\n },\n renderTag: (tag) => {\n return this.documentationTagRenderer(node, tag);\n }\n });\n }\n return undefined;\n }\n\n protected documentationLinkRenderer(node: AstNode, name: string, display: string): string | undefined {\n const description = this.findNameInPrecomputedScopes(node, name) ?? this.findNameInGlobalScope(node, name);\n if (description && description.nameSegment) {\n const line = description.nameSegment.range.start.line + 1;\n const character = description.nameSegment.range.start.character + 1;\n const uri = description.documentUri.with({ fragment: `L${line},${character}` });\n return `[${display}](${uri.toString()})`;\n } else {\n return undefined;\n }\n }\n\n protected documentationTagRenderer(_node: AstNode, _tag: JSDocTag): string | undefined {\n // Fall back to the default tag rendering\n return undefined;\n }\n\n protected findNameInPrecomputedScopes(node: AstNode, name: string): AstNodeDescription | undefined {\n const document = getDocument(node);\n const precomputed = document.precomputedScopes;\n if (!precomputed) {\n return undefined;\n }\n let currentNode: AstNode | undefined = node;\n do {\n const allDescriptions = precomputed.get(currentNode);\n const description = allDescriptions.find(e => e.name === name);\n if (description) {\n return description;\n }\n currentNode = currentNode.$container;\n } while (currentNode);\n\n return undefined;\n }\n\n protected findNameInGlobalScope(node: AstNode, name: string): AstNodeDescription | undefined {\n const description = this.indexManager.allElements().find(e => e.name === name);\n return description;\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport { isAstNodeWithComment } from '../serializer/json-serializer.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport { findCommentNode } from '../utils/cst-utils.js';\n\n/**\n * Provides comments for AST nodes.\n */\nexport interface CommentProvider {\n /**\n * Returns the comment associated with the specified AST node.\n * @param node The AST node to get the comment for.\n * @returns The comment associated with the specified AST node or `undefined` if there is no comment.\n */\n getComment(node: AstNode): string | undefined;\n}\n\nexport class DefaultCommentProvider implements CommentProvider {\n protected readonly grammarConfig: () => GrammarConfig;\n constructor(services: LangiumCoreServices) {\n this.grammarConfig = () => services.parser.GrammarConfig;\n }\n getComment(node: AstNode): string | undefined {\n if(isAstNodeWithComment(node)) {\n return node.$comment;\n }\n return findCommentNode(node.$cstNode, this.grammarConfig().multilineCommentRules)?.text;\n }\n}\n", "/******************************************************************************\n * Copyright 2024 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n// eslint-disable-next-line no-restricted-imports\nexport * from 'vscode-jsonrpc/lib/common/events.js';\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport type { LangiumParser, ParseResult } from './langium-parser.js';\nimport type { Hydrator } from '../serializer/hydrator.js';\nimport type { Event } from '../utils/event.js';\nimport { Deferred, OperationCancelled } from '../utils/promise-utils.js';\nimport { Emitter } from '../utils/event.js';\n\n/**\n * Async parser that allows to cancel the current parsing process.\n * The sync parser implementation is blocking the event loop, which can become quite problematic for large files.\n *\n * Note that the default implementation is not actually async. It just wraps the sync parser in a promise.\n * A real implementation would create worker threads or web workers to offload the parsing work.\n */\nexport interface AsyncParser {\n parse(text: string, cancelToken: CancellationToken): Promise>;\n}\n\n/**\n * Default implementation of the async parser. This implementation only wraps the sync parser in a promise.\n *\n * A real implementation would create worker threads or web workers to offload the parsing work.\n */\nexport class DefaultAsyncParser implements AsyncParser {\n\n protected readonly syncParser: LangiumParser;\n\n constructor(services: LangiumCoreServices) {\n this.syncParser = services.parser.LangiumParser;\n }\n\n parse(text: string): Promise> {\n return Promise.resolve(this.syncParser.parse(text));\n }\n}\n\nexport abstract class AbstractThreadedAsyncParser implements AsyncParser {\n\n /**\n * The thread count determines how many threads are used to parse files in parallel.\n * The default value is 8. Decreasing this value increases startup performance, but decreases parallel parsing performance.\n */\n protected threadCount = 8;\n /**\n * The termination delay determines how long the parser waits for a thread to finish after a cancellation request.\n * The default value is 200(ms).\n */\n protected terminationDelay = 200;\n protected workerPool: ParserWorker[] = [];\n protected queue: Array> = [];\n\n protected readonly hydrator: Hydrator;\n\n constructor(services: LangiumCoreServices) {\n this.hydrator = services.serializer.Hydrator;\n }\n\n protected initializeWorkers(): void {\n while (this.workerPool.length < this.threadCount) {\n const worker = this.createWorker();\n worker.onReady(() => {\n if (this.queue.length > 0) {\n const deferred = this.queue.shift();\n if (deferred) {\n worker.lock();\n deferred.resolve(worker);\n }\n }\n });\n this.workerPool.push(worker);\n }\n }\n\n async parse(text: string, cancelToken: CancellationToken): Promise> {\n const worker = await this.acquireParserWorker(cancelToken);\n const deferred = new Deferred>();\n let timeout: NodeJS.Timeout | undefined;\n // If the cancellation token is requested, we wait for a certain time before terminating the worker.\n // Since the cancellation token lives longer than the parsing process, we need to dispose the event listener.\n // Otherwise, we might accidentally terminate the worker after the parsing process has finished.\n const cancellation = cancelToken.onCancellationRequested(() => {\n timeout = setTimeout(() => {\n this.terminateWorker(worker);\n }, this.terminationDelay);\n });\n worker.parse(text).then(result => {\n const hydrated = this.hydrator.hydrate(result);\n deferred.resolve(hydrated);\n }).catch(err => {\n deferred.reject(err);\n }).finally(() => {\n cancellation.dispose();\n clearTimeout(timeout);\n });\n return deferred.promise;\n }\n\n protected terminateWorker(worker: ParserWorker): void {\n worker.terminate();\n const index = this.workerPool.indexOf(worker);\n if (index >= 0) {\n this.workerPool.splice(index, 1);\n }\n }\n\n protected async acquireParserWorker(cancelToken: CancellationToken): Promise {\n this.initializeWorkers();\n for (const worker of this.workerPool) {\n if (worker.ready) {\n worker.lock();\n return worker;\n }\n }\n const deferred = new Deferred();\n cancelToken.onCancellationRequested(() => {\n const index = this.queue.indexOf(deferred);\n if (index >= 0) {\n this.queue.splice(index, 1);\n }\n deferred.reject(OperationCancelled);\n });\n this.queue.push(deferred);\n return deferred.promise;\n }\n\n protected abstract createWorker(): ParserWorker;\n}\n\nexport type WorkerMessagePost = (message: unknown) => void;\nexport type WorkerMessageCallback = (cb: (message: unknown) => void) => void;\n\nexport class ParserWorker {\n\n protected readonly sendMessage: WorkerMessagePost;\n protected readonly _terminate: () => void;\n protected readonly onReadyEmitter = new Emitter();\n\n protected deferred = new Deferred();\n protected _ready = true;\n protected _parsing = false;\n\n get ready(): boolean {\n return this._ready;\n }\n\n get onReady(): Event {\n return this.onReadyEmitter.event;\n }\n\n constructor(sendMessage: WorkerMessagePost, onMessage: WorkerMessageCallback, onError: WorkerMessageCallback, terminate: () => void) {\n this.sendMessage = sendMessage;\n this._terminate = terminate;\n onMessage(result => {\n const parseResult = result as ParseResult;\n this.deferred.resolve(parseResult);\n this.unlock();\n });\n onError(error => {\n this.deferred.reject(error);\n this.unlock();\n });\n }\n\n terminate(): void {\n this.deferred.reject(OperationCancelled);\n this._terminate();\n }\n\n lock(): void {\n this._ready = false;\n }\n\n unlock(): void {\n this._parsing = false;\n this._ready = true;\n this.onReadyEmitter.fire();\n }\n\n parse(text: string): Promise {\n if (this._parsing) {\n throw new Error('Parser worker is busy');\n }\n this._parsing = true;\n this.deferred = new Deferred();\n this.sendMessage(text);\n return this.deferred.promise;\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { CancellationToken, CancellationTokenSource } from '../utils/cancellation.js';\nimport { Deferred, isOperationCancelled, type MaybePromise } from '../utils/promise-utils.js';\n\n/**\n * Utility service to execute mutually exclusive actions.\n */\nexport interface WorkspaceLock {\n /**\n * Performs a single async action, like initializing the workspace or processing document changes.\n * Only one action will be executed at a time.\n *\n * When another action is queued up, the token provided for the action will be cancelled.\n * Assuming the action makes use of this token, the next action only has to wait for the current action to finish cancellation.\n */\n write(action: (token: CancellationToken) => MaybePromise): Promise;\n\n /**\n * Performs a single action, like computing completion results or providing workspace symbols.\n * Read actions will only be executed after all write actions have finished. They will be executed in parallel if possible.\n *\n * If a write action is currently running, the read action will be queued up and executed afterwards.\n * If a new write action is queued up while a read action is waiting, the write action will receive priority and will be handled before the read action.\n *\n * Note that read actions are not allowed to modify anything in the workspace. Please use {@link write} instead.\n */\n read(action: () => MaybePromise): Promise;\n\n /**\n * Cancels the last queued write action. All previous write actions already have been cancelled.\n */\n cancelWrite(): void;\n}\n\ntype LockAction = (token: CancellationToken) => MaybePromise;\n\ninterface LockEntry {\n action: LockAction;\n deferred: Deferred;\n cancellationToken: CancellationToken;\n}\n\nexport class DefaultWorkspaceLock implements WorkspaceLock {\n\n private previousTokenSource = new CancellationTokenSource();\n private writeQueue: LockEntry[] = [];\n private readQueue: LockEntry[] = [];\n private done = true;\n\n write(action: (token: CancellationToken) => MaybePromise): Promise {\n this.cancelWrite();\n const tokenSource = new CancellationTokenSource();\n this.previousTokenSource = tokenSource;\n return this.enqueue(this.writeQueue, action, tokenSource.token);\n }\n\n read(action: () => MaybePromise): Promise {\n return this.enqueue(this.readQueue, action);\n }\n\n private enqueue(queue: LockEntry[], action: LockAction, cancellationToken?: CancellationToken): Promise {\n const deferred = new Deferred();\n const entry: LockEntry = {\n action,\n deferred,\n cancellationToken: cancellationToken ?? CancellationToken.None\n };\n queue.push(entry);\n this.performNextOperation();\n return deferred.promise as Promise;\n }\n\n private async performNextOperation(): Promise {\n if (!this.done) {\n return;\n }\n const entries: LockEntry[] = [];\n if (this.writeQueue.length > 0) {\n // Just perform the next write action\n entries.push(this.writeQueue.shift()!);\n } else if (this.readQueue.length > 0) {\n // Empty the read queue and perform all actions in parallel\n entries.push(...this.readQueue.splice(0, this.readQueue.length));\n } else {\n return;\n }\n this.done = false;\n await Promise.all(entries.map(async ({ action, deferred, cancellationToken }) => {\n try {\n // Move the execution of the action to the next event loop tick via `Promise.resolve()`\n const result = await Promise.resolve().then(() => action(cancellationToken));\n deferred.resolve(result);\n } catch (err) {\n if (isOperationCancelled(err)) {\n // If the operation was cancelled, we don't want to reject the promise\n deferred.resolve(undefined);\n } else {\n deferred.reject(err);\n }\n }\n }));\n this.done = true;\n this.performNextOperation();\n }\n\n cancelWrite(): void {\n this.previousTokenSource.cancel();\n }\n}\n", "/******************************************************************************\n * Copyright 2024 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { TokenType } from 'chevrotain';\nimport { CompositeCstNodeImpl, LeafCstNodeImpl, RootCstNodeImpl } from '../parser/cst-node-builder.js';\nimport { isAbstractElement, type AbstractElement, type Grammar } from '../languages/generated/ast.js';\nimport type { Linker } from '../references/linker.js';\nimport type { Lexer } from '../parser/lexer.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport type { ParseResult } from '../parser/langium-parser.js';\nimport type { Reference, AstNode, CstNode, LeafCstNode, GenericAstNode, Mutable, RootCstNode } from '../syntax-tree.js';\nimport { isRootCstNode, isCompositeCstNode, isLeafCstNode, isAstNode, isReference } from '../syntax-tree.js';\nimport { streamAst } from '../utils/ast-utils.js';\nimport { BiMap } from '../utils/collections.js';\nimport { streamCst } from '../utils/cst-utils.js';\n\n/**\n * The hydrator service is responsible for allowing AST parse results to be sent across worker threads.\n */\nexport interface Hydrator {\n /**\n * Converts a parse result to a plain object. The resulting object can be sent across worker threads.\n */\n dehydrate(result: ParseResult): ParseResult;\n /**\n * Converts a plain object to a parse result. The included AST node can then be used in the main thread.\n * Calling this method on objects that have not been dehydrated first will result in undefined behavior.\n */\n hydrate(result: ParseResult): ParseResult;\n}\n\nexport interface DehydrateContext {\n astNodes: Map;\n cstNodes: Map;\n}\n\nexport interface HydrateContext {\n astNodes: Map;\n cstNodes: Map;\n}\n\nexport class DefaultHydrator implements Hydrator {\n\n protected readonly grammar: Grammar;\n protected readonly lexer: Lexer;\n protected readonly linker: Linker;\n\n protected readonly grammarElementIdMap = new BiMap();\n protected readonly tokenTypeIdMap = new BiMap();\n\n constructor(services: LangiumCoreServices) {\n this.grammar = services.Grammar;\n this.lexer = services.parser.Lexer;\n this.linker = services.references.Linker;\n }\n\n dehydrate(result: ParseResult): ParseResult {\n return {\n // We need to create shallow copies of the errors\n // The original errors inherit from the `Error` class, which is not transferable across worker threads\n lexerErrors: result.lexerErrors.map(e => ({ ...e })),\n parserErrors: result.parserErrors.map(e => ({ ...e })),\n value: this.dehydrateAstNode(result.value, this.createDehyrationContext(result.value))\n };\n }\n\n protected createDehyrationContext(node: AstNode): DehydrateContext {\n const astNodes = new Map();\n const cstNodes = new Map();\n for (const astNode of streamAst(node)) {\n astNodes.set(astNode, {});\n }\n if (node.$cstNode) {\n for (const cstNode of streamCst(node.$cstNode)) {\n cstNodes.set(cstNode, {});\n }\n }\n return {\n astNodes,\n cstNodes\n };\n }\n\n protected dehydrateAstNode(node: AstNode, context: DehydrateContext): object {\n const obj = context.astNodes.get(node) as Record;\n obj.$type = node.$type;\n obj.$containerIndex = node.$containerIndex;\n obj.$containerProperty = node.$containerProperty;\n if (node.$cstNode !== undefined) {\n obj.$cstNode = this.dehydrateCstNode(node.$cstNode, context);\n }\n for (const [name, value] of Object.entries(node)) {\n if (name.startsWith('$')) {\n continue;\n }\n if (Array.isArray(value)) {\n const arr: any[] = [];\n obj[name] = arr;\n for (const item of value) {\n if (isAstNode(item)) {\n arr.push(this.dehydrateAstNode(item, context));\n } else if (isReference(item)) {\n arr.push(this.dehydrateReference(item, context));\n } else {\n arr.push(item);\n }\n }\n } else if (isAstNode(value)) {\n obj[name] = this.dehydrateAstNode(value, context);\n } else if (isReference(value)) {\n obj[name] = this.dehydrateReference(value, context);\n } else if (value !== undefined) {\n obj[name] = value;\n }\n }\n return obj;\n }\n\n protected dehydrateReference(reference: Reference, context: DehydrateContext): any {\n const obj: Record = {};\n obj.$refText = reference.$refText;\n if (reference.$refNode) {\n obj.$refNode = context.cstNodes.get(reference.$refNode);\n }\n return obj;\n }\n\n protected dehydrateCstNode(node: CstNode, context: DehydrateContext): any {\n const cstNode = context.cstNodes.get(node) as Record;\n if (isRootCstNode(node)) {\n cstNode.fullText = node.fullText;\n } else {\n // Note: This returns undefined for hidden nodes (i.e. comments)\n cstNode.grammarSource = this.getGrammarElementId(node.grammarSource);\n }\n cstNode.hidden = node.hidden;\n cstNode.astNode = context.astNodes.get(node.astNode);\n if (isCompositeCstNode(node)) {\n cstNode.content = node.content.map(child => this.dehydrateCstNode(child, context));\n } else if (isLeafCstNode(node)) {\n cstNode.tokenType = node.tokenType.name;\n cstNode.offset = node.offset;\n cstNode.length = node.length;\n cstNode.startLine = node.range.start.line;\n cstNode.startColumn = node.range.start.character;\n cstNode.endLine = node.range.end.line;\n cstNode.endColumn = node.range.end.character;\n }\n return cstNode;\n }\n\n hydrate(result: ParseResult): ParseResult {\n const node = result.value;\n const context = this.createHydrationContext(node);\n if ('$cstNode' in node) {\n this.hydrateCstNode(node.$cstNode, context);\n }\n return {\n lexerErrors: result.lexerErrors,\n parserErrors: result.parserErrors,\n value: this.hydrateAstNode(node, context) as T\n };\n }\n\n protected createHydrationContext(node: any): HydrateContext {\n const astNodes = new Map();\n const cstNodes = new Map();\n for (const astNode of streamAst(node)) {\n astNodes.set(astNode, {} as AstNode);\n }\n let root: RootCstNode;\n if (node.$cstNode) {\n for (const cstNode of streamCst(node.$cstNode)) {\n let cst: Mutable | undefined;\n if ('fullText' in cstNode) {\n cst = new RootCstNodeImpl(cstNode.fullText as string);\n root = cst as RootCstNode;\n } else if ('content' in cstNode) {\n cst = new CompositeCstNodeImpl();\n } else if ('tokenType' in cstNode) {\n cst = this.hydrateCstLeafNode(cstNode);\n }\n if (cst) {\n cstNodes.set(cstNode, cst);\n cst.root = root!;\n }\n }\n }\n return {\n astNodes,\n cstNodes\n };\n }\n\n protected hydrateAstNode(node: any, context: HydrateContext): AstNode {\n const astNode = context.astNodes.get(node) as Mutable;\n astNode.$type = node.$type;\n astNode.$containerIndex = node.$containerIndex;\n astNode.$containerProperty = node.$containerProperty;\n if (node.$cstNode) {\n astNode.$cstNode = context.cstNodes.get(node.$cstNode);\n }\n for (const [name, value] of Object.entries(node)) {\n if (name.startsWith('$')) {\n continue;\n }\n if (Array.isArray(value)) {\n const arr: unknown[] = [];\n astNode[name] = arr;\n for (const item of value) {\n if (isAstNode(item)) {\n arr.push(this.setParent(this.hydrateAstNode(item, context), astNode));\n } else if (isReference(item)) {\n arr.push(this.hydrateReference(item, astNode, name, context));\n } else {\n arr.push(item);\n }\n }\n } else if (isAstNode(value)) {\n astNode[name] = this.setParent(this.hydrateAstNode(value, context), astNode);\n } else if (isReference(value)) {\n astNode[name] = this.hydrateReference(value, astNode, name, context);\n } else if (value !== undefined) {\n astNode[name] = value;\n }\n }\n return astNode;\n }\n\n protected setParent(node: any, parent: any): any {\n node.$container = parent as AstNode;\n return node;\n }\n\n protected hydrateReference(reference: any, node: AstNode, name: string, context: HydrateContext): Reference {\n return this.linker.buildReference(node, name, context.cstNodes.get(reference.$refNode)!, reference.$refText);\n }\n\n protected hydrateCstNode(cstNode: any, context: HydrateContext, num = 0): CstNode {\n const cstNodeObj = context.cstNodes.get(cstNode) as Mutable;\n if (typeof cstNode.grammarSource === 'number') {\n cstNodeObj.grammarSource = this.getGrammarElement(cstNode.grammarSource);\n }\n cstNodeObj.astNode = context.astNodes.get(cstNode.astNode)!;\n if (isCompositeCstNode(cstNodeObj)) {\n for (const child of cstNode.content) {\n const hydrated = this.hydrateCstNode(child, context, num++);\n cstNodeObj.content.push(hydrated);\n }\n }\n return cstNodeObj;\n }\n\n protected hydrateCstLeafNode(cstNode: any): LeafCstNode {\n const tokenType = this.getTokenType(cstNode.tokenType);\n const offset = cstNode.offset;\n const length = cstNode.length;\n const startLine = cstNode.startLine;\n const startColumn = cstNode.startColumn;\n const endLine = cstNode.endLine;\n const endColumn = cstNode.endColumn;\n const hidden = cstNode.hidden;\n const node = new LeafCstNodeImpl(\n offset,\n length,\n {\n start: {\n line: startLine,\n character: startColumn\n },\n end: {\n line: endLine,\n character: endColumn\n }\n },\n tokenType,\n hidden\n );\n return node;\n }\n\n protected getTokenType(name: string): TokenType {\n return this.lexer.definition[name];\n }\n\n protected getGrammarElementId(node: AbstractElement): number | undefined {\n if (this.grammarElementIdMap.size === 0) {\n this.createGrammarElementIdMap();\n }\n return this.grammarElementIdMap.get(node);\n }\n\n protected getGrammarElement(id: number): AbstractElement {\n if (this.grammarElementIdMap.size === 0) {\n this.createGrammarElementIdMap();\n }\n const element = this.grammarElementIdMap.getKey(id);\n if (element) {\n return element;\n } else {\n throw new Error('Invalid grammar element id: ' + id);\n }\n }\n\n protected createGrammarElementIdMap(): void {\n let id = 0;\n for (const element of streamAst(this.grammar)) {\n if (isAbstractElement(element)) {\n this.grammarElementIdMap.set(element, id++);\n }\n }\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n******************************************************************************/\n\nimport type { Module } from './dependency-injection.js';\nimport type { LangiumDefaultCoreServices, LangiumDefaultSharedCoreServices, LangiumCoreServices, LangiumSharedCoreServices } from './services.js';\nimport type { FileSystemProvider } from './workspace/file-system-provider.js';\nimport { createGrammarConfig } from './languages/grammar-config.js';\nimport { createCompletionParser } from './parser/completion-parser-builder.js';\nimport { createLangiumParser } from './parser/langium-parser-builder.js';\nimport { DefaultTokenBuilder } from './parser/token-builder.js';\nimport { DefaultValueConverter } from './parser/value-converter.js';\nimport { DefaultLinker } from './references/linker.js';\nimport { DefaultNameProvider } from './references/name-provider.js';\nimport { DefaultReferences } from './references/references.js';\nimport { DefaultScopeComputation } from './references/scope-computation.js';\nimport { DefaultScopeProvider } from './references/scope-provider.js';\nimport { DefaultJsonSerializer } from './serializer/json-serializer.js';\nimport { DefaultServiceRegistry } from './service-registry.js';\nimport { DefaultDocumentValidator } from './validation/document-validator.js';\nimport { ValidationRegistry } from './validation/validation-registry.js';\nimport { DefaultAstNodeDescriptionProvider, DefaultReferenceDescriptionProvider } from './workspace/ast-descriptions.js';\nimport { DefaultAstNodeLocator } from './workspace/ast-node-locator.js';\nimport { DefaultConfigurationProvider } from './workspace/configuration.js';\nimport { DefaultDocumentBuilder } from './workspace/document-builder.js';\nimport { DefaultLangiumDocumentFactory, DefaultLangiumDocuments } from './workspace/documents.js';\nimport { DefaultIndexManager } from './workspace/index-manager.js';\nimport { DefaultWorkspaceManager } from './workspace/workspace-manager.js';\nimport { DefaultLexer } from './parser/lexer.js';\nimport { JSDocDocumentationProvider } from './documentation/documentation-provider.js';\nimport { DefaultCommentProvider } from './documentation/comment-provider.js';\nimport { LangiumParserErrorMessageProvider } from './parser/langium-parser.js';\nimport { DefaultAsyncParser } from './parser/async-parser.js';\nimport { DefaultWorkspaceLock } from './workspace/workspace-lock.js';\nimport { DefaultHydrator } from './serializer/hydrator.js';\n\n/**\n * Context required for creating the default language-specific dependency injection module.\n */\nexport interface DefaultCoreModuleContext {\n shared: LangiumSharedCoreServices;\n}\n\n/**\n * Creates a dependency injection module configuring the default core services.\n * This is a set of services that are dedicated to a specific language.\n */\nexport function createDefaultCoreModule(context: DefaultCoreModuleContext): Module {\n return {\n documentation: {\n CommentProvider: (services) => new DefaultCommentProvider(services),\n DocumentationProvider: (services) => new JSDocDocumentationProvider(services)\n },\n parser: {\n AsyncParser: (services) => new DefaultAsyncParser(services),\n GrammarConfig: (services) => createGrammarConfig(services),\n LangiumParser: (services) => createLangiumParser(services),\n CompletionParser: (services) => createCompletionParser(services),\n ValueConverter: () => new DefaultValueConverter(),\n TokenBuilder: () => new DefaultTokenBuilder(),\n Lexer: (services) => new DefaultLexer(services),\n ParserErrorMessageProvider: () => new LangiumParserErrorMessageProvider()\n },\n workspace: {\n AstNodeLocator: () => new DefaultAstNodeLocator(),\n AstNodeDescriptionProvider: (services) => new DefaultAstNodeDescriptionProvider(services),\n ReferenceDescriptionProvider: (services) => new DefaultReferenceDescriptionProvider(services)\n },\n references: {\n Linker: (services) => new DefaultLinker(services),\n NameProvider: () => new DefaultNameProvider(),\n ScopeProvider: (services) => new DefaultScopeProvider(services),\n ScopeComputation: (services) => new DefaultScopeComputation(services),\n References: (services) => new DefaultReferences(services)\n },\n serializer: {\n Hydrator: (services) => new DefaultHydrator(services),\n JsonSerializer: (services) => new DefaultJsonSerializer(services)\n },\n validation: {\n DocumentValidator: (services) => new DefaultDocumentValidator(services),\n ValidationRegistry: (services) => new ValidationRegistry(services)\n },\n shared: () => context.shared\n };\n}\n\n/**\n * Context required for creating the default shared dependency injection module.\n */\nexport interface DefaultSharedCoreModuleContext {\n /**\n * Factory function to create a {@link FileSystemProvider}.\n *\n * Langium exposes an `EmptyFileSystem` and `NodeFileSystem`, exported through `langium/node`.\n * When running Langium as part of a vscode language server or a Node.js app, using the `NodeFileSystem` is recommended,\n * the `EmptyFileSystem` in every other use case.\n */\n fileSystemProvider: (services: LangiumSharedCoreServices) => FileSystemProvider;\n}\n\n/**\n * Creates a dependency injection module configuring the default shared core services.\n * This is the set of services that are shared between multiple languages.\n */\nexport function createDefaultSharedCoreModule(context: DefaultSharedCoreModuleContext): Module {\n return {\n ServiceRegistry: () => new DefaultServiceRegistry(),\n workspace: {\n LangiumDocuments: (services) => new DefaultLangiumDocuments(services),\n LangiumDocumentFactory: (services) => new DefaultLangiumDocumentFactory(services),\n DocumentBuilder: (services) => new DefaultDocumentBuilder(services),\n IndexManager: (services) => new DefaultIndexManager(services),\n WorkspaceManager: (services) => new DefaultWorkspaceManager(services),\n FileSystemProvider: (services) => context.fileSystemProvider(services),\n WorkspaceLock: () => new DefaultWorkspaceLock(),\n ConfigurationProvider: (services) => new DefaultConfigurationProvider(services)\n }\n };\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * A `Module` is a description of possibly grouped service factories.\n *\n * Given a type I = { group: { service: A } },\n * Module := { group: { service: (injector: I) => A } }\n *\n * Making `I` available during the creation of `I` allows us to create cyclic\n * dependencies.\n */\nexport type Module = {\n [K in keyof T]: Module | ((injector: I) => T[K])\n}\n\nexport namespace Module {\n export const merge = (m1: Module, m2: Module) => (_merge(_merge({}, m1), m2) as Module);\n}\n\n/**\n * Given a set of modules, the inject function returns a lazily evaluated injector\n * that injects dependencies into the requested service when it is requested the\n * first time. Subsequent requests will return the same service.\n *\n * In the case of cyclic dependencies, an Error will be thrown. This can be fixed\n * by injecting a provider `() => T` instead of a `T`.\n *\n * Please note that the arguments may be objects or arrays. However, the result will\n * be an object. Using it with for..of will have no effect.\n *\n * @param module1 first Module\n * @param module2 (optional) second Module\n * @param module3 (optional) third Module\n * @param module4 (optional) fourth Module\n * @param module5 (optional) fifth Module\n * @param module6 (optional) sixth Module\n * @param module7 (optional) seventh Module\n * @param module8 (optional) eighth Module\n * @param module9 (optional) ninth Module\n * @returns a new object of type I\n */\nexport function inject(\n module1: Module, module2?: Module, module3?: Module, module4?: Module, module5?: Module, module6?: Module, module7?: Module, module8?: Module, module9?: Module\n): I {\n const module = [module1, module2, module3, module4, module5, module6, module7, module8, module9].reduce(_merge, {}) as Module;\n return _inject(module);\n}\n\nconst isProxy = Symbol('isProxy');\n\n/**\n * Eagerly load all services in the given dependency injection container. This is sometimes\n * necessary because services can register event listeners in their constructors.\n */\nexport function eagerLoad(item: T): T {\n if (item && (item as any)[isProxy]) {\n for (const value of Object.values(item)) {\n eagerLoad(value);\n }\n }\n return item;\n}\n\n/**\n * Helper function that returns an injector by creating a proxy.\n * Invariant: injector is of type I. If injector is undefined, then T = I.\n */\nfunction _inject(module: Module, injector?: any): T {\n const proxy: any = new Proxy({} as any, {\n deleteProperty: () => false,\n get: (obj, prop) => _resolve(obj, prop, module, injector || proxy),\n getOwnPropertyDescriptor: (obj, prop) => (_resolve(obj, prop, module, injector || proxy), Object.getOwnPropertyDescriptor(obj, prop)), // used by for..in\n has: (_, prop) => prop in module, // used by ..in..\n ownKeys: () => [...Reflect.ownKeys(module), isProxy] // used by for..in\n });\n proxy[isProxy] = true;\n return proxy;\n}\n\n/**\n * Internally used to tag a requested dependency, directly before calling the factory.\n * This allows us to find cycles during instance creation.\n */\nconst __requested__ = Symbol();\n\n/**\n * Returns the value `obj[prop]`. If the value does not exist, yet, it is resolved from\n * the module description. The result of service factories is cached. Groups are\n * recursively proxied.\n *\n * @param obj an object holding all group proxies and services\n * @param prop the key of a value within obj\n * @param module an object containing groups and service factories\n * @param injector the first level proxy that provides access to all values\n * @returns the requested value `obj[prop]`\n * @throws Error if a dependency cycle is detected\n */\nfunction _resolve(obj: any, prop: string | symbol | number, module: Module, injector: I): T[keyof T] | undefined {\n if (prop in obj) {\n if (obj[prop] instanceof Error) {\n throw new Error('Construction failure. Please make sure that your dependencies are constructable.', {cause: obj[prop]});\n }\n if (obj[prop] === __requested__) {\n throw new Error('Cycle detected. Please make \"' + String(prop) + '\" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');\n }\n return obj[prop];\n } else if (prop in module) {\n const value: Module | ((injector: I) => T[keyof T]) = module[prop as keyof T];\n obj[prop] = __requested__;\n try {\n obj[prop] = (typeof value === 'function') ? value(injector) : _inject(value, injector);\n } catch (error) {\n obj[prop] = error instanceof Error ? error : undefined;\n throw error;\n }\n return obj[prop];\n } else {\n return undefined;\n }\n}\n\n/**\n * Performs a deep-merge of two modules by writing source entries into the target module.\n *\n * @param target the module which is written\n * @param source the module which is read\n * @returns the target module\n */\nfunction _merge(target: Module, source?: Module): Module {\n if (source) {\n for (const [key, value2] of Object.entries(source)) {\n if (value2 !== undefined) {\n const value1 = target[key];\n if (value1 !== null && value2 !== null && typeof value1 === 'object' && typeof value2 === 'object') {\n target[key] = _merge(value1, value2);\n } else {\n target[key] = value2;\n }\n }\n }\n }\n return target;\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { DocumentHighlightParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { FindReferencesOptions, References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { ReferenceDescription } from '../workspace/ast-descriptions.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport { DocumentHighlight } from 'vscode-languageserver';\nimport { getDocument } from '../utils/ast-utils.js';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\nimport { UriUtils } from '../utils/uri-utils.js';\n\n/**\n * Language-specific service for handling document highlight requests.\n */\nexport interface DocumentHighlightProvider {\n /**\n * Handle a document highlight request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getDocumentHighlight(document: LangiumDocument, params: DocumentHighlightParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport class DefaultDocumentHighlightProvider implements DocumentHighlightProvider {\n protected readonly references: References;\n protected readonly nameProvider: NameProvider;\n protected readonly grammarConfig: GrammarConfig;\n\n constructor(services: LangiumServices) {\n this.references = services.references.References;\n this.nameProvider = services.references.NameProvider;\n this.grammarConfig = services.parser.GrammarConfig;\n }\n\n getDocumentHighlight(document: LangiumDocument, params: DocumentHighlightParams): MaybePromise {\n const rootNode = document.parseResult.value.$cstNode;\n if (!rootNode) {\n return undefined;\n }\n const selectedNode = findDeclarationNodeAtOffset(rootNode, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp);\n if (!selectedNode) {\n return undefined;\n }\n const targetAstNode = this.references.findDeclaration(selectedNode);\n if (targetAstNode) {\n const includeDeclaration = UriUtils.equals(getDocument(targetAstNode).uri, document.uri);\n const options: FindReferencesOptions = { documentUri: document.uri, includeDeclaration };\n const references = this.references.findReferences(targetAstNode, options);\n return references.map(ref => this.createDocumentHighlight(ref)).toArray();\n }\n return undefined;\n }\n\n /**\n * Override this method to determine the highlight kind of the given reference.\n */\n protected createDocumentHighlight(reference: ReferenceDescription): DocumentHighlight {\n return DocumentHighlight.create(reference.segment.range);\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { DocumentSymbol, DocumentSymbolParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport { streamContents } from '../utils/ast-utils.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport type { NodeKindProvider } from './node-kind-provider.js';\n\n/**\n * Language-specific service for handling document symbols requests.\n */\nexport interface DocumentSymbolProvider {\n /**\n * Handle a document symbols request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getSymbols(document: LangiumDocument, params: DocumentSymbolParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport class DefaultDocumentSymbolProvider implements DocumentSymbolProvider {\n\n protected readonly nameProvider: NameProvider;\n protected readonly nodeKindProvider: NodeKindProvider;\n\n constructor(services: LangiumServices) {\n this.nameProvider = services.references.NameProvider;\n this.nodeKindProvider = services.shared.lsp.NodeKindProvider;\n }\n\n getSymbols(document: LangiumDocument): MaybePromise {\n return this.getSymbol(document, document.parseResult.value);\n }\n\n protected getSymbol(document: LangiumDocument, astNode: AstNode): DocumentSymbol[] {\n const node = astNode.$cstNode;\n const nameNode = this.nameProvider.getNameNode(astNode);\n if (nameNode && node) {\n const name = this.nameProvider.getName(astNode);\n return [{\n kind: this.nodeKindProvider.getSymbolKind(astNode),\n name: name ?? nameNode.text,\n range: node.range,\n selectionRange: nameNode.range,\n children: this.getChildSymbols(document, astNode)\n }];\n } else {\n return this.getChildSymbols(document, astNode) || [];\n }\n }\n\n protected getChildSymbols(document: LangiumDocument, astNode: AstNode): DocumentSymbol[] | undefined {\n const children: DocumentSymbol[] = [];\n\n for (const child of streamContents(astNode)) {\n const result = this.getSymbol(document, child);\n children.push(...result);\n }\n if (children.length > 0) {\n return children;\n }\n return undefined;\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { DidChangeWatchedFilesNotification, FileChangeType, type DidChangeWatchedFilesParams, type DidChangeWatchedFilesRegistrationOptions, type TextDocumentChangeEvent } from 'vscode-languageserver';\nimport { stream } from '../utils/stream.js';\nimport { URI } from '../utils/uri-utils.js';\nimport type { DocumentBuilder } from '../workspace/document-builder.js';\nimport type { TextDocument } from '../workspace/documents.js';\nimport type { WorkspaceLock } from '../workspace/workspace-lock.js';\nimport type { LangiumSharedServices } from './lsp-services.js';\nimport type { WorkspaceManager } from '../workspace/workspace-manager.js';\n\n/**\n * Shared service for handling text document changes and watching relevant files.\n */\nexport interface DocumentUpdateHandler {\n\n /**\n * A content change event was triggered by the `TextDocuments` service.\n */\n didChangeContent(change: TextDocumentChangeEvent): void;\n\n /**\n * The client detected changes to files and folders watched by the language client.\n */\n didChangeWatchedFiles(params: DidChangeWatchedFilesParams): void;\n\n}\n\nexport class DefaultDocumentUpdateHandler implements DocumentUpdateHandler {\n\n protected readonly workspaceManager: WorkspaceManager;\n protected readonly documentBuilder: DocumentBuilder;\n protected readonly workspaceLock: WorkspaceLock;\n\n constructor(services: LangiumSharedServices) {\n this.workspaceManager = services.workspace.WorkspaceManager;\n this.documentBuilder = services.workspace.DocumentBuilder;\n this.workspaceLock = services.workspace.WorkspaceLock;\n\n let canRegisterFileWatcher = false;\n services.lsp.LanguageServer.onInitialize(params => {\n canRegisterFileWatcher = Boolean(params.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration);\n });\n\n services.lsp.LanguageServer.onInitialized(_params => {\n if (canRegisterFileWatcher) {\n this.registerFileWatcher(services);\n }\n });\n }\n\n protected registerFileWatcher(services: LangiumSharedServices): void {\n const fileExtensions = stream(services.ServiceRegistry.all)\n .flatMap(language => language.LanguageMetaData.fileExtensions)\n .map(ext => ext.startsWith('.') ? ext.substring(1) : ext)\n .distinct()\n .toArray();\n if (fileExtensions.length > 0) {\n const connection = services.lsp.Connection;\n const options: DidChangeWatchedFilesRegistrationOptions = {\n watchers: [{\n globPattern: fileExtensions.length === 1\n ? `**/*.${fileExtensions[0]}`\n : `**/*.{${fileExtensions.join(',')}}`\n }]\n };\n connection?.client.register(DidChangeWatchedFilesNotification.type, options);\n }\n }\n\n protected fireDocumentUpdate(changed: URI[], deleted: URI[]): void {\n // Only fire the document update when the workspace manager is ready\n // Otherwise, we might miss the initial indexing of the workspace\n this.workspaceManager.ready.then(() => {\n this.workspaceLock.write(token => this.documentBuilder.update(changed, deleted, token));\n }).catch(err => {\n // This should never happen, but if it does, we want to know about it\n console.error('Workspace initialization failed. Could not perform document update.', err);\n });\n }\n\n didChangeContent(change: TextDocumentChangeEvent): void {\n this.fireDocumentUpdate([URI.parse(change.document.uri)], []);\n }\n\n didChangeWatchedFiles(params: DidChangeWatchedFilesParams): void {\n const changedUris = stream(params.changes)\n .filter(c => c.type !== FileChangeType.Deleted)\n .distinct(c => c.uri)\n .map(c => URI.parse(c.uri))\n .toArray();\n const deletedUris = stream(params.changes)\n .filter(c => c.type === FileChangeType.Deleted)\n .distinct(c => c.uri)\n .map(c => URI.parse(c.uri))\n .toArray();\n this.fireDocumentUpdate(changedUris, deletedUris);\n }\n\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { FoldingRangeParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { AstNode, CstNode } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport { FoldingRange, FoldingRangeKind } from 'vscode-languageserver';\nimport { streamAllContents } from '../utils/ast-utils.js';\nimport { flattenCst } from '../utils/cst-utils.js';\n\n/**\n * Language-specific service for handling folding range requests.\n */\nexport interface FoldingRangeProvider {\n /**\n * Handle a folding range request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getFoldingRanges(document: LangiumDocument, params: FoldingRangeParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport type FoldingRangeAcceptor = (foldingRange: FoldingRange) => void;\n\nexport class DefaultFoldingRangeProvider implements FoldingRangeProvider {\n\n protected readonly commentNames: string[];\n\n constructor(services: LangiumServices) {\n this.commentNames = services.parser.GrammarConfig.multilineCommentRules;\n }\n\n getFoldingRanges(document: LangiumDocument): MaybePromise {\n const foldings: FoldingRange[] = [];\n const acceptor: FoldingRangeAcceptor = (foldingRange) => foldings.push(foldingRange);\n this.collectFolding(document, acceptor);\n return foldings;\n }\n\n protected collectFolding(document: LangiumDocument, acceptor: FoldingRangeAcceptor): void {\n const root = document.parseResult?.value;\n if (root) {\n if (this.shouldProcessContent(root)) {\n const treeIterator = streamAllContents(root).iterator();\n let result: IteratorResult;\n do {\n result = treeIterator.next();\n if (!result.done) {\n const node = result.value;\n if (this.shouldProcess(node)) {\n this.collectObjectFolding(document, node, acceptor);\n }\n if (!this.shouldProcessContent(node)) {\n treeIterator.prune();\n }\n }\n } while (!result.done);\n }\n\n this.collectCommentFolding(document, root, acceptor);\n }\n }\n\n /**\n * Template method to determine whether the specified `AstNode` should be handled by the folding range provider.\n * Returns true by default for all nodes. Returning false only ignores the specified node and not its content.\n * To ignore the content of a node use `shouldProcessContent`.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected shouldProcess(node: AstNode): boolean {\n return true;\n }\n\n /**\n * Template method to determine whether the content/children of the specified `AstNode` should be handled by the folding range provider.\n * Returns true by default for all nodes. Returning false ignores _all_ content of this node, even transitive ones.\n * For more precise control over foldings use the `shouldProcess` method.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected shouldProcessContent(node: AstNode): boolean {\n return true;\n }\n\n protected collectObjectFolding(document: LangiumDocument, node: AstNode, acceptor: FoldingRangeAcceptor): void {\n const cstNode = node.$cstNode;\n if (cstNode) {\n const foldingRange = this.toFoldingRange(document, cstNode);\n if (foldingRange) {\n acceptor(foldingRange);\n }\n }\n }\n\n protected collectCommentFolding(document: LangiumDocument, node: AstNode, acceptor: FoldingRangeAcceptor): void {\n const cstNode = node.$cstNode;\n if (cstNode) {\n for (const node of flattenCst(cstNode)) {\n if (this.commentNames.includes(node.tokenType.name)) {\n const foldingRange = this.toFoldingRange(document, node, FoldingRangeKind.Comment);\n if (foldingRange) {\n acceptor(foldingRange);\n }\n }\n }\n }\n }\n\n protected toFoldingRange(document: LangiumDocument, node: CstNode, kind?: string): FoldingRange | undefined {\n const range = node.range;\n const start = range.start;\n let end = range.end;\n // Don't generate foldings for nodes that are less than 3 lines\n if (end.line - start.line < 2) {\n return undefined;\n }\n // As we don't want to hide the end token like 'if { ... --> } <--',\n // we simply select the end of the previous line as the end position\n if (!this.includeLastFoldingLine(node, kind)) {\n end = document.textDocument.positionAt(document.textDocument.offsetAt({ line: end.line, character: 0 }) - 1);\n }\n return FoldingRange.create(start.line, end.line, start.character, end.character, kind);\n }\n\n /**\n * Template method to determine whether the folding range for this cst node should include its last line.\n * Returns false by default for ast nodes which end in braces and for comments.\n */\n protected includeLastFoldingLine(node: CstNode, kind?: string): boolean {\n if (kind === FoldingRangeKind.Comment) {\n return false;\n }\n\n const nodeText = node.text;\n const endChar = nodeText.charAt(nodeText.length - 1);\n if (endChar === '}' || endChar === ')' || endChar === ']') {\n return false;\n }\n\n return true;\n }\n\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/**\n * This service implements a [fuzzy matching](https://en.wikipedia.org/wiki/Approximate_string_matching) method.\n */\nexport interface FuzzyMatcher {\n /**\n * Performs [fuzzy matching](https://en.wikipedia.org/wiki/Approximate_string_matching).\n *\n * Fuzzy matching improves search/completion user experience by allowing to omit characters.\n * For example, a query such as `FuMa` matches the text `FuzzyMatcher`.\n *\n * @param query The user input search query.\n * @param text The text that should be matched against the query.\n * @returns Whether the query matches the text.\n */\n match(query: string, text: string): boolean;\n}\n\nexport class DefaultFuzzyMatcher implements FuzzyMatcher {\n\n match(query: string, text: string): boolean {\n if (query.length === 0) {\n return true;\n }\n\n text = text.toLowerCase();\n let matchedFirstCharacter = false;\n let previous: number | undefined;\n let character = 0;\n const len = text.length;\n for (let i = 0; i < len; i++) {\n const strChar = text.charCodeAt(i);\n const testChar = query.charCodeAt(character);\n if (strChar === testChar || this.toUpperCharCode(strChar) === this.toUpperCharCode(testChar)) {\n matchedFirstCharacter ||=\n previous === undefined || // Beginning of word\n this.isWordTransition(previous, strChar);\n if (matchedFirstCharacter) {\n character++;\n }\n if (character === query.length) {\n return true;\n }\n }\n previous = strChar;\n }\n return false;\n }\n\n protected isWordTransition(previous: number, current: number): boolean {\n return a <= previous && previous <= z && A <= current && current <= Z || // camelCase transition\n previous === _ && current !== _; // snake_case transition\n }\n\n protected toUpperCharCode(charCode: number) {\n if (a <= charCode && charCode <= z) {\n return charCode - 32;\n }\n return charCode;\n }\n}\n\nconst a = 'a'.charCodeAt(0);\nconst z = 'z'.charCodeAt(0);\nconst A = 'A'.charCodeAt(0);\nconst Z = 'Z'.charCodeAt(0);\nconst _ = '_'.charCodeAt(0);\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Hover, HoverParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport type { DocumentationProvider } from '../documentation/documentation-provider.js';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\n\n/**\n * Language-specific service for handling hover requests.\n */\nexport interface HoverProvider {\n /**\n * Handle a hover request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getHoverContent(document: LangiumDocument, params: HoverParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport abstract class AstNodeHoverProvider implements HoverProvider {\n\n protected readonly references: References;\n protected readonly grammarConfig: GrammarConfig;\n\n constructor(services: LangiumServices) {\n this.references = services.references.References;\n this.grammarConfig = services.parser.GrammarConfig;\n }\n\n getHoverContent(document: LangiumDocument, params: HoverParams): MaybePromise {\n const rootNode = document.parseResult?.value?.$cstNode;\n if (rootNode) {\n const offset = document.textDocument.offsetAt(params.position);\n const cstNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp);\n if (cstNode && cstNode.offset + cstNode.length > offset) {\n const targetNode = this.references.findDeclaration(cstNode);\n if (targetNode) {\n return this.getAstNodeHoverContent(targetNode);\n }\n }\n }\n return undefined;\n }\n\n protected abstract getAstNodeHoverContent(node: AstNode): MaybePromise;\n\n}\n\nexport class MultilineCommentHoverProvider extends AstNodeHoverProvider {\n\n protected readonly documentationProvider: DocumentationProvider;\n\n constructor(services: LangiumServices) {\n super(services);\n this.documentationProvider = services.documentation.DocumentationProvider;\n }\n\n protected getAstNodeHoverContent(node: AstNode): MaybePromise {\n const content = this.documentationProvider.getDocumentation(node);\n\n if (content) {\n return {\n contents: {\n kind: 'markdown',\n value: content\n }\n };\n }\n return undefined;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type {\n CallHierarchyIncomingCallsParams,\n CallHierarchyOutgoingCallsParams,\n CancellationToken,\n Connection,\n Disposable,\n Event,\n HandlerResult,\n InitializedParams,\n InitializeParams,\n InitializeResult,\n RequestHandler,\n SemanticTokens,\n SemanticTokensDelta,\n SemanticTokensDeltaParams,\n SemanticTokensDeltaPartialResult,\n SemanticTokensParams,\n SemanticTokensPartialResult,\n SemanticTokensRangeParams,\n ServerRequestHandler,\n TextDocumentIdentifier,\n TypeHierarchySubtypesParams,\n TypeHierarchySupertypesParams\n} from 'vscode-languageserver';\nimport { DidChangeConfigurationNotification, Emitter, LSPErrorCodes, ResponseError, TextDocumentSyncKind } from 'vscode-languageserver-protocol';\nimport { eagerLoad } from '../dependency-injection.js';\nimport type { LangiumCoreServices } from '../services.js';\nimport { isOperationCancelled } from '../utils/promise-utils.js';\nimport { URI } from '../utils/uri-utils.js';\nimport type { ConfigurationInitializedParams } from '../workspace/configuration.js';\nimport { DocumentState, type LangiumDocument } from '../workspace/documents.js';\nimport { mergeCompletionProviderOptions } from './completion/completion-provider.js';\nimport type { LangiumSharedServices, PartialLangiumLSPServices } from './lsp-services.js';\nimport { DefaultSemanticTokenOptions } from './semantic-token-provider.js';\nimport { mergeSignatureHelpOptions } from './signature-help-provider.js';\n\nexport interface LanguageServer {\n initialize(params: InitializeParams): Promise\n initialized(params: InitializedParams): void\n onInitialize(callback: (params: InitializeParams) => void): Disposable\n onInitialized(callback: (params: InitializedParams) => void): Disposable\n}\n\n/**\n * Language-specific core and optional LSP services.\n * To be used while accessing the language-specific services via the service registry without a-priori knowledge about the presence of LSP services for the particular languages.\n * Shared services should be accessed via the language server's `services` property.\n */\nexport type LangiumCoreAndPartialLSPServices = Omit\n\nexport class DefaultLanguageServer implements LanguageServer {\n\n protected onInitializeEmitter = new Emitter();\n protected onInitializedEmitter = new Emitter();\n\n protected readonly services: LangiumSharedServices;\n\n constructor(services: LangiumSharedServices) {\n this.services = services;\n }\n\n get onInitialize(): Event {\n return this.onInitializeEmitter.event;\n }\n\n get onInitialized(): Event {\n return this.onInitializedEmitter.event;\n }\n\n async initialize(params: InitializeParams): Promise {\n this.eagerLoadServices();\n\n this.fireInitializeOnDefaultServices(params);\n\n this.onInitializeEmitter.fire(params);\n this.onInitializeEmitter.dispose();\n return this.buildInitializeResult(params);\n }\n\n /**\n * Eagerly loads all services before emitting the `onInitialize` event.\n * Ensures that all services are able to catch the event.\n */\n protected eagerLoadServices(): void {\n eagerLoad(this.services);\n this.services.ServiceRegistry.all.forEach(language => eagerLoad(language));\n }\n\n protected hasService(callback: (language: LangiumCoreAndPartialLSPServices) => object | undefined): boolean {\n const allServices: readonly LangiumCoreAndPartialLSPServices[] = this.services.ServiceRegistry.all;\n return allServices.some(services => callback(services) !== undefined);\n }\n\n protected buildInitializeResult(_params: InitializeParams): InitializeResult {\n const fileOperationOptions = this.services.lsp.FileOperationHandler?.fileOperationOptions;\n const allServices: readonly LangiumCoreAndPartialLSPServices[] = this.services.ServiceRegistry.all;\n const hasFormattingService = this.hasService(e => e.lsp?.Formatter);\n const formattingOnTypeOptions = allServices.map(e => e.lsp?.Formatter?.formatOnTypeOptions).find(e => Boolean(e));\n const hasCodeActionProvider = this.hasService(e => e.lsp?.CodeActionProvider);\n const hasSemanticTokensProvider = this.hasService(e => e.lsp?.SemanticTokenProvider);\n const commandNames = this.services.lsp?.ExecuteCommandHandler?.commands;\n const hasDocumentLinkProvider = this.hasService(e => e.lsp?.DocumentLinkProvider);\n const signatureHelpOptions = mergeSignatureHelpOptions(allServices.map(e => e.lsp?.SignatureHelp?.signatureHelpOptions));\n const hasGoToTypeProvider = this.hasService(e => e.lsp?.TypeProvider);\n const hasGoToImplementationProvider = this.hasService(e => e.lsp?.ImplementationProvider);\n const hasCompletionProvider = this.hasService(e => e.lsp?.CompletionProvider);\n const completionOptions = mergeCompletionProviderOptions(allServices.map(e => e.lsp?.CompletionProvider?.completionOptions));\n const hasReferencesProvider = this.hasService(e => e.lsp?.ReferencesProvider);\n const hasDocumentSymbolProvider = this.hasService(e => e.lsp?.DocumentSymbolProvider);\n const hasDefinitionProvider = this.hasService(e => e.lsp?.DefinitionProvider);\n const hasDocumentHighlightProvider = this.hasService(e => e.lsp?.DocumentHighlightProvider);\n const hasFoldingRangeProvider = this.hasService(e => e.lsp?.FoldingRangeProvider);\n const hasHoverProvider = this.hasService(e => e.lsp?.HoverProvider);\n const hasRenameProvider = this.hasService(e => e.lsp?.RenameProvider);\n const hasCallHierarchyProvider = this.hasService(e => e.lsp?.CallHierarchyProvider);\n const hasTypeHierarchyProvider = this.hasService((e) => e.lsp?.TypeHierarchyProvider);\n const hasCodeLensProvider = this.hasService(e => e.lsp?.CodeLensProvider);\n const hasDeclarationProvider = this.hasService(e => e.lsp?.DeclarationProvider);\n const hasInlayHintProvider = this.hasService(e => e.lsp?.InlayHintProvider);\n const workspaceSymbolProvider = this.services.lsp?.WorkspaceSymbolProvider;\n\n const result: InitializeResult = {\n capabilities: {\n workspace: {\n workspaceFolders: {\n supported: true\n },\n fileOperations: fileOperationOptions\n },\n executeCommandProvider: commandNames && {\n commands: commandNames\n },\n textDocumentSync: TextDocumentSyncKind.Incremental,\n completionProvider: hasCompletionProvider ? completionOptions : undefined,\n referencesProvider: hasReferencesProvider,\n documentSymbolProvider: hasDocumentSymbolProvider,\n definitionProvider: hasDefinitionProvider,\n typeDefinitionProvider: hasGoToTypeProvider,\n documentHighlightProvider: hasDocumentHighlightProvider,\n codeActionProvider: hasCodeActionProvider,\n documentFormattingProvider: hasFormattingService,\n documentRangeFormattingProvider: hasFormattingService,\n documentOnTypeFormattingProvider: formattingOnTypeOptions,\n foldingRangeProvider: hasFoldingRangeProvider,\n hoverProvider: hasHoverProvider,\n renameProvider: hasRenameProvider ? {\n prepareProvider: true\n } : undefined,\n semanticTokensProvider: hasSemanticTokensProvider\n ? DefaultSemanticTokenOptions\n : undefined,\n signatureHelpProvider: signatureHelpOptions,\n implementationProvider: hasGoToImplementationProvider,\n callHierarchyProvider: hasCallHierarchyProvider\n ? {}\n : undefined,\n typeHierarchyProvider: hasTypeHierarchyProvider\n ? {}\n : undefined,\n documentLinkProvider: hasDocumentLinkProvider\n ? { resolveProvider: false }\n : undefined,\n codeLensProvider: hasCodeLensProvider\n ? { resolveProvider: false }\n : undefined,\n declarationProvider: hasDeclarationProvider,\n inlayHintProvider: hasInlayHintProvider\n ? { resolveProvider: false }\n : undefined,\n workspaceSymbolProvider: workspaceSymbolProvider\n ? { resolveProvider: Boolean(workspaceSymbolProvider.resolveSymbol) }\n : undefined\n }\n };\n\n return result;\n }\n\n initialized(params: InitializedParams): void {\n this.fireInitializedOnDefaultServices(params);\n\n this.onInitializedEmitter.fire(params);\n this.onInitializedEmitter.dispose();\n }\n\n protected fireInitializeOnDefaultServices(params: InitializeParams): void {\n this.services.workspace.ConfigurationProvider.initialize(params);\n this.services.workspace.WorkspaceManager.initialize(params);\n }\n\n protected fireInitializedOnDefaultServices(params: InitializedParams): void {\n const connection = this.services.lsp.Connection;\n const configurationParams = connection ? {\n ...params,\n register: params => connection.client.register(DidChangeConfigurationNotification.type, params),\n fetchConfiguration: params => connection.workspace.getConfiguration(params)\n } : params;\n\n // do not await the promises of the following calls, as they must not block the initialization process!\n // otherwise, there is the danger of out-of-order processing of subsequent incoming messages from the language client\n // however, awaiting should be possible in general, e.g. in unit test scenarios\n this.services.workspace.ConfigurationProvider.initialized(configurationParams)\n .catch(err => console.error('Error in ConfigurationProvider initialization:', err));\n this.services.workspace.WorkspaceManager.initialized(params)\n .catch(err => console.error('Error in WorkspaceManager initialization:', err));\n }\n}\n\nexport function startLanguageServer(services: LangiumSharedServices): void {\n const connection = services.lsp.Connection;\n if (!connection) {\n throw new Error('Starting a language server requires the languageServer.Connection service to be set.');\n }\n\n addDocumentUpdateHandler(connection, services);\n addFileOperationHandler(connection, services);\n addDiagnosticsHandler(connection, services);\n addCompletionHandler(connection, services);\n addFindReferencesHandler(connection, services);\n addDocumentSymbolHandler(connection, services);\n addGotoDefinitionHandler(connection, services);\n addGoToTypeDefinitionHandler(connection, services);\n addGoToImplementationHandler(connection, services);\n addDocumentHighlightsHandler(connection, services);\n addFoldingRangeHandler(connection, services);\n addFormattingHandler(connection, services);\n addCodeActionHandler(connection, services);\n addRenameHandler(connection, services);\n addHoverHandler(connection, services);\n addInlayHintHandler(connection, services);\n addSemanticTokenHandler(connection, services);\n addExecuteCommandHandler(connection, services);\n addSignatureHelpHandler(connection, services);\n addCallHierarchyHandler(connection, services);\n addTypeHierarchyHandler(connection, services);\n addCodeLensHandler(connection, services);\n addDocumentLinkHandler(connection, services);\n addConfigurationChangeHandler(connection, services);\n addGoToDeclarationHandler(connection, services);\n addWorkspaceSymbolHandler(connection, services);\n\n connection.onInitialize(params => {\n return services.lsp.LanguageServer.initialize(params);\n });\n connection.onInitialized(params => {\n services.lsp.LanguageServer.initialized(params);\n });\n\n // Make the text document manager listen on the connection for open, change and close text document events.\n const documents = services.workspace.TextDocuments;\n documents.listen(connection);\n\n // Start listening for incoming messages from the client.\n connection.listen();\n}\n\n/**\n * Adds a handler for document updates when content changes, or watch catches a change.\n * In the case there is no handler service registered, this function does nothing.\n */\nexport function addDocumentUpdateHandler(connection: Connection, services: LangiumSharedServices): void {\n const handler = services.lsp.DocumentUpdateHandler;\n const documents = services.workspace.TextDocuments;\n documents.onDidChangeContent(change => handler.didChangeContent(change));\n connection.onDidChangeWatchedFiles(params => handler.didChangeWatchedFiles(params));\n}\n\nexport function addFileOperationHandler(connection: Connection, services: LangiumSharedServices): void {\n const handler = services.lsp.FileOperationHandler;\n if (!handler) {\n return;\n }\n if (handler.didCreateFiles) {\n connection.workspace.onDidCreateFiles(params => handler.didCreateFiles!(params));\n }\n if (handler.didRenameFiles) {\n connection.workspace.onDidRenameFiles(params => handler.didRenameFiles!(params));\n }\n if (handler.didDeleteFiles) {\n connection.workspace.onDidDeleteFiles(params => handler.didDeleteFiles!(params));\n }\n if (handler.willCreateFiles) {\n connection.workspace.onWillCreateFiles(params => handler.willCreateFiles!(params));\n }\n if (handler.willRenameFiles) {\n connection.workspace.onWillRenameFiles(params => handler.willRenameFiles!(params));\n }\n if (handler.willDeleteFiles) {\n connection.workspace.onWillDeleteFiles(params => handler.willDeleteFiles!(params));\n }\n}\n\nexport function addDiagnosticsHandler(connection: Connection, services: LangiumSharedServices): void {\n const documentBuilder = services.workspace.DocumentBuilder;\n documentBuilder.onBuildPhase(DocumentState.Validated, async (documents, cancelToken) => {\n for (const document of documents) {\n if (document.diagnostics) {\n connection.sendDiagnostics({\n uri: document.uri.toString(),\n diagnostics: document.diagnostics\n });\n }\n if (cancelToken.isCancellationRequested) {\n return;\n }\n }\n });\n}\n\nexport function addCompletionHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onCompletion(createRequestHandler(\n (services, document, params, cancelToken) => {\n return services.lsp?.CompletionProvider?.getCompletion(document, params, cancelToken);\n },\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addFindReferencesHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onReferences(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.ReferencesProvider?.findReferences(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addCodeActionHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onCodeAction(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.CodeActionProvider?.getCodeActions(document, params, cancelToken),\n services,\n DocumentState.Validated\n ));\n}\n\nexport function addDocumentSymbolHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDocumentSymbol(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.DocumentSymbolProvider?.getSymbols(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n}\n\nexport function addGotoDefinitionHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDefinition(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.DefinitionProvider?.getDefinition(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addGoToTypeDefinitionHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onTypeDefinition(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.TypeProvider?.getTypeDefinition(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addGoToImplementationHandler(connection: Connection, services: LangiumSharedServices) {\n connection.onImplementation(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.ImplementationProvider?.getImplementation(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addGoToDeclarationHandler(connection: Connection, services: LangiumSharedServices) {\n connection.onDeclaration(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.DeclarationProvider?.getDeclaration(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addDocumentHighlightsHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDocumentHighlight(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.DocumentHighlightProvider?.getDocumentHighlight(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addHoverHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onHover(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.HoverProvider?.getHoverContent(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addFoldingRangeHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onFoldingRanges(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.FoldingRangeProvider?.getFoldingRanges(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n}\n\nexport function addFormattingHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDocumentFormatting(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.Formatter?.formatDocument(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n connection.onDocumentRangeFormatting(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.Formatter?.formatDocumentRange(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n connection.onDocumentOnTypeFormatting(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.Formatter?.formatDocumentOnType(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n}\n\nexport function addRenameHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onRenameRequest(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.RenameProvider?.rename(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n connection.onPrepareRename(createRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.RenameProvider?.prepareRename(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addInlayHintHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.languages.inlayHint.on(createServerRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.InlayHintProvider?.getInlayHints(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addSemanticTokenHandler(connection: Connection, services: LangiumSharedServices): void {\n // If no semantic token provider is registered that's fine. Just return an empty result\n const emptyResult: SemanticTokens = { data: [] };\n connection.languages.semanticTokens.on(createServerRequestHandler(\n (services, document, params, cancelToken) => {\n if (services.lsp?.SemanticTokenProvider) {\n return services.lsp.SemanticTokenProvider.semanticHighlight(document, params, cancelToken);\n }\n return emptyResult;\n },\n services,\n DocumentState.IndexedReferences\n ));\n connection.languages.semanticTokens.onDelta(createServerRequestHandler(\n (services, document, params, cancelToken) => {\n if (services.lsp?.SemanticTokenProvider) {\n return services.lsp.SemanticTokenProvider.semanticHighlightDelta(document, params, cancelToken);\n }\n return emptyResult;\n },\n services,\n DocumentState.IndexedReferences\n ));\n connection.languages.semanticTokens.onRange(createServerRequestHandler(\n (services, document, params, cancelToken) => {\n if (services.lsp?.SemanticTokenProvider) {\n return services.lsp.SemanticTokenProvider.semanticHighlightRange(document, params, cancelToken);\n }\n return emptyResult;\n },\n services,\n DocumentState.IndexedReferences\n ));\n}\nexport function addConfigurationChangeHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDidChangeConfiguration(change => {\n if (change.settings) {\n services.workspace.ConfigurationProvider.updateConfiguration(change);\n }\n });\n}\n\nexport function addExecuteCommandHandler(connection: Connection, services: LangiumSharedServices): void {\n const commandHandler = services.lsp.ExecuteCommandHandler;\n if (commandHandler) {\n connection.onExecuteCommand(async (params, token) => {\n try {\n return await commandHandler.executeCommand(params.command, params.arguments ?? [], token);\n } catch (err) {\n return responseError(err);\n }\n });\n }\n}\n\nexport function addDocumentLinkHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onDocumentLinks(createServerRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.DocumentLinkProvider?.getDocumentLinks(document, params, cancelToken),\n services,\n DocumentState.Parsed\n ));\n}\n\nexport function addSignatureHelpHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onSignatureHelp(createServerRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.SignatureHelp?.provideSignatureHelp(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addCodeLensHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.onCodeLens(createServerRequestHandler(\n (services, document, params, cancelToken) => services.lsp?.CodeLensProvider?.provideCodeLens(document, params, cancelToken),\n services,\n DocumentState.IndexedReferences\n ));\n}\n\nexport function addWorkspaceSymbolHandler(connection: Connection, services: LangiumSharedServices): void {\n const workspaceSymbolProvider = services.lsp.WorkspaceSymbolProvider;\n if (workspaceSymbolProvider) {\n const documentBuilder = services.workspace.DocumentBuilder;\n connection.onWorkspaceSymbol(async (params, token) => {\n try {\n await documentBuilder.waitUntil(DocumentState.IndexedContent, token);\n return await workspaceSymbolProvider.getSymbols(params, token);\n } catch (err) {\n return responseError(err);\n }\n });\n const resolveWorkspaceSymbol = workspaceSymbolProvider.resolveSymbol?.bind(workspaceSymbolProvider);\n if (resolveWorkspaceSymbol) {\n connection.onWorkspaceSymbolResolve(async (workspaceSymbol, token) => {\n try {\n await documentBuilder.waitUntil(DocumentState.IndexedContent, token);\n return await resolveWorkspaceSymbol(workspaceSymbol, token);\n } catch (err) {\n return responseError(err);\n }\n });\n }\n }\n}\n\nexport function addCallHierarchyHandler(connection: Connection, services: LangiumSharedServices): void {\n connection.languages.callHierarchy.onPrepare(createServerRequestHandler(\n async (services, document, params, cancelToken) => {\n if (services.lsp?.CallHierarchyProvider) {\n const result = await services.lsp.CallHierarchyProvider.prepareCallHierarchy(document, params, cancelToken);\n return result ?? null;\n }\n return null;\n },\n services,\n DocumentState.IndexedReferences\n ));\n\n connection.languages.callHierarchy.onIncomingCalls(createHierarchyRequestHandler(\n async (services, params, cancelToken) => {\n if (services.lsp?.CallHierarchyProvider) {\n const result = await services.lsp.CallHierarchyProvider.incomingCalls(params, cancelToken);\n return result ?? null;\n }\n return null;\n },\n services\n ));\n\n connection.languages.callHierarchy.onOutgoingCalls(createHierarchyRequestHandler(\n async (services, params, cancelToken) => {\n if (services.lsp?.CallHierarchyProvider) {\n const result = await services.lsp.CallHierarchyProvider.outgoingCalls(params, cancelToken);\n return result ?? null;\n }\n return null;\n },\n services\n ));\n}\n\nexport function addTypeHierarchyHandler(connection: Connection, sharedServices: LangiumSharedServices): void {\n // Don't register type hierarchy handlers if no type hierarchy provider is registered\n if (!sharedServices.ServiceRegistry.all.some((services: LangiumCoreAndPartialLSPServices) => services.lsp?.TypeHierarchyProvider)) {\n return;\n }\n\n connection.languages.typeHierarchy.onPrepare(\n createServerRequestHandler(\n async (services, document, params, cancelToken) => {\n const result = await services.lsp?.TypeHierarchyProvider?.prepareTypeHierarchy(document, params, cancelToken);\n return result ?? null;\n },\n sharedServices,\n DocumentState.IndexedReferences\n ),\n );\n\n connection.languages.typeHierarchy.onSupertypes(\n createHierarchyRequestHandler(\n async (services, params, cancelToken) => {\n const result = await services.lsp?.TypeHierarchyProvider?.supertypes(params, cancelToken);\n return result ?? null;\n },\n sharedServices\n ),\n );\n\n connection.languages.typeHierarchy.onSubtypes(\n createHierarchyRequestHandler(\n async (services, params, cancelToken) => {\n const result = await services.lsp?.TypeHierarchyProvider?.subtypes(params, cancelToken);\n return result ?? null;\n },\n sharedServices\n ),\n );\n}\n\nexport function createHierarchyRequestHandler

(\n serviceCall: (services: LangiumCoreAndPartialLSPServices, params: P, cancelToken: CancellationToken) => HandlerResult,\n sharedServices: LangiumSharedServices,\n): ServerRequestHandler {\n const serviceRegistry = sharedServices.ServiceRegistry;\n return async (params: P, cancelToken: CancellationToken) => {\n const uri = URI.parse(params.item.uri);\n const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, DocumentState.IndexedReferences);\n if (cancellationError) {\n return cancellationError;\n }\n const language = serviceRegistry.getServices(uri);\n if (!language) {\n const message = `Could not find service instance for uri: '${uri.toString()}'`;\n console.error(message);\n throw new Error(message);\n }\n try {\n return await serviceCall(language, params, cancelToken);\n } catch (err) {\n return responseError(err);\n }\n };\n}\n\nexport function createServerRequestHandler

(\n serviceCall: (services: LangiumCoreAndPartialLSPServices, document: LangiumDocument, params: P, cancelToken: CancellationToken) => HandlerResult,\n sharedServices: LangiumSharedServices,\n targetState?: DocumentState\n): ServerRequestHandler {\n const documents = sharedServices.workspace.LangiumDocuments;\n const serviceRegistry = sharedServices.ServiceRegistry;\n return async (params: P, cancelToken: CancellationToken) => {\n const uri = URI.parse(params.textDocument.uri);\n const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, targetState);\n if (cancellationError) {\n return cancellationError;\n }\n const language = serviceRegistry.getServices(uri);\n if (!language) {\n const errorText = `Could not find service instance for uri: '${uri}'`;\n console.error(errorText);\n throw new Error(errorText);\n }\n const document = await documents.getOrCreateDocument(uri);\n try {\n return await serviceCall(language, document, params, cancelToken);\n } catch (err) {\n return responseError(err);\n }\n };\n}\n\nexport function createRequestHandler

(\n serviceCall: (services: LangiumCoreAndPartialLSPServices, document: LangiumDocument, params: P, cancelToken: CancellationToken) => HandlerResult,\n sharedServices: LangiumSharedServices,\n targetState?: DocumentState\n): RequestHandler {\n const documents = sharedServices.workspace.LangiumDocuments;\n const serviceRegistry = sharedServices.ServiceRegistry;\n return async (params: P, cancelToken: CancellationToken) => {\n const uri = URI.parse(params.textDocument.uri);\n const cancellationError = await waitUntilPhase(sharedServices, cancelToken, uri, targetState);\n if (cancellationError) {\n return cancellationError;\n }\n const language = serviceRegistry.getServices(uri);\n if (!language) {\n console.error(`Could not find service instance for uri: '${uri.toString()}'`);\n return null;\n }\n const document = documents.getDocument(uri);\n if (!document) {\n return null;\n }\n try {\n return await serviceCall(language, document, params, cancelToken);\n } catch (err) {\n return responseError(err);\n }\n };\n}\n\nasync function waitUntilPhase(services: LangiumSharedServices, cancelToken: CancellationToken, uri?: URI, targetState?: DocumentState): Promise | undefined> {\n if (targetState !== undefined) {\n const documentBuilder = services.workspace.DocumentBuilder;\n try {\n await documentBuilder.waitUntil(targetState, uri, cancelToken);\n } catch (err) {\n return responseError(err);\n }\n }\n return undefined;\n}\n\nfunction responseError(err: unknown): ResponseError {\n if (isOperationCancelled(err)) {\n return new ResponseError(LSPErrorCodes.RequestCancelled, 'The request has been cancelled.');\n }\n if (err instanceof ResponseError) {\n return err;\n }\n throw err;\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\n/* eslint-disable no-bitwise */\n\nimport type { Range, SemanticTokens, SemanticTokensClientCapabilities, SemanticTokensDelta, SemanticTokensDeltaParams, SemanticTokensOptions, SemanticTokensParams, SemanticTokensRangeParams } from 'vscode-languageserver';\nimport { SemanticTokensBuilder as BaseSemanticTokensBuilder, SemanticTokenModifiers, SemanticTokenTypes } from 'vscode-languageserver';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport type { AstNode, CstNode, Properties } from '../syntax-tree.js';\nimport { streamAst } from '../utils/ast-utils.js';\nimport { inRange } from '../utils/cst-utils.js';\nimport { findNodeForKeyword, findNodeForProperty, findNodesForKeyword, findNodesForProperty } from '../utils/grammar-utils.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport { interruptAndCheck } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport type { LangiumServices } from './lsp-services.js';\n\nexport const AllSemanticTokenTypes: Record = {\n [SemanticTokenTypes.class]: 0,\n [SemanticTokenTypes.comment]: 1,\n [SemanticTokenTypes.enum]: 2,\n [SemanticTokenTypes.enumMember]: 3,\n [SemanticTokenTypes.event]: 4,\n [SemanticTokenTypes.function]: 5,\n [SemanticTokenTypes.interface]: 6,\n [SemanticTokenTypes.keyword]: 7,\n [SemanticTokenTypes.macro]: 8,\n [SemanticTokenTypes.method]: 9,\n [SemanticTokenTypes.modifier]: 10,\n [SemanticTokenTypes.namespace]: 11,\n [SemanticTokenTypes.number]: 12,\n [SemanticTokenTypes.operator]: 13,\n [SemanticTokenTypes.parameter]: 14,\n [SemanticTokenTypes.property]: 15,\n [SemanticTokenTypes.regexp]: 16,\n [SemanticTokenTypes.string]: 17,\n [SemanticTokenTypes.struct]: 18,\n [SemanticTokenTypes.type]: 19,\n [SemanticTokenTypes.typeParameter]: 20,\n [SemanticTokenTypes.variable]: 21,\n [SemanticTokenTypes.decorator]: 22\n};\n\nexport const AllSemanticTokenModifiers: Record = {\n [SemanticTokenModifiers.abstract]: 1 << 0,\n [SemanticTokenModifiers.async]: 1 << 1,\n [SemanticTokenModifiers.declaration]: 1 << 2,\n [SemanticTokenModifiers.defaultLibrary]: 1 << 3,\n [SemanticTokenModifiers.definition]: 1 << 4,\n [SemanticTokenModifiers.deprecated]: 1 << 5,\n [SemanticTokenModifiers.documentation]: 1 << 6,\n [SemanticTokenModifiers.modification]: 1 << 7,\n [SemanticTokenModifiers.readonly]: 1 << 8,\n [SemanticTokenModifiers.static]: 1 << 9\n};\n\nexport const DefaultSemanticTokenOptions: SemanticTokensOptions = {\n legend: {\n tokenTypes: Object.keys(AllSemanticTokenTypes),\n tokenModifiers: Object.keys(AllSemanticTokenModifiers)\n },\n full: {\n delta: true\n },\n range: true\n};\n\nexport interface SemanticTokenProvider {\n semanticHighlight(document: LangiumDocument, params: SemanticTokensParams, cancelToken?: CancellationToken): MaybePromise\n semanticHighlightRange(document: LangiumDocument, params: SemanticTokensRangeParams, cancelToken?: CancellationToken): MaybePromise\n semanticHighlightDelta(document: LangiumDocument, params: SemanticTokensDeltaParams, cancelToken?: CancellationToken): MaybePromise\n}\n\nexport interface SemanticToken {\n line: number\n char: number\n length: number\n tokenType: number\n tokenModifiers: number\n}\n\nexport type SemanticTokenAcceptorOptions = ({\n line: number;\n char: number;\n length: number;\n} | {\n node: N;\n property: Properties;\n index?: number;\n} | {\n node: N;\n keyword: string;\n index?: number;\n} | {\n cst: CstNode;\n} | {\n range: Range;\n}) & {\n type: string;\n modifier?: string | string[];\n}\n\nexport interface SemanticTokenPropertyOptions {\n node: T;\n property: Properties;\n index?: number;\n type: string;\n modifier?: string | string[];\n}\n\nexport interface SemanticTokenKeywordOptions {\n node: AstNode;\n keyword: string;\n index?: number;\n type: string;\n modifier?: string | string[];\n}\n\nexport interface SemanticTokenNodeOptions {\n node: CstNode;\n type: string;\n modifier?: string | string[];\n}\n\nexport interface SemanticTokenRangeOptions {\n range: Range\n type: string\n modifier?: string | string[]\n}\n\nexport class SemanticTokensBuilder extends BaseSemanticTokensBuilder {\n private _tokens: SemanticToken[] = [];\n\n override push(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void {\n this._tokens.push({\n line,\n char,\n length,\n tokenType,\n tokenModifiers\n });\n }\n\n override build(): SemanticTokens {\n this.applyTokens();\n return super.build();\n }\n\n override buildEdits(): SemanticTokens | SemanticTokensDelta {\n this.applyTokens();\n return super.buildEdits();\n }\n\n /**\n * Flushes the cached delta token values\n */\n flush(): void {\n this.previousResult(this.id);\n }\n\n private applyTokens(): void {\n for (const token of this._tokens.sort(this.compareTokens)) {\n super.push(token.line, token.char, token.length, token.tokenType, token.tokenModifiers);\n }\n this._tokens = [];\n }\n\n private compareTokens(a: SemanticToken, b: SemanticToken): number {\n if (a.line === b.line) {\n return a.char - b.char;\n }\n return a.line - b.line;\n }\n}\n\nexport type SemanticTokenAcceptor = (options: SemanticTokenAcceptorOptions) => void;\n\n/**\n * A basic super class for providing semantic token data.\n * Users of Langium should extend this class to create their own `SemanticTokenProvider`.\n *\n * The entry method for generating semantic tokens based on an `AstNode` is the `highlightElement` method.\n */\nexport abstract class AbstractSemanticTokenProvider implements SemanticTokenProvider {\n\n /**\n * Store a token builder for each open document.\n */\n protected tokensBuilders = new Map();\n protected currentDocument?: LangiumDocument;\n protected currentTokensBuilder?: SemanticTokensBuilder;\n protected currentRange?: Range;\n protected clientCapabilities?: SemanticTokensClientCapabilities;\n\n constructor(services: LangiumServices) {\n // Delete the token builder once the text document has been closed\n services.shared.workspace.TextDocuments.onDidClose(e => {\n this.tokensBuilders.delete(e.document.uri);\n });\n services.shared.lsp.LanguageServer.onInitialize(params => {\n this.initialize(params.capabilities.textDocument?.semanticTokens);\n });\n }\n\n initialize(clientCapabilities?: SemanticTokensClientCapabilities): void {\n this.clientCapabilities = clientCapabilities;\n }\n\n async semanticHighlight(document: LangiumDocument, _params: SemanticTokensParams, cancelToken = CancellationToken.None): Promise {\n this.currentRange = undefined;\n this.currentDocument = document;\n this.currentTokensBuilder = this.getDocumentTokensBuilder(document);\n this.currentTokensBuilder.flush();\n await this.computeHighlighting(document, this.createAcceptor(), cancelToken);\n return this.currentTokensBuilder.build();\n }\n\n async semanticHighlightRange(document: LangiumDocument, params: SemanticTokensRangeParams, cancelToken = CancellationToken.None): Promise {\n this.currentRange = params.range;\n this.currentDocument = document;\n this.currentTokensBuilder = this.getDocumentTokensBuilder(document);\n this.currentTokensBuilder.flush();\n await this.computeHighlighting(document, this.createAcceptor(), cancelToken);\n return this.currentTokensBuilder.build();\n }\n\n async semanticHighlightDelta(document: LangiumDocument, params: SemanticTokensDeltaParams, cancelToken = CancellationToken.None): Promise {\n this.currentRange = undefined;\n this.currentDocument = document;\n this.currentTokensBuilder = this.getDocumentTokensBuilder(document);\n this.currentTokensBuilder.previousResult(params.previousResultId);\n await this.computeHighlighting(document, this.createAcceptor(), cancelToken);\n return this.currentTokensBuilder.buildEdits();\n }\n\n protected createAcceptor(): SemanticTokenAcceptor {\n const acceptor: SemanticTokenAcceptor = options => {\n if ('line' in options) {\n this.highlightToken({\n range: {\n start: {\n line: options.line,\n character: options.char\n },\n end: {\n line: options.line,\n character: options.char + options.length\n }\n },\n type: options.type,\n modifier: options.modifier\n });\n } else if ('range' in options) {\n this.highlightToken(options);\n } else if ('keyword' in options) {\n this.highlightKeyword(options);\n } else if ('property' in options) {\n this.highlightProperty(options);\n } else {\n this.highlightNode({\n node: options.cst,\n type: options.type,\n modifier: options.modifier\n });\n }\n };\n return acceptor;\n }\n\n protected getDocumentTokensBuilder(document: LangiumDocument): SemanticTokensBuilder {\n const existing = this.tokensBuilders.get(document.uri.toString());\n if (existing) {\n return existing;\n }\n const builder = new SemanticTokensBuilder();\n this.tokensBuilders.set(document.uri.toString(), builder);\n return builder;\n }\n\n protected async computeHighlighting(document: LangiumDocument, acceptor: SemanticTokenAcceptor, cancelToken: CancellationToken): Promise {\n const root = document.parseResult.value;\n const treeIterator = streamAst(root, { range: this.currentRange }).iterator();\n let result: IteratorResult;\n do {\n result = treeIterator.next();\n if (!result.done) {\n await interruptAndCheck(cancelToken);\n const node = result.value;\n if (this.highlightElement(node, acceptor) === 'prune') {\n treeIterator.prune();\n }\n }\n } while (!result.done);\n }\n\n /**\n * @return `'prune'` to skip the children of this element, nothing otherwise.\n */\n protected abstract highlightElement(node: AstNode, acceptor: SemanticTokenAcceptor): void | undefined | 'prune';\n\n protected highlightToken(options: SemanticTokenRangeOptions): void {\n const { range, type } = options;\n let modifiers = options.modifier;\n if ((this.currentRange && !inRange(range, this.currentRange)) || !this.currentDocument || !this.currentTokensBuilder) {\n return;\n }\n const intType = AllSemanticTokenTypes[type];\n let totalModifier = 0;\n if (modifiers !== undefined) {\n if (typeof modifiers === 'string') {\n modifiers = [modifiers];\n }\n for (const modifier of modifiers) {\n const intModifier = AllSemanticTokenModifiers[modifier];\n totalModifier |= intModifier;\n }\n }\n const startLine = range.start.line;\n const endLine = range.end.line;\n if (startLine === endLine) {\n // Token only spans a single line\n const char = range.start.character;\n const length = range.end.character - char;\n this.currentTokensBuilder.push(startLine, char, length, intType, totalModifier);\n } else if (this.clientCapabilities?.multilineTokenSupport) {\n // Let token span multiple lines\n const startChar = range.start.character;\n const startOffset = this.currentDocument.textDocument.offsetAt(range.start);\n const endOffset = this.currentDocument.textDocument.offsetAt(range.end);\n this.currentTokensBuilder.push(startLine, startChar, endOffset - startOffset, intType, totalModifier);\n } else {\n // Token spans multiple lines, but the client doesn't support it\n // Split the range into multiple semantic tokens\n const firstLineStart = range.start;\n let nextLineOffset = this.currentDocument.textDocument.offsetAt({\n line: startLine + 1,\n character: 0\n });\n // Build first line\n this.currentTokensBuilder.push(\n firstLineStart.line,\n firstLineStart.character,\n nextLineOffset - firstLineStart.character - 1,\n intType,\n totalModifier\n );\n // Build all lines in between first and last\n for (let i = startLine + 1; i < endLine; i++) {\n const currentLineOffset = nextLineOffset;\n nextLineOffset = this.currentDocument.textDocument.offsetAt({\n line: i + 1,\n character: 0\n });\n this.currentTokensBuilder.push(\n i,\n 0,\n nextLineOffset - currentLineOffset - 1,\n intType, totalModifier\n );\n }\n // Build last line\n this.currentTokensBuilder.push(\n endLine,\n 0,\n range.end.character,\n intType,\n totalModifier\n );\n }\n }\n\n protected highlightProperty(options: SemanticTokenPropertyOptions): void {\n const nodes: CstNode[] = [];\n if (typeof options.index === 'number') {\n const node = findNodeForProperty(options.node.$cstNode, options.property, options.index);\n if (node) {\n nodes.push(node);\n }\n } else {\n nodes.push(...findNodesForProperty(options.node.$cstNode, options.property));\n }\n const { type, modifier } = options;\n for (const node of nodes) {\n this.highlightNode({\n node,\n type,\n modifier\n });\n }\n }\n\n protected highlightKeyword(options: SemanticTokenKeywordOptions): void {\n const { node, keyword, type, index, modifier } = options;\n const nodes: CstNode[] = [];\n if (typeof index === 'number') {\n const keywordNode = findNodeForKeyword(node.$cstNode, keyword, index);\n if (keywordNode) {\n nodes.push(keywordNode);\n }\n } else {\n nodes.push(...findNodesForKeyword(node.$cstNode, keyword));\n }\n for (const keywordNode of nodes) {\n this.highlightNode({\n node: keywordNode,\n type,\n modifier\n });\n }\n }\n\n protected highlightNode(options: SemanticTokenNodeOptions): void {\n const { node, type, modifier } = options;\n const range = node.range;\n this.highlightToken({\n range,\n type,\n modifier\n });\n }\n\n}\n\nexport namespace SemanticTokensDecoder {\n export interface DecodedSemanticToken {\n offset: number;\n tokenType: SemanticTokenTypes;\n tokenModifiers: number;\n text: string;\n }\n\n export function decode(tokens: SemanticTokens, document: LangiumDocument): DecodedSemanticToken[] {\n const typeMap = new Map();\n Object.entries(AllSemanticTokenTypes).forEach(([type, index]) => typeMap.set(index, type as SemanticTokenTypes));\n let line = 0;\n let character = 0;\n return sliceIntoChunks(tokens.data, 5).map(t => {\n line += t[0];\n if (t[0] !== 0) {\n character = 0;\n }\n character += t[1];\n const length = t[2];\n const offset = document.textDocument.offsetAt({ line, character });\n return {\n offset,\n tokenType: typeMap.get(t[3])!,\n tokenModifiers: t[4],\n text: document.textDocument.getText({ start: { line, character }, end: { line, character: character + length } })\n } as DecodedSemanticToken;\n });\n }\n\n function sliceIntoChunks(arr: T[], chunkSize: number) {\n const res = [];\n for (let i = 0; i < arr.length; i += chunkSize) {\n const chunk = arr.slice(i, i + chunkSize);\n res.push(chunk);\n }\n return res;\n }\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { SignatureHelp, SignatureHelpOptions, SignatureHelpParams } from 'vscode-languageserver';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport { findLeafNodeAtOffset } from '../utils/cst-utils.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\n\n/**\n * Language-specific service for handling signature help requests.\n */\nexport interface SignatureHelpProvider {\n /**\n * Handles a signature help request\n */\n provideSignatureHelp(document: LangiumDocument, params: SignatureHelpParams, cancelToken?: CancellationToken): MaybePromise;\n /**\n * Options that determine the server capabilities for a signature help request. It contains the list of triggering characters.\n */\n get signatureHelpOptions(): SignatureHelpOptions;\n}\n\nexport abstract class AbstractSignatureHelpProvider implements SignatureHelpProvider {\n provideSignatureHelp(document: LangiumDocument, params: SignatureHelpParams, cancelToken = CancellationToken.None): MaybePromise {\n const rootNode = document.parseResult.value;\n const cst = rootNode.$cstNode;\n if (cst) {\n const sourceCstNode = findLeafNodeAtOffset(cst, document.textDocument.offsetAt(params.position));\n if (sourceCstNode) {\n return this.getSignatureFromElement(sourceCstNode.astNode, cancelToken);\n }\n }\n return undefined;\n }\n\n /**\n * Override this method to return the desired SignatureHelp\n */\n protected abstract getSignatureFromElement(element: AstNode, cancelToken: CancellationToken): MaybePromise;\n\n /**\n * Override this getter to return the list of triggering characters for your language. To deactivate the signature help, return an empty object.\n */\n get signatureHelpOptions(): SignatureHelpOptions {\n return {\n triggerCharacters: ['('],\n retriggerCharacters: [',']\n };\n }\n}\n\n/**\n * Merges the SignatureHelpOptions of all languages\n */\nexport function mergeSignatureHelpOptions(options: Array): SignatureHelpOptions | undefined {\n const triggerCharacters: string[] = [];\n const retriggerCharacters: string[] = [];\n\n options.forEach(option => {\n if (option?.triggerCharacters) {\n triggerCharacters.push(...option.triggerCharacters);\n }\n if (option?.retriggerCharacters) {\n retriggerCharacters.push(...option.retriggerCharacters);\n }\n });\n\n const mergedOptions: SignatureHelpOptions = {\n triggerCharacters: triggerCharacters.length > 0 ? Array.from(new Set(triggerCharacters)).sort() : undefined,\n retriggerCharacters: retriggerCharacters.length > 0 ? Array.from(new Set(retriggerCharacters)).sort() : undefined\n };\n\n return mergedOptions.triggerCharacters ? mergedOptions : undefined;\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { AstNode, AstNodeDescription } from '../syntax-tree.js';\nimport { CompletionItemKind, SymbolKind } from 'vscode-languageserver';\n\n/**\n * This service consolidates the logic for gathering LSP kind information based on AST nodes or their descriptions.\n */\nexport interface NodeKindProvider {\n /**\n * Returns a `SymbolKind` as used by `WorkspaceSymbolProvider` or `DocumentSymbolProvider`.\n */\n getSymbolKind(node: AstNode | AstNodeDescription): SymbolKind;\n /**\n * Returns a `CompletionItemKind` as used by the `CompletionProvider`.\n */\n getCompletionItemKind(node: AstNode | AstNodeDescription): CompletionItemKind;\n}\n\nexport class DefaultNodeKindProvider implements NodeKindProvider {\n getSymbolKind(): SymbolKind {\n return SymbolKind.Field;\n }\n getCompletionItemKind(): CompletionItemKind {\n return CompletionItemKind.Reference;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { ReferenceParams } from 'vscode-languageserver';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { References } from '../references/references.js';\nimport type { LeafCstNode } from '../syntax-tree.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport { Location } from 'vscode-languageserver';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\n\n/**\n * Language-specific service for handling find references requests.\n */\nexport interface ReferencesProvider {\n /**\n * Handle a find references request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n findReferences(document: LangiumDocument, params: ReferenceParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport class DefaultReferencesProvider implements ReferencesProvider {\n protected readonly nameProvider: NameProvider;\n protected readonly references: References;\n protected readonly grammarConfig: GrammarConfig;\n\n constructor(services: LangiumServices) {\n this.nameProvider = services.references.NameProvider;\n this.references = services.references.References;\n this.grammarConfig = services.parser.GrammarConfig;\n }\n\n findReferences(document: LangiumDocument, params: ReferenceParams): MaybePromise {\n const rootNode = document.parseResult.value.$cstNode;\n if (!rootNode) {\n return [];\n }\n\n const selectedNode = findDeclarationNodeAtOffset(rootNode, document.textDocument.offsetAt(params.position), this.grammarConfig.nameRegexp);\n if (!selectedNode) {\n return [];\n }\n\n return this.getReferences(selectedNode, params, document);\n }\n\n protected getReferences(selectedNode: LeafCstNode, params: ReferenceParams, _document: LangiumDocument): Location[] {\n const locations: Location[] = [];\n const targetAstNode = this.references.findDeclaration(selectedNode);\n if (targetAstNode) {\n const options = { includeDeclaration: params.context.includeDeclaration };\n this.references.findReferences(targetAstNode, options).forEach(reference => {\n locations.push(Location.create(reference.sourceUri.toString(), reference.segment.range));\n });\n }\n return locations;\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { Position, Range, RenameParams, TextDocumentPositionParams, WorkspaceEdit } from 'vscode-languageserver-protocol';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { CstNode } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { LangiumDocument } from '../workspace/documents.js';\nimport { TextEdit } from 'vscode-languageserver-types';\nimport { isNamed } from '../references/name-provider.js';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\n\n/**\n * Language-specific service for handling rename requests and prepare rename requests.\n */\nexport interface RenameProvider {\n /**\n * Handle a rename request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n rename(document: LangiumDocument, params: RenameParams, cancelToken?: CancellationToken): MaybePromise;\n\n /**\n * Handle a prepare rename request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n prepareRename(document: LangiumDocument, params: TextDocumentPositionParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport class DefaultRenameProvider implements RenameProvider {\n\n protected readonly references: References;\n protected readonly nameProvider: NameProvider;\n protected readonly grammarConfig: GrammarConfig;\n\n constructor(services: LangiumServices) {\n this.references = services.references.References;\n this.nameProvider = services.references.NameProvider;\n this.grammarConfig = services.parser.GrammarConfig;\n }\n\n async rename(document: LangiumDocument, params: RenameParams): Promise {\n const changes: Record = {};\n const rootNode = document.parseResult.value.$cstNode;\n if (!rootNode) return undefined;\n const offset = document.textDocument.offsetAt(params.position);\n const leafNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp);\n if (!leafNode) return undefined;\n const targetNode = this.references.findDeclaration(leafNode);\n if (!targetNode) return undefined;\n const options = { onlyLocal: false, includeDeclaration: true };\n const references = this.references.findReferences(targetNode, options);\n references.forEach(ref => {\n const change = TextEdit.replace(ref.segment.range, params.newName);\n const uri = ref.sourceUri.toString();\n if (changes[uri]) {\n changes[uri].push(change);\n } else {\n changes[uri] = [change];\n }\n });\n return { changes };\n }\n\n prepareRename(document: LangiumDocument, params: TextDocumentPositionParams): MaybePromise {\n return this.renameNodeRange(document, params.position);\n }\n\n protected renameNodeRange(doc: LangiumDocument, position: Position): Range | undefined {\n const rootNode = doc.parseResult.value.$cstNode;\n const offset = doc.textDocument.offsetAt(position);\n if (rootNode && offset) {\n const leafNode = findDeclarationNodeAtOffset(rootNode, offset, this.grammarConfig.nameRegexp);\n if (!leafNode) {\n return undefined;\n }\n const isCrossRef = this.references.findDeclaration(leafNode);\n // return range if selected CstNode is the name node or it is a crosslink which points to a declaration\n if (isCrossRef || this.isNameNode(leafNode)) {\n return leafNode.range;\n }\n }\n return undefined;\n }\n\n protected isNameNode(leafNode: CstNode | undefined): boolean | undefined {\n return leafNode?.astNode && isNamed(leafNode.astNode) && leafNode === this.nameProvider.getNameNode(leafNode.astNode);\n }\n}\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { WorkspaceSymbol, WorkspaceSymbolParams } from 'vscode-languageserver';\nimport type { LangiumSharedServices } from './lsp-services.js';\nimport type { IndexManager } from '../workspace/index-manager.js';\nimport type { MaybePromise} from '../utils/promise-utils.js';\nimport type { AstNodeDescription } from '../syntax-tree.js';\nimport type { NodeKindProvider } from './node-kind-provider.js';\nimport type { FuzzyMatcher } from './fuzzy-matcher.js';\nimport { CancellationToken } from '../utils/cancellation.js';\nimport { interruptAndCheck } from '../utils/promise-utils.js';\n\n/**\n * Shared service for handling workspace symbols requests.\n */\nexport interface WorkspaceSymbolProvider {\n /**\n * Handle a workspace symbols request.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n getSymbols(params: WorkspaceSymbolParams, cancelToken?: CancellationToken): MaybePromise;\n /**\n * Handle a resolve request for a workspace symbol.\n *\n * @throws `OperationCancelled` if cancellation is detected during execution\n * @throws `ResponseError` if an error is detected that should be sent as response to the client\n */\n resolveSymbol?(symbol: WorkspaceSymbol, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport class DefaultWorkspaceSymbolProvider implements WorkspaceSymbolProvider {\n\n protected readonly indexManager: IndexManager;\n protected readonly nodeKindProvider: NodeKindProvider;\n protected readonly fuzzyMatcher: FuzzyMatcher;\n\n constructor(services: LangiumSharedServices) {\n this.indexManager = services.workspace.IndexManager;\n this.nodeKindProvider = services.lsp.NodeKindProvider;\n this.fuzzyMatcher = services.lsp.FuzzyMatcher;\n }\n\n async getSymbols(params: WorkspaceSymbolParams, cancelToken = CancellationToken.None): Promise {\n const workspaceSymbols: WorkspaceSymbol[] = [];\n const query = params.query.toLowerCase();\n for (const description of this.indexManager.allElements()) {\n await interruptAndCheck(cancelToken);\n if (this.fuzzyMatcher.match(query, description.name)) {\n const symbol = this.getWorkspaceSymbol(description);\n if (symbol) {\n workspaceSymbols.push(symbol);\n }\n }\n }\n return workspaceSymbols;\n }\n\n protected getWorkspaceSymbol(astDescription: AstNodeDescription): WorkspaceSymbol | undefined {\n const nameSegment = astDescription.nameSegment;\n if (nameSegment) {\n return {\n kind: this.nodeKindProvider.getSymbolKind(astDescription),\n name: astDescription.name,\n location: {\n range: nameSegment.range,\n uri: astDescription.documentUri.toString()\n }\n };\n } else {\n return undefined;\n }\n }\n}\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { DocumentFormattingParams, DocumentOnTypeFormattingOptions, DocumentOnTypeFormattingParams, DocumentRangeFormattingParams, FormattingOptions, Range, TextEdit } from 'vscode-languageserver-protocol';\nimport type { CancellationToken } from '../utils/cancellation.js';\nimport type { AstNode, CstNode, Properties } from '../syntax-tree.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\nimport type { Stream } from '../utils/stream.js';\nimport type { LangiumDocument, TextDocument } from '../workspace/documents.js';\nimport { findNodeForKeyword, findNodesForKeyword, findNodeForProperty, findNodesForProperty } from '../utils/grammar-utils.js';\nimport { isCompositeCstNode, isLeafCstNode } from '../syntax-tree.js';\nimport { streamAllContents } from '../utils/ast-utils.js';\nimport { getInteriorNodes, getNextNode } from '../utils/cst-utils.js';\nimport { DONE_RESULT, EMPTY_STREAM, StreamImpl, TreeStreamImpl } from '../utils/stream.js';\n\n/**\n * Language specific service for handling formatting related LSP requests.\n */\nexport interface Formatter {\n /**\n * Handles full document formatting.\n */\n formatDocument(document: LangiumDocument, params: DocumentFormattingParams, cancelToken?: CancellationToken): MaybePromise\n /**\n * Handles partial document formatting. Only parts of the document within the `params.range` property are formatted.\n */\n formatDocumentRange(document: LangiumDocument, params: DocumentRangeFormattingParams, cancelToken?: CancellationToken): MaybePromise\n /**\n * Handles document formatting while typing. Only formats the current line.\n */\n formatDocumentOnType(document: LangiumDocument, params: DocumentOnTypeFormattingParams, cancelToken?: CancellationToken): MaybePromise\n /**\n * Options that determine when the `formatDocumentOnType` method should be invoked by the language client.\n * When `undefined` is returned, document format on type will be disabled.\n */\n get formatOnTypeOptions(): DocumentOnTypeFormattingOptions | undefined\n}\n\nexport abstract class AbstractFormatter implements Formatter {\n\n protected collector: FormattingCollector = () => { /* Does nothing at first */ };\n\n /**\n * Creates a formatter scoped to the supplied AST node.\n * Allows to define fine-grained formatting rules for elements.\n *\n * Example usage:\n *\n * ```ts\n * export class CustomFormatter extends AbstractFormatter {\n * protected override format(node: AstNode): void {\n * if (isPerson(node)) {\n * const formatter = this.getNodeFormatter(node);\n * formatter.property('name').prepend(Formatting.oneSpace());\n * }\n * }\n * }\n * ```\n * @param node The specific node the formatter should be scoped to. Every call to properties or keywords will only select those which belong to the supplied AST node.\n */\n protected getNodeFormatter(node: T): NodeFormatter {\n return new DefaultNodeFormatter(node, this.collector);\n }\n\n formatDocument(document: LangiumDocument, params: DocumentFormattingParams): MaybePromise {\n const pr = document.parseResult;\n if (pr.lexerErrors.length === 0 && pr.parserErrors.length === 0) {\n // safe to format\n return this.doDocumentFormat(document, params.options);\n } else {\n // don't format a potentially broken document, return no edits\n return [];\n }\n }\n\n /**\n * Returns whether a range for a given document is error free, i.e. safe to format\n *\n * @param document Document to inspect for lexer & parser errors that may produce an unsafe range\n * @param range Formatting range to check for safety\n * @returns Whether the given formatting range does not overlap with or follow any regions with an error\n */\n protected isFormatRangeErrorFree(document: LangiumDocument, range: Range): boolean {\n const pr = document.parseResult;\n if (pr.lexerErrors.length || pr.parserErrors.length) {\n // collect the earliest error line from either\n const earliestErrLine = Math.min(\n ...pr.lexerErrors.map(e => e.line ?? Number.MAX_VALUE),\n ...pr.parserErrors.map(e => e.token.startLine ?? Number.MAX_VALUE)\n );\n // if the earliest error line occurs before or at the end line of the range, then don't format\n return earliestErrLine > range.end.line;\n } else {\n // no errors, ok to format\n return true;\n }\n }\n\n formatDocumentRange(document: LangiumDocument, params: DocumentRangeFormattingParams): MaybePromise {\n if (this.isFormatRangeErrorFree(document, params.range)) {\n return this.doDocumentFormat(document, params.options, params.range);\n } else {\n return [];\n }\n }\n\n formatDocumentOnType(document: LangiumDocument, params: DocumentOnTypeFormattingParams): MaybePromise {\n // Format the current line after typing something\n const range = {\n start: {\n character: 0,\n line: params.position.line\n },\n end: params.position\n };\n\n if (this.isFormatRangeErrorFree(document, range)) {\n return this.doDocumentFormat(document, params.options, range);\n } else {\n return [];\n }\n }\n\n get formatOnTypeOptions(): DocumentOnTypeFormattingOptions | undefined {\n return undefined;\n }\n\n protected doDocumentFormat(document: LangiumDocument, options: FormattingOptions, range?: Range): TextEdit[] {\n const map = new Map();\n const collector: FormattingCollector = (node, mode, formatting) => {\n const key = this.nodeModeToKey(node, mode);\n const existing = map.get(key);\n const priority = formatting.options.priority ?? 0;\n const existingPriority = existing?.options.priority ?? 0;\n if (!existing || existingPriority <= priority) {\n map.set(key, formatting);\n }\n };\n this.collector = collector;\n\n this.iterateAstFormatting(document, range);\n const edits = this.iterateCstFormatting(document, map, options, range);\n\n return this.avoidOverlappingEdits(document.textDocument, edits);\n }\n\n protected avoidOverlappingEdits(textDocument: TextDocument, textEdits: TextEdit[]): TextEdit[] {\n const edits: TextEdit[] = [];\n for (const edit of textEdits) {\n const last = edits[edits.length - 1];\n if (last) {\n const currentStart = textDocument.offsetAt(edit.range.start);\n const lastEnd = textDocument.offsetAt(last.range.end);\n if (currentStart < lastEnd) {\n edits.pop();\n }\n }\n edits.push(edit);\n }\n return edits;\n }\n\n protected iterateAstFormatting(document: LangiumDocument, range?: Range): void {\n const root = document.parseResult.value;\n this.format(root);\n const treeIterator = streamAllContents(root).iterator();\n let result: IteratorResult;\n do {\n result = treeIterator.next();\n if (!result.done) {\n const node = result.value;\n const inside = this.insideRange(node.$cstNode!.range, range);\n if (inside) {\n this.format(node);\n } else {\n treeIterator.prune();\n }\n }\n } while (!result.done);\n }\n\n protected abstract format(node: AstNode): void;\n\n protected nodeModeToKey(node: CstNode, mode: 'prepend' | 'append'): string {\n return `${node.offset}:${node.end}:${mode}`;\n }\n\n protected insideRange(inside: Range, total?: Range): boolean {\n if (!total) {\n return true;\n }\n if ((inside.start.line <= total.start.line && inside.end.line >= total.end.line) ||\n (inside.start.line >= total.start.line && inside.end.line <= total.end.line) ||\n (inside.start.line <= total.end.line && inside.end.line >= total.end.line)) {\n return true;\n }\n return false;\n }\n\n protected isNecessary(edit: TextEdit, document: TextDocument): boolean {\n const existing = document.getText(edit.range);\n return existing !== edit.newText;\n }\n\n protected iterateCstFormatting(document: LangiumDocument, formattings: Map, options: FormattingOptions, range?: Range): TextEdit[] {\n const context: FormattingContext = {\n indentation: 0,\n options,\n document: document.textDocument\n };\n const edits: TextEdit[] = [];\n const cstTreeStream = this.iterateCstTree(document, context);\n const iterator = cstTreeStream.iterator();\n let lastNode: CstNode | undefined;\n let result: IteratorResult;\n do {\n result = iterator.next();\n if (!result.done) {\n const node = result.value;\n const isLeaf = isLeafCstNode(node);\n const prependKey = this.nodeModeToKey(node, 'prepend');\n const prependFormatting = formattings.get(prependKey);\n formattings.delete(prependKey);\n if (prependFormatting) {\n const nodeEdits = this.createTextEdit(lastNode, node, prependFormatting, context);\n for (const edit of nodeEdits) {\n if (edit && this.insideRange(edit.range, range) && this.isNecessary(edit, document.textDocument)) {\n edits.push(edit);\n }\n }\n }\n const appendKey = this.nodeModeToKey(node, 'append');\n const appendFormatting = formattings.get(appendKey);\n formattings.delete(appendKey);\n if (appendFormatting) {\n const nextNode = getNextNode(node);\n if (nextNode) {\n const nodeEdits = this.createTextEdit(node, nextNode, appendFormatting, context);\n for (const edit of nodeEdits) {\n if (edit && this.insideRange(edit.range, range) && this.isNecessary(edit, document.textDocument)) {\n edits.push(edit);\n }\n }\n }\n }\n\n if (!prependFormatting && node.hidden) {\n const hiddenEdits = this.createHiddenTextEdits(lastNode, node, undefined, context);\n for (const edit of hiddenEdits) {\n if (edit && this.insideRange(edit.range, range) && this.isNecessary(edit, document.textDocument)) {\n edits.push(edit);\n }\n }\n }\n if (isLeaf) {\n lastNode = node;\n }\n }\n } while (!result.done);\n\n return edits;\n }\n\n protected createHiddenTextEdits(previous: CstNode | undefined, hidden: CstNode, formatting: FormattingAction | undefined, context: FormattingContext): TextEdit[] {\n // Don't format the hidden node if it is on the same line as its previous node\n const startLine = hidden.range.start.line;\n if (previous && previous.range.end.line === startLine) {\n return [];\n }\n const edits: TextEdit[] = [];\n\n const startRange: Range = {\n start: {\n character: 0,\n line: startLine\n },\n end: hidden.range.start\n };\n const hiddenStartText = context.document.getText(startRange);\n const move = this.findFittingMove(startRange, formatting?.moves ?? [], context);\n const hiddenStartChar = this.getExistingIndentationCharacterCount(hiddenStartText, context);\n const expectedStartChar = this.getIndentationCharacterCount(context, move);\n\n const characterIncrease = expectedStartChar - hiddenStartChar;\n\n if (characterIncrease === 0) {\n return [];\n }\n\n let newText = '';\n if (characterIncrease > 0) {\n newText = (context.options.insertSpaces ? ' ' : '\\t').repeat(characterIncrease);\n }\n\n const lines = hidden.text.split('\\n');\n lines[0] = hiddenStartText + lines[0];\n for (let i = 0; i < lines.length; i++) {\n const currentLine = startLine + i;\n const pos = {\n character: 0,\n line: currentLine\n };\n if (characterIncrease > 0) {\n edits.push({\n newText,\n range: {\n start: pos,\n end: pos\n }\n });\n } else {\n const currentText = lines[i];\n let j = 0;\n for (; j < currentText.length; j++) {\n const char = currentText.charAt(j);\n if (char !== ' ' && char !== '\\t') {\n break;\n }\n }\n edits.push({\n newText: '',\n range: {\n start: pos,\n end: {\n line: currentLine,\n // Remove as much whitespace characters as necessary\n // In some cases `characterIncrease` is actually larger than the amount of whitespace available\n // So we simply remove all whitespace characters `j`\n character: Math.min(j, Math.abs(characterIncrease))\n }\n }\n });\n }\n }\n\n return edits;\n }\n\n protected getExistingIndentationCharacterCount(text: string, context: FormattingContext): number {\n const tabWhitespace = ' '.repeat(context.options.tabSize);\n const normalized = context.options.insertSpaces ? text.replaceAll('\\t', tabWhitespace) : text.replaceAll(tabWhitespace, '\\t');\n return normalized.length;\n }\n\n protected getIndentationCharacterCount(context: FormattingContext, formattingMove?: FormattingMove): number {\n let indentation = context.indentation;\n if (formattingMove && formattingMove.tabs) {\n indentation += formattingMove.tabs;\n }\n return (context.options.insertSpaces ? context.options.tabSize : 1) * indentation;\n }\n\n protected createTextEdit(a: CstNode | undefined, b: CstNode, formatting: FormattingAction, context: FormattingContext): TextEdit[] {\n if (b.hidden) {\n return this.createHiddenTextEdits(a, b, formatting, context);\n }\n const betweenRange: Range = {\n start: a?.range.end ?? {\n character: 0,\n line: 0\n },\n end: b.range.start\n };\n const move = this.findFittingMove(betweenRange, formatting.moves, context);\n if (!move) {\n return [];\n }\n const chars = move.characters;\n const lines = move.lines;\n const tabs = move.tabs;\n const existingIndentation = context.indentation;\n context.indentation += (tabs ?? 0);\n const edits: TextEdit[] = [];\n if (chars !== undefined) {\n edits.push(this.createSpaceTextEdit(betweenRange, chars, formatting.options));\n } else if (lines !== undefined) {\n edits.push(this.createLineTextEdit(betweenRange, lines, context, formatting.options));\n } else if (tabs !== undefined) {\n edits.push(this.createTabTextEdit(betweenRange, Boolean(a), context));\n }\n if (isLeafCstNode(b)) {\n context.indentation = existingIndentation;\n }\n return edits;\n }\n\n protected createSpaceTextEdit(range: Range, spaces: number, options: FormattingActionOptions): TextEdit {\n if (range.start.line === range.end.line) {\n const existingSpaces = range.end.character - range.start.character;\n spaces = this.fitIntoOptions(spaces, existingSpaces, options);\n }\n const newText = ' '.repeat(spaces);\n return {\n newText,\n range\n };\n }\n\n protected createLineTextEdit(range: Range, lines: number, context: FormattingContext, options: FormattingActionOptions): TextEdit {\n const existingLines = range.end.line - range.start.line;\n lines = this.fitIntoOptions(lines, existingLines, options);\n const indent = context.options.insertSpaces ? ' '.repeat(context.options.tabSize) : '\\t';\n const nodeIndent = indent.repeat(context.indentation);\n const newText = `${'\\n'.repeat(lines)}${nodeIndent}`;\n return {\n newText,\n range\n };\n }\n\n protected createTabTextEdit(range: Range, hasPrevious: boolean, context: FormattingContext): TextEdit {\n const indent = context.options.insertSpaces ? ' '.repeat(context.options.tabSize) : '\\t';\n const nodeIndent = indent.repeat(context.indentation);\n const minimumLines = hasPrevious ? 1 : 0;\n const lines = Math.max(range.end.line - range.start.line, minimumLines);\n const newText = `${'\\n'.repeat(lines)}${nodeIndent}`;\n return {\n newText,\n range\n };\n }\n\n protected fitIntoOptions(value: number, existing: number, options: FormattingActionOptions): number {\n if (options.allowMore) {\n value = Math.max(existing, value);\n } else if (options.allowLess) {\n value = Math.min(existing, value);\n }\n return value;\n }\n\n protected findFittingMove(range: Range, moves: FormattingMove[], _context: FormattingContext): FormattingMove | undefined {\n if (moves.length === 0) {\n return undefined;\n } else if (moves.length === 1) {\n return moves[0];\n }\n\n const existingLines = range.end.line - range.start.line;\n\n for (const move of moves) {\n if (move.lines !== undefined && existingLines <= move.lines) {\n return move;\n } else if (move.lines === undefined && existingLines === 0) {\n return move;\n }\n }\n\n // Return the last move\n return moves[moves.length - 1];\n }\n\n protected iterateCstTree(document: LangiumDocument, context: FormattingContext): Stream {\n const root = document.parseResult.value;\n const rootCst = root.$cstNode;\n if (!rootCst) {\n return EMPTY_STREAM;\n }\n return new TreeStreamImpl(rootCst, node => this.iterateCst(node, context));\n }\n\n protected iterateCst(node: CstNode, context: FormattingContext): Stream {\n if (!isCompositeCstNode(node)) {\n return EMPTY_STREAM;\n }\n const initial = context.indentation;\n return new StreamImpl<{ index: number }, CstNode>(\n () => ({ index: 0 }),\n (state) => {\n if (state.index < node.content.length) {\n return { done: false, value: node.content[state.index++] };\n } else {\n // Reset the indentation to the level when we entered the node\n context.indentation = initial;\n return DONE_RESULT;\n }\n }\n );\n }\n\n}\n\n/**\n * Represents an object that allows to format certain parts of a specific node, like its keywords or properties.\n */\nexport interface NodeFormatter {\n /**\n * Creates a new formatting region that contains the specified node.\n */\n node(node: AstNode): FormattingRegion\n /**\n * Creates a new formatting region that contains all of the specified nodes.\n */\n nodes(...nodes: AstNode[]): FormattingRegion\n /**\n * Creates a new formatting region that contains the specified property of the supplied node.\n *\n * @param property The name of the property to format. Scoped to the supplied node.\n * @param index The index of the property, if the property is an array. `0` by default. To retrieve all elements of this array, use the {@link properties} method instead.\n */\n property(property: Properties, index?: number): FormattingRegion\n /**\n * Creates a new formatting region that contains the all of the specified properties of the supplied node.\n *\n * @param properties The names of the properties to format. Scoped to the supplied node.\n */\n properties(...properties: Array>): FormattingRegion\n /**\n * Creates a new formatting region that contains the specified keyword of the supplied node.\n *\n * @param keyword The keyword to format. Scoped to the supplied node.\n * @param index The index of the keyword, necessary if the keyword appears multiple times. `0` by default. To retrieve all keywords, use the {@link keywords} method instead.\n */\n keyword(keyword: string, index?: number): FormattingRegion\n /**\n * Creates a new formatting region that contains the all of the specified keywords of the supplied node.\n *\n * @param keywords The keywords to format. Scoped to the supplied node.\n */\n keywords(...keywords: string[]): FormattingRegion\n /**\n * Creates a new formatting region that contains the all of the specified CST nodes.\n *\n * @param nodes A list of CST nodes to format\n */\n cst(nodes: CstNode[]): FormattingRegion\n /**\n * Creates a new formatting region that contains all nodes between the given formatting regions.\n *\n * For example, can be used to retrieve a formatting region that contains all nodes between two curly braces:\n *\n * ```ts\n * const formatter = this.getNodeFormatter(node);\n * const bracesOpen = formatter.keyword('{');\n * const bracesClose = formatter.keyword('}');\n * formatter.interior(bracesOpen, bracesClose).prepend(Formatting.indent());\n * ```\n *\n * @param start Determines where the search for interior nodes should start\n * @param end Determines where the search for interior nodes should end\n */\n interior(start: FormattingRegion, end: FormattingRegion): FormattingRegion\n}\n\nexport class DefaultNodeFormatter implements NodeFormatter {\n\n protected readonly astNode: T;\n protected readonly collector: FormattingCollector;\n\n constructor(astNode: T, collector: FormattingCollector) {\n this.astNode = astNode;\n this.collector = collector;\n }\n\n node(node: AstNode): FormattingRegion {\n return new FormattingRegion(node.$cstNode ? [node.$cstNode] : [], this.collector);\n }\n\n nodes(...nodes: AstNode[]): FormattingRegion {\n const cstNodes: CstNode[] = [];\n for (const node of nodes) {\n if (node.$cstNode) {\n cstNodes.push(node.$cstNode);\n }\n }\n return new FormattingRegion(cstNodes, this.collector);\n }\n\n property(feature: Properties, index?: number): FormattingRegion {\n const cstNode = findNodeForProperty(this.astNode.$cstNode, feature, index);\n return new FormattingRegion(cstNode ? [cstNode] : [], this.collector);\n }\n\n properties(...features: Array>): FormattingRegion {\n const nodes: CstNode[] = [];\n for (const feature of features) {\n const cstNodes = findNodesForProperty(this.astNode.$cstNode, feature);\n nodes.push(...cstNodes);\n }\n return new FormattingRegion(nodes, this.collector);\n }\n\n keyword(keyword: string, index?: number): FormattingRegion {\n const cstNode = findNodeForKeyword(this.astNode.$cstNode, keyword, index);\n return new FormattingRegion(cstNode ? [cstNode] : [], this.collector);\n }\n\n keywords(...keywords: string[]): FormattingRegion {\n const nodes: CstNode[] = [];\n for (const feature of keywords) {\n const cstNodes = findNodesForKeyword(this.astNode.$cstNode, feature);\n nodes.push(...cstNodes);\n }\n return new FormattingRegion(nodes, this.collector);\n }\n\n cst(nodes: CstNode[]): FormattingRegion {\n return new FormattingRegion([...nodes], this.collector);\n }\n\n interior(start: FormattingRegion, end: FormattingRegion): FormattingRegion {\n const startNodes = start.nodes;\n const endNodes = end.nodes;\n if (startNodes.length !== 1 || endNodes.length !== 1) {\n return new FormattingRegion([], this.collector);\n }\n let startNode = startNodes[0];\n let endNode = endNodes[0];\n\n if (startNode.offset > endNode.offset) {\n const intermediate = startNode;\n startNode = endNode;\n endNode = intermediate;\n }\n\n return new FormattingRegion(getInteriorNodes(startNode, endNode), this.collector);\n }\n}\n\nexport interface FormattingContext {\n document: TextDocument\n options: FormattingOptions\n indentation: number // Level of indentation, not the amount of spaces/tabs\n}\n\nexport class FormattingRegion {\n\n readonly nodes: CstNode[];\n protected readonly collector: FormattingCollector;\n\n constructor(nodes: CstNode[], collector: FormattingCollector) {\n this.nodes = nodes;\n this.collector = collector;\n }\n\n /**\n * Prepends the specified formatting to all nodes of this region.\n */\n prepend(formatting: FormattingAction): FormattingRegion {\n for (const node of this.nodes) {\n this.collector(node, 'prepend', formatting);\n }\n return this;\n }\n\n /**\n * Appends the specified formatting to all nodes of this region.\n */\n append(formatting: FormattingAction): FormattingRegion {\n for (const node of this.nodes) {\n this.collector(node, 'append', formatting);\n }\n return this;\n }\n\n /**\n * Sorrounds all nodes of this region with the specified formatting.\n * Functionally the same as invoking `prepend` and `append` with the same formatting.\n */\n surround(formatting: FormattingAction): FormattingRegion {\n for (const node of this.nodes) {\n this.collector(node, 'prepend', formatting);\n this.collector(node, 'append', formatting);\n }\n return this;\n }\n\n /**\n * Creates a copy of this region with a slice of the selected nodes.\n * For both start and end, a negative index can be used to indicate an offset from the end of the array.\n * For example, -2 refers to the second to last element of the array.\n * @param start The beginning index of the specified portion of the region. If start is undefined, then the slice begins at index 0.\n * @param end The end index of the specified portion of the region. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the region.\n */\n slice(start?: number, end?: number): FormattingRegion {\n return new FormattingRegion(this.nodes.slice(start, end), this.collector);\n }\n}\n\nexport interface FormattingAction {\n options: FormattingActionOptions\n moves: FormattingMove[]\n}\n\nexport interface FormattingActionOptions {\n /**\n * The priority of this formatting. Formattings with a higher priority override those with lower priority.\n * `0` by default.\n */\n priority?: number\n /**\n * Determines whether this formatting allows more spaces/lines than expected. For example, if {@link Formatting.newLine} is used, but 2 empty lines already exist between the elements, no formatting is applied.\n */\n allowMore?: boolean\n /**\n * Determines whether this formatting allows less spaces/lines than expected. For example, if {@link Formatting.oneSpace} is used, but no spaces exist between the elements, no formatting is applied.\n */\n allowLess?: boolean\n}\n\nexport interface FormattingMove {\n characters?: number\n tabs?: number\n lines?: number\n}\n\n/**\n * Contains utilities to easily create formatting actions that can be applied to a {@link FormattingRegion}.\n */\nexport namespace Formatting {\n\n /**\n * Creates a new formatting that tries to fit the existing text into one of the specified formattings.\n * @param formattings All possible formattings.\n */\n export function fit(...formattings: FormattingAction[]): FormattingAction {\n return {\n options: {},\n moves: formattings.flatMap(e => e.moves).sort(compareMoves)\n };\n }\n\n /**\n * Creates a new formatting that removes all spaces\n */\n export function noSpace(options?: FormattingActionOptions): FormattingAction {\n return spaces(0, options);\n }\n\n /**\n * Creates a new formatting that creates a single space\n */\n export function oneSpace(options?: FormattingActionOptions): FormattingAction {\n return spaces(1, options);\n }\n\n /**\n * Creates a new formatting that creates the specified amount of spaces\n *\n * @param count The amount of spaces to be inserted\n */\n export function spaces(count: number, options?: FormattingActionOptions): FormattingAction {\n return {\n options: options ?? {},\n moves: [{\n characters: count\n }]\n };\n }\n\n /**\n * Creates a new formatting that moves an element to the next line\n */\n export function newLine(options?: FormattingActionOptions): FormattingAction {\n return newLines(1, options);\n }\n\n /**\n * Creates a new formatting that creates the specified amount of new lines.\n */\n export function newLines(count: number, options?: FormattingActionOptions): FormattingAction {\n return {\n options: options ?? {},\n moves: [{\n lines: count\n }]\n };\n }\n\n /**\n * Creates a new formatting that moves the element to a new line and indents that line.\n */\n export function indent(options?: FormattingActionOptions): FormattingAction {\n return {\n options: options ?? {},\n moves: [{\n tabs: 1,\n lines: 1\n }]\n };\n }\n\n /**\n * Creates a new formatting that removes all indentation.\n */\n export function noIndent(options?: FormattingActionOptions): FormattingAction {\n return {\n options: options ?? {},\n moves: [{\n tabs: 0\n }]\n };\n }\n\n function compareMoves(a: FormattingMove, b: FormattingMove): number {\n const aLines = a.lines ?? 0;\n const bLines = b.lines ?? 0;\n const aTabs = a.tabs ?? 0;\n const bTabs = b.tabs ?? 0;\n const aSpaces = a.characters ?? 0;\n const bSpaces = b.characters ?? 0;\n if (aLines < bLines) {\n return -1;\n } else if (aLines > bLines) {\n return 1;\n } else if (aTabs < bTabs) {\n return -1;\n } else if (aTabs > bTabs) {\n return 1;\n } else if (aSpaces < bSpaces) {\n return -1;\n } else if (aSpaces > bSpaces) {\n return 1;\n } else {\n return 0;\n }\n }\n}\n\nexport type FormattingCollector = (node: CstNode, mode: 'prepend' | 'append', formatting: FormattingAction) => void;\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type {\n CancellationToken,\n TypeHierarchyItem,\n TypeHierarchyPrepareParams,\n TypeHierarchySubtypesParams,\n TypeHierarchySupertypesParams\n} from 'vscode-languageserver';\nimport { SymbolKind } from 'vscode-languageserver';\nimport type { GrammarConfig } from '../languages/grammar-config.js';\nimport type { NameProvider } from '../references/name-provider.js';\nimport type { References } from '../references/references.js';\nimport type { LangiumServices } from './lsp-services.js';\nimport type { AstNode } from '../syntax-tree.js';\nimport { findDeclarationNodeAtOffset } from '../utils/cst-utils.js';\nimport { URI } from '../utils/uri-utils.js';\nimport type { LangiumDocument, LangiumDocuments } from '../workspace/documents.js';\nimport type { MaybePromise } from '../utils/promise-utils.js';\n\n/**\n * Language-specific service for handling type hierarchy requests.\n */\n\nexport interface TypeHierarchyProvider {\n prepareTypeHierarchy(document: LangiumDocument, params: TypeHierarchyPrepareParams, cancelToken?: CancellationToken): MaybePromise;\n\n supertypes(params: TypeHierarchySupertypesParams, cancelToken?: CancellationToken): MaybePromise;\n\n subtypes(params: TypeHierarchySubtypesParams, cancelToken?: CancellationToken): MaybePromise;\n}\n\nexport abstract class AbstractTypeHierarchyProvider implements TypeHierarchyProvider {\n protected readonly grammarConfig: GrammarConfig;\n protected readonly nameProvider: NameProvider;\n protected readonly documents: LangiumDocuments;\n protected readonly references: References;\n\n constructor(services: LangiumServices) {\n this.grammarConfig = services.parser.GrammarConfig;\n this.nameProvider = services.references.NameProvider;\n this.documents = services.shared.workspace.LangiumDocuments;\n this.references = services.references.References;\n }\n\n prepareTypeHierarchy(document: LangiumDocument, params: TypeHierarchyPrepareParams, _cancelToken?: CancellationToken): MaybePromise {\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.position),\n this.grammarConfig.nameRegexp,\n );\n if (!targetNode) {\n return undefined;\n }\n\n const declarationNode = this.references.findDeclarationNode(targetNode);\n if (!declarationNode) {\n return undefined;\n }\n\n return this.getTypeHierarchyItems(declarationNode.astNode, document);\n }\n\n protected getTypeHierarchyItems(targetNode: AstNode, document: LangiumDocument): TypeHierarchyItem[] | undefined {\n const nameNode = this.nameProvider.getNameNode(targetNode);\n const name = this.nameProvider.getName(targetNode);\n if (!nameNode || !targetNode.$cstNode || name === undefined) {\n return undefined;\n }\n\n return [\n {\n kind: SymbolKind.Class,\n name,\n range: targetNode.$cstNode.range,\n selectionRange: nameNode.range,\n uri: document.uri.toString(),\n ...this.getTypeHierarchyItem(targetNode),\n },\n ];\n }\n\n /**\n * Override this method to change default properties of the type hierarchy item or add additional ones like `tags`\n * or `details`.\n *\n * @example\n * // Change the node kind to SymbolKind.Interface\n * return { kind: SymbolKind.Interface }\n *\n * @see NodeKindProvider\n */\n protected getTypeHierarchyItem(_targetNode: AstNode): Partial | undefined {\n return undefined;\n }\n\n async supertypes(params: TypeHierarchySupertypesParams, _cancelToken?: CancellationToken): Promise {\n const document = await this.documents.getOrCreateDocument(URI.parse(params.item.uri));\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.item.range.start),\n this.grammarConfig.nameRegexp,\n );\n if (!targetNode) {\n return undefined;\n }\n return this.getSupertypes(targetNode.astNode);\n }\n\n /**\n * Override this method to collect the supertypes for your language.\n */\n protected abstract getSupertypes(node: AstNode): MaybePromise;\n\n async subtypes(params: TypeHierarchySubtypesParams, _cancelToken?: CancellationToken): Promise {\n const document = await this.documents.getOrCreateDocument(URI.parse(params.item.uri));\n const rootNode = document.parseResult.value;\n const targetNode = findDeclarationNodeAtOffset(\n rootNode.$cstNode,\n document.textDocument.offsetAt(params.item.range.start),\n this.grammarConfig.nameRegexp,\n );\n if (!targetNode) {\n return undefined;\n }\n\n return this.getSubtypes(targetNode.astNode);\n }\n\n /**\n * Override this method to collect the subtypes for your language.\n */\n protected abstract getSubtypes(node: AstNode): MaybePromise;\n}\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { URI } from '../utils/uri-utils.js';\nimport { UriUtils } from '../utils/uri-utils.js';\nimport type { FileSystemNode, FileSystemProvider } from '../workspace/file-system-provider.js';\nimport * as fs from 'node:fs';\n\nexport type NodeTextEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'latin1';\n\nexport class NodeFileSystemProvider implements FileSystemProvider {\n\n encoding: NodeTextEncoding = 'utf-8';\n\n readFile(uri: URI): Promise {\n return fs.promises.readFile(uri.fsPath, this.encoding);\n }\n\n async readDirectory(folderPath: URI): Promise {\n const dirents = await fs.promises.readdir(folderPath.fsPath, { withFileTypes: true });\n return dirents.map(dirent => ({\n dirent, // Include the raw entry, it may be useful...\n isFile: dirent.isFile(),\n isDirectory: dirent.isDirectory(),\n uri: UriUtils.joinPath(folderPath, dirent.name)\n }));\n }\n}\n\nexport const NodeFileSystem = {\n fileSystemProvider: () => new NodeFileSystemProvider()\n};\n", "import { startLanguageServer } from 'langium/lsp';\nimport { NodeFileSystem } from 'langium/node';\nimport { createConnection, ProposedFeatures } from 'vscode-languageserver/node.js';\nimport { createPlOneServices } from './pl-one-module.js';\n\n// Create a connection to the client\nconst connection = createConnection(ProposedFeatures.all);\n\n// Inject the shared services and language-specific services\nconst { shared } = createPlOneServices({ connection, ...NodeFileSystem });\n\n// Start the language server with the shared services\nstartLanguageServer(shared);\n", "/******************************************************************************\n * Copyright 2021 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nexport * from './default-module.js';\nexport * from './dependency-injection.js';\nexport * from './service-registry.js';\nexport * from './services.js';\nexport * from './syntax-tree.js';\nexport * from './documentation/index.js';\nexport * from './languages/index.js';\nexport * from './parser/index.js';\nexport * from './references/index.js';\nexport * from './serializer/index.js';\nexport * from './utils/index.js';\nexport * from './validation/index.js';\nexport * from './workspace/index.js';\n\n// Export the Langium Grammar AST definitions in the `GrammarAST` namespace\nimport * as GrammarAST from './languages/generated/ast.js';\nimport type { Grammar } from './languages/generated/ast.js';\nexport { Grammar, GrammarAST };\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nexport * from './caching.js';\nexport * from './event.js';\nexport * from './collections.js';\nexport * from './disposable.js';\nexport * from './errors.js';\nexport * from './grammar-loader.js';\nexport * from './promise-utils.js';\nexport * from './stream.js';\nexport * from './uri-utils.js';\n\nimport * as AstUtils from './ast-utils.js';\nimport * as Cancellation from './cancellation.js';\nimport * as CstUtils from './cst-utils.js';\nimport * as GrammarUtils from './grammar-utils.js';\nimport * as RegExpUtils from './regexp-utils.js';\nexport { AstUtils, Cancellation, CstUtils, GrammarUtils, RegExpUtils };\n", "/******************************************************************************\n * Copyright 2022 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport type { URI } from '../utils/uri-utils.js';\n\nexport interface FileSystemNode {\n readonly isFile: boolean;\n readonly isDirectory: boolean;\n readonly uri: URI;\n}\n\nexport type FileSystemFilter = (node: FileSystemNode) => boolean;\n\n/**\n * Provides methods to interact with an abstract file system. The default implementation is based on the node.js `fs` API.\n */\nexport interface FileSystemProvider {\n /**\n * Reads a document asynchronously from a given URI.\n * @returns The string content of the file with the specified URI.\n */\n readFile(uri: URI): Promise;\n /**\n * Reads the directory information for the given URI.\n * @returns The list of file system entries that are contained within the specified directory.\n */\n readDirectory(uri: URI): Promise;\n}\n\nexport class EmptyFileSystemProvider implements FileSystemProvider {\n\n readFile(): Promise {\n throw new Error('No file system is available.');\n }\n\n async readDirectory(): Promise {\n return [];\n }\n\n}\n\nexport const EmptyFileSystem = {\n fileSystemProvider: () => new EmptyFileSystemProvider()\n};\n", "/******************************************************************************\n * Copyright 2023 TypeFox GmbH\n * This program and the accompanying materials are made available under the\n * terms of the MIT License, which is available in the project root.\n ******************************************************************************/\n\nimport { createDefaultCoreModule, createDefaultSharedCoreModule } from '../default-module.js';\nimport type { Module } from '../dependency-injection.js';\nimport { inject } from '../dependency-injection.js';\nimport * as ast from '../languages/generated/ast.js';\nimport type { LangiumCoreServices, LangiumSharedCoreServices, PartialLangiumCoreServices, PartialLangiumSharedCoreServices } from '../services.js';\nimport type { Mutable } from '../syntax-tree.js';\nimport { EmptyFileSystem } from '../workspace/file-system-provider.js';\nimport { URI } from './uri-utils.js';\n\nconst minimalGrammarModule: Module = {\n Grammar: () => undefined as unknown as ast.Grammar,\n LanguageMetaData: () => ({\n caseInsensitive: false,\n fileExtensions: ['.langium'],\n languageId: 'langium'\n })\n};\n\nconst minimalSharedGrammarModule: Module = {\n AstReflection: () => new ast.LangiumGrammarAstReflection()\n};\n\nfunction createMinimalGrammarServices(): LangiumCoreServices {\n const shared = inject(\n createDefaultSharedCoreModule(EmptyFileSystem),\n minimalSharedGrammarModule\n );\n const grammar = inject(\n createDefaultCoreModule({ shared }),\n minimalGrammarModule\n );\n shared.ServiceRegistry.register(grammar);\n return grammar;\n}\n\n/**\n * Load a Langium grammar for your language from a JSON string. This is used by several services,\n * most notably the parser builder which interprets the grammar to create a parser.\n */\nexport function loadGrammarFromJson(json: string): ast.Grammar {\n const services = createMinimalGrammarServices();\n const astNode = services.serializer.JsonSerializer.deserialize(json) as Mutable;\n services.shared.workspace.LangiumDocumentFactory.fromModel(astNode, URI.parse(`memory://${astNode.name ?? 'grammar'}.langium`));\n return astNode;\n}\n", "/******************************************************************************\r\n * This file was generated by langium-cli 3.0.3.\r\n * DO NOT EDIT MANUALLY!\r\n ******************************************************************************/\r\n\r\n/* eslint-disable */\r\nimport type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';\r\nimport { AbstractAstReflection } from 'langium';\r\n\r\nexport const PlOneTerminals = {\r\n WS: /\\s+/,\r\n ID: /[_a-zA-Z][\\w_]*/,\r\n INT: /[0-9]+/,\r\n ML_COMMENT: /\\/\\*[\\s\\S]*?\\*\\//,\r\n SL_COMMENT: /\\/\\/[^\\n\\r]*/,\r\n};\r\n\r\nexport interface EndProgram extends AstNode {\r\n readonly $container: Model;\r\n readonly $type: 'EndProgram';\r\n name: string;\r\n}\r\n\r\nexport const EndProgram = 'EndProgram';\r\n\r\nexport function isEndProgram(item: unknown): item is EndProgram {\r\n return reflection.isInstance(item, EndProgram);\r\n}\r\n\r\nexport interface Greeting extends AstNode {\r\n readonly $container: Model;\r\n readonly $type: 'Greeting';\r\n person: Reference;\r\n}\r\n\r\nexport const Greeting = 'Greeting';\r\n\r\nexport function isGreeting(item: unknown): item is Greeting {\r\n return reflection.isInstance(item, Greeting);\r\n}\r\n\r\nexport interface Loop extends AstNode {\r\n readonly $container: Model;\r\n readonly $type: 'Loop';\r\n name: string;\r\n num: number;\r\n}\r\n\r\nexport const Loop = 'Loop';\r\n\r\nexport function isLoop(item: unknown): item is Loop {\r\n return reflection.isInstance(item, Loop);\r\n}\r\n\r\nexport interface Model extends AstNode {\r\n readonly $type: 'Model';\r\n endProgram?: EndProgram;\r\n greetings: Array;\r\n loop: Array;\r\n persons: Array;\r\n progname: Array;\r\n}\r\n\r\nexport const Model = 'Model';\r\n\r\nexport function isModel(item: unknown): item is Model {\r\n return reflection.isInstance(item, Model);\r\n}\r\n\r\nexport interface Person extends AstNode {\r\n readonly $container: Model;\r\n readonly $type: 'Person';\r\n name: string;\r\n}\r\n\r\nexport const Person = 'Person';\r\n\r\nexport function isPerson(item: unknown): item is Person {\r\n return reflection.isInstance(item, Person);\r\n}\r\n\r\nexport interface Progname extends AstNode {\r\n readonly $container: Model;\r\n readonly $type: 'Progname';\r\n name: string;\r\n num: number;\r\n}\r\n\r\nexport const Progname = 'Progname';\r\n\r\nexport function isProgname(item: unknown): item is Progname {\r\n return reflection.isInstance(item, Progname);\r\n}\r\n\r\nexport type PlOneAstType = {\r\n EndProgram: EndProgram\r\n Greeting: Greeting\r\n Loop: Loop\r\n Model: Model\r\n Person: Person\r\n Progname: Progname\r\n}\r\n\r\nexport class PlOneAstReflection extends AbstractAstReflection {\r\n\r\n getAllTypes(): string[] {\r\n return ['EndProgram', 'Greeting', 'Loop', 'Model', 'Person', 'Progname'];\r\n }\r\n\r\n protected override computeIsSubtype(subtype: string, supertype: string): boolean {\r\n switch (subtype) {\r\n default: {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n getReferenceType(refInfo: ReferenceInfo): string {\r\n const referenceId = `${refInfo.container.$type}:${refInfo.property}`;\r\n switch (referenceId) {\r\n case 'Greeting:person': {\r\n return Person;\r\n }\r\n default: {\r\n throw new Error(`${referenceId} is not a valid reference id.`);\r\n }\r\n }\r\n }\r\n\r\n getTypeMetaData(type: string): TypeMetaData {\r\n switch (type) {\r\n case 'EndProgram': {\r\n return {\r\n name: 'EndProgram',\r\n properties: [\r\n { name: 'name' }\r\n ]\r\n };\r\n }\r\n case 'Greeting': {\r\n return {\r\n name: 'Greeting',\r\n properties: [\r\n { name: 'person' }\r\n ]\r\n };\r\n }\r\n case 'Loop': {\r\n return {\r\n name: 'Loop',\r\n properties: [\r\n { name: 'name' },\r\n { name: 'num' }\r\n ]\r\n };\r\n }\r\n case 'Model': {\r\n return {\r\n name: 'Model',\r\n properties: [\r\n { name: 'endProgram' },\r\n { name: 'greetings', defaultValue: [] },\r\n { name: 'loop', defaultValue: [] },\r\n { name: 'persons', defaultValue: [] },\r\n { name: 'progname', defaultValue: [] }\r\n ]\r\n };\r\n }\r\n case 'Person': {\r\n return {\r\n name: 'Person',\r\n properties: [\r\n { name: 'name' }\r\n ]\r\n };\r\n }\r\n case 'Progname': {\r\n return {\r\n name: 'Progname',\r\n properties: [\r\n { name: 'name' },\r\n { name: 'num' }\r\n ]\r\n };\r\n }\r\n default: {\r\n return {\r\n name: type,\r\n properties: []\r\n };\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport const reflection = new PlOneAstReflection();\r\n", "/******************************************************************************\r\n * This file was generated by langium-cli 3.0.3.\r\n * DO NOT EDIT MANUALLY!\r\n ******************************************************************************/\r\n\r\nimport type { Grammar } from 'langium';\r\nimport { loadGrammarFromJson } from 'langium';\r\n\r\nlet loadedPlOneGrammar: Grammar | undefined;\r\nexport const PlOneGrammar = (): Grammar => loadedPlOneGrammar ?? (loadedPlOneGrammar = loadGrammarFromJson(`{\r\n \"$type\": \"Grammar\",\r\n \"isDeclared\": true,\r\n \"name\": \"PlOne\",\r\n \"imports\": [],\r\n \"rules\": [\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"Model\",\r\n \"entry\": true,\r\n \"definition\": {\r\n \"$type\": \"Alternatives\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"progname\",\r\n \"operator\": \"+=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@1\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"loop\",\r\n \"operator\": \"+=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@2\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"endProgram\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@3\"\r\n },\r\n \"arguments\": []\r\n }\r\n }\r\n ],\r\n \"cardinality\": \"*\"\r\n },\r\n {\r\n \"$type\": \"Alternatives\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"persons\",\r\n \"operator\": \"+=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@4\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"greetings\",\r\n \"operator\": \"+=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@5\"\r\n },\r\n \"arguments\": []\r\n }\r\n }\r\n ],\r\n \"cardinality\": \"*\"\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false\r\n },\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"Progname\",\r\n \"definition\": {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"name\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \":\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"PROCEDURE\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"OPTIONS\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"(MAIN)\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \";\"\r\n },\r\n {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"/*\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"name\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"*/\"\r\n }\r\n ],\r\n \"cardinality\": \"*\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"FLAG\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"=\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"num\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@8\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \";\"\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"entry\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false\r\n },\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"Loop\",\r\n \"definition\": {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"LOOP\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \":\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"DO\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"WHILE\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"(\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"FLAG\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"=\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"num\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@8\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \")\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \";\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"PUT\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"SKIP\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"DATA\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"(\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"name\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \")\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \";\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"END\"\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"LOOP;\"\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"entry\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false\r\n },\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"EndProgram\",\r\n \"definition\": {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"END\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"name\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \";\"\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"entry\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false\r\n },\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"Person\",\r\n \"definition\": {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"person\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"name\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n }\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"entry\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false,\r\n \"$comment\": \"/*just simple program*/\"\r\n },\r\n {\r\n \"$type\": \"ParserRule\",\r\n \"name\": \"Greeting\",\r\n \"definition\": {\r\n \"$type\": \"Group\",\r\n \"elements\": [\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"Hello\"\r\n },\r\n {\r\n \"$type\": \"Assignment\",\r\n \"feature\": \"person\",\r\n \"operator\": \"=\",\r\n \"terminal\": {\r\n \"$type\": \"CrossReference\",\r\n \"type\": {\r\n \"$ref\": \"#/rules@4\"\r\n },\r\n \"terminal\": {\r\n \"$type\": \"RuleCall\",\r\n \"rule\": {\r\n \"$ref\": \"#/rules@7\"\r\n },\r\n \"arguments\": []\r\n },\r\n \"deprecatedSyntax\": false\r\n }\r\n },\r\n {\r\n \"$type\": \"Keyword\",\r\n \"value\": \"!\"\r\n }\r\n ]\r\n },\r\n \"definesHiddenTokens\": false,\r\n \"entry\": false,\r\n \"fragment\": false,\r\n \"hiddenTokens\": [],\r\n \"parameters\": [],\r\n \"wildcard\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"hidden\": true,\r\n \"name\": \"WS\",\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/\\\\\\\\s+/\"\r\n },\r\n \"fragment\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"name\": \"ID\",\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/[_a-zA-Z][\\\\\\\\w_]*/\"\r\n },\r\n \"fragment\": false,\r\n \"hidden\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"name\": \"INT\",\r\n \"type\": {\r\n \"$type\": \"ReturnType\",\r\n \"name\": \"number\"\r\n },\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/[0-9]+/\"\r\n },\r\n \"fragment\": false,\r\n \"hidden\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"name\": \"STRING\",\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/\\\\\"(\\\\\\\\\\\\\\\\.|[^\\\\\"\\\\\\\\\\\\\\\\])*\\\\\"|'(\\\\\\\\\\\\\\\\.|[^'\\\\\\\\\\\\\\\\])*'/\"\r\n },\r\n \"fragment\": false,\r\n \"hidden\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"hidden\": true,\r\n \"name\": \"ML_COMMENT\",\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/\\\\\\\\/\\\\\\\\*[\\\\\\\\s\\\\\\\\S]*?\\\\\\\\*\\\\\\\\//\"\r\n },\r\n \"fragment\": false\r\n },\r\n {\r\n \"$type\": \"TerminalRule\",\r\n \"hidden\": true,\r\n \"name\": \"SL_COMMENT\",\r\n \"definition\": {\r\n \"$type\": \"RegexToken\",\r\n \"regex\": \"/\\\\\\\\/\\\\\\\\/[^\\\\\\\\n\\\\\\\\r]*/\"\r\n },\r\n \"fragment\": false\r\n }\r\n ],\r\n \"definesHiddenTokens\": false,\r\n \"hiddenTokens\": [],\r\n \"interfaces\": [],\r\n \"types\": [],\r\n \"usedGrammars\": []\r\n}`));\r\n", "/******************************************************************************\r\n * This file was generated by langium-cli 3.0.3.\r\n * DO NOT EDIT MANUALLY!\r\n ******************************************************************************/\r\n\r\nimport type { LangiumSharedCoreServices, LangiumCoreServices, LangiumGeneratedCoreServices, LangiumGeneratedSharedCoreServices, LanguageMetaData, Module } from 'langium';\r\nimport { PlOneAstReflection } from './ast.js';\r\nimport { PlOneGrammar } from './grammar.js';\r\n\r\nexport const PlOneLanguageMetaData = {\r\n languageId: 'pl-one',\r\n fileExtensions: ['.pl1', '.PLI'],\r\n caseInsensitive: false\r\n} as const satisfies LanguageMetaData;\r\n\r\nexport const PlOneGeneratedSharedModule: Module = {\r\n AstReflection: () => new PlOneAstReflection()\r\n};\r\n\r\nexport const PlOneGeneratedModule: Module = {\r\n Grammar: () => PlOneGrammar(),\r\n LanguageMetaData: () => PlOneLanguageMetaData,\r\n parser: {}\r\n};\r\n", "import type { ValidationAcceptor, ValidationChecks } from 'langium';\nimport type { PlOneAstType, Progname } from './generated/ast.js';\nimport type { PlOneServices } from './pl-one-module.js';\n\n/**\n * Register custom validation checks.\n */\nexport function registerValidationChecks(services: PlOneServices) {\n const registry = services.validation.ValidationRegistry;\n const validator = services.validation.PlOneValidator;\n const checks: ValidationChecks = {\n Progname: validator.checkPrognameStartsWithCapital\n };\n registry.register(checks, validator);\n}\n\n/**\n * Implementation of custom validations.\n */\nexport class PlOneValidator {\n\n checkPrognameStartsWithCapital(prog: Progname, accept: ValidationAcceptor): void {\n if (prog.name) {\n const firstChar = prog.name.substring(0, 1);\n if (firstChar.toUpperCase() !== firstChar) {\n accept('warning', 'Prog name should start with a capital.', { node: prog, property: 'name' });\n }\n }\n }\n\n}\n", "import { type Module, inject } from 'langium';\nimport { createDefaultModule, createDefaultSharedModule, type DefaultSharedModuleContext, type LangiumServices, type LangiumSharedServices, type PartialLangiumServices } from 'langium/lsp';\nimport { PlOneGeneratedModule, PlOneGeneratedSharedModule } from './generated/module.js';\nimport { PlOneValidator, registerValidationChecks } from './pl-one-validator.js';\n\n/**\n * Declaration of custom services - add your own service classes here.\n */\nexport type PlOneAddedServices = {\n validation: {\n PlOneValidator: PlOneValidator\n }\n}\n\n/**\n * Union of Langium default services and your custom services - use this as constructor parameter\n * of custom service classes.\n */\nexport type PlOneServices = LangiumServices & PlOneAddedServices\n\n/**\n * Dependency injection module that overrides Langium default services and contributes the\n * declared custom services. The Langium defaults can be partially specified to override only\n * selected services, while the custom services must be fully specified.\n */\nexport const PlOneModule: Module = {\n validation: {\n PlOneValidator: () => new PlOneValidator()\n }\n};\n\n/**\n * Create the full set of services required by Langium.\n *\n * First inject the shared services by merging two modules:\n * - Langium default shared services\n * - Services generated by langium-cli\n *\n * Then inject the language-specific services by merging three modules:\n * - Langium default language-specific services\n * - Services generated by langium-cli\n * - Services specified in this file\n *\n * @param context Optional module context with the LSP connection\n * @returns An object wrapping the shared services and the language-specific services\n */\nexport function createPlOneServices(context: DefaultSharedModuleContext): {\n shared: LangiumSharedServices,\n PlOne: PlOneServices\n} {\n const shared = inject(\n createDefaultSharedModule(context),\n PlOneGeneratedSharedModule\n );\n const PlOne = inject(\n createDefaultModule({ shared }),\n PlOneGeneratedModule,\n PlOneModule\n );\n shared.ServiceRegistry.register(PlOne);\n registerValidationChecks(PlOne);\n return { shared, PlOne };\n}\n"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8DAAAA,UAAA;AAAA;AAKA,WAAO,eAAeA,UAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,IAAAA,SAAQ,WAAWA,SAAQ,aAAaA,SAAQ,cAAcA,SAAQ,QAAQA,SAAQ,OAAOA,SAAQ,QAAQA,SAAQ,SAASA,SAAQ,SAASA,SAAQ,UAAU;AACjK,aAAS,QAAQ,OAAO;AACpB,aAAO,UAAU,QAAQ,UAAU;AAAA,IACvC;AACA,IAAAA,SAAQ,UAAU;AAClB,aAAS,OAAO,OAAO;AACnB,aAAO,OAAO,UAAU,YAAY,iBAAiB;AAAA,IACzD;AACA,IAAAA,SAAQ,SAAS;AACjB,aAAS,OAAO,OAAO;AACnB,aAAO,OAAO,UAAU,YAAY,iBAAiB;AAAA,IACzD;AACA,IAAAA,SAAQ,SAAS;AACjB,aAAS,MAAM,OAAO;AAClB,aAAO,iBAAiB;AAAA,IAC5B;AACA,IAAAA,SAAQ,QAAQ;AAChB,aAAS,KAAK,OAAO;AACjB,aAAO,OAAO,UAAU;AAAA,IAC5B;AACA,IAAAA,SAAQ,OAAO;AACf,aAAS,MAAM,OAAO;AAClB,aAAO,MAAM,QAAQ,KAAK;AAAA,IAC9B;AACA,IAAAA,SAAQ,QAAQ;AAChB,aAAS,YAAY,OAAO;AACxB,aAAO,MAAM,KAAK,KAAK,MAAM,MAAM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,eAAe,MAAM,IAAI,mBAAmB;AAChD;AAEO,IAAM,uBAAkF;AAAA,EAC3F,SAAS,MAAM,aAAa;AAAA,EAC5B,kBAAkB,MAAM;AAAA,EACxB,QAAQ,CAAC;AACb;;;AChBO,SAAS,yBAAyB,UAAyB;AAC9D,QAAM,WAAW,SAAS,WAAW;AACrC,QAAM,YAAY,SAAS,WAAW;AACtC,QAAM,SAAyC;AAAA,IAC3C,UAAU,UAAU;AAAA,EACxB;AACA,WAAS,SAAS,QAAQ,SAAS;AACvC;AAKO,IAAM,iBAAN,MAAqB;AAAA,EAExB,+BAA+B,MAAgB,QAAkC;AAC7E,QAAI,KAAK,MAAM;AACX,YAAM,YAAY,KAAK,KAAK,UAAU,GAAG,CAAC;AAC1C,UAAI,UAAU,YAAY,MAAM,WAAW;AACvC,eAAO,WAAW,0CAA0C,EAAE,MAAM,MAAM,UAAU,OAAO,CAAC;AAAA,MAChG;AAAA,IACJ;AAAA,EACJ;AAEJ;;;ACLO,IAAM,cAAkF;AAAA,EAC3F,YAAY;AAAA,IACR,gBAAgB,MAAM,IAAI,eAAe;AAAA,EAC7C;AACJ;AAiBO,SAAS,oBAAoB,SAGlC;AACE,QAAMC,UAAS;AAAA,IACX,0BAA0B,OAAO;AAAA,IACjC;AAAA,EACJ;AACA,QAAM,QAAQ;AAAA,IACV,oBAAoB,EAAE,QAAAA,QAAO,CAAC;AAAA,IAC9B;AAAA,IACA;AAAA,EACJ;AACA,EAAAA,QAAO,gBAAgB,SAAS,KAAK;AACrC,2BAAyB,KAAK;AAC9B,SAAO,EAAE,QAAAA,SAAQ,MAAM;AAC3B;;;ATxDA,IAAM,iBAAa,+BAAiB,8BAAiB,GAAG;AAGxD,IAAM,EAAE,OAAO,IAAI,oBAAoB,iBAAE,cAAe,eAAgB;AAGxE,oBAAoB,MAAM;", - "names": ["exports", "require_is", "exports", "exports", "ErrorCodes", "ResponseError", "Message", "exports", "Touch", "_a", "exports", "Disposable", "exports", "RAL", "exports", "Event", "Emitter", "exports", "Is", "CancellationToken", "CancellationTokenSource", "exports", "CancellationState", "exports", "reject", "exports", "Is", "MessageReader", "ResolvedMessageReaderOptions", "exports", "Is", "MessageWriter", "ResolvedMessageWriterOptions", "exports", "result", "exports", "Is", "CancelNotification", "ProgressToken", "ProgressNotification", "StarRequestHandler", "Trace", "TraceValues", "toString", "TraceFormat", "SetTraceNotification", "LogTraceNotification", "ConnectionErrors", "ConnectionStrategy", "IdCancellationReceiverStrategy", "RequestCancellationReceiverStrategy", "CancellationReceiverStrategy", "_", "CancellationSenderStrategy", "CancellationStrategy", "MessageStrategy", "ConnectionOptions", "ConnectionState", "timer", "startTime", "connection", "first", "last", "reject", "exports", "exports", "stream", "reject", "RIL", "exports", "process", "reject", "exports", "module", "require_main", "exports", "module", "require", "DocumentUri", "URI", "integer", "uinteger", "Position", "Is", "Range", "Location", "LocationLink", "Color", "ColorInformation", "ColorPresentation", "TextEdit", "FoldingRangeKind", "FoldingRange", "DiagnosticRelatedInformation", "DiagnosticSeverity", "DiagnosticTag", "CodeDescription", "Diagnostic", "Command", "ChangeAnnotation", "ChangeAnnotationIdentifier", "AnnotatedTextEdit", "TextDocumentEdit", "OptionalVersionedTextDocumentIdentifier", "CreateFile", "RenameFile", "DeleteFile", "WorkspaceEdit", "TextEditChangeImpl", "ChangeAnnotations", "WorkspaceChange", "TextDocumentIdentifier", "VersionedTextDocumentIdentifier", "TextDocumentItem", "MarkupKind", "MarkupContent", "CompletionItemKind", "InsertTextFormat", "CompletionItemTag", "InsertReplaceEdit", "InsertTextMode", "CompletionItemLabelDetails", "CompletionItem", "CompletionList", "MarkedString", "Hover", "ParameterInformation", "SignatureInformation", "DocumentHighlightKind", "DocumentHighlight", "SymbolKind", "SymbolTag", "SymbolInformation", "WorkspaceSymbol", "DocumentSymbol", "CodeActionKind", "CodeActionTriggerKind", "CodeActionContext", "CodeAction", "CodeLens", "FormattingOptions", "DocumentLink", "SelectionRange", "SemanticTokenTypes", "SemanticTokenModifiers", "SemanticTokens", "InlineValueText", "InlineValueVariableLookup", "InlineValueEvaluatableExpression", "InlineValueContext", "InlayHintKind", "InlayHintLabelPart", "InlayHint", "StringValue", "InlineCompletionItem", "InlineCompletionList", "InlineCompletionTriggerKind", "SelectedCompletionInfo", "InlineCompletionContext", "WorkspaceFolder", "TextDocument", "FullTextDocument", "mergeSort", "a", "toString", "undefined", "min", "require_messages", "exports", "MessageDirection", "require_is", "exports", "exports", "ImplementationRequest", "exports", "TypeDefinitionRequest", "exports", "WorkspaceFoldersRequest", "DidChangeWorkspaceFoldersNotification", "exports", "ConfigurationRequest", "exports", "DocumentColorRequest", "ColorPresentationRequest", "exports", "FoldingRangeRequest", "FoldingRangeRefreshRequest", "exports", "DeclarationRequest", "exports", "SelectionRangeRequest", "exports", "WorkDoneProgress", "WorkDoneProgressCreateRequest", "WorkDoneProgressCancelNotification", "exports", "CallHierarchyPrepareRequest", "CallHierarchyIncomingCallsRequest", "CallHierarchyOutgoingCallsRequest", "exports", "TokenFormat", "SemanticTokensRegistrationType", "SemanticTokensRequest", "SemanticTokensDeltaRequest", "SemanticTokensRangeRequest", "SemanticTokensRefreshRequest", "exports", "ShowDocumentRequest", "exports", "LinkedEditingRangeRequest", "exports", "FileOperationPatternKind", "WillCreateFilesRequest", "DidCreateFilesNotification", "WillRenameFilesRequest", "DidRenameFilesNotification", "DidDeleteFilesNotification", "WillDeleteFilesRequest", "exports", "UniquenessLevel", "MonikerKind", "MonikerRequest", "exports", "TypeHierarchyPrepareRequest", "TypeHierarchySupertypesRequest", "TypeHierarchySubtypesRequest", "exports", "InlineValueRequest", "InlineValueRefreshRequest", "exports", "InlayHintRequest", "InlayHintResolveRequest", "InlayHintRefreshRequest", "exports", "Is", "DiagnosticServerCancellationData", "DocumentDiagnosticReportKind", "DocumentDiagnosticRequest", "WorkspaceDiagnosticRequest", "DiagnosticRefreshRequest", "exports", "Is", "NotebookCellKind", "ExecutionSummary", "NotebookCell", "NotebookDocument", "NotebookDocumentSyncRegistrationType", "DidOpenNotebookDocumentNotification", "NotebookCellArrayChange", "DidChangeNotebookDocumentNotification", "DidSaveNotebookDocumentNotification", "DidCloseNotebookDocumentNotification", "exports", "InlineCompletionRequest", "exports", "Is", "TextDocumentFilter", "NotebookDocumentFilter", "NotebookCellTextDocumentFilter", "DocumentSelector", "RegistrationRequest", "UnregistrationRequest", "ResourceOperationKind", "FailureHandlingKind", "PositionEncodingKind", "StaticRegistrationOptions", "TextDocumentRegistrationOptions", "WorkDoneProgressOptions", "InitializeRequest", "InitializeErrorCodes", "InitializedNotification", "ShutdownRequest", "ExitNotification", "DidChangeConfigurationNotification", "MessageType", "ShowMessageNotification", "ShowMessageRequest", "LogMessageNotification", "TelemetryEventNotification", "TextDocumentSyncKind", "DidOpenTextDocumentNotification", "TextDocumentContentChangeEvent", "DidChangeTextDocumentNotification", "DidCloseTextDocumentNotification", "DidSaveTextDocumentNotification", "TextDocumentSaveReason", "WillSaveTextDocumentNotification", "WillSaveTextDocumentWaitUntilRequest", "DidChangeWatchedFilesNotification", "FileChangeType", "RelativePattern", "WatchKind", "PublishDiagnosticsNotification", "CompletionTriggerKind", "CompletionRequest", "CompletionResolveRequest", "HoverRequest", "SignatureHelpTriggerKind", "SignatureHelpRequest", "DefinitionRequest", "ReferencesRequest", "DocumentHighlightRequest", "DocumentSymbolRequest", "CodeActionRequest", "CodeActionResolveRequest", "WorkspaceSymbolRequest", "WorkspaceSymbolResolveRequest", "CodeLensRequest", "CodeLensResolveRequest", "CodeLensRefreshRequest", "DocumentLinkRequest", "DocumentLinkResolveRequest", "DocumentFormattingRequest", "DocumentRangeFormattingRequest", "DocumentRangesFormattingRequest", "DocumentOnTypeFormattingRequest", "PrepareSupportDefaultBehavior", "RenameRequest", "PrepareRenameRequest", "ExecuteCommandRequest", "ApplyWorkspaceEditRequest", "require_connection", "exports", "require_api", "exports", "LSPErrorCodes", "require_main", "exports", "exports", "exports", "connection", "ResultProgress", "exports", "Is", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "exports", "TextDocuments", "connection", "exports", "connection", "change", "exports", "exports", "Is", "connection", "BulkRegistration", "BulkUnregistration", "one", "two", "createConnection", "reject", "result", "exports", "fs", "first", "resolve", "reject", "message", "FileSystem", "require_node", "exports", "module", "exports", "require_api", "exports", "ProposedFeatures", "require_main", "exports", "Is", "Files", "createConnection", "require_node", "exports", "module", "stream", "root", "Reduction", "a", "min", "RangeComparison", "last", "a", "property", "root", "reflection", "_", "newState", "atom", "process", "property", "first", "negate", "plus", "option", "isDataTypeNode", "import_vscode_languageserver", "assertPath", "path", "TypeError", "JSON", "stringify", "normalizeStringPosix", "allowAboveRoot", "code", "res", "lastSegmentLength", "lastSlash", "dots", "i", "length", "charCodeAt", "lastSlashIndex", "lastIndexOf", "slice", "posix", "resolve", "cwd", "resolvedPath", "resolvedAbsolute", "arguments", "process", "normalize", "isAbsolute", "trailingSeparator", "join", "joined", "arg", "relative", "from", "to", "fromStart", "fromEnd", "fromLen", "toStart", "toLen", "lastCommonSep", "fromCode", "out", "_makeLong", "dirname", "hasRoot", "end", "matchedSlash", "basename", "ext", "start", "extIdx", "firstNonSlashEnd", "extname", "startDot", "startPart", "preDotState", "format", "pathObject", "sep", "dir", "root", "base", "name", "parse", "ret", "delimiter", "win32", "module", "exports", "__webpack_module_cache__", "__webpack_require__", "moduleId", "cachedModule", "__webpack_modules__", "d", "definition", "key", "o", "Object", "defineProperty", "enumerable", "get", "obj", "prop", "prototype", "hasOwnProperty", "call", "r", "Symbol", "toStringTag", "value", "isWindows", "platform", "navigator", "userAgent", "indexOf", "_schemePattern", "_singleSlashStart", "_doubleSlashStart", "_validateUri", "_strict", "scheme", "Error", "authority", "query", "fragment", "test", "_empty", "_slash", "_regexp", "URI", "schemeOrData", "this", "thing", "fsPath", "with", "toString", "uriToFsPath", "change", "Uri", "match", "exec", "percentDecode", "replace", "idx", "substring", "components", "result", "skipEncoding", "_asFormatted", "toJSON", "data", "_formatted", "external", "_fsPath", "_sep", "_pathSepMarker", "$mid", "encodeTable", "encodeURIComponentFast", "uriComponent", "isPath", "isAuthority", "nativeEncodePos", "pos", "encodeURIComponent", "charAt", "substr", "escaped", "encodeURIComponentMinimal", "uri", "keepDriveLetterCasing", "toLowerCase", "encoder", "userinfo", "String", "fromCharCode", "decodeURIComponentGraceful", "str", "decodeURIComponent", "e", "_rEncodedAsHex", "A", "posixPath", "slash", "Utils", "t", "joinPath", "paths", "resolvePath", "slashAdded", "UriUtils", "a", "import_vscode_languageserver", "import_vscode_languageserver", "Symbol", "objectProto", "nativeObjectToString", "symToStringTag", "INFINITY", "funcProto", "objectProto", "funcToString", "hasOwnProperty", "objectProto", "hasOwnProperty", "MAX_SAFE_INTEGER", "objectProto", "objectProto", "hasOwnProperty", "Buffer", "argsTag", "funcTag", "freeExports", "freeModule", "moduleExports", "objectProto", "hasOwnProperty", "isType", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "HASH_UNDEFINED", "Map", "map", "toString", "INFINITY", "values", "freeExports", "freeModule", "moduleExports", "Buffer", "objectProto", "propertyIsEnumerable", "nativeGetSymbols", "Promise", "Set", "mapTag", "objectTag", "setTag", "weakMapTag", "dataViewTag", "objectProto", "hasOwnProperty", "Uint8Array", "symbolProto", "boolTag", "dateTag", "mapTag", "numberTag", "regexpTag", "setTag", "stringTag", "symbolTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "mapTag", "setTag", "argsTag", "arrayTag", "boolTag", "dateTag", "errorTag", "funcTag", "genTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "symbolTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "key", "CLONE_SYMBOLS_FLAG", "HASH_UNDEFINED", "values", "othValue", "map", "COMPARE_PARTIAL_FLAG", "COMPARE_UNORDERED_FLAG", "boolTag", "dateTag", "errorTag", "mapTag", "numberTag", "regexpTag", "setTag", "stringTag", "symbolTag", "arrayBufferTag", "dataViewTag", "symbolProto", "symbolValueOf", "COMPARE_PARTIAL_FLAG", "objectProto", "hasOwnProperty", "COMPARE_PARTIAL_FLAG", "argsTag", "arrayTag", "objectTag", "objectProto", "hasOwnProperty", "COMPARE_PARTIAL_FLAG", "COMPARE_UNORDERED_FLAG", "COMPARE_PARTIAL_FLAG", "COMPARE_UNORDERED_FLAG", "collection", "objectProto", "hasOwnProperty", "LARGE_ARRAY_SIZE", "values", "includes", "values", "collection", "collection", "nativeMax", "collection", "objectProto", "hasOwnProperty", "objectProto", "hasOwnProperty", "stringTag", "nativeMax", "nativeMax", "mapTag", "setTag", "objectProto", "hasOwnProperty", "regexpTag", "FUNC_ERROR_TEXT", "collection", "collection", "INFINITY", "values", "LARGE_ARRAY_SIZE", "includes", "visitor", "atom", "map", "LexerDefinitionErrorType", "msg", "currConfig", "tokenLabel", "hasTokenLabel", "hasTokenLabel", "hasTokenLabel", "tokenLabel", "getExtraProductionArgument", "PROD_TYPE", "tokenMatcher", "keys", "prefixKeys", "visitor", "collectorVisitor", "option", "alternation", "resolveGrammar", "validateGrammar", "alternation", "repetition", "option", "repetitionMandatory", "CstVisitorDefinitionError", "newState", "allTokenTypes", "invokeRuleWithTry", "newState", "ParserDefinitionErrorType", "resolveGrammar", "validateGrammar", "repetition", "alternation", "option", "block", "plus", "star", "optional", "getProdType", "first", "last", "a", "map", "closure", "newState", "tokenLabel", "getProductionDslName", "DocumentUri", "URI", "integer", "uinteger", "Position", "Range", "Location", "LocationLink", "Color", "ColorInformation", "ColorPresentation", "FoldingRangeKind", "FoldingRange", "DiagnosticRelatedInformation", "DiagnosticSeverity", "DiagnosticTag", "CodeDescription", "Diagnostic", "Command", "TextEdit", "ChangeAnnotation", "ChangeAnnotationIdentifier", "AnnotatedTextEdit", "TextDocumentEdit", "CreateFile", "RenameFile", "DeleteFile", "WorkspaceEdit", "TextDocumentIdentifier", "VersionedTextDocumentIdentifier", "OptionalVersionedTextDocumentIdentifier", "TextDocumentItem", "MarkupKind", "MarkupContent", "CompletionItemKind", "InsertTextFormat", "CompletionItemTag", "InsertReplaceEdit", "InsertTextMode", "CompletionItemLabelDetails", "CompletionItem", "CompletionList", "MarkedString", "Hover", "ParameterInformation", "SignatureInformation", "DocumentHighlightKind", "DocumentHighlight", "SymbolKind", "SymbolTag", "SymbolInformation", "WorkspaceSymbol", "DocumentSymbol", "CodeActionKind", "CodeActionTriggerKind", "CodeActionContext", "CodeAction", "CodeLens", "FormattingOptions", "DocumentLink", "SelectionRange", "SemanticTokenTypes", "SemanticTokenModifiers", "SemanticTokens", "InlineValueText", "InlineValueVariableLookup", "InlineValueEvaluatableExpression", "InlineValueContext", "InlayHintKind", "InlayHintLabelPart", "InlayHint", "Position", "StringValue", "InlineCompletionItem", "InlineCompletionList", "InlineCompletionTriggerKind", "SelectedCompletionInfo", "InlineCompletionContext", "WorkspaceFolder", "URI", "TextDocument", "mergeSort", "a", "Position", "Is", "toString", "undefined", "min", "integer", "uinteger", "Position", "last", "a", "ValueConverter", "reject", "FullTextDocument", "TextDocument", "a", "DocumentState", "TextDocument", "property", "a", "values", "exports", "root", "property", "node", "documentUri", "document", "ValidationCategory", "DocumentValidator", "property", "Disposable", "reject", "_a", "exports", "Position", "first", "last", "option", "root", "Module", "module", "_", "import_vscode_languageserver", "import_vscode_languageserver", "connection", "import_vscode_languageserver", "root", "node", "import_vscode_languageserver", "SemanticTokensDecoder", "option", "_a", "_b", "connection", "params", "services", "import_vscode_languageserver", "import_vscode_languageserver", "TextDocument", "Formatting", "a", "import_vscode_languageserver", "import_node", "TextDocument", "shared", "reflection", "shared"] -} diff --git a/intellij-plugin/src/main/resources/language/main.js b/intellij-plugin/src/main/resources/language/main.js deleted file mode 100644 index b9770fc..0000000 --- a/intellij-plugin/src/main/resources/language/main.js +++ /dev/null @@ -1,11 +0,0 @@ -import { startLanguageServer } from 'langium/lsp'; -import { NodeFileSystem } from 'langium/node'; -import { createConnection, ProposedFeatures } from 'vscode-languageserver/node.js'; -import { createPlOneServices } from './pl-one-module.js'; -// Create a connection to the client -const connection = createConnection(ProposedFeatures.all); -// Inject the shared services and language-specific services -const { shared } = createPlOneServices(Object.assign({ connection }, NodeFileSystem)); -// Start the language server with the shared services -startLanguageServer(shared); -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/main.js.map b/intellij-plugin/src/main/resources/language/main.js.map deleted file mode 100644 index 261ad1a..0000000 --- a/intellij-plugin/src/main/resources/language/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/language/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,oCAAoC;AACpC,MAAM,UAAU,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAE1D,4DAA4D;AAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,iBAAG,UAAU,IAAK,cAAc,EAAG,CAAC;AAE1E,qDAAqD;AACrD,mBAAmB,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/pl-one-module.js b/intellij-plugin/src/main/resources/language/pl-one-module.js deleted file mode 100644 index 188376a..0000000 --- a/intellij-plugin/src/main/resources/language/pl-one-module.js +++ /dev/null @@ -1,37 +0,0 @@ -import { inject } from 'langium'; -import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp'; -import { PlOneGeneratedModule, PlOneGeneratedSharedModule } from './generated/module.js'; -import { PlOneValidator, registerValidationChecks } from './pl-one-validator.js'; -/** - * Dependency injection module that overrides Langium default services and contributes the - * declared custom services. The Langium defaults can be partially specified to override only - * selected services, while the custom services must be fully specified. - */ -export const PlOneModule = { - validation: { - PlOneValidator: () => new PlOneValidator() - } -}; -/** - * Create the full set of services required by Langium. - * - * First inject the shared services by merging two modules: - * - Langium default shared services - * - Services generated by langium-cli - * - * Then inject the language-specific services by merging three modules: - * - Langium default language-specific services - * - Services generated by langium-cli - * - Services specified in this file - * - * @param context Optional module context with the LSP connection - * @returns An object wrapping the shared services and the language-specific services - */ -export function createPlOneServices(context) { - const shared = inject(createDefaultSharedModule(context), PlOneGeneratedSharedModule); - const PlOne = inject(createDefaultModule({ shared }), PlOneGeneratedModule, PlOneModule); - shared.ServiceRegistry.register(PlOne); - registerValidationChecks(PlOne); - return { shared, PlOne }; -} -//# sourceMappingURL=pl-one-module.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/pl-one-module.js.map b/intellij-plugin/src/main/resources/language/pl-one-module.js.map deleted file mode 100644 index 325219c..0000000 --- a/intellij-plugin/src/main/resources/language/pl-one-module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pl-one-module.js","sourceRoot":"","sources":["../../src/language/pl-one-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAkH,MAAM,aAAa,CAAC;AAC7L,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAiBjF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAuE;IAC3F,UAAU,EAAE;QACR,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE;KAC7C;CACJ,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IAInE,MAAM,MAAM,GAAG,MAAM,CACjB,yBAAyB,CAAC,OAAO,CAAC,EAClC,0BAA0B,CAC7B,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,CAChB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,EAC/B,oBAAoB,EACpB,WAAW,CACd,CAAC;IACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvC,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/pl-one-validator.js b/intellij-plugin/src/main/resources/language/pl-one-validator.js deleted file mode 100644 index b36ec24..0000000 --- a/intellij-plugin/src/main/resources/language/pl-one-validator.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Register custom validation checks. - */ -export function registerValidationChecks(services) { - const registry = services.validation.ValidationRegistry; - const validator = services.validation.PlOneValidator; - const checks = { - Progname: validator.checkPrognameStartsWithCapital - }; - registry.register(checks, validator); -} -/** - * Implementation of custom validations. - */ -export class PlOneValidator { - checkPrognameStartsWithCapital(prog, accept) { - if (prog.name) { - const firstChar = prog.name.substring(0, 1); - if (firstChar.toUpperCase() !== firstChar) { - accept('warning', 'Prog name should start with a capital.', { node: prog, property: 'name' }); - } - } - } -} -//# sourceMappingURL=pl-one-validator.js.map \ No newline at end of file diff --git a/intellij-plugin/src/main/resources/language/pl-one-validator.js.map b/intellij-plugin/src/main/resources/language/pl-one-validator.js.map deleted file mode 100644 index d185617..0000000 --- a/intellij-plugin/src/main/resources/language/pl-one-validator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pl-one-validator.js","sourceRoot":"","sources":["../../src/language/pl-one-validator.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAuB;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC;IACxD,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC;IACrD,MAAM,MAAM,GAAmC;QAC3C,QAAQ,EAAE,SAAS,CAAC,8BAA8B;KACrD,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IAEvB,8BAA8B,CAAC,IAAc,EAAE,MAA0B;QACrE,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5C,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;gBACvC,MAAM,CAAC,SAAS,EAAE,wCAAwC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;aACjG;SACJ;IACL,CAAC;CAEJ"} \ No newline at end of file