# minted + escapeinside: how to feed the result of the escape into the lexer?

The result of an escapeinside in minted is typeset as-is, and not fed into the lexer. This is by design, as I understand. How can I change minted's behavior so that the result of the escapeinside is lexed together with the rest of the code?

In other words, how can I generate source code dynamically and feed it into the lexer?

Example:

\documentclass{article}
\usepackage{minted}
\begin{document}
\newcommand{\something}{bbb}
aaa|\something|aaa
aaabbbaaa
\end{minted}
\end{document}


generates two different lines, whereas I would like it to generate twice exactly the same line:

From the above code (first line), minted generates the fancyvrb line

\PYG{n+nt}{aaa}\PYG{esc}{\something}\PYG{n+nt}{aaa}


whereas what I want is the \something command inside the \PYG call, something like

\PYG{n+na}{aaa\something{}aaa}