Classes
JavaScriptStateMachineLexer
2
▼
JavaScript/ECMAScript lexer using composable mixins.
Supports ES2024 syntax with all modern featur…
JavaScriptStateMachineLexer
2
▼
JavaScript/ECMAScript lexer using composable mixins.
Supports ES2024 syntax with all modern features. Most scanning logic is inherited from C-style mixins; only JS-specific parts are here.
Configuration: NUMBER_CONFIG: Enables BigInt suffix ('n') STRING_CONFIG: Enables template literals (backticks) OPERATOR_CONFIG: JS-specific operators (===, ??, ?., etc.)
Token Classification:
- Declaration keywords: function, class, const, let, var
- Namespace keywords: import, export, from
- Constants: true, false, null, undefined, NaN, Infinity
- Builtins: Array, Promise, console, window, etc.
Methods
tokenize
2
Iterator[Token]
▼
Tokenize JavaScript source code.
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]
Internal Methods 1 ▼
_classify_word
1
TokenType
▼
Classify an identifier.
_classify_word
1
TokenType
▼
def _classify_word(self, word: str) -> TokenType
Parameters
| Name | Type | Description |
|---|---|---|
word |
— |
Returns
TokenType