@@ -1451,9 +1451,7 @@ for \\[find-tag] (which see)."
1451
1451
1452
1452
; ; Logical operators (and, or, &&, ...)
1453
1453
; ; Not operator (!) is defined in "before cc-mode" section above.
1454
- (" \\ (&&\\ |||\\ )" 1 'php-logical-op )
1455
- ; ; string interpolation ("$var, ${var}, {$var}")
1456
- (php-mode--string-interpolated-variable-font-lock-find 0 nil )))
1454
+ (" \\ (&&\\ |||\\ )" 1 'php-logical-op )))
1457
1455
" Detailed highlighting for PHP Mode." )
1458
1456
1459
1457
(defvar php-font-lock-keywords php-font-lock-keywords-3
@@ -1485,15 +1483,22 @@ The output will appear in the buffer *PHP*."
1485
1483
(defconst php-string-interpolated-variable-regexp
1486
1484
" {\\ $[^}\n \\\\ ]*\\ (?:\\\\ .[^}\n \\\\ ]*\\ )*}\\ |\\ ${\\ sw+}\\ |\\ $\\ sw+" )
1487
1485
1488
- (defun php-mode--string-interpolated-variable-font-lock-find (limit )
1489
- " Apply text-property to LIMIT for string interpolation by font-lock."
1490
- (let (quoted-stuff)
1491
- (while (re-search-forward php-string-interpolated-variable-regexp limit t )
1492
- (setq quoted-stuff (php-in-string-p))
1486
+ (defun php-string-intepolated-variable-font-lock-find (limit )
1487
+ (while (re-search-forward php-string-interpolated-variable-regexp limit t )
1488
+ (let ((quoted-stuff (nth 3 (syntax-ppss ))))
1493
1489
(when (or (eq ?\" quoted-stuff) (eq ?` quoted-stuff))
1494
- (put-text-property (match-beginning 0 ) (match-end 0 ) 'face 'php-variable-name ))))
1490
+ (put-text-property (match-beginning 0 ) (match-end 0 )
1491
+ 'face 'php-variable-name ))))
1495
1492
nil )
1493
+
1494
+ (eval-after-load 'php-mode
1495
+ '(progn
1496
+ (font-lock-add-keywords
1497
+ 'php-mode
1498
+ `((php-string-intepolated-variable-font-lock-find))
1499
+ 'append )))
1496
1500
1501
+
1497
1502
; ;; Correct the behavior of `delete-indentation' by modifying the
1498
1503
; ;; logic of `fixup-whitespace' .
1499
1504
(defun php-mode--fixup-whitespace-after ()
0 commit comments