commit 0dbe857ba2032cfaa9f1db5ea639a5619bef4ca9
parent 483538f8f38e8c280b51ab479cec581a6fa598f5
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 18 Oct 2021 12:04:31 +0200
syntaxes: undouble the backslash within bracket expressions
Within a bracket expression, the backslash is not special,
so it does not need to be escaped.
The double backslashes within brackets were found with:
grep -o '\[[^][]*\\\\[^][]*\]' syntax{,/extra}/*rc
Also, incorporate the square brackets into some bracket expressions
by listing the closing bracket first, saving a separate regex for
those two brackets.
Diffstat:
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/syntax/c.nanorc b/syntax/c.nanorc
@@ -33,7 +33,7 @@ color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
color brightyellow ""([^"]|\\")*"" "#[[:blank:]]*include[[:blank:]]*<[^>]+>"
# Preprocessor directives.
-color brightcyan start="^[[:blank:]]*#[[:blank:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\\])$"
+color brightcyan start="^[[:blank:]]*#[[:blank:]]*(if(n?def)?|elif|warning|error|pragma)\>" end="(\`|[^\])$"
color brightcyan "^[[:blank:]]*#[[:blank:]]*((define|else|endif|include(_next)?|line|undef)\>|$)"
# Comments.
diff --git a/syntax/extra/gentoo.nanorc b/syntax/extra/gentoo.nanorc
@@ -11,7 +11,7 @@ color brightgreen "\<default(_pkg_nofetch|_src_(unpack|prepare|configure|compile
## Bash-related syntax:
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)\>"
-color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
+color green "[][{}():;|`$<>!=&\]"
color green "-[defhnrsuwxzL]\>"
color green "-(eq|ne|gt|lt|ge|le)\>"
## Variables... official portage ones in red, all others in bright red:
diff --git a/syntax/nftables.nanorc b/syntax/nftables.nanorc
@@ -27,7 +27,7 @@ color ,green "[[:space:]]+$"
# Strings and others
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
-color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
+color green "[][{}():;|`$<>!=&\]"
# Basic variable names
color brightred "(\$|@)[[:alpha:]_-][[:alnum:]_.-]*"
diff --git a/syntax/objc.nanorc b/syntax/objc.nanorc
@@ -24,7 +24,7 @@ color magenta "[[:alnum:]]*:"
color white "\[[^][:blank:]]*\]"
# Strings.
-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 brightblue "@"(\\.|[^"])*""
diff --git a/syntax/sh.nanorc b/syntax/sh.nanorc
@@ -14,7 +14,7 @@ color brightgreen "^[A-Za-z0-9_-]+\(\)"
# Keywords, symbols, and comparisons.
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)\>"
-color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
+color green "[][{}():;|`$<>!=&\]"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options.