source: doc/LaTeXmacros/lstlang.sty @ f678c53b

Last change on this file since f678c53b was 1967109, checked in by Peter A. Buhr <pabuhr@…>, 5 months ago

make bool a keyword for CFA lstlisting so it is bolded

  • Property mode set to 100644
File size: 6.3 KB
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%
3%% Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
4%%
5%% lstlang.sty --
6%%
7%% Author           : Peter A. Buhr
8%% Created On       : Sat May 13 16:34:42 2017
9%% Last Modified By : Peter A. Buhr
10%% Last Modified On : Fri May 31 14:36:02 2024
11%% Update Count     : 44
12%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14% Go programming language: https://github.com/julienc91/listings-golang/blob/master/listings-golang.sty
15\lstdefinelanguage{Golang}{
16        morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
17        morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
18                bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
19        morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
20        morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
21        morekeywords=[5]{Println,Printf,Error,},
22        sensitive=true,
23        morecomment=[l]{//},
24        morecomment=[s]{/*}{*/},
25        morestring=[b]',
26        morestring=[b]",
27        morestring=[s]{`}{`},
28}
29
30% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
31\lstdefinelanguage{sml} {
32        morekeywords= {
33                EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
34                bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
35                handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
36                open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
37                string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
38                with, withtype, word
39    },
40    morestring=[b]",
41    morecomment=[s]{(*}{*)},
42}
43
44\lstdefinelanguage{D}{
45        % Keywords
46        morekeywords=[1]{
47                abstract, alias, align, auto, body, break, cast, catch, class, const, continue, debug,
48                delegate, delete, deprecated, do, else, enum, export, false, final, finally, for, foreach,
49                foreach_reverse, function, goto, if, immutable, import, in, inout, interface, invariant, is,
50                lazy, macro, mixin, module, new, nothrow, null, out, override, package, pragma, private,
51                protected, public, pure, ref, return, shared, static, struct, super, switch, synchronized,
52                template, this, throw, true, try, typedef, typeid, typeof, union, unittest, volatile, while,
53                with
54        },
55        % Special identifiers, common functions
56        morekeywords=[2]{enforce},
57        % Ugly identifiers
58        morekeywords=[3]{
59                __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
60                __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
61                _arguments, _ctor, _dtor
62        },
63        % Basic types
64        morekeywords=[4]{
65                byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void, bool, bit, float,
66                double, real, ushort, int, uint, long, ulong, float, char, wchar, dchar, string, wstring,
67                dstring, ireal, ifloat, idouble, creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t,
68                equals_t, hash_t
69        },
70        % Strings
71        morestring=[b]{"},
72        morestring=[b]{'},
73        morestring=[b]{`},
74        % Comments
75        comment=[l]{//},
76        morecomment=[s]{/*}{*/},
77        morecomment=[s][\color{blue}]{/**}{*/},
78        morecomment=[n]{/+}{+/},
79        morecomment=[n][\color{blue}]{/++}{+/},
80        % Options
81        sensitive=true
82}
83
84\lstdefinelanguage{rust}{
85        % Keywords
86        morekeywords=[1]{
87                abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
88                false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
89                override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
90                trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
91        },
92        % Strings
93        morestring=[b]{"},
94        % Comments
95        comment=[l]{//},
96        morecomment=[s]{/*}{*/},
97        % Options
98        sensitive=true
99}
100
101\lstdefinelanguage{OCaml}%
102        {morekeywords={
103                and, as, asr, assert, begin, class, constraint do, done, downto, else, end, exception, external,
104                false, for, fun, function, functor, if, in, include, inherit, initializer, land, lazy, let, lor, lsl, lsr, lxor,
105                match, method, mod, module, open, mutable, new, nonrec, object, of, open, open!, or, private, rec,
106                sig, struct, then, to, true, try, type, val, virtual, when, while, with
107        },
108   sensitive,%
109   morecomment=[n]{(*}{*)},%
110   morestring=[d]"%
111}[keywords,comments,strings]%
112
113% CFA programming language, based on ANSI C (with some gcc additions)
114\lstdefinelanguage{CFA}[ANSI]{C}{
115        morekeywords={
116                alignas, _Alignas, alignof, _Alignof, __alignof, __alignof__, and, asm, __asm, __asm__, _Atomic, __attribute, __attribute__,
117                __auto_type, basetypeof, _Bool, bool, catch, catchResume, choose, coerce, corun, cofor, _Complex, __complex, __complex__,
118                __const, __const__, continue, coroutine, _Decimal32, _Decimal64, _Decimal128, disable, dtype, enable, exception, __extension__,
119                fallthrough, fallthru, finally, fixup, __float80, float80, __float128, float128, _Float16, _Float32, _Float32x, _Float64,
120                _Float64x, _Float128, _Float128x, forall, fortran, ftype, generator, _Generic, _Imaginary, __imag, __imag__, inline,
121                __inline, __inline__, int128, __int128, __int128_t, __label__, monitor, mutex, _Noreturn, __builtin_offsetof, one_t, or,
122                otype, recover, report, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, static_assert, suspend,
123                thread, __thread, _Thread_local, thread_local, throw, throwResume, timeout, trait, try, ttype, typedef, typeof, __typeof,
124                __typeof__, typeid, __uint128_t, __builtin_va_arg, __builtin_va_list, virtual, __volatile, __volatile__, vtable,
125                waitfor, waituntil, when, with, zero_t
126    },
127        moredirectives={defined,include_next}%
128}
129
130% uC++ programming language, based on ANSI C++
131\lstdefinelanguage{uC++}[GNU]{C++}{
132        morekeywords={
133                _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch, _CatchResume, _CorActor, _Cormonitor, _Coroutine,
134                _Disable, _Else, _Enable, _Event, _Exception, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
135                _Resume, _ResumeTop, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw
136        },
137}
138
139% pseudo code
140\lstdefinelanguage{pseudo}{
141        morekeywords={string,uint,int,bool,float},
142        sensitive=true,
143        morecomment=[l]{//},
144        morecomment=[s]{/*}{*/},
145        morestring=[b]',
146        morestring=[b]",
147        morestring=[s]{`}{`},
148}
149
150% Local Variables: %
151% tab-width: 4 %
152% fill-column: 100 %
153% End: %
Note: See TracBrowser for help on using the repository browser.