1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! `quickjs-parse` — ECMAScript 2025 lexer, AST and parser.
//!
//! Milestone status: **the lexer is complete (M1a)**; the AST and parser are the
//! next step and do not exist yet.
//!
//! ```no_run
//! use js_parse::{Lexer, TokenKind};
//!
//! let mut lexer = Lexer::new("let answer = 0x2a + 1_000;");
//! let mut kinds = Vec::new();
//! loop {
//! let token = lexer.next_token().expect("valid source");
//! let done = matches!(token.kind, TokenKind::Eof);
//! kinds.push(token.kind);
//! if done {
//! break;
//! }
//! }
//! assert_eq!(kinds.len(), 8);
//! ```
//!
//! # Known limitation
//!
//! String values are Rust `String`s, so a lone surrogate (`"\ud800"`) cannot be
//! represented yet: it is decoded to U+FFFD. QuickJS keeps UTF-16 code units
//! and reports `"\ud800".length === 1`, so the string representation must gain
//! WTF-8 (or UTF-16) support in the `js-value` milestone. This is tracked as a
//! `TODO(js-value)` and only affects lone surrogates, never well-formed text.
pub use ;
pub use Lexer;
pub use ;
/// Parser configuration constants and helpers.
pub use ;