syntaxes: remove some superfluous outer parentheses from regexes

Also, standardize some comments, condense a few regexes, add some
word-edge anchors, and remove some superfluous backslashes.
master
Benno Schulenberg 2020-04-21 12:47:08 +02:00
parent afce41c754
commit 227467adb9
14 changed files with 24 additions and 24 deletions

View File

@ -5,7 +5,7 @@ comment "#"
# Keywords: # Keywords:
color yellow "\<(if|test|then|elif|else|fi|for|in|do|done)\>" color yellow "\<(if|test|then|elif|else|fi|for|in|do|done)\>"
color yellow "(=|!=|&&|\|\|)" color yellow "=|!=|&&|\|\|"
# Macros: # Macros:
color cyan "\<[[:upper:]_[:digit:]]+\>" color cyan "\<[[:upper:]_[:digit:]]+\>"

View File

@ -14,7 +14,7 @@ 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)\>"

View File

@ -12,7 +12,7 @@ color yellow "<[^>]*@[^>]*>"
# Command-line options. # Command-line options.
color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+" color cyan "[[:space:]]-[a-zA-Z\$]" "--[8a-z-]+"
# Bug and patch numbers. # Bug and patch numbers.
color cyan "(BZ|bug|patch) #[0-9]+" "PR [[:alnum:]]+/[0-9]+" color cyan "(BZ|bug|patch)[ ]#[0-9]+" "PR [[:alnum:]]+/[0-9]+"
# Probable constants, for variety. # Probable constants, for variety.
color brightred "\<[A-Z_][0-9A-Z_]+\>" color brightred "\<[A-Z_][0-9A-Z_]+\>"
# Key sequences. # Key sequences.

View File

@ -1,4 +1,4 @@
## Here is an example for apt's sources.list. ## Syntax highlighting for apt's sources.list.
syntax sources.list "sources\.list(\.d/.*\.list)?(~|\.old|\.save)?$" syntax sources.list "sources\.list(\.d/.*\.list)?(~|\.old|\.save)?$"
comment "#" comment "#"

View File

@ -1,5 +1,5 @@
## Here is an example for Gentoo ebuilds/eclasses, ## Syntax highlighting for Gentoo ebuilds/eclasses,
## and (further down) one for Portage control files. ## and (further down) for Portage control files.
syntax ebuild "\.e(build|class|blit)$" syntax ebuild "\.e(build|class|blit)$"
comment "#" comment "#"

View File

@ -10,13 +10,13 @@ comment "--"
color red "\<(as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix(l|r)?|instance|let|in|mdo|module|newtype|qualified|type|where)\>" color red "\<(as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix(l|r)?|instance|let|in|mdo|module|newtype|qualified|type|where)\>"
# Various symbols # Various symbols
color cyan "(\||@|!|:|_|~|=|\\|;|\(\)|,|\[|\]|\{|\})" color cyan "\||@|!|:|_|~|=|\\|;|\(\)|,|\[|\]|\{|\}"
# Operators # Operators
color magenta "(==|/=|&&|\|\||<|>|<=|>=)" color magenta "==|/=|&&|\|\||<|>|<=|>="
# More symbols # More symbols
color cyan "(->|<-|=>)" color cyan "->|<-|=>"
color magenta "\.|\$" color magenta "\.|\$"
# Data constructors # Data constructors

View File

@ -8,7 +8,7 @@ color brightyellow "\<(sphere|cylinder|translate|matrix|rotate|scale)\>"
color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>" color brightyellow "\<(orthographic|location|up|right|direction|clipped_by)\>"
color brightyellow "\<(fog_type|fog_offset|fog_alt|rgb|distance|transform)\>" color brightyellow "\<(fog_type|fog_offset|fog_alt|rgb|distance|transform)\>"
color brightred "\<(background|camera|fog|light_source|object|texture)\>" color brightred "\<(background|camera|fog|light_source|object|texture)\>"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color green "\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|"
color brightmagenta "\<(union|group|subgroup)\>" color brightmagenta "\<(union|group|subgroup)\>"
# Comments. # Comments.

View File

@ -8,17 +8,17 @@ color cyan "^\.(ds|nr) [^[:space:]]*"
# Single-character escapes # Single-character escapes
color brightmagenta "\\." color brightmagenta "\\."
# 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(.|\(..)" "\\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="]"

View File

