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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e5b9d51ae5
commit
452eba30c5
@ -1,3 +1,9 @@
|
|||||||
|
Thu Jun 2 16:51:35 2016 Koichi ITO <koic.ito@gmail.com>
|
||||||
|
|
||||||
|
* 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@it.aoyama.ac.jp>
|
Thu Jun 2 10:24:48 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* string.c: Raise ArgumentError when invalid string is detected in
|
* string.c: Raise ArgumentError when invalid string is detected in
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
(defconst ruby-block-end-re "\\_<end\\_>")
|
(defconst ruby-block-end-re "\\_<end\\_>")
|
||||||
|
|
||||||
(defconst ruby-here-doc-beg-re
|
(defconst ruby-here-doc-beg-re
|
||||||
"\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
|
"\\(<\\)<\\([-~]\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
|
||||||
|
|
||||||
(defconst ruby-here-doc-end-re
|
(defconst ruby-here-doc-end-re
|
||||||
"^\\([ \t]+\\)?\\(.*\\)\\(.\\)$")
|
"^\\([ \t]+\\)?\\(.*\\)\\(.\\)$")
|
||||||
@ -127,9 +127,9 @@
|
|||||||
(concat "<<"
|
(concat "<<"
|
||||||
(let ((match (match-string 1)))
|
(let ((match (match-string 1)))
|
||||||
(if (and match (> (length match) 0))
|
(if (and match (> (length match) 0))
|
||||||
(concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
|
(concat "\\(?:[-~]\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
|
||||||
contents "\\(\\1\\|\\2\\)")
|
contents "\\(\\1\\|\\2\\)")
|
||||||
(concat "-?\\([\"']\\|\\)" contents "\\1"))))))
|
(concat "[-~]?\\([\"']\\|\\)" contents "\\1"))))))
|
||||||
|
|
||||||
(defconst ruby-delimiter
|
(defconst ruby-delimiter
|
||||||
(concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\_<\\("
|
(concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\_<\\("
|
||||||
@ -679,7 +679,7 @@ Emacs to Ruby."
|
|||||||
((looking-at "<<")
|
((looking-at "<<")
|
||||||
(cond
|
(cond
|
||||||
((and (ruby-expr-beg 'heredoc)
|
((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))))
|
(setq re (regexp-quote (or (match-string 4) (match-string 2))))
|
||||||
(if (match-beginning 1) (setq re (concat "\\s *" re)))
|
(if (match-beginning 1) (setq re (concat "\\s *" re)))
|
||||||
(let* ((id-end (goto-char (match-end 0)))
|
(let* ((id-end (goto-char (match-end 0)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user