-
Notifications
You must be signed in to change notification settings - Fork 6
/
lang.sty
37 lines (36 loc) · 1.04 KB
/
lang.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
% Based on https://bitbucket.org/korfuri/golang-latex-listings by Uriel Corfa.
\lstdefinelanguage{go}{
sensitive=true,
alsoletter={\%},
% comments.
% // line comment
% /* general comment */
comment=[l]{//},
morecomment=[s]{/*}{*/},
% strings.
% "foo"
% `bar`
% 'x'
string=[b]{"},
morestring=[b]{`},
morestring=[b]{'},
% keywords.
% ref: http://golang.org/ref/spec#Keywords
keywords=[1]{
break, case, chan, const, continue, default, defer, else, fallthrough, for,
func, go, goto, if, import, interface, map, package, range, return, select,
struct, switch, type, var
},
% built-in functions.
% ref: http://golang.org/ref/spec#Predeclared_identifiers
morekeywords=[2]{
append, cap, close, complex, copy, delete, imag, len, make, new, panic, print,
println, real, recover
},
% basic types.
% ref: http://golang.org/ref/spec#Predeclared_identifiers
morekeywords=[3]{
bool, byte, complex64, complex128, error, float32, float64, int, int8, int16,
int32, int64, rune, string, uint, uint8, uint16, uint32, uint64, uintptr
},
}