Expand description
Scanner types and utilities for TypeScript lexical analysis.
This module contains the SyntaxKind enum, scanner implementation,
and character code constants for TypeScript lexical analysis.
Modules§
- char_
codes - Character codes matching TypeScript’s
CharacterCodesenum. - scanner_
impl - Scanner implementation - the lexical analyzer for TypeScript.
Enums§
- Syntax
Kind - Syntax kind enum matching TypeScript’s
SyntaxKind. This enum contains only the token types produced by the scanner (0-186). AST node types are not included here.
Functions§
- keyword_
to_ text - Get the text representation of a keyword token. WASM-exported version that allocates a String for JS compatibility.
- keyword_
to_ text_ static - Internal non-allocating version - returns static str reference. Use this for Rust-internal code to avoid allocations.
- punctuation_
to_ text - Get the text representation of a punctuation token. WASM-exported version that allocates a String for JS compatibility.
- punctuation_
to_ text_ static - Internal non-allocating version - returns static str reference. Use this for Rust-internal code to avoid allocations.
- string_
to_ token - Get the token kind for a given text, including identifiers and keywords.
Returns
Identifierif the text is not a keyword. - text_
to_ keyword - Convert a string to its keyword
SyntaxKind, if it’s a keyword. Returns None if the text is not a keyword. - token_
is_ assignment_ operator - token_
is_ identifier_ or_ keyword - token_
is_ keyword - token_
is_ literal - token_
is_ punctuation - token_
is_ reserved_ word - token_
is_ strict_ mode_ reserved_ word - token_
is_ template_ literal - token_
is_ trivia