ruby.nanorc (1388B)
1 ## Syntax highlighting for Ruby. 2 3 ## Original author: John M. Gabriele 4 5 syntax ruby "\.rb$" 6 header "^#!.*ruby" 7 magic "Ruby script" 8 comment "#" 9 10 linter ruby -w -c 11 12 # Constants. 13 color brightblue "\<[[:upper:]]+[[:alnum:]_]*|(\$|@|@@)[[:alnum:]_]+" 14 # Reserved words. 15 color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module)\>" 16 color yellow "\<(next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>" 17 # Ruby "symbols". 18 color magenta "([ ]|^):[[:alnum:]_]+\>" 19 # Some unique things we want to stand out. 20 color brightyellow "\<(__FILE__|__LINE__)\>" 21 22 # Regular expressions. 23 color brightmagenta "(/([^/]|\\/)*/|%r\{([^}]|\\\})*\})[iomx]*" 24 # Shell command expansion is in `backticks` or like %x{this}. 25 color brightblue "`[^`]*`|%x\{[^}]*\}" 26 27 # Strings, double-quoted. 28 color green ""([^"]|\\")*"|%[QW]?(\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)" 29 # Expression substitution for inside double-quoted strings, "like #{this}". 30 color brightgreen "#\{[^}]*\}" 31 # Strings, single-quoted. 32 color green "'([^']|\\')*'|%[qw](\{[^}]*\}|\([^)]*\)|<[^>]*>|\[[^]]*\]|\$[^$]*\$|\^[^^]*\^|![^!]*!)" 33 34 # Comments. 35 color cyan "#([^{#].*|$)" 36 color brightcyan "##([^{].*|$)" 37 color cyan start="^=begin\>" end="^=end\>" 38 39 # Some common markers. 40 color brightcyan "XXX|TODO|FIXME|\?\?\?"