macro_rules! impl_node {
    (
    mod $mod_name:ident {
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      {}
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      NodeInfo {
        $($node_info:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      $(#[$param_enum_meta:meta])*
      pub enum $param_enum_name:ident {
        $($param_enum_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      []
      {}
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      #[doc = $node_struct_doc:expr]
      $(#[$node_struct_attr:meta])*
      pub struct $node_ty_name:ident {
        $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      []
      {}
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      $(#[$node_struct_attr:meta])*
      pub struct $node_ty_name:ident {
        $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize_fields
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      ___internal_parse_fields {
          $( #[$field_meta:meta] )*
          $field_vis:vis $field_name:ident : Input<$field_ty:ident> $(Color($color:tt))?,
          $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize_fields
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      ___internal_parse_fields {
          $( #[$field_meta:meta] )*
          $field_vis:vis $field_name:ident : Param<$field_ty:ident>,
          $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize_fields
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      ___internal_parse_fields {
          $( #[$field_meta:meta] )*
          $field_vis:vis $field_name:ident : Output<$field_ty:ident> $(Color($color:tt))?,
          $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize_fields
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      ___internal_parse_fields {
          $( #[$field_meta:meta] )*
          $field_vis:vis $field_name:ident : $field_ty:ident,
          $($unparsed_fields:tt)*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize_fields
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      ___internal_parse_fields { }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      $(#[$node_impl_meta:meta])*
      impl $node_ty_name:ident {
        $( $ty_impl_fns:tt )*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      $(#[$node_impl_meta:meta])*
      impl NodeImpl for $node_ty_name:ident {
        $( $ty_node_impl_fns:tt )*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      { $( $node_info:tt )* }
      { $( $extra_code:tt )* }
      [ $( $node_inputs:tt )* ]
      [ $( $node_parameters:tt )* ]
      [ $( $node_outputs:tt )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      { $( $node_struct:tt )* }
      { $( $node_impl:tt )* }
      { $( $node_trait_impl:tt )* }
      $(#[$node_impl_meta:meta])*
      impl $impl_trait_name:ident for $node_ty_name:ident {
        $( $ty_impl_fns:tt )*
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@normalize
    mod $mod_name:ident {
      {
        name: $($node_name_ident:ident)? $($node_name:literal)?
        $(
          , description: $node_description:literal
        )?
        $(
          , package: $node_package:expr
        )?
        $(
          , category: $node_category:expr
        )?
        $(
          , deprecated: $node_deprecated:expr
        )?
        $(
          , custom: {
            $( $custom_field_name:ident: $custom_field_value:literal ),*
            $(,)?
          }
        )?
        $(,)?
      }
      { $( $extra_code:tt )* }
      [ $( $field_input_name:ident: $field_input_ty:ident Idx($field_input_idx:expr) $(Color($field_input_color:tt))?,)* ]
      [ $( $field_param_name:ident: $field_param_ty:ident, )* ]
      [ $( $field_output_name:ident: $field_output_ty:ident Idx($field_output_idx:expr) $(Color($field_output_color:tt))?, )* ]
      [ $( $count_inputs:tt )* ] [ $( $count_params:tt )* ] [ $( $count_outputs:tt )* ]
      [ $( $node_struct_fields:tt )* ]
      {
        #[doc = $node_struct_doc:expr]
        $(#[$node_struct_attr:meta])*
        pub struct $node_ty_name:ident;
      }
      { $( $node_impl:tt )* }
      {
        $(#[$node_impl_meta:meta])*
        impl NodeImpl for $node_impl_ty_name:ident {
          $( $ty_node_impl_fns:tt )*
        }
      }
      $($rest:tt)*
    }
  ) => { ... };
    (@impl_resolve_inputs
    $node_ty_name:ident []
  ) => { ... };
    (@impl_resolve_inputs
    $node_ty_name:ident [ $field_input_name:ident ]
  ) => { ... };
    (@impl_resolve_inputs
    $node_ty_name:ident [ $( $field_input_name:ident),* ]
  ) => { ... };
}