-
Notifications
You must be signed in to change notification settings - Fork 1
/
lst-m2pim.in-situ.sty
66 lines (64 loc) · 1.66 KB
/
lst-m2pim.in-situ.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%%% PIM Modula-2 in-situ definition for use with LaTeX Listings package
%
% Released into the Public Domain
%
\lstdefinelanguage{m2pim}{
% Reserved words
keywords=[1]{
AND, ARRAY, BEGIN, BY, CASE, CONST, DEFINITION, DIV, DO, ELSE, ELSIF,
END, EXIT, EXPORT, FOR, FROM, IF, IMPLEMENTATION, IMPORT, IN, LOOP,
MOD, MODULE, NOT, OF, OR, POINTER, PROCEDURE, QUALIFIED, RECORD, REPEAT,
RETURN, SET, THEN, TO, TYPE, UNTIL, VAR, WHILE, WITH
},
% Pervasive Identifiers
keywords=[2]{
ABS, BITSET, BOOLEAN, CAP, CARDINAL, CHAR, CHR, DEC, DISPOSE, EXCL, FALSE,
FLOAT, HALT, HIGH, INC, INCL, INTEGER, LONGINT, LONGREAL, MAX, MIN, NEW,
NIL, ODD, ORD, PROC, REAL, SIZE, TRUNC, VAL
},
sensitive=true,
string=[b]{'},
morestring=[b]{"},
comment=[n]{(*}{*)},
% Latex escape
escapeinside={?}{?}
}
%
% Modula-2 typesetting style with frame
%
\newcommand\darkgraytt[1]{\textcolor{darkgray!80}{\texttt{#1}}}
\newcommand\boldgray[1]{\textcolor{gray}{\textbf{#1}}}
%
\lstdefinestyle{modula2}{
language=m2pim,
xleftmargin=2mm,
xrightmargin=2mm,
frame=trbl,
framexleftmargin=1mm,
framexrightmargin=1mm,
rulecolor=\color{gray},
backgroundcolor=\color{gray!10}, % faint grey
basicstyle=\setfont{DejaVuSansMono-TLF},
% reserved words
keywordstyle={[1]\textbf},
% pervasive identifiers
keywordstyle={[2]\texttt},
% string style
stringstyle=\darkgraytt,
% comment style
commentstyle=\italicgray
}
%
% Modula2 Environment
%
% usage:
%
% \begin{Modula2}
% source code goes here
% \end{Modula2)
%
\lstnewenvironment{Modula2}
{\renewcommand{\:}{\;:\;}\vspace{0.5ex}\lstset{language=m2pim, style=modula2}}
{\vspace{0.5ex}}
%
% END OF FILE