* 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.
This commit is contained in:
parent
85222d4485
commit
51a8ea2acf
2 changed files with 22 additions and 3 deletions
|
@ -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.
|
||||
|
|
|
@ -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 '()))
|
||||
|
|
Loading…
Add table
Reference in a new issue