Variable: ruby-font-lock-keywords
ruby-font-lock-keywords is a variable defined in ruby-mode.el.gz.
Value
Large value
(("^\\s *def\\s +\\(?:[^( \n.]*\\.\\)?\\([^( \n]+\\)" 1
font-lock-function-name-face)
("\\(?:^\\|[^.@$:]\\|\\.\\.\\)\\_<\\(a\\(?:lias\\|nd\\)\\|b\\(?:egin\\|reak\\)\\|c\\(?:ase\\|lass\\)\\|d\\(?:ef\\(?:ined\\?\\)?\\|o\\)\\|e\\(?:ls\\(?:e\\|if\\)\\|n\\(?:d\\|sure\\)\\)\\|f\\(?:ail\\|or\\)\\|i[fn]\\|module\\|n\\(?:\\(?:ex\\|o\\)t\\)\\|or\\|re\\(?:do\\|scue\\|t\\(?:ry\\|urn\\)\\)\\|s\\(?:elf\\|uper\\)\\|then\\|un\\(?:def\\|less\\|til\\)\\|wh\\(?:en\\|ile\\)\\|yield\\)\\_>"
(1 font-lock-keyword-face))
("\\(?:^\\|[^.@$:]\\|\\.\\.\\)\\_<\\(a\\(?:lias_method\\|t\\(?:_exit\\|tr\\(?:_\\(?:\\(?:accesso\\|\\(?:read\\|writ\\)e\\)r\\)\\)?\\)\\|utoload\\??\\)\\|ca\\(?:llcc\\|tch\\)\\|define_method\\|e\\(?:val\\|x\\(?:ec\\|tend\\)\\)\\|format\\|include\\|l\\(?:ambda\\|o\\(?:ad\\|op\\)\\)\\|module_function\\|open\\|p\\(?:r\\(?:epend\\|i\\(?:ntf\\|vate_c\\(?:lass_method\\|onstant\\)\\)\\|oc\\)\\|u\\(?:blic_c\\(?:lass_method\\|onstant\\)\\|tc\\)\\)?\\|re\\(?:\\(?:fin\\|quir\\(?:e_relativ\\)?\\)e\\)\\|s\\(?:p\\(?:awn\\|rintf\\)\\|ys\\(?:call\\|tem\\)\\)\\|t\\(?:hrow\\|ra\\(?:ce_var\\|p\\)\\)\\|u\\(?:ntrace_var\\|sing\\)\\|warn\\)\\_>"
(1
(unless (looking-at " *\\(?:[]|,.)}=]\\|$\\)")
font-lock-builtin-face)))
("\\(?:^\\|[^.@$:]\\|\\.\\.\\)\\_<\\(__\\(?:\\(?:callee\\|dir\\|method\\)__\\)\\|abort\\|b\\(?:inding\\|lock_given\\?\\)\\|caller\\|exit!?\\|f\\(?:ail\\|ork\\)\\|global_variables\\|local_variables\\|p\\(?:r\\(?:i\\(?:nt\\|vate\\)\\|otected\\)\\|u\\(?:blic\\|ts\\)\\)\\|r\\(?:a\\(?:ise\\|nd\\)\\|eadlines?\\)\\|s\\(?:leep\\|rand\\)\\)\\_>"
(1 font-lock-builtin-face))
("\\(<\\)<\\([~-]\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)"
(0
(when (ruby-verify-heredoc (match-beginning 0))
'font-lock-string-face)))
"\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
("\\(?:^\\|[^.@$:]\\|\\.\\.\\)\\_<\\(nil\\|true\\|false\\)\\_>" 1
font-lock-constant-face)
("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
(0 font-lock-builtin-face))
("\\(^\\|[^:]\\)\\(:@\\{0,2\\}\\(?:\\sw\\|\\s_\\)+\\)"
(2 font-lock-constant-face))
("\\$\\(?:[:\"!@;,/._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|\\(?:ARGV\\|C\\(?:HILD_STATUS\\|LASSPATH\\)\\|DE\\(?:BUG\\|FAULT_\\(?:\\(?:IN\\|OUT\\)PUT\\)\\)\\|E\\(?:NV_JAVA\\|RROR_\\(?:INFO\\|POSITION\\)\\)\\|F\\(?:I\\(?:ELD_SEPARATOR\\|LENAME\\)\\|S\\)\\|I\\(?:GNORECASE\\|NPUT_\\(?:\\(?:LINE_NUMBE\\|RECORD_SEPARATO\\)R\\)\\)\\|JRUBY_\\(?:\\(?:REVI\\|VER\\)SION\\)\\|L\\(?:AST_\\(?:MATCH_INFO\\|PAREN_MATCH\\|READ_LINE\\)\\|OAD\\(?:ED_FEATURES\\|_PATH\\)\\)\\|MATCH\\|NR\\|O\\(?:FS\\|RS\\|UTPUT_\\(?:\\(?:FIEL\\|RECOR\\)D_SEPARATOR\\)\\)\\|P\\(?:ID\\|OSTMATCH\\|R\\(?:EMATCH\\|O\\(?:CESS_ID\\|GRAM_NAME\\)\\)\\)\\|RS\\|SAFE\\|VERBOSE\\|std\\(?:err\\|in\\|out\\)\\)\\_>\\)"
0 font-lock-builtin-face)
("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+" 0 font-lock-variable-name-face)
("\\_<\\([A-Z]+\\(\\w\\|_\\)*\\)" 1
(unless (eq 40 (char-after)) font-lock-type-face))
("\\(?:^\\s *\\|[[{(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+:\\)[^:]"
(1 (progn (forward-char -1) font-lock-constant-face)))
("\\(?:^\\|[^.@$:]\\|\\.\\.\\)\\_<\\(Array\\|Complex\\|Float\\|Hash\\|Integer\\|Rational\\|String\\)\\_>"
(1 font-lock-builtin-face))
(ruby-match-expression-expansion 0 font-lock-variable-name-face t)
("\\(?:^\\|[^[:alnum:]_]\\)\\(!+\\)[^=~]" 1
font-lock-negation-char-face)
("\\?\\\\?\\_<.\\_>" 0 font-lock-string-face)
("\\(?:\\s|\\|/\\)\\([imxo]+\\)" 1
(when
(save-excursion
(let ((state (syntax-ppss (match-beginning 0))))
(and (nth 3 state)
(or (eq (char-after) 47)
(progn (goto-char (nth 8 state)) (looking-at "%r"))))))
font-lock-preprocessor-face)))
Documentation
Additional expressions to highlight in Ruby mode.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/ruby-mode.el.gz
(defconst ruby-font-lock-keywords
`(;; Functions.
("^\\s *def\\s +\\(?:[^( \t\n.]*\\.\\)?\\([^( \t\n]+\\)"
1 font-lock-function-name-face)
;; Keywords.
(,(concat
ruby-font-lock-keyword-beg-re
(regexp-opt
'("alias"
"and"
"begin"
"break"
"case"
"class"
"def"
"defined?"
"do"
"elsif"
"else"
"fail"
"ensure"
"for"
"end"
"if"
"in"
"module"
"next"
"not"
"or"
"redo"
"rescue"
"retry"
"return"
"self"
"super"
"then"
"unless"
"undef"
"until"
"when"
"while"
"yield")
'symbols))
(1 font-lock-keyword-face))
;; Core methods that have required arguments.
(,(concat
ruby-font-lock-keyword-beg-re
(regexp-opt ruby-builtin-methods-with-reqs 'symbols))
(1 (unless (looking-at " *\\(?:[]|,.)}=]\\|$\\)")
font-lock-builtin-face)))
;; Kernel methods that have no required arguments.
(,(concat
ruby-font-lock-keyword-beg-re
(regexp-opt ruby-builtin-methods-no-reqs 'symbols))
(1 font-lock-builtin-face))
;; Here-doc beginnings.
(,ruby-here-doc-beg-re
(0 (when (ruby-verify-heredoc (match-beginning 0))
'font-lock-string-face)))
;; Perl-ish keywords.
"\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
;; Singleton objects.
(,(concat ruby-font-lock-keyword-beg-re
"\\_<\\(nil\\|true\\|false\\)\\_>")
1 font-lock-constant-face)
;; Keywords that evaluate to certain values.
("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
(0 font-lock-builtin-face))
;; Symbols.
("\\(^\\|[^:]\\)\\(:@\\{0,2\\}\\(?:\\sw\\|\\s_\\)+\\)"
(2 font-lock-constant-face))
;; Special globals.
(,(concat "\\$\\(?:[:\"!@;,/._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
(regexp-opt '("LOAD_PATH" "LOADED_FEATURES" "PROGRAM_NAME"
"ERROR_INFO" "ERROR_POSITION"
"FS" "FIELD_SEPARATOR"
"OFS" "OUTPUT_FIELD_SEPARATOR"
"RS" "INPUT_RECORD_SEPARATOR"
"ORS" "OUTPUT_RECORD_SEPARATOR"
"NR" "INPUT_LINE_NUMBER"
"LAST_READ_LINE" "DEFAULT_OUTPUT" "DEFAULT_INPUT"
"PID" "PROCESS_ID" "CHILD_STATUS"
"LAST_MATCH_INFO" "IGNORECASE"
"ARGV" "MATCH" "PREMATCH" "POSTMATCH"
"LAST_PAREN_MATCH" "stdin" "stdout" "stderr"
"DEBUG" "FILENAME" "VERBOSE" "SAFE" "CLASSPATH"
"JRUBY_VERSION" "JRUBY_REVISION" "ENV_JAVA"))
"\\_>\\)")
0 font-lock-builtin-face)
("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
0 font-lock-variable-name-face)
;; Constants.
("\\_<\\([A-Z]+\\(\\w\\|_\\)*\\)"
1 (unless (eq ?\( (char-after)) font-lock-type-face))
;; Ruby 1.9-style symbol hash keys.
("\\(?:^\\s *\\|[[{(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+:\\)[^:]"
(1 (progn (forward-char -1) font-lock-constant-face)))
;; Conversion methods on Kernel.
(,(concat ruby-font-lock-keyword-beg-re
(regexp-opt '("Array" "Complex" "Float" "Hash"
"Integer" "Rational" "String")
'symbols))
(1 font-lock-builtin-face))
;; Expression expansion.
(ruby-match-expression-expansion
0 font-lock-variable-name-face t)
;; Negation char.
("\\(?:^\\|[^[:alnum:]_]\\)\\(!+\\)[^=~]"
1 font-lock-negation-char-face)
;; Character literals.
;; FIXME: Support longer escape sequences.
("\\?\\\\?\\_<.\\_>" 0 font-lock-string-face)
;; Regexp options.
("\\(?:\\s|\\|/\\)\\([imxo]+\\)"
1 (when (save-excursion
(let ((state (syntax-ppss (match-beginning 0))))
(and (nth 3 state)
(or (eq (char-after) ?/)
(progn
(goto-char (nth 8 state))
(looking-at "%r"))))))
font-lock-preprocessor-face))
)
"Additional expressions to highlight in Ruby mode.")