aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2021-02-02 03:47:46 +0200
committerDmitry Gutov2021-02-02 03:48:04 +0200
commit83efac64779b0cda1a700d2f82d63a1afa1ac6f4 (patch)
tree623177e0425d79d1461951ca70155a16d5549352
parente38e7b7bc121b96649518e5e986bba23697abc2d (diff)
downloademacs-83efac64779b0cda1a700d2f82d63a1afa1ac6f4.tar.gz
emacs-83efac64779b0cda1a700d2f82d63a1afa1ac6f4.zip
ruby-syntax-propertize: Fix certain cases following ::
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Make sure to backtrack if the "symbols with special characters" rule is aborted because of preceding colon.
-rw-r--r--lisp/progmodes/ruby-mode.el4
-rw-r--r--test/lisp/progmodes/ruby-mode-resources/ruby.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index a8667acb9d5..e7f407b6367 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1869,8 +1869,8 @@ It will be properly highlighted even when the call omits parens.")
1869 ;; Symbols with special characters. 1869 ;; Symbols with special characters.
1870 (":\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)" 1870 (":\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)"
1871 (1 (unless (or 1871 (1 (unless (or
1872 (eq (char-before (match-beginning 0)) ?:) 1872 (nth 8 (syntax-ppss (match-beginning 1)))
1873 (nth 8 (syntax-ppss (match-beginning 1)))) 1873 (eq (char-before (match-beginning 0)) ?:))
1874 (goto-char (match-end 0)) 1874 (goto-char (match-end 0))
1875 (string-to-syntax "_")))) 1875 (string-to-syntax "_"))))
1876 ;; Symbols ending with '=' (bug#42846). 1876 ;; Symbols ending with '=' (bug#42846).
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index 434237cf638..8c698e4fac8 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -108,7 +108,7 @@ foo( # ruby-deep-indent-disabled
108# Multiline regexp. 108# Multiline regexp.
109/bars 109/bars
110 tees # toots 110 tees # toots
111 nfoos/ 111 nfoos::/
112 112
113def test1(arg) 113def test1(arg)
114 puts "hello" 114 puts "hello"