;cperl-mode.el: Do not mistake a left-shift operator for a here-doc.
* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Empty unquoted delimiters for here-documents are now forbidden (Bug#65834). * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-65834): New test. * test/lisp/progmodes/cperl-mode-resources/cperl-bug-65834.pl: new resource with source code from the bug report.
This commit is contained in:
parent
ad02fc212b
commit
330dd51f8b
3 changed files with 23 additions and 2 deletions
|
@ -3973,8 +3973,8 @@ recursive calls in starting lines of here-documents."
|
|||
"\\([^\"'`\n]*\\)" ; 4 + 1
|
||||
"\\4"
|
||||
"\\|"
|
||||
;; Second variant: Identifier or \ID (same as 'ID') or empty
|
||||
"\\\\?\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)?\\)" ; 5 + 1, 6 + 1
|
||||
;; Second variant: Identifier or \ID (same as 'ID')
|
||||
"\\\\?\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\)" ; 5 + 1, 6 + 1
|
||||
;; Do not have <<= or << 30 or <<30 or << $blah.
|
||||
;; "\\([^= \t0-9$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" ; 6 + 1
|
||||
"\\)"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# -*- mode: cperl -*-
|
||||
if ($t->[3]<<5) {
|
||||
return 0;
|
||||
}
|
||||
# comment
|
|
@ -1379,6 +1379,22 @@ as a regex."
|
|||
(forward-line 1))))
|
||||
(cperl-set-style-back))
|
||||
|
||||
(ert-deftest cperl-test-bug-65834 ()
|
||||
"Verify that CPerl mode identifies a left-shift operator.
|
||||
Left-shift and here-documents both use the \"<<\" operator.
|
||||
In the code provided by this bug report, it needs to be
|
||||
detected as left-shift operator."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents (ert-resource-file "cperl-bug-65834.pl"))
|
||||
(funcall cperl-test-mode)
|
||||
(font-lock-ensure)
|
||||
(search-forward "retur") ; leaves point before the "n"
|
||||
(should (equal (get-text-property (point) 'face)
|
||||
font-lock-keyword-face))
|
||||
(search-forward "# comm") ; leaves point before "ent"
|
||||
(should (equal (get-text-property (point) 'face)
|
||||
font-lock-comment-face))))
|
||||
|
||||
(ert-deftest cperl-test-bug-66145 ()
|
||||
"Verify that hashes and arrays are only fontified in code.
|
||||
In strings, comments and POD the syntaxified faces should
|
||||
|
|
Loading…
Add table
Reference in a new issue