#![allow(clippy::needless_doctest_main)]
#[macro_export]
macro_rules! iota {
(const $n:ident : $t:ty = $($rest:tt)+) => {
$crate::__iota_dup!((0) const $n : $t = $($rest)+);
};
(pub const $n:ident : $t:ty = $($rest:tt)+) => {
$crate::__iota_dup!((0) pub const $n : $t = $($rest)+);
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __iota_dup {
(($v:expr)) => {};
(($v:expr) const $n:ident : $t:ty = $($rest:tt)+) => {
$crate::__iota_impl!(($v) () () const $n : $t = ($($rest)+) ($($rest)+));
};
(($v:expr) pub const $n:ident : $t:ty = $($rest:tt)+) => {
$crate::__iota_impl!(($v) () (pub) const $n : $t = ($($rest)+) ($($rest)+));
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __iota_impl {
(($v:expr) () $vis:tt const $n:ident : $t:ty = (; $($x:tt)*) ($semi:tt $($y:tt)*)) => {
$crate::__iota_impl!($semi);
};
(($v:expr) ($($seen:tt)*) $vis:tt const $n:ident : $t:ty = (const $($x:tt)*) ($cons:tt $($y:tt)*)) => {
$crate::__iota_impl!($cons);
};
(($v:expr) ($($seen:tt)*) $vis:tt const $n:ident : $t:ty = () $y:tt) => {
$crate::__iota_impl!();
};
(($v:expr) ($($seen:tt)+) ($($vis:tt)*) const $n:ident : $t:ty = (; , $i:ident $($rest:tt)*) $y:tt) => {
$($vis)* const $n : $t = $crate::__iota_replace!(($v) (()) $($seen)+);
$crate::__iota_impl!(($v + 1) ($($seen)+) ($($vis)*) const $i : $t = (; $($rest)*) (; $($rest)*));
};
(($v:expr) ($($seen:tt)+) ($($vis:tt)*) const $n:ident : $t:ty = (; $($rest:tt)*) $y:tt) => {
$($vis)* const $n : $t = $crate::__iota_replace!(($v) (()) $($seen)+);
$crate::__iota_dup!(($v + 1) $($rest)*);
};
(($v:expr) ($($seen:tt)*) $vis:tt const $n:ident : $t:ty = ($first:tt $($rest:tt)*) $y:tt) => {
$crate::__iota_impl!(($v) ($($seen)* $first) $vis const $n : $t = ($($rest)*) ($($rest)*));
};
(($v:expr) ()) => {};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __iota_replace {
(($v:expr) ($($stack:tt)*) ($($first:tt)*) $($rest:tt)*) => {
$crate::__iota_replace!(($v) (() $($stack)*) $($first)* __iota_close_paren $($rest)*)
};
(($v:expr) ($($stack:tt)*) [$($first:tt)*] $($rest:tt)*) => {
$crate::__iota_replace!(($v) (() $($stack)*) $($first)* __iota_close_bracket $($rest)*)
};
(($v:expr) ($($stack:tt)*) {$($first:tt)*} $($rest:tt)*) => {
$crate::__iota_replace!(($v) (() $($stack)*) $($first)* __iota_close_brace $($rest)*)
};
(($v:expr) (($($close:tt)*) ($($top:tt)*) $($stack:tt)*) __iota_close_paren $($rest:tt)*) => {
$crate::__iota_replace!(($v) (($($top)* ($($close)*)) $($stack)*) $($rest)*)
};
(($v:expr) (($($close:tt)*) ($($top:tt)*) $($stack:tt)*) __iota_close_bracket $($rest:tt)*) => {
$crate::__iota_replace!(($v) (($($top)* [$($close)*]) $($stack)*) $($rest)*)
};
(($v:expr) (($($close:tt)*) ($($top:tt)*) $($stack:tt)*) __iota_close_brace $($rest:tt)*) => {
$crate::__iota_replace!(($v) (($($top)* {$($close)*}) $($stack)*) $($rest)*)
};
(($v:expr) (($($top:tt)*) $($stack:tt)*) iota $($rest:tt)*) => {
$crate::__iota_replace!(($v) (($($top)* $v) $($stack)*) $($rest)*)
};
(($v:expr) (($($top:tt)*) $($stack:tt)*) $first:tt $($rest:tt)*) => {
$crate::__iota_replace!(($v) (($($top)* $first) $($stack)*) $($rest)*)
};
(($v:expr) (($($top:tt)+))) => {
$($top)+
};
}