@xberg-io/tree-sitter-language-pack 1.12.0 → 1.12.2
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/index.d.ts +517 -517
- package/index.js +52 -19
- package/package.json +50 -60
- package/ts-pack-core-node.darwin-arm64.node +0 -0
- package/ts-pack-core-node.darwin-x64.node +0 -0
- package/ts-pack-core-node.linux-arm64-gnu.node +0 -0
- package/ts-pack-core-node.linux-x64-gnu.node +0 -0
- package/ts-pack-core-node.win32-arm64-msvc.node +0 -0
- package/ts-pack-core-node.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:d52ce7c026fac10e1f63c1823f2d7e68872bab43e264e5db5c29124d912a5c7c
|
|
3
3
|
// To regenerate: alef generate
|
|
4
4
|
// To verify freshness: alef verify --exit-code
|
|
5
5
|
/* eslint-disable */
|
|
@@ -241,60 +241,60 @@ export declare function init(config?: PackConfig | undefined | null): void;
|
|
|
241
241
|
|
|
242
242
|
/** A byte range — start (inclusive) to end (exclusive). */
|
|
243
243
|
export interface ByteRange {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
244
|
+
/** Inclusive start byte offset. */
|
|
245
|
+
readonly start: number;
|
|
246
|
+
/** Exclusive end byte offset. */
|
|
247
|
+
readonly end: number;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/** Metadata for a single chunk of source code. */
|
|
251
251
|
export interface ChunkContext {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
252
|
+
/** Language name used to parse this chunk. */
|
|
253
|
+
readonly language?: string;
|
|
254
|
+
/** Zero-indexed position of this chunk within the file's chunk list. */
|
|
255
|
+
readonly chunkIndex?: number;
|
|
256
|
+
/** Total number of chunks the file was split into. */
|
|
257
|
+
readonly totalChunks?: number;
|
|
258
|
+
/** Tree-sitter node kinds that appear at the top level of this chunk. */
|
|
259
|
+
readonly nodeTypes?: Array<string>;
|
|
260
|
+
/** Hierarchical path of enclosing structural items (e.g., `["MyClass", "my_method"]`). */
|
|
261
|
+
readonly contextPath?: Array<string>;
|
|
262
|
+
/** Names of symbols defined within this chunk. */
|
|
263
|
+
readonly symbolsDefined?: Array<string>;
|
|
264
|
+
/** Comments contained within this chunk. */
|
|
265
|
+
readonly comments?: Array<CommentInfo>;
|
|
266
|
+
/** Docstrings contained within this chunk. */
|
|
267
|
+
readonly docstrings?: Array<DocstringInfo>;
|
|
268
|
+
/** Whether this chunk contains any tree-sitter error nodes. */
|
|
269
|
+
readonly hasErrorNodes?: boolean;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
/** A chunk of source code with rich metadata. */
|
|
273
273
|
export interface CodeChunk {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
274
|
+
/** The raw source text of this chunk. */
|
|
275
|
+
readonly content?: string;
|
|
276
|
+
/** Inclusive start byte offset of this chunk in the original source. */
|
|
277
|
+
readonly startByte?: number;
|
|
278
|
+
/** Exclusive end byte offset of this chunk in the original source. */
|
|
279
|
+
readonly endByte?: number;
|
|
280
|
+
/** Zero-indexed start line of this chunk. */
|
|
281
|
+
readonly startLine?: number;
|
|
282
|
+
/** Zero-indexed end line of this chunk. */
|
|
283
|
+
readonly endLine?: number;
|
|
284
|
+
/** Contextual metadata about this chunk. */
|
|
285
|
+
readonly metadata?: ChunkContext;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/** A comment extracted from source code. */
|
|
289
289
|
export interface CommentInfo {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
290
|
+
/** The raw text content of the comment. */
|
|
291
|
+
readonly text?: string;
|
|
292
|
+
/** The kind of comment (line, block, or doc). */
|
|
293
|
+
readonly kind?: CommentKind;
|
|
294
|
+
/** Source span covering the comment. */
|
|
295
|
+
readonly span?: Span;
|
|
296
|
+
/** Name of the syntax node this comment is directly associated with. */
|
|
297
|
+
readonly associatedNode?: string;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
/**
|
|
@@ -304,12 +304,12 @@ export interface CommentInfo {
|
|
|
304
304
|
* and documentation comments.
|
|
305
305
|
*/
|
|
306
306
|
export declare enum CommentKind {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
307
|
+
/** A single-line comment (e.g., `// ...` or `# ...`). */
|
|
308
|
+
Line = "Line",
|
|
309
|
+
/** A block or multi-line comment using slash-star delimiters. */
|
|
310
|
+
Block = "Block",
|
|
311
|
+
/** A documentation comment such as `/// ...` or slash-double-star block. */
|
|
312
|
+
Doc = "Doc",
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
/**
|
|
@@ -319,12 +319,12 @@ export declare enum CommentKind {
|
|
|
319
319
|
* `Sequence` nodes.
|
|
320
320
|
*/
|
|
321
321
|
export interface DataAttribute {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
/** Attribute name (e.g. `"class"`, `"href"`). */
|
|
323
|
+
readonly name?: string;
|
|
324
|
+
/** Attribute value as a raw string (quotes stripped). */
|
|
325
|
+
readonly value?: string;
|
|
326
|
+
/** Source span covering the entire `name="value"` attribute token. */
|
|
327
|
+
readonly span?: Span;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
@@ -343,24 +343,24 @@ export interface DataAttribute {
|
|
|
343
343
|
* | `Sequence` | positional index (`"0"`) | leaf value | empty | sub-items |
|
|
344
344
|
*/
|
|
345
345
|
export interface DataNode {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
346
|
+
/** Whether this node is a key/value pair, XML element, or sequence item. */
|
|
347
|
+
readonly kind?: DataNodeKind;
|
|
348
|
+
/**
|
|
349
|
+
* Key, attribute name, tag name, or positional index (`"0"`, `"1"`, …).
|
|
350
|
+
* `None` at the document root.
|
|
351
|
+
*/
|
|
352
|
+
readonly key?: string;
|
|
353
|
+
/**
|
|
354
|
+
* Leaf scalar value, if any. `None` for containers (objects, arrays, XML elements
|
|
355
|
+
* with child elements).
|
|
356
|
+
*/
|
|
357
|
+
readonly value?: string;
|
|
358
|
+
/** Attributes on element-shape nodes (XML `STag` attributes). Empty for all other kinds. */
|
|
359
|
+
readonly attributes?: Array<DataAttribute>;
|
|
360
|
+
/** Children for nested containers and XML element bodies. */
|
|
361
|
+
readonly children?: Array<DataNode>;
|
|
362
|
+
/** Source span covering this node in the original source file. */
|
|
363
|
+
readonly span?: Span;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
/**
|
|
@@ -378,28 +378,28 @@ export interface DataNode {
|
|
|
378
378
|
* Covered by `tests/wire_format.rs`.
|
|
379
379
|
*/
|
|
380
380
|
export declare enum DataNodeKind {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
381
|
+
/**
|
|
382
|
+
* A key/value pair or mapping (json/toml/properties/yaml/hcl/cue/kdl pair,
|
|
383
|
+
* or a wrapper "object"/"mapping" container).
|
|
384
|
+
*/
|
|
385
|
+
KeyValue = "KeyValue",
|
|
386
|
+
/** An XML element with a tag name in `key` and attributes in `attributes`. */
|
|
387
|
+
Element = "Element",
|
|
388
|
+
/**
|
|
389
|
+
* A positional sequence item (JSON array element, YAML block sequence item,
|
|
390
|
+
* CSV/PSV row or cell).
|
|
391
|
+
*/
|
|
392
|
+
Sequence = "Sequence",
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
/** A diagnostic (syntax error, missing node, etc.) from parsing. */
|
|
396
396
|
export interface Diagnostic {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
/** Human-readable description of the diagnostic. */
|
|
398
|
+
readonly message?: string;
|
|
399
|
+
/** Severity of the diagnostic. */
|
|
400
|
+
readonly severity?: DiagnosticSeverity;
|
|
401
|
+
/** Source span where the diagnostic was detected. */
|
|
402
|
+
readonly span?: Span;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
/**
|
|
@@ -409,22 +409,22 @@ export interface Diagnostic {
|
|
|
409
409
|
* found in the syntax tree.
|
|
410
410
|
*/
|
|
411
411
|
export declare enum DiagnosticSeverity {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
412
|
+
/** A parse error (e.g., an `ERROR` or `MISSING` node in the tree). */
|
|
413
|
+
Error = "Error",
|
|
414
|
+
/** A warning-level diagnostic. */
|
|
415
|
+
Warning = "Warning",
|
|
416
|
+
/** An informational diagnostic. */
|
|
417
|
+
Info = "Info",
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
/** A section within a docstring (e.g., Args, Returns, Raises). */
|
|
421
421
|
export interface DocSection {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
422
|
+
/** Section kind (e.g., `"args"`, `"returns"`, `"raises"`). */
|
|
423
|
+
readonly kind?: string;
|
|
424
|
+
/** Parameter or return value name, if applicable. */
|
|
425
|
+
readonly name?: string;
|
|
426
|
+
/** Description text for this section. */
|
|
427
|
+
readonly description?: string;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
/**
|
|
@@ -440,78 +440,78 @@ export interface DocSection {
|
|
|
440
440
|
* NOT add `#[serde(tag = "...")]`. Covered by `tests/wire_format.rs`.
|
|
441
441
|
*/
|
|
442
442
|
export declare enum DocstringFormat {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
443
|
+
/** Python triple-quoted string docstring (`"""..."""`). */
|
|
444
|
+
PythonTripleQuote = "PythonTripleQuote",
|
|
445
|
+
/**
|
|
446
|
+
* JavaScript/TypeScript JSDoc block comment (opens with two stars, closes
|
|
447
|
+
* with star-slash).
|
|
448
|
+
*/
|
|
449
|
+
JSDoc = "JSDoc",
|
|
450
|
+
/** Rust `///` or `//!` doc comment. */
|
|
451
|
+
Rustdoc = "Rustdoc",
|
|
452
|
+
/** Go doc comment (a comment block immediately preceding a declaration). */
|
|
453
|
+
GoDoc = "GoDoc",
|
|
454
|
+
/**
|
|
455
|
+
* Java Javadoc block comment (opens with two stars, closes with
|
|
456
|
+
* star-slash).
|
|
457
|
+
*/
|
|
458
|
+
JavaDoc = "JavaDoc",
|
|
459
|
+
/** A language-specific docstring format not covered by the standard variants. */
|
|
460
|
+
Other = "Other",
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
/** A docstring extracted from source code. */
|
|
464
464
|
export interface DocstringInfo {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
465
|
+
/** The raw text of the docstring. */
|
|
466
|
+
readonly text?: string;
|
|
467
|
+
/** The docstring format (Python, JSDoc, Rustdoc, etc.). */
|
|
468
|
+
readonly format?: DocstringFormat;
|
|
469
|
+
/** Source span covering the docstring. */
|
|
470
|
+
readonly span?: Span;
|
|
471
|
+
/** Name of the item this docstring documents. */
|
|
472
|
+
readonly associatedItem?: string;
|
|
473
|
+
/** Parsed sections of the docstring (Args, Returns, Raises, etc.). */
|
|
474
|
+
readonly parsedSections?: Array<DocSection>;
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
/** Manages downloading and caching of pre-built parser shared libraries. */
|
|
478
478
|
export declare class DownloadManager {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
479
|
+
/** Create a new download manager for the given version. */
|
|
480
|
+
static new(version: string): DownloadManager;
|
|
481
|
+
/** List languages that are already downloaded and cached. */
|
|
482
|
+
installedLanguages(): Array<string>;
|
|
483
|
+
/**
|
|
484
|
+
* Download the platform bundle and extract every library file it contains.
|
|
485
|
+
*
|
|
486
|
+
* Unlike [`Self::ensure_languages`], this does not check the manifest language list
|
|
487
|
+
* against archive contents — it simply extracts all `.so`/`.dylib`/`.dll` files
|
|
488
|
+
* from the bundle. Languages in the manifest that are missing from the archive
|
|
489
|
+
* are silently ignored rather than returning an error.
|
|
490
|
+
*
|
|
491
|
+
* Returns the number of library files extracted (including those already cached).
|
|
492
|
+
*/
|
|
493
|
+
downloadAllBestEffort(): number;
|
|
494
|
+
/**
|
|
495
|
+
* Remove all cached parser libraries.
|
|
496
|
+
*
|
|
497
|
+
* Acquires the cross-process lock so `clean_cache` cannot race a concurrent
|
|
498
|
+
* downloader (avoids Windows sharing-violation errors against an in-flight
|
|
499
|
+
* bundle write). The `.download.lock` file itself is **not** removed — it is
|
|
500
|
+
* permanent infrastructure; deleting it could allow a concurrent process that
|
|
501
|
+
* already opened the file to continue holding a stale lock handle while a new
|
|
502
|
+
* process opens a fresh inode, breaking the mutual-exclusion guarantee.
|
|
503
|
+
*/
|
|
504
|
+
cleanCache(): void;
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
/** An export statement extracted from source code. */
|
|
508
508
|
export interface ExportInfo {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
509
|
+
/** The exported name. */
|
|
510
|
+
readonly name?: string;
|
|
511
|
+
/** The kind of export (named, default, or re-export). */
|
|
512
|
+
readonly kind?: ExportKind;
|
|
513
|
+
/** Source span covering the export statement. */
|
|
514
|
+
readonly span?: Span;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
/**
|
|
@@ -520,46 +520,46 @@ export interface ExportInfo {
|
|
|
520
520
|
* Covers named exports, default exports, and re-exports from other modules.
|
|
521
521
|
*/
|
|
522
522
|
export declare enum ExportKind {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
523
|
+
/** A named export (e.g., `export { foo }`). */
|
|
524
|
+
Named = "Named",
|
|
525
|
+
/** A default export (e.g., `export default foo`). */
|
|
526
|
+
Default = "Default",
|
|
527
|
+
/** A re-export from another module (e.g., `export { foo } from 'bar'`). */
|
|
528
|
+
ReExport = "ReExport",
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
/** Aggregate metrics for a source file. */
|
|
532
532
|
export interface FileMetrics {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
533
|
+
/** Total number of lines (including blank and comment lines). */
|
|
534
|
+
readonly totalLines?: number;
|
|
535
|
+
/** Number of lines containing non-blank, non-comment source code. */
|
|
536
|
+
readonly codeLines?: number;
|
|
537
|
+
/** Number of lines that are entirely comments. */
|
|
538
|
+
readonly commentLines?: number;
|
|
539
|
+
/** Number of blank (whitespace-only) lines. */
|
|
540
|
+
readonly blankLines?: number;
|
|
541
|
+
/** Total byte length of the source file. */
|
|
542
|
+
readonly totalBytes?: number;
|
|
543
|
+
/** Total number of nodes in the syntax tree. */
|
|
544
|
+
readonly nodeCount?: number;
|
|
545
|
+
/** Number of error nodes in the syntax tree (parse errors). */
|
|
546
|
+
readonly errorCount?: number;
|
|
547
|
+
/** Maximum nesting depth reached in the syntax tree. */
|
|
548
|
+
readonly maxDepth?: number;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/** An import statement extracted from source code. */
|
|
552
552
|
export interface ImportInfo {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
553
|
+
/** The module or path being imported from. */
|
|
554
|
+
readonly source?: string;
|
|
555
|
+
/** Specific names imported from the source module. */
|
|
556
|
+
readonly items?: Array<string>;
|
|
557
|
+
/** Alias assigned to the import (e.g., `import numpy as np`). */
|
|
558
|
+
readonly alias?: string;
|
|
559
|
+
/** Whether this is a wildcard import (e.g., `import *` or `use foo::*`). */
|
|
560
|
+
readonly isWildcard?: boolean;
|
|
561
|
+
/** Source span covering the import statement. */
|
|
562
|
+
readonly span?: Span;
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
/**
|
|
@@ -571,65 +571,65 @@ export interface ImportInfo {
|
|
|
571
571
|
* (`get_language`, `available_languages`, etc.).
|
|
572
572
|
*/
|
|
573
573
|
export declare class LanguageRegistry {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
574
|
+
/**
|
|
575
|
+
* Create a new registry populated with all statically compiled languages.
|
|
576
|
+
*
|
|
577
|
+
* When the `dynamic-loading` feature is enabled, the registry also knows
|
|
578
|
+
* about dynamically loadable grammars and will load them on demand.
|
|
579
|
+
*/
|
|
580
|
+
static new(): LanguageRegistry;
|
|
581
|
+
/**
|
|
582
|
+
* Get a tree-sitter [`Language`] by name.
|
|
583
|
+
*
|
|
584
|
+
* Resolves aliases (e.g., `"shell"` -> `"bash"`, `"makefile"` -> `"make"`),
|
|
585
|
+
* then looks up the language in the static table. When the `dynamic-loading`
|
|
586
|
+
* feature is enabled, falls back to loading a shared library on demand.
|
|
587
|
+
* @throws Returns [`Error::LanguageNotFound`] if the name (after alias resolution)
|
|
588
|
+
* does not match any known grammar.
|
|
589
|
+
*/
|
|
590
|
+
getLanguage(name: string): Language;
|
|
591
|
+
/**
|
|
592
|
+
* List all available language names, sorted and deduplicated.
|
|
593
|
+
*
|
|
594
|
+
* Includes statically compiled languages, dynamically loadable languages
|
|
595
|
+
* (if the `dynamic-loading` feature is enabled), and all configured aliases.
|
|
596
|
+
*/
|
|
597
|
+
availableLanguages(): Array<string>;
|
|
598
|
+
/**
|
|
599
|
+
* Check whether a parser is statically compiled into this build.
|
|
600
|
+
*
|
|
601
|
+
* Returns `true` only when the grammar was compiled in at build time
|
|
602
|
+
* (i.e. it appears in the `STATIC_LANGUAGES` table). This is independent
|
|
603
|
+
* of the extension-to-language mapping: `detect_language_from_extension`
|
|
604
|
+
* consults the static ext table for all 306 grammars regardless of which
|
|
605
|
+
* parsers are compiled in.
|
|
606
|
+
*
|
|
607
|
+
* Use this when you need to distinguish "we know the language name" from
|
|
608
|
+
* "we can actually parse files in that language right now".
|
|
609
|
+
*
|
|
610
|
+
* ```no_run
|
|
611
|
+
* use tree_sitter_language_pack::{detect_language_from_extension, LanguageRegistry};
|
|
612
|
+
*
|
|
613
|
+
* let registry = LanguageRegistry::new();
|
|
614
|
+
* // Extension detection uses the static table — independent of compiled parsers.
|
|
615
|
+
* let lang = detect_language_from_extension("feature"); // always returns Some("gherkin")
|
|
616
|
+
* // Parser availability depends on which grammars were compiled in.
|
|
617
|
+
* let can_parse = lang.map(|name| registry.has_parser(name)).unwrap_or(false);
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
hasParser(name: string): boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Check whether a language is available by name or alias.
|
|
623
|
+
*
|
|
624
|
+
* Returns `true` if the language can be loaded, either from the static
|
|
625
|
+
* table or from a dynamic library on disk.
|
|
626
|
+
*/
|
|
627
|
+
hasLanguage(name: string): boolean;
|
|
628
|
+
/** Return the total number of available languages (including aliases). */
|
|
629
|
+
languageCount(): number;
|
|
630
|
+
/** Parse source code and extract file intelligence based on config in a single pass. */
|
|
631
|
+
process(source: string, config?: ProcessConfig | undefined | null): ProcessResult;
|
|
632
|
+
static default(): LanguageRegistry;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
/**
|
|
@@ -639,58 +639,58 @@ export declare class LanguageRegistry {
|
|
|
639
639
|
* regardless of how the tree is moved or stored at the FFI boundary.
|
|
640
640
|
*/
|
|
641
641
|
export declare class Node {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
642
|
+
clone(): Node;
|
|
643
|
+
/** Return the node's kind name (e.g. `"function_definition"`). */
|
|
644
|
+
kind(): string;
|
|
645
|
+
/**
|
|
646
|
+
* Return the node's numeric kind ID.
|
|
647
|
+
*
|
|
648
|
+
* Tree-sitter assigns a stable `u16` ID to every node kind in a grammar
|
|
649
|
+
* (e.g. `"function_definition" → 42`). Comparing `kind_id()` is cheaper
|
|
650
|
+
* than comparing the string [`kind()`](Self::kind) in tight AST loops.
|
|
651
|
+
*/
|
|
652
|
+
kindId(): number;
|
|
653
|
+
/** Return the inclusive start byte offset of this node. */
|
|
654
|
+
startByte(): number;
|
|
655
|
+
/** Return the exclusive end byte offset of this node. */
|
|
656
|
+
endByte(): number;
|
|
657
|
+
/**
|
|
658
|
+
* Return the node's byte range as a [`ByteRange`].
|
|
659
|
+
*
|
|
660
|
+
* Callers should slice their own source bytes — this is a zero-copy
|
|
661
|
+
* text accessor.
|
|
662
|
+
*/
|
|
663
|
+
byteRange(): ByteRange;
|
|
664
|
+
/** Return the start [`Point`] (row, column). */
|
|
665
|
+
startPosition(): Point;
|
|
666
|
+
/** Return the end [`Point`] (row, column). */
|
|
667
|
+
endPosition(): Point;
|
|
668
|
+
/** True when this node is named (not punctuation/whitespace). */
|
|
669
|
+
isNamed(): boolean;
|
|
670
|
+
/** True when this is an error node. */
|
|
671
|
+
isError(): boolean;
|
|
672
|
+
/** True when this is a missing-token node. */
|
|
673
|
+
isMissing(): boolean;
|
|
674
|
+
/** True when this is an "extra" node (e.g. a comment). */
|
|
675
|
+
isExtra(): boolean;
|
|
676
|
+
/** True when this node or any descendant is an error. */
|
|
677
|
+
hasError(): boolean;
|
|
678
|
+
/** Return this node's parent, if any. */
|
|
679
|
+
parent(): Node | null;
|
|
680
|
+
/** Return the i-th child of this node, if any. */
|
|
681
|
+
child(index: number): Node | null;
|
|
682
|
+
/** Total number of children (including unnamed). */
|
|
683
|
+
childCount(): number;
|
|
684
|
+
/** Return the i-th named child of this node, if any. */
|
|
685
|
+
namedChild(index: number): Node | null;
|
|
686
|
+
/** Number of named children of this node. */
|
|
687
|
+
namedChildCount(): number;
|
|
688
|
+
/** Look up a child by its grammar-defined field name. */
|
|
689
|
+
childByFieldName(name: string): Node | null;
|
|
690
|
+
/** Return the S-expression form of this node's subtree. */
|
|
691
|
+
toSexp(): string;
|
|
692
|
+
/** Return a [`TreeCursor`] positioned at this node. */
|
|
693
|
+
walk(): TreeCursor;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
/**
|
|
@@ -701,63 +701,63 @@ export declare class Node {
|
|
|
701
701
|
* or passed as a dict/object from language bindings.
|
|
702
702
|
*/
|
|
703
703
|
export interface PackConfig {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
704
|
+
/**
|
|
705
|
+
* Override default cache directory.
|
|
706
|
+
*
|
|
707
|
+
* Default: `~/.cache/tree-sitter-language-pack/v{version}/libs/`
|
|
708
|
+
*/
|
|
709
|
+
readonly cacheDir?: string;
|
|
710
|
+
/**
|
|
711
|
+
* Languages to pre-download on init.
|
|
712
|
+
*
|
|
713
|
+
* Each entry is a language name (e.g. `"python"`, `"rust"`).
|
|
714
|
+
*/
|
|
715
|
+
readonly languages?: Array<string>;
|
|
716
|
+
/** Language groups to pre-download (e.g. `"web"`, `"systems"`, `"scripting"`). */
|
|
717
|
+
readonly groups?: Array<string>;
|
|
718
718
|
}
|
|
719
719
|
|
|
720
720
|
/** A tree-sitter parser configured for one language at a time. */
|
|
721
721
|
export declare class Parser {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
722
|
+
/**
|
|
723
|
+
* Construct a new parser with no language set.
|
|
724
|
+
*
|
|
725
|
+
* Call [`Parser::set_language`] before parsing.
|
|
726
|
+
*/
|
|
727
|
+
static new(): Parser;
|
|
728
|
+
/**
|
|
729
|
+
* Configure the parser to use the language identified by name (e.g. `"python"`).
|
|
730
|
+
*
|
|
731
|
+
* Resolves the language through the global registry — auto-downloading
|
|
732
|
+
* if necessary, when the `download` feature is enabled.
|
|
733
|
+
* @throws Returns [`Error::LanguageNotFound`] if the language is not recognized,
|
|
734
|
+
* or [`Error::ParserSetup`] if the language ABI is incompatible.
|
|
735
|
+
*/
|
|
736
|
+
setLanguage(name: string): void;
|
|
737
|
+
/**
|
|
738
|
+
* Parse a UTF-8 source string. Returns `None` if parsing was cancelled
|
|
739
|
+
* or no language is set.
|
|
740
|
+
*/
|
|
741
|
+
parse(source: string): Tree | null;
|
|
742
|
+
/**
|
|
743
|
+
* Parse a raw byte slice. Returns `None` if parsing was cancelled or
|
|
744
|
+
* no language is set.
|
|
745
|
+
*/
|
|
746
|
+
parseBytes(source: Uint8Array): Tree | null;
|
|
747
|
+
/**
|
|
748
|
+
* Reset internal state. The next call to [`parse`](Self::parse) will
|
|
749
|
+
* not be incremental.
|
|
750
|
+
*/
|
|
751
|
+
reset(): void;
|
|
752
|
+
static default(): Parser;
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
/** A source position — row + column, zero-indexed. */
|
|
756
756
|
export interface Point {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
757
|
+
/** Zero-indexed row number. */
|
|
758
|
+
readonly row: number;
|
|
759
|
+
/** Zero-indexed column number, in UTF-16 code units. */
|
|
760
|
+
readonly column: number;
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
/**
|
|
@@ -766,35 +766,35 @@ export interface Point {
|
|
|
766
766
|
* Controls which analysis features are enabled and whether chunking is performed.
|
|
767
767
|
*/
|
|
768
768
|
export interface ProcessConfig {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
769
|
+
/** Language name (required). */
|
|
770
|
+
readonly language?: string;
|
|
771
|
+
/** Extract structural items (functions, classes, etc.). Default: true. */
|
|
772
|
+
readonly structure?: boolean;
|
|
773
|
+
/** Extract import statements. Default: true. */
|
|
774
|
+
readonly imports?: boolean;
|
|
775
|
+
/** Extract export statements. Default: true. */
|
|
776
|
+
readonly exports?: boolean;
|
|
777
|
+
/** Extract comments. Default: false. */
|
|
778
|
+
readonly comments?: boolean;
|
|
779
|
+
/** Extract docstrings. Default: false. */
|
|
780
|
+
readonly docstrings?: boolean;
|
|
781
|
+
/** Extract symbol definitions. Default: false. */
|
|
782
|
+
readonly symbols?: boolean;
|
|
783
|
+
/** Include parse diagnostics. Default: false. */
|
|
784
|
+
readonly diagnostics?: boolean;
|
|
785
|
+
/** Maximum chunk size in bytes. `None` disables chunking. */
|
|
786
|
+
readonly chunkMaxSize?: number;
|
|
787
|
+
/**
|
|
788
|
+
* Extract hierarchical key/value data tree from data-format files. Default: false.
|
|
789
|
+
*
|
|
790
|
+
* When `true`, [`ProcessResult::data`](crate::ProcessResult::data) is populated
|
|
791
|
+
* with a [`DataNode`](crate::DataNode) tree for supported languages: JSON, YAML,
|
|
792
|
+
* TOML, `.properties`, HCL/HOCON, INI, editorconfig, KDL, CUE, CSV, PSV, PO,
|
|
793
|
+
* nginx config, Caddy config, XML, and DTD.
|
|
794
|
+
*
|
|
795
|
+
* For languages outside this set the field is left as `None`.
|
|
796
|
+
*/
|
|
797
|
+
readonly dataExtraction?: boolean;
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
/**
|
|
@@ -818,36 +818,36 @@ export interface ProcessConfig {
|
|
|
818
818
|
* - `chunks` - Chunked code segments (when `config.chunk_max_size` is set)
|
|
819
819
|
*/
|
|
820
820
|
export interface ProcessResult {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
821
|
+
/** The language name used to parse the source file. */
|
|
822
|
+
readonly language?: string;
|
|
823
|
+
/** File-level metrics (line counts, byte size, error count). */
|
|
824
|
+
readonly metrics?: FileMetrics;
|
|
825
|
+
/** Top-level structural items (functions, classes, etc.). */
|
|
826
|
+
readonly structure?: Array<StructureItem>;
|
|
827
|
+
/** Import statements extracted from the source. */
|
|
828
|
+
readonly imports?: Array<ImportInfo>;
|
|
829
|
+
/** Export statements extracted from the source. */
|
|
830
|
+
readonly exports?: Array<ExportInfo>;
|
|
831
|
+
/** Comments extracted from the source. */
|
|
832
|
+
readonly comments?: Array<CommentInfo>;
|
|
833
|
+
/** Docstrings extracted from the source. */
|
|
834
|
+
readonly docstrings?: Array<DocstringInfo>;
|
|
835
|
+
/** Symbol definitions (variables, types, functions) extracted from the source. */
|
|
836
|
+
readonly symbols?: Array<SymbolInfo>;
|
|
837
|
+
/** Parse diagnostics (syntax errors, missing nodes) from tree-sitter. */
|
|
838
|
+
readonly diagnostics?: Array<Diagnostic>;
|
|
839
|
+
/** Syntax-aware code chunks produced when chunking is enabled. */
|
|
840
|
+
readonly chunks?: Array<CodeChunk>;
|
|
841
|
+
/**
|
|
842
|
+
* Hierarchical data tree extracted when `config.data_extraction` is `true`.
|
|
843
|
+
*
|
|
844
|
+
* Populated for supported data-format languages (JSON, YAML, TOML, properties,
|
|
845
|
+
* HCL, INI, XML, CSV, and more). `None` when `data_extraction` is `false` (the
|
|
846
|
+
* default) or when the language is not a recognised data format.
|
|
847
|
+
*
|
|
848
|
+
* See [`DataNode`] for the shape of the returned tree.
|
|
849
|
+
*/
|
|
850
|
+
readonly data?: DataNode;
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
/**
|
|
@@ -857,40 +857,40 @@ export interface ProcessResult {
|
|
|
857
857
|
* positions (for display and diagnostics).
|
|
858
858
|
*/
|
|
859
859
|
export interface Span {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
860
|
+
/** Inclusive start byte offset in the source. */
|
|
861
|
+
readonly startByte?: number;
|
|
862
|
+
/** Exclusive end byte offset in the source. */
|
|
863
|
+
readonly endByte?: number;
|
|
864
|
+
/** Zero-indexed line number of the span's start. */
|
|
865
|
+
readonly startLine?: number;
|
|
866
|
+
/** Zero-indexed column number of the span's start. */
|
|
867
|
+
readonly startColumn?: number;
|
|
868
|
+
/** Zero-indexed line number of the span's end. */
|
|
869
|
+
readonly endLine?: number;
|
|
870
|
+
/** Zero-indexed column number of the span's end. */
|
|
871
|
+
readonly endColumn?: number;
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
/** A structural item (function, class, struct, etc.) in source code. */
|
|
875
875
|
export interface StructureItem {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
876
|
+
/** The kind of structural item. */
|
|
877
|
+
readonly kind?: StructureKind;
|
|
878
|
+
/** The declared name of the item, if present. */
|
|
879
|
+
readonly name?: string;
|
|
880
|
+
/** Visibility modifier (e.g., `"pub"`, `"public"`, `"private"`). */
|
|
881
|
+
readonly visibility?: string;
|
|
882
|
+
/** Source span covering the entire item declaration. */
|
|
883
|
+
readonly span?: Span;
|
|
884
|
+
/** Nested structural items (e.g., methods within a class). */
|
|
885
|
+
readonly children?: Array<StructureItem>;
|
|
886
|
+
/** Decorator or attribute names applied to the item. */
|
|
887
|
+
readonly decorators?: Array<string>;
|
|
888
|
+
/** Documentation comment attached to the item, if any. */
|
|
889
|
+
readonly docComment?: string;
|
|
890
|
+
/** Full signature text of the item (e.g., function parameters and return type). */
|
|
891
|
+
readonly signature?: string;
|
|
892
|
+
/** Source span covering only the body of the item, if distinct from the declaration. */
|
|
893
|
+
readonly bodySpan?: Span;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
/**
|
|
@@ -910,42 +910,42 @@ export interface StructureItem {
|
|
|
910
910
|
* Covered by `tests/wire_format.rs`.
|
|
911
911
|
*/
|
|
912
912
|
export declare enum StructureKind {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
913
|
+
/** A free-standing or associated function. */
|
|
914
|
+
Function = "Function",
|
|
915
|
+
/** A method defined inside a class, struct, trait, or impl block. */
|
|
916
|
+
Method = "Method",
|
|
917
|
+
/** A class definition. */
|
|
918
|
+
Class = "Class",
|
|
919
|
+
/** A struct definition. */
|
|
920
|
+
Struct = "Struct",
|
|
921
|
+
/** An interface or protocol definition. */
|
|
922
|
+
Interface = "Interface",
|
|
923
|
+
/** An enum definition. */
|
|
924
|
+
Enum = "Enum",
|
|
925
|
+
/** A module or package declaration. */
|
|
926
|
+
Module = "Module",
|
|
927
|
+
/** A trait definition. */
|
|
928
|
+
Trait = "Trait",
|
|
929
|
+
/** An impl block (Rust) or similar implementation block. */
|
|
930
|
+
Impl = "Impl",
|
|
931
|
+
/** A namespace declaration. */
|
|
932
|
+
Namespace = "Namespace",
|
|
933
|
+
/** A language-specific construct that does not fit any standard category. */
|
|
934
|
+
Other = "Other",
|
|
935
935
|
}
|
|
936
936
|
|
|
937
937
|
/** A symbol (variable, function, type, etc.) extracted from source code. */
|
|
938
938
|
export interface SymbolInfo {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
939
|
+
/** The name of the symbol. */
|
|
940
|
+
readonly name?: string;
|
|
941
|
+
/** The kind of symbol (variable, function, class, etc.). */
|
|
942
|
+
readonly kind?: SymbolKind;
|
|
943
|
+
/** Source span covering the symbol definition. */
|
|
944
|
+
readonly span?: Span;
|
|
945
|
+
/** Explicit type annotation, if present in the source. */
|
|
946
|
+
readonly typeAnnotation?: string;
|
|
947
|
+
/** Documentation comment associated with this symbol. */
|
|
948
|
+
readonly doc?: string;
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
/**
|
|
@@ -961,55 +961,55 @@ export interface SymbolInfo {
|
|
|
961
961
|
* NOT add `#[serde(tag = "...")]`. Covered by `tests/wire_format.rs`.
|
|
962
962
|
*/
|
|
963
963
|
export declare enum SymbolKind {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
964
|
+
/** A variable binding. */
|
|
965
|
+
Variable = "Variable",
|
|
966
|
+
/** A constant (immutable binding). */
|
|
967
|
+
Constant = "Constant",
|
|
968
|
+
/** A function definition. */
|
|
969
|
+
Function = "Function",
|
|
970
|
+
/** A class definition. */
|
|
971
|
+
Class = "Class",
|
|
972
|
+
/** A type alias or typedef. */
|
|
973
|
+
Type = "Type",
|
|
974
|
+
/** An interface definition. */
|
|
975
|
+
Interface = "Interface",
|
|
976
|
+
/** An enum definition. */
|
|
977
|
+
Enum = "Enum",
|
|
978
|
+
/** A module declaration. */
|
|
979
|
+
Module = "Module",
|
|
980
|
+
/** A symbol kind not covered by the standard variants. */
|
|
981
|
+
Other = "Other",
|
|
982
982
|
}
|
|
983
983
|
|
|
984
984
|
/** A parsed syntax tree. Cheap to clone (refcount bump). */
|
|
985
985
|
export declare class Tree {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
986
|
+
/** Return the root [`Node`] of this tree. */
|
|
987
|
+
rootNode(): Node;
|
|
988
|
+
/** Return a [`TreeCursor`] positioned at the root. */
|
|
989
|
+
walk(): TreeCursor;
|
|
990
990
|
}
|
|
991
991
|
|
|
992
992
|
/** A cursor for traversing a [`Tree`]. */
|
|
993
993
|
export declare class TreeCursor {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
994
|
+
/** Return the [`Node`] at the cursor's current position. */
|
|
995
|
+
node(): Node;
|
|
996
|
+
/**
|
|
997
|
+
* Move the cursor to the first child of the current node.
|
|
998
|
+
* Returns `true` if a child existed.
|
|
999
|
+
*/
|
|
1000
|
+
gotoFirstChild(): boolean;
|
|
1001
|
+
/**
|
|
1002
|
+
* Move the cursor to the parent of the current node.
|
|
1003
|
+
* Returns `true` if a parent existed.
|
|
1004
|
+
*/
|
|
1005
|
+
gotoParent(): boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* Move the cursor to the next sibling of the current node.
|
|
1008
|
+
* Returns `true` if a sibling existed.
|
|
1009
|
+
*/
|
|
1010
|
+
gotoNextSibling(): boolean;
|
|
1011
|
+
/** Return the field name for the current node, if any. */
|
|
1012
|
+
fieldName(): string | null;
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|