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
#![feature(let_chains)]
#![feature(pattern)]
#![feature(rustc_attrs)]
mod control_str;
mod tildes;
pub use control_str::*;
pub use tildes::*;
#[macro_export]
macro_rules! multi_tilde_impl {
($implName:ident, [$($y:ident),+], $s:ident,$body:block) => {
$(
impl $implName for $y {
fn format(&$s, tkind: &TildeKind) -> Result<Option<String>, Box<dyn std::error::Error>>
$body
}
)+
};
}
#[macro_export]
macro_rules! tilde {
($arg:expr) => {
$arg as &dyn crate::TildeAble
};
}
#[macro_export]
macro_rules! cl_format {
($control_str:expr) => {
{
let c = crate::ControlStr::from($control_str).expect("making control string has issue");
let a = crate::Args::new(vec![]);
c.reveal(a)
}
};
($control_str:expr, $($ele:expr),*) => {
{
let c = crate::ControlStr::from($control_str).expect("making control string has issue");
let a = Into::<crate::Args<'_>>::into([$(tilde!($ele)),*]);
c.reveal(a)
}
}
}
#[cfg(test)]
mod tests {}