tweaks: fold some regexes together, and trim or improve some comments
Also, trim some whitespace and group one rule better. Also, fix a stray closing parenthesis in the JSON syntax, and add the missing slash to the possible escaped characters. (Reference: https://www.json.org/json-en.html.) Also, improve the ending of multiline strings in the Rust syntax.master
parent
1cd92458e9
commit
0e1d45dc36
|
@ -11,8 +11,8 @@ color brightyellow "\.(ascii|asciz|byte|double|float|hword|int|long|short|single
|
|||
color brightred "^[[:blank:]]*[.0-9A-Za-z_]*:"
|
||||
color brightcyan "^[[:blank:]]*#[[:blank:]]*(define|undef|include|ifn?def|endif|elif|else|if|warning|error)"
|
||||
|
||||
# Strings.
|
||||
color brightyellow "<[^= ]*>|"([^"\]|\\.)*""
|
||||
# Strings and names of included files.
|
||||
color brightyellow ""([^"\]|\\.)*"|<[^= ]*>"
|
||||
|
||||
# Comments.
|
||||
color brightblue "//.*"
|
||||
|
|
|
@ -28,8 +28,7 @@ color brightmagenta "'([^'\]|\\(["'\abfnrtv]|x[0-9A-Fa-f]{1,2}|[0-3]?[0-7]{1,2})
|
|||
# GCC builtins.
|
||||
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
|
||||
# Strings. (In general you will want your strings and comments to come last,
|
||||
# because highlighting rules are applied in the order they are read in.)
|
||||
# Strings and names of included files.
|
||||
color brightyellow ""([^"]|\\")*"" "#[[:blank:]]*include[[:blank:]]*<[^>]+>"
|
||||
|
||||
# Preprocessor directives.
|
||||
|
|
|
@ -13,13 +13,13 @@ color red "^(19|20)[0-9-]{8}"
|
|||
color yellow "<[^>]*@[^>]*>"
|
||||
|
||||
# Command-line options.
|
||||
color cyan "[[:blank:]]-[a-zA-Z\$]" "--[8a-z-]+"
|
||||
color cyan "[[:blank:]]-[a-zA-Z\$]|--[8a-z-]+"
|
||||
# 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.
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
# Key sequences.
|
||||
color brightblue "\^[A-Z^\]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
color brightblue "\^[A-Z^\]|\<M-.|\<F1?[0-9]|(\^|M-)Space"
|
||||
|
||||
# Changed files.
|
||||
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
|
||||
|
|
|
@ -15,5 +15,8 @@ icolor brightred "^[[:blank:]]*((end)?(function|macro)|return)"
|
|||
icolor cyan start="\$(ENV)?\{" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
# Comments.
|
||||
color brightblue "(^|[[:blank:]])#.*"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
|
|
@ -4,17 +4,17 @@ syntax css "\.css$"
|
|||
comment "/*|*/"
|
||||
|
||||
# First make everything red:
|
||||
color brightred "."
|
||||
color brightred "."
|
||||
# Then everything between braces yellow:
|
||||
color brightyellow start="\{" end="\}"
|
||||
color brightyellow start="\{" end="\}"
|
||||
# Then everything after a colon white:
|
||||
color brightwhite start=":" end="([;^{]|$)"
|
||||
color brightwhite start=":" end="([;^{]|$)"
|
||||
|
||||
# Pseudo-classes:
|
||||
color brightcyan ":(active|checked|focus|hover|link|visited|after|before)\>"
|
||||
color brightcyan ":(active|checked|focus|hover|link|visited|after|before)\>"
|
||||
|
||||
# Comments:
|
||||
color brightblue start="/\*" end="\*/"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Syntactic characters:
|
||||
color green ";|:|\{|\}"
|
||||
color green ";|:|\{|\}"
|
||||
|
|
|
@ -30,7 +30,7 @@ color cyan "'[[:alnum:]]+"
|
|||
color green "\<[0-9][0-9A-Fa-f_#.+-]*"
|
||||
|
||||
# Characters / Strings
|
||||
color red "'.'" ""[^"]*""
|
||||
color red "'.'|"[^"]*""
|
||||
|
||||
# Comments
|
||||
color brightblue "--.*"
|
||||
|
|
|
@ -26,6 +26,7 @@ color magenta "\<(break|continue|fallthrough|goto|return)\>"
|
|||
color brightcyan "\<(package|import)\>"
|
||||
|
||||
# Literals.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][0-9A-Fa-f]+)\>"
|
||||
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
||||
|
@ -33,7 +34,6 @@ color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
|
|||
color red "\<[0-9]+i\>"
|
||||
|
||||
# Strings and characters; slightly fuzzy.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
color red ""([^"\]|\\.)*"|'([^'\]|\\.)+'"
|
||||
color red start=""([^"\]|\\.)*\\[[:blank:]]*$" end="^([^"\]|\\.)*""
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ color brightcyan "\<define(-macro|-module|-public|-syntax)?\>"
|
|||
# Quoted symbols
|
||||
color brightyellow "'\<(\w|-)+\>"
|
||||
# Chars
|
||||
color brightmagenta "#\\."
|
||||
color brightmagenta "#\\\w+\>"
|
||||
color brightmagenta "#\\(.|\w+)"
|
||||
# Booleans
|
||||
color brightred "(#t|#f)\>"
|
||||
# Keywords
|
||||
|
|
|
@ -14,7 +14,7 @@ color brightmagenta "".+""
|
|||
# Hex numbers (used as value).
|
||||
color green ":[[:blank:]]*"#[0-9abcdefABCDEF]+""
|
||||
# Escapes.
|
||||
color green "\\\\" "\\"" "\\[bfnrt]" "\\u[0-9abcdefABCDEF]{4})"
|
||||
color green "\\["\/bfnrt]" "\\u[0-9abcdefABCDEF]{4}"
|
||||
# Special words.
|
||||
color green "\<(true|false|null)\>"
|
||||
|
||||
|
|
|
@ -25,8 +25,10 @@ color cyan "(^|[[:blank:]])#.*"
|
|||
# Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Strings and others
|
||||
# Strings
|
||||
color yellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'"
|
||||
|
||||
# Syntactic symbols
|
||||
color green "[][{}():;|`$<>!=&\]"
|
||||
|
||||
# Basic variable names
|
||||
|
|
|
@ -4,7 +4,7 @@ syntax m "\.m$"
|
|||
magic "Objective-C source"
|
||||
comment "//"
|
||||
|
||||
# Stuffs,
|
||||
# Stuffs.
|
||||
color brightwhite "\<[A-Z_][0-9A-Z_]+\>"
|
||||
color green "\<(float|double|BOOL|bool|char|int|short|long|id|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
||||
color green "\<[[:alpha:]_][[:alnum:]_]*_t\>"
|
||||
|
@ -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]|x[0-9A-Fa-f]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||
color brightblack "<[^= ]*>|"([^"\]|\\.)*""
|
||||
color brightblue "@"([^"\]|\\.)*""
|
||||
|
||||
|
|
|
@ -26,5 +26,5 @@ color green "\<(include|inherit|initializer)\>"
|
|||
color yellow "\<(new|ref|mutable|lazy|assert|raise)\>"
|
||||
# Comments:
|
||||
color white start="\(\*" end="\*\)"
|
||||
# Strings: (no multiline handling yet)
|
||||
color brightblack ""[^\"]*""
|
||||
# Strings:
|
||||
color brightblack ""[^"\]*""
|
||||
|
|
|
@ -29,8 +29,8 @@ color normal "'''|""""
|
|||
# Comments.
|
||||
color brightred "(^|[[:blank:]])#.*"
|
||||
# Triple-quoted strings.
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
|
||||
color brightgreen start=""""([^"),]|$)" end="(^|[^(\])""""
|
||||
color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
|
||||
color brightgreen start=""""([^"),]|$)" end="(^|[^(\])""""
|
||||
|
||||
# Reminders.
|
||||
color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
|
||||
|
|
|
@ -23,8 +23,8 @@ color magenta "[A-Z][A-Za-z0-9]+"
|
|||
|
||||
# Strings
|
||||
color green ""([^"]|\\")*""
|
||||
color green start=""([^"]|\\")*\\$" end=".*""
|
||||
## NOTE: This isn't accurate, but matching "#{0,} for the end of the string is too liberal.
|
||||
color green start=""([^"]|\\")*\\$" end="(^|.*[^\])""
|
||||
## Inaccurate, but it's not possible to balance the number of hashes.
|
||||
color green start="r#+"" end=""#+"
|
||||
|
||||
# Comments
|
||||
|
|
|
@ -18,7 +18,7 @@ color green "[][{}():;|`$<>!=&\]"
|
|||
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
|
||||
|
||||
# Short and long options.
|
||||
color brightmagenta "[[:blank:]]-[A-Za-z]\>" "[[:blank:]]--[A-Za-z-]+\>"
|
||||
color brightmagenta "[[:blank:]](-[A-Za-z]|--\<[A-Za-z-]+)\>"
|
||||
|
||||
# Common commands.
|
||||
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"
|
||||
|
|
|
@ -6,10 +6,10 @@ magic "(XML|SGML) (sub)?document"
|
|||
comment "<!--|-->"
|
||||
|
||||
# The entire content of the tag:
|
||||
color green start="<" end=">"
|
||||
color green start="<" end=">"
|
||||
|
||||
# The start and the end of the tag:
|
||||
color cyan "<[^> ]+" ">"
|
||||
color cyan "<[^> ]+" ">"
|
||||
|
||||
# The strings inside the tag:
|
||||
color magenta ""[^"]*""
|
||||
|
@ -19,4 +19,4 @@ color yellow start="<!DOCTYPE" end="[/]?>"
|
|||
color yellow start="<!--" end="-->"
|
||||
|
||||
# Escapes:
|
||||
color red "&[^;]*;"
|
||||
color red "&[^;]*;"
|
||||
|
|
Loading…
Reference in New Issue