Classes
TypeScriptStateMachineLexer
1
▼
TypeScript lexer using composable mixins.
Extends JavaScript syntax with TypeScript-specific featu…
TypeScriptStateMachineLexer
1
▼
TypeScript lexer using composable mixins.
Extends JavaScript syntax with TypeScript-specific features.
Token Classification:
- Type keywords: any, boolean, never, number, string, unknown, void
- Declaration keywords: type, interface, enum, class, function
- Namespace keywords: import, export, namespace
- Utility types as builtins: Partial, Required, Pick, Omit, etc.
Special Handling:
- Decorators: @decorator → NAME_DECORATOR
- Template literals:
string ${expr}→ STRING - Non-null assertion: !. operator
Methods
tokenize
2
Iterator[Token]
▼
tokenize
2
Iterator[Token]
▼
def tokenize(self, code: str, config: LexerConfig | None = None) -> Iterator[Token]
Parameters
| Name | Type | Description |
|---|---|---|
code |
— |
|
config |
— |
Default:None
|
Returns
Iterator[Token]