#![no_std]
#[macro_export]
macro_rules! concat {
($(,)*) => {
""
};
( $e:expr $(,)*) => {
::core::concat!($e)
};
( $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!( $e $(, $es)+ )
};
(with $w:expr $(,)*) => {
""
};
(with $w:expr, $e:expr $(,)*) => {
::core::concat!($e)
};
(with $w:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!( $e $(, $w, $es)+ )
};
(prefix $p:expr $(,)*) => {
""
};
(prefix $p:expr, $e:expr $(,)*) => {
::core::concat!($p, $e)
};
(prefix $p:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($p, $e $(, $p, $es)+ )
};
(suffix $s:expr $(,)*) => {
""
};
(suffix $s:expr, $e:expr $(,)*) => {
::core::concat!($e, $s)
};
(suffix $s:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($e, $s $(, $es, $s)+ )
};
(prefix $p:expr, suffix $s:expr $(,)*) => {
""
};
(prefix $p:expr, suffix $s:expr, $e:expr $(,)*) => {
::core::concat!($p, $e, $s)
};
(prefix $p:expr, suffix $s:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($p, $e, $s $(, $p, $es, $s)+ )
};
(suffix $s:expr, prefix $p:expr $(,)*) => {
$crate::concat!(prefix $p, suffix $s)
};
(suffix $s:expr, prefix $p:expr, $e:expr $(,)*) => {
$crate::concat!(prefix $p, suffix $s, $e)
};
(suffix $s:expr, prefix $p:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(prefix $p, suffix $s, $e $(, $es)+)
};
(with $w:expr, prefix $p:expr $(,)*) => {
""
};
(with $w:expr, prefix $p:expr, $e:expr $(,)*) => {
::core::concat!($p, $e)
};
(with $w:expr, prefix $p:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($p, $e $(, $w, $p, $es)+ )
};
(prefix $p:expr, with $w:expr $(,)*) => {
$crate::concat!(with $w, prefix $p)
};
(prefix $p:expr, with $w:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, $e)
};
(prefix $p:expr, with $w:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, $e $(, $es)+)
};
(with $w:expr, suffix $s:expr $(,)*) => {
""
};
(with $w:expr, suffix $s:expr, $e:expr $(,)*) => {
::core::concat!($e, $s)
};
(with $w:expr, suffix $s:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($e, $s $(, $w, $es, $s)+ )
};
(suffix $s:expr, with $w:expr $(,)*) => {
$crate::concat!(with $w, suffix $s)
};
(suffix $s:expr, with $w:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, suffix $s, $e)
};
(suffix $s:expr, with $w:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, suffix $s, $e $(, $es)+)
};
(with $w:expr, prefix $p:expr, suffix $s:expr $(,)*) => {
""
};
(with $w:expr, prefix $p:expr, suffix $s:expr, $e:expr $(,)*) => {
::core::concat!($p, $e, $s)
};
(with $w:expr, prefix $p:expr, suffix $s:expr, $e:expr $(, $es:expr)+ $(,)*) => {
::core::concat!($p, $e, $s $(, $w, $p, $es, $s)+ )
};
(prefix $p:expr, with $w:expr, suffix $s:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s)
};
(prefix $p:expr, with $w:expr, suffix $s:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e)
};
(prefix $p:expr, with $w:expr, suffix $s:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e $(, $es)+)
};
(prefix $p:expr, suffix $s:expr, with $w:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s)
};
(prefix $p:expr, suffix $s:expr, with $w:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e)
};
(prefix $p:expr, suffix $s:expr, with $w:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e $(, $es)+)
};
(with $w:expr, suffix $s:expr, prefix $p:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s)
};
(with $w:expr, suffix $s:expr, prefix $p:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e)
};
(with $w:expr, suffix $s:expr, prefix $p:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e $(, $es)+)
};
(suffix $s:expr, with $w:expr, prefix $p:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s)
};
(suffix $s:expr, with $w:expr, prefix $p:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e)
};
(suffix $s:expr, with $w:expr, prefix $p:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e $(, $es)+)
};
(suffix $s:expr, prefix $p:expr, with $w:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s)
};
(suffix $s:expr, prefix $p:expr, with $w:expr, $e:expr $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e)
};
(suffix $s:expr, prefix $p:expr, with $w:expr, $e:expr $(, $es:expr)+ $(,)*) => {
$crate::concat!(with $w, prefix $p, suffix $s, $e $(, $es)+)
};
}
#[macro_export]
macro_rules! concat_impl {
(@inner $(#[$attr:meta])* $name:ident, $w: expr, $dollar:tt) => {
$(#[$attr])*
macro_rules! $name {
($dollar($dollar e:expr),* $dollar(,)*) => {
$crate::concat!(with $w $dollar(, $dollar e)*)
};
(prefix $dollar p:expr $dollar(, $dollar e:expr)* $dollar(,)*) => {
$crate::concat!(with $w, prefix $dollar p $dollar (, $dollar e)*)
};
(suffix $dollar s:expr $dollar(, $e:expr)* $dollar(,)*) => {
$crate::concat!(with $w, suffix $dollar s $dollar(, $dollar e)*)
};
(prefix $dollar p:expr, suffix $dollar s:expr $dollar(, $dollar e:expr)* $dollar(,)*) => {
$crate::concat!(with $w, prefix $dollar p, suffix $dollar s $dollar(, $dollar e)*)
};
(suffix $dollar s:expr, prefix $dollar p:expr $dollar(, $dollar e:expr)* $dollar(,)*) => {
$crate::concat!(with $w, prefix $dollar p, suffix $dollar s $dollar(, $dollar e)*)
};
}
};
($($(#[$attr:meta])* $name:ident => $w:expr),* $(,) *) => {
$(
$crate::concat_impl!(@inner $(#[$attr])* $name, $w, $);
)*
};
}
concat_impl! {
#[macro_export]
concat_line => "\n"
}