go.nanorc (1446B)
1 ## Syntax highlighting for Go. 2 3 ## Original author: Robert Clausecker 4 ## License: CC0 (public domain) 5 6 syntax go "\.go$" 7 comment "//" 8 9 formatter gofmt -w 10 11 # Types. 12 color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>" 13 color green "\<(chan|const|func|interface|map|struct|type|var)\>" 14 color green "<-[[:blank:]]*chan\>|\<chan[[:blank:]]*<-" 15 16 # Predefined functions. 17 color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>" 18 19 # Control structures. 20 color brightyellow "\<(case|default|defer|else|for|go|if|range|select|switch)\>" 21 22 # Control flow. 23 color magenta "\<(break|continue|fallthrough|goto|return)\>" 24 25 # Declarations. 26 color brightcyan "\<(package|import)\>" 27 28 # Literals. 29 color red "\<(true|false|nil|iota|_)\>" 30 color red "\<([1-9][0-9]*|0[0-7]*|0[xX][[:xdigit:]]+)\>" 31 color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>" 32 color red "\<[0-9]+[eE][+-]?[0-9]+i?\>" 33 color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>" 34 color red "\<[0-9]+i\>" 35 36 # Strings and characters; slightly fuzzy. 37 color red ""([^"\]|\\.)*"|'([^'\]|\\.)+'" 38 color red start=""([^"\]|\\.)*\\[[:blank:]]*$" end="^([^"\]|\\.)*"" 39 40 # Comments. 41 color brightblue "//.*" 42 color brightblue start="/\*" end="\*/" 43 44 # Special comments. 45 color brightcyan "//[[:blank:]]*\+build[[:blank:]]+(([[:alnum:]_]+[[:blank:]]*)+,[[:blank:]]*)*[[:alnum:]_]+" 46 47 # Trailing whitespace. 48 color ,green "[[:space:]]+$"