monaco-editor-core 0.54.0 → 0.55.0-dev-20251007
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/browser/canIUse.js +1 -0
- package/esm/vs/base/browser/canIUse.js.map +1 -1
- package/esm/vs/base/browser/dom.js +9 -0
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/fastDomNode.js.map +1 -1
- package/esm/vs/base/browser/mouseEvent.js +3 -0
- package/esm/vs/base/browser/mouseEvent.js.map +1 -1
- package/esm/vs/base/browser/trustedTypes.js +2 -0
- package/esm/vs/base/browser/trustedTypes.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listWidget.js +5 -5
- package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
- package/esm/vs/base/browser/ui/sash/sash.css +1 -1
- package/esm/vs/base/browser/ui/sash/sash.js +4 -0
- package/esm/vs/base/browser/ui/sash/sash.js.map +1 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js +1 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js.map +1 -1
- package/esm/vs/base/browser/ui/table/table.css +2 -2
- package/esm/vs/base/browser/ui/tree/abstractTree.js +7 -3
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +4 -0
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/indexTreeModel.js +1 -0
- package/esm/vs/base/browser/ui/tree/indexTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/media/tree.css +2 -2
- package/esm/vs/base/browser/webWorkerFactory.js +3 -0
- package/esm/vs/base/browser/webWorkerFactory.js.map +1 -1
- package/esm/vs/base/common/buffer.js.map +1 -1
- package/esm/vs/base/common/decorators.js +1 -0
- package/esm/vs/base/common/decorators.js.map +1 -1
- package/esm/vs/base/common/errors.js +1 -0
- package/esm/vs/base/common/errors.js.map +1 -1
- package/esm/vs/base/common/glob.js +1 -1
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/hash.js.map +1 -1
- package/esm/vs/base/common/hotReload.js +2 -0
- package/esm/vs/base/common/hotReload.js.map +1 -1
- package/esm/vs/base/common/hotReloadHelpers.js +1 -0
- package/esm/vs/base/common/hotReloadHelpers.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +19 -0
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/map.js.map +1 -1
- package/esm/vs/base/common/marshalling.js +4 -0
- package/esm/vs/base/common/marshalling.js.map +1 -1
- package/esm/vs/base/common/network.js +1 -0
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/objects.js +1 -0
- package/esm/vs/base/common/objects.js.map +1 -1
- package/esm/vs/base/common/observableInternal/changeTracker.js +4 -0
- package/esm/vs/base/common/observableInternal/changeTracker.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugLocation.js +1 -0
- package/esm/vs/base/common/observableInternal/debugLocation.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugName.js +1 -0
- package/esm/vs/base/common/observableInternal/debugName.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/consoleObservableLogger.js +1 -0
- package/esm/vs/base/common/observableInternal/logging/consoleObservableLogger.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js +1 -0
- package/esm/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/rpc.js +1 -0
- package/esm/vs/base/common/observableInternal/logging/debugger/rpc.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derived.js +7 -1
- package/esm/vs/base/common/observableInternal/observables/derived.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js +2 -0
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -0
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +1 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/process.js +1 -0
- package/esm/vs/base/common/process.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/types.js +2 -0
- package/esm/vs/base/common/types.js.map +1 -1
- package/esm/vs/base/common/worker/webWorker.js +26 -14
- package/esm/vs/base/common/worker/webWorker.js.map +1 -1
- package/esm/vs/base/parts/sandbox/common/sandboxTypes.js +2 -0
- package/esm/vs/base/parts/sandbox/common/sandboxTypes.js.map +1 -0
- package/esm/vs/editor/browser/config/editorConfiguration.js +3 -2
- package/esm/vs/editor/browser/config/editorConfiguration.js.map +1 -1
- package/esm/vs/editor/browser/config/migrateOptions.js +1 -1
- package/esm/vs/editor/browser/config/migrateOptions.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/editContextFactory.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContextUtils.js +2 -0
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContextUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +2 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js +7 -0
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/controller/pointerHandler.js.map +1 -1
- package/esm/vs/editor/browser/coreCommands.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/editorDom.js.map +1 -1
- package/esm/vs/editor/browser/editorExtensions.js.map +1 -1
- package/esm/vs/editor/browser/gpu/gpuUtils.js +1 -0
- package/esm/vs/editor/browser/gpu/gpuUtils.js.map +1 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js +1 -0
- package/esm/vs/editor/browser/gpu/viewGpuContext.js.map +1 -1
- package/esm/vs/editor/browser/services/abstractCodeEditorService.js.map +1 -1
- package/esm/vs/editor/browser/services/bulkEditService.js.map +1 -1
- package/esm/vs/editor/browser/services/codeEditorService.js.map +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/services/hoverService/hover.css +2 -0
- package/esm/vs/editor/browser/services/hoverService/hoverService.js.map +1 -1
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js +1 -1
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js.map +1 -1
- package/esm/vs/editor/browser/services/inlineCompletionsService.js +8 -8
- package/esm/vs/editor/browser/services/inlineCompletionsService.js.map +1 -1
- package/esm/vs/editor/browser/services/openerService.js.map +1 -1
- package/esm/vs/editor/browser/view/viewLayer.js +1 -1
- package/esm/vs/editor/browser/view/viewLayer.js.map +1 -1
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +1 -0
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +1 -0
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorContributions.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +4 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +1 -0
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js +1 -0
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +1 -0
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/utils.js +2 -0
- package/esm/vs/editor/browser/widget/diffEditor/utils.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +2 -0
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +122 -68
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/config/fontInfo.js +32 -16
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/config/fontInfoFromSettings.js +16 -0
- package/esm/vs/editor/common/config/fontInfoFromSettings.js.map +1 -0
- package/esm/vs/editor/common/core/edits/edit.js +1 -0
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +2 -0
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/position.js +1 -1
- package/esm/vs/editor/common/core/position.js.map +1 -1
- package/esm/vs/editor/common/core/range.js +1 -1
- package/esm/vs/editor/common/core/range.js.map +1 -1
- package/esm/vs/editor/common/core/selection.js +1 -1
- package/esm/vs/editor/common/core/selection.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/editorCommon.js.map +1 -1
- package/esm/vs/editor/common/languages.js +1 -1
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js +14 -0
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js +2 -0
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +1 -1
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model.js +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/common/services/editorBaseApi.js.map +1 -1
- package/esm/vs/editor/common/services/editorWebWorker.js +1 -0
- package/esm/vs/editor/common/services/editorWebWorker.js.map +1 -1
- package/esm/vs/editor/common/services/editorWorkerHost.js.map +1 -1
- package/esm/vs/editor/common/services/modelService.js +14 -21
- package/esm/vs/editor/common/services/modelService.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +2 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +40 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +2 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js.map +1 -1
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +1 -1
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js +1 -0
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js.map +1 -1
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +1 -0
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js +1 -0
- package/esm/vs/editor/contrib/find/browser/findModel.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findWidget.css +5 -5
- package/esm/vs/editor/contrib/folding/browser/folding.css +4 -4
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +30 -14
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +4 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +56 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/structuredLogger.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/structuredLogger.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +2 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js.map +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.css +2 -0
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +2 -0
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +8 -8
- package/esm/vs/editor/editor.api.js +4 -0
- package/esm/vs/editor/editor.api.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneEditor.js +37 -0
- package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +37 -0
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneWebWorker.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js +3 -0
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js.map +1 -1
- package/esm/vs/platform/accessibility/browser/accessibilityService.js +2 -2
- package/esm/vs/platform/accessibility/browser/accessibilityService.js.map +1 -1
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/commands/common/commands.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +5 -0
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/dataChannel/browser/forwardingTelemetryService.js +1 -0
- package/esm/vs/platform/dataChannel/browser/forwardingTelemetryService.js.map +1 -1
- package/esm/vs/platform/dnd/browser/dnd.js +2 -0
- package/esm/vs/platform/dnd/browser/dnd.js.map +1 -1
- package/esm/vs/platform/instantiation/common/descriptors.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -0
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/list/browser/listService.js +5 -0
- package/esm/vs/platform/list/browser/listService.js.map +1 -1
- package/esm/vs/platform/log/common/log.js.map +1 -1
- package/esm/vs/platform/log/common/logService.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInHotClass.js +2 -0
- package/esm/vs/platform/observable/common/wrapInHotClass.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js +3 -0
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js.map +1 -1
- package/esm/vs/platform/product/common/product.js +69 -0
- package/esm/vs/platform/product/common/product.js.map +1 -0
- package/esm/vs/platform/quickinput/browser/quickInput.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/monaco.d.ts +8 -8
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/standalone/browser/standaloneWebWorker.ts","vs/editor/standalone/browser/standaloneWebWorker.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAmB,YAA2B,EAAE,IAA+B;IAC7G,OAAO,IAAI,mBAAmB,CAAI,YAAY,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAqCD,MAAM,mBAAsC,SAAQ,kBAAkB;IAKrE,YAAY,YAA2B,EAAE,IAA+B;QACvE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAClD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE;gBACpB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;oBACzB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;wBACrB,4GAA4G;wBAC5G,OAAO,SAAS,CAAC;oBAClB,CAAC;oBACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;wBAC9B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;oBAClC,CAAC;oBACD,OAAO,CAAC,GAAG,
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/standalone/browser/standaloneWebWorker.ts","vs/editor/standalone/browser/standaloneWebWorker.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAmB,YAA2B,EAAE,IAA+B;IAC7G,OAAO,IAAI,mBAAmB,CAAI,YAAY,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAqCD,MAAM,mBAAsC,SAAQ,kBAAkB;IAKrE,YAAY,YAA2B,EAAE,IAA+B;QACvE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAClD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE;gBACpB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;oBACzB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;wBACrB,4GAA4G;wBAC5G,OAAO,SAAS,CAAC;oBAClB,CAAC;oBACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;wBAC9B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;oBAClC,CAAC;oBACD,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;wBAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAC/B,CAAC,CAAC;gBACH,CAAC;aACD,CAAM,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,uBAAuB;IACP,GAAG,CAAC,MAAc,EAAE,IAAe;QAClD,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;YACvF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,GAAG,MAAM,GAAG,uCAAuC,CAAC,CAAC,CAAC;QACxG,CAAC;QAED,IAAI,CAAC;YACJ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9F,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAEM,mBAAmB,CAAC,SAAgB;QAC1C,OAAO,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC;CACD","file":"standaloneWebWorker.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\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\nimport { URI } from '../../../base/common/uri.js';\nimport { EditorWorkerClient } from '../../browser/services/editorWorkerService.js';\nimport { IModelService } from '../../common/services/model.js';\n\n/**\n * Create a new web worker that has model syncing capabilities built in.\n * Specify an AMD module to load that will `create` an object that will be proxied.\n */\nexport function createWebWorker<T extends object>(modelService: IModelService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T> {\n\treturn new MonacoWebWorkerImpl<T>(modelService, opts);\n}\n\n/**\n * A web worker that can provide a proxy to an arbitrary file.\n */\nexport interface MonacoWebWorker<T> {\n\t/**\n\t * Terminate the web worker, thus invalidating the returned proxy.\n\t */\n\tdispose(): void;\n\t/**\n\t * Get a proxy to the arbitrary loaded code.\n\t */\n\tgetProxy(): Promise<T>;\n\t/**\n\t * Synchronize (send) the models at `resources` to the web worker,\n\t * making them available in the monaco.worker.getMirrorModels().\n\t */\n\twithSyncedResources(resources: URI[]): Promise<T>;\n}\n\nexport interface IInternalWebWorkerOptions {\n\t/**\n\t * The worker.\n\t */\n\tworker: Worker | Promise<Worker>;\n\t/**\n\t * An object that can be used by the web worker to make calls back to the main thread.\n\t */\n\thost?: any;\n\t/**\n\t * Keep idle models.\n\t * Defaults to false, which means that idle models will stop syncing after a while.\n\t */\n\tkeepIdleModels?: boolean;\n}\n\nclass MonacoWebWorkerImpl<T extends object> extends EditorWorkerClient implements MonacoWebWorker<T> {\n\n\tprivate readonly _foreignModuleHost: { [method: string]: Function } | null;\n\tprivate _foreignProxy: Promise<T>;\n\n\tconstructor(modelService: IModelService, opts: IInternalWebWorkerOptions) {\n\t\tsuper(opts.worker, opts.keepIdleModels || false, modelService);\n\t\tthis._foreignModuleHost = opts.host || null;\n\t\tthis._foreignProxy = this._getProxy().then(proxy => {\n\t\t\treturn new Proxy({}, {\n\t\t\t\tget(target, prop, receiver) {\n\t\t\t\t\tif (prop === 'then') {\n\t\t\t\t\t\t// Don't forward the call when the proxy is returned in an async function and the runtime tries to .then it.\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof prop !== 'string') {\n\t\t\t\t\t\tthrow new Error(`Not supported`);\n\t\t\t\t\t}\n\t\t\t\t\treturn (...args: unknown[]) => {\n\t\t\t\t\t\treturn proxy.$fmr(prop, args);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}) as T;\n\t\t});\n\t}\n\n\t// foreign host request\n\tpublic override fhr(method: string, args: unknown[]): Promise<any> {\n\t\tif (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {\n\t\t\treturn Promise.reject(new Error('Missing method ' + method + ' or missing main thread foreign host.'));\n\t\t}\n\n\t\ttry {\n\t\t\treturn Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));\n\t\t} catch (e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n\n\tpublic getProxy(): Promise<T> {\n\t\treturn this._foreignProxy;\n\t}\n\n\tpublic withSyncedResources(resources: URI[]): Promise<T> {\n\t\treturn this.workerWithSyncedResources(resources).then(_ => this.getProxy());\n\t}\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\nimport { URI } from '../../../base/common/uri.js';\nimport { EditorWorkerClient } from '../../browser/services/editorWorkerService.js';\nimport { IModelService } from '../../common/services/model.js';\n\n/**\n * Create a new web worker that has model syncing capabilities built in.\n * Specify an AMD module to load that will `create` an object that will be proxied.\n */\nexport function createWebWorker<T extends object>(modelService: IModelService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T> {\n\treturn new MonacoWebWorkerImpl<T>(modelService, opts);\n}\n\n/**\n * A web worker that can provide a proxy to an arbitrary file.\n */\nexport interface MonacoWebWorker<T> {\n\t/**\n\t * Terminate the web worker, thus invalidating the returned proxy.\n\t */\n\tdispose(): void;\n\t/**\n\t * Get a proxy to the arbitrary loaded code.\n\t */\n\tgetProxy(): Promise<T>;\n\t/**\n\t * Synchronize (send) the models at `resources` to the web worker,\n\t * making them available in the monaco.worker.getMirrorModels().\n\t */\n\twithSyncedResources(resources: URI[]): Promise<T>;\n}\n\nexport interface IInternalWebWorkerOptions {\n\t/**\n\t * The worker.\n\t */\n\tworker: Worker | Promise<Worker>;\n\t/**\n\t * An object that can be used by the web worker to make calls back to the main thread.\n\t */\n\thost?: any;\n\t/**\n\t * Keep idle models.\n\t * Defaults to false, which means that idle models will stop syncing after a while.\n\t */\n\tkeepIdleModels?: boolean;\n}\n\nclass MonacoWebWorkerImpl<T extends object> extends EditorWorkerClient implements MonacoWebWorker<T> {\n\n\tprivate readonly _foreignModuleHost: { [method: string]: Function } | null;\n\tprivate _foreignProxy: Promise<T>;\n\n\tconstructor(modelService: IModelService, opts: IInternalWebWorkerOptions) {\n\t\tsuper(opts.worker, opts.keepIdleModels || false, modelService);\n\t\tthis._foreignModuleHost = opts.host || null;\n\t\tthis._foreignProxy = this._getProxy().then(proxy => {\n\t\t\treturn new Proxy({}, {\n\t\t\t\tget(target, prop, receiver) {\n\t\t\t\t\tif (prop === 'then') {\n\t\t\t\t\t\t// Don't forward the call when the proxy is returned in an async function and the runtime tries to .then it.\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof prop !== 'string') {\n\t\t\t\t\t\tthrow new Error(`Not supported`);\n\t\t\t\t\t}\n\t\t\t\t\treturn (...args: unknown[]) => {\n\t\t\t\t\t\treturn proxy.$fmr(prop, args);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}) as T;\n\t\t});\n\t}\n\n\t// foreign host request\n\tpublic override fhr(method: string, args: unknown[]): Promise<any> {\n\t\tif (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== 'function') {\n\t\t\treturn Promise.reject(new Error('Missing method ' + method + ' or missing main thread foreign host.'));\n\t\t}\n\n\t\ttry {\n\t\t\treturn Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));\n\t\t} catch (e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n\n\tpublic getProxy(): Promise<T> {\n\t\treturn this._foreignProxy;\n\t}\n\n\tpublic withSyncedResources(resources: URI[]): Promise<T> {\n\t\treturn this.workerWithSyncedResources(resources).then(_ => this.getProxy());\n\t}\n}\n"]}
|
|
@@ -416,6 +416,7 @@ export function compile(languageId, json) {
|
|
|
416
416
|
brackets: []
|
|
417
417
|
};
|
|
418
418
|
// For calling compileAction later on
|
|
419
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
419
420
|
const lexerMin = json;
|
|
420
421
|
lexerMin.languageId = languageId;
|
|
421
422
|
lexerMin.includeLF = lexer.includeLF;
|
|
@@ -486,6 +487,7 @@ export function compile(languageId, json) {
|
|
|
486
487
|
if (!json.tokenizer || typeof (json.tokenizer) !== 'object') {
|
|
487
488
|
throw monarchCommon.createError(lexer, 'a language definition must define the \'tokenizer\' attribute as an object');
|
|
488
489
|
}
|
|
490
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
489
491
|
lexer.tokenizer = [];
|
|
490
492
|
for (const key in json.tokenizer) {
|
|
491
493
|
if (json.tokenizer.hasOwnProperty(key)) {
|
|
@@ -500,6 +502,7 @@ export function compile(languageId, json) {
|
|
|
500
502
|
lexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction
|
|
501
503
|
// Set simple brackets
|
|
502
504
|
if (json.brackets) {
|
|
505
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
503
506
|
if (!(Array.isArray(json.brackets))) {
|
|
504
507
|
throw monarchCommon.createError(lexer, 'the \'brackets\' attribute must be defined as an array');
|
|
505
508
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/standalone/common/monarch/monarchCompile.ts","vs/editor/standalone/common/monarch/monarchCompile.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAGpD;;;;;;;G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AQ,CAAC,IAAI,CAAC;gBACb,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,YAAY;gBACtC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC;gBAC7C,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;aAC/C,CAAC,CAAC;QACJ,CAAC;aACI,CAAC;YACL,MAAM,aAAa,CAAC,WAAW,CAAC,KAAK,EAAE,0FAA0F,CAAC,CAAC;QACpI,CAAC;IACF,CAAC;IACD,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,+DAA+D;IAC/D,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,OAAO,KAAK,CAAC;AACd,CAAC","file":"monarchCompile.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\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/*\n * This module only exports 'compile' which compiles a JSON language definition\n * into a typed and checked ILexer definition.\n */\n\nimport { isString } from '../../../../base/common/types.js';\nimport * as monarchCommon from './monarchCommon.js';\nimport { IMonarchLanguage, IMonarchLanguageBracket } from './monarchTypes.js';\n\n/*\n * Type helpers\n *\n * Note: this is just for sanity checks on the JSON description which is\n * helpful for the programmer. No checks are done anymore once the lexer is\n * already 'compiled and checked'.\n *\n */\n\nfunction isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\tif (!(Array.isArray(obj))) {\n\t\treturn false;\n\t}\n\tfor (const el of obj) {\n\t\tif (!(elemType(el))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction bool(prop: any, defValue: boolean): boolean {\n\tif (typeof prop === 'boolean') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\nfunction string(prop: any, defValue: string): string {\n\tif (typeof (prop) === 'string') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\n\nfunction arrayToHash(array: string[]): { [name: string]: true } {\n\tconst result: any = {};\n\tfor (const e of array) {\n\t\tresult[e] = true;\n\t}\n\treturn result;\n}\n\n\nfunction createKeywordMatcher(arr: string[], caseInsensitive: boolean = false): (str: string) => boolean {\n\tif (caseInsensitive) {\n\t\tarr = arr.map(function (x) { return x.toLowerCase(); });\n\t}\n\tconst hash = arrayToHash(arr);\n\tif (caseInsensitive) {\n\t\treturn function (word) {\n\t\t\treturn hash[word.toLowerCase()] !== undefined && hash.hasOwnProperty(word.toLowerCase());\n\t\t};\n\t} else {\n\t\treturn function (word) {\n\t\t\treturn hash[word] !== undefined && hash.hasOwnProperty(word);\n\t\t};\n\t}\n}\n\n\n// Lexer helpers\n\n/**\n * Compiles a regular expression string, adding the 'i' flag if 'ignoreCase' is set, and the 'u' flag if 'unicode' is set.\n * Also replaces @\\w+ or sequences with the content of the specified attribute\n * @\\w+ replacement can be avoided by escaping `@` signs with another `@` sign.\n * @example /@attr/ will be replaced with the value of lexer[attr]\n * @example /@@text/ will not be replaced and will become /@text/.\n */\nfunction compileRegExp<S extends true | false>(lexer: monarchCommon.ILexerMin, str: string, handleSn: S): S extends true ? RegExp | DynamicRegExp : RegExp;\nfunction compileRegExp(lexer: monarchCommon.ILexerMin, str: string, handleSn: true | false): RegExp | DynamicRegExp {\n\t// @@ must be interpreted as a literal @, so we replace all occurences of @@ with a placeholder character\n\tstr = str.replace(/@@/g, `\\x01`);\n\n\tlet n = 0;\n\tlet hadExpansion: boolean;\n\tdo {\n\t\thadExpansion = false;\n\t\tstr = str.replace(/@(\\w+)/g, function (s, attr?) {\n\t\t\thadExpansion = true;\n\t\t\tlet sub = '';\n\t\t\tif (typeof (lexer[attr]) === 'string') {\n\t\t\t\tsub = lexer[attr];\n\t\t\t} else if (lexer[attr] && lexer[attr] instanceof RegExp) {\n\t\t\t\tsub = lexer[attr].source;\n\t\t\t} else {\n\t\t\t\tif (lexer[attr] === undefined) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'language definition does not contain attribute \\'' + attr + '\\', used at: ' + str);\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'attribute reference \\'' + attr + '\\' must be a string, used at: ' + str);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn (monarchCommon.empty(sub) ? '' : '(?:' + sub + ')');\n\t\t});\n\t\tn++;\n\t} while (hadExpansion && n < 5);\n\n\t// handle escaped @@\n\tstr = str.replace(/\\x01/g, '@');\n\n\tconst flags = (lexer.ignoreCase ? 'i' : '') + (lexer.unicode ? 'u' : '');\n\n\t// handle $Sn\n\tif (handleSn) {\n\t\tconst match = str.match(/\\$[sS](\\d\\d?)/g);\n\t\tif (match) {\n\t\t\tlet lastState: string | null = null;\n\t\t\tlet lastRegEx: RegExp | null = null;\n\t\t\treturn (state: string) => {\n\t\t\t\tif (lastRegEx && lastState === state) {\n\t\t\t\t\treturn lastRegEx;\n\t\t\t\t}\n\t\t\t\tlastState = state;\n\t\t\t\tlastRegEx = new RegExp(monarchCommon.substituteMatchesRe(lexer, str, state), flags);\n\t\t\t\treturn lastRegEx;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn new RegExp(str, flags);\n}\n\n/**\n * Compiles guard functions for case matches.\n * This compiles 'cases' attributes into efficient match functions.\n *\n */\nfunction selectScrutinee(id: string, matches: string[], state: string, num: number): string | null {\n\tif (num < 0) {\n\t\treturn id;\n\t}\n\tif (num < matches.length) {\n\t\treturn matches[num];\n\t}\n\tif (num >= 100) {\n\t\tnum = num - 100;\n\t\tconst parts = state.split('.');\n\t\tparts.unshift(state);\n\t\tif (num < parts.length) {\n\t\t\treturn parts[num];\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: string, val: monarchCommon.FuzzyAction): monarchCommon.IBranch {\n\t// get the scrutinee and pattern\n\tlet scrut = -1; // -1: $!, 0-99: $n, 100+n: $Sn\n\tlet oppat = tkey;\n\tlet matches = tkey.match(/^\\$(([sS]?)(\\d\\d?)|#)(.*)$/);\n\tif (matches) {\n\t\tif (matches[3]) { // if digits\n\t\t\tscrut = parseInt(matches[3]);\n\t\t\tif (matches[2]) {\n\t\t\t\tscrut = scrut + 100; // if [sS] present\n\t\t\t}\n\t\t}\n\t\toppat = matches[4];\n\t}\n\t// get operator\n\tlet op = '~';\n\tlet pat = oppat;\n\tif (!oppat || oppat.length === 0) {\n\t\top = '!=';\n\t\tpat = '';\n\t}\n\telse if (/^\\w*$/.test(pat)) { // just a word\n\t\top = '==';\n\t}\n\telse {\n\t\tmatches = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);\n\t\tif (matches) {\n\t\t\top = matches[1];\n\t\t\tpat = matches[2];\n\t\t}\n\t}\n\n\t// set the tester function\n\tlet tester: (s: string, id: string, matches: string[], state: string, eos: boolean) => boolean;\n\n\t// special case a regexp that matches just words\n\tif ((op === '~' || op === '!~') && /^(\\w|\\|)*$/.test(pat)) {\n\t\tconst inWords = createKeywordMatcher(pat.split('|'), lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '~' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '@' || op === '!@') {\n\t\tconst words = lexer[pat];\n\t\tif (!words) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' is not defined, in rule: ' + ruleName);\n\t\t}\n\t\tif (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' must be an array of strings, in rule: ' + ruleName);\n\t\t}\n\t\tconst inWords = createKeywordMatcher(words, lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '@' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '~' || op === '!~') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\t// precompile regular expression\n\t\t\tconst re = compileRegExp(lexer, '^' + pat + '$', false);\n\t\t\ttester = function (s) { return (op === '~' ? re.test(s) : !re.test(s)); };\n\t\t}\n\t\telse {\n\t\t\ttester = function (s, id, matches, state) {\n\t\t\t\tconst re = compileRegExp(lexer, '^' + monarchCommon.substituteMatches(lexer, pat, id, matches, state) + '$', false);\n\t\t\t\treturn re.test(s);\n\t\t\t};\n\t\t}\n\t}\n\telse { // if (op==='==' || op==='!=') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s) { return (op === '==' ? s === patx : s !== patx); };\n\t\t}\n\t\telse {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s, id, matches, state, eos) {\n\t\t\t\tconst patexp = monarchCommon.substituteMatches(lexer, patx, id, matches, state);\n\t\t\t\treturn (op === '==' ? s === patexp : s !== patexp);\n\t\t\t};\n\t\t}\n\t}\n\n\t// return the branch object\n\tif (scrut === -1) {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\treturn tester(id, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\tconst scrutinee = selectScrutinee(id, matches, state, scrut);\n\t\t\t\treturn tester(!scrutinee ? '' : scrutinee, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n}\n\n/**\n * Compiles an action: i.e. optimize regular expressions and case matches\n * and do many sanity checks.\n *\n * This is called only during compilation but if the lexer definition\n * contains user functions as actions (which is usually not allowed), then this\n * may be called during lexing. It is important therefore to compile common cases efficiently\n */\nfunction compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: any): monarchCommon.FuzzyAction {\n\tif (!action) {\n\t\treturn { token: '' };\n\t}\n\telse if (typeof (action) === 'string') {\n\t\treturn action; // { token: action };\n\t}\n\telse if (action.token || action.token === '') {\n\t\tif (typeof (action.token) !== 'string') {\n\t\t\tthrow monarchCommon.createError(lexer, 'a \\'token\\' attribute must be of type string, in rule: ' + ruleName);\n\t\t}\n\t\telse {\n\t\t\t// only copy specific typed fields (only happens once during compile Lexer)\n\t\t\tconst newAction: monarchCommon.IAction = { token: action.token };\n\t\t\tif (action.token.indexOf('$') >= 0) {\n\t\t\t\tnewAction.tokenSubst = true;\n\t\t\t}\n\t\t\tif (typeof (action.bracket) === 'string') {\n\t\t\t\tif (action.bracket === '@open') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Open;\n\t\t\t\t} else if (action.bracket === '@close') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Close;\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a \\'bracket\\' attribute must be either \\'@open\\' or \\'@close\\', in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.next) {\n\t\t\t\tif (typeof (action.next) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state must be a string value in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet next: string = action.next;\n\t\t\t\t\tif (!/^(@pop|@push|@popall)$/.test(next)) {\n\t\t\t\t\t\tif (next[0] === '@') {\n\t\t\t\t\t\t\tnext = next.substr(1); // peel off starting @ sign\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists\n\t\t\t\t\t\t\tif (!monarchCommon.stateExists(lexer, monarchCommon.substituteMatches(lexer, next, '', [], ''))) {\n\t\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state \\'' + action.next + '\\' is not defined in rule: ' + ruleName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewAction.next = next;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof (action.goBack) === 'number') {\n\t\t\t\tnewAction.goBack = action.goBack;\n\t\t\t}\n\t\t\tif (typeof (action.switchTo) === 'string') {\n\t\t\t\tnewAction.switchTo = action.switchTo;\n\t\t\t}\n\t\t\tif (typeof (action.log) === 'string') {\n\t\t\t\tnewAction.log = action.log;\n\t\t\t}\n\t\t\tif (typeof (action.nextEmbedded) === 'string') {\n\t\t\t\tnewAction.nextEmbedded = action.nextEmbedded;\n\t\t\t\tlexer.usesEmbedded = true;\n\t\t\t}\n\t\t\treturn newAction;\n\t\t}\n\t}\n\telse if (Array.isArray(action)) {\n\t\tconst results: monarchCommon.FuzzyAction[] = [];\n\t\tfor (let i = 0, len = action.length; i < len; i++) {\n\t\t\tresults[i] = compileAction(lexer, ruleName, action[i]);\n\t\t}\n\t\treturn { group: results };\n\t}\n\telse if (action.cases) {\n\t\t// build an array of test cases\n\t\tconst cases: monarchCommon.IBranch[] = [];\n\n\t\tlet hasEmbeddedEndInCases = false;\n\t\t// for each case, push a test function and result value\n\t\tfor (const tkey in action.cases) {\n\t\t\tif (action.cases.hasOwnProperty(tkey)) {\n\t\t\t\tconst val = compileAction(lexer, ruleName, action.cases[tkey]);\n\n\t\t\t\t// what kind of case\n\t\t\t\tif (tkey === '@default' || tkey === '@' || tkey === '') {\n\t\t\t\t\tcases.push({ test: undefined, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse if (tkey === '@eos') {\n\t\t\t\t\tcases.push({ test: function (id, matches, state, eos) { return eos; }, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcases.push(createGuard(lexer, ruleName, tkey, val)); // call separate function to avoid local variable capture\n\t\t\t\t}\n\n\t\t\t\tif (!hasEmbeddedEndInCases) {\n\t\t\t\t\thasEmbeddedEndInCases = !isString(val) && (val.hasEmbeddedEndInCases || ['@pop', '@popall'].includes(val.nextEmbedded || ''));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// create a matching function\n\t\tconst def = lexer.defaultToken;\n\t\treturn {\n\t\t\thasEmbeddedEndInCases,\n\t\t\ttest: function (id, matches, state, eos) {\n\t\t\t\tfor (const _case of cases) {\n\t\t\t\t\tconst didmatch = (!_case.test || _case.test(id, matches, state, eos));\n\t\t\t\t\tif (didmatch) {\n\t\t\t\t\t\treturn _case.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn def;\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\tthrow monarchCommon.createError(lexer, 'an action must be a string, an object with a \\'token\\' or \\'cases\\' attribute, or an array of actions; in rule: ' + ruleName);\n\t}\n}\n\ntype DynamicRegExp = (state: string) => RegExp;\n\n/**\n * Helper class for creating matching rules\n */\nclass Rule implements monarchCommon.IRule {\n\tprivate regex: RegExp | DynamicRegExp = new RegExp('');\n\tpublic action: monarchCommon.FuzzyAction = { token: '' };\n\tpublic matchOnlyAtLineStart: boolean = false;\n\tpublic name: string = '';\n\n\tconstructor(name: string) {\n\t\tthis.name = name;\n\t}\n\n\tpublic setRegex(lexer: monarchCommon.ILexerMin, re: string | RegExp): void {\n\t\tlet sregex: string;\n\t\tif (typeof (re) === 'string') {\n\t\t\tsregex = re;\n\t\t}\n\t\telse if (re instanceof RegExp) {\n\t\t\tsregex = (<RegExp>re).source;\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'rules must start with a match string or regular expression: ' + this.name);\n\t\t}\n\n\t\tthis.matchOnlyAtLineStart = (sregex.length > 0 && sregex[0] === '^');\n\t\tthis.name = this.name + ': ' + sregex;\n\t\tthis.regex = compileRegExp(lexer, '^(?:' + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ')', true);\n\t}\n\n\tpublic setAction(lexer: monarchCommon.ILexerMin, act: monarchCommon.IAction) {\n\t\tthis.action = compileAction(lexer, this.name, act);\n\t}\n\n\tpublic resolveRegex(state: string): RegExp {\n\t\tif (this.regex instanceof RegExp) {\n\t\t\treturn this.regex;\n\t\t} else {\n\t\t\treturn this.regex(state);\n\t\t}\n\t}\n}\n\n/**\n * Compiles a json description function into json where all regular expressions,\n * case matches etc, are compiled and all include rules are expanded.\n * We also compile the bracket definitions, supply defaults, and do many sanity checks.\n * If the 'jsonStrict' parameter is 'false', we allow at certain locations\n * regular expression objects and functions that get called during lexing.\n * (Currently we have no samples that need this so perhaps we should always have\n * jsonStrict to true).\n */\nexport function compile(languageId: string, json: IMonarchLanguage): monarchCommon.ILexer {\n\tif (!json || typeof (json) !== 'object') {\n\t\tthrow new Error('Monarch: expecting a language definition object');\n\t}\n\n\t// Create our lexer\n\tconst lexer: monarchCommon.ILexer = {\n\t\tlanguageId: languageId,\n\t\tincludeLF: bool(json.includeLF, false),\n\t\tnoThrow: false, // raise exceptions during compilation\n\t\tmaxStack: 100,\n\t\tstart: (typeof json.start === 'string' ? json.start : null),\n\t\tignoreCase: bool(json.ignoreCase, false),\n\t\tunicode: bool(json.unicode, false),\n\t\ttokenPostfix: string(json.tokenPostfix, '.' + languageId),\n\t\tdefaultToken: string(json.defaultToken, 'source'),\n\t\tusesEmbedded: false, // becomes true if we find a nextEmbedded action\n\t\tstateNames: {},\n\t\ttokenizer: {},\n\t\tbrackets: []\n\t};\n\n\t// For calling compileAction later on\n\tconst lexerMin: monarchCommon.ILexerMin = <any>json;\n\tlexerMin.languageId = languageId;\n\tlexerMin.includeLF = lexer.includeLF;\n\tlexerMin.ignoreCase = lexer.ignoreCase;\n\tlexerMin.unicode = lexer.unicode;\n\tlexerMin.noThrow = lexer.noThrow;\n\tlexerMin.usesEmbedded = lexer.usesEmbedded;\n\tlexerMin.stateNames = json.tokenizer;\n\tlexerMin.defaultToken = lexer.defaultToken;\n\n\n\t// Compile an array of rules into newrules where RegExp objects are created.\n\tfunction addRules(state: string, newrules: monarchCommon.IRule[], rules: any[]) {\n\t\tfor (const rule of rules) {\n\n\t\t\tlet include = rule.include;\n\t\t\tif (include) {\n\t\t\t\tif (typeof (include) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'an \\'include\\' attribute must be a string at: ' + state);\n\t\t\t\t}\n\t\t\t\tif (include[0] === '@') {\n\t\t\t\t\tinclude = include.substr(1); // peel off starting @\n\t\t\t\t}\n\t\t\t\tif (!json.tokenizer[include]) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'include target \\'' + include + '\\' is not defined at: ' + state);\n\t\t\t\t}\n\t\t\t\taddRules(state + '.' + include, newrules, json.tokenizer[include]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst newrule = new Rule(state);\n\n\t\t\t\t// Set up new rule attributes\n\t\t\t\tif (Array.isArray(rule) && rule.length >= 1 && rule.length <= 3) {\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule[0]);\n\t\t\t\t\tif (rule.length >= 3) {\n\t\t\t\t\t\tif (typeof (rule[1]) === 'string') {\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, { token: rule[1], next: rule[2] });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (typeof (rule[1]) === 'object') {\n\t\t\t\t\t\t\tconst rule1 = rule[1];\n\t\t\t\t\t\t\trule1.next = rule[2];\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, rule1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a next state as the last element of a rule can only be given if the action is either an object or a string, at: ' + state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnewrule.setAction(lexerMin, rule[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!rule.regex) {\n\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a rule must either be an array, or an object with a \\'regex\\' or \\'include\\' field at: ' + state);\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.name) {\n\t\t\t\t\t\tif (typeof rule.name === 'string') {\n\t\t\t\t\t\t\tnewrule.name = rule.name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.matchOnlyAtStart) {\n\t\t\t\t\t\tnewrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart, false);\n\t\t\t\t\t}\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule.regex);\n\t\t\t\t\tnewrule.setAction(lexerMin, rule.action);\n\t\t\t\t}\n\n\t\t\t\tnewrules.push(newrule);\n\t\t\t}\n\t\t}\n\t}\n\n\t// compile the tokenizer rules\n\tif (!json.tokenizer || typeof (json.tokenizer) !== 'object') {\n\t\tthrow monarchCommon.createError(lexer, 'a language definition must define the \\'tokenizer\\' attribute as an object');\n\t}\n\n\tlexer.tokenizer = <any>[];\n\tfor (const key in json.tokenizer) {\n\t\tif (json.tokenizer.hasOwnProperty(key)) {\n\t\t\tif (!lexer.start) {\n\t\t\t\tlexer.start = key;\n\t\t\t}\n\n\t\t\tconst rules = json.tokenizer[key];\n\t\t\tlexer.tokenizer[key] = new Array();\n\t\t\taddRules('tokenizer.' + key, lexer.tokenizer[key], rules);\n\t\t}\n\t}\n\tlexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction\n\n\t// Set simple brackets\n\tif (json.brackets) {\n\t\tif (!(Array.isArray(<any>json.brackets))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the \\'brackets\\' attribute must be defined as an array');\n\t\t}\n\t}\n\telse {\n\t\tjson.brackets = [\n\t\t\t{ open: '{', close: '}', token: 'delimiter.curly' },\n\t\t\t{ open: '[', close: ']', token: 'delimiter.square' },\n\t\t\t{ open: '(', close: ')', token: 'delimiter.parenthesis' },\n\t\t\t{ open: '<', close: '>', token: 'delimiter.angle' }];\n\t}\n\tconst brackets: IMonarchLanguageBracket[] = [];\n\tfor (const el of json.brackets) {\n\t\tlet desc: any = el;\n\t\tif (desc && Array.isArray(desc) && desc.length === 3) {\n\t\t\tdesc = { token: desc[2], open: desc[0], close: desc[1] };\n\t\t}\n\t\tif (desc.open === desc.close) {\n\t\t\tthrow monarchCommon.createError(lexer, 'open and close brackets in a \\'brackets\\' attribute must be different: ' + desc.open +\n\t\t\t\t'\\n hint: use the \\'bracket\\' attribute if matching on equal brackets is required.');\n\t\t}\n\t\tif (typeof desc.open === 'string' && typeof desc.token === 'string' && typeof desc.close === 'string') {\n\t\t\tbrackets.push({\n\t\t\t\ttoken: desc.token + lexer.tokenPostfix,\n\t\t\t\topen: monarchCommon.fixCase(lexer, desc.open),\n\t\t\t\tclose: monarchCommon.fixCase(lexer, desc.close)\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'every element in the \\'brackets\\' array must be a \\'{open,close,token}\\' object or array');\n\t\t}\n\t}\n\tlexer.brackets = brackets;\n\n\t// Disable throw so the syntax highlighter goes, no matter what\n\tlexer.noThrow = true;\n\treturn lexer;\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\n/*\n * This module only exports 'compile' which compiles a JSON language definition\n * into a typed and checked ILexer definition.\n */\n\nimport { isString } from '../../../../base/common/types.js';\nimport * as monarchCommon from './monarchCommon.js';\nimport { IMonarchLanguage, IMonarchLanguageBracket } from './monarchTypes.js';\n\n/*\n * Type helpers\n *\n * Note: this is just for sanity checks on the JSON description which is\n * helpful for the programmer. No checks are done anymore once the lexer is\n * already 'compiled and checked'.\n *\n */\n\nfunction isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\tif (!(Array.isArray(obj))) {\n\t\treturn false;\n\t}\n\tfor (const el of obj) {\n\t\tif (!(elemType(el))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction bool(prop: any, defValue: boolean): boolean {\n\tif (typeof prop === 'boolean') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\nfunction string(prop: any, defValue: string): string {\n\tif (typeof (prop) === 'string') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\n\nfunction arrayToHash(array: string[]): { [name: string]: true } {\n\tconst result: any = {};\n\tfor (const e of array) {\n\t\tresult[e] = true;\n\t}\n\treturn result;\n}\n\n\nfunction createKeywordMatcher(arr: string[], caseInsensitive: boolean = false): (str: string) => boolean {\n\tif (caseInsensitive) {\n\t\tarr = arr.map(function (x) { return x.toLowerCase(); });\n\t}\n\tconst hash = arrayToHash(arr);\n\tif (caseInsensitive) {\n\t\treturn function (word) {\n\t\t\treturn hash[word.toLowerCase()] !== undefined && hash.hasOwnProperty(word.toLowerCase());\n\t\t};\n\t} else {\n\t\treturn function (word) {\n\t\t\treturn hash[word] !== undefined && hash.hasOwnProperty(word);\n\t\t};\n\t}\n}\n\n\n// Lexer helpers\n\n/**\n * Compiles a regular expression string, adding the 'i' flag if 'ignoreCase' is set, and the 'u' flag if 'unicode' is set.\n * Also replaces @\\w+ or sequences with the content of the specified attribute\n * @\\w+ replacement can be avoided by escaping `@` signs with another `@` sign.\n * @example /@attr/ will be replaced with the value of lexer[attr]\n * @example /@@text/ will not be replaced and will become /@text/.\n */\nfunction compileRegExp<S extends true | false>(lexer: monarchCommon.ILexerMin, str: string, handleSn: S): S extends true ? RegExp | DynamicRegExp : RegExp;\nfunction compileRegExp(lexer: monarchCommon.ILexerMin, str: string, handleSn: true | false): RegExp | DynamicRegExp {\n\t// @@ must be interpreted as a literal @, so we replace all occurences of @@ with a placeholder character\n\tstr = str.replace(/@@/g, `\\x01`);\n\n\tlet n = 0;\n\tlet hadExpansion: boolean;\n\tdo {\n\t\thadExpansion = false;\n\t\tstr = str.replace(/@(\\w+)/g, function (s, attr?) {\n\t\t\thadExpansion = true;\n\t\t\tlet sub = '';\n\t\t\tif (typeof (lexer[attr]) === 'string') {\n\t\t\t\tsub = lexer[attr];\n\t\t\t} else if (lexer[attr] && lexer[attr] instanceof RegExp) {\n\t\t\t\tsub = lexer[attr].source;\n\t\t\t} else {\n\t\t\t\tif (lexer[attr] === undefined) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'language definition does not contain attribute \\'' + attr + '\\', used at: ' + str);\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'attribute reference \\'' + attr + '\\' must be a string, used at: ' + str);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn (monarchCommon.empty(sub) ? '' : '(?:' + sub + ')');\n\t\t});\n\t\tn++;\n\t} while (hadExpansion && n < 5);\n\n\t// handle escaped @@\n\tstr = str.replace(/\\x01/g, '@');\n\n\tconst flags = (lexer.ignoreCase ? 'i' : '') + (lexer.unicode ? 'u' : '');\n\n\t// handle $Sn\n\tif (handleSn) {\n\t\tconst match = str.match(/\\$[sS](\\d\\d?)/g);\n\t\tif (match) {\n\t\t\tlet lastState: string | null = null;\n\t\t\tlet lastRegEx: RegExp | null = null;\n\t\t\treturn (state: string) => {\n\t\t\t\tif (lastRegEx && lastState === state) {\n\t\t\t\t\treturn lastRegEx;\n\t\t\t\t}\n\t\t\t\tlastState = state;\n\t\t\t\tlastRegEx = new RegExp(monarchCommon.substituteMatchesRe(lexer, str, state), flags);\n\t\t\t\treturn lastRegEx;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn new RegExp(str, flags);\n}\n\n/**\n * Compiles guard functions for case matches.\n * This compiles 'cases' attributes into efficient match functions.\n *\n */\nfunction selectScrutinee(id: string, matches: string[], state: string, num: number): string | null {\n\tif (num < 0) {\n\t\treturn id;\n\t}\n\tif (num < matches.length) {\n\t\treturn matches[num];\n\t}\n\tif (num >= 100) {\n\t\tnum = num - 100;\n\t\tconst parts = state.split('.');\n\t\tparts.unshift(state);\n\t\tif (num < parts.length) {\n\t\t\treturn parts[num];\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: string, val: monarchCommon.FuzzyAction): monarchCommon.IBranch {\n\t// get the scrutinee and pattern\n\tlet scrut = -1; // -1: $!, 0-99: $n, 100+n: $Sn\n\tlet oppat = tkey;\n\tlet matches = tkey.match(/^\\$(([sS]?)(\\d\\d?)|#)(.*)$/);\n\tif (matches) {\n\t\tif (matches[3]) { // if digits\n\t\t\tscrut = parseInt(matches[3]);\n\t\t\tif (matches[2]) {\n\t\t\t\tscrut = scrut + 100; // if [sS] present\n\t\t\t}\n\t\t}\n\t\toppat = matches[4];\n\t}\n\t// get operator\n\tlet op = '~';\n\tlet pat = oppat;\n\tif (!oppat || oppat.length === 0) {\n\t\top = '!=';\n\t\tpat = '';\n\t}\n\telse if (/^\\w*$/.test(pat)) { // just a word\n\t\top = '==';\n\t}\n\telse {\n\t\tmatches = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);\n\t\tif (matches) {\n\t\t\top = matches[1];\n\t\t\tpat = matches[2];\n\t\t}\n\t}\n\n\t// set the tester function\n\tlet tester: (s: string, id: string, matches: string[], state: string, eos: boolean) => boolean;\n\n\t// special case a regexp that matches just words\n\tif ((op === '~' || op === '!~') && /^(\\w|\\|)*$/.test(pat)) {\n\t\tconst inWords = createKeywordMatcher(pat.split('|'), lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '~' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '@' || op === '!@') {\n\t\tconst words = lexer[pat];\n\t\tif (!words) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' is not defined, in rule: ' + ruleName);\n\t\t}\n\t\tif (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' must be an array of strings, in rule: ' + ruleName);\n\t\t}\n\t\tconst inWords = createKeywordMatcher(words, lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '@' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '~' || op === '!~') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\t// precompile regular expression\n\t\t\tconst re = compileRegExp(lexer, '^' + pat + '$', false);\n\t\t\ttester = function (s) { return (op === '~' ? re.test(s) : !re.test(s)); };\n\t\t}\n\t\telse {\n\t\t\ttester = function (s, id, matches, state) {\n\t\t\t\tconst re = compileRegExp(lexer, '^' + monarchCommon.substituteMatches(lexer, pat, id, matches, state) + '$', false);\n\t\t\t\treturn re.test(s);\n\t\t\t};\n\t\t}\n\t}\n\telse { // if (op==='==' || op==='!=') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s) { return (op === '==' ? s === patx : s !== patx); };\n\t\t}\n\t\telse {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s, id, matches, state, eos) {\n\t\t\t\tconst patexp = monarchCommon.substituteMatches(lexer, patx, id, matches, state);\n\t\t\t\treturn (op === '==' ? s === patexp : s !== patexp);\n\t\t\t};\n\t\t}\n\t}\n\n\t// return the branch object\n\tif (scrut === -1) {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\treturn tester(id, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\tconst scrutinee = selectScrutinee(id, matches, state, scrut);\n\t\t\t\treturn tester(!scrutinee ? '' : scrutinee, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n}\n\n/**\n * Compiles an action: i.e. optimize regular expressions and case matches\n * and do many sanity checks.\n *\n * This is called only during compilation but if the lexer definition\n * contains user functions as actions (which is usually not allowed), then this\n * may be called during lexing. It is important therefore to compile common cases efficiently\n */\nfunction compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: any): monarchCommon.FuzzyAction {\n\tif (!action) {\n\t\treturn { token: '' };\n\t}\n\telse if (typeof (action) === 'string') {\n\t\treturn action; // { token: action };\n\t}\n\telse if (action.token || action.token === '') {\n\t\tif (typeof (action.token) !== 'string') {\n\t\t\tthrow monarchCommon.createError(lexer, 'a \\'token\\' attribute must be of type string, in rule: ' + ruleName);\n\t\t}\n\t\telse {\n\t\t\t// only copy specific typed fields (only happens once during compile Lexer)\n\t\t\tconst newAction: monarchCommon.IAction = { token: action.token };\n\t\t\tif (action.token.indexOf('$') >= 0) {\n\t\t\t\tnewAction.tokenSubst = true;\n\t\t\t}\n\t\t\tif (typeof (action.bracket) === 'string') {\n\t\t\t\tif (action.bracket === '@open') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Open;\n\t\t\t\t} else if (action.bracket === '@close') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Close;\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a \\'bracket\\' attribute must be either \\'@open\\' or \\'@close\\', in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.next) {\n\t\t\t\tif (typeof (action.next) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state must be a string value in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet next: string = action.next;\n\t\t\t\t\tif (!/^(@pop|@push|@popall)$/.test(next)) {\n\t\t\t\t\t\tif (next[0] === '@') {\n\t\t\t\t\t\t\tnext = next.substr(1); // peel off starting @ sign\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists\n\t\t\t\t\t\t\tif (!monarchCommon.stateExists(lexer, monarchCommon.substituteMatches(lexer, next, '', [], ''))) {\n\t\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state \\'' + action.next + '\\' is not defined in rule: ' + ruleName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewAction.next = next;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof (action.goBack) === 'number') {\n\t\t\t\tnewAction.goBack = action.goBack;\n\t\t\t}\n\t\t\tif (typeof (action.switchTo) === 'string') {\n\t\t\t\tnewAction.switchTo = action.switchTo;\n\t\t\t}\n\t\t\tif (typeof (action.log) === 'string') {\n\t\t\t\tnewAction.log = action.log;\n\t\t\t}\n\t\t\tif (typeof (action.nextEmbedded) === 'string') {\n\t\t\t\tnewAction.nextEmbedded = action.nextEmbedded;\n\t\t\t\tlexer.usesEmbedded = true;\n\t\t\t}\n\t\t\treturn newAction;\n\t\t}\n\t}\n\telse if (Array.isArray(action)) {\n\t\tconst results: monarchCommon.FuzzyAction[] = [];\n\t\tfor (let i = 0, len = action.length; i < len; i++) {\n\t\t\tresults[i] = compileAction(lexer, ruleName, action[i]);\n\t\t}\n\t\treturn { group: results };\n\t}\n\telse if (action.cases) {\n\t\t// build an array of test cases\n\t\tconst cases: monarchCommon.IBranch[] = [];\n\n\t\tlet hasEmbeddedEndInCases = false;\n\t\t// for each case, push a test function and result value\n\t\tfor (const tkey in action.cases) {\n\t\t\tif (action.cases.hasOwnProperty(tkey)) {\n\t\t\t\tconst val = compileAction(lexer, ruleName, action.cases[tkey]);\n\n\t\t\t\t// what kind of case\n\t\t\t\tif (tkey === '@default' || tkey === '@' || tkey === '') {\n\t\t\t\t\tcases.push({ test: undefined, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse if (tkey === '@eos') {\n\t\t\t\t\tcases.push({ test: function (id, matches, state, eos) { return eos; }, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcases.push(createGuard(lexer, ruleName, tkey, val)); // call separate function to avoid local variable capture\n\t\t\t\t}\n\n\t\t\t\tif (!hasEmbeddedEndInCases) {\n\t\t\t\t\thasEmbeddedEndInCases = !isString(val) && (val.hasEmbeddedEndInCases || ['@pop', '@popall'].includes(val.nextEmbedded || ''));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// create a matching function\n\t\tconst def = lexer.defaultToken;\n\t\treturn {\n\t\t\thasEmbeddedEndInCases,\n\t\t\ttest: function (id, matches, state, eos) {\n\t\t\t\tfor (const _case of cases) {\n\t\t\t\t\tconst didmatch = (!_case.test || _case.test(id, matches, state, eos));\n\t\t\t\t\tif (didmatch) {\n\t\t\t\t\t\treturn _case.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn def;\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\tthrow monarchCommon.createError(lexer, 'an action must be a string, an object with a \\'token\\' or \\'cases\\' attribute, or an array of actions; in rule: ' + ruleName);\n\t}\n}\n\ntype DynamicRegExp = (state: string) => RegExp;\n\n/**\n * Helper class for creating matching rules\n */\nclass Rule implements monarchCommon.IRule {\n\tprivate regex: RegExp | DynamicRegExp = new RegExp('');\n\tpublic action: monarchCommon.FuzzyAction = { token: '' };\n\tpublic matchOnlyAtLineStart: boolean = false;\n\tpublic name: string = '';\n\n\tconstructor(name: string) {\n\t\tthis.name = name;\n\t}\n\n\tpublic setRegex(lexer: monarchCommon.ILexerMin, re: string | RegExp): void {\n\t\tlet sregex: string;\n\t\tif (typeof (re) === 'string') {\n\t\t\tsregex = re;\n\t\t}\n\t\telse if (re instanceof RegExp) {\n\t\t\tsregex = (<RegExp>re).source;\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'rules must start with a match string or regular expression: ' + this.name);\n\t\t}\n\n\t\tthis.matchOnlyAtLineStart = (sregex.length > 0 && sregex[0] === '^');\n\t\tthis.name = this.name + ': ' + sregex;\n\t\tthis.regex = compileRegExp(lexer, '^(?:' + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ')', true);\n\t}\n\n\tpublic setAction(lexer: monarchCommon.ILexerMin, act: monarchCommon.IAction) {\n\t\tthis.action = compileAction(lexer, this.name, act);\n\t}\n\n\tpublic resolveRegex(state: string): RegExp {\n\t\tif (this.regex instanceof RegExp) {\n\t\t\treturn this.regex;\n\t\t} else {\n\t\t\treturn this.regex(state);\n\t\t}\n\t}\n}\n\n/**\n * Compiles a json description function into json where all regular expressions,\n * case matches etc, are compiled and all include rules are expanded.\n * We also compile the bracket definitions, supply defaults, and do many sanity checks.\n * If the 'jsonStrict' parameter is 'false', we allow at certain locations\n * regular expression objects and functions that get called during lexing.\n * (Currently we have no samples that need this so perhaps we should always have\n * jsonStrict to true).\n */\nexport function compile(languageId: string, json: IMonarchLanguage): monarchCommon.ILexer {\n\tif (!json || typeof (json) !== 'object') {\n\t\tthrow new Error('Monarch: expecting a language definition object');\n\t}\n\n\t// Create our lexer\n\tconst lexer: monarchCommon.ILexer = {\n\t\tlanguageId: languageId,\n\t\tincludeLF: bool(json.includeLF, false),\n\t\tnoThrow: false, // raise exceptions during compilation\n\t\tmaxStack: 100,\n\t\tstart: (typeof json.start === 'string' ? json.start : null),\n\t\tignoreCase: bool(json.ignoreCase, false),\n\t\tunicode: bool(json.unicode, false),\n\t\ttokenPostfix: string(json.tokenPostfix, '.' + languageId),\n\t\tdefaultToken: string(json.defaultToken, 'source'),\n\t\tusesEmbedded: false, // becomes true if we find a nextEmbedded action\n\t\tstateNames: {},\n\t\ttokenizer: {},\n\t\tbrackets: []\n\t};\n\n\t// For calling compileAction later on\n\tconst lexerMin: monarchCommon.ILexerMin = <any>json;\n\tlexerMin.languageId = languageId;\n\tlexerMin.includeLF = lexer.includeLF;\n\tlexerMin.ignoreCase = lexer.ignoreCase;\n\tlexerMin.unicode = lexer.unicode;\n\tlexerMin.noThrow = lexer.noThrow;\n\tlexerMin.usesEmbedded = lexer.usesEmbedded;\n\tlexerMin.stateNames = json.tokenizer;\n\tlexerMin.defaultToken = lexer.defaultToken;\n\n\n\t// Compile an array of rules into newrules where RegExp objects are created.\n\tfunction addRules(state: string, newrules: monarchCommon.IRule[], rules: any[]) {\n\t\tfor (const rule of rules) {\n\n\t\t\tlet include = rule.include;\n\t\t\tif (include) {\n\t\t\t\tif (typeof (include) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'an \\'include\\' attribute must be a string at: ' + state);\n\t\t\t\t}\n\t\t\t\tif (include[0] === '@') {\n\t\t\t\t\tinclude = include.substr(1); // peel off starting @\n\t\t\t\t}\n\t\t\t\tif (!json.tokenizer[include]) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'include target \\'' + include + '\\' is not defined at: ' + state);\n\t\t\t\t}\n\t\t\t\taddRules(state + '.' + include, newrules, json.tokenizer[include]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst newrule = new Rule(state);\n\n\t\t\t\t// Set up new rule attributes\n\t\t\t\tif (Array.isArray(rule) && rule.length >= 1 && rule.length <= 3) {\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule[0]);\n\t\t\t\t\tif (rule.length >= 3) {\n\t\t\t\t\t\tif (typeof (rule[1]) === 'string') {\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, { token: rule[1], next: rule[2] });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (typeof (rule[1]) === 'object') {\n\t\t\t\t\t\t\tconst rule1 = rule[1];\n\t\t\t\t\t\t\trule1.next = rule[2];\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, rule1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a next state as the last element of a rule can only be given if the action is either an object or a string, at: ' + state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnewrule.setAction(lexerMin, rule[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!rule.regex) {\n\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a rule must either be an array, or an object with a \\'regex\\' or \\'include\\' field at: ' + state);\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.name) {\n\t\t\t\t\t\tif (typeof rule.name === 'string') {\n\t\t\t\t\t\t\tnewrule.name = rule.name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.matchOnlyAtStart) {\n\t\t\t\t\t\tnewrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart, false);\n\t\t\t\t\t}\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule.regex);\n\t\t\t\t\tnewrule.setAction(lexerMin, rule.action);\n\t\t\t\t}\n\n\t\t\t\tnewrules.push(newrule);\n\t\t\t}\n\t\t}\n\t}\n\n\t// compile the tokenizer rules\n\tif (!json.tokenizer || typeof (json.tokenizer) !== 'object') {\n\t\tthrow monarchCommon.createError(lexer, 'a language definition must define the \\'tokenizer\\' attribute as an object');\n\t}\n\n\tlexer.tokenizer = <any>[];\n\tfor (const key in json.tokenizer) {\n\t\tif (json.tokenizer.hasOwnProperty(key)) {\n\t\t\tif (!lexer.start) {\n\t\t\t\tlexer.start = key;\n\t\t\t}\n\n\t\t\tconst rules = json.tokenizer[key];\n\t\t\tlexer.tokenizer[key] = new Array();\n\t\t\taddRules('tokenizer.' + key, lexer.tokenizer[key], rules);\n\t\t}\n\t}\n\tlexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction\n\n\t// Set simple brackets\n\tif (json.brackets) {\n\t\tif (!(Array.isArray(<any>json.brackets))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the \\'brackets\\' attribute must be defined as an array');\n\t\t}\n\t}\n\telse {\n\t\tjson.brackets = [\n\t\t\t{ open: '{', close: '}', token: 'delimiter.curly' },\n\t\t\t{ open: '[', close: ']', token: 'delimiter.square' },\n\t\t\t{ open: '(', close: ')', token: 'delimiter.parenthesis' },\n\t\t\t{ open: '<', close: '>', token: 'delimiter.angle' }];\n\t}\n\tconst brackets: IMonarchLanguageBracket[] = [];\n\tfor (const el of json.brackets) {\n\t\tlet desc: any = el;\n\t\tif (desc && Array.isArray(desc) && desc.length === 3) {\n\t\t\tdesc = { token: desc[2], open: desc[0], close: desc[1] };\n\t\t}\n\t\tif (desc.open === desc.close) {\n\t\t\tthrow monarchCommon.createError(lexer, 'open and close brackets in a \\'brackets\\' attribute must be different: ' + desc.open +\n\t\t\t\t'\\n hint: use the \\'bracket\\' attribute if matching on equal brackets is required.');\n\t\t}\n\t\tif (typeof desc.open === 'string' && typeof desc.token === 'string' && typeof desc.close === 'string') {\n\t\t\tbrackets.push({\n\t\t\t\ttoken: desc.token + lexer.tokenPostfix,\n\t\t\t\topen: monarchCommon.fixCase(lexer, desc.open),\n\t\t\t\tclose: monarchCommon.fixCase(lexer, desc.close)\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'every element in the \\'brackets\\' array must be a \\'{open,close,token}\\' object or array');\n\t\t}\n\t}\n\tlexer.brackets = brackets;\n\n\t// Disable throw so the syntax highlighter goes, no matter what\n\tlexer.noThrow = true;\n\treturn lexer;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/standalone/common/monarch/monarchCompile.ts","vs/editor/standalone/common/monarch/monarchCompile.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAGpD;;;;;;;GAOG;AAEH,SAAS,SAAS,CAAC,QAA6B,EAAE,GAAQ;IACzD,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,IAAI,CAAC,IAAS,EAAE,QAAiB;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,+DAA+D;IAC/D,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,OAAO,KAAK,CAAC;AACd,CAAC","file":"monarchCompile.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\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/*\n * This module only exports 'compile' which compiles a JSON language definition\n * into a typed and checked ILexer definition.\n */\n\nimport { isString } from '../../../../base/common/types.js';\nimport * as monarchCommon from './monarchCommon.js';\nimport { IMonarchLanguage, IMonarchLanguageBracket } from './monarchTypes.js';\n\n/*\n * Type helpers\n *\n * Note: this is just for sanity checks on the JSON description which is\n * helpful for the programmer. No checks are done anymore once the lexer is\n * already 'compiled and checked'.\n *\n */\n\nfunction isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\tif (!(Array.isArray(obj))) {\n\t\treturn false;\n\t}\n\tfor (const el of obj) {\n\t\tif (!(elemType(el))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction bool(prop: any, defValue: boolean): boolean {\n\tif (typeof prop === 'boolean') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\nfunction string(prop: any, defValue: string): string {\n\tif (typeof (prop) === 'string') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\n\nfunction arrayToHash(array: string[]): { [name: string]: true } {\n\tconst result: any = {};\n\tfor (const e of array) {\n\t\tresult[e] = true;\n\t}\n\treturn result;\n}\n\n\nfunction createKeywordMatcher(arr: string[], caseInsensitive: boolean = false): (str: string) => boolean {\n\tif (caseInsensitive) {\n\t\tarr = arr.map(function (x) { return x.toLowerCase(); });\n\t}\n\tconst hash = arrayToHash(arr);\n\tif (caseInsensitive) {\n\t\treturn function (word) {\n\t\t\treturn hash[word.toLowerCase()] !== undefined && hash.hasOwnProperty(word.toLowerCase());\n\t\t};\n\t} else {\n\t\treturn function (word) {\n\t\t\treturn hash[word] !== undefined && hash.hasOwnProperty(word);\n\t\t};\n\t}\n}\n\n\n// Lexer helpers\n\n/**\n * Compiles a regular expression string, adding the 'i' flag if 'ignoreCase' is set, and the 'u' flag if 'unicode' is set.\n * Also replaces @\\w+ or sequences with the content of the specified attribute\n * @\\w+ replacement can be avoided by escaping `@` signs with another `@` sign.\n * @example /@attr/ will be replaced with the value of lexer[attr]\n * @example /@@text/ will not be replaced and will become /@text/.\n */\nfunction compileRegExp<S extends true | false>(lexer: monarchCommon.ILexerMin, str: string, handleSn: S): S extends true ? RegExp | DynamicRegExp : RegExp;\nfunction compileRegExp(lexer: monarchCommon.ILexerMin, str: string, handleSn: true | false): RegExp | DynamicRegExp {\n\t// @@ must be interpreted as a literal @, so we replace all occurences of @@ with a placeholder character\n\tstr = str.replace(/@@/g, `\\x01`);\n\n\tlet n = 0;\n\tlet hadExpansion: boolean;\n\tdo {\n\t\thadExpansion = false;\n\t\tstr = str.replace(/@(\\w+)/g, function (s, attr?) {\n\t\t\thadExpansion = true;\n\t\t\tlet sub = '';\n\t\t\tif (typeof (lexer[attr]) === 'string') {\n\t\t\t\tsub = lexer[attr];\n\t\t\t} else if (lexer[attr] && lexer[attr] instanceof RegExp) {\n\t\t\t\tsub = lexer[attr].source;\n\t\t\t} else {\n\t\t\t\tif (lexer[attr] === undefined) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'language definition does not contain attribute \\'' + attr + '\\', used at: ' + str);\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'attribute reference \\'' + attr + '\\' must be a string, used at: ' + str);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn (monarchCommon.empty(sub) ? '' : '(?:' + sub + ')');\n\t\t});\n\t\tn++;\n\t} while (hadExpansion && n < 5);\n\n\t// handle escaped @@\n\tstr = str.replace(/\\x01/g, '@');\n\n\tconst flags = (lexer.ignoreCase ? 'i' : '') + (lexer.unicode ? 'u' : '');\n\n\t// handle $Sn\n\tif (handleSn) {\n\t\tconst match = str.match(/\\$[sS](\\d\\d?)/g);\n\t\tif (match) {\n\t\t\tlet lastState: string | null = null;\n\t\t\tlet lastRegEx: RegExp | null = null;\n\t\t\treturn (state: string) => {\n\t\t\t\tif (lastRegEx && lastState === state) {\n\t\t\t\t\treturn lastRegEx;\n\t\t\t\t}\n\t\t\t\tlastState = state;\n\t\t\t\tlastRegEx = new RegExp(monarchCommon.substituteMatchesRe(lexer, str, state), flags);\n\t\t\t\treturn lastRegEx;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn new RegExp(str, flags);\n}\n\n/**\n * Compiles guard functions for case matches.\n * This compiles 'cases' attributes into efficient match functions.\n *\n */\nfunction selectScrutinee(id: string, matches: string[], state: string, num: number): string | null {\n\tif (num < 0) {\n\t\treturn id;\n\t}\n\tif (num < matches.length) {\n\t\treturn matches[num];\n\t}\n\tif (num >= 100) {\n\t\tnum = num - 100;\n\t\tconst parts = state.split('.');\n\t\tparts.unshift(state);\n\t\tif (num < parts.length) {\n\t\t\treturn parts[num];\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: string, val: monarchCommon.FuzzyAction): monarchCommon.IBranch {\n\t// get the scrutinee and pattern\n\tlet scrut = -1; // -1: $!, 0-99: $n, 100+n: $Sn\n\tlet oppat = tkey;\n\tlet matches = tkey.match(/^\\$(([sS]?)(\\d\\d?)|#)(.*)$/);\n\tif (matches) {\n\t\tif (matches[3]) { // if digits\n\t\t\tscrut = parseInt(matches[3]);\n\t\t\tif (matches[2]) {\n\t\t\t\tscrut = scrut + 100; // if [sS] present\n\t\t\t}\n\t\t}\n\t\toppat = matches[4];\n\t}\n\t// get operator\n\tlet op = '~';\n\tlet pat = oppat;\n\tif (!oppat || oppat.length === 0) {\n\t\top = '!=';\n\t\tpat = '';\n\t}\n\telse if (/^\\w*$/.test(pat)) { // just a word\n\t\top = '==';\n\t}\n\telse {\n\t\tmatches = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);\n\t\tif (matches) {\n\t\t\top = matches[1];\n\t\t\tpat = matches[2];\n\t\t}\n\t}\n\n\t// set the tester function\n\tlet tester: (s: string, id: string, matches: string[], state: string, eos: boolean) => boolean;\n\n\t// special case a regexp that matches just words\n\tif ((op === '~' || op === '!~') && /^(\\w|\\|)*$/.test(pat)) {\n\t\tconst inWords = createKeywordMatcher(pat.split('|'), lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '~' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '@' || op === '!@') {\n\t\tconst words = lexer[pat];\n\t\tif (!words) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' is not defined, in rule: ' + ruleName);\n\t\t}\n\t\tif (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' must be an array of strings, in rule: ' + ruleName);\n\t\t}\n\t\tconst inWords = createKeywordMatcher(words, lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '@' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '~' || op === '!~') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\t// precompile regular expression\n\t\t\tconst re = compileRegExp(lexer, '^' + pat + '$', false);\n\t\t\ttester = function (s) { return (op === '~' ? re.test(s) : !re.test(s)); };\n\t\t}\n\t\telse {\n\t\t\ttester = function (s, id, matches, state) {\n\t\t\t\tconst re = compileRegExp(lexer, '^' + monarchCommon.substituteMatches(lexer, pat, id, matches, state) + '$', false);\n\t\t\t\treturn re.test(s);\n\t\t\t};\n\t\t}\n\t}\n\telse { // if (op==='==' || op==='!=') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s) { return (op === '==' ? s === patx : s !== patx); };\n\t\t}\n\t\telse {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s, id, matches, state, eos) {\n\t\t\t\tconst patexp = monarchCommon.substituteMatches(lexer, patx, id, matches, state);\n\t\t\t\treturn (op === '==' ? s === patexp : s !== patexp);\n\t\t\t};\n\t\t}\n\t}\n\n\t// return the branch object\n\tif (scrut === -1) {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\treturn tester(id, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\tconst scrutinee = selectScrutinee(id, matches, state, scrut);\n\t\t\t\treturn tester(!scrutinee ? '' : scrutinee, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n}\n\n/**\n * Compiles an action: i.e. optimize regular expressions and case matches\n * and do many sanity checks.\n *\n * This is called only during compilation but if the lexer definition\n * contains user functions as actions (which is usually not allowed), then this\n * may be called during lexing. It is important therefore to compile common cases efficiently\n */\nfunction compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: any): monarchCommon.FuzzyAction {\n\tif (!action) {\n\t\treturn { token: '' };\n\t}\n\telse if (typeof (action) === 'string') {\n\t\treturn action; // { token: action };\n\t}\n\telse if (action.token || action.token === '') {\n\t\tif (typeof (action.token) !== 'string') {\n\t\t\tthrow monarchCommon.createError(lexer, 'a \\'token\\' attribute must be of type string, in rule: ' + ruleName);\n\t\t}\n\t\telse {\n\t\t\t// only copy specific typed fields (only happens once during compile Lexer)\n\t\t\tconst newAction: monarchCommon.IAction = { token: action.token };\n\t\t\tif (action.token.indexOf('$') >= 0) {\n\t\t\t\tnewAction.tokenSubst = true;\n\t\t\t}\n\t\t\tif (typeof (action.bracket) === 'string') {\n\t\t\t\tif (action.bracket === '@open') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Open;\n\t\t\t\t} else if (action.bracket === '@close') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Close;\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a \\'bracket\\' attribute must be either \\'@open\\' or \\'@close\\', in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.next) {\n\t\t\t\tif (typeof (action.next) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state must be a string value in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet next: string = action.next;\n\t\t\t\t\tif (!/^(@pop|@push|@popall)$/.test(next)) {\n\t\t\t\t\t\tif (next[0] === '@') {\n\t\t\t\t\t\t\tnext = next.substr(1); // peel off starting @ sign\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists\n\t\t\t\t\t\t\tif (!monarchCommon.stateExists(lexer, monarchCommon.substituteMatches(lexer, next, '', [], ''))) {\n\t\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state \\'' + action.next + '\\' is not defined in rule: ' + ruleName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewAction.next = next;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof (action.goBack) === 'number') {\n\t\t\t\tnewAction.goBack = action.goBack;\n\t\t\t}\n\t\t\tif (typeof (action.switchTo) === 'string') {\n\t\t\t\tnewAction.switchTo = action.switchTo;\n\t\t\t}\n\t\t\tif (typeof (action.log) === 'string') {\n\t\t\t\tnewAction.log = action.log;\n\t\t\t}\n\t\t\tif (typeof (action.nextEmbedded) === 'string') {\n\t\t\t\tnewAction.nextEmbedded = action.nextEmbedded;\n\t\t\t\tlexer.usesEmbedded = true;\n\t\t\t}\n\t\t\treturn newAction;\n\t\t}\n\t}\n\telse if (Array.isArray(action)) {\n\t\tconst results: monarchCommon.FuzzyAction[] = [];\n\t\tfor (let i = 0, len = action.length; i < len; i++) {\n\t\t\tresults[i] = compileAction(lexer, ruleName, action[i]);\n\t\t}\n\t\treturn { group: results };\n\t}\n\telse if (action.cases) {\n\t\t// build an array of test cases\n\t\tconst cases: monarchCommon.IBranch[] = [];\n\n\t\tlet hasEmbeddedEndInCases = false;\n\t\t// for each case, push a test function and result value\n\t\tfor (const tkey in action.cases) {\n\t\t\tif (action.cases.hasOwnProperty(tkey)) {\n\t\t\t\tconst val = compileAction(lexer, ruleName, action.cases[tkey]);\n\n\t\t\t\t// what kind of case\n\t\t\t\tif (tkey === '@default' || tkey === '@' || tkey === '') {\n\t\t\t\t\tcases.push({ test: undefined, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse if (tkey === '@eos') {\n\t\t\t\t\tcases.push({ test: function (id, matches, state, eos) { return eos; }, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcases.push(createGuard(lexer, ruleName, tkey, val)); // call separate function to avoid local variable capture\n\t\t\t\t}\n\n\t\t\t\tif (!hasEmbeddedEndInCases) {\n\t\t\t\t\thasEmbeddedEndInCases = !isString(val) && (val.hasEmbeddedEndInCases || ['@pop', '@popall'].includes(val.nextEmbedded || ''));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// create a matching function\n\t\tconst def = lexer.defaultToken;\n\t\treturn {\n\t\t\thasEmbeddedEndInCases,\n\t\t\ttest: function (id, matches, state, eos) {\n\t\t\t\tfor (const _case of cases) {\n\t\t\t\t\tconst didmatch = (!_case.test || _case.test(id, matches, state, eos));\n\t\t\t\t\tif (didmatch) {\n\t\t\t\t\t\treturn _case.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn def;\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\tthrow monarchCommon.createError(lexer, 'an action must be a string, an object with a \\'token\\' or \\'cases\\' attribute, or an array of actions; in rule: ' + ruleName);\n\t}\n}\n\ntype DynamicRegExp = (state: string) => RegExp;\n\n/**\n * Helper class for creating matching rules\n */\nclass Rule implements monarchCommon.IRule {\n\tprivate regex: RegExp | DynamicRegExp = new RegExp('');\n\tpublic action: monarchCommon.FuzzyAction = { token: '' };\n\tpublic matchOnlyAtLineStart: boolean = false;\n\tpublic name: string = '';\n\n\tconstructor(name: string) {\n\t\tthis.name = name;\n\t}\n\n\tpublic setRegex(lexer: monarchCommon.ILexerMin, re: string | RegExp): void {\n\t\tlet sregex: string;\n\t\tif (typeof (re) === 'string') {\n\t\t\tsregex = re;\n\t\t}\n\t\telse if (re instanceof RegExp) {\n\t\t\tsregex = (<RegExp>re).source;\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'rules must start with a match string or regular expression: ' + this.name);\n\t\t}\n\n\t\tthis.matchOnlyAtLineStart = (sregex.length > 0 && sregex[0] === '^');\n\t\tthis.name = this.name + ': ' + sregex;\n\t\tthis.regex = compileRegExp(lexer, '^(?:' + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ')', true);\n\t}\n\n\tpublic setAction(lexer: monarchCommon.ILexerMin, act: monarchCommon.IAction) {\n\t\tthis.action = compileAction(lexer, this.name, act);\n\t}\n\n\tpublic resolveRegex(state: string): RegExp {\n\t\tif (this.regex instanceof RegExp) {\n\t\t\treturn this.regex;\n\t\t} else {\n\t\t\treturn this.regex(state);\n\t\t}\n\t}\n}\n\n/**\n * Compiles a json description function into json where all regular expressions,\n * case matches etc, are compiled and all include rules are expanded.\n * We also compile the bracket definitions, supply defaults, and do many sanity checks.\n * If the 'jsonStrict' parameter is 'false', we allow at certain locations\n * regular expression objects and functions that get called during lexing.\n * (Currently we have no samples that need this so perhaps we should always have\n * jsonStrict to true).\n */\nexport function compile(languageId: string, json: IMonarchLanguage): monarchCommon.ILexer {\n\tif (!json || typeof (json) !== 'object') {\n\t\tthrow new Error('Monarch: expecting a language definition object');\n\t}\n\n\t// Create our lexer\n\tconst lexer: monarchCommon.ILexer = {\n\t\tlanguageId: languageId,\n\t\tincludeLF: bool(json.includeLF, false),\n\t\tnoThrow: false, // raise exceptions during compilation\n\t\tmaxStack: 100,\n\t\tstart: (typeof json.start === 'string' ? json.start : null),\n\t\tignoreCase: bool(json.ignoreCase, false),\n\t\tunicode: bool(json.unicode, false),\n\t\ttokenPostfix: string(json.tokenPostfix, '.' + languageId),\n\t\tdefaultToken: string(json.defaultToken, 'source'),\n\t\tusesEmbedded: false, // becomes true if we find a nextEmbedded action\n\t\tstateNames: {},\n\t\ttokenizer: {},\n\t\tbrackets: []\n\t};\n\n\t// For calling compileAction later on\n\t// eslint-disable-next-line local/code-no-any-casts\n\tconst lexerMin: monarchCommon.ILexerMin = <any>json;\n\tlexerMin.languageId = languageId;\n\tlexerMin.includeLF = lexer.includeLF;\n\tlexerMin.ignoreCase = lexer.ignoreCase;\n\tlexerMin.unicode = lexer.unicode;\n\tlexerMin.noThrow = lexer.noThrow;\n\tlexerMin.usesEmbedded = lexer.usesEmbedded;\n\tlexerMin.stateNames = json.tokenizer;\n\tlexerMin.defaultToken = lexer.defaultToken;\n\n\n\t// Compile an array of rules into newrules where RegExp objects are created.\n\tfunction addRules(state: string, newrules: monarchCommon.IRule[], rules: any[]) {\n\t\tfor (const rule of rules) {\n\n\t\t\tlet include = rule.include;\n\t\t\tif (include) {\n\t\t\t\tif (typeof (include) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'an \\'include\\' attribute must be a string at: ' + state);\n\t\t\t\t}\n\t\t\t\tif (include[0] === '@') {\n\t\t\t\t\tinclude = include.substr(1); // peel off starting @\n\t\t\t\t}\n\t\t\t\tif (!json.tokenizer[include]) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'include target \\'' + include + '\\' is not defined at: ' + state);\n\t\t\t\t}\n\t\t\t\taddRules(state + '.' + include, newrules, json.tokenizer[include]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst newrule = new Rule(state);\n\n\t\t\t\t// Set up new rule attributes\n\t\t\t\tif (Array.isArray(rule) && rule.length >= 1 && rule.length <= 3) {\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule[0]);\n\t\t\t\t\tif (rule.length >= 3) {\n\t\t\t\t\t\tif (typeof (rule[1]) === 'string') {\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, { token: rule[1], next: rule[2] });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (typeof (rule[1]) === 'object') {\n\t\t\t\t\t\t\tconst rule1 = rule[1];\n\t\t\t\t\t\t\trule1.next = rule[2];\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, rule1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a next state as the last element of a rule can only be given if the action is either an object or a string, at: ' + state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnewrule.setAction(lexerMin, rule[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!rule.regex) {\n\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a rule must either be an array, or an object with a \\'regex\\' or \\'include\\' field at: ' + state);\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.name) {\n\t\t\t\t\t\tif (typeof rule.name === 'string') {\n\t\t\t\t\t\t\tnewrule.name = rule.name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.matchOnlyAtStart) {\n\t\t\t\t\t\tnewrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart, false);\n\t\t\t\t\t}\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule.regex);\n\t\t\t\t\tnewrule.setAction(lexerMin, rule.action);\n\t\t\t\t}\n\n\t\t\t\tnewrules.push(newrule);\n\t\t\t}\n\t\t}\n\t}\n\n\t// compile the tokenizer rules\n\tif (!json.tokenizer || typeof (json.tokenizer) !== 'object') {\n\t\tthrow monarchCommon.createError(lexer, 'a language definition must define the \\'tokenizer\\' attribute as an object');\n\t}\n\n\t// eslint-disable-next-line local/code-no-any-casts\n\tlexer.tokenizer = <any>[];\n\tfor (const key in json.tokenizer) {\n\t\tif (json.tokenizer.hasOwnProperty(key)) {\n\t\t\tif (!lexer.start) {\n\t\t\t\tlexer.start = key;\n\t\t\t}\n\n\t\t\tconst rules = json.tokenizer[key];\n\t\t\tlexer.tokenizer[key] = new Array();\n\t\t\taddRules('tokenizer.' + key, lexer.tokenizer[key], rules);\n\t\t}\n\t}\n\tlexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction\n\n\t// Set simple brackets\n\tif (json.brackets) {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(Array.isArray(<any>json.brackets))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the \\'brackets\\' attribute must be defined as an array');\n\t\t}\n\t}\n\telse {\n\t\tjson.brackets = [\n\t\t\t{ open: '{', close: '}', token: 'delimiter.curly' },\n\t\t\t{ open: '[', close: ']', token: 'delimiter.square' },\n\t\t\t{ open: '(', close: ')', token: 'delimiter.parenthesis' },\n\t\t\t{ open: '<', close: '>', token: 'delimiter.angle' }];\n\t}\n\tconst brackets: IMonarchLanguageBracket[] = [];\n\tfor (const el of json.brackets) {\n\t\tlet desc: any = el;\n\t\tif (desc && Array.isArray(desc) && desc.length === 3) {\n\t\t\tdesc = { token: desc[2], open: desc[0], close: desc[1] };\n\t\t}\n\t\tif (desc.open === desc.close) {\n\t\t\tthrow monarchCommon.createError(lexer, 'open and close brackets in a \\'brackets\\' attribute must be different: ' + desc.open +\n\t\t\t\t'\\n hint: use the \\'bracket\\' attribute if matching on equal brackets is required.');\n\t\t}\n\t\tif (typeof desc.open === 'string' && typeof desc.token === 'string' && typeof desc.close === 'string') {\n\t\t\tbrackets.push({\n\t\t\t\ttoken: desc.token + lexer.tokenPostfix,\n\t\t\t\topen: monarchCommon.fixCase(lexer, desc.open),\n\t\t\t\tclose: monarchCommon.fixCase(lexer, desc.close)\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'every element in the \\'brackets\\' array must be a \\'{open,close,token}\\' object or array');\n\t\t}\n\t}\n\tlexer.brackets = brackets;\n\n\t// Disable throw so the syntax highlighter goes, no matter what\n\tlexer.noThrow = true;\n\treturn lexer;\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\n/*\n * This module only exports 'compile' which compiles a JSON language definition\n * into a typed and checked ILexer definition.\n */\n\nimport { isString } from '../../../../base/common/types.js';\nimport * as monarchCommon from './monarchCommon.js';\nimport { IMonarchLanguage, IMonarchLanguageBracket } from './monarchTypes.js';\n\n/*\n * Type helpers\n *\n * Note: this is just for sanity checks on the JSON description which is\n * helpful for the programmer. No checks are done anymore once the lexer is\n * already 'compiled and checked'.\n *\n */\n\nfunction isArrayOf(elemType: (x: any) => boolean, obj: any): boolean {\n\tif (!obj) {\n\t\treturn false;\n\t}\n\tif (!(Array.isArray(obj))) {\n\t\treturn false;\n\t}\n\tfor (const el of obj) {\n\t\tif (!(elemType(el))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction bool(prop: any, defValue: boolean): boolean {\n\tif (typeof prop === 'boolean') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\nfunction string(prop: any, defValue: string): string {\n\tif (typeof (prop) === 'string') {\n\t\treturn prop;\n\t}\n\treturn defValue;\n}\n\n\nfunction arrayToHash(array: string[]): { [name: string]: true } {\n\tconst result: any = {};\n\tfor (const e of array) {\n\t\tresult[e] = true;\n\t}\n\treturn result;\n}\n\n\nfunction createKeywordMatcher(arr: string[], caseInsensitive: boolean = false): (str: string) => boolean {\n\tif (caseInsensitive) {\n\t\tarr = arr.map(function (x) { return x.toLowerCase(); });\n\t}\n\tconst hash = arrayToHash(arr);\n\tif (caseInsensitive) {\n\t\treturn function (word) {\n\t\t\treturn hash[word.toLowerCase()] !== undefined && hash.hasOwnProperty(word.toLowerCase());\n\t\t};\n\t} else {\n\t\treturn function (word) {\n\t\t\treturn hash[word] !== undefined && hash.hasOwnProperty(word);\n\t\t};\n\t}\n}\n\n\n// Lexer helpers\n\n/**\n * Compiles a regular expression string, adding the 'i' flag if 'ignoreCase' is set, and the 'u' flag if 'unicode' is set.\n * Also replaces @\\w+ or sequences with the content of the specified attribute\n * @\\w+ replacement can be avoided by escaping `@` signs with another `@` sign.\n * @example /@attr/ will be replaced with the value of lexer[attr]\n * @example /@@text/ will not be replaced and will become /@text/.\n */\nfunction compileRegExp<S extends true | false>(lexer: monarchCommon.ILexerMin, str: string, handleSn: S): S extends true ? RegExp | DynamicRegExp : RegExp;\nfunction compileRegExp(lexer: monarchCommon.ILexerMin, str: string, handleSn: true | false): RegExp | DynamicRegExp {\n\t// @@ must be interpreted as a literal @, so we replace all occurences of @@ with a placeholder character\n\tstr = str.replace(/@@/g, `\\x01`);\n\n\tlet n = 0;\n\tlet hadExpansion: boolean;\n\tdo {\n\t\thadExpansion = false;\n\t\tstr = str.replace(/@(\\w+)/g, function (s, attr?) {\n\t\t\thadExpansion = true;\n\t\t\tlet sub = '';\n\t\t\tif (typeof (lexer[attr]) === 'string') {\n\t\t\t\tsub = lexer[attr];\n\t\t\t} else if (lexer[attr] && lexer[attr] instanceof RegExp) {\n\t\t\t\tsub = lexer[attr].source;\n\t\t\t} else {\n\t\t\t\tif (lexer[attr] === undefined) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'language definition does not contain attribute \\'' + attr + '\\', used at: ' + str);\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'attribute reference \\'' + attr + '\\' must be a string, used at: ' + str);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn (monarchCommon.empty(sub) ? '' : '(?:' + sub + ')');\n\t\t});\n\t\tn++;\n\t} while (hadExpansion && n < 5);\n\n\t// handle escaped @@\n\tstr = str.replace(/\\x01/g, '@');\n\n\tconst flags = (lexer.ignoreCase ? 'i' : '') + (lexer.unicode ? 'u' : '');\n\n\t// handle $Sn\n\tif (handleSn) {\n\t\tconst match = str.match(/\\$[sS](\\d\\d?)/g);\n\t\tif (match) {\n\t\t\tlet lastState: string | null = null;\n\t\t\tlet lastRegEx: RegExp | null = null;\n\t\t\treturn (state: string) => {\n\t\t\t\tif (lastRegEx && lastState === state) {\n\t\t\t\t\treturn lastRegEx;\n\t\t\t\t}\n\t\t\t\tlastState = state;\n\t\t\t\tlastRegEx = new RegExp(monarchCommon.substituteMatchesRe(lexer, str, state), flags);\n\t\t\t\treturn lastRegEx;\n\t\t\t};\n\t\t}\n\t}\n\n\treturn new RegExp(str, flags);\n}\n\n/**\n * Compiles guard functions for case matches.\n * This compiles 'cases' attributes into efficient match functions.\n *\n */\nfunction selectScrutinee(id: string, matches: string[], state: string, num: number): string | null {\n\tif (num < 0) {\n\t\treturn id;\n\t}\n\tif (num < matches.length) {\n\t\treturn matches[num];\n\t}\n\tif (num >= 100) {\n\t\tnum = num - 100;\n\t\tconst parts = state.split('.');\n\t\tparts.unshift(state);\n\t\tif (num < parts.length) {\n\t\t\treturn parts[num];\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction createGuard(lexer: monarchCommon.ILexerMin, ruleName: string, tkey: string, val: monarchCommon.FuzzyAction): monarchCommon.IBranch {\n\t// get the scrutinee and pattern\n\tlet scrut = -1; // -1: $!, 0-99: $n, 100+n: $Sn\n\tlet oppat = tkey;\n\tlet matches = tkey.match(/^\\$(([sS]?)(\\d\\d?)|#)(.*)$/);\n\tif (matches) {\n\t\tif (matches[3]) { // if digits\n\t\t\tscrut = parseInt(matches[3]);\n\t\t\tif (matches[2]) {\n\t\t\t\tscrut = scrut + 100; // if [sS] present\n\t\t\t}\n\t\t}\n\t\toppat = matches[4];\n\t}\n\t// get operator\n\tlet op = '~';\n\tlet pat = oppat;\n\tif (!oppat || oppat.length === 0) {\n\t\top = '!=';\n\t\tpat = '';\n\t}\n\telse if (/^\\w*$/.test(pat)) { // just a word\n\t\top = '==';\n\t}\n\telse {\n\t\tmatches = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);\n\t\tif (matches) {\n\t\t\top = matches[1];\n\t\t\tpat = matches[2];\n\t\t}\n\t}\n\n\t// set the tester function\n\tlet tester: (s: string, id: string, matches: string[], state: string, eos: boolean) => boolean;\n\n\t// special case a regexp that matches just words\n\tif ((op === '~' || op === '!~') && /^(\\w|\\|)*$/.test(pat)) {\n\t\tconst inWords = createKeywordMatcher(pat.split('|'), lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '~' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '@' || op === '!@') {\n\t\tconst words = lexer[pat];\n\t\tif (!words) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' is not defined, in rule: ' + ruleName);\n\t\t}\n\t\tif (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the @ match target \\'' + pat + '\\' must be an array of strings, in rule: ' + ruleName);\n\t\t}\n\t\tconst inWords = createKeywordMatcher(words, lexer.ignoreCase);\n\t\ttester = function (s) { return (op === '@' ? inWords(s) : !inWords(s)); };\n\t}\n\telse if (op === '~' || op === '!~') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\t// precompile regular expression\n\t\t\tconst re = compileRegExp(lexer, '^' + pat + '$', false);\n\t\t\ttester = function (s) { return (op === '~' ? re.test(s) : !re.test(s)); };\n\t\t}\n\t\telse {\n\t\t\ttester = function (s, id, matches, state) {\n\t\t\t\tconst re = compileRegExp(lexer, '^' + monarchCommon.substituteMatches(lexer, pat, id, matches, state) + '$', false);\n\t\t\t\treturn re.test(s);\n\t\t\t};\n\t\t}\n\t}\n\telse { // if (op==='==' || op==='!=') {\n\t\tif (pat.indexOf('$') < 0) {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s) { return (op === '==' ? s === patx : s !== patx); };\n\t\t}\n\t\telse {\n\t\t\tconst patx = monarchCommon.fixCase(lexer, pat);\n\t\t\ttester = function (s, id, matches, state, eos) {\n\t\t\t\tconst patexp = monarchCommon.substituteMatches(lexer, patx, id, matches, state);\n\t\t\t\treturn (op === '==' ? s === patexp : s !== patexp);\n\t\t\t};\n\t\t}\n\t}\n\n\t// return the branch object\n\tif (scrut === -1) {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\treturn tester(id, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\treturn {\n\t\t\tname: tkey, value: val, test: function (id, matches, state, eos) {\n\t\t\t\tconst scrutinee = selectScrutinee(id, matches, state, scrut);\n\t\t\t\treturn tester(!scrutinee ? '' : scrutinee, id, matches, state, eos);\n\t\t\t}\n\t\t};\n\t}\n}\n\n/**\n * Compiles an action: i.e. optimize regular expressions and case matches\n * and do many sanity checks.\n *\n * This is called only during compilation but if the lexer definition\n * contains user functions as actions (which is usually not allowed), then this\n * may be called during lexing. It is important therefore to compile common cases efficiently\n */\nfunction compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: any): monarchCommon.FuzzyAction {\n\tif (!action) {\n\t\treturn { token: '' };\n\t}\n\telse if (typeof (action) === 'string') {\n\t\treturn action; // { token: action };\n\t}\n\telse if (action.token || action.token === '') {\n\t\tif (typeof (action.token) !== 'string') {\n\t\t\tthrow monarchCommon.createError(lexer, 'a \\'token\\' attribute must be of type string, in rule: ' + ruleName);\n\t\t}\n\t\telse {\n\t\t\t// only copy specific typed fields (only happens once during compile Lexer)\n\t\t\tconst newAction: monarchCommon.IAction = { token: action.token };\n\t\t\tif (action.token.indexOf('$') >= 0) {\n\t\t\t\tnewAction.tokenSubst = true;\n\t\t\t}\n\t\t\tif (typeof (action.bracket) === 'string') {\n\t\t\t\tif (action.bracket === '@open') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Open;\n\t\t\t\t} else if (action.bracket === '@close') {\n\t\t\t\t\tnewAction.bracket = monarchCommon.MonarchBracket.Close;\n\t\t\t\t} else {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a \\'bracket\\' attribute must be either \\'@open\\' or \\'@close\\', in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (action.next) {\n\t\t\t\tif (typeof (action.next) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state must be a string value in rule: ' + ruleName);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet next: string = action.next;\n\t\t\t\t\tif (!/^(@pop|@push|@popall)$/.test(next)) {\n\t\t\t\t\t\tif (next[0] === '@') {\n\t\t\t\t\t\t\tnext = next.substr(1); // peel off starting @ sign\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists\n\t\t\t\t\t\t\tif (!monarchCommon.stateExists(lexer, monarchCommon.substituteMatches(lexer, next, '', [], ''))) {\n\t\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'the next state \\'' + action.next + '\\' is not defined in rule: ' + ruleName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewAction.next = next;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof (action.goBack) === 'number') {\n\t\t\t\tnewAction.goBack = action.goBack;\n\t\t\t}\n\t\t\tif (typeof (action.switchTo) === 'string') {\n\t\t\t\tnewAction.switchTo = action.switchTo;\n\t\t\t}\n\t\t\tif (typeof (action.log) === 'string') {\n\t\t\t\tnewAction.log = action.log;\n\t\t\t}\n\t\t\tif (typeof (action.nextEmbedded) === 'string') {\n\t\t\t\tnewAction.nextEmbedded = action.nextEmbedded;\n\t\t\t\tlexer.usesEmbedded = true;\n\t\t\t}\n\t\t\treturn newAction;\n\t\t}\n\t}\n\telse if (Array.isArray(action)) {\n\t\tconst results: monarchCommon.FuzzyAction[] = [];\n\t\tfor (let i = 0, len = action.length; i < len; i++) {\n\t\t\tresults[i] = compileAction(lexer, ruleName, action[i]);\n\t\t}\n\t\treturn { group: results };\n\t}\n\telse if (action.cases) {\n\t\t// build an array of test cases\n\t\tconst cases: monarchCommon.IBranch[] = [];\n\n\t\tlet hasEmbeddedEndInCases = false;\n\t\t// for each case, push a test function and result value\n\t\tfor (const tkey in action.cases) {\n\t\t\tif (action.cases.hasOwnProperty(tkey)) {\n\t\t\t\tconst val = compileAction(lexer, ruleName, action.cases[tkey]);\n\n\t\t\t\t// what kind of case\n\t\t\t\tif (tkey === '@default' || tkey === '@' || tkey === '') {\n\t\t\t\t\tcases.push({ test: undefined, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse if (tkey === '@eos') {\n\t\t\t\t\tcases.push({ test: function (id, matches, state, eos) { return eos; }, value: val, name: tkey });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcases.push(createGuard(lexer, ruleName, tkey, val)); // call separate function to avoid local variable capture\n\t\t\t\t}\n\n\t\t\t\tif (!hasEmbeddedEndInCases) {\n\t\t\t\t\thasEmbeddedEndInCases = !isString(val) && (val.hasEmbeddedEndInCases || ['@pop', '@popall'].includes(val.nextEmbedded || ''));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// create a matching function\n\t\tconst def = lexer.defaultToken;\n\t\treturn {\n\t\t\thasEmbeddedEndInCases,\n\t\t\ttest: function (id, matches, state, eos) {\n\t\t\t\tfor (const _case of cases) {\n\t\t\t\t\tconst didmatch = (!_case.test || _case.test(id, matches, state, eos));\n\t\t\t\t\tif (didmatch) {\n\t\t\t\t\t\treturn _case.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn def;\n\t\t\t}\n\t\t};\n\t}\n\telse {\n\t\tthrow monarchCommon.createError(lexer, 'an action must be a string, an object with a \\'token\\' or \\'cases\\' attribute, or an array of actions; in rule: ' + ruleName);\n\t}\n}\n\ntype DynamicRegExp = (state: string) => RegExp;\n\n/**\n * Helper class for creating matching rules\n */\nclass Rule implements monarchCommon.IRule {\n\tprivate regex: RegExp | DynamicRegExp = new RegExp('');\n\tpublic action: monarchCommon.FuzzyAction = { token: '' };\n\tpublic matchOnlyAtLineStart: boolean = false;\n\tpublic name: string = '';\n\n\tconstructor(name: string) {\n\t\tthis.name = name;\n\t}\n\n\tpublic setRegex(lexer: monarchCommon.ILexerMin, re: string | RegExp): void {\n\t\tlet sregex: string;\n\t\tif (typeof (re) === 'string') {\n\t\t\tsregex = re;\n\t\t}\n\t\telse if (re instanceof RegExp) {\n\t\t\tsregex = (<RegExp>re).source;\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'rules must start with a match string or regular expression: ' + this.name);\n\t\t}\n\n\t\tthis.matchOnlyAtLineStart = (sregex.length > 0 && sregex[0] === '^');\n\t\tthis.name = this.name + ': ' + sregex;\n\t\tthis.regex = compileRegExp(lexer, '^(?:' + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ')', true);\n\t}\n\n\tpublic setAction(lexer: monarchCommon.ILexerMin, act: monarchCommon.IAction) {\n\t\tthis.action = compileAction(lexer, this.name, act);\n\t}\n\n\tpublic resolveRegex(state: string): RegExp {\n\t\tif (this.regex instanceof RegExp) {\n\t\t\treturn this.regex;\n\t\t} else {\n\t\t\treturn this.regex(state);\n\t\t}\n\t}\n}\n\n/**\n * Compiles a json description function into json where all regular expressions,\n * case matches etc, are compiled and all include rules are expanded.\n * We also compile the bracket definitions, supply defaults, and do many sanity checks.\n * If the 'jsonStrict' parameter is 'false', we allow at certain locations\n * regular expression objects and functions that get called during lexing.\n * (Currently we have no samples that need this so perhaps we should always have\n * jsonStrict to true).\n */\nexport function compile(languageId: string, json: IMonarchLanguage): monarchCommon.ILexer {\n\tif (!json || typeof (json) !== 'object') {\n\t\tthrow new Error('Monarch: expecting a language definition object');\n\t}\n\n\t// Create our lexer\n\tconst lexer: monarchCommon.ILexer = {\n\t\tlanguageId: languageId,\n\t\tincludeLF: bool(json.includeLF, false),\n\t\tnoThrow: false, // raise exceptions during compilation\n\t\tmaxStack: 100,\n\t\tstart: (typeof json.start === 'string' ? json.start : null),\n\t\tignoreCase: bool(json.ignoreCase, false),\n\t\tunicode: bool(json.unicode, false),\n\t\ttokenPostfix: string(json.tokenPostfix, '.' + languageId),\n\t\tdefaultToken: string(json.defaultToken, 'source'),\n\t\tusesEmbedded: false, // becomes true if we find a nextEmbedded action\n\t\tstateNames: {},\n\t\ttokenizer: {},\n\t\tbrackets: []\n\t};\n\n\t// For calling compileAction later on\n\t// eslint-disable-next-line local/code-no-any-casts\n\tconst lexerMin: monarchCommon.ILexerMin = <any>json;\n\tlexerMin.languageId = languageId;\n\tlexerMin.includeLF = lexer.includeLF;\n\tlexerMin.ignoreCase = lexer.ignoreCase;\n\tlexerMin.unicode = lexer.unicode;\n\tlexerMin.noThrow = lexer.noThrow;\n\tlexerMin.usesEmbedded = lexer.usesEmbedded;\n\tlexerMin.stateNames = json.tokenizer;\n\tlexerMin.defaultToken = lexer.defaultToken;\n\n\n\t// Compile an array of rules into newrules where RegExp objects are created.\n\tfunction addRules(state: string, newrules: monarchCommon.IRule[], rules: any[]) {\n\t\tfor (const rule of rules) {\n\n\t\t\tlet include = rule.include;\n\t\t\tif (include) {\n\t\t\t\tif (typeof (include) !== 'string') {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'an \\'include\\' attribute must be a string at: ' + state);\n\t\t\t\t}\n\t\t\t\tif (include[0] === '@') {\n\t\t\t\t\tinclude = include.substr(1); // peel off starting @\n\t\t\t\t}\n\t\t\t\tif (!json.tokenizer[include]) {\n\t\t\t\t\tthrow monarchCommon.createError(lexer, 'include target \\'' + include + '\\' is not defined at: ' + state);\n\t\t\t\t}\n\t\t\t\taddRules(state + '.' + include, newrules, json.tokenizer[include]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst newrule = new Rule(state);\n\n\t\t\t\t// Set up new rule attributes\n\t\t\t\tif (Array.isArray(rule) && rule.length >= 1 && rule.length <= 3) {\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule[0]);\n\t\t\t\t\tif (rule.length >= 3) {\n\t\t\t\t\t\tif (typeof (rule[1]) === 'string') {\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, { token: rule[1], next: rule[2] });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (typeof (rule[1]) === 'object') {\n\t\t\t\t\t\t\tconst rule1 = rule[1];\n\t\t\t\t\t\t\trule1.next = rule[2];\n\t\t\t\t\t\t\tnewrule.setAction(lexerMin, rule1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a next state as the last element of a rule can only be given if the action is either an object or a string, at: ' + state);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnewrule.setAction(lexerMin, rule[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!rule.regex) {\n\t\t\t\t\t\tthrow monarchCommon.createError(lexer, 'a rule must either be an array, or an object with a \\'regex\\' or \\'include\\' field at: ' + state);\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.name) {\n\t\t\t\t\t\tif (typeof rule.name === 'string') {\n\t\t\t\t\t\t\tnewrule.name = rule.name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (rule.matchOnlyAtStart) {\n\t\t\t\t\t\tnewrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart, false);\n\t\t\t\t\t}\n\t\t\t\t\tnewrule.setRegex(lexerMin, rule.regex);\n\t\t\t\t\tnewrule.setAction(lexerMin, rule.action);\n\t\t\t\t}\n\n\t\t\t\tnewrules.push(newrule);\n\t\t\t}\n\t\t}\n\t}\n\n\t// compile the tokenizer rules\n\tif (!json.tokenizer || typeof (json.tokenizer) !== 'object') {\n\t\tthrow monarchCommon.createError(lexer, 'a language definition must define the \\'tokenizer\\' attribute as an object');\n\t}\n\n\t// eslint-disable-next-line local/code-no-any-casts\n\tlexer.tokenizer = <any>[];\n\tfor (const key in json.tokenizer) {\n\t\tif (json.tokenizer.hasOwnProperty(key)) {\n\t\t\tif (!lexer.start) {\n\t\t\t\tlexer.start = key;\n\t\t\t}\n\n\t\t\tconst rules = json.tokenizer[key];\n\t\t\tlexer.tokenizer[key] = new Array();\n\t\t\taddRules('tokenizer.' + key, lexer.tokenizer[key], rules);\n\t\t}\n\t}\n\tlexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction\n\n\t// Set simple brackets\n\tif (json.brackets) {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(Array.isArray(<any>json.brackets))) {\n\t\t\tthrow monarchCommon.createError(lexer, 'the \\'brackets\\' attribute must be defined as an array');\n\t\t}\n\t}\n\telse {\n\t\tjson.brackets = [\n\t\t\t{ open: '{', close: '}', token: 'delimiter.curly' },\n\t\t\t{ open: '[', close: ']', token: 'delimiter.square' },\n\t\t\t{ open: '(', close: ')', token: 'delimiter.parenthesis' },\n\t\t\t{ open: '<', close: '>', token: 'delimiter.angle' }];\n\t}\n\tconst brackets: IMonarchLanguageBracket[] = [];\n\tfor (const el of json.brackets) {\n\t\tlet desc: any = el;\n\t\tif (desc && Array.isArray(desc) && desc.length === 3) {\n\t\t\tdesc = { token: desc[2], open: desc[0], close: desc[1] };\n\t\t}\n\t\tif (desc.open === desc.close) {\n\t\t\tthrow monarchCommon.createError(lexer, 'open and close brackets in a \\'brackets\\' attribute must be different: ' + desc.open +\n\t\t\t\t'\\n hint: use the \\'bracket\\' attribute if matching on equal brackets is required.');\n\t\t}\n\t\tif (typeof desc.open === 'string' && typeof desc.token === 'string' && typeof desc.close === 'string') {\n\t\t\tbrackets.push({\n\t\t\t\ttoken: desc.token + lexer.tokenPostfix,\n\t\t\t\topen: monarchCommon.fixCase(lexer, desc.open),\n\t\t\t\tclose: monarchCommon.fixCase(lexer, desc.close)\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthrow monarchCommon.createError(lexer, 'every element in the \\'brackets\\' array must be a \\'{open,close,token}\\' object or array');\n\t\t}\n\t}\n\tlexer.brackets = brackets;\n\n\t// Disable throw so the syntax highlighter goes, no matter what\n\tlexer.noThrow = true;\n\treturn lexer;\n}\n"]}
|
|
@@ -59,8 +59,8 @@ let AccessibilityService = class AccessibilityService extends Disposable {
|
|
|
59
59
|
}));
|
|
60
60
|
const updateRootClasses = () => {
|
|
61
61
|
const reduce = this.isMotionReduced();
|
|
62
|
-
this._layoutService.mainContainer.classList.toggle('reduce-motion', reduce);
|
|
63
|
-
this._layoutService.mainContainer.classList.toggle('enable-motion', !reduce);
|
|
62
|
+
this._layoutService.mainContainer.classList.toggle('monaco-reduce-motion', reduce);
|
|
63
|
+
this._layoutService.mainContainer.classList.toggle('monaco-enable-motion', !reduce);
|
|
64
64
|
};
|
|
65
65
|
updateRootClasses();
|
|
66
66
|
this._register(this.onDidChangeReducedMotion(() => updateRootClasses()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/platform/accessibility/browser/accessibilityService.ts","vs/platform/accessibility/browser/accessibilityService.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAS,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAwB,kCAAkC,EAAyB,MAAM,4BAA4B,CAAC;AAC7H,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAe,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACxF,O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O,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;IAC7C,CAAC;IAED,eAAe;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACzC,OAAO,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC5E,CAAC;IAED,uBAAuB;QACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,CAAC;CACD,CAAA;AA7GY,oBAAoB;IAe9B,WAAA,kBAAkB,CAAA;IAClB,WAAA,cAAc,CAAA;IACd,WAAA,qBAAqB,CAAA;GAjBX,oBAAoB,CA6GhC","file":"accessibilityService.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\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\nimport { addDisposableListener } from '../../../base/browser/dom.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { AccessibilitySupport, CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from '../common/accessibility.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IContextKey, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { ILayoutService } from '../../layout/browser/layoutService.js';\n\nexport class AccessibilityService extends Disposable implements IAccessibilityService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _accessibilityModeEnabledContext: IContextKey<boolean>;\n\tprotected _accessibilitySupport = AccessibilitySupport.Unknown;\n\tprotected readonly _onDidChangeScreenReaderOptimized = new Emitter<void>();\n\n\tprotected _configMotionReduced: 'auto' | 'on' | 'off';\n\tprotected _systemMotionReduced: boolean;\n\tprotected readonly _onDidChangeReducedMotion = new Emitter<void>();\n\n\tprivate _linkUnderlinesEnabled: boolean;\n\tprotected readonly _onDidChangeLinkUnderline = new Emitter<void>();\n\n\tconstructor(\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@ILayoutService private readonly _layoutService: ILayoutService,\n\t\t@IConfigurationService protected readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis._accessibilityModeEnabledContext = CONTEXT_ACCESSIBILITY_MODE_ENABLED.bindTo(this._contextKeyService);\n\n\t\tconst updateContextKey = () => this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('editor.accessibilitySupport')) {\n\t\t\t\tupdateContextKey();\n\t\t\t\tthis._onDidChangeScreenReaderOptimized.fire();\n\t\t\t}\n\t\t\tif (e.affectsConfiguration('workbench.reduceMotion')) {\n\t\t\t\tthis._configMotionReduced = this._configurationService.getValue('workbench.reduceMotion');\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\t\tupdateContextKey();\n\t\tthis._register(this.onDidChangeScreenReaderOptimized(() => updateContextKey()));\n\n\t\tconst reduceMotionMatcher = mainWindow.matchMedia(`(prefers-reduced-motion: reduce)`);\n\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\tthis._configMotionReduced = this._configurationService.getValue<'auto' | 'on' | 'off'>('workbench.reduceMotion');\n\n\t\tthis._linkUnderlinesEnabled = this._configurationService.getValue('accessibility.underlineLinks');\n\n\t\tthis.initReducedMotionListeners(reduceMotionMatcher);\n\t\tthis.initLinkUnderlineListeners();\n\t}\n\n\tprivate initReducedMotionListeners(reduceMotionMatcher: MediaQueryList) {\n\n\t\tthis._register(addDisposableListener(reduceMotionMatcher, 'change', () => {\n\t\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\t\tif (this._configMotionReduced === 'auto') {\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateRootClasses = () => {\n\t\t\tconst reduce = this.isMotionReduced();\n\t\t\tthis._layoutService.mainContainer.classList.toggle('reduce-motion', reduce);\n\t\t\tthis._layoutService.mainContainer.classList.toggle('enable-motion', !reduce);\n\t\t};\n\n\t\tupdateRootClasses();\n\t\tthis._register(this.onDidChangeReducedMotion(() => updateRootClasses()));\n\t}\n\n\tprivate initLinkUnderlineListeners() {\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('accessibility.underlineLinks')) {\n\t\t\t\tconst linkUnderlinesEnabled = this._configurationService.getValue<boolean>('accessibility.underlineLinks');\n\t\t\t\tthis._linkUnderlinesEnabled = linkUnderlinesEnabled;\n\t\t\t\tthis._onDidChangeLinkUnderline.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateLinkUnderlineClasses = () => {\n\t\t\tconst underlineLinks = this._linkUnderlinesEnabled;\n\t\t\tthis._layoutService.mainContainer.classList.toggle('underline-links', underlineLinks);\n\t\t};\n\n\t\tupdateLinkUnderlineClasses();\n\n\t\tthis._register(this.onDidChangeLinkUnderlines(() => updateLinkUnderlineClasses()));\n\t}\n\n\tpublic onDidChangeLinkUnderlines(listener: () => void) {\n\t\treturn this._onDidChangeLinkUnderline.event(listener);\n\t}\n\n\tget onDidChangeScreenReaderOptimized(): Event<void> {\n\t\treturn this._onDidChangeScreenReaderOptimized.event;\n\t}\n\n\tisScreenReaderOptimized(): boolean {\n\t\tconst config = this._configurationService.getValue('editor.accessibilitySupport');\n\t\treturn config === 'on' || (config === 'auto' && this._accessibilitySupport === AccessibilitySupport.Enabled);\n\t}\n\n\tget onDidChangeReducedMotion(): Event<void> {\n\t\treturn this._onDidChangeReducedMotion.event;\n\t}\n\n\tisMotionReduced(): boolean {\n\t\tconst config = this._configMotionReduced;\n\t\treturn config === 'on' || (config === 'auto' && this._systemMotionReduced);\n\t}\n\n\tgetAccessibilitySupport(): AccessibilitySupport {\n\t\treturn this._accessibilitySupport;\n\t}\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\nimport { addDisposableListener } from '../../../base/browser/dom.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { AccessibilitySupport, CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from '../common/accessibility.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IContextKey, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { ILayoutService } from '../../layout/browser/layoutService.js';\n\nexport class AccessibilityService extends Disposable implements IAccessibilityService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _accessibilityModeEnabledContext: IContextKey<boolean>;\n\tprotected _accessibilitySupport = AccessibilitySupport.Unknown;\n\tprotected readonly _onDidChangeScreenReaderOptimized = new Emitter<void>();\n\n\tprotected _configMotionReduced: 'auto' | 'on' | 'off';\n\tprotected _systemMotionReduced: boolean;\n\tprotected readonly _onDidChangeReducedMotion = new Emitter<void>();\n\n\tprivate _linkUnderlinesEnabled: boolean;\n\tprotected readonly _onDidChangeLinkUnderline = new Emitter<void>();\n\n\tconstructor(\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@ILayoutService private readonly _layoutService: ILayoutService,\n\t\t@IConfigurationService protected readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis._accessibilityModeEnabledContext = CONTEXT_ACCESSIBILITY_MODE_ENABLED.bindTo(this._contextKeyService);\n\n\t\tconst updateContextKey = () => this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('editor.accessibilitySupport')) {\n\t\t\t\tupdateContextKey();\n\t\t\t\tthis._onDidChangeScreenReaderOptimized.fire();\n\t\t\t}\n\t\t\tif (e.affectsConfiguration('workbench.reduceMotion')) {\n\t\t\t\tthis._configMotionReduced = this._configurationService.getValue('workbench.reduceMotion');\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\t\tupdateContextKey();\n\t\tthis._register(this.onDidChangeScreenReaderOptimized(() => updateContextKey()));\n\n\t\tconst reduceMotionMatcher = mainWindow.matchMedia(`(prefers-reduced-motion: reduce)`);\n\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\tthis._configMotionReduced = this._configurationService.getValue<'auto' | 'on' | 'off'>('workbench.reduceMotion');\n\n\t\tthis._linkUnderlinesEnabled = this._configurationService.getValue('accessibility.underlineLinks');\n\n\t\tthis.initReducedMotionListeners(reduceMotionMatcher);\n\t\tthis.initLinkUnderlineListeners();\n\t}\n\n\tprivate initReducedMotionListeners(reduceMotionMatcher: MediaQueryList) {\n\n\t\tthis._register(addDisposableListener(reduceMotionMatcher, 'change', () => {\n\t\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\t\tif (this._configMotionReduced === 'auto') {\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateRootClasses = () => {\n\t\t\tconst reduce = this.isMotionReduced();\n\t\t\tthis._layoutService.mainContainer.classList.toggle('reduce-motion', reduce);\n\t\t\tthis._layoutService.mainContainer.classList.toggle('enable-motion', !reduce);\n\t\t};\n\n\t\tupdateRootClasses();\n\t\tthis._register(this.onDidChangeReducedMotion(() => updateRootClasses()));\n\t}\n\n\tprivate initLinkUnderlineListeners() {\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('accessibility.underlineLinks')) {\n\t\t\t\tconst linkUnderlinesEnabled = this._configurationService.getValue<boolean>('accessibility.underlineLinks');\n\t\t\t\tthis._linkUnderlinesEnabled = linkUnderlinesEnabled;\n\t\t\t\tthis._onDidChangeLinkUnderline.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateLinkUnderlineClasses = () => {\n\t\t\tconst underlineLinks = this._linkUnderlinesEnabled;\n\t\t\tthis._layoutService.mainContainer.classList.toggle('underline-links', underlineLinks);\n\t\t};\n\n\t\tupdateLinkUnderlineClasses();\n\n\t\tthis._register(this.onDidChangeLinkUnderlines(() => updateLinkUnderlineClasses()));\n\t}\n\n\tpublic onDidChangeLinkUnderlines(listener: () => void) {\n\t\treturn this._onDidChangeLinkUnderline.event(listener);\n\t}\n\n\tget onDidChangeScreenReaderOptimized(): Event<void> {\n\t\treturn this._onDidChangeScreenReaderOptimized.event;\n\t}\n\n\tisScreenReaderOptimized(): boolean {\n\t\tconst config = this._configurationService.getValue('editor.accessibilitySupport');\n\t\treturn config === 'on' || (config === 'auto' && this._accessibilitySupport === AccessibilitySupport.Enabled);\n\t}\n\n\tget onDidChangeReducedMotion(): Event<void> {\n\t\treturn this._onDidChangeReducedMotion.event;\n\t}\n\n\tisMotionReduced(): boolean {\n\t\tconst config = this._configMotionReduced;\n\t\treturn config === 'on' || (config === 'auto' && this._systemMotionReduced);\n\t}\n\n\tgetAccessibilitySupport(): AccessibilitySupport {\n\t\treturn this._accessibilitySupport;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/platform/accessibility/browser/accessibilityService.ts","vs/platform/accessibility/browser/accessibilityService.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAS,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAwB,kCAAkC,EAAyB,MAAM,4BAA4B,CAAC;AAC7H,OAAO,EAA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AK,MAAM,IAAI,IAAI,CAAC,qBAAqB,yCAAiC,CAAC,CAAC;IAC9G,CAAC;IAED,IAAI,wBAAwB;QAC3B,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;IAC7C,CAAC;IAED,eAAe;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACzC,OAAO,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC5E,CAAC;IAED,uBAAuB;QACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,CAAC;CACD,CAAA;AA7GY,oBAAoB;IAe9B,WAAA,kBAAkB,CAAA;IAClB,WAAA,cAAc,CAAA;IACd,WAAA,qBAAqB,CAAA;GAjBX,oBAAoB,CA6GhC","file":"accessibilityService.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\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\nimport { addDisposableListener } from '../../../base/browser/dom.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { AccessibilitySupport, CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from '../common/accessibility.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IContextKey, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { ILayoutService } from '../../layout/browser/layoutService.js';\n\nexport class AccessibilityService extends Disposable implements IAccessibilityService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _accessibilityModeEnabledContext: IContextKey<boolean>;\n\tprotected _accessibilitySupport = AccessibilitySupport.Unknown;\n\tprotected readonly _onDidChangeScreenReaderOptimized = new Emitter<void>();\n\n\tprotected _configMotionReduced: 'auto' | 'on' | 'off';\n\tprotected _systemMotionReduced: boolean;\n\tprotected readonly _onDidChangeReducedMotion = new Emitter<void>();\n\n\tprivate _linkUnderlinesEnabled: boolean;\n\tprotected readonly _onDidChangeLinkUnderline = new Emitter<void>();\n\n\tconstructor(\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@ILayoutService private readonly _layoutService: ILayoutService,\n\t\t@IConfigurationService protected readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis._accessibilityModeEnabledContext = CONTEXT_ACCESSIBILITY_MODE_ENABLED.bindTo(this._contextKeyService);\n\n\t\tconst updateContextKey = () => this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('editor.accessibilitySupport')) {\n\t\t\t\tupdateContextKey();\n\t\t\t\tthis._onDidChangeScreenReaderOptimized.fire();\n\t\t\t}\n\t\t\tif (e.affectsConfiguration('workbench.reduceMotion')) {\n\t\t\t\tthis._configMotionReduced = this._configurationService.getValue('workbench.reduceMotion');\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\t\tupdateContextKey();\n\t\tthis._register(this.onDidChangeScreenReaderOptimized(() => updateContextKey()));\n\n\t\tconst reduceMotionMatcher = mainWindow.matchMedia(`(prefers-reduced-motion: reduce)`);\n\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\tthis._configMotionReduced = this._configurationService.getValue<'auto' | 'on' | 'off'>('workbench.reduceMotion');\n\n\t\tthis._linkUnderlinesEnabled = this._configurationService.getValue('accessibility.underlineLinks');\n\n\t\tthis.initReducedMotionListeners(reduceMotionMatcher);\n\t\tthis.initLinkUnderlineListeners();\n\t}\n\n\tprivate initReducedMotionListeners(reduceMotionMatcher: MediaQueryList) {\n\n\t\tthis._register(addDisposableListener(reduceMotionMatcher, 'change', () => {\n\t\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\t\tif (this._configMotionReduced === 'auto') {\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateRootClasses = () => {\n\t\t\tconst reduce = this.isMotionReduced();\n\t\t\tthis._layoutService.mainContainer.classList.toggle('monaco-reduce-motion', reduce);\n\t\t\tthis._layoutService.mainContainer.classList.toggle('monaco-enable-motion', !reduce);\n\t\t};\n\n\t\tupdateRootClasses();\n\t\tthis._register(this.onDidChangeReducedMotion(() => updateRootClasses()));\n\t}\n\n\tprivate initLinkUnderlineListeners() {\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('accessibility.underlineLinks')) {\n\t\t\t\tconst linkUnderlinesEnabled = this._configurationService.getValue<boolean>('accessibility.underlineLinks');\n\t\t\t\tthis._linkUnderlinesEnabled = linkUnderlinesEnabled;\n\t\t\t\tthis._onDidChangeLinkUnderline.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateLinkUnderlineClasses = () => {\n\t\t\tconst underlineLinks = this._linkUnderlinesEnabled;\n\t\t\tthis._layoutService.mainContainer.classList.toggle('underline-links', underlineLinks);\n\t\t};\n\n\t\tupdateLinkUnderlineClasses();\n\n\t\tthis._register(this.onDidChangeLinkUnderlines(() => updateLinkUnderlineClasses()));\n\t}\n\n\tpublic onDidChangeLinkUnderlines(listener: () => void) {\n\t\treturn this._onDidChangeLinkUnderline.event(listener);\n\t}\n\n\tget onDidChangeScreenReaderOptimized(): Event<void> {\n\t\treturn this._onDidChangeScreenReaderOptimized.event;\n\t}\n\n\tisScreenReaderOptimized(): boolean {\n\t\tconst config = this._configurationService.getValue('editor.accessibilitySupport');\n\t\treturn config === 'on' || (config === 'auto' && this._accessibilitySupport === AccessibilitySupport.Enabled);\n\t}\n\n\tget onDidChangeReducedMotion(): Event<void> {\n\t\treturn this._onDidChangeReducedMotion.event;\n\t}\n\n\tisMotionReduced(): boolean {\n\t\tconst config = this._configMotionReduced;\n\t\treturn config === 'on' || (config === 'auto' && this._systemMotionReduced);\n\t}\n\n\tgetAccessibilitySupport(): AccessibilitySupport {\n\t\treturn this._accessibilitySupport;\n\t}\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\nimport { addDisposableListener } from '../../../base/browser/dom.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { Disposable } from '../../../base/common/lifecycle.js';\nimport { AccessibilitySupport, CONTEXT_ACCESSIBILITY_MODE_ENABLED, IAccessibilityService } from '../common/accessibility.js';\nimport { IConfigurationService } from '../../configuration/common/configuration.js';\nimport { IContextKey, IContextKeyService } from '../../contextkey/common/contextkey.js';\nimport { ILayoutService } from '../../layout/browser/layoutService.js';\n\nexport class AccessibilityService extends Disposable implements IAccessibilityService {\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate _accessibilityModeEnabledContext: IContextKey<boolean>;\n\tprotected _accessibilitySupport = AccessibilitySupport.Unknown;\n\tprotected readonly _onDidChangeScreenReaderOptimized = new Emitter<void>();\n\n\tprotected _configMotionReduced: 'auto' | 'on' | 'off';\n\tprotected _systemMotionReduced: boolean;\n\tprotected readonly _onDidChangeReducedMotion = new Emitter<void>();\n\n\tprivate _linkUnderlinesEnabled: boolean;\n\tprotected readonly _onDidChangeLinkUnderline = new Emitter<void>();\n\n\tconstructor(\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@ILayoutService private readonly _layoutService: ILayoutService,\n\t\t@IConfigurationService protected readonly _configurationService: IConfigurationService\n\t) {\n\t\tsuper();\n\t\tthis._accessibilityModeEnabledContext = CONTEXT_ACCESSIBILITY_MODE_ENABLED.bindTo(this._contextKeyService);\n\n\t\tconst updateContextKey = () => this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('editor.accessibilitySupport')) {\n\t\t\t\tupdateContextKey();\n\t\t\t\tthis._onDidChangeScreenReaderOptimized.fire();\n\t\t\t}\n\t\t\tif (e.affectsConfiguration('workbench.reduceMotion')) {\n\t\t\t\tthis._configMotionReduced = this._configurationService.getValue('workbench.reduceMotion');\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\t\tupdateContextKey();\n\t\tthis._register(this.onDidChangeScreenReaderOptimized(() => updateContextKey()));\n\n\t\tconst reduceMotionMatcher = mainWindow.matchMedia(`(prefers-reduced-motion: reduce)`);\n\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\tthis._configMotionReduced = this._configurationService.getValue<'auto' | 'on' | 'off'>('workbench.reduceMotion');\n\n\t\tthis._linkUnderlinesEnabled = this._configurationService.getValue('accessibility.underlineLinks');\n\n\t\tthis.initReducedMotionListeners(reduceMotionMatcher);\n\t\tthis.initLinkUnderlineListeners();\n\t}\n\n\tprivate initReducedMotionListeners(reduceMotionMatcher: MediaQueryList) {\n\n\t\tthis._register(addDisposableListener(reduceMotionMatcher, 'change', () => {\n\t\t\tthis._systemMotionReduced = reduceMotionMatcher.matches;\n\t\t\tif (this._configMotionReduced === 'auto') {\n\t\t\t\tthis._onDidChangeReducedMotion.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateRootClasses = () => {\n\t\t\tconst reduce = this.isMotionReduced();\n\t\t\tthis._layoutService.mainContainer.classList.toggle('monaco-reduce-motion', reduce);\n\t\t\tthis._layoutService.mainContainer.classList.toggle('monaco-enable-motion', !reduce);\n\t\t};\n\n\t\tupdateRootClasses();\n\t\tthis._register(this.onDidChangeReducedMotion(() => updateRootClasses()));\n\t}\n\n\tprivate initLinkUnderlineListeners() {\n\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\tif (e.affectsConfiguration('accessibility.underlineLinks')) {\n\t\t\t\tconst linkUnderlinesEnabled = this._configurationService.getValue<boolean>('accessibility.underlineLinks');\n\t\t\t\tthis._linkUnderlinesEnabled = linkUnderlinesEnabled;\n\t\t\t\tthis._onDidChangeLinkUnderline.fire();\n\t\t\t}\n\t\t}));\n\n\t\tconst updateLinkUnderlineClasses = () => {\n\t\t\tconst underlineLinks = this._linkUnderlinesEnabled;\n\t\t\tthis._layoutService.mainContainer.classList.toggle('underline-links', underlineLinks);\n\t\t};\n\n\t\tupdateLinkUnderlineClasses();\n\n\t\tthis._register(this.onDidChangeLinkUnderlines(() => updateLinkUnderlineClasses()));\n\t}\n\n\tpublic onDidChangeLinkUnderlines(listener: () => void) {\n\t\treturn this._onDidChangeLinkUnderline.event(listener);\n\t}\n\n\tget onDidChangeScreenReaderOptimized(): Event<void> {\n\t\treturn this._onDidChangeScreenReaderOptimized.event;\n\t}\n\n\tisScreenReaderOptimized(): boolean {\n\t\tconst config = this._configurationService.getValue('editor.accessibilitySupport');\n\t\treturn config === 'on' || (config === 'auto' && this._accessibilitySupport === AccessibilitySupport.Enabled);\n\t}\n\n\tget onDidChangeReducedMotion(): Event<void> {\n\t\treturn this._onDidChangeReducedMotion.event;\n\t}\n\n\tisMotionReduced(): boolean {\n\t\tconst config = this._configMotionReduced;\n\t\treturn config === 'on' || (config === 'auto' && this._systemMotionReduced);\n\t}\n\n\tgetAccessibilitySupport(): AccessibilitySupport {\n\t\treturn this._accessibilitySupport;\n\t}\n}\n"]}
|