source: doc/papers/concurrency/style/cfa-format.tex@ 25bca42

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum with_gc
Last change on this file since 25bca42 was aac7197, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

working copy, no latin-1 characters

  • Property mode set to 100644
File size: 7.7 KB
RevLine 
[d5ccbe9]1%\usepackage[usenames,dvipsnames]{xcolor}
[604e76d]2\usepackage{listings}
3\usepackage{inconsolata}
4
5\definecolor{basicCol}{HTML}{000000}
6\definecolor{commentCol}{HTML}{000000}
7\definecolor{stringCol}{HTML}{000000}
8\definecolor{keywordCol}{HTML}{000000}
9\definecolor{identifierCol}{HTML}{000000}
10
11% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
12\lstdefinelanguage{sml} {
[aac7197]13 morekeywords= {
14 EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
15 bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
16 handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
17 open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
18 string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
19 with, withtype, word
20 },
21 morestring=[b]",
22 morecomment=[s]{(*}{*)},
[604e76d]23}
24
25\lstdefinelanguage{D}{
[aac7197]26 % Keywords
27 morekeywords=[1]{
28 abstract, alias, align, auto, body, break, cast, catch, class, const, continue, debug,
29 delegate, delete, deprecated, do, else, enum, export, false, final, finally, for, foreach,
30 foreach_reverse, function, goto, if, immutable, import, in, inout, interface, invariant, is,
31 lazy, macro, mixin, module, new, nothrow, null, out, override, package, pragma, private,
32 protected, public, pure, ref, return, shared, static, struct, super, switch, synchronized,
33 template, this, throw, true, try, typedef, typeid, typeof, union, unittest, volatile, while,
34 with
35 },
36 % Special identifiers, common functions
37 morekeywords=[2]{enforce},
38 % Ugly identifiers
39 morekeywords=[3]{
40 __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
41 __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
42 _arguments, _ctor, _dtor
43 },
44 % Basic types
45 morekeywords=[4]{
46 byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void, bool, bit, float,
47 double, real, ushort, int, uint, long, ulong, float, char, wchar, dchar, string, wstring,
48 dstring, ireal, ifloat, idouble, creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t,
49 equals_t, hash_t
50 },
51 % Strings
52 morestring=[b]{"},
53 morestring=[b]{'},
54 morestring=[b]{`},
55 % Comments
56 comment=[l]{//},
57 morecomment=[s]{/*}{*/},
58 morecomment=[s][\color{blue}]{/**}{*/},
59 morecomment=[n]{/+}{+/},
60 morecomment=[n][\color{blue}]{/++}{+/},
61 % Options
62 sensitive=true
[604e76d]63}
64
65\lstdefinelanguage{rust}{
[aac7197]66 % Keywords
67 morekeywords=[1]{
68 abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
69 false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
70 override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
71 trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
72 },
73 % Strings
74 morestring=[b]{"},
75 % Comments
76 comment=[l]{//},
77 morecomment=[s]{/*}{*/},
78 % Options
79 sensitive=true
[604e76d]80}
81
82\lstdefinelanguage{pseudo}{
[aac7197]83 morekeywords={string,uint,int,bool,float},
84 sensitive=true,
85 morecomment=[l]{//},
86 morecomment=[s]{/*}{*/},
87 morestring=[b]',
88 morestring=[b]",
89 morestring=[s]{`}{`},
90}
[604e76d]91
92\newcommand{\KWC}{K-W C\xspace}
93
94\lstdefinestyle{pseudoStyle}{
[aac7197]95 escapeinside={@@},
96 basicstyle=\linespread{0.9}\sf\footnotesize, % reduce line spacing and use typewriter font
97 keywordstyle=\bfseries\color{blue},
98 keywordstyle=[2]\bfseries\color{Plum},
99 commentstyle=\itshape\color{OliveGreen}, % green and italic comments
100 identifierstyle=\color{identifierCol},
101 stringstyle=\sf\color{Mahogany}, % use sanserif font
102 mathescape=true,
103 columns=fixed,
104 aboveskip=4pt, % spacing above/below code block
105 belowskip=3pt,
106 keepspaces=true,
107 tabsize=4,
108 % frame=lines,
109 literate=,
110 showlines=true, % show blank lines at end of code
111 showspaces=false,
112 showstringspaces=false,
113 escapechar=\$,
114 xleftmargin=\parindentlnth, % indent code to paragraph indentation
115 moredelim=[is][\color{red}\bfseries]{**R**}{**R**}, % red highlighting
116 % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
117 % moredelim=** allows cumulative application
[604e76d]118}
119
120\lstdefinestyle{defaultStyle}{
[aac7197]121 escapeinside={@@},
122 basicstyle=\linespread{0.9}\tt\footnotesize, % reduce line spacing and use typewriter font
123 keywordstyle=\bfseries\color{blue},
124 keywordstyle=[2]\bfseries\color{Plum},
125 commentstyle=\itshape\color{OliveGreen}, % green and italic comments
126 identifierstyle=\color{identifierCol},
127 stringstyle=\sf\color{Mahogany}, % use sanserif font
128 mathescape=true,
129 columns=fixed,
130 aboveskip=4pt, % spacing above/below code block
131 belowskip=3pt,
132 keepspaces=true,
133 tabsize=4,
134 % frame=lines,
135 literate=,
136 showlines=true, % show blank lines at end of code
137 showspaces=false,
138 showstringspaces=false,
139 escapechar=\$,
140 xleftmargin=\parindentlnth, % indent code to paragraph indentation
141 moredelim=[is][\color{red}\bfseries]{**R**}{**R**}, % red highlighting
142 % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
143 % moredelim=** allows cumulative application
[604e76d]144}
145
146\lstdefinestyle{cfaStyle}{
[aac7197]147 escapeinside={@@},
148 basicstyle=\linespread{0.9}\sf, % reduce line spacing and use typewriter font
[d5ccbe9]149% keywordstyle=\bfseries\color{blue},
[aac7197]150 keywordstyle=[2]\bfseries\color{red},
[d5ccbe9]151% commentstyle=\sf\itshape\color{OliveGreen}, % green and italic comments
[aac7197]152 identifierstyle=\color{identifierCol},
153% stringstyle=\sf\color{Mahogany}, % use sanserif font
154 stringstyle=\tt, % use typewriter font
155 mathescape=true,
156 columns=fixed,
157 aboveskip=4pt, % spacing above/below code block
158 belowskip=3pt,
159 keepspaces=true,
160 tabsize=4,
161 % frame=lines,
162 literate=,
163 showlines=true, % show blank lines at end of code
164 showspaces=false,
165 showstringspaces=false,
166 escapechar=\$,
167 xleftmargin=\parindentlnth, % indent code to paragraph indentation
168 moredelim=[is][\color{red}\bfseries]{**R**}{**R**}, % red highlighting
169 morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
[604e76d]170}
171
172\lstMakeShortInline[basewidth=0.5em,breaklines=true,basicstyle=\normalsize\ttfamily\color{basicCol}]@ % single-character for \lstinline
173
174\lstnewenvironment{ccode}[1][]{
[aac7197]175 \lstset{
176 language = C,
177 style=defaultStyle,
178 captionpos=b,
179 #1
180 }
[604e76d]181}{}
182
183\lstnewenvironment{cfacode}[1][]{
[aac7197]184 \lstset{
185 language = CFA,
186 style=cfaStyle,
187 captionpos=b,
188 #1
189 }
[604e76d]190}{}
191
192\lstnewenvironment{pseudo}[1][]{
[aac7197]193 \lstset{
194 language = pseudo,
195 style=pseudoStyle,
196 captionpos=b,
197 #1
198 }
[604e76d]199}{}
200
201\lstnewenvironment{cppcode}[1][]{
[aac7197]202 \lstset{
203 language = c++,
204 style=defaultStyle,
205 captionpos=b,
206 #1
207 }
[604e76d]208}{}
209
210\lstnewenvironment{ucppcode}[1][]{
[aac7197]211 \lstset{
212 language = c++,
213 style=defaultStyle,
214 captionpos=b,
215 #1
216 }
[604e76d]217}{}
218
219\lstnewenvironment{javacode}[1][]{
[aac7197]220 \lstset{
221 language = java,
222 style=defaultStyle,
223 captionpos=b,
224 #1
225 }
[604e76d]226}{}
227
228\lstnewenvironment{scalacode}[1][]{
[aac7197]229 \lstset{
230 language = scala,
231 style=defaultStyle,
232 captionpos=b,
233 #1
234 }
[604e76d]235}{}
236
237\lstnewenvironment{smlcode}[1][]{
[aac7197]238 \lstset{
239 language = sml,
240 style=defaultStyle,
241 captionpos=b,
242 #1
243 }
[604e76d]244}{}
245
246\lstnewenvironment{dcode}[1][]{
[aac7197]247 \lstset{
248 language = D,
249 style=defaultStyle,
250 captionpos=b,
251 #1
252 }
[604e76d]253}{}
254
255\lstnewenvironment{rustcode}[1][]{
[aac7197]256 \lstset{
257 language = rust,
258 style=defaultStyle,
259 captionpos=b,
260 #1
261 }
[604e76d]262}{}
263
264\lstnewenvironment{gocode}[1][]{
[aac7197]265 \lstset{
266 language = Golang,
267 style=defaultStyle,
268 captionpos=b,
269 #1
270 }
[604e76d]271}{}
272
273\newcommand{\zero}{\lstinline{zero_t}\xspace}
274\newcommand{\one}{\lstinline{one_t}\xspace}
275\newcommand{\ateq}{\lstinline{\@=}\xspace}
276\newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
[d5ccbe9]277\newcommand{\pscode}[1]{\lstinline[language=pseudo,style=pseudoStyle]{#1}}
[aac7197]278
279% Local Variables: %
280% tab-width: 4 %
281% fill-column: 100 %
282% End: %
Note: See TracBrowser for help on using the repository browser.