I'm defining my own listings and have run into an issue whereby LaTeX highlights words within words - e.g. if OR is a keyword, it highlights the OR in ANIMATOR - even if ANIMATOR itself is a keyword (it overrides the ANIMATOR highlighting).
MWE:
\documentclass{article}
\usepackage{listings, xcolor, courier}
\lstdefinelanguage{defFile}{
morekeywords={FOOBAR, FOOBAE},
otherkeywords={-,->,> ,BAR},
morekeywords=[2]{-,->,>,;},
morekeywords=[3]{BAR}
}
\lstdefinestyle{defFile}
{
\lstset{
language = {defFile},
basicstyle = \small\ttfamily,
keywordstyle = \bfseries\color{purple},
keywordstyle = [2]{\color{green}},
keywordstyle = [3]{\color{blue}}
}
}
\begin{document}
\begin{lstlisting}[style={defFile}]
FOOBAR -> FOO, BAR
FOOBAE -> FOO, BAE
\end{lstlisting}
\end{document}
The result of this is:
Note how due to subsequently defining BAR as a keyword, FOOBAR is no longer highlighted.

