If I have a file containing some code (somecodefile):
Var x = io.input("x", UInt(32));
Var y = x + 1;
io.output("y", y, UInt(32));
... and I set some "delineators" (e.g. TEXBLOCK) ...
/*TEXBLOCK {x}*/
Var x = io.input("x", UInt(32));
/*TEXBLOCK {end}*/
/*TEXBLOCK {y}*/
Var y = x + 1;
io.output("y", y, UInt(32));
/*TEXBLOCK {end}*/
... is it possible to use the linerange option in an lstlisting environment (or something similar) to say have something like "linerange=x-end" produce ONLY:
Var x = io.input("x", UInt(32));
The MWE might then be, using the TEXBLOCKs "x" and "end":
\documentclass{article}
\begin{document}
\begin{lstlisting}[linerange=x-end]
\input{somecodefile}
\end{lstlisting}
\end{document}
As another example, have linerange=y-end produce:
Var y = x + 1;
io.output("y", y, UInt(32));
For which the MWE would be:
\documentclass{article}
\begin{document}
\begin{lstlisting}[linerange=y-end]
\input{somecodefile}
\end{lstlisting}
\end{document}
I have this working in Python 2.7 already in a Makefile, but I'd really like to just use LaTeX for it. Using the delineator ("TEXBLOCK") and the lstlisting environment is just what I've got the Python script doing: if there is a way to do the same thing but with a different environment then I would of course be interested in that, too. I basically just want to be able to pick out specific parts of files that contain lines of code.