2020-04-20 20:15:43 +03:00
|
|
|
## Syntax highlighting for Ruby.
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2018-02-07 13:25:46 +03:00
|
|
|
syntax ruby "\.rb$"
|
2018-08-28 20:47:40 +03:00
|
|
|
header "^#!.*ruby"
|
2017-11-19 13:10:53 +03:00
|
|
|
magic "Ruby script"
|
2016-05-25 23:13:50 +03:00
|
|
|
comment "#"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2020-04-20 20:15:43 +03:00
|
|
|
linter ruby -w -c
|
|
|
|
|
2019-10-27 18:34:06 +03:00
|
|
|
# Constants.
|
|
|
|
color brightblue "\<[A-Z]+[0-9A-Z_a-z]*|(\$|@|@@)[0-9A-Z_a-z]+"
|
2015-02-21 13:34:15 +03:00
|
|
|
# Reserved words.
|
|
|
|
color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>"
|
|
|
|
color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Ruby "symbols".
|
2019-08-17 18:01:19 +03:00
|
|
|
color magenta "([ ]|^):[0-9A-Za-z_]+\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Some unique things we want to stand out.
|
2006-06-01 21:23:28 +04:00
|
|
|
color brightyellow "\<(__FILE__|__LINE__)\>"
|
2021-10-25 13:31:02 +03:00
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Regular expressions.
|
2021-10-25 13:31:02 +03:00
|
|
|
color brightmagenta "(/([^/]|\\/)*/|%r\{([^}]|\\\})*\})[iomx]*"
|
|
|
|
# Shell command expansion is in `backticks` or like %x{this}.
|
|
|
|
color brightblue "`[^`]*`|%x\{[^}]*\}"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Strings, double-quoted.
|
2021-10-25 13:31:02 +03:00
|
|
|
color green ""([^"]|\\")*"" "%[QW]?(\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
|
|
|
|
# Expression substitution for inside double-quoted strings, "like #{this}".
|
2006-06-01 21:23:28 +04:00
|
|
|
color brightgreen "#\{[^}]*\}"
|
2014-05-17 00:21:34 +04:00
|
|
|
# Strings, single-quoted.
|
2021-10-25 13:31:02 +03:00
|
|
|
color green "'([^']|\\')*'" "%[qw](\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)"
|
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Comments.
|
2021-10-25 14:32:10 +03:00
|
|
|
color cyan "#([^{#].*|$)"
|
2021-10-25 13:31:02 +03:00
|
|
|
color brightcyan "##([^{].*|$)"
|
2021-10-25 14:32:10 +03:00
|
|
|
color cyan start="^=begin\>" end="^=end\>"
|
2021-10-25 13:31:02 +03:00
|
|
|
|
2014-05-17 00:21:34 +04:00
|
|
|
# Some common markers.
|
2020-04-21 13:47:08 +03:00
|
|
|
color brightcyan "XXX|TODO|FIXME|\?\?\?"
|