@ -16,7 +16,7 @@ color green ":[[:space:]]*\"#[0-9abcdefABCDEF]+\""
# Escapes. # Escapes.
color green "\\\\" "\\\"" "\\[bfnrt]" "\\u[0-9abcdefABCDEF]{4})" color green "\\\\" "\\\"" "\\[bfnrt]" "\\u[0-9abcdefABCDEF]{4})"
# Special words. # Special words.
color green "(true|false|null)" color green "\<(true|false|null)\>"
# Names (very unlikely to contain a quote). # Names (very unlikely to contain a quote).
color brightblue "\"[^"]+\"[[:space:]]*:" color brightblue "\"[^"]+\"[[:space:]]*:"

View File

@ -8,8 +8,8 @@ color green "^#.*$"
color yellow "Copyright|\(C\)" color yellow "Copyright|\(C\)"
# Header fields. # Header fields.
color brightred "^\"X-Bugs:.*\"$" color brightred "^\"X-Bugs:.*\"$"
color brightmagenta "\<(Project\-Id\-Version|Report\-Msgid\-Bugs\-To|Last\-Translator|Language(\-Team)?|X-Bugs|X-Generator|Plural\-Forms)\>" color brightmagenta "\<(Project-Id-Version|Report-Msgid-Bugs-To|Last-Translator|Language(-Team)?|X-Bugs|X-Generator|Plural-Forms)\>"
color cyan "\<(POT\-Creation\-Date|PO\-Revision\-Date|MIME\-Version|Content\-Type|Content\-Transfer\-Encoding)\>" color cyan "\<(POT-Creation-Date|PO-Revision-Date|MIME-Version|Content-Type|Content-Transfer-Encoding)\>"
# Encodings and numbers. # Encodings and numbers.
color yellow "\<(UTF|ISO|Windows|Mac|IBM)-[0-9]+" color yellow "\<(UTF|ISO|Windows|Mac|IBM)-[0-9]+"
color yellow "\<((pre|rc)?[0-9]+|[0-9]bit)\>" color yellow "\<((pre|rc)?[0-9]+|[0-9]bit)\>"
@ -24,6 +24,6 @@ color brightmagenta "%([1-9]\$)?[a-z]*"
color yellow "\"" color yellow "\""
color cyan "\\([abcefnrtv"\]|x[0-9abcdefABCDEF]{2}|[0-7]{3})" color cyan "\\([abcefnrtv"\]|x[0-9abcdefABCDEF]{2}|[0-7]{3})"
# Reminders. # Reminders.
color brightwhite,yellow "(FIXME|TODO|XXX)" color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
# Obsolete strings. # Obsolete strings.
color red "#~.*" color red "#~.*"

View File

@ -34,7 +34,7 @@ color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
color brightgreen start=""""([^"),]|$)" end="(^|[^(\])"""" color brightgreen start=""""([^"),]|$)" end="(^|[^(\])""""
# Reminders. # Reminders.
color brightwhite,yellow "(FIXME|TODO|XXX)" color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
# Trailing whitespace. # Trailing whitespace.
color ,green "[[:space:]]+$" color ,green "[[:space:]]+$"

View File

@ -34,4 +34,4 @@ color brightcyan "##[^{].*" "##$"
# "Here" docs. # "Here" docs.
color green start="<<-?'?EOT'?" end="^EOT" color green start="<<-?'?EOT'?" end="^EOT"
# Some common markers. # Some common markers.
color brightcyan "(XXX|TODO|FIXME|\?\?\?)" color brightcyan "XXX|TODO|FIXME|\?\?\?"

View File

@ -35,4 +35,4 @@ color blue start="/\*" end="\*/"
color magenta start="#!\[" end="\]" color magenta start="#!\[" end="\]"
# Some common markers # Some common markers
color brightcyan "(XXX|TODO|FIXME|\?\?\?)" color brightcyan "XXX|TODO|FIXME|\?\?\?"

View File

@ -12,8 +12,8 @@ color green "\<string (bytelength|compare|equal|first|index|is|last|length|map|m
# Extended TclX [info commands]: # Extended TclX [info commands]:
color green "\<(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\>" color green "\<(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\>"
# Syntax: # Syntax:
color brightblue "proc[[:space:]]" "(\{|\})" color brightblue "\<proc[[:space:]]|\{|\}"
color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)" color green "\(|\)|\;|`|\\|\$|<|>|!|=|&|\|"
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
color brightred "\$\{?[0-9A-Za-z_!@#$*?-]+\}?" color brightred "\$\{?[0-9A-Za-z_!@#$*?-]+\}?"
# Trailing whitespace: # Trailing whitespace: