On 15. Oct 2006, at 03:10, Charilaos Skiadas wrote:
[...] it assumes the code is Python code [...] We could perhaps come up with some convention, like having to precede the \begin {lstlisting} line with a command line like:
# Java code
and so on. Then we could put a couple of rules in place, each matching one of the common languages, though as you can imagine this can quickly get out of hand and bloat the grammar to twice its size at least.
There are two (distant future) features which combined will address the problem:
1. Scope names can include captures from the match (and full $- notation for transforming them etc.). 2. The previously mentioned scope injection.
This means the convention we come up with now should, to take advantage of this in the future, include the grammar name, and preferably be on the same line, in the simplest case:
\begin{lstlisting}{} % Java
So don’t worry about presently having to create a rule per thing we want to support, as that’s only a (somewhat) short-term solution.