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
//! rxeval — evaluate ODK/OpenRosa XForms logic.
//!
//! The third piece beside [`rxform`](https://crates.io/crates/rxform)
//! (spreadsheet → XForm) and `rxdata` (submission → typed data): the rules
//! a form carries — `relevant`, `constraint`, `required`, `calculate` — are
//! written in XPath, and until something evaluates them a server can only
//! take a device's word for what it collected.
//!
//! One engine, three places. On the server it checks what arrived. Compiled
//! to WebAssembly it drives a web form. Bound from R it lets a
//! questionnaire's logic be exercised before anyone goes to the field.
//! Enketo's engine is browser-only JavaScript and JavaRosa's is JVM-only;
//! neither travels.
//!
//! **What an expression can do.** These are XForms expressions, not a
//! scripting language: the grammar is XPath 1.0, the only inputs are the
//! instance tree and the environment handed in, and evaluation performs no
//! I/O, spawns nothing and cannot reach the host. A hostile expression can
//! waste time or return a wrong answer; it cannot escape. `eval_str` is
//! named for XPath evaluation, and shares nothing with the `eval` of
//! interpreted languages.
//!
//! **Nothing here guesses.** An expression this crate does not understand is
//! an error, never a default. A form engine that returns `false` for a
//! `relevant` it failed to parse hides a question and reports success, and
//! the damage shows up in the data weeks later.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Parse and evaluate one expression against an instance, with `.` at the
/// root. The convenience path; a form engine keeps parsed expressions.