diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2012-04-24 12:00:08 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-04-24 12:00:08 -0400 |
commit | 51a8ea2acf100a3a0ab783632c5fbcdb665a2e14 (patch) | |
tree | 7bd18fb78b99187d57975b0d34b236693de4b431 /lisp | |
parent | 85222d4485aaaf5b308859988ac3d06212e6bf3f (diff) | |
download | emacs-51a8ea2acf100a3a0ab783632c5fbcdb665a2e14.tar.gz emacs-51a8ea2acf100a3a0ab783632c5fbcdb665a2e14.tar.bz2 emacs-51a8ea2acf100a3a0ab783632c5fbcdb665a2e14.zip |
* lisp/progmodes/ruby-mode.el: Handle Cucumber defs (bug#6286).
(ruby-syntax-propertize-regexp): New function.
(ruby-syntax-propertize-function): Use it to handle regexp not preceded
by a special keyword.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/progmodes/ruby-mode.el | 20 |
2 files changed, 22 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 03fbfd83255..2328cf99c1a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2012-04-24 Dmitry Gutov <dgutov@yandex.ru> + * progmodes/ruby-mode.el: Handle Cucumber defs (bug#6286). + (ruby-syntax-propertize-regexp): New function. + (ruby-syntax-propertize-function): Use it to handle regexp not preceded + by a special keyword. + * progmodes/ruby-mode.el: Handle general delimited literals (bug#6286). (ruby-syntax-general-delimiters-goto-beg) (ruby-syntax-propertize-general-delimiters): New functions. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 05a4042b67d..8818911159b 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1131,9 +1131,8 @@ See `add-log-current-defun-function'." (nth 3 (syntax-ppss (match-beginning 0)))) (string-to-syntax "\\")))) ;; regexps - ("\\(^\\|[[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)" - (4 "\"/") - (6 "\"/")) + ("\\(^\\|[[=(,~?:;<>]\\|\\(?:^\\|\\s \\)\\(?:if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)?\\s *\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)" + (2 (ruby-syntax-propertize-regexp))) ("^=en\\(d\\)\\_>" (1 "!")) ("^\\(=\\)begin\\_>" (1 "!")) ;; Handle here documents. @@ -1144,6 +1143,21 @@ See `add-log-current-defun-function'." (1 (prog1 "|" (ruby-syntax-propertize-general-delimiters end))))) (point) end)) + (defun ruby-syntax-propertize-regexp () + (let ((syn (string-to-syntax "\"/"))) + (goto-char (match-end 3)) + (if (or + ;; after paren, comma, operator, control flow keyword, + ;; or a method from hardcoded list + (match-beginning 1) + ;; followed by comma or block + (looking-at "[imxo]*\\s *\\(?:,\\|\\<do\\>\\)")) + (progn + (put-text-property (1- (point)) (point) + 'syntax-table syn) + syn) + (goto-char (match-end 2))))) + (defun ruby-syntax-propertize-heredoc (limit) (let ((ppss (syntax-ppss)) (res '())) |