Commit fe9da942 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Partially harmonizing the syntax-colouring files.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4899 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 79 additions and 75 deletions
+79 -75
......@@ -3,6 +3,7 @@
* doc/syntax/patch.nanorc: Show trailing whitespace on added lines.
* doc/syntax/debian.nanorc: Make the component colouring simpler,
and the URI colouring completer, and improve the comments.
* doc/syntax/*.nanorc: Harmonize (partially) the syntax files.
2014-05-16 David Lawrence Ramsey <pooka109@gmail.com>
* src/color.c, src/cut.c, src/text.c: Tweak some whitespace.
......
## Here is an example for assembler.
##
syntax "asm" "\.(S|s|asm)$"
magic "[Aa]ssembl(y|er)"
color red "\<[A-Z_]{2,}\>"
color brightgreen "\.(data|subsection|text)"
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single|struct|word)"
icolor brightred "^[[:space:]]*[.0-9A-Z_]*:"
color brightcyan "^[[:space:]]*#[[:space:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
## Highlight strings (note: VERY resource intensive)
# Strings.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
# Multiline strings (note: VERY resource intensive).
color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
## Highlight comments
# Comments.
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
## Highlight trailing whitespace
# Trailing whitespace.
color ,green "[[:space:]]+$"
## Here is an example for awk.
##
syntax "awk" "\.awk$"
magic "awk.*script text"
## records
# Records.
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
## awk-set variables
# Awk-set variables.
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
color red "\<(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\>"
## function declarations and special patterns
# Function declarations and special patterns.
color brightgreen "\<(function|extension|BEGIN|END)\>"
## operators
# Operators.
color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
## flow control
# Flow control.
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
color brightyellow "\<(break|continue|return)\>"
## I/O statements
# I/O statements.
color brightgreen "\<(close|getline|next|nextfile|print|printf)\>"
color brightgreen "\<(system|fflush)\>"
## standard functions
# Standard functions.
color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
color magenta "\<(split|sprintf|strtonum|sub|substr|tolower|toupper)\>"
......@@ -26,13 +27,10 @@ color magenta "\<(mktime|strftime|systime)\>"
color magenta "\<(and|compl|lshift|or|rshift|xor)\>"
color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
## 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.
# Strings.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
## Comment highlighting
# Comments.
color brightblue "(^|[[:space:]])#.*$"
## Trailing whitespace
# Trailing whitespace.
color ,green "[[:space:]]+$"
......@@ -3,7 +3,7 @@
syntax "c" "\.(c(c|pp|xx|\+\+)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
magic "(ASCII|UTF-8 Unicode) C(\+\+)? program text"
color brightred "\<[A-Z_][0-9A-Z_]+\>"
color brightred "\<[A-Z_][0-9A-Z_]+\>"
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
......
## Colouring for Changelogs.
##
syntax "changelog" "Change[Ll]og.*"
# Author lines.
......@@ -14,13 +14,10 @@ color magenta "[[:space:]]\*[[:space:]].*:"
# Command-line options.
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
# Bug numbers.
color cyan "bug #[0-9]{5}"
# Probable variables, for variety.
color brightred "\<[A-Z_][0-9A-Z_]+\>"
color brightred "\<[A-Z_][0-9A-Z_]+\>"
# Key sequences.
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
......
## Syntax highlighting for CMake files.
##
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
icolor green "^[[:space:]]*[A-Z0-9_]+"
......
## Here is an example for CSS files.
##
syntax "css" "\.css$"
color brightred "."
color brightyellow start="\{" end="\}"
color brightwhite start=":" end="([;^\{]|$)"
......
## Here is an example for Gentoo ebuilds/eclasses.
##
syntax "ebuild" "\.e(build|class)$"
## All the standard portage functions
color brightgreen "(^|\<default_)src_(unpack|prepare|configure|compile|install|test)\>"
color brightgreen "^pkg_(config|nofetch|info|pretend|setup|(pre|post)(inst|rm))\>"
......
## Here is an example for Go.
##
syntax "go" "\.go$"
# Types.
......
## Here is an example for groff.
##
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
## The argument of .ds or .nr
# The argument of .ds or .nr
color cyan "^\.(ds|nr) [^[[:space:]]]*"
## Single character escapes
# Single-character escapes
color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
# The argument of \f or \s in the same color
color brightmagenta "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
## Newlines
# Newlines
color cyan "(\\|\\\\)n(.|\(..)"
color cyan start="(\\|\\\\)n\[" end="]"
## Requests
# Requests
color brightgreen "^\.[[:space:]]*[^[[:space:]]]*"
## Comments
# Comments
color yellow "^\.\\".*$"
## Strings
# Strings
color green "(\\|\\\\)\*(.|\(..)"
color green start="(\\|\\\\)\*\[" end="]"
## Characters
# Characters
color brightred "\\\(.."
color brightred start="\\\[" end="]"
## Macro arguments
# Macro arguments
color brightcyan "\\\\\$[1-9]"
## Here is a short example for HTML.
##
syntax "html" "\.html?$"
magic "HTML document text"
color cyan start="<" end=">"
color red "&[^;[:space:]]*;"
color green ""(\\.|[^"])*""
## Here is an example for Java.
##
syntax "java" "\.java$"
magic "Java "
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
......
## Here is an example for Javascript.
##
syntax "javascript" "\.js$"
color brightred "\<[A-Z_][0-9A-Z_]+\>"
color green "\<(const|function|let|this|typeof|var|void)\>"
color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>"
......@@ -8,14 +9,11 @@ color brightyellow "\<(export|try|throw|catch|new|delete)\>"
color magenta "\<(continue|break|return|yield)\>"
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
## 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.
# Strings.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'"
## Comment highlighting
# Comments.
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
## Trailing whitespace
# Trailing whitespace.
color ,green "[[:space:]]+$"
##############################################################################
## Syntax highlighting for Lua.
#
# Lua syntax highlighting for Nano.
#
# Author: Matthew Wild <mwild1 (at) gmail.com>
# License: GPL 3 or later
#
# Version: 2011-05-05
#
# Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt
##############################################################################
## Author: Matthew Wild <mwild1 (at) gmail.com>
## License: GPL 3 or later
## Version: 2011-05-05
# Automatically use for '.lua' files
syntax "lua" "\.lua$"
color brightwhite "\[\[.*\]\]"
......
## Syntax highlighting for Makefiles.
## (unattributed example from http://wiki.linuxhelp.net/)
## Here is an example for Makefiles.
syntax "makefile" "Makefile[^/]*$"
color red "[:=]"
color magenta "\<(if|ifeq|else|endif)\>"
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
color brightblue "^[^ ]+:"
color green "#.*$"
## Trailing whitespace.
color ,green "[[:space:]]+$"
## Here is an example for manpages.
##
syntax "man" "\.[1-9]x?$"
magic "troff or preprocessor input text"
color green "\.(SH|SS|TH) .*$"
color brightgreen "\.(SH|SS|TH) " "\.([HIT]P)"
color brightred "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) .*$"
color brightblue "\.(B[IR]?|I[BR]?|R[BI]|S[BM]) " "\.([LP]?P)$"
color magenta "\\f[BIPR]"
color yellow "\.(br|DT|RS|RE|PD)"
# Comments.
color cyan "\.?\\\".*$"
# Trailing whitespace.
color ,green "[[:space:]]+$"
## Here is an example for Magicpoint presentations.
##
syntax "mgp" "\.mgp$"
header "^%include.*"
icolor green "^%[a-z].*$"
color cyan "(^|[[:space:]])#.*$"
color cyan "(^|[[:space:]])%%.*$"
......
## Here is an example for quoted emails (under e.g. mutt).
##
syntax "mutt"
color green "^>.*"
## Here is an example for C/C++/Obj-C.
##
syntax "m" "\.m$"
## Stuffs
color brightwhite "\<[A-Z_][0-9A-Z_]+\>"
# Stuffs,
color brightwhite "\<[A-Z_][0-9A-Z_]+\>"
color green "\<(float|double|BOOL|bool|char|int|short|long|id|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
color green "\<[[:alpha:]_][[:alnum:]_]*_t\>"
color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
......@@ -12,27 +12,28 @@ color brightgreen "\<(try|throw|catch|operator|new|delete)\>"
color brightgreen "\<(goto|continue|break|return)\>"
color brightgreen "@\<(en(code|d)|i(mplementation|nterface)|selector)\>"
## GCC builtins
# GCC builtins.
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
## Selector/method
# Selector/method.
color brightmagenta "(^|[[:space:]])\[.*[[:space:]].*\]"
color white ":[[:alnum:]]*"
color magenta "[[:alnum:]]*:"
color white "\[[^][:space:]]*\]"
## 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.
# Strings.
color brightblack "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
color brightblack "<[^= ]*>" ""(\\.|[^"])*""
color brightblue "@"(\\.|[^"])*""
## This string is VERY resource intensive!
# Multiline strings. This regex is VERY resource intensive!
## color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
# Preprocessor commands.
color brightblue "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
## Comment highlighting
# Comments.
color yellow "//.*"
color yellow start="/\*" end="\*/"
# Trailing whitespace.  
color ,green "[[:space:]]+$"
## Syntax highlighting for OCaml.
syntax "ocaml" "\.mli?$"
#uid
color red "\<[A-Z][0-9a-z_]{2,}\>"
#declarations
......@@ -10,7 +11,7 @@ color red "\<(type|open|class|module|exception|external)\>"
#patterns
color blue "\<(fun|function|functor|match|try|with)\>"
#patterns-modifiers
color yellow "\<(as|when|of)\>"
color yellow "\<(as|when|of)\>"
#conditions
color cyan "\<(if|then|else)\>"
#blocs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment