Variable: ruby-syntax-methods-before-regexp

ruby-syntax-methods-before-regexp is a variable defined in ruby-mode.el.gz.

Value

("gsub" "gsub!" "sub" "sub!" "scan" "split" "split!" "index" "match" "assert_match" "Given" "Then" "When")

Documentation

Methods that can take regexp as the first argument.

It will be properly highlighted even when the call omits parens.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-mode.el.gz
(eval-and-compile
  (defconst ruby-percent-literal-beg-re
    "\\(%\\)[qQrswWxIi]?\\([[:punct:]]\\)"
    "Regexp to match the beginning of percent literal.")

  (defconst ruby-syntax-methods-before-regexp
    '("gsub" "gsub!" "sub" "sub!" "scan" "split" "split!" "index" "match"
      "assert_match" "Given" "Then" "When")
    "Methods that can take regexp as the first argument.
It will be properly highlighted even when the call omits parens.")

  (defvar ruby-syntax-before-regexp-re
    (concat
     ;; Special tokens that can't be followed by a division operator.
     "\\(^\\|[[{|=(,~;<>!]"
     ;; Distinguish ternary operator tokens.
     ;; FIXME: They don't really have to be separated with spaces.
     "\\|[?:] "
     ;; Control flow keywords and operators following bol or whitespace.
     "\\|\\(?:^\\|\\s \\)"
     (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and"
                   "or" "not" "&&" "||"))
     ;; Method name from the list.
     "\\|\\_<"
     (regexp-opt ruby-syntax-methods-before-regexp)
     "\\)\\s *")
    "Regexp to match text that can be followed by a regular expression."))