mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
; cperl-mode.el: Fix fontification of flip-flop (Bug#72296)
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Prevent a movement of point from bleeding into a following clause. * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-72296): Add a test for the flip-flop operator with code from the report.
This commit is contained in:
parent
fcd4e4c895
commit
c27055a938
@ -4651,7 +4651,7 @@ recursive calls in starting lines of here-documents."
|
||||
(and (eq (preceding-char) ?\})
|
||||
(cperl-after-block-p (point-min)))
|
||||
(and (eq (char-syntax (preceding-char)) ?w)
|
||||
(progn
|
||||
(save-excursion
|
||||
(forward-sexp -1)
|
||||
;; After these keywords `/'
|
||||
;; starts a RE. One should
|
||||
|
@ -1573,6 +1573,23 @@ not appropriate."
|
||||
(should (equal (get-text-property (point) 'face)
|
||||
font-lock-string-face))))))
|
||||
|
||||
(ert-deftest cperl-test-bug-72296 ()
|
||||
"Verify that the perl modes correctly handle the flip-flop operator.
|
||||
Two successive dots are an operator. A slash immediately following them
|
||||
starts a regular expression, if there's another term between the dots
|
||||
and the slash, then we have a division."
|
||||
:tags '(:fontification)
|
||||
;; Code from the bug report. The slash is a division. The following
|
||||
;; number is not a string.
|
||||
(let ((code "for (2..$n/2) { ...; }"))
|
||||
(should (equal (nth 8 (cperl-test-ppss code "/")) nil)))
|
||||
;; This is what the test for two successive dots wants to catch: The
|
||||
;; flip-flop operator. Here, the number is part of a regexp, seen as
|
||||
;; a string.
|
||||
(let ((code "for (2../2/) { ...; }"))
|
||||
(should (equal (nth 8 (cperl-test-ppss code "/")) 9)))
|
||||
)
|
||||
|
||||
(ert-deftest test-indentation ()
|
||||
(ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user