UNPKG

2.19 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 ObjectKey = 9
14}
15export declare function isDeclaration(token: Token): boolean;
16export declare function isNonTopLevelDeclaration(token: Token): boolean;
17export declare function isBlockScopedDeclaration(token: Token): boolean;
18export declare function isFunctionScopedDeclaration(token: Token): boolean;
19export declare function isObjectShorthandDeclaration(token: Token): boolean;
20export declare class Token {
21 constructor();
22 type: TokenType;
23 contextualKeyword: ContextualKeyword;
24 start: number;
25 end: number;
26 isType: boolean;
27 identifierRole: IdentifierRole | null;
28 shadowsGlobal: boolean;
29 contextId: number | null;
30 rhsEndIndex: number | null;
31 isExpression: boolean;
32}
33export declare function next(): void;
34export declare function nextTemplateToken(): void;
35export declare function retokenizeSlashAsRegex(): void;
36export declare function pushTypeContext(existingTokensInType: number): boolean;
37export declare function popTypeContext(oldIsType: boolean): void;
38export declare function eat(type: TokenType): boolean;
39export declare function match(type: TokenType): boolean;
40export declare function lookaheadType(): TokenType;
41export declare class TypeAndKeyword {
42 type: TokenType;
43 contextualKeyword: ContextualKeyword;
44 constructor(type: TokenType, contextualKeyword: ContextualKeyword);
45}
46export declare function lookaheadTypeAndKeyword(): TypeAndKeyword;
47export declare function nextToken(): void;
48export declare function skipLineComment(startSkip: number): void;
49export declare function skipSpace(): void;
50export declare function finishToken(type: TokenType, contextualKeyword?: ContextualKeyword): void;
51export declare function getTokenFromCode(code: number): void;
52export declare function skipWord(): void;