commit 89bb88e4f572cb64963d12b2f8b17b0e29ec18e1
parent a58efa70bc07a3ccb75071da8b0de7c70f8a0056
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 16 Feb 2022 12:29:14 +0100
syntaxes: fold a couple of regexes together, and improve a few comments
Diffstat:
8 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/syntax/c.nanorc b/syntax/c.nanorc
@@ -26,10 +26,10 @@ color magenta "\<(break|continue|goto|return)\>"
color brightmagenta "'([^'\]|\\(["'\abfnrtv]|x[[:xdigit:]]{1,2}|[0-3]?[0-7]{1,2}))'"
# GCC builtins.
-color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
+color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
# Strings and names of included files.
-color brightyellow ""([^"]|\\")*"" "#[[:blank:]]*include[[:blank:]]*<[^>]+>"
+color brightyellow ""([^"]|\\")*"|#[[:blank:]]*include[[:blank:]]*<[^>]+>"
# Preprocessor directives.
color brightcyan start="^[[:blank:]]*#[[:blank:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\])$"
diff --git a/syntax/groff.nanorc b/syntax/groff.nanorc
@@ -3,23 +3,23 @@
syntax groff "\.(m[ems]|rof|tmac)$|/tmac\.[^/]+$"
comment ".\""
-# The argument of .ds or .nr
+# The setting of a string or register
color cyan "^\.(ds|nr) [^[:space:]]*"
# Single-character escapes
color brightmagenta "\\."
# The argument of \f or \s in the same color
-color brightmagenta "\\f(.|\(..)" "\\s(\+|\-)?[0-9]"
-# Newlines
+color brightmagenta "\\f(.|\(..)|\\s(\+|\-)?[0-9]"
+# References to registers
color cyan "\\(\\)?n(.|\(..)"
color cyan start="\\(\\)?n\[" end="]"
# Requests
color brightgreen "^\.[[:blank:]]*[^[:space:]]*"
# Comments
color yellow "^\.\\".*"
-# Strings
+# References to strings
color green "\\(\\)?\*(.|\(..)"
color green start="\\(\\)?\*\[" end="]"
-# Characters
+# Special characters
color brightred "\\\(.."
color brightred start="\\\[" end="]"
# Macro arguments
diff --git a/syntax/json.nanorc b/syntax/json.nanorc
@@ -22,9 +22,8 @@ color green "\<(true|false|null)\>"
color brightblue ""[^"]+"[[:blank:]]*:"
# Brackets, braces, and separators.
-color brightblue "\[" "\]"
-color brightred "\{" "\}"
-color brightred "," ":"
+color brightblue "[][]"
+color brightred "[{},:]"
# Comments.
color cyan "(^|[[:blank:]]+)(//|#).*"
diff --git a/syntax/man.nanorc b/syntax/man.nanorc
@@ -6,10 +6,10 @@ comment ".\""
# Section headers, title line, and indented paragraphs.
color green "^\.(SH|SS|TH) .*"
-color brightgreen "^\.(SH|SS|TH) " "^\.([HIT]P)"
+color brightgreen "^\.((SH|SS|TH) |[HIT]P)"
# Type faces, and normal paragraphs.
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$)"
# Inline type faces.
color magenta "\\f[BIPR]"
# Relative margins, hyperlinks, and various other stuff.
diff --git a/syntax/objc.nanorc b/syntax/objc.nanorc
@@ -15,7 +15,7 @@ color brightgreen "\<(goto|continue|break|return)\>"
color brightgreen "@(encode|end|implementation|interface)|selector)\>"
# GCC builtins.
-color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
+color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
# Selector/method.
color brightmagenta "(^|[[:blank:]])\[.*[[:blank:]].*\]"
diff --git a/syntax/ruby.nanorc b/syntax/ruby.nanorc
@@ -23,11 +23,11 @@ color brightmagenta "(/([^/]|\\/)*/|%r\{([^}]|\\\})*\})[iomx]*"
color brightblue "`[^`]*`|%x\{[^}]*\}"
# Strings, double-quoted.
-color green ""([^"]|\\")*"" "%[QW]?(\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
+color green ""([^"]|\\")*"|%[QW]?(\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
# Expression substitution for inside double-quoted strings, "like #{this}".
color brightgreen "#\{[^}]*\}"
# Strings, single-quoted.
-color green "'([^']|\\')*'" "%[qw](\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
+color green "'([^']|\\')*'|%[qw](\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
# Comments.
color cyan "#([^{#].*|$)"
diff --git a/syntax/sh.nanorc b/syntax/sh.nanorc
@@ -25,7 +25,7 @@ color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|instal
color normal "[.-]tar\>"
# Basic variable names (no braces).
-color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
+color brightred "\$([-@*#?$!0-9]|[[:alpha:]_][[:alnum:]_]*)"
# More complicated variable names; handles braces and replacements and arrays.
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:blank:]]*[[:alnum:]_]+[[:blank:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
diff --git a/syntax/xml.nanorc b/syntax/xml.nanorc
@@ -8,8 +8,8 @@ comment "<!--|-->"
# The entire content of the tag:
color green start="<" end=">"
-# The start and the end of the tag:
-color cyan "<[^> ]+" ">"
+# The angled brackets and the name of the tag:
+color cyan "<[^> ]+|>"
# The strings inside the tag:
color magenta ""[^"]*""