From fe9da9425e57258c97ca417c058018be0735089a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 16 May 2014 20:21:34 +0000 Subject: [PATCH] Partially harmonizing the syntax-colouring files. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4899 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + doc/syntax/asm.nanorc | 13 +++++++++---- doc/syntax/awk.nanorc | 26 ++++++++++++-------------- doc/syntax/c.nanorc | 2 +- doc/syntax/changelog.nanorc | 7 ++----- doc/syntax/cmake.nanorc | 2 +- doc/syntax/css.nanorc | 3 ++- doc/syntax/gentoo.nanorc | 3 ++- doc/syntax/go.nanorc | 2 +- doc/syntax/groff.nanorc | 21 +++++++++++---------- doc/syntax/html.nanorc | 3 ++- doc/syntax/java.nanorc | 3 ++- doc/syntax/javascript.nanorc | 12 +++++------- doc/syntax/lua.nanorc | 16 ++++------------ doc/syntax/makefile.nanorc | 5 +++-- doc/syntax/man.nanorc | 5 ++++- doc/syntax/mgp.nanorc | 3 ++- doc/syntax/mutt.nanorc | 3 ++- doc/syntax/objc.nanorc | 21 +++++++++++---------- doc/syntax/ocaml.nanorc | 3 ++- doc/syntax/perl.nanorc | 1 + doc/syntax/php.nanorc | 22 +++++++++++----------- doc/syntax/po.nanorc | 3 ++- doc/syntax/pov.nanorc | 6 ++++-- doc/syntax/python.nanorc | 2 +- doc/syntax/ruby.nanorc | 31 ++++++++++++++++--------------- doc/syntax/sh.nanorc | 12 ++++++++++-- doc/syntax/spec.nanorc | 27 ++++++++++++++------------- doc/syntax/tex.nanorc | 3 ++- doc/syntax/texinfo.nanorc | 2 +- 30 files changed, 141 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3304a28a..1b549541 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 * src/color.c, src/cut.c, src/text.c: Tweak some whitespace. diff --git a/doc/syntax/asm.nanorc b/doc/syntax/asm.nanorc index 9d927604..4e215915 100644 --- a/doc/syntax/asm.nanorc +++ b/doc/syntax/asm.nanorc @@ -1,18 +1,23 @@ ## 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:]]+$" diff --git a/doc/syntax/awk.nanorc b/doc/syntax/awk.nanorc index 48b3db11..bfc6387c 100644 --- a/doc/syntax/awk.nanorc +++ b/doc/syntax/awk.nanorc @@ -1,24 +1,25 @@ ## 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:]]+$" diff --git a/doc/syntax/c.nanorc b/doc/syntax/c.nanorc index 3fc3fbb3..8fe7088d 100644 --- a/doc/syntax/c.nanorc +++ b/doc/syntax/c.nanorc @@ -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)\>" diff --git a/doc/syntax/changelog.nanorc b/doc/syntax/changelog.nanorc index 84c07b09..60666bd5 100644 --- a/doc/syntax/changelog.nanorc +++ b/doc/syntax/changelog.nanorc @@ -1,5 +1,5 @@ ## 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]" "\" color brightgreen "^pkg_(config|nofetch|info|pretend|setup|(pre|post)(inst|rm))\>" diff --git a/doc/syntax/go.nanorc b/doc/syntax/go.nanorc index b60c72f4..58ef1812 100644 --- a/doc/syntax/go.nanorc +++ b/doc/syntax/go.nanorc @@ -1,5 +1,5 @@ ## Here is an example for Go. -## + syntax "go" "\.go$" # Types. diff --git a/doc/syntax/groff.nanorc b/doc/syntax/groff.nanorc index 02b82b8e..70f641d3 100644 --- a/doc/syntax/groff.nanorc +++ b/doc/syntax/groff.nanorc @@ -1,24 +1,25 @@ ## 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]" diff --git a/doc/syntax/html.nanorc b/doc/syntax/html.nanorc index 5066da44..8782dc36 100644 --- a/doc/syntax/html.nanorc +++ b/doc/syntax/html.nanorc @@ -1,7 +1,8 @@ ## Here is a short example for HTML. -## + syntax "html" "\.html?$" magic "HTML document text" + color cyan start="<" end=">" color red "&[^;[:space:]]*;" color green ""(\\.|[^"])*"" diff --git a/doc/syntax/java.nanorc b/doc/syntax/java.nanorc index f45b0c94..0beebf47 100644 --- a/doc/syntax/java.nanorc +++ b/doc/syntax/java.nanorc @@ -1,7 +1,8 @@ ## 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)\>" diff --git a/doc/syntax/javascript.nanorc b/doc/syntax/javascript.nanorc index d68da5dd..991f54bf 100644 --- a/doc/syntax/javascript.nanorc +++ b/doc/syntax/javascript.nanorc @@ -1,6 +1,7 @@ ## 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:]]+$" diff --git a/doc/syntax/lua.nanorc b/doc/syntax/lua.nanorc index 3f5b7be8..7512f53c 100644 --- a/doc/syntax/lua.nanorc +++ b/doc/syntax/lua.nanorc @@ -1,17 +1,9 @@ -############################################################################## +## Syntax highlighting for Lua. # -# Lua syntax highlighting for Nano. -# -# Author: Matthew Wild -# License: GPL 3 or later -# -# Version: 2011-05-05 -# -# Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt -############################################################################## - +## Author: Matthew Wild +## License: GPL 3 or later +## Version: 2011-05-05 -# Automatically use for '.lua' files syntax "lua" "\.lua$" color brightwhite "\[\[.*\]\]" diff --git a/doc/syntax/makefile.nanorc b/doc/syntax/makefile.nanorc index f81d1e5a..04163909 100644 --- a/doc/syntax/makefile.nanorc +++ b/doc/syntax/makefile.nanorc @@ -1,11 +1,12 @@ -## 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:]]+$" diff --git a/doc/syntax/man.nanorc b/doc/syntax/man.nanorc index cdee7a2d..6c296bb6 100644 --- a/doc/syntax/man.nanorc +++ b/doc/syntax/man.nanorc @@ -1,14 +1,17 @@ ## 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:]]+$" diff --git a/doc/syntax/mgp.nanorc b/doc/syntax/mgp.nanorc index 8f2bc744..c0a5d203 100644 --- a/doc/syntax/mgp.nanorc +++ b/doc/syntax/mgp.nanorc @@ -1,7 +1,8 @@ ## Here is an example for Magicpoint presentations. -## + syntax "mgp" "\.mgp$" header "^%include.*" + icolor green "^%[a-z].*$" color cyan "(^|[[:space:]])#.*$" color cyan "(^|[[:space:]])%%.*$" diff --git a/doc/syntax/mutt.nanorc b/doc/syntax/mutt.nanorc index 2e683998..9acd6a09 100644 --- a/doc/syntax/mutt.nanorc +++ b/doc/syntax/mutt.nanorc @@ -1,4 +1,5 @@ ## Here is an example for quoted emails (under e.g. mutt). -## + syntax "mutt" + color green "^>.*" diff --git a/doc/syntax/objc.nanorc b/doc/syntax/objc.nanorc index 2dddf02c..bfbae126 100644 --- a/doc/syntax/objc.nanorc +++ b/doc/syntax/objc.nanorc @@ -1,9 +1,9 @@ ## 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:]]+$" diff --git a/doc/syntax/ocaml.nanorc b/doc/syntax/ocaml.nanorc index 3d07e1a1..8decb727 100644 --- a/doc/syntax/ocaml.nanorc +++ b/doc/syntax/ocaml.nanorc @@ -1,6 +1,7 @@ ## 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 diff --git a/doc/syntax/perl.nanorc b/doc/syntax/perl.nanorc index a5bebf24..5f39c176 100644 --- a/doc/syntax/perl.nanorc +++ b/doc/syntax/perl.nanorc @@ -1,4 +1,5 @@ ## Here is an example for Perl. + syntax "perl" "\.p[lm]$" header "^#!.*/perl[-0-9._]*" magic "Perl script text" diff --git a/doc/syntax/php.nanorc b/doc/syntax/php.nanorc index 44d3cf4d..e3c4f1fa 100644 --- a/doc/syntax/php.nanorc +++ b/doc/syntax/php.nanorc @@ -1,31 +1,31 @@ ## Here is an example for PHP. -## + syntax "php" "\.php[2345s~]?$" magic "PHP script text" -## php markings +# PHP markings. color brightgreen "(<\?(php)?|\?>)" -## functions +# Functions. color white "\<[a-z_]*\(" -## types +# Types. color green "\<(var|float|global|double|bool|char|int|enum|const)\>" -## structure +# Structure. color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>" -## control flow +# Control flow. color magenta "\<(goto|continue|break|return)\>" -## strings +# Strings. color brightyellow "<[^= ]*>" ""(\.|[^"])*"" -## comments +# Comments. color brightblue "//.*" color brightblue start="/\*" end="\*/" -#color blue start="<" end=">" -#color red "&[^;[[:space:]]]*;" +##color blue start="<" end=">" +##color red "&[^;[[:space:]]]*;" -## trailing whitespace +# Trailing whitespace. color ,green "[[:space:]]+$" diff --git a/doc/syntax/po.nanorc b/doc/syntax/po.nanorc index db5acfac..567ef7ad 100644 --- a/doc/syntax/po.nanorc +++ b/doc/syntax/po.nanorc @@ -1,6 +1,7 @@ ## Colouring for PO files. -## + syntax "po" "\.pot?$" + # Comments. color green "^#.*$" color yellow "Copyright|\(C\)" diff --git a/doc/syntax/pov.nanorc b/doc/syntax/pov.nanorc index 298b2012..b7033b10 100644 --- a/doc/syntax/pov.nanorc +++ b/doc/syntax/pov.nanorc @@ -1,6 +1,7 @@ ## Here is an example for POV-Ray. -## + syntax "pov" "\.(pov|POV|povray|POVRAY)$" + color brightcyan "^[[:space:]]*#[[:space:]]*(declare)" color brightyellow "\<(sphere|cylinder|translate|matrix|rotate|scale)\>" color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>" @@ -10,6 +11,7 @@ color brightred "\<(light_source|background)\>" color brightred "\<(fog|object|camera)\>" color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color brightmagenta "\<(union|group|subgroup)\>" -## Comment highlighting + +# Comments. color brightblue "//.*" color brightblue start="/\*" end="\*/" diff --git a/doc/syntax/python.nanorc b/doc/syntax/python.nanorc index 423ce245..4679cf10 100644 --- a/doc/syntax/python.nanorc +++ b/doc/syntax/python.nanorc @@ -1,5 +1,5 @@ ## Here is an example for Python. -## + syntax "python" "\.py$" header "^#!.*/python[-0-9._]*" diff --git a/doc/syntax/ruby.nanorc b/doc/syntax/ruby.nanorc index b30b229d..3566e1fe 100644 --- a/doc/syntax/ruby.nanorc +++ b/doc/syntax/ruby.nanorc @@ -1,31 +1,32 @@ ## Here is an example for Ruby. -## + syntax "ruby" "\.rb$" header "^#!.*/ruby[-0-9._]*" -## Asciibetical list of reserved words + +# Asciibetical list of reserved words. color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>" -## Constants +# Constants. color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*" -## Ruby "symbols" +# Ruby "symbols". icolor magenta "([ ]|^):[0-9A-Z_]+\>" -## Some unique things we want to stand out +# Some unique things we want to stand out. color brightyellow "\<(__FILE__|__LINE__)\>" -## Regular expressions +# Regular expressions. color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*" -## Shell command expansion is in `backticks` or like %x{this}. These are -## "double-quotish" (to use a perlism). +# Shell command expansion is in `backticks` or like %x{this}. These are +# "double-quotish" (to use a perlism). color brightblue "`[^`]*`" "%x\{[^}]*\}" -## Strings, double-quoted +# Strings, double-quoted. color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!" -## Expression substitution. These go inside double-quoted strings, -## "like #{this}". +# Expression substitution. These go inside double-quoted strings, +# "like #{this}". color brightgreen "#\{[^}]*\}" -## Strings, single-quoted +# Strings, single-quoted. color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!" -## Comments +# Comments. color cyan "#[^{].*$" "#$" color brightcyan "##[^{].*$" "##$" -## "Here" docs +# "Here" docs. color green start="<<-?'?EOT'?" end="^EOT" -## Some common markers +# Some common markers. color brightcyan "(XXX|TODO|FIXME|\?\?\?)" diff --git a/doc/syntax/sh.nanorc b/doc/syntax/sh.nanorc index 1623d969..823cc5d1 100644 --- a/doc/syntax/sh.nanorc +++ b/doc/syntax/sh.nanorc @@ -1,8 +1,9 @@ ## Here is an example for Bourne shell scripts. -## + syntax "sh" "\.sh$" -magic "(POSIX|Bourne.*) shell script text" header "^#!.*/(ba|k|pdk)?sh[-0-9_]*" +magic "(POSIX|Bourne.*) shell script text" + icolor brightgreen "^[0-9A-Z_]+\(\)" color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>" color green "\<(declare|eval|exec|export|let|local)\>" @@ -10,10 +11,17 @@ color green "[{}():;|`$<>!=&\\]" "(\]|\[)" color green "-[Ldefgruwx]\>" color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|echo|env|grep|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|umask|unset)\>" + # Basic variable names (no braces). color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*" # More complicated variable names; handles braces and replacements and arrays. color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})" + +# Comments. color cyan "(^|[[:space:]])#.*$" + +# Strings. color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" + +# Trailing whitespace. color ,green "[[:space:]]+$" diff --git a/doc/syntax/spec.nanorc b/doc/syntax/spec.nanorc index 1a5d2f9d..a0fff88a 100644 --- a/doc/syntax/spec.nanorc +++ b/doc/syntax/spec.nanorc @@ -1,8 +1,8 @@ ## Syntax highlighting for RPM spec files. -## Parts were taken from Kate's (KDE) syntax highlighting. -## Asterios Dramis + syntax "spec" "\.(spec$|spec\.*)" -# Main tags + +# Main tags. color brightblue "((Icon|ExclusiveOs|ExcludeOs)[[:space:]]*:)" color brightblue "((BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch)[[:space:]]*:)" color brightblue "((Conflicts|Obsoletes|Provides|Requires|Requires\(.*\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|Supplements)[[:space:]]*:)" @@ -11,28 +11,29 @@ color brightblue "((AutoReq|AutoProv|AutoReqProv)[[:space:]]*:)" color brightblue "((Copyright|License|Summary|Summary\(.*\)|Distribution|Vendor|Packager|Group|Source\d*|Patch\d*|BuildRoot|Prefix)[[:space:]]*:)" color brightblue "((Name|Version|Release|Url|URL)[[:space:]]*:)" color brightblue start="^Source" end=":" start="^Patch" end=":" -# Architectures +# Architectures. color brightred "(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppc|iseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x|s390|noarch)" -# Architecture conditionals +# Architecture conditionals. color brightred "(ifarch|ifnarch)" -# OS conditionals +# OS conditionals. color brightred "(ifos|ifnos)" -# %* strings +# %* strings. color green "%([A-Z_a-z_0-9_]*)" color magenta "%_([A-Z_a-z_0-9_]*)" color yellow start="%__" end="\ " color magenta start="%\{" end="\}" color yellow start="%\{__" end="\}" -# Sections +# Sections. color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)" color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)" -# Conditionals and Defines +# Conditionals and defines. color brightred "%(if|else|endif|define|global|undefine)" -# Comments + +# Comments. color cyan "#.*$" -# "# norootforbuild" is handled as main tag +# Special case: "# norootforbuild" is handled as main tag. color brightblue "^# norootforbuild" -# %changelog date entries +# %changelog date entries. color brightyellow "^\* .*\)$" -# Trailing whitespace +# Trailing whitespace. color ,green "[[:space:]]+$" diff --git a/doc/syntax/tex.nanorc b/doc/syntax/tex.nanorc index 23ca3a44..7fa417c4 100644 --- a/doc/syntax/tex.nanorc +++ b/doc/syntax/tex.nanorc @@ -1,6 +1,7 @@ ## Here is a short example for TeX files. -## + syntax "tex" "\.tex$" + icolor green "\\.|\\[A-Z]*" color magenta "[{}]" color blue "(^|[^\])%.*" diff --git a/doc/syntax/texinfo.nanorc b/doc/syntax/texinfo.nanorc index ca62aacb..63354bae 100644 --- a/doc/syntax/texinfo.nanorc +++ b/doc/syntax/texinfo.nanorc @@ -1,5 +1,5 @@ ## Here is an example for Texinfo files. -## + syntax "texinfo" "\.texi$" header "^\\input texinfo" magic "Texinfo source text" -- 2.39.5