-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsilver.sty
91 lines (84 loc) · 2.57 KB
/
silver.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%
% SILVER syntax highlighting for the LaTeX listings package
%
\RequirePackage{listings}
\RequirePackage{microtype}
\RequirePackage{xcolor}
\newcommand\SilverSmall{\fontsize{8.3}{8.5}\selectfont}
%\newcommand*\SilverFont{\SilverSmall\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
%\newcommand*\SilverFont{\SilverSmall\ttfamily\lsstyle}
\newcommand*\SilverFont{\small\ttfamily\lsstyle}
\definecolor{darkgreen}{rgb}{0,0.3,0}
\lstdefinelanguage{silver}{
morekeywords={
result,
Int, Perm, Bool, Ref,
true, false,
null,
method, function, predicate, domain, axiom, var, returns,
requires, ensures, invariant,
fold, unfold, inhale, exhale, new, assert, assume, goto,
while, if, elsif, else,
fresh,
unfolding, in,
old,
forall, exists, forperm,
acc, wildcard, write, none, epsilon, perm,
Seq, Set, MultiSet, union, intersection, setminus, subset,
unique,
field,
define,
package,
apply,
label
},
% literate=%
% {&&}{$\ast$}3
% {and}{\&\&}3
% {\\}{/}2
% ,
sensitive=true,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
numbers=none,
firstnumber=1,
numberstyle=\tiny,
stepnumber=1,
basicstyle={\SilverFont},
commentstyle={\SilverFont},
keepspaces=true,
keywordstyle=\bfseries,
ndkeywordstyle=\bfseries,
escapechar=@,
mathescape=true,
commentstyle=\color{darkgreen}\small\ttfamily
}
\lstnewenvironment{viper}[1][]{%
\lstset{language=silver,
floatplacement={tbp},captionpos=b,
frame=lines,xleftmargin=3pt,xrightmargin=3pt,#1}}{}
\lstnewenvironment{viper2}[1][]{%
\lstset{language=silver,
floatplacement={tbp},captionpos=b,
frame=none,xleftmargin=3pt,xrightmargin=3pt,#1}}{}
\lstnewenvironment{viper2linenum}[1][]{%
\lstset{language=silver,
floatplacement={tbp},captionpos=b,
frame=none,xleftmargin=3pt,xrightmargin=3pt,#1,
numbers=left,
numberstyle={},
firstnumber=1,
stepnumber=1}}{}
\newcommand{\silverfile}[1]{
\lstinputlisting[language=silver,%
frame=lines,xleftmargin=8pt,xrightmargin=8pt,columns=fixed]{#1}
}
\def\inlinesilver{%
\lstinline[language=silver,basicstyle=\ttfamily\small,columns=fixed]}
%%% http://tex.stackexchange.com/questions/100427/
%\newcommand\inlinesilver[1]{%
% \lstinline[language=silver,basicstyle=\ttfamily\small,columns=fixed]}
%\newcommand*{\code}[1]{{\small\texttt{#1}}}
\def\vipercode#1{\inlinesilver|#1|}
%\let\code\inlinesilver