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
55
56
57
58
59
60
61
//! **ViperJS** — an embeddable JavaScript engine in safe Rust, with zero runtime dependencies.
//!
//! Start at [`api`]. [`api::Engine`] runs a script, binds host functions written in Rust, and can
//! give a run a wall-clock budget that the script **cannot catch** — which is what makes running
//! untrusted source a configuration problem rather than a liability. `examples/embed.rs` is the
//! tour.
//!
//! Everything else is public because the engine is meant to be taken apart: [`lexer`], [`parser`]
//! and [`compile`] are each usable on their own, and [`span`] is the worked example of the standard
//! the rest is held to. That is a wide surface on purpose, and none of it is stable until 1.0.
//!
//! # The one invariant that outranks everything
//!
//! **No input may panic.** Every failure a script author can cause — a syntax error, a stack
//! overflow, a 100 MB string literal, a truncated UTF-16 surrogate — is a `Result`, never a
//! panic and never a process exit. An embedder runs untrusted source inside their own binary;
//! a panic there is our bug, categorically, and no amount of "well, that input is absurd"
//! makes it not our bug.
pub use crate;
/// The engine version, as reported to embedders (`viperjs::VERSION`).
pub const VERSION: &str = env!;
/// Two things about the comments that no compiler checks — see the module for why they are tests.