[前][次][番号順一覧][スレッド一覧]

ruby-changes:43185

From: nobu <ko1@a...>
Date: Thu, 2 Jun 2016 16:51:42 +0900 (JST)
Subject: [ruby-changes:43185] nobu:r55259 (trunk): ruby-mode.el: squiggly heredoc

nobu	2016-06-02 16:51:36 +0900 (Thu, 02 Jun 2016)

  New Revision: 55259

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55259

  Log:
    ruby-mode.el: squiggly heredoc
    
    * misc/ruby-mode.el (ruby-here-doc-beg-re),
      (ruby-here-doc-beg-match, ruby-parse-partial): Support for
      `squiggly heredoc' syntax in ruby-mode.  [Fix GH-1372]

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-mode.el
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 55258)
+++ misc/ruby-mode.el	(revision 55259)
@@ -107,7 +107,7 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L107
 (defconst ruby-block-end-re "\\_<end\\_>")
 
 (defconst ruby-here-doc-beg-re
-  "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
+  "\\(<\\)<\\([-~]\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
 
 (defconst ruby-here-doc-end-re
   "^\\([ \t]+\\)?\\(.*\\)\\(.\\)$")
@@ -127,9 +127,9 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L127
     (concat "<<"
             (let ((match (match-string 1)))
               (if (and match (> (length match) 0))
-                  (concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
+                  (concat "\\(?:[-~]\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
                           contents "\\(\\1\\|\\2\\)")
-                (concat "-?\\([\"']\\|\\)" contents "\\1"))))))
+                (concat "[-~]?\\([\"']\\|\\)" contents "\\1"))))))
 
 (defconst ruby-delimiter
   (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\_<\\("
@@ -679,7 +679,7 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L679
        ((looking-at "<<")
         (cond
          ((and (ruby-expr-beg 'heredoc)
-               (looking-at "<<\\(-\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\(?:\\sw\\|\\s_\\)+\\)"))
+               (looking-at "<<\\([-~]\\)?\\(\\([\"'`]\\)\\([^\n]+?\\)\\3\\|\\(?:\\sw\\|\\s_\\)+\\)"))
           (setq re (regexp-quote (or (match-string 4) (match-string 2))))
           (if (match-beginning 1) (setq re (concat "\\s *" re)))
           (let* ((id-end (goto-char (match-end 0)))
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55258)
+++ ChangeLog	(revision 55259)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun  2 16:51:35 2016  Koichi ITO  <koic.ito@g...>
+
+	* misc/ruby-mode.el (ruby-here-doc-beg-re),
+	  (ruby-here-doc-beg-match, ruby-parse-partial): Support for
+	  `squiggly heredoc' syntax in ruby-mode.  [Fix GH-1372]
+
 Thu Jun  2 10:24:48 2016  Martin Duerst  <duerst@i...>
 
 	* string.c: Raise ArgumentError when invalid string is detected in

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]