Skip to main content

Crate tsz_scanner

Crate tsz_scanner 

Source
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 CharacterCodes enum.
scanner_impl
Scanner implementation - the lexical analyzer for TypeScript.

Enums§

SyntaxKind
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 Identifier if 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