chrome-devtools-frontend 1.0.1669021 → 1.0.1672388
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/.agents/skills/fixing-skipped-tests/SKILL.md +6 -6
- package/.agents/skills/gerrit-cli/SKILL.md +4 -10
- package/.agents/skills/gerrit-cli/references/commands.md +45 -2
- package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
- package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
- package/config/typescript/tsconfig.eslint.json +1 -1
- package/docs/contributing/settings-experiments-features.md +2 -8
- package/docs/ecosystem/automatic_workspace_folders.md +0 -19
- package/eslint.config.mjs +2 -2
- package/front_end/core/common/Lazy.ts +3 -3
- package/front_end/core/common/SettingRegistration.ts +0 -7
- package/front_end/core/common/Settings.ts +0 -38
- package/front_end/core/host/UserMetrics.ts +187 -953
- package/front_end/core/host/UserMetricsEnums.d.ts +949 -0
- package/front_end/core/root/Runtime.ts +21 -133
- package/front_end/core/sdk/CSSMetadata.ts +70 -65
- package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
- package/front_end/core/sdk/ChildTargetManager.ts +0 -2
- package/front_end/core/sdk/EmulationModel.ts +0 -2
- package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
- package/front_end/core/sdk/NetworkManager.ts +0 -3
- package/front_end/core/sdk/PageResourceLoader.ts +9 -9
- package/front_end/core/sdk/RehydratingConnection.ts +52 -4
- package/front_end/core/sdk/Target.ts +0 -4
- package/front_end/devtools_compatibility.js +886 -0
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +18 -22
- package/front_end/foundation/Universe.ts +7 -2
- package/front_end/generated/InspectorBackendCommands.ts +3 -10
- package/front_end/generated/protocol-mapping.d.ts +0 -42
- package/front_end/generated/protocol-proxy-api.d.ts +0 -38
- package/front_end/generated/protocol.ts +9 -169
- package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
- package/front_end/models/ai_assistance/AiSetting.ts +108 -0
- package/front_end/models/ai_assistance/AiUtils.ts +47 -0
- package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
- package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
- package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
- package/front_end/models/ai_assistance/injected.ts +1 -0
- package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/performance.md +10 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
- package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
- package/front_end/models/ai_assistance/tools/README.md +1 -1
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
- package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
- package/front_end/models/badges/UserBadges.ts +2 -0
- package/front_end/models/bindings/NetworkProject.ts +5 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
- package/front_end/models/bindings/ResourceUtils.ts +3 -0
- package/front_end/models/crux-manager/CrUXManager.ts +1 -0
- package/front_end/models/emulation/DeviceModeModel.ts +140 -7
- package/front_end/models/emulation/EmulatedDevices.ts +246 -793
- package/front_end/models/issues_manager/IssuesManager.ts +10 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
- package/front_end/models/logs/LogManager.ts +8 -5
- package/front_end/models/logs/NetworkLog.ts +1 -0
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
- package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
- package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
- package/front_end/models/workspace/IgnoreListManager.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +2 -0
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
- package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
- package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
- package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
- package/front_end/panels/application/application.ts +0 -10
- package/front_end/panels/application/components/components.ts +0 -4
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
- package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
- package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
- package/front_end/panels/console/ConsoleFormat.ts +2 -62
- package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
- package/front_end/panels/emulation/AdvancedApp.ts +1 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
- package/front_end/panels/emulation/DeviceModeView.ts +4 -134
- package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
- package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
- package/front_end/panels/emulation/emulation-meta.ts +12 -12
- package/front_end/panels/issues/IssuesPane.ts +3 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
- package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +11 -11
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
- package/front_end/panels/network/RequestHeadersView.ts +1 -1
- package/front_end/panels/network/ResourceChunkView.ts +243 -144
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
- package/front_end/panels/network/resourceChunkView.css +41 -36
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
- package/front_end/panels/profiler/profiler.ts +4 -0
- package/front_end/panels/recorder/RecorderPanel.ts +6 -14
- package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
- package/front_end/panels/settings/AISettingsTab.ts +75 -31
- package/front_end/panels/settings/SettingsScreen.ts +8 -13
- package/front_end/panels/settings/components/SyncSection.ts +3 -4
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +200 -18
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
- package/front_end/panels/settings/settings-meta.ts +0 -1
- package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
- package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
- package/front_end/panels/sources/SourcesPanel.ts +19 -17
- package/front_end/panels/sources/SourcesView.ts +191 -96
- package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
- package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
- package/front_end/panels/timeline/timeline-meta.ts +3 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
- package/front_end/tsconfig.compatibility.json +2 -1
- package/front_end/tsconfig.json +1 -1
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
- package/front_end/ui/components/settings/settings.ts +1 -2
- package/front_end/ui/legacy/Treeoutline.ts +52 -30
- package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
- package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
- package/front_end/ui/visual_logging/KnownContextValues.ts +21 -0
- package/inspector_overlay/tsconfig.json +8 -2
- package/package.json +3 -2
- package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
- package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
- package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
- package/front_end/foundation/Universe.test.api.ts +0 -73
- package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
- package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
- package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
- package/front_end/panels/application/SharedStorageModel.ts +0 -249
- package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
- package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
- package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
- package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
- package/front_end/panels/application/sharedStorageEventsView.css +0 -9
- package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
- package/front_end/panels/network/originalResourceChunkView.css +0 -49
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
- package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
The [`TreeFragment.applyChanges`](#common.TreeFragment^applyChanges)
|
|
3
3
|
method expects changed ranges in this format.
|
|
4
4
|
*/
|
|
5
|
-
interface ChangedRange {
|
|
5
|
+
interface ChangedRange$1 {
|
|
6
6
|
/**
|
|
7
7
|
The start of the change in the start document
|
|
8
8
|
*/
|
|
@@ -29,7 +29,7 @@ parses. Use the static
|
|
|
29
29
|
[`applyChanges`](#common.TreeFragment^applyChanges) method to
|
|
30
30
|
update fragments for document changes.
|
|
31
31
|
*/
|
|
32
|
-
declare class TreeFragment {
|
|
32
|
+
declare class TreeFragment$1 {
|
|
33
33
|
/**
|
|
34
34
|
The start of the unchanged range pointed to by this fragment.
|
|
35
35
|
This refers to an offset in the _updated_ document (as opposed
|
|
@@ -43,7 +43,7 @@ declare class TreeFragment {
|
|
|
43
43
|
/**
|
|
44
44
|
The tree that this fragment is based on.
|
|
45
45
|
*/
|
|
46
|
-
readonly tree: Tree;
|
|
46
|
+
readonly tree: Tree$1;
|
|
47
47
|
/**
|
|
48
48
|
The offset between the fragment's tree and the document that
|
|
49
49
|
this fragment can be used against. Add this when going from
|
|
@@ -71,7 +71,7 @@ declare class TreeFragment {
|
|
|
71
71
|
/**
|
|
72
72
|
The tree that this fragment is based on.
|
|
73
73
|
*/
|
|
74
|
-
tree: Tree,
|
|
74
|
+
tree: Tree$1,
|
|
75
75
|
/**
|
|
76
76
|
The offset between the fragment's tree and the document that
|
|
77
77
|
this fragment can be used against. Add this when going from
|
|
@@ -99,24 +99,24 @@ declare class TreeFragment {
|
|
|
99
99
|
fragment has [`openEnd`](#common.TreeFragment.openEnd) set to
|
|
100
100
|
true.
|
|
101
101
|
*/
|
|
102
|
-
static addTree(tree: Tree, fragments?: readonly TreeFragment[], partial?: boolean): readonly TreeFragment[];
|
|
102
|
+
static addTree(tree: Tree$1, fragments?: readonly TreeFragment$1[], partial?: boolean): readonly TreeFragment$1[];
|
|
103
103
|
/**
|
|
104
104
|
Apply a set of edits to an array of fragments, removing or
|
|
105
105
|
splitting fragments as necessary to remove edited ranges, and
|
|
106
106
|
adjusting offsets for fragments that moved.
|
|
107
107
|
*/
|
|
108
|
-
static applyChanges(fragments: readonly TreeFragment[], changes: readonly ChangedRange[], minGap?: number): readonly TreeFragment[];
|
|
108
|
+
static applyChanges(fragments: readonly TreeFragment$1[], changes: readonly ChangedRange$1[], minGap?: number): readonly TreeFragment$1[];
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
Interface used to represent an in-progress parse, which can be
|
|
112
112
|
moved forward piece-by-piece.
|
|
113
113
|
*/
|
|
114
|
-
interface PartialParse {
|
|
114
|
+
interface PartialParse$1 {
|
|
115
115
|
/**
|
|
116
116
|
Advance the parse state by some amount. Will return the finished
|
|
117
117
|
syntax tree when the parse completes.
|
|
118
118
|
*/
|
|
119
|
-
advance(): Tree | null;
|
|
119
|
+
advance(): Tree$1 | null;
|
|
120
120
|
/**
|
|
121
121
|
The position up to which the document has been parsed. Note
|
|
122
122
|
that, in multi-pass parsers, this will stay back until the last
|
|
@@ -141,16 +141,16 @@ interface PartialParse {
|
|
|
141
141
|
/**
|
|
142
142
|
A superclass that parsers should extend.
|
|
143
143
|
*/
|
|
144
|
-
declare abstract class Parser {
|
|
144
|
+
declare abstract class Parser$1 {
|
|
145
145
|
/**
|
|
146
146
|
Start a parse for a single tree. This is the method concrete
|
|
147
147
|
parser implementations must implement. Called by `startParse`,
|
|
148
148
|
with the optional arguments resolved.
|
|
149
149
|
*/
|
|
150
|
-
abstract createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
|
|
150
|
+
abstract createParse(input: Input$1, fragments: readonly TreeFragment$1[], ranges: readonly {
|
|
151
151
|
from: number;
|
|
152
152
|
to: number;
|
|
153
|
-
}[]): PartialParse;
|
|
153
|
+
}[]): PartialParse$1;
|
|
154
154
|
/**
|
|
155
155
|
Start a parse, returning a [partial parse](#common.PartialParse)
|
|
156
156
|
object. [`fragments`](#common.TreeFragment) can be passed in to
|
|
@@ -161,24 +161,24 @@ declare abstract class Parser {
|
|
|
161
161
|
ranges, to parse only those ranges. The tree returned in that
|
|
162
162
|
case will start at `ranges[0].from`.
|
|
163
163
|
*/
|
|
164
|
-
startParse(input: Input | string, fragments?: readonly TreeFragment[], ranges?: readonly {
|
|
164
|
+
startParse(input: Input$1 | string, fragments?: readonly TreeFragment$1[], ranges?: readonly {
|
|
165
165
|
from: number;
|
|
166
166
|
to: number;
|
|
167
|
-
}[]): PartialParse;
|
|
167
|
+
}[]): PartialParse$1;
|
|
168
168
|
/**
|
|
169
169
|
Run a full parse, returning the resulting tree.
|
|
170
170
|
*/
|
|
171
|
-
parse(input: Input | string, fragments?: readonly TreeFragment[], ranges?: readonly {
|
|
171
|
+
parse(input: Input$1 | string, fragments?: readonly TreeFragment$1[], ranges?: readonly {
|
|
172
172
|
from: number;
|
|
173
173
|
to: number;
|
|
174
|
-
}[]): Tree;
|
|
174
|
+
}[]): Tree$1;
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
This is the interface parsers use to access the document. To run
|
|
178
178
|
Lezer directly on your own document data structure, you have to
|
|
179
179
|
write an implementation of it.
|
|
180
180
|
*/
|
|
181
|
-
interface Input {
|
|
181
|
+
interface Input$1 {
|
|
182
182
|
/**
|
|
183
183
|
The length of the document.
|
|
184
184
|
*/
|
|
@@ -206,16 +206,16 @@ interface Input {
|
|
|
206
206
|
Parse wrapper functions are supported by some parsers to inject
|
|
207
207
|
additional parsing logic.
|
|
208
208
|
*/
|
|
209
|
-
type ParseWrapper = (inner: PartialParse, input: Input, fragments: readonly TreeFragment[], ranges: readonly {
|
|
209
|
+
type ParseWrapper$1 = (inner: PartialParse$1, input: Input$1, fragments: readonly TreeFragment$1[], ranges: readonly {
|
|
210
210
|
from: number;
|
|
211
211
|
to: number;
|
|
212
|
-
}[]) => PartialParse;
|
|
212
|
+
}[]) => PartialParse$1;
|
|
213
213
|
/**
|
|
214
214
|
Each [node type](#common.NodeType) or [individual tree](#common.Tree)
|
|
215
215
|
can have metadata associated with it in props. Instances of this
|
|
216
216
|
class represent prop names.
|
|
217
217
|
*/
|
|
218
|
-
declare class NodeProp<T> {
|
|
218
|
+
declare class NodeProp$1<T> {
|
|
219
219
|
/**
|
|
220
220
|
Indicates whether this prop is stored per [node
|
|
221
221
|
type](#common.NodeType) or per [tree node](#common.Tree).
|
|
@@ -258,26 +258,26 @@ declare class NodeProp<T> {
|
|
|
258
258
|
*/
|
|
259
259
|
add(match: {
|
|
260
260
|
[selector: string]: T;
|
|
261
|
-
} | ((type: NodeType) => T | undefined)): NodePropSource;
|
|
261
|
+
} | ((type: NodeType$1) => T | undefined)): NodePropSource$1;
|
|
262
262
|
/**
|
|
263
263
|
Prop that is used to describe matching delimiters. For opening
|
|
264
264
|
delimiters, this holds an array of node names (written as a
|
|
265
265
|
space-separated string when declaring this prop in a grammar)
|
|
266
266
|
for the node types of closing delimiters that match it.
|
|
267
267
|
*/
|
|
268
|
-
static closedBy: NodeProp<readonly string[]>;
|
|
268
|
+
static closedBy: NodeProp$1<readonly string[]>;
|
|
269
269
|
/**
|
|
270
270
|
The inverse of [`closedBy`](#common.NodeProp^closedBy). This is
|
|
271
271
|
attached to closing delimiters, holding an array of node names
|
|
272
272
|
of types of matching opening delimiters.
|
|
273
273
|
*/
|
|
274
|
-
static openedBy: NodeProp<readonly string[]>;
|
|
274
|
+
static openedBy: NodeProp$1<readonly string[]>;
|
|
275
275
|
/**
|
|
276
276
|
Used to assign node types to groups (for example, all node
|
|
277
277
|
types that represent an expression could be tagged with an
|
|
278
278
|
`"Expression"` group).
|
|
279
279
|
*/
|
|
280
|
-
static group: NodeProp<readonly string[]>;
|
|
280
|
+
static group: NodeProp$1<readonly string[]>;
|
|
281
281
|
/**
|
|
282
282
|
Attached to nodes to indicate these should be
|
|
283
283
|
[displayed](https://codemirror.net/docs/ref/#language.syntaxTree)
|
|
@@ -289,37 +289,37 @@ declare class NodeProp<T> {
|
|
|
289
289
|
not given a value, in a grammar declaration, defaults to
|
|
290
290
|
`"auto"`.
|
|
291
291
|
*/
|
|
292
|
-
static isolate: NodeProp<"rtl" | "ltr" | "auto">;
|
|
292
|
+
static isolate: NodeProp$1<"rtl" | "ltr" | "auto">;
|
|
293
293
|
/**
|
|
294
294
|
The hash of the [context](#lr.ContextTracker.constructor)
|
|
295
295
|
that the node was parsed in, if any. Used to limit reuse of
|
|
296
296
|
contextual nodes.
|
|
297
297
|
*/
|
|
298
|
-
static contextHash: NodeProp<number>;
|
|
298
|
+
static contextHash: NodeProp$1<number>;
|
|
299
299
|
/**
|
|
300
300
|
The distance beyond the end of the node that the tokenizer
|
|
301
301
|
looked ahead for any of the tokens inside the node. (The LR
|
|
302
302
|
parser only stores this when it is larger than 25, for
|
|
303
303
|
efficiency reasons.)
|
|
304
304
|
*/
|
|
305
|
-
static lookAhead: NodeProp<number>;
|
|
305
|
+
static lookAhead: NodeProp$1<number>;
|
|
306
306
|
/**
|
|
307
307
|
This per-node prop is used to replace a given node, or part of a
|
|
308
308
|
node, with another tree. This is useful to include trees from
|
|
309
309
|
different languages in mixed-language parsers.
|
|
310
310
|
*/
|
|
311
|
-
static mounted: NodeProp<MountedTree>;
|
|
311
|
+
static mounted: NodeProp$1<MountedTree$1>;
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
314
314
|
A mounted tree, which can be [stored](#common.NodeProp^mounted) on
|
|
315
315
|
a tree node to indicate that parts of its content are
|
|
316
316
|
represented by another tree.
|
|
317
317
|
*/
|
|
318
|
-
declare class MountedTree {
|
|
318
|
+
declare class MountedTree$1 {
|
|
319
319
|
/**
|
|
320
320
|
The inner tree.
|
|
321
321
|
*/
|
|
322
|
-
readonly tree: Tree;
|
|
322
|
+
readonly tree: Tree$1;
|
|
323
323
|
/**
|
|
324
324
|
If this is null, this tree replaces the entire node (it will
|
|
325
325
|
be included in the regular iteration instead of its host
|
|
@@ -336,12 +336,12 @@ declare class MountedTree {
|
|
|
336
336
|
/**
|
|
337
337
|
The parser used to create this subtree.
|
|
338
338
|
*/
|
|
339
|
-
readonly parser: Parser;
|
|
339
|
+
readonly parser: Parser$1;
|
|
340
340
|
constructor(
|
|
341
341
|
/**
|
|
342
342
|
The inner tree.
|
|
343
343
|
*/
|
|
344
|
-
tree: Tree,
|
|
344
|
+
tree: Tree$1,
|
|
345
345
|
/**
|
|
346
346
|
If this is null, this tree replaces the entire node (it will
|
|
347
347
|
be included in the regular iteration instead of its host
|
|
@@ -358,18 +358,18 @@ declare class MountedTree {
|
|
|
358
358
|
/**
|
|
359
359
|
The parser used to create this subtree.
|
|
360
360
|
*/
|
|
361
|
-
parser: Parser);
|
|
361
|
+
parser: Parser$1);
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
364
|
Type returned by [`NodeProp.add`](#common.NodeProp.add). Describes
|
|
365
365
|
whether a prop should be added to a given node type in a node set,
|
|
366
366
|
and what value it should have.
|
|
367
367
|
*/
|
|
368
|
-
type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any];
|
|
368
|
+
type NodePropSource$1 = (type: NodeType$1) => null | [NodeProp$1<any>, any];
|
|
369
369
|
/**
|
|
370
370
|
Each node in a syntax tree has a node type associated with it.
|
|
371
371
|
*/
|
|
372
|
-
declare class NodeType {
|
|
372
|
+
declare class NodeType$1 {
|
|
373
373
|
/**
|
|
374
374
|
The name of the node type. Not necessarily unique, but if the
|
|
375
375
|
grammar was written properly, different node types with the
|
|
@@ -401,7 +401,7 @@ declare class NodeType {
|
|
|
401
401
|
[Node props](#common.NodeProp) to assign to the type. The value
|
|
402
402
|
given for any given prop should correspond to the prop's type.
|
|
403
403
|
*/
|
|
404
|
-
props?: readonly ([NodeProp<any>, any] | NodePropSource)[];
|
|
404
|
+
props?: readonly ([NodeProp$1<any>, any] | NodePropSource$1)[];
|
|
405
405
|
/**
|
|
406
406
|
Whether this is a [top node](#common.NodeType.isTop).
|
|
407
407
|
*/
|
|
@@ -416,12 +416,12 @@ declare class NodeType {
|
|
|
416
416
|
node.
|
|
417
417
|
*/
|
|
418
418
|
skipped?: boolean;
|
|
419
|
-
}): NodeType;
|
|
419
|
+
}): NodeType$1;
|
|
420
420
|
/**
|
|
421
421
|
Retrieves a node prop for this type. Will return `undefined` if
|
|
422
422
|
the prop isn't present on this node.
|
|
423
423
|
*/
|
|
424
|
-
prop<T>(prop: NodeProp<T>): T | undefined;
|
|
424
|
+
prop<T>(prop: NodeProp$1<T>): T | undefined;
|
|
425
425
|
/**
|
|
426
426
|
True when this is the top node of a grammar.
|
|
427
427
|
*/
|
|
@@ -447,7 +447,7 @@ declare class NodeType {
|
|
|
447
447
|
/**
|
|
448
448
|
An empty dummy node type to use when no actual type is available.
|
|
449
449
|
*/
|
|
450
|
-
static none: NodeType;
|
|
450
|
+
static none: NodeType$1;
|
|
451
451
|
/**
|
|
452
452
|
Create a function from node types to arbitrary values by
|
|
453
453
|
specifying an object whose property names are node or
|
|
@@ -458,7 +458,7 @@ declare class NodeType {
|
|
|
458
458
|
*/
|
|
459
459
|
static match<T>(map: {
|
|
460
460
|
[selector: string]: T;
|
|
461
|
-
}): (node: NodeType) => T | undefined;
|
|
461
|
+
}): (node: NodeType$1) => T | undefined;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
A node set holds a collection of node types. It is used to
|
|
@@ -469,11 +469,11 @@ buffers](#common.TreeBuffer) can only store collections of nodes
|
|
|
469
469
|
from the same set. A set can have a maximum of 2**16 (65536) node
|
|
470
470
|
types in it, so that the ids fit into 16-bit typed array slots.
|
|
471
471
|
*/
|
|
472
|
-
declare class NodeSet {
|
|
472
|
+
declare class NodeSet$1 {
|
|
473
473
|
/**
|
|
474
474
|
The node types in this set, by id.
|
|
475
475
|
*/
|
|
476
|
-
readonly types: readonly NodeType[];
|
|
476
|
+
readonly types: readonly NodeType$1[];
|
|
477
477
|
/**
|
|
478
478
|
Create a set with the given types. The `id` property of each
|
|
479
479
|
type should correspond to its position within the array.
|
|
@@ -482,19 +482,19 @@ declare class NodeSet {
|
|
|
482
482
|
/**
|
|
483
483
|
The node types in this set, by id.
|
|
484
484
|
*/
|
|
485
|
-
types: readonly NodeType[]);
|
|
485
|
+
types: readonly NodeType$1[]);
|
|
486
486
|
/**
|
|
487
487
|
Create a copy of this set with some node properties added. The
|
|
488
488
|
arguments to this method can be created with
|
|
489
489
|
[`NodeProp.add`](#common.NodeProp.add).
|
|
490
490
|
*/
|
|
491
|
-
extend(...props: NodePropSource[]): NodeSet;
|
|
491
|
+
extend(...props: NodePropSource$1[]): NodeSet$1;
|
|
492
492
|
}
|
|
493
493
|
/**
|
|
494
494
|
Options that control iteration. Can be combined with the `|`
|
|
495
495
|
operator to enable multiple ones.
|
|
496
496
|
*/
|
|
497
|
-
declare enum IterMode {
|
|
497
|
+
declare enum IterMode$1 {
|
|
498
498
|
/**
|
|
499
499
|
When enabled, iteration will only visit [`Tree`](#common.Tree)
|
|
500
500
|
objects, not nodes packed into
|
|
@@ -537,15 +537,15 @@ use the [`TreeCursor`](#common.TreeCursor) or
|
|
|
537
537
|
a view on some part of this data structure, and can be used to
|
|
538
538
|
move around to adjacent nodes.
|
|
539
539
|
*/
|
|
540
|
-
declare class Tree {
|
|
540
|
+
declare class Tree$1 {
|
|
541
541
|
/**
|
|
542
542
|
The type of the top node.
|
|
543
543
|
*/
|
|
544
|
-
readonly type: NodeType;
|
|
544
|
+
readonly type: NodeType$1;
|
|
545
545
|
/**
|
|
546
546
|
This node's child nodes.
|
|
547
547
|
*/
|
|
548
|
-
readonly children: readonly (Tree | TreeBuffer)[];
|
|
548
|
+
readonly children: readonly (Tree$1 | TreeBuffer$1)[];
|
|
549
549
|
/**
|
|
550
550
|
The positions (offsets relative to the start of this tree) of
|
|
551
551
|
the children.
|
|
@@ -562,11 +562,11 @@ declare class Tree {
|
|
|
562
562
|
/**
|
|
563
563
|
The type of the top node.
|
|
564
564
|
*/
|
|
565
|
-
type: NodeType,
|
|
565
|
+
type: NodeType$1,
|
|
566
566
|
/**
|
|
567
567
|
This node's child nodes.
|
|
568
568
|
*/
|
|
569
|
-
children: readonly (Tree | TreeBuffer)[],
|
|
569
|
+
children: readonly (Tree$1 | TreeBuffer$1)[],
|
|
570
570
|
/**
|
|
571
571
|
The positions (offsets relative to the start of this tree) of
|
|
572
572
|
the children.
|
|
@@ -579,28 +579,28 @@ declare class Tree {
|
|
|
579
579
|
/**
|
|
580
580
|
Per-node [node props](#common.NodeProp) to associate with this node.
|
|
581
581
|
*/
|
|
582
|
-
props?: readonly [NodeProp<any> | number, any][]);
|
|
582
|
+
props?: readonly [NodeProp$1<any> | number, any][]);
|
|
583
583
|
/**
|
|
584
584
|
The empty tree
|
|
585
585
|
*/
|
|
586
|
-
static empty: Tree;
|
|
586
|
+
static empty: Tree$1;
|
|
587
587
|
/**
|
|
588
588
|
Get a [tree cursor](#common.TreeCursor) positioned at the top of
|
|
589
589
|
the tree. Mode can be used to [control](#common.IterMode) which
|
|
590
590
|
nodes the cursor visits.
|
|
591
591
|
*/
|
|
592
|
-
cursor(mode?: IterMode): TreeCursor;
|
|
592
|
+
cursor(mode?: IterMode$1): TreeCursor$1;
|
|
593
593
|
/**
|
|
594
594
|
Get a [tree cursor](#common.TreeCursor) pointing into this tree
|
|
595
595
|
at the given position and side (see
|
|
596
596
|
[`moveTo`](#common.TreeCursor.moveTo).
|
|
597
597
|
*/
|
|
598
|
-
cursorAt(pos: number, side?: -1 | 0 | 1, mode?: IterMode): TreeCursor;
|
|
598
|
+
cursorAt(pos: number, side?: -1 | 0 | 1, mode?: IterMode$1): TreeCursor$1;
|
|
599
599
|
/**
|
|
600
600
|
Get a [syntax node](#common.SyntaxNode) object for the top of the
|
|
601
601
|
tree.
|
|
602
602
|
*/
|
|
603
|
-
get topNode(): SyntaxNode;
|
|
603
|
+
get topNode(): SyntaxNode$1;
|
|
604
604
|
/**
|
|
605
605
|
Get the [syntax node](#common.SyntaxNode) at the given position.
|
|
606
606
|
If `side` is -1, this will move into nodes that end at the
|
|
@@ -612,7 +612,7 @@ declare class Tree {
|
|
|
612
612
|
[overlays](#common.MountedTree.overlay), and you often want
|
|
613
613
|
[`resolveInner`](#common.Tree.resolveInner) instead.
|
|
614
614
|
*/
|
|
615
|
-
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
615
|
+
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode$1;
|
|
616
616
|
/**
|
|
617
617
|
Like [`resolve`](#common.Tree.resolve), but will enter
|
|
618
618
|
[overlaid](#common.MountedTree.overlay) nodes, producing a syntax node
|
|
@@ -620,7 +620,7 @@ declare class Tree {
|
|
|
620
620
|
(with parent links going through all parent structure, including
|
|
621
621
|
the host trees).
|
|
622
622
|
*/
|
|
623
|
-
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
623
|
+
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode$1;
|
|
624
624
|
/**
|
|
625
625
|
In some situations, it can be useful to iterate through all
|
|
626
626
|
nodes around a position, including those in overlays that don't
|
|
@@ -628,7 +628,7 @@ declare class Tree {
|
|
|
628
628
|
that will produce all nodes, from small to big, around the given
|
|
629
629
|
position.
|
|
630
630
|
*/
|
|
631
|
-
resolveStack(pos: number, side?: -1 | 0 | 1): NodeIterator;
|
|
631
|
+
resolveStack(pos: number, side?: -1 | 0 | 1): NodeIterator$1;
|
|
632
632
|
/**
|
|
633
633
|
Iterate over the tree and its children, calling `enter` for any
|
|
634
634
|
node that touches the `from`/`to` region (if given) before
|
|
@@ -637,23 +637,23 @@ declare class Tree {
|
|
|
637
637
|
not have its children iterated over (or `leave` called).
|
|
638
638
|
*/
|
|
639
639
|
iterate(spec: {
|
|
640
|
-
enter(node: SyntaxNodeRef): boolean | void;
|
|
641
|
-
leave?(node: SyntaxNodeRef): void;
|
|
640
|
+
enter(node: SyntaxNodeRef$1): boolean | void;
|
|
641
|
+
leave?(node: SyntaxNodeRef$1): void;
|
|
642
642
|
from?: number;
|
|
643
643
|
to?: number;
|
|
644
|
-
mode?: IterMode;
|
|
644
|
+
mode?: IterMode$1;
|
|
645
645
|
}): void;
|
|
646
646
|
/**
|
|
647
647
|
Get the value of the given [node prop](#common.NodeProp) for this
|
|
648
648
|
node. Works with both per-node and per-type props.
|
|
649
649
|
*/
|
|
650
|
-
prop<T>(prop: NodeProp<T>): T | undefined;
|
|
650
|
+
prop<T>(prop: NodeProp$1<T>): T | undefined;
|
|
651
651
|
/**
|
|
652
652
|
Returns the node's [per-node props](#common.NodeProp.perNode) in a
|
|
653
653
|
format that can be passed to the [`Tree`](#common.Tree)
|
|
654
654
|
constructor.
|
|
655
655
|
*/
|
|
656
|
-
get propValues(): readonly [NodeProp<any> | number, any][];
|
|
656
|
+
get propValues(): readonly [NodeProp$1<any> | number, any][];
|
|
657
657
|
/**
|
|
658
658
|
Balance the direct children of this tree, producing a copy of
|
|
659
659
|
which may have children grouped into subtrees with type
|
|
@@ -663,22 +663,22 @@ declare class Tree {
|
|
|
663
663
|
/**
|
|
664
664
|
Function to create the newly balanced subtrees.
|
|
665
665
|
*/
|
|
666
|
-
makeTree?: (children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => Tree;
|
|
667
|
-
}): Tree;
|
|
666
|
+
makeTree?: (children: readonly (Tree$1 | TreeBuffer$1)[], positions: readonly number[], length: number) => Tree$1;
|
|
667
|
+
}): Tree$1;
|
|
668
668
|
/**
|
|
669
669
|
Build a tree from a postfix-ordered buffer of node information,
|
|
670
670
|
or a cursor over such a buffer.
|
|
671
671
|
*/
|
|
672
|
-
static build(data: BuildData): Tree;
|
|
672
|
+
static build(data: BuildData$1): Tree$1;
|
|
673
673
|
}
|
|
674
674
|
/**
|
|
675
675
|
Represents a sequence of nodes.
|
|
676
676
|
*/
|
|
677
|
-
type NodeIterator = {
|
|
678
|
-
node: SyntaxNode;
|
|
679
|
-
next: NodeIterator | null;
|
|
677
|
+
type NodeIterator$1 = {
|
|
678
|
+
node: SyntaxNode$1;
|
|
679
|
+
next: NodeIterator$1 | null;
|
|
680
680
|
};
|
|
681
|
-
type BuildData = {
|
|
681
|
+
type BuildData$1 = {
|
|
682
682
|
/**
|
|
683
683
|
The buffer or buffer cursor to read the node data from.
|
|
684
684
|
|
|
@@ -701,11 +701,11 @@ type BuildData = {
|
|
|
701
701
|
|
|
702
702
|
[11, 0, 1, 4, 12, 2, 4, 4, 10, 0, 4, 12]
|
|
703
703
|
*/
|
|
704
|
-
buffer: BufferCursor | readonly number[];
|
|
704
|
+
buffer: BufferCursor$1 | readonly number[];
|
|
705
705
|
/**
|
|
706
706
|
The node types to use.
|
|
707
707
|
*/
|
|
708
|
-
nodeSet: NodeSet;
|
|
708
|
+
nodeSet: NodeSet$1;
|
|
709
709
|
/**
|
|
710
710
|
The id of the top node type.
|
|
711
711
|
*/
|
|
@@ -733,7 +733,7 @@ type BuildData = {
|
|
|
733
733
|
An optional array holding reused nodes that the buffer can refer
|
|
734
734
|
to.
|
|
735
735
|
*/
|
|
736
|
-
reused?: readonly Tree[];
|
|
736
|
+
reused?: readonly Tree$1[];
|
|
737
737
|
/**
|
|
738
738
|
The first node type that indicates repeat constructs in this
|
|
739
739
|
grammar.
|
|
@@ -746,7 +746,7 @@ a tree buffer. A cursor initially points at the very last element
|
|
|
746
746
|
in the buffer. Every time `next()` is called it moves on to the
|
|
747
747
|
previous one.
|
|
748
748
|
*/
|
|
749
|
-
interface BufferCursor {
|
|
749
|
+
interface BufferCursor$1 {
|
|
750
750
|
/**
|
|
751
751
|
The current buffer position (four times the number of nodes
|
|
752
752
|
remaining).
|
|
@@ -776,7 +776,7 @@ interface BufferCursor {
|
|
|
776
776
|
/**
|
|
777
777
|
Create a copy of this cursor.
|
|
778
778
|
*/
|
|
779
|
-
fork(): BufferCursor;
|
|
779
|
+
fork(): BufferCursor$1;
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
782
|
Tree buffers contain (type, start, end, endIndex) quads for each
|
|
@@ -784,7 +784,7 @@ node. In such a buffer, nodes are stored in prefix order (parents
|
|
|
784
784
|
before children, with the endIndex of the parent indicating which
|
|
785
785
|
children belong to it).
|
|
786
786
|
*/
|
|
787
|
-
declare class TreeBuffer {
|
|
787
|
+
declare class TreeBuffer$1 {
|
|
788
788
|
/**
|
|
789
789
|
The buffer's content.
|
|
790
790
|
*/
|
|
@@ -796,7 +796,7 @@ declare class TreeBuffer {
|
|
|
796
796
|
/**
|
|
797
797
|
The node set used in this buffer.
|
|
798
798
|
*/
|
|
799
|
-
readonly set: NodeSet;
|
|
799
|
+
readonly set: NodeSet$1;
|
|
800
800
|
/**
|
|
801
801
|
Create a tree buffer.
|
|
802
802
|
*/
|
|
@@ -812,7 +812,7 @@ declare class TreeBuffer {
|
|
|
812
812
|
/**
|
|
813
813
|
The node set used in this buffer.
|
|
814
814
|
*/
|
|
815
|
-
set: NodeSet);
|
|
815
|
+
set: NodeSet$1);
|
|
816
816
|
}
|
|
817
817
|
/**
|
|
818
818
|
The set of properties provided by both [`SyntaxNode`](#common.SyntaxNode)
|
|
@@ -820,7 +820,7 @@ and [`TreeCursor`](#common.TreeCursor). Note that, if you need
|
|
|
820
820
|
an object that is guaranteed to stay stable in the future, you
|
|
821
821
|
need to use the [`node`](#common.SyntaxNodeRef.node) accessor.
|
|
822
822
|
*/
|
|
823
|
-
interface SyntaxNodeRef {
|
|
823
|
+
interface SyntaxNodeRef$1 {
|
|
824
824
|
/**
|
|
825
825
|
The start position of the node.
|
|
826
826
|
*/
|
|
@@ -832,7 +832,7 @@ interface SyntaxNodeRef {
|
|
|
832
832
|
/**
|
|
833
833
|
The type of the node.
|
|
834
834
|
*/
|
|
835
|
-
readonly type: NodeType;
|
|
835
|
+
readonly type: NodeType$1;
|
|
836
836
|
/**
|
|
837
837
|
The name of the node (`.type.name`).
|
|
838
838
|
*/
|
|
@@ -842,12 +842,12 @@ interface SyntaxNodeRef {
|
|
|
842
842
|
if any. Will return null when the node is in a [tree
|
|
843
843
|
buffer](#common.TreeBuffer).
|
|
844
844
|
*/
|
|
845
|
-
readonly tree: Tree | null;
|
|
845
|
+
readonly tree: Tree$1 | null;
|
|
846
846
|
/**
|
|
847
847
|
Retrieve a stable [syntax node](#common.SyntaxNode) at this
|
|
848
848
|
position.
|
|
849
849
|
*/
|
|
850
|
-
readonly node: SyntaxNode;
|
|
850
|
+
readonly node: SyntaxNode$1;
|
|
851
851
|
/**
|
|
852
852
|
Test whether the node matches a given context—a sequence of
|
|
853
853
|
direct parent nodes. Empty strings in the context array act as
|
|
@@ -861,27 +861,27 @@ tree. When iterating over large amounts of nodes, you may want to
|
|
|
861
861
|
use a mutable [cursor](#common.TreeCursor) instead, which is more
|
|
862
862
|
efficient.
|
|
863
863
|
*/
|
|
864
|
-
interface SyntaxNode extends SyntaxNodeRef {
|
|
864
|
+
interface SyntaxNode$1 extends SyntaxNodeRef$1 {
|
|
865
865
|
/**
|
|
866
866
|
The node's parent node, if any.
|
|
867
867
|
*/
|
|
868
|
-
parent: SyntaxNode | null;
|
|
868
|
+
parent: SyntaxNode$1 | null;
|
|
869
869
|
/**
|
|
870
870
|
The first child, if the node has children.
|
|
871
871
|
*/
|
|
872
|
-
firstChild: SyntaxNode | null;
|
|
872
|
+
firstChild: SyntaxNode$1 | null;
|
|
873
873
|
/**
|
|
874
874
|
The node's last child, if available.
|
|
875
875
|
*/
|
|
876
|
-
lastChild: SyntaxNode | null;
|
|
876
|
+
lastChild: SyntaxNode$1 | null;
|
|
877
877
|
/**
|
|
878
878
|
The first child that ends after `pos`.
|
|
879
879
|
*/
|
|
880
|
-
childAfter(pos: number): SyntaxNode | null;
|
|
880
|
+
childAfter(pos: number): SyntaxNode$1 | null;
|
|
881
881
|
/**
|
|
882
882
|
The last child that starts before `pos`.
|
|
883
883
|
*/
|
|
884
|
-
childBefore(pos: number): SyntaxNode | null;
|
|
884
|
+
childBefore(pos: number): SyntaxNode$1 | null;
|
|
885
885
|
/**
|
|
886
886
|
Enter the child at the given position. If side is -1 the child
|
|
887
887
|
may end at that position, when 1 it may start there.
|
|
@@ -896,41 +896,41 @@ interface SyntaxNode extends SyntaxNodeRef {
|
|
|
896
896
|
is mostly useful when looking for props, which cannot exist on
|
|
897
897
|
buffer-allocated nodes).
|
|
898
898
|
*/
|
|
899
|
-
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode): SyntaxNode | null;
|
|
899
|
+
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode$1): SyntaxNode$1 | null;
|
|
900
900
|
/**
|
|
901
901
|
This node's next sibling, if any.
|
|
902
902
|
*/
|
|
903
|
-
nextSibling: SyntaxNode | null;
|
|
903
|
+
nextSibling: SyntaxNode$1 | null;
|
|
904
904
|
/**
|
|
905
905
|
This node's previous sibling.
|
|
906
906
|
*/
|
|
907
|
-
prevSibling: SyntaxNode | null;
|
|
907
|
+
prevSibling: SyntaxNode$1 | null;
|
|
908
908
|
/**
|
|
909
909
|
A [tree cursor](#common.TreeCursor) starting at this node.
|
|
910
910
|
*/
|
|
911
|
-
cursor(mode?: IterMode): TreeCursor;
|
|
911
|
+
cursor(mode?: IterMode$1): TreeCursor$1;
|
|
912
912
|
/**
|
|
913
913
|
Find the node around, before (if `side` is -1), or after (`side`
|
|
914
914
|
is 1) the given position. Will look in parent nodes if the
|
|
915
915
|
position is outside this node.
|
|
916
916
|
*/
|
|
917
|
-
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
917
|
+
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode$1;
|
|
918
918
|
/**
|
|
919
919
|
Similar to `resolve`, but enter
|
|
920
920
|
[overlaid](#common.MountedTree.overlay) nodes.
|
|
921
921
|
*/
|
|
922
|
-
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
922
|
+
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode$1;
|
|
923
923
|
/**
|
|
924
924
|
Move the position to the innermost node before `pos` that looks
|
|
925
925
|
like it is unfinished (meaning it ends in an error node or has a
|
|
926
926
|
child ending in an error node right at its end).
|
|
927
927
|
*/
|
|
928
|
-
enterUnfinishedNodesBefore(pos: number): SyntaxNode;
|
|
928
|
+
enterUnfinishedNodesBefore(pos: number): SyntaxNode$1;
|
|
929
929
|
/**
|
|
930
930
|
Get a [tree](#common.Tree) for this node. Will allocate one if it
|
|
931
931
|
points into a buffer.
|
|
932
932
|
*/
|
|
933
|
-
toTree(): Tree;
|
|
933
|
+
toTree(): Tree$1;
|
|
934
934
|
/**
|
|
935
935
|
Get the first child of the given type (which may be a [node
|
|
936
936
|
name](#common.NodeType.name) or a [group
|
|
@@ -939,22 +939,22 @@ interface SyntaxNode extends SyntaxNodeRef {
|
|
|
939
939
|
or group. If `after` is non-null, only return children that
|
|
940
940
|
occur somewhere before a node with that name or group.
|
|
941
941
|
*/
|
|
942
|
-
getChild(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode | null;
|
|
942
|
+
getChild(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode$1 | null;
|
|
943
943
|
/**
|
|
944
944
|
Like [`getChild`](#common.SyntaxNode.getChild), but return all
|
|
945
945
|
matching children, not just the first.
|
|
946
946
|
*/
|
|
947
|
-
getChildren(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode[];
|
|
947
|
+
getChildren(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode$1[];
|
|
948
948
|
}
|
|
949
949
|
/**
|
|
950
950
|
A tree cursor object focuses on a given node in a syntax tree, and
|
|
951
951
|
allows you to move to adjacent nodes.
|
|
952
952
|
*/
|
|
953
|
-
declare class TreeCursor implements SyntaxNodeRef {
|
|
953
|
+
declare class TreeCursor$1 implements SyntaxNodeRef$1 {
|
|
954
954
|
/**
|
|
955
955
|
The node's type.
|
|
956
956
|
*/
|
|
957
|
-
type: NodeType;
|
|
957
|
+
type: NodeType$1;
|
|
958
958
|
/**
|
|
959
959
|
Shorthand for `.type.name`.
|
|
960
960
|
*/
|
|
@@ -995,7 +995,7 @@ declare class TreeCursor implements SyntaxNodeRef {
|
|
|
995
995
|
[mounted](#common.NodeProp^mounted) trees unless `overlays` is
|
|
996
996
|
set to false.
|
|
997
997
|
*/
|
|
998
|
-
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode): boolean;
|
|
998
|
+
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode$1): boolean;
|
|
999
999
|
/**
|
|
1000
1000
|
Move to the node's parent node, if this isn't the top node.
|
|
1001
1001
|
*/
|
|
@@ -1035,20 +1035,20 @@ declare class TreeCursor implements SyntaxNodeRef {
|
|
|
1035
1035
|
Get a [syntax node](#common.SyntaxNode) at the cursor's current
|
|
1036
1036
|
position.
|
|
1037
1037
|
*/
|
|
1038
|
-
get node(): SyntaxNode;
|
|
1038
|
+
get node(): SyntaxNode$1;
|
|
1039
1039
|
/**
|
|
1040
1040
|
Get the [tree](#common.Tree) that represents the current node, if
|
|
1041
1041
|
any. Will return null when the node is in a [tree
|
|
1042
1042
|
buffer](#common.TreeBuffer).
|
|
1043
1043
|
*/
|
|
1044
|
-
get tree(): Tree | null;
|
|
1044
|
+
get tree(): Tree$1 | null;
|
|
1045
1045
|
/**
|
|
1046
1046
|
Iterate over the current node and all its descendants, calling
|
|
1047
1047
|
`enter` when entering a node and `leave`, if given, when leaving
|
|
1048
1048
|
one. When `enter` returns `false`, any children of that node are
|
|
1049
1049
|
skipped, and `leave` isn't called for it.
|
|
1050
1050
|
*/
|
|
1051
|
-
iterate(enter: (node: SyntaxNodeRef) => boolean | void, leave?: (node: SyntaxNodeRef) => void): void;
|
|
1051
|
+
iterate(enter: (node: SyntaxNodeRef$1) => boolean | void, leave?: (node: SyntaxNodeRef$1) => void): void;
|
|
1052
1052
|
/**
|
|
1053
1053
|
Test whether the current node matches a given context—a sequence
|
|
1054
1054
|
of direct parent node names. Empty strings in the context array
|
|
@@ -1229,7 +1229,7 @@ declare class ContextTracker<T> {
|
|
|
1229
1229
|
Update the context when the parser reuses a node from a tree
|
|
1230
1230
|
fragment.
|
|
1231
1231
|
*/
|
|
1232
|
-
reuse?(context: T, node: Tree, stack: Stack, input: InputStream): T;
|
|
1232
|
+
reuse?(context: T, node: Tree$1, stack: Stack, input: InputStream): T;
|
|
1233
1233
|
/**
|
|
1234
1234
|
Reduce a context value to a number (for cheap storage and
|
|
1235
1235
|
comparison). Only needed for strict contexts.
|
|
@@ -1252,7 +1252,7 @@ interface ParserConfig {
|
|
|
1252
1252
|
/**
|
|
1253
1253
|
Node prop values to add to the parser's node set.
|
|
1254
1254
|
*/
|
|
1255
|
-
props?: readonly NodePropSource[];
|
|
1255
|
+
props?: readonly NodePropSource$1[];
|
|
1256
1256
|
/**
|
|
1257
1257
|
The name of the `@top` declaration to parse from. If not
|
|
1258
1258
|
specified, the first top rule declaration in the grammar is
|
|
@@ -1292,7 +1292,7 @@ interface ParserConfig {
|
|
|
1292
1292
|
with additional logic (usually used to add
|
|
1293
1293
|
[mixed-language](#common.parseMixed) parsing).
|
|
1294
1294
|
*/
|
|
1295
|
-
wrap?: ParseWrapper;
|
|
1295
|
+
wrap?: ParseWrapper$1;
|
|
1296
1296
|
/**
|
|
1297
1297
|
The maximum length of the TreeBuffers generated in the output
|
|
1298
1298
|
tree. Defaults to 1024.
|
|
@@ -1304,15 +1304,15 @@ Holds the parse tables for a given grammar, as generated by
|
|
|
1304
1304
|
`lezer-generator`, and provides [methods](#common.Parser) to parse
|
|
1305
1305
|
content with.
|
|
1306
1306
|
*/
|
|
1307
|
-
declare class LRParser extends Parser {
|
|
1307
|
+
declare class LRParser extends Parser$1 {
|
|
1308
1308
|
/**
|
|
1309
1309
|
The nodes used in the trees emitted by this parser.
|
|
1310
1310
|
*/
|
|
1311
|
-
readonly nodeSet: NodeSet;
|
|
1312
|
-
createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
|
|
1311
|
+
readonly nodeSet: NodeSet$1;
|
|
1312
|
+
createParse(input: Input$1, fragments: readonly TreeFragment$1[], ranges: readonly {
|
|
1313
1313
|
from: number;
|
|
1314
1314
|
to: number;
|
|
1315
|
-
}[]): PartialParse;
|
|
1315
|
+
}[]): PartialParse$1;
|
|
1316
1316
|
/**
|
|
1317
1317
|
Configure the parser. Returns a new parser instance that has the
|
|
1318
1318
|
given settings modified. Settings not provided in `config` are
|
|
@@ -1334,7 +1334,7 @@ declare class LRParser extends Parser {
|
|
|
1334
1334
|
/**
|
|
1335
1335
|
The type of top node produced by the parser.
|
|
1336
1336
|
*/
|
|
1337
|
-
get topNode(): NodeType;
|
|
1337
|
+
get topNode(): NodeType$1;
|
|
1338
1338
|
/**
|
|
1339
1339
|
Used by the output of the parser generator. Not available to
|
|
1340
1340
|
user code. @hide
|
|
@@ -1565,12 +1565,13 @@ declare class ChangeDesc {
|
|
|
1565
1565
|
position pointing into the new document.
|
|
1566
1566
|
|
|
1567
1567
|
`assoc` indicates which side the position should be associated
|
|
1568
|
-
with. When it is negative
|
|
1569
|
-
|
|
1568
|
+
with. When it is negative, the mapping will try to keep the
|
|
1569
|
+
position close to the character before it (if any), and will
|
|
1570
1570
|
move it before insertions at that point or replacements across
|
|
1571
|
-
that point. When it is positive, the position is associated
|
|
1572
|
-
the character after it, and will be moved forward for
|
|
1573
|
-
|
|
1571
|
+
that point. When it is zero or positive, the position is associated
|
|
1572
|
+
with the character after it, and will be moved forward for
|
|
1573
|
+
*/
|
|
1574
|
+
/**
|
|
1574
1575
|
|
|
1575
1576
|
`mode` determines whether deletions should be
|
|
1576
1577
|
[reported](https://codemirror.net/6/docs/ref/#state.MapMode). It defaults to
|
|
@@ -1701,6 +1702,13 @@ declare class SelectionRange {
|
|
|
1701
1702
|
*/
|
|
1702
1703
|
readonly to: number;
|
|
1703
1704
|
private flags;
|
|
1705
|
+
/**
|
|
1706
|
+
The goal column (stored vertical offset) associated with a
|
|
1707
|
+
cursor. This is used to preserve the vertical position when
|
|
1708
|
+
[moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across
|
|
1709
|
+
lines of different length.
|
|
1710
|
+
*/
|
|
1711
|
+
readonly goalColumn: number | undefined;
|
|
1704
1712
|
private constructor();
|
|
1705
1713
|
/**
|
|
1706
1714
|
The anchor of the range—the side that doesn't move when you
|
|
@@ -1724,18 +1732,19 @@ declare class SelectionRange {
|
|
|
1724
1732
|
*/
|
|
1725
1733
|
get assoc(): -1 | 0 | 1;
|
|
1726
1734
|
/**
|
|
1735
|
+
A flag that, when set, makes some selection-extending commands
|
|
1736
|
+
treat the range's head and anchor as exchangeable, so that for
|
|
1737
|
+
example Shift-ArrowUp will make the lower side of the selection
|
|
1738
|
+
the anchor, even if that was the head before. Used to implement
|
|
1739
|
+
MacOS-style undirectional selections.
|
|
1740
|
+
*/
|
|
1741
|
+
get undirectional(): boolean;
|
|
1742
|
+
/**
|
|
1727
1743
|
The bidirectional text level associated with this cursor, if
|
|
1728
1744
|
any.
|
|
1729
1745
|
*/
|
|
1730
1746
|
get bidiLevel(): number | null;
|
|
1731
1747
|
/**
|
|
1732
|
-
The goal column (stored vertical offset) associated with a
|
|
1733
|
-
cursor. This is used to preserve the vertical position when
|
|
1734
|
-
[moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across
|
|
1735
|
-
lines of different length.
|
|
1736
|
-
*/
|
|
1737
|
-
get goalColumn(): number | undefined;
|
|
1738
|
-
/**
|
|
1739
1748
|
Map this range through a change, producing a valid range in the
|
|
1740
1749
|
updated document.
|
|
1741
1750
|
*/
|
|
@@ -1743,7 +1752,7 @@ declare class SelectionRange {
|
|
|
1743
1752
|
/**
|
|
1744
1753
|
Extend this range to cover at least `from` to `to`.
|
|
1745
1754
|
*/
|
|
1746
|
-
extend(from: number, to?: number): SelectionRange;
|
|
1755
|
+
extend(from: number, to?: number, assoc?: number): SelectionRange;
|
|
1747
1756
|
/**
|
|
1748
1757
|
Compare this range to another range.
|
|
1749
1758
|
*/
|
|
@@ -1831,7 +1840,12 @@ declare class EditorSelection {
|
|
|
1831
1840
|
/**
|
|
1832
1841
|
Create a selection range.
|
|
1833
1842
|
*/
|
|
1834
|
-
static range(anchor: number, head: number, goalColumn?: number, bidiLevel?: number): SelectionRange;
|
|
1843
|
+
static range(anchor: number, head: number, goalColumn?: number, bidiLevel?: number, assoc?: number): SelectionRange;
|
|
1844
|
+
/**
|
|
1845
|
+
Create an [undirectional](https://codemirror.net/6/docs/ref/#state.SelectionRange.undirectional)
|
|
1846
|
+
selection range.
|
|
1847
|
+
*/
|
|
1848
|
+
static undirectionalRange(from: number, to: number): SelectionRange;
|
|
1835
1849
|
}
|
|
1836
1850
|
|
|
1837
1851
|
type FacetConfig<Input, Output> = {
|
|
@@ -2601,9 +2615,9 @@ declare class EditorState {
|
|
|
2601
2615
|
A facet used to register [language
|
|
2602
2616
|
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers.
|
|
2603
2617
|
*/
|
|
2604
|
-
static languageData: Facet<(state: EditorState, pos: number, side:
|
|
2618
|
+
static languageData: Facet<(state: EditorState, pos: number, side: -1 | 0 | 1) => readonly {
|
|
2605
2619
|
[name: string]: any;
|
|
2606
|
-
}[], readonly ((state: EditorState, pos: number, side:
|
|
2620
|
+
}[], readonly ((state: EditorState, pos: number, side: -1 | 0 | 1) => readonly {
|
|
2607
2621
|
[name: string]: any;
|
|
2608
2622
|
}[])[]>;
|
|
2609
2623
|
/**
|
|
@@ -2818,7 +2832,11 @@ interface RangeCursor<T> {
|
|
|
2818
2832
|
/**
|
|
2819
2833
|
Move the iterator forward.
|
|
2820
2834
|
*/
|
|
2821
|
-
next
|
|
2835
|
+
next(): void;
|
|
2836
|
+
/**
|
|
2837
|
+
Jump the cursor to the given position.
|
|
2838
|
+
*/
|
|
2839
|
+
goto(pos: number): void;
|
|
2822
2840
|
/**
|
|
2823
2841
|
The next range's value. Holds `null` when the cursor has reached
|
|
2824
2842
|
its end.
|
|
@@ -2832,6 +2850,11 @@ interface RangeCursor<T> {
|
|
|
2832
2850
|
The next end position.
|
|
2833
2851
|
*/
|
|
2834
2852
|
to: number;
|
|
2853
|
+
/**
|
|
2854
|
+
The position of the set that this range comes from in the array
|
|
2855
|
+
of sets being iterated over.
|
|
2856
|
+
*/
|
|
2857
|
+
rank: number;
|
|
2835
2858
|
}
|
|
2836
2859
|
type RangeSetUpdate<T extends RangeValue> = {
|
|
2837
2860
|
/**
|
|
@@ -4940,7 +4963,7 @@ interface Highlighter {
|
|
|
4940
4963
|
whose [top](#common.NodeType.isTop) node this predicate returns
|
|
4941
4964
|
true.
|
|
4942
4965
|
*/
|
|
4943
|
-
scope?(node: NodeType): boolean;
|
|
4966
|
+
scope?(node: NodeType$1): boolean;
|
|
4944
4967
|
}
|
|
4945
4968
|
/**
|
|
4946
4969
|
Highlight the given [tree](#common.Tree) with the given
|
|
@@ -4948,7 +4971,7 @@ Highlight the given [tree](#common.Tree) with the given
|
|
|
4948
4971
|
[`highlightCode`](#highlight.highlightCode) function is easier to
|
|
4949
4972
|
use.
|
|
4950
4973
|
*/
|
|
4951
|
-
declare function highlightTree(tree: Tree, highlighter: Highlighter | readonly Highlighter[],
|
|
4974
|
+
declare function highlightTree(tree: Tree$1, highlighter: Highlighter | readonly Highlighter[],
|
|
4952
4975
|
/**
|
|
4953
4976
|
Assign styling to a region of the text. Will be called, in order
|
|
4954
4977
|
of position, for any ranges where more than zero classes apply.
|
|
@@ -5379,7 +5402,7 @@ declare class Language {
|
|
|
5379
5402
|
The parser object. Can be useful when using this as a [nested
|
|
5380
5403
|
parser](https://lezer.codemirror.net/docs/ref#common.Parser).
|
|
5381
5404
|
*/
|
|
5382
|
-
parser: Parser;
|
|
5405
|
+
parser: Parser$1;
|
|
5383
5406
|
/**
|
|
5384
5407
|
Construct a language object. If you need to invoke this
|
|
5385
5408
|
directly, first define a data facet with
|
|
@@ -5394,7 +5417,7 @@ declare class Language {
|
|
|
5394
5417
|
*/
|
|
5395
5418
|
data: Facet<{
|
|
5396
5419
|
[name: string]: any;
|
|
5397
|
-
}>, parser: Parser, extraExtensions?: Extension[],
|
|
5420
|
+
}>, parser: Parser$1, extraExtensions?: Extension[],
|
|
5398
5421
|
/**
|
|
5399
5422
|
A language name.
|
|
5400
5423
|
*/
|
|
@@ -5461,13 +5484,13 @@ incomplete) parse tree of the active
|
|
|
5461
5484
|
[language](https://codemirror.net/6/docs/ref/#language.Language), or the empty tree if there is no
|
|
5462
5485
|
language available.
|
|
5463
5486
|
*/
|
|
5464
|
-
declare function syntaxTree(state: EditorState): Tree;
|
|
5487
|
+
declare function syntaxTree(state: EditorState): Tree$1;
|
|
5465
5488
|
/**
|
|
5466
5489
|
Try to get a parse tree that spans at least up to `upto`. The
|
|
5467
5490
|
method will do at most `timeout` milliseconds of work to parse
|
|
5468
5491
|
up to that point if the tree isn't already available.
|
|
5469
5492
|
*/
|
|
5470
|
-
declare function ensureSyntaxTree(state: EditorState, upto: number, timeout?: number): Tree | null;
|
|
5493
|
+
declare function ensureSyntaxTree(state: EditorState, upto: number, timeout?: number): Tree$1 | null;
|
|
5471
5494
|
/**
|
|
5472
5495
|
Move parsing forward, and update the editor state afterwards to
|
|
5473
5496
|
reflect the new tree. Will work for at most `timeout`
|
|
@@ -5815,7 +5838,7 @@ declare class HighlightStyle implements Highlighter {
|
|
|
5815
5838
|
*/
|
|
5816
5839
|
readonly module: StyleModule | null;
|
|
5817
5840
|
readonly style: (tags: readonly Tag[]) => string | null;
|
|
5818
|
-
readonly scope: ((type: NodeType) => boolean) | undefined;
|
|
5841
|
+
readonly scope: ((type: NodeType$1) => boolean) | undefined;
|
|
5819
5842
|
private constructor();
|
|
5820
5843
|
/**
|
|
5821
5844
|
Create a highlighter style that associates the given styles to
|
|
@@ -5838,7 +5861,7 @@ declare class HighlightStyle implements Highlighter {
|
|
|
5838
5861
|
scope them to a single language by providing the language
|
|
5839
5862
|
object or a language's top node type here.
|
|
5840
5863
|
*/
|
|
5841
|
-
scope?: Language | NodeType;
|
|
5864
|
+
scope?: Language | NodeType$1;
|
|
5842
5865
|
/**
|
|
5843
5866
|
Add a style to _all_ content. Probably only useful in
|
|
5844
5867
|
combination with `scope`.
|
|
@@ -6325,7 +6348,7 @@ declare class CompletionContext {
|
|
|
6325
6348
|
from: number;
|
|
6326
6349
|
to: number;
|
|
6327
6350
|
text: string;
|
|
6328
|
-
type: NodeType;
|
|
6351
|
+
type: NodeType$1;
|
|
6329
6352
|
} | null;
|
|
6330
6353
|
/**
|
|
6331
6354
|
Get the match of the given expression directly before the
|
|
@@ -6763,7 +6786,7 @@ declare namespace _codemirror_lang_vue {
|
|
|
6763
6786
|
export { vue$1 as vue, _codemirror_lang_vue_vueLanguage as vueLanguage };
|
|
6764
6787
|
}
|
|
6765
6788
|
|
|
6766
|
-
declare const parser: Parser
|
|
6789
|
+
declare const parser: Parser$1
|
|
6767
6790
|
|
|
6768
6791
|
declare const svelteLanguage: LRLanguage;
|
|
6769
6792
|
declare function svelte$1(): LanguageSupport;
|
|
@@ -6858,94 +6881,1189 @@ declare namespace _codemirror_lang_php {
|
|
|
6858
6881
|
}
|
|
6859
6882
|
|
|
6860
6883
|
/**
|
|
6861
|
-
|
|
6862
|
-
|
|
6884
|
+
The [`TreeFragment.applyChanges`](#common.TreeFragment^applyChanges)
|
|
6885
|
+
method expects changed ranges in this format.
|
|
6863
6886
|
*/
|
|
6864
|
-
|
|
6887
|
+
interface ChangedRange {
|
|
6865
6888
|
/**
|
|
6866
|
-
The start
|
|
6889
|
+
The start of the change in the start document
|
|
6867
6890
|
*/
|
|
6868
|
-
|
|
6891
|
+
fromA: number;
|
|
6869
6892
|
/**
|
|
6870
|
-
The
|
|
6893
|
+
The end of the change in the start document
|
|
6871
6894
|
*/
|
|
6872
|
-
|
|
6895
|
+
toA: number;
|
|
6873
6896
|
/**
|
|
6874
|
-
The
|
|
6897
|
+
The start of the replacement in the new document
|
|
6875
6898
|
*/
|
|
6876
|
-
|
|
6899
|
+
fromB: number;
|
|
6900
|
+
/**
|
|
6901
|
+
The end of the replacement in the new document
|
|
6902
|
+
*/
|
|
6903
|
+
toB: number;
|
|
6877
6904
|
}
|
|
6878
6905
|
/**
|
|
6879
|
-
|
|
6906
|
+
Tree fragments are used during [incremental
|
|
6907
|
+
parsing](#common.Parser.startParse) to track parts of old trees
|
|
6908
|
+
that can be reused in a new parse. An array of fragments is used
|
|
6909
|
+
to track regions of an old tree whose nodes might be reused in new
|
|
6910
|
+
parses. Use the static
|
|
6911
|
+
[`applyChanges`](#common.TreeFragment^applyChanges) method to
|
|
6912
|
+
update fragments for document changes.
|
|
6880
6913
|
*/
|
|
6881
|
-
declare class
|
|
6914
|
+
declare class TreeFragment {
|
|
6882
6915
|
/**
|
|
6883
|
-
The
|
|
6916
|
+
The start of the unchanged range pointed to by this fragment.
|
|
6917
|
+
This refers to an offset in the _updated_ document (as opposed
|
|
6918
|
+
to the original tree).
|
|
6884
6919
|
*/
|
|
6885
|
-
|
|
6920
|
+
readonly from: number;
|
|
6886
6921
|
/**
|
|
6887
|
-
The
|
|
6888
|
-
been handled so far).
|
|
6922
|
+
The end of the unchanged range.
|
|
6889
6923
|
*/
|
|
6890
|
-
|
|
6924
|
+
readonly to: number;
|
|
6891
6925
|
/**
|
|
6892
|
-
The
|
|
6926
|
+
The tree that this fragment is based on.
|
|
6893
6927
|
*/
|
|
6894
|
-
|
|
6928
|
+
readonly tree: Tree;
|
|
6895
6929
|
/**
|
|
6896
|
-
The
|
|
6897
|
-
|
|
6930
|
+
The offset between the fragment's tree and the document that
|
|
6931
|
+
this fragment can be used against. Add this when going from
|
|
6932
|
+
document to tree positions, subtract it to go from tree to
|
|
6933
|
+
document positions.
|
|
6898
6934
|
*/
|
|
6899
|
-
|
|
6935
|
+
readonly offset: number;
|
|
6900
6936
|
/**
|
|
6901
|
-
|
|
6937
|
+
Construct a tree fragment. You'll usually want to use
|
|
6938
|
+
[`addTree`](#common.TreeFragment^addTree) and
|
|
6939
|
+
[`applyChanges`](#common.TreeFragment^applyChanges) instead of
|
|
6940
|
+
calling this directly.
|
|
6902
6941
|
*/
|
|
6903
|
-
|
|
6942
|
+
constructor(
|
|
6904
6943
|
/**
|
|
6905
|
-
The
|
|
6944
|
+
The start of the unchanged range pointed to by this fragment.
|
|
6945
|
+
This refers to an offset in the _updated_ document (as opposed
|
|
6946
|
+
to the original tree).
|
|
6906
6947
|
*/
|
|
6907
|
-
|
|
6948
|
+
from: number,
|
|
6908
6949
|
/**
|
|
6909
|
-
|
|
6910
|
-
the next non-space character or the end of the line if there's
|
|
6911
|
-
only space after `from`.
|
|
6950
|
+
The end of the unchanged range.
|
|
6912
6951
|
*/
|
|
6913
|
-
|
|
6952
|
+
to: number,
|
|
6914
6953
|
/**
|
|
6915
|
-
|
|
6916
|
-
This should only be called by composite [block
|
|
6917
|
-
parsers](#BlockParser.parse) or [markup skipping
|
|
6918
|
-
functions](#NodeSpec.composite).
|
|
6954
|
+
The tree that this fragment is based on.
|
|
6919
6955
|
*/
|
|
6920
|
-
|
|
6956
|
+
tree: Tree,
|
|
6921
6957
|
/**
|
|
6922
|
-
|
|
6958
|
+
The offset between the fragment's tree and the document that
|
|
6959
|
+
this fragment can be used against. Add this when going from
|
|
6960
|
+
document to tree positions, subtract it to go from tree to
|
|
6961
|
+
document positions.
|
|
6923
6962
|
*/
|
|
6924
|
-
|
|
6963
|
+
offset: number, openStart?: boolean, openEnd?: boolean);
|
|
6925
6964
|
/**
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6965
|
+
Whether the start of the fragment represents the start of a
|
|
6966
|
+
parse, or the end of a change. (In the second case, it may not
|
|
6967
|
+
be safe to reuse some nodes at the start, depending on the
|
|
6968
|
+
parsing algorithm.)
|
|
6929
6969
|
*/
|
|
6930
|
-
|
|
6970
|
+
get openStart(): boolean;
|
|
6931
6971
|
/**
|
|
6932
|
-
|
|
6933
|
-
|
|
6972
|
+
Whether the end of the fragment represents the end of a
|
|
6973
|
+
full-document parse, or the start of a change.
|
|
6934
6974
|
*/
|
|
6935
|
-
|
|
6975
|
+
get openEnd(): boolean;
|
|
6936
6976
|
/**
|
|
6937
|
-
|
|
6977
|
+
Create a set of fragments from a freshly parsed tree, or update
|
|
6978
|
+
an existing set of fragments by replacing the ones that overlap
|
|
6979
|
+
with a tree with content from the new tree. When `partial` is
|
|
6980
|
+
true, the parse is treated as incomplete, and the resulting
|
|
6981
|
+
fragment has [`openEnd`](#common.TreeFragment.openEnd) set to
|
|
6982
|
+
true.
|
|
6938
6983
|
*/
|
|
6939
|
-
|
|
6984
|
+
static addTree(tree: Tree, fragments?: readonly TreeFragment[], partial?: boolean): readonly TreeFragment[];
|
|
6985
|
+
/**
|
|
6986
|
+
Apply a set of edits to an array of fragments, removing or
|
|
6987
|
+
splitting fragments as necessary to remove edited ranges, and
|
|
6988
|
+
adjusting offsets for fragments that moved.
|
|
6989
|
+
*/
|
|
6990
|
+
static applyChanges(fragments: readonly TreeFragment[], changes: readonly ChangedRange[], minGap?: number): readonly TreeFragment[];
|
|
6940
6991
|
}
|
|
6941
|
-
type BlockResult = boolean | null;
|
|
6942
6992
|
/**
|
|
6943
|
-
|
|
6993
|
+
Interface used to represent an in-progress parse, which can be
|
|
6994
|
+
moved forward piece-by-piece.
|
|
6944
6995
|
*/
|
|
6945
|
-
|
|
6996
|
+
interface PartialParse {
|
|
6946
6997
|
/**
|
|
6947
|
-
|
|
6948
|
-
|
|
6998
|
+
Advance the parse state by some amount. Will return the finished
|
|
6999
|
+
syntax tree when the parse completes.
|
|
7000
|
+
*/
|
|
7001
|
+
advance(): Tree | null;
|
|
7002
|
+
/**
|
|
7003
|
+
The position up to which the document has been parsed. Note
|
|
7004
|
+
that, in multi-pass parsers, this will stay back until the last
|
|
7005
|
+
pass has moved past a given position.
|
|
7006
|
+
*/
|
|
7007
|
+
readonly parsedPos: number;
|
|
7008
|
+
/**
|
|
7009
|
+
Tell the parse to not advance beyond the given position.
|
|
7010
|
+
`advance` will return a tree when the parse has reached the
|
|
7011
|
+
position. Note that, depending on the parser algorithm and the
|
|
7012
|
+
state of the parse when `stopAt` was called, that tree may
|
|
7013
|
+
contain nodes beyond the position. It is an error to call
|
|
7014
|
+
`stopAt` with a higher position than it's [current
|
|
7015
|
+
value](#common.PartialParse.stoppedAt).
|
|
7016
|
+
*/
|
|
7017
|
+
stopAt(pos: number): void;
|
|
7018
|
+
/**
|
|
7019
|
+
Reports whether `stopAt` has been called on this parse.
|
|
7020
|
+
*/
|
|
7021
|
+
readonly stoppedAt: number | null;
|
|
7022
|
+
}
|
|
7023
|
+
/**
|
|
7024
|
+
A superclass that parsers should extend.
|
|
7025
|
+
*/
|
|
7026
|
+
declare abstract class Parser {
|
|
7027
|
+
/**
|
|
7028
|
+
Start a parse for a single tree. This is the method concrete
|
|
7029
|
+
parser implementations must implement. Called by `startParse`,
|
|
7030
|
+
with the optional arguments resolved.
|
|
7031
|
+
*/
|
|
7032
|
+
abstract createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
|
|
7033
|
+
from: number;
|
|
7034
|
+
to: number;
|
|
7035
|
+
}[]): PartialParse;
|
|
7036
|
+
/**
|
|
7037
|
+
Start a parse, returning a [partial parse](#common.PartialParse)
|
|
7038
|
+
object. [`fragments`](#common.TreeFragment) can be passed in to
|
|
7039
|
+
make the parse incremental.
|
|
7040
|
+
|
|
7041
|
+
By default, the entire input is parsed. You can pass `ranges`,
|
|
7042
|
+
which should be a sorted array of non-empty, non-overlapping
|
|
7043
|
+
ranges, to parse only those ranges. The tree returned in that
|
|
7044
|
+
case will start at `ranges[0].from`.
|
|
7045
|
+
*/
|
|
7046
|
+
startParse(input: Input | string, fragments?: readonly TreeFragment[], ranges?: readonly {
|
|
7047
|
+
from: number;
|
|
7048
|
+
to: number;
|
|
7049
|
+
}[]): PartialParse;
|
|
7050
|
+
/**
|
|
7051
|
+
Run a full parse, returning the resulting tree.
|
|
7052
|
+
*/
|
|
7053
|
+
parse(input: Input | string, fragments?: readonly TreeFragment[], ranges?: readonly {
|
|
7054
|
+
from: number;
|
|
7055
|
+
to: number;
|
|
7056
|
+
}[]): Tree;
|
|
7057
|
+
}
|
|
7058
|
+
/**
|
|
7059
|
+
This is the interface parsers use to access the document. To run
|
|
7060
|
+
Lezer directly on your own document data structure, you have to
|
|
7061
|
+
write an implementation of it.
|
|
7062
|
+
*/
|
|
7063
|
+
interface Input {
|
|
7064
|
+
/**
|
|
7065
|
+
The length of the document.
|
|
7066
|
+
*/
|
|
7067
|
+
readonly length: number;
|
|
7068
|
+
/**
|
|
7069
|
+
Get the chunk after the given position. The returned string
|
|
7070
|
+
should start at `from` and, if that isn't the end of the
|
|
7071
|
+
document, may be of any length greater than zero.
|
|
7072
|
+
*/
|
|
7073
|
+
chunk(from: number): string;
|
|
7074
|
+
/**
|
|
7075
|
+
Indicates whether the chunks already end at line breaks, so that
|
|
7076
|
+
client code that wants to work by-line can avoid re-scanning
|
|
7077
|
+
them for line breaks. When this is true, the result of `chunk()`
|
|
7078
|
+
should either be a single line break, or the content between
|
|
7079
|
+
`from` and the next line break.
|
|
7080
|
+
*/
|
|
7081
|
+
readonly lineChunks: boolean;
|
|
7082
|
+
/**
|
|
7083
|
+
Read the part of the document between the given positions.
|
|
7084
|
+
*/
|
|
7085
|
+
read(from: number, to: number): string;
|
|
7086
|
+
}
|
|
7087
|
+
/**
|
|
7088
|
+
Parse wrapper functions are supported by some parsers to inject
|
|
7089
|
+
additional parsing logic.
|
|
7090
|
+
*/
|
|
7091
|
+
type ParseWrapper = (inner: PartialParse, input: Input, fragments: readonly TreeFragment[], ranges: readonly {
|
|
7092
|
+
from: number;
|
|
7093
|
+
to: number;
|
|
7094
|
+
}[]) => PartialParse;
|
|
7095
|
+
/**
|
|
7096
|
+
Each [node type](#common.NodeType) or [individual tree](#common.Tree)
|
|
7097
|
+
can have metadata associated with it in props. Instances of this
|
|
7098
|
+
class represent prop names.
|
|
7099
|
+
*/
|
|
7100
|
+
declare class NodeProp<T> {
|
|
7101
|
+
/**
|
|
7102
|
+
Indicates whether this prop is stored per [node
|
|
7103
|
+
type](#common.NodeType) or per [tree node](#common.Tree).
|
|
7104
|
+
*/
|
|
7105
|
+
perNode: boolean;
|
|
7106
|
+
/**
|
|
7107
|
+
A method that deserializes a value of this prop from a string.
|
|
7108
|
+
Can be used to allow a prop to be directly written in a grammar
|
|
7109
|
+
file.
|
|
7110
|
+
*/
|
|
7111
|
+
deserialize: (str: string) => T;
|
|
7112
|
+
/**
|
|
7113
|
+
Create a new node prop type.
|
|
7114
|
+
*/
|
|
7115
|
+
constructor(config?: {
|
|
7116
|
+
/**
|
|
7117
|
+
The [deserialize](#common.NodeProp.deserialize) function to
|
|
7118
|
+
use for this prop, used for example when directly providing
|
|
7119
|
+
the prop from a grammar file. Defaults to a function that
|
|
7120
|
+
raises an error.
|
|
7121
|
+
*/
|
|
7122
|
+
deserialize?: (str: string) => T;
|
|
7123
|
+
/**
|
|
7124
|
+
If configuring another value for this prop when it already
|
|
7125
|
+
exists on a node should combine the old and new values, rather
|
|
7126
|
+
than overwrite the old value, you can pass a function that
|
|
7127
|
+
does the combining here.
|
|
7128
|
+
*/
|
|
7129
|
+
combine?: (a: T, b: T) => T;
|
|
7130
|
+
/**
|
|
7131
|
+
By default, node props are stored in the [node
|
|
7132
|
+
type](#common.NodeType). It can sometimes be useful to directly
|
|
7133
|
+
store information (usually related to the parsing algorithm)
|
|
7134
|
+
in [nodes](#common.Tree) themselves. Set this to true to enable
|
|
7135
|
+
that for this prop.
|
|
7136
|
+
*/
|
|
7137
|
+
perNode?: boolean;
|
|
7138
|
+
});
|
|
7139
|
+
/**
|
|
7140
|
+
This is meant to be used with
|
|
7141
|
+
[`NodeSet.extend`](#common.NodeSet.extend) or
|
|
7142
|
+
[`LRParser.configure`](#lr.ParserConfig.props) to compute
|
|
7143
|
+
prop values for each node type in the set. Takes a [match
|
|
7144
|
+
object](#common.NodeType^match) or function that returns undefined
|
|
7145
|
+
if the node type doesn't get this prop, and the prop's value if
|
|
7146
|
+
it does.
|
|
7147
|
+
*/
|
|
7148
|
+
add(match: {
|
|
7149
|
+
[selector: string]: T;
|
|
7150
|
+
} | ((type: NodeType) => T | undefined)): NodePropSource;
|
|
7151
|
+
/**
|
|
7152
|
+
Prop that is used to describe matching delimiters. For opening
|
|
7153
|
+
delimiters, this holds an array of node names (written as a
|
|
7154
|
+
space-separated string when declaring this prop in a grammar)
|
|
7155
|
+
for the node types of closing delimiters that match it.
|
|
7156
|
+
*/
|
|
7157
|
+
static closedBy: NodeProp<readonly string[]>;
|
|
7158
|
+
/**
|
|
7159
|
+
The inverse of [`closedBy`](#common.NodeProp^closedBy). This is
|
|
7160
|
+
attached to closing delimiters, holding an array of node names
|
|
7161
|
+
of types of matching opening delimiters.
|
|
7162
|
+
*/
|
|
7163
|
+
static openedBy: NodeProp<readonly string[]>;
|
|
7164
|
+
/**
|
|
7165
|
+
Used to assign node types to groups (for example, all node
|
|
7166
|
+
types that represent an expression could be tagged with an
|
|
7167
|
+
`"Expression"` group).
|
|
7168
|
+
*/
|
|
7169
|
+
static group: NodeProp<readonly string[]>;
|
|
7170
|
+
/**
|
|
7171
|
+
Attached to nodes to indicate these should be
|
|
7172
|
+
[displayed](https://codemirror.net/docs/ref/#language.syntaxTree)
|
|
7173
|
+
in a bidirectional text isolate, so that direction-neutral
|
|
7174
|
+
characters on their sides don't incorrectly get associated with
|
|
7175
|
+
surrounding text. You'll generally want to set this for nodes
|
|
7176
|
+
that contain arbitrary text, like strings and comments, and for
|
|
7177
|
+
nodes that appear _inside_ arbitrary text, like HTML tags. When
|
|
7178
|
+
not given a value, in a grammar declaration, defaults to
|
|
7179
|
+
`"auto"`.
|
|
7180
|
+
*/
|
|
7181
|
+
static isolate: NodeProp<"rtl" | "ltr" | "auto">;
|
|
7182
|
+
/**
|
|
7183
|
+
The hash of the [context](#lr.ContextTracker.constructor)
|
|
7184
|
+
that the node was parsed in, if any. Used to limit reuse of
|
|
7185
|
+
contextual nodes.
|
|
7186
|
+
*/
|
|
7187
|
+
static contextHash: NodeProp<number>;
|
|
7188
|
+
/**
|
|
7189
|
+
The distance beyond the end of the node that the tokenizer
|
|
7190
|
+
looked ahead for any of the tokens inside the node. (The LR
|
|
7191
|
+
parser only stores this when it is larger than 25, for
|
|
7192
|
+
efficiency reasons.)
|
|
7193
|
+
*/
|
|
7194
|
+
static lookAhead: NodeProp<number>;
|
|
7195
|
+
/**
|
|
7196
|
+
This per-node prop is used to replace a given node, or part of a
|
|
7197
|
+
node, with another tree. This is useful to include trees from
|
|
7198
|
+
different languages in mixed-language parsers.
|
|
7199
|
+
*/
|
|
7200
|
+
static mounted: NodeProp<MountedTree>;
|
|
7201
|
+
}
|
|
7202
|
+
/**
|
|
7203
|
+
A mounted tree, which can be [stored](#common.NodeProp^mounted) on
|
|
7204
|
+
a tree node to indicate that parts of its content are
|
|
7205
|
+
represented by another tree.
|
|
7206
|
+
*/
|
|
7207
|
+
declare class MountedTree {
|
|
7208
|
+
/**
|
|
7209
|
+
The inner tree.
|
|
7210
|
+
*/
|
|
7211
|
+
readonly tree: Tree;
|
|
7212
|
+
/**
|
|
7213
|
+
If this is null, this tree replaces the entire node (it will
|
|
7214
|
+
be included in the regular iteration instead of its host
|
|
7215
|
+
node). If not, only the given ranges are considered to be
|
|
7216
|
+
covered by this tree. This is used for trees that are mixed in
|
|
7217
|
+
a way that isn't strictly hierarchical. Such mounted trees are
|
|
7218
|
+
only entered by [`resolveInner`](#common.Tree.resolveInner)
|
|
7219
|
+
and [`enter`](#common.SyntaxNode.enter).
|
|
7220
|
+
*/
|
|
7221
|
+
readonly overlay: readonly {
|
|
7222
|
+
from: number;
|
|
7223
|
+
to: number;
|
|
7224
|
+
}[] | null;
|
|
7225
|
+
/**
|
|
7226
|
+
The parser used to create this subtree.
|
|
7227
|
+
*/
|
|
7228
|
+
readonly parser: Parser;
|
|
7229
|
+
/**
|
|
7230
|
+
[Indicates](#common.IterMode.EnterBracketed) that the nested
|
|
7231
|
+
content is delineated with some kind
|
|
7232
|
+
of bracket token.
|
|
7233
|
+
*/
|
|
7234
|
+
readonly bracketed: boolean;
|
|
7235
|
+
constructor(
|
|
7236
|
+
/**
|
|
7237
|
+
The inner tree.
|
|
7238
|
+
*/
|
|
7239
|
+
tree: Tree,
|
|
7240
|
+
/**
|
|
7241
|
+
If this is null, this tree replaces the entire node (it will
|
|
7242
|
+
be included in the regular iteration instead of its host
|
|
7243
|
+
node). If not, only the given ranges are considered to be
|
|
7244
|
+
covered by this tree. This is used for trees that are mixed in
|
|
7245
|
+
a way that isn't strictly hierarchical. Such mounted trees are
|
|
7246
|
+
only entered by [`resolveInner`](#common.Tree.resolveInner)
|
|
7247
|
+
and [`enter`](#common.SyntaxNode.enter).
|
|
7248
|
+
*/
|
|
7249
|
+
overlay: readonly {
|
|
7250
|
+
from: number;
|
|
7251
|
+
to: number;
|
|
7252
|
+
}[] | null,
|
|
7253
|
+
/**
|
|
7254
|
+
The parser used to create this subtree.
|
|
7255
|
+
*/
|
|
7256
|
+
parser: Parser,
|
|
7257
|
+
/**
|
|
7258
|
+
[Indicates](#common.IterMode.EnterBracketed) that the nested
|
|
7259
|
+
content is delineated with some kind
|
|
7260
|
+
of bracket token.
|
|
7261
|
+
*/
|
|
7262
|
+
bracketed?: boolean);
|
|
7263
|
+
}
|
|
7264
|
+
/**
|
|
7265
|
+
Type returned by [`NodeProp.add`](#common.NodeProp.add). Describes
|
|
7266
|
+
whether a prop should be added to a given node type in a node set,
|
|
7267
|
+
and what value it should have.
|
|
7268
|
+
*/
|
|
7269
|
+
type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any];
|
|
7270
|
+
/**
|
|
7271
|
+
Each node in a syntax tree has a node type associated with it.
|
|
7272
|
+
*/
|
|
7273
|
+
declare class NodeType {
|
|
7274
|
+
/**
|
|
7275
|
+
The name of the node type. Not necessarily unique, but if the
|
|
7276
|
+
grammar was written properly, different node types with the
|
|
7277
|
+
same name within a node set should play the same semantic
|
|
7278
|
+
role.
|
|
7279
|
+
*/
|
|
7280
|
+
readonly name: string;
|
|
7281
|
+
/**
|
|
7282
|
+
The id of this node in its set. Corresponds to the term ids
|
|
7283
|
+
used in the parser.
|
|
7284
|
+
*/
|
|
7285
|
+
readonly id: number;
|
|
7286
|
+
/**
|
|
7287
|
+
Define a node type.
|
|
7288
|
+
*/
|
|
7289
|
+
static define(spec: {
|
|
7290
|
+
/**
|
|
7291
|
+
The ID of the node type. When this type is used in a
|
|
7292
|
+
[set](#common.NodeSet), the ID must correspond to its index in
|
|
7293
|
+
the type array.
|
|
7294
|
+
*/
|
|
7295
|
+
id: number;
|
|
7296
|
+
/**
|
|
7297
|
+
The name of the node type. Leave empty to define an anonymous
|
|
7298
|
+
node.
|
|
7299
|
+
*/
|
|
7300
|
+
name?: string;
|
|
7301
|
+
/**
|
|
7302
|
+
[Node props](#common.NodeProp) to assign to the type. The value
|
|
7303
|
+
given for any given prop should correspond to the prop's type.
|
|
7304
|
+
*/
|
|
7305
|
+
props?: readonly ([NodeProp<any>, any] | NodePropSource)[];
|
|
7306
|
+
/**
|
|
7307
|
+
Whether this is a [top node](#common.NodeType.isTop).
|
|
7308
|
+
*/
|
|
7309
|
+
top?: boolean;
|
|
7310
|
+
/**
|
|
7311
|
+
Whether this node counts as an [error
|
|
7312
|
+
node](#common.NodeType.isError).
|
|
7313
|
+
*/
|
|
7314
|
+
error?: boolean;
|
|
7315
|
+
/**
|
|
7316
|
+
Whether this node is a [skipped](#common.NodeType.isSkipped)
|
|
7317
|
+
node.
|
|
7318
|
+
*/
|
|
7319
|
+
skipped?: boolean;
|
|
7320
|
+
}): NodeType;
|
|
7321
|
+
/**
|
|
7322
|
+
Retrieves a node prop for this type. Will return `undefined` if
|
|
7323
|
+
the prop isn't present on this node.
|
|
7324
|
+
*/
|
|
7325
|
+
prop<T>(prop: NodeProp<T>): T | undefined;
|
|
7326
|
+
/**
|
|
7327
|
+
True when this is the top node of a grammar.
|
|
7328
|
+
*/
|
|
7329
|
+
get isTop(): boolean;
|
|
7330
|
+
/**
|
|
7331
|
+
True when this node is produced by a skip rule.
|
|
7332
|
+
*/
|
|
7333
|
+
get isSkipped(): boolean;
|
|
7334
|
+
/**
|
|
7335
|
+
Indicates whether this is an error node.
|
|
7336
|
+
*/
|
|
7337
|
+
get isError(): boolean;
|
|
7338
|
+
/**
|
|
7339
|
+
When true, this node type doesn't correspond to a user-declared
|
|
7340
|
+
named node, for example because it is used to cache repetition.
|
|
7341
|
+
*/
|
|
7342
|
+
get isAnonymous(): boolean;
|
|
7343
|
+
/**
|
|
7344
|
+
Returns true when this node's name or one of its
|
|
7345
|
+
[groups](#common.NodeProp^group) matches the given string.
|
|
7346
|
+
*/
|
|
7347
|
+
is(name: string | number): boolean;
|
|
7348
|
+
/**
|
|
7349
|
+
An empty dummy node type to use when no actual type is available.
|
|
7350
|
+
*/
|
|
7351
|
+
static none: NodeType;
|
|
7352
|
+
/**
|
|
7353
|
+
Create a function from node types to arbitrary values by
|
|
7354
|
+
specifying an object whose property names are node or
|
|
7355
|
+
[group](#common.NodeProp^group) names. Often useful with
|
|
7356
|
+
[`NodeProp.add`](#common.NodeProp.add). You can put multiple
|
|
7357
|
+
names, separated by spaces, in a single property name to map
|
|
7358
|
+
multiple node names to a single value.
|
|
7359
|
+
*/
|
|
7360
|
+
static match<T>(map: {
|
|
7361
|
+
[selector: string]: T;
|
|
7362
|
+
}): (node: NodeType) => T | undefined;
|
|
7363
|
+
}
|
|
7364
|
+
/**
|
|
7365
|
+
A node set holds a collection of node types. It is used to
|
|
7366
|
+
compactly represent trees by storing their type ids, rather than a
|
|
7367
|
+
full pointer to the type object, in a numeric array. Each parser
|
|
7368
|
+
[has](#lr.LRParser.nodeSet) a node set, and [tree
|
|
7369
|
+
buffers](#common.TreeBuffer) can only store collections of nodes
|
|
7370
|
+
from the same set. A set can have a maximum of 2**16 (65536) node
|
|
7371
|
+
types in it, so that the ids fit into 16-bit typed array slots.
|
|
7372
|
+
*/
|
|
7373
|
+
declare class NodeSet {
|
|
7374
|
+
/**
|
|
7375
|
+
The node types in this set, by id.
|
|
7376
|
+
*/
|
|
7377
|
+
readonly types: readonly NodeType[];
|
|
7378
|
+
/**
|
|
7379
|
+
Create a set with the given types. The `id` property of each
|
|
7380
|
+
type should correspond to its position within the array.
|
|
7381
|
+
*/
|
|
7382
|
+
constructor(
|
|
7383
|
+
/**
|
|
7384
|
+
The node types in this set, by id.
|
|
7385
|
+
*/
|
|
7386
|
+
types: readonly NodeType[]);
|
|
7387
|
+
/**
|
|
7388
|
+
Create a copy of this set with some node properties added. The
|
|
7389
|
+
arguments to this method can be created with
|
|
7390
|
+
[`NodeProp.add`](#common.NodeProp.add).
|
|
7391
|
+
*/
|
|
7392
|
+
extend(...props: NodePropSource[]): NodeSet;
|
|
7393
|
+
}
|
|
7394
|
+
/**
|
|
7395
|
+
Options that control iteration. Can be combined with the `|`
|
|
7396
|
+
operator to enable multiple ones.
|
|
7397
|
+
*/
|
|
7398
|
+
declare enum IterMode {
|
|
7399
|
+
/**
|
|
7400
|
+
When enabled, iteration will only visit [`Tree`](#common.Tree)
|
|
7401
|
+
objects, not nodes packed into
|
|
7402
|
+
[`TreeBuffer`](#common.TreeBuffer)s.
|
|
7403
|
+
*/
|
|
7404
|
+
ExcludeBuffers = 1,
|
|
7405
|
+
/**
|
|
7406
|
+
Enable this to make iteration include anonymous nodes (such as
|
|
7407
|
+
the nodes that wrap repeated grammar constructs into a balanced
|
|
7408
|
+
tree).
|
|
7409
|
+
*/
|
|
7410
|
+
IncludeAnonymous = 2,
|
|
7411
|
+
/**
|
|
7412
|
+
By default, regular [mounted](#common.NodeProp^mounted) nodes
|
|
7413
|
+
replace their base node in iteration. Enable this to ignore them
|
|
7414
|
+
instead.
|
|
7415
|
+
*/
|
|
7416
|
+
IgnoreMounts = 4,
|
|
7417
|
+
/**
|
|
7418
|
+
This option only applies in
|
|
7419
|
+
[`enter`](#common.SyntaxNode.enter)-style methods. It tells the
|
|
7420
|
+
library to not enter mounted overlays if one covers the given
|
|
7421
|
+
position.
|
|
7422
|
+
*/
|
|
7423
|
+
IgnoreOverlays = 8,
|
|
7424
|
+
/**
|
|
7425
|
+
When set, positions on the boundary of a mounted overlay tree
|
|
7426
|
+
that has its [`bracketed`](#common.NestedParse.bracketed) flag
|
|
7427
|
+
set will enter that tree regardless of side. Only supported in
|
|
7428
|
+
[`enter`](#common.SyntaxNode.enter), not in cursors.
|
|
7429
|
+
*/
|
|
7430
|
+
EnterBracketed = 16
|
|
7431
|
+
}
|
|
7432
|
+
/**
|
|
7433
|
+
A piece of syntax tree. There are two ways to approach these
|
|
7434
|
+
trees: the way they are actually stored in memory, and the
|
|
7435
|
+
convenient way.
|
|
7436
|
+
|
|
7437
|
+
Syntax trees are stored as a tree of `Tree` and `TreeBuffer`
|
|
7438
|
+
objects. By packing detail information into `TreeBuffer` leaf
|
|
7439
|
+
nodes, the representation is made a lot more memory-efficient.
|
|
7440
|
+
|
|
7441
|
+
However, when you want to actually work with tree nodes, this
|
|
7442
|
+
representation is very awkward, so most client code will want to
|
|
7443
|
+
use the [`TreeCursor`](#common.TreeCursor) or
|
|
7444
|
+
[`SyntaxNode`](#common.SyntaxNode) interface instead, which provides
|
|
7445
|
+
a view on some part of this data structure, and can be used to
|
|
7446
|
+
move around to adjacent nodes.
|
|
7447
|
+
*/
|
|
7448
|
+
declare class Tree {
|
|
7449
|
+
/**
|
|
7450
|
+
The type of the top node.
|
|
7451
|
+
*/
|
|
7452
|
+
readonly type: NodeType;
|
|
7453
|
+
/**
|
|
7454
|
+
This node's child nodes.
|
|
7455
|
+
*/
|
|
7456
|
+
readonly children: readonly (Tree | TreeBuffer)[];
|
|
7457
|
+
/**
|
|
7458
|
+
The positions (offsets relative to the start of this tree) of
|
|
7459
|
+
the children.
|
|
7460
|
+
*/
|
|
7461
|
+
readonly positions: readonly number[];
|
|
7462
|
+
/**
|
|
7463
|
+
The total length of this tree
|
|
7464
|
+
*/
|
|
7465
|
+
readonly length: number;
|
|
7466
|
+
/**
|
|
7467
|
+
Construct a new tree. See also [`Tree.build`](#common.Tree^build).
|
|
7468
|
+
*/
|
|
7469
|
+
constructor(
|
|
7470
|
+
/**
|
|
7471
|
+
The type of the top node.
|
|
7472
|
+
*/
|
|
7473
|
+
type: NodeType,
|
|
7474
|
+
/**
|
|
7475
|
+
This node's child nodes.
|
|
7476
|
+
*/
|
|
7477
|
+
children: readonly (Tree | TreeBuffer)[],
|
|
7478
|
+
/**
|
|
7479
|
+
The positions (offsets relative to the start of this tree) of
|
|
7480
|
+
the children.
|
|
7481
|
+
*/
|
|
7482
|
+
positions: readonly number[],
|
|
7483
|
+
/**
|
|
7484
|
+
The total length of this tree
|
|
7485
|
+
*/
|
|
7486
|
+
length: number,
|
|
7487
|
+
/**
|
|
7488
|
+
Per-node [node props](#common.NodeProp) to associate with this node.
|
|
7489
|
+
*/
|
|
7490
|
+
props?: readonly [NodeProp<any> | number, any][]);
|
|
7491
|
+
/**
|
|
7492
|
+
The empty tree
|
|
7493
|
+
*/
|
|
7494
|
+
static empty: Tree;
|
|
7495
|
+
/**
|
|
7496
|
+
Get a [tree cursor](#common.TreeCursor) positioned at the top of
|
|
7497
|
+
the tree. Mode can be used to [control](#common.IterMode) which
|
|
7498
|
+
nodes the cursor visits.
|
|
7499
|
+
*/
|
|
7500
|
+
cursor(mode?: IterMode): TreeCursor;
|
|
7501
|
+
/**
|
|
7502
|
+
Get a [tree cursor](#common.TreeCursor) pointing into this tree
|
|
7503
|
+
at the given position and side (see
|
|
7504
|
+
[`moveTo`](#common.TreeCursor.moveTo).
|
|
7505
|
+
*/
|
|
7506
|
+
cursorAt(pos: number, side?: -1 | 0 | 1, mode?: IterMode): TreeCursor;
|
|
7507
|
+
/**
|
|
7508
|
+
Get a [syntax node](#common.SyntaxNode) object for the top of the
|
|
7509
|
+
tree.
|
|
7510
|
+
*/
|
|
7511
|
+
get topNode(): SyntaxNode;
|
|
7512
|
+
/**
|
|
7513
|
+
Get the [syntax node](#common.SyntaxNode) at the given position.
|
|
7514
|
+
If `side` is -1, this will move into nodes that end at the
|
|
7515
|
+
position. If 1, it'll move into nodes that start at the
|
|
7516
|
+
position. With 0, it'll only enter nodes that cover the position
|
|
7517
|
+
from both sides.
|
|
7518
|
+
|
|
7519
|
+
Note that this will not enter
|
|
7520
|
+
[overlays](#common.MountedTree.overlay), and you often want
|
|
7521
|
+
[`resolveInner`](#common.Tree.resolveInner) instead.
|
|
7522
|
+
*/
|
|
7523
|
+
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
7524
|
+
/**
|
|
7525
|
+
Like [`resolve`](#common.Tree.resolve), but will enter
|
|
7526
|
+
[overlaid](#common.MountedTree.overlay) nodes, producing a syntax node
|
|
7527
|
+
pointing into the innermost overlaid tree at the given position
|
|
7528
|
+
(with parent links going through all parent structure, including
|
|
7529
|
+
the host trees).
|
|
7530
|
+
*/
|
|
7531
|
+
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
7532
|
+
/**
|
|
7533
|
+
In some situations, it can be useful to iterate through all
|
|
7534
|
+
nodes around a position, including those in overlays that don't
|
|
7535
|
+
directly cover the position. This method gives you an iterator
|
|
7536
|
+
that will produce all nodes, from small to big, around the given
|
|
7537
|
+
position.
|
|
7538
|
+
*/
|
|
7539
|
+
resolveStack(pos: number, side?: -1 | 0 | 1): NodeIterator;
|
|
7540
|
+
/**
|
|
7541
|
+
Iterate over the tree and its children, calling `enter` for any
|
|
7542
|
+
node that touches the `from`/`to` region (if given) before
|
|
7543
|
+
running over such a node's children, and `leave` (if given) when
|
|
7544
|
+
leaving the node. When `enter` returns `false`, that node will
|
|
7545
|
+
not have its children iterated over (or `leave` called).
|
|
7546
|
+
*/
|
|
7547
|
+
iterate(spec: {
|
|
7548
|
+
enter(node: SyntaxNodeRef): boolean | void;
|
|
7549
|
+
leave?(node: SyntaxNodeRef): void;
|
|
7550
|
+
from?: number;
|
|
7551
|
+
to?: number;
|
|
7552
|
+
mode?: IterMode;
|
|
7553
|
+
}): void;
|
|
7554
|
+
/**
|
|
7555
|
+
Get the value of the given [node prop](#common.NodeProp) for this
|
|
7556
|
+
node. Works with both per-node and per-type props.
|
|
7557
|
+
*/
|
|
7558
|
+
prop<T>(prop: NodeProp<T>): T | undefined;
|
|
7559
|
+
/**
|
|
7560
|
+
Returns the node's [per-node props](#common.NodeProp.perNode) in a
|
|
7561
|
+
format that can be passed to the [`Tree`](#common.Tree)
|
|
7562
|
+
constructor.
|
|
7563
|
+
*/
|
|
7564
|
+
get propValues(): readonly [NodeProp<any> | number, any][];
|
|
7565
|
+
/**
|
|
7566
|
+
Balance the direct children of this tree, producing a copy of
|
|
7567
|
+
which may have children grouped into subtrees with type
|
|
7568
|
+
[`NodeType.none`](#common.NodeType^none).
|
|
7569
|
+
*/
|
|
7570
|
+
balance(config?: {
|
|
7571
|
+
/**
|
|
7572
|
+
Function to create the newly balanced subtrees.
|
|
7573
|
+
*/
|
|
7574
|
+
makeTree?: (children: readonly (Tree | TreeBuffer)[], positions: readonly number[], length: number) => Tree;
|
|
7575
|
+
}): Tree;
|
|
7576
|
+
/**
|
|
7577
|
+
Build a tree from a postfix-ordered buffer of node information,
|
|
7578
|
+
or a cursor over such a buffer.
|
|
7579
|
+
*/
|
|
7580
|
+
static build(data: BuildData): Tree;
|
|
7581
|
+
}
|
|
7582
|
+
/**
|
|
7583
|
+
Represents a sequence of nodes.
|
|
7584
|
+
*/
|
|
7585
|
+
type NodeIterator = {
|
|
7586
|
+
node: SyntaxNode;
|
|
7587
|
+
next: NodeIterator | null;
|
|
7588
|
+
};
|
|
7589
|
+
type BuildData = {
|
|
7590
|
+
/**
|
|
7591
|
+
The buffer or buffer cursor to read the node data from.
|
|
7592
|
+
|
|
7593
|
+
When this is an array, it should contain four values for every
|
|
7594
|
+
node in the tree.
|
|
7595
|
+
|
|
7596
|
+
- The first holds the node's type, as a node ID pointing into
|
|
7597
|
+
the given `NodeSet`.
|
|
7598
|
+
- The second holds the node's start offset.
|
|
7599
|
+
- The third the end offset.
|
|
7600
|
+
- The fourth the amount of space taken up in the array by this
|
|
7601
|
+
node and its children. Since there's four values per node,
|
|
7602
|
+
this is the total number of nodes inside this node (children
|
|
7603
|
+
and transitive children) plus one for the node itself, times
|
|
7604
|
+
four.
|
|
7605
|
+
|
|
7606
|
+
Parent nodes should appear _after_ child nodes in the array. As
|
|
7607
|
+
an example, a node of type 10 spanning positions 0 to 4, with
|
|
7608
|
+
two children, of type 11 and 12, might look like this:
|
|
7609
|
+
|
|
7610
|
+
[11, 0, 1, 4, 12, 2, 4, 4, 10, 0, 4, 12]
|
|
7611
|
+
*/
|
|
7612
|
+
buffer: BufferCursor | readonly number[];
|
|
7613
|
+
/**
|
|
7614
|
+
The node types to use.
|
|
7615
|
+
*/
|
|
7616
|
+
nodeSet: NodeSet;
|
|
7617
|
+
/**
|
|
7618
|
+
The id of the top node type.
|
|
7619
|
+
*/
|
|
7620
|
+
topID: number;
|
|
7621
|
+
/**
|
|
7622
|
+
The position the tree should start at. Defaults to 0.
|
|
7623
|
+
*/
|
|
7624
|
+
start?: number;
|
|
7625
|
+
/**
|
|
7626
|
+
The position in the buffer where the function should stop
|
|
7627
|
+
reading. Defaults to 0.
|
|
7628
|
+
*/
|
|
7629
|
+
bufferStart?: number;
|
|
7630
|
+
/**
|
|
7631
|
+
The length of the wrapping node. The end offset of the last
|
|
7632
|
+
child is used when not provided.
|
|
7633
|
+
*/
|
|
7634
|
+
length?: number;
|
|
7635
|
+
/**
|
|
7636
|
+
The maximum buffer length to use. Defaults to
|
|
7637
|
+
[`DefaultBufferLength`](#common.DefaultBufferLength).
|
|
7638
|
+
*/
|
|
7639
|
+
maxBufferLength?: number;
|
|
7640
|
+
/**
|
|
7641
|
+
An optional array holding reused nodes that the buffer can refer
|
|
7642
|
+
to.
|
|
7643
|
+
*/
|
|
7644
|
+
reused?: readonly Tree[];
|
|
7645
|
+
/**
|
|
7646
|
+
The first node type that indicates repeat constructs in this
|
|
7647
|
+
grammar.
|
|
7648
|
+
*/
|
|
7649
|
+
minRepeatType?: number;
|
|
7650
|
+
};
|
|
7651
|
+
/**
|
|
7652
|
+
This is used by `Tree.build` as an abstraction for iterating over
|
|
7653
|
+
a tree buffer. A cursor initially points at the very last element
|
|
7654
|
+
in the buffer. Every time `next()` is called it moves on to the
|
|
7655
|
+
previous one.
|
|
7656
|
+
*/
|
|
7657
|
+
interface BufferCursor {
|
|
7658
|
+
/**
|
|
7659
|
+
The current buffer position (four times the number of nodes
|
|
7660
|
+
remaining).
|
|
7661
|
+
*/
|
|
7662
|
+
pos: number;
|
|
7663
|
+
/**
|
|
7664
|
+
The node ID of the next node in the buffer.
|
|
7665
|
+
*/
|
|
7666
|
+
id: number;
|
|
7667
|
+
/**
|
|
7668
|
+
The start position of the next node in the buffer.
|
|
7669
|
+
*/
|
|
7670
|
+
start: number;
|
|
7671
|
+
/**
|
|
7672
|
+
The end position of the next node.
|
|
7673
|
+
*/
|
|
7674
|
+
end: number;
|
|
7675
|
+
/**
|
|
7676
|
+
The size of the next node (the number of nodes inside, counting
|
|
7677
|
+
the node itself, times 4).
|
|
7678
|
+
*/
|
|
7679
|
+
size: number;
|
|
7680
|
+
/**
|
|
7681
|
+
Moves `this.pos` down by 4.
|
|
7682
|
+
*/
|
|
7683
|
+
next(): void;
|
|
7684
|
+
/**
|
|
7685
|
+
Create a copy of this cursor.
|
|
7686
|
+
*/
|
|
7687
|
+
fork(): BufferCursor;
|
|
7688
|
+
}
|
|
7689
|
+
/**
|
|
7690
|
+
Tree buffers contain (type, start, end, endIndex) quads for each
|
|
7691
|
+
node. In such a buffer, nodes are stored in prefix order (parents
|
|
7692
|
+
before children, with the endIndex of the parent indicating which
|
|
7693
|
+
children belong to it).
|
|
7694
|
+
*/
|
|
7695
|
+
declare class TreeBuffer {
|
|
7696
|
+
/**
|
|
7697
|
+
The buffer's content.
|
|
7698
|
+
*/
|
|
7699
|
+
readonly buffer: Uint16Array;
|
|
7700
|
+
/**
|
|
7701
|
+
The total length of the group of nodes in the buffer.
|
|
7702
|
+
*/
|
|
7703
|
+
readonly length: number;
|
|
7704
|
+
/**
|
|
7705
|
+
The node set used in this buffer.
|
|
7706
|
+
*/
|
|
7707
|
+
readonly set: NodeSet;
|
|
7708
|
+
/**
|
|
7709
|
+
Create a tree buffer.
|
|
7710
|
+
*/
|
|
7711
|
+
constructor(
|
|
7712
|
+
/**
|
|
7713
|
+
The buffer's content.
|
|
7714
|
+
*/
|
|
7715
|
+
buffer: Uint16Array,
|
|
7716
|
+
/**
|
|
7717
|
+
The total length of the group of nodes in the buffer.
|
|
7718
|
+
*/
|
|
7719
|
+
length: number,
|
|
7720
|
+
/**
|
|
7721
|
+
The node set used in this buffer.
|
|
7722
|
+
*/
|
|
7723
|
+
set: NodeSet);
|
|
7724
|
+
}
|
|
7725
|
+
/**
|
|
7726
|
+
The set of properties provided by both [`SyntaxNode`](#common.SyntaxNode)
|
|
7727
|
+
and [`TreeCursor`](#common.TreeCursor). Note that, if you need
|
|
7728
|
+
an object that is guaranteed to stay stable in the future, you
|
|
7729
|
+
need to use the [`node`](#common.SyntaxNodeRef.node) accessor.
|
|
7730
|
+
*/
|
|
7731
|
+
interface SyntaxNodeRef {
|
|
7732
|
+
/**
|
|
7733
|
+
The start position of the node.
|
|
7734
|
+
*/
|
|
7735
|
+
readonly from: number;
|
|
7736
|
+
/**
|
|
7737
|
+
The end position of the node.
|
|
7738
|
+
*/
|
|
7739
|
+
readonly to: number;
|
|
7740
|
+
/**
|
|
7741
|
+
The type of the node.
|
|
7742
|
+
*/
|
|
7743
|
+
readonly type: NodeType;
|
|
7744
|
+
/**
|
|
7745
|
+
The name of the node (`.type.name`).
|
|
7746
|
+
*/
|
|
7747
|
+
readonly name: string;
|
|
7748
|
+
/**
|
|
7749
|
+
Get the [tree](#common.Tree) that represents the current node,
|
|
7750
|
+
if any. Will return null when the node is in a [tree
|
|
7751
|
+
buffer](#common.TreeBuffer).
|
|
7752
|
+
*/
|
|
7753
|
+
readonly tree: Tree | null;
|
|
7754
|
+
/**
|
|
7755
|
+
Retrieve a stable [syntax node](#common.SyntaxNode) at this
|
|
7756
|
+
position.
|
|
7757
|
+
*/
|
|
7758
|
+
readonly node: SyntaxNode;
|
|
7759
|
+
/**
|
|
7760
|
+
Test whether the node matches a given context—a sequence of
|
|
7761
|
+
direct parent nodes. Empty strings in the context array act as
|
|
7762
|
+
wildcards, other strings must match the ancestor node's name.
|
|
7763
|
+
*/
|
|
7764
|
+
matchContext(context: readonly string[]): boolean;
|
|
7765
|
+
}
|
|
7766
|
+
/**
|
|
7767
|
+
A syntax node provides an immutable pointer to a given node in a
|
|
7768
|
+
tree. When iterating over large amounts of nodes, you may want to
|
|
7769
|
+
use a mutable [cursor](#common.TreeCursor) instead, which is more
|
|
7770
|
+
efficient.
|
|
7771
|
+
*/
|
|
7772
|
+
interface SyntaxNode extends SyntaxNodeRef {
|
|
7773
|
+
/**
|
|
7774
|
+
The node's parent node, if any.
|
|
7775
|
+
*/
|
|
7776
|
+
parent: SyntaxNode | null;
|
|
7777
|
+
/**
|
|
7778
|
+
The first child, if the node has children.
|
|
7779
|
+
*/
|
|
7780
|
+
firstChild: SyntaxNode | null;
|
|
7781
|
+
/**
|
|
7782
|
+
The node's last child, if available.
|
|
7783
|
+
*/
|
|
7784
|
+
lastChild: SyntaxNode | null;
|
|
7785
|
+
/**
|
|
7786
|
+
The first child that ends after `pos`.
|
|
7787
|
+
*/
|
|
7788
|
+
childAfter(pos: number): SyntaxNode | null;
|
|
7789
|
+
/**
|
|
7790
|
+
The last child that starts before `pos`.
|
|
7791
|
+
*/
|
|
7792
|
+
childBefore(pos: number): SyntaxNode | null;
|
|
7793
|
+
/**
|
|
7794
|
+
Enter the child at the given position. If side is -1 the child
|
|
7795
|
+
may end at that position, when 1 it may start there.
|
|
7796
|
+
|
|
7797
|
+
This will by default enter
|
|
7798
|
+
[overlaid](#common.MountedTree.overlay)
|
|
7799
|
+
[mounted](#common.NodeProp^mounted) trees. You can set
|
|
7800
|
+
`overlays` to false to disable that.
|
|
7801
|
+
|
|
7802
|
+
Similarly, when `buffers` is false this will not enter
|
|
7803
|
+
[buffers](#common.TreeBuffer), only [nodes](#common.Tree) (which
|
|
7804
|
+
is mostly useful when looking for props, which cannot exist on
|
|
7805
|
+
buffer-allocated nodes).
|
|
7806
|
+
*/
|
|
7807
|
+
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode): SyntaxNode | null;
|
|
7808
|
+
/**
|
|
7809
|
+
This node's next sibling, if any.
|
|
7810
|
+
*/
|
|
7811
|
+
nextSibling: SyntaxNode | null;
|
|
7812
|
+
/**
|
|
7813
|
+
This node's previous sibling.
|
|
7814
|
+
*/
|
|
7815
|
+
prevSibling: SyntaxNode | null;
|
|
7816
|
+
/**
|
|
7817
|
+
Read the given node prop from this node.
|
|
7818
|
+
*/
|
|
7819
|
+
prop<T>(prop: NodeProp<T>): T | undefined;
|
|
7820
|
+
/**
|
|
7821
|
+
A [tree cursor](#common.TreeCursor) starting at this node.
|
|
7822
|
+
*/
|
|
7823
|
+
cursor(mode?: IterMode): TreeCursor;
|
|
7824
|
+
/**
|
|
7825
|
+
Find the node around, before (if `side` is -1), or after (`side`
|
|
7826
|
+
is 1) the given position. Will look in parent nodes if the
|
|
7827
|
+
position is outside this node.
|
|
7828
|
+
*/
|
|
7829
|
+
resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
7830
|
+
/**
|
|
7831
|
+
Similar to `resolve`, but enter
|
|
7832
|
+
[overlaid](#common.MountedTree.overlay) nodes.
|
|
7833
|
+
*/
|
|
7834
|
+
resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode;
|
|
7835
|
+
/**
|
|
7836
|
+
Move the position to the innermost node before `pos` that looks
|
|
7837
|
+
like it is unfinished (meaning it ends in an error node or has a
|
|
7838
|
+
child ending in an error node right at its end).
|
|
7839
|
+
*/
|
|
7840
|
+
enterUnfinishedNodesBefore(pos: number): SyntaxNode;
|
|
7841
|
+
/**
|
|
7842
|
+
Get a [tree](#common.Tree) for this node. Will allocate one if it
|
|
7843
|
+
points into a buffer.
|
|
7844
|
+
*/
|
|
7845
|
+
toTree(): Tree;
|
|
7846
|
+
/**
|
|
7847
|
+
Get the first child of the given type (which may be a [node
|
|
7848
|
+
name](#common.NodeType.name) or a [group
|
|
7849
|
+
name](#common.NodeProp^group)). If `before` is non-null, only
|
|
7850
|
+
return children that occur somewhere after a node with that name
|
|
7851
|
+
or group. If `after` is non-null, only return children that
|
|
7852
|
+
occur somewhere before a node with that name or group.
|
|
7853
|
+
*/
|
|
7854
|
+
getChild(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode | null;
|
|
7855
|
+
/**
|
|
7856
|
+
Like [`getChild`](#common.SyntaxNode.getChild), but return all
|
|
7857
|
+
matching children, not just the first.
|
|
7858
|
+
*/
|
|
7859
|
+
getChildren(type: string | number, before?: string | number | null, after?: string | number | null): SyntaxNode[];
|
|
7860
|
+
}
|
|
7861
|
+
/**
|
|
7862
|
+
A tree cursor object focuses on a given node in a syntax tree, and
|
|
7863
|
+
allows you to move to adjacent nodes.
|
|
7864
|
+
*/
|
|
7865
|
+
declare class TreeCursor implements SyntaxNodeRef {
|
|
7866
|
+
/**
|
|
7867
|
+
The node's type.
|
|
7868
|
+
*/
|
|
7869
|
+
type: NodeType;
|
|
7870
|
+
/**
|
|
7871
|
+
Shorthand for `.type.name`.
|
|
7872
|
+
*/
|
|
7873
|
+
get name(): string;
|
|
7874
|
+
/**
|
|
7875
|
+
The start source offset of this node.
|
|
7876
|
+
*/
|
|
7877
|
+
from: number;
|
|
7878
|
+
/**
|
|
7879
|
+
The end source offset.
|
|
7880
|
+
*/
|
|
7881
|
+
to: number;
|
|
7882
|
+
private stack;
|
|
7883
|
+
private bufferNode;
|
|
7884
|
+
private yieldNode;
|
|
7885
|
+
private yieldBuf;
|
|
7886
|
+
/**
|
|
7887
|
+
Move the cursor to this node's first child. When this returns
|
|
7888
|
+
false, the node has no child, and the cursor has not been moved.
|
|
7889
|
+
*/
|
|
7890
|
+
firstChild(): boolean;
|
|
7891
|
+
/**
|
|
7892
|
+
Move the cursor to this node's last child.
|
|
7893
|
+
*/
|
|
7894
|
+
lastChild(): boolean;
|
|
7895
|
+
/**
|
|
7896
|
+
Move the cursor to the first child that ends after `pos`.
|
|
7897
|
+
*/
|
|
7898
|
+
childAfter(pos: number): boolean;
|
|
7899
|
+
/**
|
|
7900
|
+
Move to the last child that starts before `pos`.
|
|
7901
|
+
*/
|
|
7902
|
+
childBefore(pos: number): boolean;
|
|
7903
|
+
/**
|
|
7904
|
+
Move the cursor to the child around `pos`. If side is -1 the
|
|
7905
|
+
child may end at that position, when 1 it may start there. This
|
|
7906
|
+
will also enter [overlaid](#common.MountedTree.overlay)
|
|
7907
|
+
[mounted](#common.NodeProp^mounted) trees unless `overlays` is
|
|
7908
|
+
set to false.
|
|
7909
|
+
*/
|
|
7910
|
+
enter(pos: number, side: -1 | 0 | 1, mode?: IterMode): boolean;
|
|
7911
|
+
/**
|
|
7912
|
+
Move to the node's parent node, if this isn't the top node.
|
|
7913
|
+
*/
|
|
7914
|
+
parent(): boolean;
|
|
7915
|
+
/**
|
|
7916
|
+
Move to this node's next sibling, if any.
|
|
7917
|
+
*/
|
|
7918
|
+
nextSibling(): boolean;
|
|
7919
|
+
/**
|
|
7920
|
+
Move to this node's previous sibling, if any.
|
|
7921
|
+
*/
|
|
7922
|
+
prevSibling(): boolean;
|
|
7923
|
+
private atLastNode;
|
|
7924
|
+
private move;
|
|
7925
|
+
/**
|
|
7926
|
+
Move to the next node in a
|
|
7927
|
+
[pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
|
|
7928
|
+
traversal, going from a node to its first child or, if the
|
|
7929
|
+
current node is empty or `enter` is false, its next sibling or
|
|
7930
|
+
the next sibling of the first parent node that has one.
|
|
7931
|
+
*/
|
|
7932
|
+
next(enter?: boolean): boolean;
|
|
7933
|
+
/**
|
|
7934
|
+
Move to the next node in a last-to-first pre-order traversal. A
|
|
7935
|
+
node is followed by its last child or, if it has none, its
|
|
7936
|
+
previous sibling or the previous sibling of the first parent
|
|
7937
|
+
node that has one.
|
|
7938
|
+
*/
|
|
7939
|
+
prev(enter?: boolean): boolean;
|
|
7940
|
+
/**
|
|
7941
|
+
Move the cursor to the innermost node that covers `pos`. If
|
|
7942
|
+
`side` is -1, it will enter nodes that end at `pos`. If it is 1,
|
|
7943
|
+
it will enter nodes that start at `pos`.
|
|
7944
|
+
*/
|
|
7945
|
+
moveTo(pos: number, side?: -1 | 0 | 1): this;
|
|
7946
|
+
/**
|
|
7947
|
+
Get a [syntax node](#common.SyntaxNode) at the cursor's current
|
|
7948
|
+
position.
|
|
7949
|
+
*/
|
|
7950
|
+
get node(): SyntaxNode;
|
|
7951
|
+
/**
|
|
7952
|
+
Get the [tree](#common.Tree) that represents the current node, if
|
|
7953
|
+
any. Will return null when the node is in a [tree
|
|
7954
|
+
buffer](#common.TreeBuffer).
|
|
7955
|
+
*/
|
|
7956
|
+
get tree(): Tree | null;
|
|
7957
|
+
/**
|
|
7958
|
+
Iterate over the current node and all its descendants, calling
|
|
7959
|
+
`enter` when entering a node and `leave`, if given, when leaving
|
|
7960
|
+
one. When `enter` returns `false`, any children of that node are
|
|
7961
|
+
skipped, and `leave` isn't called for it.
|
|
7962
|
+
*/
|
|
7963
|
+
iterate(enter: (node: SyntaxNodeRef) => boolean | void, leave?: (node: SyntaxNodeRef) => void): void;
|
|
7964
|
+
/**
|
|
7965
|
+
Test whether the current node matches a given context—a sequence
|
|
7966
|
+
of direct parent node names. Empty strings in the context array
|
|
7967
|
+
are treated as wildcards.
|
|
7968
|
+
*/
|
|
7969
|
+
matchContext(context: readonly string[]): boolean;
|
|
7970
|
+
}
|
|
7971
|
+
|
|
7972
|
+
/**
|
|
7973
|
+
Data structure used to accumulate a block's content during [leaf
|
|
7974
|
+
block parsing](#BlockParser.leaf).
|
|
7975
|
+
*/
|
|
7976
|
+
declare class LeafBlock {
|
|
7977
|
+
/**
|
|
7978
|
+
The start position of the block.
|
|
7979
|
+
*/
|
|
7980
|
+
readonly start: number;
|
|
7981
|
+
/**
|
|
7982
|
+
The block's text content.
|
|
7983
|
+
*/
|
|
7984
|
+
content: string;
|
|
7985
|
+
/**
|
|
7986
|
+
The block parsers active for this block.
|
|
7987
|
+
*/
|
|
7988
|
+
parsers: LeafBlockParser[];
|
|
7989
|
+
}
|
|
7990
|
+
/**
|
|
7991
|
+
Data structure used during block-level per-line parsing.
|
|
7992
|
+
*/
|
|
7993
|
+
declare class Line {
|
|
7994
|
+
/**
|
|
7995
|
+
The line's full text.
|
|
7996
|
+
*/
|
|
7997
|
+
text: string;
|
|
7998
|
+
/**
|
|
7999
|
+
The base indent provided by the composite contexts (that have
|
|
8000
|
+
been handled so far).
|
|
8001
|
+
*/
|
|
8002
|
+
baseIndent: number;
|
|
8003
|
+
/**
|
|
8004
|
+
The string position corresponding to the base indent.
|
|
8005
|
+
*/
|
|
8006
|
+
basePos: number;
|
|
8007
|
+
/**
|
|
8008
|
+
Any markers (i.e. block quote markers) parsed for the contexts.
|
|
8009
|
+
A block parser that moves across lines, covering such marks, may
|
|
8010
|
+
need to include these in its node structure.
|
|
8011
|
+
*/
|
|
8012
|
+
markers: Element$1[];
|
|
8013
|
+
/**
|
|
8014
|
+
The position of the next non-whitespace character beyond any
|
|
8015
|
+
list, blockquote, or other composite block markers.
|
|
8016
|
+
*/
|
|
8017
|
+
pos: number;
|
|
8018
|
+
/**
|
|
8019
|
+
The column of the next non-whitespace character.
|
|
8020
|
+
*/
|
|
8021
|
+
indent: number;
|
|
8022
|
+
/**
|
|
8023
|
+
The character code of the character after `pos`.
|
|
8024
|
+
*/
|
|
8025
|
+
next: number;
|
|
8026
|
+
/**
|
|
8027
|
+
Skip whitespace after the given position, return the position of
|
|
8028
|
+
the next non-space character or the end of the line if there's
|
|
8029
|
+
only space after `from`.
|
|
8030
|
+
*/
|
|
8031
|
+
skipSpace(from: number): number;
|
|
8032
|
+
/**
|
|
8033
|
+
Move the line's base position forward to the given position.
|
|
8034
|
+
This should only be called by composite [block
|
|
8035
|
+
parsers](#BlockParser.parse) or [markup skipping
|
|
8036
|
+
functions](#NodeSpec.composite).
|
|
8037
|
+
*/
|
|
8038
|
+
moveBase(to: number): void;
|
|
8039
|
+
/**
|
|
8040
|
+
Move the line's base position forward to the given _column_.
|
|
8041
|
+
*/
|
|
8042
|
+
moveBaseColumn(indent: number): void;
|
|
8043
|
+
/**
|
|
8044
|
+
Store a composite-block-level marker. Should be called from
|
|
8045
|
+
[markup skipping functions](#NodeSpec.composite) when they
|
|
8046
|
+
consume any non-whitespace characters.
|
|
8047
|
+
*/
|
|
8048
|
+
addMarker(elt: Element$1): void;
|
|
8049
|
+
/**
|
|
8050
|
+
Find the column position at `to`, optionally starting at a given
|
|
8051
|
+
position and column.
|
|
8052
|
+
*/
|
|
8053
|
+
countIndent(to: number, from?: number, indent?: number): number;
|
|
8054
|
+
/**
|
|
8055
|
+
Find the position corresponding to the given column.
|
|
8056
|
+
*/
|
|
8057
|
+
findColumn(goal: number): number;
|
|
8058
|
+
}
|
|
8059
|
+
type BlockResult = boolean | null;
|
|
8060
|
+
/**
|
|
8061
|
+
Block-level parsing functions get access to this context object.
|
|
8062
|
+
*/
|
|
8063
|
+
declare class BlockContext implements PartialParse {
|
|
8064
|
+
/**
|
|
8065
|
+
The parser configuration used.
|
|
8066
|
+
*/
|
|
6949
8067
|
readonly parser: MarkdownParser;
|
|
6950
8068
|
private line;
|
|
6951
8069
|
private atEnd;
|
|
@@ -7087,7 +8205,9 @@ general types of block parsers:
|
|
|
7087
8205
|
- Composite block parsers, which handle things like lists and
|
|
7088
8206
|
blockquotes. These define a [`parse`](#BlockParser.parse) method
|
|
7089
8207
|
that [starts](#BlockContext.startComposite) a composite block
|
|
7090
|
-
and returns null when it recognizes its syntax.
|
|
8208
|
+
and returns null when it recognizes its syntax. The node type
|
|
8209
|
+
used by such a block must define a
|
|
8210
|
+
[`composite`](#NodeSpec.composite) function as well.
|
|
7091
8211
|
|
|
7092
8212
|
- Eager leaf block parsers, used for things like code or HTML
|
|
7093
8213
|
blocks. These can unambiguously recognize their content from its
|
|
@@ -7116,7 +8236,7 @@ interface BlockParser {
|
|
|
7116
8236
|
The eager parse function, which can look at the block's first
|
|
7117
8237
|
line and return `false` to do nothing, `true` if it has parsed
|
|
7118
8238
|
(and [moved past](#BlockContext.nextLine) a block), or `null` if
|
|
7119
|
-
it has started a composite block.
|
|
8239
|
+
it has [started](#BlockContext.startComposite) a composite block.
|
|
7120
8240
|
*/
|
|
7121
8241
|
parse?(cx: BlockContext, line: Line): BlockResult;
|
|
7122
8242
|
/**
|
|
@@ -7341,6 +8461,17 @@ declare class InlineContext {
|
|
|
7341
8461
|
*/
|
|
7342
8462
|
takeContent(startIndex: number): Element$1[];
|
|
7343
8463
|
/**
|
|
8464
|
+
Return the delimiter at the given index. Mostly useful to get
|
|
8465
|
+
additional info out of a delimiter index returned by
|
|
8466
|
+
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
|
|
8467
|
+
Returns null if there is no delimiter at this index.
|
|
8468
|
+
*/
|
|
8469
|
+
getDelimiterAt(index: number): {
|
|
8470
|
+
from: number;
|
|
8471
|
+
to: number;
|
|
8472
|
+
type: DelimiterType;
|
|
8473
|
+
} | null;
|
|
8474
|
+
/**
|
|
7344
8475
|
Skip space after the given (document) position, returning either
|
|
7345
8476
|
the position of the next non-space character or the end of the
|
|
7346
8477
|
section.
|
|
@@ -7351,6 +8482,14 @@ declare class InlineContext {
|
|
|
7351
8482
|
*/
|
|
7352
8483
|
elt(type: string, from: number, to: number, children?: readonly Element$1[]): Element$1;
|
|
7353
8484
|
elt(tree: Tree, at: number): Element$1;
|
|
8485
|
+
/**
|
|
8486
|
+
The opening delimiter type used by the standard link parser.
|
|
8487
|
+
*/
|
|
8488
|
+
static linkStart: DelimiterType;
|
|
8489
|
+
/**
|
|
8490
|
+
Opening delimiter type used for standard images.
|
|
8491
|
+
*/
|
|
8492
|
+
static imageStart: DelimiterType;
|
|
7354
8493
|
}
|
|
7355
8494
|
|
|
7356
8495
|
/**
|
|
@@ -7715,12 +8854,12 @@ type NestedLang = {
|
|
|
7715
8854
|
attrs?: (attrs: {
|
|
7716
8855
|
[attr: string]: string;
|
|
7717
8856
|
}) => boolean;
|
|
7718
|
-
parser: Parser;
|
|
8857
|
+
parser: Parser$1;
|
|
7719
8858
|
};
|
|
7720
8859
|
type NestedAttr = {
|
|
7721
8860
|
name: string;
|
|
7722
8861
|
tagName?: string;
|
|
7723
|
-
parser: Parser;
|
|
8862
|
+
parser: Parser$1;
|
|
7724
8863
|
};
|
|
7725
8864
|
/**
|
|
7726
8865
|
A language provider based on the [Lezer HTML
|
|
@@ -8054,4 +9193,4 @@ declare function vue(): Promise<typeof _codemirror_lang_vue>;
|
|
|
8054
9193
|
declare function wast(): Promise<typeof _codemirror_lang_wast>;
|
|
8055
9194
|
declare function xml(): Promise<typeof _codemirror_lang_xml>;
|
|
8056
9195
|
|
|
8057
|
-
export { Annotation, AnnotationType, ChangeDesc, ChangeSet, type ChangeSpec, type Command, Compartment, type Completion, CompletionContext, type CompletionResult, type CompletionSource, Decoration, type DecorationSet, EditorSelection, EditorState, type EditorStateConfig, EditorView, type Extension, Facet, GutterMarker, HighlightStyle, type KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp, NodeSet, NodeType, type Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, type StreamParser, StringStream, StyleModule, type SyntaxNode, Tag, type TagStyle, Text, type TextIterator, type Tooltip, type TooltipView, Transaction, type TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, angular, autocompletion, bidiIsolates, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, completionStatus, cpp, css, cssStreamParser, currentCompletions, cursorGroupLeft, cursorGroupRight, cursorMatchingBracket, cursorSyntaxLeft, cursorSyntaxRight, dart, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, forceParsing, go, gss, gutter, gutters, highlightSelectionMatches, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, indentationMarkers, insertNewlineAndIndent, java, index_d as javascript, keymap, kotlin, less, lineNumberMarkers, lineNumbers, markdown, moveCompletionSelection, php, placeholder, python, redo, redoSelection, repositionTooltips, sass, scala, scrollPastEnd, selectGroupLeft, selectGroupRight, selectMatchingBracket, selectNextOccurrence, selectSyntaxLeft, selectSyntaxRight, selectedCompletion, selectedCompletionIndex, shell, showPanel, showTooltip, standardKeymap, startCompletion, svelte, syntaxHighlighting, syntaxParserRunning, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, vue, wast, xml };
|
|
9196
|
+
export { Annotation, AnnotationType, ChangeDesc, ChangeSet, type ChangeSpec, type Command, Compartment, type Completion, CompletionContext, type CompletionResult, type CompletionSource, Decoration, type DecorationSet, EditorSelection, EditorState, type EditorStateConfig, EditorView, type Extension, Facet, GutterMarker, HighlightStyle, type KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp$1 as NodeProp, NodeSet$1 as NodeSet, NodeType$1 as NodeType, type Panel, Parser$1 as Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, type StreamParser, StringStream, StyleModule, type SyntaxNode$1 as SyntaxNode, Tag, type TagStyle, Text, type TextIterator, type Tooltip, type TooltipView, Transaction, type TransactionSpec, Tree$1 as Tree, TreeCursor$1 as TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, angular, autocompletion, bidiIsolates, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, completionStatus, cpp, css, cssStreamParser, currentCompletions, cursorGroupLeft, cursorGroupRight, cursorMatchingBracket, cursorSyntaxLeft, cursorSyntaxRight, dart, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, forceParsing, go, gss, gutter, gutters, highlightSelectionMatches, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, indentationMarkers, insertNewlineAndIndent, java, index_d as javascript, keymap, kotlin, less, lineNumberMarkers, lineNumbers, markdown, moveCompletionSelection, php, placeholder, python, redo, redoSelection, repositionTooltips, sass, scala, scrollPastEnd, selectGroupLeft, selectGroupRight, selectMatchingBracket, selectNextOccurrence, selectSyntaxLeft, selectSyntaxRight, selectedCompletion, selectedCompletionIndex, shell, showPanel, showTooltip, standardKeymap, startCompletion, svelte, syntaxHighlighting, syntaxParserRunning, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, vue, wast, xml };
|