(let ((index-alist '()) (case-fold-search nil)
name next pos decl sing)
(goto-char beg)
- (while (re-search-forward "^\\s *\\(\\(class\\s +\\|\\(class\\s *<<\\s *\\)\\|module\\s +\\)\\([^\(<\n ]+\\)\\|\\(def\\|alias\\)\\s +\\([^\(\n ]+\\)\\)" end t)
+ (while (re-search-forward "^\\s *\\(\\(class\\s +\\|\\(class\\s *<<\\s *\\)\\|module\\s +\\)\\([^(<\n ]+\\)\\|\\(def\\|alias\\)\\s +\\([^(\n ]+\\)\\)" end t)
(setq sing (match-beginning 3))
(setq decl (match-string 5))
(setq next (match-end 0))
(if prefix
(setq name
(cond
- ((string-match "^self\." name)
+ ((string-match "^self\\." name)
(concat (substring prefix 0 -1) (substring name 4)))
(t (concat prefix name)))))
(push (cons name pos) index-alist)
(setq in-string (match-end 0))
(goto-char ruby-indent-point)))
(t
- (error (format "Bad string %s"
- (buffer-substring (point) pnt)
- ))))))
+ (error "Bad string %s" (buffer-substring (point) pnt))))))
(list in-string nest depth pcol))
(defun ruby-parse-region (start end)
(setq content
(if (equal string-quote "\"")
(replace-regexp-in-string "\\\\\"" "\"" (replace-regexp-in-string "\\([^\\\\]\\)'" "\\1\\\\'" content))
- (replace-regexp-in-string "\\\\\'" "'" (replace-regexp-in-string "\\([^\\\\]\\)\"" "\\1\\\\\"" content))))
+ (replace-regexp-in-string "\\\\'" "'" (replace-regexp-in-string "\\([^\\\\]\\)\"" "\\1\\\\\"" content))))
(let ((orig-point (point)))
(delete-region min max)
(insert
(t
(error (concat
"Internal error on `ruby-in-ppss-context-p': "
- "context name `" (symbol-name context) "' is unknown"))))
+ "context name `%s' is unknown")
+ context)))
t)))
(defvar ruby-font-lock-syntax-table
;; Constants.
("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)"
1 (unless (eq ?\( (char-after)) font-lock-type-face))
- ("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]"
- (2 font-lock-constant-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"
;;;###autoload
(add-to-list 'auto-mode-alist
- (cons (purecopy (concat "\\(?:\\."
- "rb\\|ru\\|rake\\|thor"
+ (cons (purecopy (concat "\\(?:\\.\\(?:"
+ "rbw?\\|ru\\|rake\\|thor"
"\\|jbuilder\\|rabl\\|gemspec\\|podspec"
+ "\\)"
"\\|/"
"\\(?:Gem\\|Rake\\|Cap\\|Thor"
"\\|Puppet\\|Berks"