playground/latex/listings-define-lang.tex

34 lines
774 B
TeX

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{fontspec}
\setmonofont{DejaVu Sans Mono}
\begin{document}
\lstdefinelanguage{psl}{
keywords={%
abort, never, until, until!, before
},
otherkeywords={% operators
%:, ->, |->, |=>, ;, <, >, <=, >=, ==, !=
},
morekeywords={%
G, F, U, R, M, W
},
keywordstyle=\color{green},
numberstyle=\scriptsize,
sensitive=true, % keywords are case-sensitive
morecomment=[l]{//}, % l is for line comment
morecomment=[s]{/*}{*/}, % s is for start and end delimiter
morestring=[b]" % defines that strings are enclosed in double quotes
}
\begin{lstlisting}{psl}
G a b
□ a b
a abort b
"a b c"
\end{lstlisting}
\end{document}