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
//! # R4d(rad)
//! R4d is a text oriented macro processor that tries to solve inconveniences of well-known m4
//! macro processor.
//!
//! R4d is provided as both binary and library. Binary includes all features of optional
//! dependencies. Library doesn't provide any features by default so you can set them manually.
//!
//! # Features
//! 
//! ```text
//! - evalexpr : "eval" macro
//! - chrono   : "date", "time" macro
//! - lipsum   : "lipsum" macro
//! - csv      : "from", "table" macro
//! 
//! - debug    : Enable debug method
//! - color    : Enable color prompt
//!
//! - full     : evalexpr+chrono+lipsum+csv
//! ```
//!
//! # Simple usage
//!
//! **Binary**
//! ```text
//! # Read from file and print to stdout 
//! rad input_file.txt
//! # Read from standard input and print to file
//! printf '...text...' | rad -o out_file.txt
//! ```
//!
//! **Library**
//! ```rust
//! use rad::Processor;
//! use std::path::Path;
//! 
//! let mut processor = Processor::new()
//!     .purge(true)
//!     .greedy(true)
//!     .write_to_file(Some(Path::new("cache.txt")))?
//!     .build(); 
//! 
//! processor.from_file(Path::new("input.txt"))?;
//! processor.print_result()?;
//! ```
//!
//! Detailed r4d usage is illustrated in [github
//! page](https://github.com/simhyeon/r4d/blob/master/docs/usage.md) or in [processor
//! module](crate::processor)

mod error;
// This is necessary for docs.rs documentation
pub mod processor;

pub(crate) mod arg_parser;
pub(crate) mod auth;
pub(crate) mod basic;
pub(crate) mod closure_map;
pub(crate) mod keyword_map;
pub(crate) mod consts;
pub(crate) mod lexor;
pub(crate) mod logger;
pub(crate) mod models;
pub(crate) mod utils;

pub use error::RadError;
pub use basic::MacroType;
pub use processor::Processor;
pub use auth::AuthType;

// Optional

// Binary option
#[cfg(feature = "clap")]
mod cli;
#[cfg(feature = "clap")]
pub use cli::Cli;

// Only for csv
#[cfg(feature = "csv")]
pub(crate) mod formatter;