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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! dmog (data mogrify) as a library: what the `dmog` command does, for a
//! program to call.
//!
//! - **Translation.** [`translate()`] writes a document of any format
//! [`formats()`] lists in any other, as it reads it: [`Translation`]
//! compiles the route once, for many documents, and
//! [`TranslateOptions`] holds what the command's options say.
//! - **The formats.** [`formats()`] lists them as values, and
//! [`formats_json`] as `dmog formats` prints them; [`parsed_formats`]
//! names those whose documents a program can read as their parse.
//! - **Programs.** [`Program`] compiles an alchemy program and runs it over
//! a document, as `dmog run` does; [`canon`], [`format()`], [`check`],
//! [`explain`] and [`explain_json`] answer what the commands of those
//! names print.
//!
//! Input is a text, or a reader the run pulls from as it goes; output is a
//! text, or a writer the run writes to as it goes. Every failure is a
//! [`Fail`]: its [`Code`], its message, where it was found, and whether
//! output had already been written. The defaults are the command's:
//! [`default_limits`], the member a root is wrapped under, and the writer.
//!
//! A run compiles and evaluates on a thread of
//! [`tabnas_alchemy::STACK_BYTES`] that the library starts, so it may be
//! called from any thread. An [`Abort`] stops a run that is under way.
//!
//! ```
//! use tabnas_dmog::{translate_str, Program, ProgramOptions, Source, TranslateOptions};
//!
//! let json = translate_str("a: 1\nb: [x, y]\n", TranslateOptions::new("yaml", "json"))?;
//! assert_eq!(json, "{\"a\":1,\"b\":[\"x\",\"y\"]}\n");
//!
//! let names = Source::new(
//! "names.alc",
//! "def export [input]\n pipe input\n select (path each-index \"name\")\n join \",\"\n",
//! );
//! let program = Program::new(names, ProgramOptions::default())?;
//! assert_eq!(program.run_str(r#"[{"name":"Ada"},{"name":"Alan"}]"#)?, "Ada,Alan");
//! # Ok::<(), tabnas_dmog::Fail>(())
//! ```
//!
//! The `dmog` command is this library's first user: `src/bin/dmog.rs`
//! parses the command line, opens the files, and turns a failure into its
//! exit status.
pub use ;
pub use ;
pub use Abort;
pub use ;
pub use ;
/// A program's text, and the name its failures cite it by.
/// The limits a run has when none are given: the command's.
/// The README's examples, which `cargo test --doc` runs.
;