@@ -1442,7 +1442,9 @@ for \\[find-tag] (which see)."
14421442
14431443 ; ; Logical operators (and, or, &&, ...)
14441444 ; ; Not operator (!) is defined in "before cc-mode" section above.
1445- (" \\ (&&\\ |||\\ )" 1 'php-logical-op )))
1445+ (" \\ (&&\\ |||\\ )" 1 'php-logical-op )
1446+ ; ; string interpolation ("$var, ${var}, {$var}")
1447+ (php-mode--string-interpolated-variable-font-lock-find 0 nil )))
14461448 " Detailed highlighting for PHP Mode." )
14471449
14481450(defvar php-font-lock-keywords php-font-lock-keywords-3
@@ -1474,22 +1476,15 @@ The output will appear in the buffer *PHP*."
14741476(defconst php-string-interpolated-variable-regexp
14751477 " {\\ $[^}\n \\\\ ]*\\ (?:\\\\ .[^}\n \\\\ ]*\\ )*}\\ |\\ ${\\ sw+}\\ |\\ $\\ sw+" )
14761478
1477- (defun php-string-intepolated-variable-font-lock-find (limit )
1478- (while (re-search-forward php-string-interpolated-variable-regexp limit t )
1479- (let ((quoted-stuff (nth 3 (syntax-ppss ))))
1479+ (defun php-mode--string-interpolated-variable-font-lock-find (limit )
1480+ " Apply text-property to LIMIT for string interpolation by font-lock."
1481+ (let (quoted-stuff)
1482+ (while (re-search-forward php-string-interpolated-variable-regexp limit t )
1483+ (setq quoted-stuff (php-in-string-p))
14801484 (when (or (eq ?\" quoted-stuff) (eq ?` quoted-stuff))
1481- (put-text-property (match-beginning 0 ) (match-end 0 )
1482- 'face 'php-variable-name ))))
1485+ (put-text-property (match-beginning 0 ) (match-end 0 ) 'face 'php-variable-name ))))
14831486 nil )
1484-
1485- (eval-after-load 'php-mode
1486- '(progn
1487- (font-lock-add-keywords
1488- 'php-mode
1489- `((php-string-intepolated-variable-font-lock-find))
1490- 'append )))
14911487
1492-
14931488; ;; Correct the behavior of `delete-indentation' by modifying the
14941489; ;; logic of `fixup-whitespace' .
14951490(defun php-mode--fixup-whitespace-after ()
0 commit comments