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