Skip to content

Commit 6c15f8e

Browse files
committed
Fix infinite loop while php-syntax-propertize-hash-line-comment in last line
1 parent c2616f0 commit 6c15f8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

php-mode.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,13 +1013,16 @@ this ^ lineup"
10131013
(defun php-syntax-propertize-hash-line-comment (_start end)
10141014
"Apply propertize # comment (without PHP8 Attributes) from START to END."
10151015
(unless php-mode-use-php7-syntax-table
1016-
(while (< (point) (min end (point-max)))
1017-
(let ((line-end (line-end-position)))
1016+
(let (line-end last-pos)
1017+
(while (and (< (point) (min end (point-max)))
1018+
(not (eq (point) last-pos)))
1019+
(setq line-end (line-end-position))
10181020
(when (and (search-forward "#" line-end t)
10191021
(not (php-in-string-or-comment-p))
10201022
(not (looking-at "[[]")))
10211023
(c-put-char-property (1- (point)) 'syntax-table (string-to-syntax "<"))
10221024
(c-put-char-property line-end 'syntax-table (string-to-syntax ">")))
1025+
(setq last-pos (point))
10231026
(move-beginning-of-line 2)))))
10241027

10251028
(defun php-heredoc-syntax ()

0 commit comments

Comments
 (0)