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.
This commit is contained in:
parent
483538f8f3
commit
0dbe857ba2
@ -33,7 +33,7 @@ color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
|
|||||||
color brightyellow ""([^"]|\\")*"" "#[[:blank:]]*include[[:blank:]]*<[^>]+>"
|
color brightyellow ""([^"]|\\")*"" "#[[:blank:]]*include[[:blank:]]*<[^>]+>"
|
||||||
|
|
||||||
# Preprocessor directives.
|
# 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)\>|$)"
|
color brightcyan "^[[:blank:]]*#[[:blank:]]*((define|else|endif|include(_next)?|line|undef)\>|$)"
|
||||||
|
|
||||||
# Comments.
|
# Comments.
|
||||||
|
|||||||
@ -11,7 +11,7 @@ color brightgreen "\<default(_pkg_nofetch|_src_(unpack|prepare|configure|compile
|
|||||||
## Bash-related syntax:
|
## 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 "\<(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 "\<(declare|eval|exec|export|let|local)\>"
|
||||||
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
color green "[][{}():;|`$<>!=&\]"
|
||||||
color green "-[defhnrsuwxzL]\>"
|
color green "-[defhnrsuwxzL]\>"
|
||||||
color green "-(eq|ne|gt|lt|ge|le)\>"
|
color green "-(eq|ne|gt|lt|ge|le)\>"
|
||||||
## Variables... official portage ones in red, all others in bright red:
|
## Variables... official portage ones in red, all others in bright red:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ color ,green "[[:space:]]+$"
|
|||||||
|
|
||||||
# Strings and others
|
# Strings and others
|
||||||
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||||
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
color green "[][{}():;|`$<>!=&\]"
|
||||||
|
|
||||||
# Basic variable names
|
# Basic variable names
|
||||||
color brightred "(\$|@)[[:alpha:]_-][[:alnum:]_.-]*"
|
color brightred "(\$|@)[[:alpha:]_-][[:alnum:]_.-]*"
|
||||||
|
|||||||
@ -24,7 +24,7 @@ color magenta "[[:alnum:]]*:"
|
|||||||
color white "\[[^][:blank:]]*\]"
|
color white "\[[^][:blank:]]*\]"
|
||||||
|
|
||||||
# Strings.
|
# 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 brightblack "<[^= ]*>" ""(\\.|[^"])*""
|
||||||
color brightblue "@"(\\.|[^"])*""
|
color brightblue "@"(\\.|[^"])*""
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ color brightgreen "^[A-Za-z0-9_-]+\(\)"
|
|||||||
# Keywords, symbols, and comparisons.
|
# 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 "\<(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 "\<(declare|eval|exec|export|let|local)\>"
|
||||||
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
color green "[][{}():;|`$<>!=&\]"
|
||||||
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
|
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
|
||||||
|
|
||||||
# Short and long options.
|
# Short and long options.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user