summaryrefslogtreecommitdiff
path: root/paper/clean.sty
blob: 15c50fcd21aa7cb3f377724708ca75b640f5a4e1 (plain) (blame)
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
\usepackage{listings}

\lstdefinelanguage{Clean}{%
	alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_`1234567890},
	alsoletter={~!@\#$\%^\&*-+=?<>:|\\.},
	morekeywords={generic,implementation,definition,dynamic,module,import,from,where,in,of,case,let,infix,infixr,infixl,class,instance,with,if,derive},
	sensitive=true,
	morecomment=[l]{//},
	morecomment=[n]{/*}{*/},
	morestring=[b]",
	morestring=[b]',
	emptylines=1,
	basicstyle=\small,
	identifierstyle=\small\ttfamily,
	commentstyle=\itshape,
	keywordstyle=\bfseries,
	stringstyle=\ttfamily,
	numbers=none,
	showstringspaces=false,
	basewidth=0.45em,
	columns=[c]fixed,
	keepspaces=true,
	breaklines=false,
	tabsize=4,
	texcl=true,
	escapeinside={(\#}{\#)},
	literate=%
		% Basic Clean constructs
		{\\}{{$\lambda\:$}}1
		{A.}{{$\forall\;\,$}}1
		{E.}{{$\exists\;\,$}}1
		{>}{{$>$}}1
		{<}{{$<$}}1
		{`}{{\texttt{'}}}1
		{<=}{{$\leq$}}1
		{>=}{{$\geq$}}1
		{<>}{{$\neq$}}1
		{->}{{$\rightarrow$}}2
		{<-}{{$\leftarrow$}}1
		{=}{{$=$}}1
		{~}{{$\sim$}}1
		{*}{{$\star$}}1
		{\#}{{$\sharp$}}1
		{\{|}{{$\{\!|\!$}}1
		{|\}}{{$\!|\!\}$}}1
		{:=}{{$:=$}}2
		{=:}{{$\>=:$}}3
		{==}{{$==$}}2
		{++}{{$+\!\!+$}}2
		{+++}{{$+\!\!\!\!+\!\!\!\!+$}}2
		{:==}{{$:==$}}3
		{\{|*|\}}{{$\{\!|\!\!\star\!\!|\!\}$}}3
		%
		% Basic iTask constructs
		{>||>}{{$\triangleright\triangleright$}}2
		{>>=}{{\texttt{>>=}}}3
		{>>|}{{\texttt{>>|}}}3
		{?>>}{{\texttt{?>>}}}3
		{!>>}{{\texttt{!>>}}}3
		{-||-}{{\texttt{-||-}}}4
		{.||.}{{\texttt{.||.}}}4
		{.&&.}{{\texttt{.\&\&.}}}4
}

\newcommand{\CleanInline}[1]{\lstinline[language=Clean]�#1�}
\newcommand{\CI}[1]{\CleanInline{#1}}

\lstdefinestyle{numbers}{numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=5pt}

\lstnewenvironment{CleanCode}{\lstset{language=Clean,identifierstyle=\ttfamily}}{}
\lstnewenvironment{CleanCodeN}{\lstset{language=Clean,style=numbers}}{}
\lstnewenvironment{CleanCodeB}{\lstset{language=Clean,frame=single}}{}
\lstnewenvironment{CleanCodeNB}{\lstset{language=Clean,style=numbers,frame=single}}{}