Extending the syntax highlighting for Go lang.
Tweaked version of file submitted by Robert Clausecker. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4748 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
f7c5eeed2d
Коммит
5e901c41e8
@ -4,6 +4,8 @@
|
||||
* src/rcfile.c (parse_binding): Uppercase only the first two or three
|
||||
characters of the key name, in order to preserve ^Space and M-Space,
|
||||
so they can be unbound. Fixes Savannah bug #41940.
|
||||
* doc/syntax/go.nanorc: Extend the syntax highlighting for Go lang,
|
||||
from the submission by Robert Clausecker <fuzxxl@Savannah>.
|
||||
|
||||
2014-04-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/{proto.h,global.c,text.c}: Keep a pointer to the Uncut item in
|
||||
|
@ -1,21 +1,42 @@
|
||||
## Here is an example for Python.
|
||||
## Here is an example for Go.
|
||||
##
|
||||
syntax "go" "\.go$"
|
||||
header "^#!.*/python[-0-9._]*"
|
||||
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightcyan "\<(break|default|func|interface|select|case|defer|go|map|struct|chan|else|goto|package|switch|const|fallthrough|if|range|type|continue|for|import|return|var)\>"
|
||||
# Types.
|
||||
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
||||
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
|
||||
|
||||
## String highlighting. You will in general want your comments and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!
|
||||
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
# Predefined functions.
|
||||
color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"
|
||||
|
||||
# Control structures.
|
||||
color brightyellow "\<(case|default|defer|else|for|go|if|range|select|switch)\>"
|
||||
|
||||
## Comment highlighting
|
||||
# Control flow.
|
||||
color magenta "\<(break|continue|fallthrough|goto|return)\>"
|
||||
|
||||
# Declarations.
|
||||
color brightcyan "\<(package|import)\>"
|
||||
color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
|
||||
|
||||
# Literals.
|
||||
color red "\<[0-9]+\.[0-9]*([Ee][+-][0-9]+)?i?\>"
|
||||
color red "\<[0-9]+[Ee][+-][0-9]+i?\>"
|
||||
color red "\<\.[0-9]+([Ee][+-][0-9]+)?i?\>"
|
||||
color red "\<[0-9]+i\>"
|
||||
color red "\<[1-9][0-9]*\>"
|
||||
color red "\<0[0-7]*\>"
|
||||
icolor red "\<0x[0-9a-f]+\>"
|
||||
|
||||
# Strings and characters; slightly fuzzy.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
color red "'(\\.|[^'])+'"
|
||||
color red ""(\\.|[^"])*""
|
||||
color red start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
# Comments.
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user