Skip to content

Commit 7c6717c

Browse files
committed
Fix infinite loop while php-syntax-propertize-hash-line-comment in last line
1 parent 3beeb57 commit 7c6717c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lisp/php-mode.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,14 +1013,17 @@ 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 in-last-line)
1017+
(while (and (< (point) (min end (point-max)))
1018+
(not in-last-line))
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 ">")))
1023-
(move-beginning-of-line 2)))))
1025+
(move-beginning-of-line 2)
1026+
(setq in-last-line (>= line-end (point)))))))
10241027

10251028
(defun php-heredoc-syntax ()
10261029
"Mark the boundaries of searched heredoc."

0 commit comments

Comments
 (0)