blob: 308e976d710c5a1c905fd5901ec6d03a66c68ba8 [file] [log] [blame]
Benno Schulenberg5e901c42014-04-08 12:09:29 +00001## Here is an example for Go.
Benno Schulenbergfe9da942014-05-16 20:21:34 +00002
Chris Allegretta211a5e42014-03-31 20:26:03 +00003syntax "go" "\.go$"
Mike Scalora6a2032f2016-05-25 22:13:50 +02004comment "//"
Chris Allegretta211a5e42014-03-31 20:26:03 +00005
Benno Schulenberg6f352032016-02-11 17:30:16 +00006# Set up a formatter since spelling is probably useless...
7formatter gofmt -w
8
Benno Schulenberg5e901c42014-04-08 12:09:29 +00009# Types.
10color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
11color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
Chris Allegretta211a5e42014-03-31 20:26:03 +000012
Benno Schulenberg5e901c42014-04-08 12:09:29 +000013# Predefined functions.
14color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"
Chris Allegretta211a5e42014-03-31 20:26:03 +000015
Benno Schulenberg5e901c42014-04-08 12:09:29 +000016# Control structures.
17color brightyellow "\<(case|default|defer|else|for|go|if|range|select|switch)\>"
Chris Allegretta211a5e42014-03-31 20:26:03 +000018
Benno Schulenberg5e901c42014-04-08 12:09:29 +000019# Control flow.
20color magenta "\<(break|continue|fallthrough|goto|return)\>"
21
22# Declarations.
23color brightcyan "\<(package|import)\>"
24color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
25
26# Literals.
27color red "\<[0-9]+\.[0-9]*([Ee][+-][0-9]+)?i?\>"
28color red "\<[0-9]+[Ee][+-][0-9]+i?\>"
29color red "\<\.[0-9]+([Ee][+-][0-9]+)?i?\>"
30color red "\<[0-9]+i\>"
31color red "\<[1-9][0-9]*\>"
32color red "\<0[0-7]*\>"
33icolor red "\<0x[0-9a-f]+\>"
34
35# Strings and characters; slightly fuzzy.
36color red "\<(true|false|nil|iota|_)\>"
37color red "'(\\.|[^'])+'"
38color red ""(\\.|[^"])*""
39color red start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
40
41# Comments.
Chris Allegretta211a5e42014-03-31 20:26:03 +000042color brightblue "//.*"
43color brightblue start="/\*" end="\*/"
44
Benno Schulenberg5e901c42014-04-08 12:09:29 +000045# Trailing whitespace.
46color ,green "[[:space:]]+$"