#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_path {
{
$caller:tt
input = [{ $($input:tt)* }]
} => {
$crate::private_parse_path! {
$caller
tokens = [{ $($input)* }]
_tokens = [{ $($input)* }]
}
};
{
$caller:tt
tokens = [{ :: $_segment:ident $($rest:tt)* }]
_tokens = [{ $colons:tt $segment:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_possibly_empty_path_after_ident }]
input = [{ $($rest)* }]
~~> $crate::private_parse_path! {
$caller
prefix = [{ $colons $segment }]
}
}
};
{
$caller:tt
tokens = [{ $_segment:ident $($rest:tt)* }]
_tokens = [{ $segment:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_possibly_empty_path_after_ident }]
input = [{ $($rest)* }]
~~> $crate::private_parse_path! {
$caller
prefix = [{ $segment }]
}
}
};
{
$caller:tt
prefix = [{ $($prefix:tt)* }]
path = [{ $($path:tt)* }]
rest = [{ $($rest:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($prefix)* $($path)* }]
rest = [{ $($rest)* }]
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_possibly_empty_path_after_ident {
{
$caller:tt
input = [{ $($input:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_ident! {
$caller
path = [{ }]
tokens = [{ $($input)* }]
_tokens = [{ $($input)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ < > $($rest:tt)* }]
_tokens = [{ $lt:tt $gt:tt $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* $lt $gt }]
tokens = [{ $($rest)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ < }]
_tokens = [{ $unexpected:tt }]
} => {
$crate::error_unexpected! {
$unexpected
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ < $($rest:tt)+ }]
_tokens = [{ $lt:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_generic_param }]
input = [{ $($rest)* }]
~~> $crate::private_parse_in_angle_brackets! {
$caller
prefix = [{ $($path)* $lt }]
}
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ :: < > $($rest:tt)* }]
_tokens = [{ $colons:tt $lt:tt $gt:tt $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* $colons $lt $gt }]
tokens = [{ $($rest)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ :: < $($rest:tt)+ }]
_tokens = [{ $colons:tt $lt:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_generic_param }]
input = [{ $($rest)* }]
~~> $crate::private_parse_in_angle_brackets! {
$caller
prefix = [{ $($path)* $colons $lt }]
}
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ ($($args:tt)*) $($rest:tt)* }]
_tokens = [{ $original:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_validate_fn_path_args }]
tokens = [{ $($args)* }]
~~> $crate::private_parse_path_after_fn_args! {
$caller
path = [{ $($path)* $original }]
tokens = [{ $($rest)* }]
}
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ $($tokens:tt)* }]
_tokens = [{ $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* }]
tokens = [{ $($tokens)* }]
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_possibly_empty_path_after_close_angle {
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ $($tokens:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* }]
tokens = [{ $($tokens)* }]
_tokens = [{ $($tokens)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ :: $_segment:ident $($rest:tt)* }]
_tokens = [{ $colons:tt $segment:tt $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_ident! {
$caller
path = [{ $($path)* $colons $segment }]
tokens = [{ $($rest)* }]
_tokens = [{ $($rest)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ :: $($unexpected:tt)+ }]
_tokens = [{ $($dup:tt)* }]
} => {
$crate::error_unexpected! {
$($unexpected)*
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ $($rest:tt)* }]
_tokens = [{ $($dup:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($path)* }]
rest = [{ $($rest)* }]
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_in_angle_brackets {
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ $($rest:tt)* }]
} => {
$crate::private_parse_in_angle_brackets! {
$caller
prefix = [{ $($path)* }]
param = [{ $($param)* }]
rest = [{ $($rest)* }]
_rest = [{ $($rest)* }]
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ > $($rest:tt)* }]
_rest = [{ $gt:tt $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* $($param)* $gt }]
tokens = [{ $($rest)* }]
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ >> $($rest:tt)* }]
_rest = [{ $($dup:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($path)* $($param)* > }]
rest = [{ > $($rest)* }]
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ , > $($rest:tt)* }]
_rest = [{ $comma:tt $gt:tt $($dup:tt)* }]
} => {
$crate::private_parse_possibly_empty_path_after_close_angle! {
$caller
path = [{ $($path)* $($param)* $comma $gt }]
tokens = [{ $($rest)* }]
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ , >> $($rest:tt)* }]
_rest = [{ $comma:tt $($dup:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($path)* $($param)* $comma > }]
rest = [{ > $($rest)* }]
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ , $($rest:tt)+ }]
_rest = [{ $comma:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_generic_param }]
input = [{ $($rest)* }]
~~> $crate::private_parse_in_angle_brackets! {
$caller
prefix = [{ $($path)* $($param)* $comma }]
}
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)* }]
rest = [{ $($unexpected:tt)+ }]
_rest = [{ $($dup:tt)* }]
} => {
$crate::error_unexpected! {
$($unexpected)*
}
};
{
$caller:tt
prefix = [{ $($path:tt)* }]
param = [{ $($param:tt)+ }]
rest = [{ }]
_rest = [{ }]
} => {
$crate::error_unexpected_last! {
$($param)*
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_generic_param {
{
$caller:tt
input = [{ $lifetime:lifetime $($rest:tt)* }]
} => {
$crate::tt_return! {
$caller
param = [{ $lifetime }]
rest = [{ $($rest)* }]
}
};
{
$caller:tt
input = [{ $assoc:ident = $($rest:tt)+ }]
} => {
$crate::tt_call! {
macro = [{ $crate::parse_type }]
input = [{ $($rest)* }]
~~> $crate::private_parse_generic_param! {
$caller
assoc = [{ $assoc = }]
}
}
};
{
$caller:tt
assoc = [{ $assoc:ident $eq:tt }]
type = [{ $($ty:tt)* }]
rest = [{ $($rest:tt)* }]
} => {
$crate::tt_return! {
$caller
param = [{ $assoc $eq $($ty)* }]
rest = [{ $($rest)* }]
}
};
{
$caller:tt
input = [{ $($input:tt)+ }]
} => {
$crate::tt_call! {
macro = [{ $crate::private_parse_type_with_plus }]
input = [{ $($input)* }]
~~> $crate::private_parse_generic_param! {
$caller
}
}
};
{
$caller:tt
type = [{ $($ty:tt)* }]
rest = [{ $($rest:tt)* }]
} => {
$crate::tt_return! {
$caller
param = [{ $($ty)* }]
rest = [{ $($rest)* }]
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_validate_fn_path_args {
{
$caller:tt
tokens = [{ }]
} => {
$crate::tt_return! {
$caller
}
};
{
$caller:tt
tokens = [{ $($rest:tt)+ }]
} => {
$crate::tt_call! {
macro = [{ $crate::parse_type }]
input = [{ $($rest)* }]
~~> $crate::private_validate_fn_path_args! {
$caller
}
}
};
{
$caller:tt
type = [{ $($ty:tt)* }]
rest = [{ }]
} => {
$crate::tt_return! {
$caller
}
};
{
$caller:tt
type = [{ $($ty:tt)* }]
rest = [{ , $($rest:tt)* }]
} => {
$crate::private_validate_fn_path_args! {
$caller
tokens = [{ $($rest)* }]
}
};
{
$caller:tt
type = [{ $($ty:tt)* }]
rest = [{ $($unexpected:tt)+ }]
} => {
$crate::error_unexpected! {
$($unexpected)*
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! private_parse_path_after_fn_args {
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ $($tokens:tt)* }]
} => {
$crate::private_parse_path_after_fn_args! {
$caller
path = [{ $($path)* }]
tokens = [{ $($tokens)* }]
_tokens = [{ $($tokens)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ -> $($rest:tt)* }]
_tokens = [{ $arrow:tt $($dup:tt)* }]
} => {
$crate::tt_call! {
macro = [{ $crate::parse_type }]
input = [{ $($rest)* }]
~~> $crate::private_parse_path_after_fn_args! {
$caller
path = [{ $($path)* $arrow }]
}
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
tokens = [{ $($rest:tt)* }]
_tokens = [{ $($dup:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($path)* }]
rest = [{ $($rest)* }]
}
};
{
$caller:tt
path = [{ $($path:tt)* }]
type = [{ $($ret:tt)* }]
rest = [{ $($rest:tt)* }]
} => {
$crate::tt_return! {
$caller
path = [{ $($path)* $($ret)* }]
rest = [{ $($rest)* }]
}
};
}