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
#[macro_export]
macro_rules! whitelist {
($input:expr, $($inner:tt)*) => ($crate::ParseResult::Done($($inner)*));
}
#[macro_export]
macro_rules! unlift {
($input:expr, $($inner:tt)*) => {
$($inner)*
}
}
#[macro_export]
macro_rules! from {
($input:expr, $result:expr) => ({
match parse!($input, $result) {
$crate::ParseResult::Done(result) => $crate::ParseResult::from(result),
$crate::ParseResult::Error(e) => $crate::ParseResult::Error(e)
}
});
}
#[macro_export]
macro_rules! parse_error {
($input:expr, $name:expr, $error:expr) => (
$crate::ParseError::custom($name, $error)
);
}