started with why
[rsss1516.git] / long / clean.sty
1 \usepackage{listings}
2
3 \lstdefinelanguage{Clean}{%
4 alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_`1234567890},
5 alsoletter={~!@\#$\%^\&*-+=?<>:|\\.},
6 morekeywords={generic,implementation,definition,dynamic,module,import,from,where,in,of,case,let,infix,infixr,infixl,class,instance,with,if,derive,Void},
7 sensitive=true,
8 morecomment=[l]{//},
9 morecomment=[n]{/*}{*/},
10 morestring=[b]",
11 morestring=[b]',
12 emptylines=1,
13 basicstyle=\small,
14 identifierstyle=\small\ttfamily,
15 commentstyle=\itshape,
16 keywordstyle=\bfseries,
17 stringstyle=\ttfamily,
18 numbers=none,
19 showstringspaces=false,
20 basewidth=0.45em,
21 columns=[c]fixed,
22 keepspaces=true,
23 breaklines=false,
24 tabsize=4,
25 texcl=true,
26 escapeinside={(\#}{\#)},
27 literate=%
28 % Basic Clean constructs
29 {\\}{{$\lambda\:$}}1
30 {A.}{{$\forall\;\,$}}1
31 {E.}{{$\exists\;\,$}}1
32 {>}{{$>$}}1
33 {<}{{$<$}}1
34 {<=}{{$\leq$}}1
35 {>=}{{$\geq$}}1
36 {<>}{{$\neq$}}1
37 {->}{{$\rightarrow$}}2
38 {<-}{{$\leftarrow$}}1
39 {=}{{$=$}}1
40 {~}{{$\sim$}}1
41 {\#}{{$\sharp$}}1
42 {\{|}{{$\{\!|\!$}}1
43 {|\}}{{$\!|\!\}$}}1
44 {:=}{{$:=$}}2
45 {==}{{$==$}}2
46 {++}{{$+\!\!+$}}2
47 {+++}{{$+\!\!\!\!+\!\!\!\!+$}}2
48 {:==}{{$:==$}}3
49 {\{|*|\}}{{$\{\!|\!\!\star\!\!|\!\}$}}3
50 %
51 % Basic iTask constructs
52 {>||>}{{$\triangleright\triangleright$}}2
53 {>>=}{{\texttt{>>=}}}3
54 {>>|}{{\texttt{>>|}}}3
55 {?>>}{{\texttt{?>>}}}3
56 {!>>}{{\texttt{!>>}}}3
57 {-||-}{{\texttt{-||-}}}4
58 {.||.}{{\texttt{.||.}}}4
59 {.&&.}{{\texttt{.\&\&.}}}4
60 }
61
62 \newcommand{\CleanInline}[1]{\lstinline[language=Clean]¦#1¦}
63 \newcommand{\CI}[1]{\CleanInline{#1}}
64
65 \lstdefinestyle{numbers}{numbers=left, stepnumber=1, numberstyle=\tiny, numbersep=5pt}
66
67 \lstnewenvironment{CleanCode}{\lstset{language=Clean,identifierstyle=\ttfamily}}{}
68 \lstnewenvironment{CleanCodeN}{\lstset{language=Clean,style=numbers}}{}
69 \lstnewenvironment{CleanCodeB}{\lstset{language=Clean,frame=single}}{}
70 \lstnewenvironment{CleanCodeNB}{\lstset{language=Clean,style=numbers,frame=single}}{}