From 6a9399f7fd3ea6f4eaa0c6ceee92308553fadd39 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 21 Jan 2016 00:26:05 +0300 Subject: [PATCH] Support squiggly heredocs in ruby-mode * lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re): Support squiggly heredocs added in Ruby 2.3. * test/indent/ruby.rb: Add squiggly example. --- lisp/progmodes/ruby-mode.el | 2 +- test/indent/ruby.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 53f8a6bb4c0..e3fe315f3bd 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -102,7 +102,7 @@ (eval-and-compile (defconst ruby-here-doc-beg-re - "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" + "\\(<\\)<\\([~-]\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" "Regexp to match the beginning of a heredoc.") (defconst ruby-expression-expansion-re diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index dec6de98605..dfd1c75a679 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb @@ -4,6 +4,10 @@ if something_wrong? # ruby-move-to-block-skips-heredoc end eowarn foo + + foo(<<~squiggly) + end + squiggly end def foo -- 2.39.2