aboutsummaryrefslogtreecommitdiffstats
path: root/test/indent/ruby.rb
diff options
context:
space:
mode:
authorDmitry Gutov2013-05-19 10:01:23 +0400
committerDmitry Gutov2013-05-19 10:01:23 +0400
commit1a0a0a8a6a7c4cb47bb0d9bb5d3efa281cb70546 (patch)
tree9b1f66299f4384ac3bca1bc4044a2548077aacbb /test/indent/ruby.rb
parentc1a6c0a42021df3d41ba782460965c5cc0ae902c (diff)
downloademacs-1a0a0a8a6a7c4cb47bb0d9bb5d3efa281cb70546.tar.gz
emacs-1a0a0a8a6a7c4cb47bb0d9bb5d3efa281cb70546.zip
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re): Allow to
start at point, so that expansion starting right after opening slash in a regexp is recognized. (ruby-syntax-before-regexp-re): New defvar, extracted from ruby-syntax-propertize-function. Since the value of this regexp is looked up at runtime now, we should be able to turn `ruby-syntax-methods-before-regexp' into a defcustom later. (ruby-syntax-propertize-function): Split regexp matching into two parts, for opening and closing slashes. That allows us to skip over string interpolations and support multiline regexps. Don't call `ruby-syntax-propertize-expansions', instead use another rule for them, which calls `ruby-syntax-propertize-expansion'. (ruby-syntax-propertize-expansions): Move `remove-text-properties' call to `ruby-syntax-propertize-function'. (ruby-syntax-propertize-expansion): Extracted from `ruby-syntax-propertize-expansions'. Handles one expansion. (ruby-syntax-propertize-heredoc): Explicitly call `ruby-syntax-propertize-expansions'. (ruby-syntax-propertize-percent-literal): Leave point right after the percent symbol, so that the expression expansion rule can propertize the contents. * test/automated/ruby-mode-tests.el (ruby-heredoc-highlights-interpolations) (ruby-regexp-skips-over-interpolation) (ruby-regexp-continues-till-end-when-unclosed) (ruby-regexp-can-be-multiline) (ruby-interpolation-inside-percent-literal): New tests. * test/indent/ruby.rb: Add multiline regexp example.
Diffstat (limited to 'test/indent/ruby.rb')
-rw-r--r--test/indent/ruby.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 90c6dcdc65c..853f4dbf992 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -21,6 +21,11 @@ a = asub / aslb + bsub / bslb;
21# Highlight the regexp after "if". 21# Highlight the regexp after "if".
22x = toto / foo if /do bar/ =~ "dobar" 22x = toto / foo if /do bar/ =~ "dobar"
23 23
24# Multiline regexp.
25/bars
26 tees # toots
27 nfoos/
28
24def test1(arg) 29def test1(arg)
25 puts "hello" 30 puts "hello"
26end 31end
@@ -47,6 +52,8 @@ def test2 (arg)
47 case a 52 case a
48 when "a" 53 when "a"
49 6 54 6
55 # Support for this syntax was removed in Ruby 1.9, so we
56 # probably don't need to handle it either.
50 # when "b" : 57 # when "b" :
51 # 7 58 # 7
52 # when "c" : 2 59 # when "c" : 2