UNPKG

691 BTypeScriptView Raw
1/**
2 * Token type.
3 */
4export declare type TokenType = 'ident' | '(' | ')' | ',' | '=' | '*' | 'function' | 'class' | 'EOF';
5/**
6 * Lexer Token.
7 */
8export interface Token {
9 type: TokenType;
10 value?: string;
11}
12/**
13 * Flags that can be passed to the tokenizer to toggle certain things.
14 */
15export declare const enum TokenizerFlags {
16 None = 0,
17 /**
18 * If this is set, the tokenizer will not attempt to be smart about skipping expressions.
19 */
20 Dumb = 1
21}
22/**
23 * Creates a tokenizer for the specified source.
24 *
25 * @param source
26 */
27export declare function createTokenizer(source: string): {
28 next: (nextFlags?: TokenizerFlags) => Token;
29 done: () => boolean;
30};