private function isTemplateDefinition(Stream $stream)
    {
        if ($stream->current()->equals(Token::TYPE_KEYWORD, 'template')) {
            return true;
        }

        if (!$stream->current()->equals(Token::TYPE_KEYWORD, 'export')) {
            return false;
        }

        if ($stream->peek()->equals(Token::TYPE_KEYWORD, 'template') && $stream->peek(3)->equals(Token::TYPE_SYMBOL, '(')) {
            return true;
        }

        return false;
    }