diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-04 08:41:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-04 08:41:34 +0000 |
commit | 0b9b7d630a55f21387b49b76bb199c0841785d24 (patch) | |
tree | 428c41052e49e6fbf2432da67e1601a18302123c /misc/ruby-mode.el | |
parent | af5a9fd8c2c8e8418661b806844968f42471d778 (diff) |
* misc/ruby-mode.el (ruby-here-doc-beg-re): underscore also is
valid delimiter.
* misc/ruby-mode.el (ruby-here-doc-end-match): must quote
arbitrary string to use as regexp.
* misc/ruby-mode.el (ruby-font-lock-maybe-here-docs): must not
call `ruby-here-doc-end-match' unless `ruby-here-doc-beg-re'
matched.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc/ruby-mode.el')
-rw-r--r-- | misc/ruby-mode.el | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index d07d1da485..f538714f44 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -48,19 +48,15 @@ (defconst ruby-block-end-re "end") (defconst ruby-here-doc-beg-re - (concat "<<\\([-]\\)?\\([a-zA-Z0-9]+\\)\\|" - "<<\\([-]\\)?[\"]\\([^\"]+\\)[\"]\\|" - "<<\\([-]\\)?[']\\([^']+\\)[']")) + "<<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)") (defun ruby-here-doc-end-match () (concat "^" - (if (or (match-string 1) - (match-string 3) - (match-string 5)) - "[ \t]*" nil) - (or (match-string 2) - (match-string 4) - (match-string 6)))) + (if (match-string 1) "[ \t]*" nil) + (regexp-quote + (or (match-string 3) + (match-string 4) + (match-string 5))))) (defconst ruby-delimiter (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\(" @@ -1087,14 +1083,14 @@ balanced expression is found." (beginning-of-line) (forward-line) (setq beg (point))))) - (let ((end-match (ruby-here-doc-end-match))) - (if (and beg + (if (and beg + (let ((end-match (ruby-here-doc-end-match))) (not (re-search-backward end-match beg t)) - (re-search-forward end-match nil t)) - (progn - (set-match-data (list beg (point))) - t) - nil)))) + (re-search-forward end-match nil t))) + (progn + (set-match-data (list beg (point))) + t) + nil))) (defvar ruby-font-lock-keywords |