| Crates.io | jsompiler_lexer |
| lib.rs | jsompiler_lexer |
| version | 0.2.2 |
| created_at | 2025-03-29 08:18:36.905093+00 |
| updated_at | 2025-04-21 18:00:52.043575+00 |
| description | Lexer for JavaScript |
| homepage | |
| repository | https://github.com/abhiyandhakal/jsompiler |
| max_upload_size | |
| id | 1610923 |
| size | 81,756 |
The jsompiler_lexer is responsible for the lexical analysis part of the jsompiler project. It takes raw JavaScript source code and converts it into a stream of tokens, which are used by the parser for syntax analysis.
Note: This project is currently under active development. Interfaces and behavior may change as the project evolves.
\u0041) are not yet supported.Add jsompiler_lexer to your Cargo.toml:
[dependencies]
jsompiler_lexer = "0.2.1"
OR Run the following Cargo command in your project directory:
cargo add jsompiler_lexer
const pi = 3.1416;
| Lexemes | Tokens |
|---|---|
| const | Keyword(Const) |
| pi | Identifier("pi") |
| = | Operator(EqualTo) |
| 3.1416 | Literal(Number(Value(3.1416))) |
| ; | Delimiter(Semicolon) |
| EOF | EOF |
Add this crate to your project
use jsompiler_lexer::Lexer;
let source = "const pi = 3.1416;";
let mut lexer = Lexer::new(source);
lexer.scan_all_tokens();
println!("{:#?}", lexer.tokens);
println!("{:#?}", lexer.errors);
const, function, void, typeof, if, return, else, instanceof, in, while, for, do, true, false, exports, break, continue, switch, null, case, debugger, class, new, this, super, import, export, default, try, catch, finally, throw, enum, extends, delete
let, package, interface, get, set, arguments, public, eval, protected, private, meta, target, async, await, from, as, from, as, of, yield, static, with, implements
+, -, *, /, %, **, ++, --
=, +=, -=, *=, /=, %=, **=, &=, |=, ^=, <<=, >>=, >>>=, &&=, ||=, ??=
==, ===, !=, !==, >, <, >=, <=
&&, ||, !, ??
&, |, ^, ~, <<, >>, >>>
=>, ?, :, ?., ...
(, ), {, } ,[, ], ;, ,, .
//, /*
undefined, null, NaN, Infinity