syntaxes: fold a couple of regexes together, and improve a few comments

This commit is contained in:
Benno Schulenberg 2022-02-16 12:29:14 +01:00
parent a58efa70bc
commit 89bb88e4f5
8 changed files with 17 additions and 18 deletions

View File

@ -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="(\`|[^\])$"

View File

@ -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

View File

@ -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:]]+)(//|#).*"

View File

@ -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.

View File

@ -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:]].*\]"

View File

@ -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 "#([^{#].*|$)"

View File

@ -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:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"

View File

@ -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 ""[^"]*""