]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-syntax-propertize: Fix certain cases following ::
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 2 Feb 2021 01:47:46 +0000 (03:47 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 2 Feb 2021 01:48:04 +0000 (03:48 +0200)
* 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.

lisp/progmodes/ruby-mode.el
test/lisp/progmodes/ruby-mode-resources/ruby.rb

index a8667acb9d5c7684854c323858d3ad5055bf3c39..e7f407b6367f99a4ba892d7eed9b7a2d6e6d6444 100644 (file)
@@ -1869,8 +1869,8 @@ It will be properly highlighted even when the call omits parens.")
       ;; Symbols with special characters.
       (":\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)"
        (1 (unless (or
-                   (eq (char-before (match-beginning 0)) ?:)
-                   (nth 8 (syntax-ppss (match-beginning 1))))
+                   (nth 8 (syntax-ppss (match-beginning 1)))
+                   (eq (char-before (match-beginning 0)) ?:))
             (goto-char (match-end 0))
             (string-to-syntax "_"))))
       ;; Symbols ending with '=' (bug#42846).
index 434237cf638af8acda765d25e86bf1ffd3b5e56e..8c698e4fac8097a02cc0304c53b6db5a7a07c3c1 100644 (file)
@@ -108,7 +108,7 @@ foo(                            # ruby-deep-indent-disabled
 # Multiline regexp.
 /bars
  tees # toots
- nfoos/
+ nfoos::/
 
 def test1(arg)
   puts "hello"