# Is it possible to use the listings package incrementally in beamer?

Given a frame that has code rendered in a \begin{lstlisting}...\end{lstlisting} environment, is it possible to use beamer's incremental frame building feature to highlight code snippets?

Here is an example of what I would like to use:

\begin{frame}[fragile]{Test}
\begin{lstlisting}
x = y \alert<2->{// Assigns the value of y to x.}
\end{lstlisting}
\end{frame}


You can do this although you don't get the listings formatting inside the alert, but perhaps that's OK for comments..

\documentclass{beamer}
\usepackage{listings}
\begin{document}

\begin{frame}[fragile]{Test}
\begin{lstlisting}[escapeinside=']
x = z // Assigns the value of y to x.
x = y \alert<2->{// Assigns the value of y to x.}'
\end{lstlisting}
\end{frame}

\end{document}