ruby.nanorc 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. ## Here is an example for Ruby.
  2. ##
  3. syntax "ruby" "\.rb$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile"
  4. header "^#!.*/(env +)?ruby( |$)"
  5. ## Asciibetical list of reserved words
  6. color yellow "\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\>"
  7. ## Constants
  8. color brightblue "(\$|@|@@)?\<[A-Z]+[0-9A-Z_a-z]*"
  9. ## Ruby "symbols"
  10. icolor magenta "([ ]|^):[0-9A-Z_]+\>"
  11. ## Some unique things we want to stand out
  12. color brightyellow "\<(__FILE__|__LINE__)\>"
  13. ## Regular expressions
  14. color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
  15. ## Shell command expansion is in `backticks` or like %x{this}. These are
  16. ## "double-quotish" (to use a perlism).
  17. color brightblue "`[^`]*`" "%x\{[^}]*\}"
  18. ## Strings, double-quoted
  19. color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
  20. ## Expression substitution. These go inside double-quoted strings,
  21. ## "like #{this}".
  22. color brightgreen "#\{[^}]*\}"
  23. ## Strings, single-quoted
  24. color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
  25. ## Comments
  26. color cyan "#[^{].*$" "#$"
  27. color brightcyan "##[^{].*$" "##$"
  28. ## "Here" docs
  29. color green start="<<-?'?EOT'?" end="^EOT"
  30. ## Some common markers
  31. color brightcyan "(XXX|TODO|FIXME|\?\?\?)"