|
15 | 15 | (defconst php-mode-version-number "1.18.4" |
16 | 16 | "PHP Mode version number.") |
17 | 17 |
|
18 | | -(defconst php-mode-modified "2017-12-03" |
| 18 | +(defconst php-mode-modified "2018-01-23" |
19 | 19 | "PHP Mode build date.") |
20 | 20 |
|
21 | 21 | ;; This file is free software; you can redistribute it and/or |
@@ -469,6 +469,9 @@ SYMBOL |
469 | 469 | (c-lang-defconst c-vsemi-status-unknown-p-fn |
470 | 470 | php 'php-c-vsemi-status-unknown-p) |
471 | 471 |
|
| 472 | +(c-lang-defconst c-get-state-before-change-functions |
| 473 | + php nil) |
| 474 | + |
472 | 475 | ;; Make php-mode recognize opening tags as preprocessor macro's. |
473 | 476 | ;; |
474 | 477 | ;; This is a workaround, the tags must be recognized as something |
@@ -951,18 +954,12 @@ this ^ lineup" |
951 | 954 |
|
952 | 955 | (defun php-syntax-propertize-function (start end) |
953 | 956 | "Apply propertize rules from START to END." |
954 | | - ;; (defconst php-syntax-propertize-function |
955 | | - ;; (syntax-propertize-rules |
956 | | - ;; (php-heredoc-start-re (0 (ignore (php-heredoc-syntax)))))) |
957 | | - (goto-char start) |
958 | | - (while (and (< (point) end) |
959 | | - (re-search-forward php-heredoc-start-re end t)) |
960 | | - (php-heredoc-syntax)) |
961 | | - (goto-char start) |
962 | | - (while (re-search-forward "['\"]" end t) |
963 | | - (when (php-in-comment-p) |
964 | | - (c-put-char-property (match-beginning 0) |
965 | | - 'syntax-table (string-to-syntax "_"))))) |
| 957 | + (funcall |
| 958 | + (syntax-propertize-rules |
| 959 | + (php-heredoc-start-re (0 (ignore (php-heredoc-syntax)))) |
| 960 | + ("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) |
| 961 | + ("\\(\'\\)\\(\\\\.\\|[^\'\n\\]\\)*\\(\'\\)" (1 "\"") (3 "\""))) |
| 962 | + start end)) |
966 | 963 |
|
967 | 964 | (defun php-heredoc-syntax () |
968 | 965 | "Mark the boundaries of searched heredoc." |
@@ -1146,18 +1143,13 @@ After setting the stylevars run hooks according to STYLENAME |
1146 | 1143 | (modify-syntax-entry ?_ "_" php-mode-syntax-table) |
1147 | 1144 | (modify-syntax-entry ?` "\"" php-mode-syntax-table) |
1148 | 1145 | (modify-syntax-entry ?\" "\"" php-mode-syntax-table) |
| 1146 | + (modify-syntax-entry ?' "\"" php-mode-syntax-table) |
1149 | 1147 | (modify-syntax-entry ?# "< b" php-mode-syntax-table) |
1150 | 1148 | (modify-syntax-entry ?\n "> b" php-mode-syntax-table) |
1151 | | - (modify-syntax-entry ?$ "'" php-mode-syntax-table) |
1152 | | - |
1153 | | - (set (make-local-variable 'syntax-propertize-via-font-lock) |
1154 | | - '(("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) |
1155 | | - ("\\(\'\\)\\(\\\\.\\|[^\'\n\\]\\)*\\(\'\\)" (1 "\"") (3 "\"")))) |
1156 | 1149 |
|
| 1150 | + (setq-local syntax-propertize-function #'php-syntax-propertize-function) |
1157 | 1151 | (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) |
1158 | 1152 | #'php-syntax-propertize-extend-region) |
1159 | | - (set (make-local-variable 'syntax-propertize-function) |
1160 | | - #'php-syntax-propertize-function) |
1161 | 1153 |
|
1162 | 1154 | (setq imenu-generic-expression php-imenu-generic-expression) |
1163 | 1155 |
|
@@ -1497,8 +1489,8 @@ a completion list." |
1497 | 1489 |
|
1498 | 1490 | (defvar php-phpdoc-font-lock-keywords |
1499 | 1491 | `((,(lambda (limit) |
1500 | | - (c-font-lock-doc-comments "/\\*\\*" limit |
1501 | | - php-phpdoc-font-lock-doc-comments))))) |
| 1492 | + (c-font-lock-doc-comments "/\\*\\*" limit |
| 1493 | + php-phpdoc-font-lock-doc-comments))))) |
1502 | 1494 |
|
1503 | 1495 | (defconst php-font-lock-keywords-1 (c-lang-const c-matchers-1 php) |
1504 | 1496 | "Basic highlighting for PHP Mode.") |
@@ -1539,6 +1531,10 @@ a completion list." |
1539 | 1531 | ("\\b\\(array\\)\\s-+\\$" 1 font-lock-type-face) |
1540 | 1532 | (")\\s-*:\\s-*\\??\\(array\\)\\b" 1 font-lock-type-face) |
1541 | 1533 |
|
| 1534 | + ;; namespaces |
| 1535 | + ("\\(\\([a-zA-Z0-9]+\\\\\\)+[a-zA-Z0-9]+\\|\\(\\\\[a-zA-Z0-9]+\\)+\\)[^:a-zA-Z0-9\\\\]" 1 'font-lock-type-face) |
| 1536 | + ("\\(\\([a-zA-Z0-9]+\\\\\\)+[a-zA-Z0-9]+\\|\\(\\\\[a-zA-Z0-9]+\\)+\\)::" 1 'php-constant) |
| 1537 | + |
1542 | 1538 | ;; Support the ::class constant in PHP5.6 |
1543 | 1539 | ("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-constant))) |
1544 | 1540 |
|
@@ -1679,20 +1675,6 @@ The output will appear in the buffer *PHP*." |
1679 | 1675 | (delete-char 1)))) |
1680 | 1676 |
|
1681 | 1677 | (ad-activate 'fixup-whitespace) |
1682 | | - |
1683 | | -;; Advice `font-lock-fontify-keywords-region' to support namespace |
1684 | | -;; separators in class names. Use word syntax for backslashes when |
1685 | | -;; doing keyword fontification, but not when doing syntactic |
1686 | | -;; fontification because that breaks \ as escape character in strings. |
1687 | | -;; |
1688 | | -;; Special care is taken to restore the original syntax, because we |
1689 | | -;; want \ not to be word for functions like forward-word. |
1690 | | -(defadvice font-lock-fontify-keywords-region (around backslash-as-word activate) |
1691 | | - "Fontify keywords with backslash as word character." |
1692 | | - (let ((old-syntax (string (char-syntax ?\\)))) |
1693 | | - (modify-syntax-entry ?\\ "w") |
1694 | | - ad-do-it |
1695 | | - (modify-syntax-entry ?\\ old-syntax))) |
1696 | 1678 |
|
1697 | 1679 |
|
1698 | 1680 | (defcustom php-class-suffix-when-insert "::" |
|
0 commit comments