@tslite/parser 1.10.0 → 1.13.0
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/LICENSE +55 -0
- package/NOTICE +14 -0
- package/dist/_namespaces/ts.d.ts +18 -0
- package/dist/_namespaces/ts.js +21 -0
- package/dist/_namespaces/ts.performance.d.ts +1 -0
- package/dist/_namespaces/ts.performance.js +2 -0
- package/dist/core.d.ts +450 -0
- package/dist/core.js +1394 -0
- package/dist/corePublic.d.ts +62 -0
- package/dist/corePublic.js +31 -0
- package/dist/debug.d.ts +74 -0
- package/dist/debug.js +326 -0
- package/dist/diagnosticInformationMap.generated.d.ts +1435 -0
- package/dist/diagnosticInformationMap.generated.js +1441 -0
- package/dist/factory.d.ts +78 -0
- package/dist/factory.js +622 -0
- package/dist/factoryPublic.d.ts +314 -0
- package/dist/factoryPublic.js +1796 -0
- package/dist/index.d.ts +1 -249
- package/dist/index.js +4 -6
- package/dist/parser.d.ts +59 -0
- package/dist/parser.js +5075 -0
- package/dist/path.d.ts +312 -0
- package/dist/path.js +475 -0
- package/dist/perfLogger.d.ts +4 -0
- package/dist/perfLogger.js +38 -0
- package/dist/performance.d.ts +20 -0
- package/dist/performance.js +49 -0
- package/dist/performanceTimestamp.d.ts +2 -0
- package/dist/performanceTimestamp.js +2 -0
- package/dist/scanner.d.ts +80 -0
- package/dist/scanner.js +1984 -0
- package/dist/shims/mapShim.d.ts +23 -0
- package/dist/shims/mapShim.js +156 -0
- package/dist/types.d.ts +2626 -0
- package/dist/types.js +1074 -0
- package/dist/utilities.d.ts +473 -0
- package/dist/utilities.js +2632 -0
- package/dist/utilitiesPublic.d.ts +274 -0
- package/dist/utilitiesPublic.js +1049 -0
- package/dist/visitor.d.ts +15 -0
- package/dist/visitor.js +64 -0
- package/dist/visitorPublic.d.ts +82 -0
- package/dist/visitorPublic.js +352 -0
- package/package.json +14 -42
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +0 -249
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { LanguageVariant, ScriptTarget, SyntaxKind, TokenFlags } from "./_namespaces/ts.js";
|
|
2
|
+
import type { CommentDirective, CommentKind, CommentRange, DiagnosticMessage, JsxTokenSyntaxKind, LineAndCharacter, SourceFileLike } from "./_namespaces/ts.js";
|
|
3
|
+
export type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
|
|
4
|
+
export declare function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean;
|
|
5
|
+
export declare function tokenIsIdentifierOrKeywordOrGreaterThan(token: SyntaxKind): boolean;
|
|
6
|
+
export interface Scanner {
|
|
7
|
+
getStartPos(): number;
|
|
8
|
+
getToken(): SyntaxKind;
|
|
9
|
+
getTextPos(): number;
|
|
10
|
+
getTokenPos(): number;
|
|
11
|
+
getTokenText(): string;
|
|
12
|
+
getTokenValue(): string;
|
|
13
|
+
hasUnicodeEscape(): boolean;
|
|
14
|
+
hasExtendedUnicodeEscape(): boolean;
|
|
15
|
+
hasPrecedingLineBreak(): boolean;
|
|
16
|
+
isIdentifier(): boolean;
|
|
17
|
+
isReservedWord(): boolean;
|
|
18
|
+
isUnterminated(): boolean;
|
|
19
|
+
getCommentDirectives(): CommentDirective[] | undefined;
|
|
20
|
+
getTokenFlags(): TokenFlags;
|
|
21
|
+
reScanGreaterToken(): SyntaxKind;
|
|
22
|
+
reScanTemplateToken(): SyntaxKind;
|
|
23
|
+
scanJsxIdentifier(): SyntaxKind;
|
|
24
|
+
scanJsxAttributeValue(): SyntaxKind;
|
|
25
|
+
reScanJsxAttributeValue(): SyntaxKind;
|
|
26
|
+
reScanJsxToken(): JsxTokenSyntaxKind;
|
|
27
|
+
reScanLessThanToken(): SyntaxKind;
|
|
28
|
+
reScanQuestionToken(): SyntaxKind;
|
|
29
|
+
scanJsxToken(): JsxTokenSyntaxKind;
|
|
30
|
+
scan(): SyntaxKind;
|
|
31
|
+
getText(): string;
|
|
32
|
+
clearCommentDirectives(): void;
|
|
33
|
+
setText(text: string | undefined, start?: number, length?: number): void;
|
|
34
|
+
setOnError(onError: ErrorCallback | undefined): void;
|
|
35
|
+
setScriptTarget(scriptTarget: ScriptTarget): void;
|
|
36
|
+
setLanguageVariant(variant: LanguageVariant): void;
|
|
37
|
+
setTextPos(textPos: number): void;
|
|
38
|
+
lookAhead<T>(callback: () => T): T;
|
|
39
|
+
scanRange<T>(start: number, length: number, callback: () => T): T;
|
|
40
|
+
tryScan<T>(callback: () => T): T;
|
|
41
|
+
}
|
|
42
|
+
export declare function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget | undefined): boolean;
|
|
43
|
+
export declare function tokenToString(t: SyntaxKind): string | undefined;
|
|
44
|
+
export declare function stringToToken(s: string): SyntaxKind | undefined;
|
|
45
|
+
export declare function computeLineStarts(text: string): number[];
|
|
46
|
+
export declare function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number;
|
|
47
|
+
export declare function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number, allowEdits?: true): number;
|
|
48
|
+
export declare function computePositionOfLineAndCharacter(lineStarts: readonly number[], line: number, character: number, debugText?: string, allowEdits?: true): number;
|
|
49
|
+
export declare function getLineStarts(sourceFile: SourceFileLike): readonly number[];
|
|
50
|
+
export declare function computeLineAndCharacterOfPosition(lineStarts: readonly number[], position: number): LineAndCharacter;
|
|
51
|
+
/**
|
|
52
|
+
* We assume the first line starts at position 0 and 'position' is non-negative.
|
|
53
|
+
*/
|
|
54
|
+
export declare function computeLineOfPosition(lineStarts: readonly number[], position: number, lowerBound?: number): number;
|
|
55
|
+
export declare function getLinesBetweenPositions(sourceFile: SourceFileLike, pos1: number, pos2: number): number;
|
|
56
|
+
export declare function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter;
|
|
57
|
+
export declare function isWhiteSpaceLike(ch: number): boolean;
|
|
58
|
+
/** Does not include line breaks. For that, see isWhiteSpaceLike. */
|
|
59
|
+
export declare function isWhiteSpaceSingleLine(ch: number): boolean;
|
|
60
|
+
export declare function isLineBreak(ch: number): boolean;
|
|
61
|
+
export declare function isOctalDigit(ch: number): boolean;
|
|
62
|
+
export declare function couldStartTrivia(text: string, pos: number): boolean;
|
|
63
|
+
export declare function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean): number;
|
|
64
|
+
export declare function isShebangTrivia(text: string, pos: number): boolean;
|
|
65
|
+
export declare function scanShebangTrivia(text: string, pos: number): number;
|
|
66
|
+
export declare function forEachLeadingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
|
|
67
|
+
export declare function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
|
|
68
|
+
export declare function forEachTrailingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
|
|
69
|
+
export declare function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
|
|
70
|
+
export declare function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U | undefined) => U, state: T, initial: U | undefined): U | undefined;
|
|
71
|
+
export declare function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U | undefined) => U, state: T, initial: U | undefined): U | undefined;
|
|
72
|
+
export declare function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
|
|
73
|
+
export declare function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
|
|
74
|
+
/** Optionally, get the shebang */
|
|
75
|
+
export declare function getShebang(text: string): string | undefined;
|
|
76
|
+
export declare function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean;
|
|
77
|
+
export declare function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined, identifierVariant?: LanguageVariant): boolean;
|
|
78
|
+
export declare function isIdentifierText(name: string, languageVersion: ScriptTarget | undefined, identifierVariant?: LanguageVariant): boolean;
|
|
79
|
+
export declare function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
|
80
|
+
export declare function utf16EncodeAsString(codePoint: number): string;
|