UNPKG

2.58 kBTypeScriptView Raw
1import { ContextualKeyword } from "./keywords";
2import { TokenType } from "./types";
3export declare enum IdentifierRole {
4 Access = 0,
5 ExportAccess = 1,
6 TopLevelDeclaration = 2,
7 FunctionScopedDeclaration = 3,
8 BlockScopedDeclaration = 4,
9 ObjectShorthandTopLevelDeclaration = 5,
10 ObjectShorthandFunctionScopedDeclaration = 6,
11 ObjectShorthandBlockScopedDeclaration = 7,
12 ObjectShorthand = 8,
13 ImportDeclaration = 9,
14 ObjectKey = 10,
15 ImportAccess = 11
16}
17export declare function isDeclaration(token: Token): boolean;
18export declare function isNonTopLevelDeclaration(token: Token): boolean;
19export declare function isTopLevelDeclaration(token: Token): boolean;
20export declare function isBlockScopedDeclaration(token: Token): boolean;
21export declare function isFunctionScopedDeclaration(token: Token): boolean;
22export declare function isObjectShorthandDeclaration(token: Token): boolean;
23export declare class Token {
24 constructor();
25 type: TokenType;
26 contextualKeyword: ContextualKeyword;
27 start: number;
28 end: number;
29 scopeDepth: number;
30 isType: boolean;
31 identifierRole: IdentifierRole | null;
32 shadowsGlobal: boolean;
33 isAsyncOperation: boolean;
34 contextId: number | null;
35 rhsEndIndex: number | null;
36 isExpression: boolean;
37 numNullishCoalesceStarts: number;
38 numNullishCoalesceEnds: number;
39 isOptionalChainStart: boolean;
40 isOptionalChainEnd: boolean;
41 subscriptStartIndex: number | null;
42 nullishStartIndex: number | null;
43}
44export declare function next(): void;
45export declare function nextTemplateToken(): void;
46export declare function retokenizeSlashAsRegex(): void;
47export declare function pushTypeContext(existingTokensInType: number): boolean;
48export declare function popTypeContext(oldIsType: boolean): void;
49export declare function eat(type: TokenType): boolean;
50export declare function match(type: TokenType): boolean;
51export declare function lookaheadType(): TokenType;
52export declare class TypeAndKeyword {
53 type: TokenType;
54 contextualKeyword: ContextualKeyword;
55 constructor(type: TokenType, contextualKeyword: ContextualKeyword);
56}
57export declare function lookaheadTypeAndKeyword(): TypeAndKeyword;
58export declare function nextToken(): void;
59export declare function skipLineComment(startSkip: number): void;
60export declare function skipSpace(): void;
61export declare function finishToken(type: TokenType, contextualKeyword?: ContextualKeyword): void;
62export declare function getTokenFromCode(code: number): void;
63export declare function skipWord(): void;