-
Notifications
You must be signed in to change notification settings - Fork 1
/
lst-m2iso.in-situ.sty
70 lines (69 loc) · 1.87 KB
/
lst-m2iso.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
65
66
67
68
69
%%% ISO Modula-2 in-situ definition for use with LaTeX Listings package
%
% Released into the Public Domain
%
\lstdefinelanguage{m2iso}{
% Reserved words
keywords=[1]{
AND, ARRAY, BEGIN, BY, CASE, CONST, DEFINITION, DIV, DO, ELSE, ELSIF,
EXCEPT, END, EXIT, EXPORT, FINALLY, FOR, FORWARD, FROM, IF,IMPLEMENTATION,
IMPORT, IN, LOOP, MOD, MODULE, NOT, OF, OR, PACKEDSET,POINTER, PROCEDURE,
QUALIFIED, RECORD, REM, REPEAT, RETRY, RETURN, SET, THEN, TO, TYPE, UNTIL,
VAR, WHILE, WITH
},
% Pervasive Identifiers
keywords=[2]{
ABS, BITSET, BOOLEAN, CAP, CARDINAL, CHAR, CHR, CMPLX, COMPLEX, DEC,
DISPOSE, EXCL, FALSE, FLOAT, HALT, HIGH, IM, INC, INCL, INT, INTEGER,
INTERRUPTIBLE, LENGTH, LFLOAT, LONGCOMPLEX, LONGINT, LONGREAL, MIN, MAX,
NEW, NIL, ODD, ORD, PROC, PROTECTION, RE, REAL, SIZE, TRUE, TRUNC,
UNINTERRUPTIBLE, 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=m2iso,
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,
% pragma style
delim=[s][\boldgray]{<*}{*>}
}
%
% Modula2 Environment
%
% usage:
%
% \begin{Modula2}
% source code goes here
% \end{Modula2)
%
\lstnewenvironment{Modula2}
{\renewcommand{\:}{\;:\;}\vspace{0.5ex}\lstset{language=m2iso, style=modula2}}
{\vspace{0.5ex}}
%
% END OF FILE