Parse a shortcode differently based on on what it’s nested in

Register a new shortcode handler depending on the attribute value:

function wrapper_shortcode_handler ( $atts, $content ) {

    if ( "apple" === $atts["snack"] )
        add_shortcode( "flavor", "healthy_callback" );

    if ( "donut" === $atts["snack"] )
        add_shortcode( "flavor", "fatty_callback" );

    return do_shortcode( $content );
}

See also Execute shortcode only in another shortcode