diff options
Diffstat (limited to '.emacs.d/lisp/php-mode.el')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 154 |
1 files changed, 122 insertions, 32 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 9be3b55..faf2ec5 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -9,16 +9,13 @@ | |||
| 9 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> | 9 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> |
| 10 | ;; URL: https://github.com/emacs-php/php-mode | 10 | ;; URL: https://github.com/emacs-php/php-mode |
| 11 | ;; Keywords: languages php | 11 | ;; Keywords: languages php |
| 12 | ;; Version: 1.21.4 | 12 | ;; Version: 1.22.1 |
| 13 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) | 13 | ;; Package-Requires: ((emacs "24.3")) |
| 14 | ;; License: GPL-3.0-or-later | 14 | ;; License: GPL-3.0-or-later |
| 15 | 15 | ||
| 16 | (defconst php-mode-version-number "1.21.4" | 16 | (defconst php-mode-version-number "1.22.1" |
| 17 | "PHP Mode version number.") | 17 | "PHP Mode version number.") |
| 18 | 18 | ||
| 19 | (defconst php-mode-modified "2019-05-29" | ||
| 20 | "PHP Mode build date.") | ||
| 21 | |||
| 22 | ;; This program is free software; you can redistribute it and/or modify | 19 | ;; This program is free software; you can redistribute it and/or modify |
| 23 | ;; it under the terms of the GNU General Public License as published by | 20 | ;; it under the terms of the GNU General Public License as published by |
| 24 | ;; the Free Software Foundation, either version 3 of the License, or | 21 | ;; the Free Software Foundation, either version 3 of the License, or |
| @@ -195,7 +192,10 @@ of constants when set." | |||
| 195 | :type 'boolean) | 192 | :type 'boolean) |
| 196 | 193 | ||
| 197 | (defcustom php-mode-page-delimiter | 194 | (defcustom php-mode-page-delimiter |
| 198 | (eval-when-compile (rx symbol-start (or "namespace" "function" "class" "trait" "interface") symbol-end)) | 195 | (eval-when-compile |
| 196 | (rx symbol-start | ||
| 197 | (or "namespace" "function" "class" "trait" "interface") | ||
| 198 | symbol-end)) | ||
| 199 | "Regexp describing line-beginnings that PHP declaration statements." | 199 | "Regexp describing line-beginnings that PHP declaration statements." |
| 200 | :group 'php-mode | 200 | :group 'php-mode |
| 201 | :tag "PHP Mode Page Delimiter" | 201 | :tag "PHP Mode Page Delimiter" |
| @@ -307,7 +307,7 @@ This variable can take one of the following symbol values: | |||
| 307 | `PSR-2' - use coding styles preferred for working with projects using PSR-2 standards." | 307 | `PSR-2' - use coding styles preferred for working with projects using PSR-2 standards." |
| 308 | :group 'php-mode | 308 | :group 'php-mode |
| 309 | :tag "PHP Mode Coding Style" | 309 | :tag "PHP Mode Coding Style" |
| 310 | :type '(choice (const :tag "Default" default) | 310 | :type '(choice (const :tag "Default" php) |
| 311 | (const :tag "PEAR" pear) | 311 | (const :tag "PEAR" pear) |
| 312 | (const :tag "Drupal" drupal) | 312 | (const :tag "Drupal" drupal) |
| 313 | (const :tag "WordPress" wordpress) | 313 | (const :tag "WordPress" wordpress) |
| @@ -340,15 +340,27 @@ In that case set to `NIL'." | |||
| 340 | "When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')." | 340 | "When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')." |
| 341 | :group 'php-mode | 341 | :group 'php-mode |
| 342 | :tag "PHP Mode Disable C Mode Hook" | 342 | :tag "PHP Mode Disable C Mode Hook" |
| 343 | :type 'boolean | 343 | :type 'boolean) |
| 344 | :group 'php-mode) | 344 | |
| 345 | (defcustom php-mode-enable-project-local-variable t | ||
| 346 | "When set to `T', apply project local variable to buffer local variable." | ||
| 347 | :group 'php-mode | ||
| 348 | :tag "PHP Mode Enable Project Local Variable" | ||
| 349 | :type 'boolean) | ||
| 345 | 350 | ||
| 346 | (defun php-mode-version () | 351 | (defun php-mode-version () |
| 347 | "Display string describing the version of PHP Mode." | 352 | "Display string describing the version of PHP Mode." |
| 348 | (interactive) | 353 | (interactive) |
| 349 | (funcall | 354 | (let ((fmt |
| 350 | (if (called-interactively-p 'interactive) #'message #'format) | 355 | (eval-when-compile |
| 351 | "PHP Mode %s of %s" php-mode-version-number php-mode-modified)) | 356 | (let ((id "$Id$")) |
| 357 | (concat "PHP Mode %s" | ||
| 358 | (if (string= id (concat [?$ ?I ?d ?$])) | ||
| 359 | "" | ||
| 360 | (concat " " id))))))) | ||
| 361 | (funcall | ||
| 362 | (if (called-interactively-p 'interactive) #'message #'format) | ||
| 363 | fmt php-mode-version-number))) | ||
| 352 | 364 | ||
| 353 | ;;;###autoload | 365 | ;;;###autoload |
| 354 | (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") | 366 | (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") |
| @@ -633,10 +645,37 @@ might be to handle switch and goto labels differently." | |||
| 633 | (c-lang-defconst c-opt-<>-sexp-key | 645 | (c-lang-defconst c-opt-<>-sexp-key |
| 634 | php nil) | 646 | php nil) |
| 635 | 647 | ||
| 648 | (defconst php-mode--re-return-typed-closure | ||
| 649 | (eval-when-compile | ||
| 650 | (rx symbol-start "function" symbol-end | ||
| 651 | (* (syntax whitespace)) | ||
| 652 | "(" (* (not (any "("))) ")" | ||
| 653 | (* (syntax whitespace)) | ||
| 654 | (? symbol-start "use" symbol-end | ||
| 655 | (* (syntax whitespace)) | ||
| 656 | "(" (* (not (any "("))) ")" | ||
| 657 | (* (syntax whitespace))) | ||
| 658 | ":" (+ (not (any "{}"))) | ||
| 659 | (group "{")))) | ||
| 660 | |||
| 661 | (defun php-c-lineup-arglist (langelem) | ||
| 662 | "Line up the current argument line under the first argument using `c-lineup-arglist' LANGELEM." | ||
| 663 | (let (in-return-typed-closure) | ||
| 664 | (when (and (consp langelem) | ||
| 665 | (eq 'arglist-cont-nonempty (car langelem))) | ||
| 666 | (save-excursion | ||
| 667 | (save-match-data | ||
| 668 | (when (re-search-backward php-mode--re-return-typed-closure (cdr langelem) t) | ||
| 669 | (goto-char (match-beginning 1)) | ||
| 670 | (when (not (php-in-string-or-comment-p)) | ||
| 671 | (setq in-return-typed-closure t)))))) | ||
| 672 | (unless in-return-typed-closure | ||
| 673 | (c-lineup-arglist langelem)))) | ||
| 674 | |||
| 636 | (defun php-lineup-cascaded-calls (langelem) | 675 | (defun php-lineup-cascaded-calls (langelem) |
| 637 | "Line up chained methods using `c-lineup-cascaded-calls', | 676 | "Line up chained methods using `c-lineup-cascaded-calls', |
| 638 | but only if the setting is enabled" | 677 | but only if the setting is enabled" |
| 639 | (if php-lineup-cascaded-calls | 678 | (when php-mode-lineup-cascaded-calls |
| 640 | (c-lineup-cascaded-calls langelem))) | 679 | (c-lineup-cascaded-calls langelem))) |
| 641 | 680 | ||
| 642 | (c-add-style | 681 | (c-add-style |
| @@ -644,11 +683,12 @@ but only if the setting is enabled" | |||
| 644 | `((c-basic-offset . 4) | 683 | `((c-basic-offset . 4) |
| 645 | (c-offsets-alist . ((arglist-close . php-lineup-arglist-close) | 684 | (c-offsets-alist . ((arglist-close . php-lineup-arglist-close) |
| 646 | (arglist-cont . (first php-lineup-cascaded-calls 0)) | 685 | (arglist-cont . (first php-lineup-cascaded-calls 0)) |
| 647 | (arglist-cont-nonempty . (first php-lineup-cascaded-calls c-lineup-arglist)) | 686 | (arglist-cont-nonempty . (first php-lineup-cascaded-calls php-c-lineup-arglist)) |
| 648 | (arglist-intro . php-lineup-arglist-intro) | 687 | (arglist-intro . php-lineup-arglist-intro) |
| 649 | (case-label . +) | 688 | (case-label . +) |
| 650 | (class-open . 0) | 689 | (class-open . 0) |
| 651 | (comment-intro . 0) | 690 | (comment-intro . 0) |
| 691 | (inexpr-class . 0) | ||
| 652 | (inlambda . 0) | 692 | (inlambda . 0) |
| 653 | (inline-open . 0) | 693 | (inline-open . 0) |
| 654 | (namespace-open . 0) | 694 | (namespace-open . 0) |
| @@ -661,6 +701,7 @@ but only if the setting is enabled" | |||
| 661 | (tab-width . ,(default-value 'tab-width)) | 701 | (tab-width . ,(default-value 'tab-width)) |
| 662 | (fill-column . ,(default-value 'fill-column)) | 702 | (fill-column . ,(default-value 'fill-column)) |
| 663 | (show-trailing-whitespace . ,(default-value 'show-trailing-whitespace)) | 703 | (show-trailing-whitespace . ,(default-value 'show-trailing-whitespace)) |
| 704 | (php-mode-lineup-cascaded-calls . t) | ||
| 664 | (php-style-delete-trailing-whitespace . nil))) | 705 | (php-style-delete-trailing-whitespace . nil))) |
| 665 | 706 | ||
| 666 | (defun php-enable-default-coding-style () | 707 | (defun php-enable-default-coding-style () |
| @@ -687,6 +728,7 @@ but only if the setting is enabled" | |||
| 687 | (tab-width . 2) | 728 | (tab-width . 2) |
| 688 | (fill-column . 78) | 729 | (fill-column . 78) |
| 689 | (show-trailing-whitespace . t) | 730 | (show-trailing-whitespace . t) |
| 731 | (php-mode-lineup-cascaded-calls . nil) | ||
| 690 | (php-style-delete-trailing-whitespace . t))) | 732 | (php-style-delete-trailing-whitespace . t))) |
| 691 | 733 | ||
| 692 | (defun php-enable-drupal-coding-style () | 734 | (defun php-enable-drupal-coding-style () |
| @@ -713,6 +755,7 @@ but only if the setting is enabled" | |||
| 713 | '("php" | 755 | '("php" |
| 714 | (c-offsets-alist . ((statement-cont . php-lineup-hanging-semicolon))) | 756 | (c-offsets-alist . ((statement-cont . php-lineup-hanging-semicolon))) |
| 715 | (c-indent-comments-syntactically-p . t) | 757 | (c-indent-comments-syntactically-p . t) |
| 758 | (php-mode-lineup-cascaded-calls . nil) | ||
| 716 | (fill-column . 78))) | 759 | (fill-column . 78))) |
| 717 | 760 | ||
| 718 | (defun php-enable-symfony2-coding-style () | 761 | (defun php-enable-symfony2-coding-style () |
| @@ -721,12 +764,13 @@ but only if the setting is enabled" | |||
| 721 | (php-set-style "symfony2")) | 764 | (php-set-style "symfony2")) |
| 722 | 765 | ||
| 723 | (c-add-style | 766 | (c-add-style |
| 724 | "psr2" | 767 | "psr2" ; PSR-2 / PSR-12 |
| 725 | '("php" | 768 | '("php" |
| 726 | (c-offsets-alist . ((statement-cont . +))) | 769 | (c-offsets-alist . ((statement-cont . +))) |
| 727 | (c-indent-comments-syntactically-p . t) | 770 | (c-indent-comments-syntactically-p . t) |
| 728 | (fill-column . 78) | 771 | (fill-column . 78) |
| 729 | (show-trailing-whitespace . t) | 772 | (show-trailing-whitespace . t) |
| 773 | (php-mode-lineup-cascaded-calls . nil) | ||
| 730 | (php-style-delete-trailing-whitespace . t))) | 774 | (php-style-delete-trailing-whitespace . t))) |
| 731 | 775 | ||
| 732 | (defun php-enable-psr2-coding-style () | 776 | (defun php-enable-psr2-coding-style () |
| @@ -734,10 +778,6 @@ but only if the setting is enabled" | |||
| 734 | (interactive) | 778 | (interactive) |
| 735 | (php-set-style "psr2")) | 779 | (php-set-style "psr2")) |
| 736 | 780 | ||
| 737 | (defconst php-beginning-of-defun-regexp | ||
| 738 | "^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" | ||
| 739 | "Regular expression for a PHP function.") | ||
| 740 | |||
| 741 | (defun php-beginning-of-defun (&optional arg) | 781 | (defun php-beginning-of-defun (&optional arg) |
| 742 | "Move to the beginning of the ARGth PHP function from point. | 782 | "Move to the beginning of the ARGth PHP function from point. |
| 743 | Implements PHP version of `beginning-of-defun-function'." | 783 | Implements PHP version of `beginning-of-defun-function'." |
| @@ -1009,6 +1049,14 @@ this ^ lineup" | |||
| 1009 | (easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands" | 1049 | (easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands" |
| 1010 | (cons "PHP" (c-lang-const c-mode-menu php))) | 1050 | (cons "PHP" (c-lang-const c-mode-menu php))) |
| 1011 | 1051 | ||
| 1052 | (defun php-mode-get-style-alist () | ||
| 1053 | "Return an alist consisting of `php' style and styles that inherit it." | ||
| 1054 | (cl-loop for l in c-style-alist | ||
| 1055 | if (or (string= (car l) "php") | ||
| 1056 | (equal (cadr l) "php")) | ||
| 1057 | collect l)) | ||
| 1058 | |||
| 1059 | (defvar php-mode-set-style-history nil) | ||
| 1012 | (defvar-local php-mode--delayed-set-style nil) | 1060 | (defvar-local php-mode--delayed-set-style nil) |
| 1013 | (defvar-local php-style-delete-trailing-whitespace nil) | 1061 | (defvar-local php-style-delete-trailing-whitespace nil) |
| 1014 | 1062 | ||
| @@ -1027,7 +1075,15 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1027 | \"wordpress\" `php-mode-wordpress-hook' | 1075 | \"wordpress\" `php-mode-wordpress-hook' |
| 1028 | \"symfony2\" `php-mode-symfony2-hook' | 1076 | \"symfony2\" `php-mode-symfony2-hook' |
| 1029 | \"psr2\" `php-mode-psr2-hook'" | 1077 | \"psr2\" `php-mode-psr2-hook'" |
| 1030 | (interactive) | 1078 | (interactive |
| 1079 | (list (let ((completion-ignore-case t) | ||
| 1080 | (prompt (format "Which %s indentation style? " | ||
| 1081 | mode-name))) | ||
| 1082 | (completing-read prompt | ||
| 1083 | (php-mode-get-style-alist) | ||
| 1084 | nil t nil | ||
| 1085 | 'php-mode-set-style-history | ||
| 1086 | c-indentation-style)))) | ||
| 1031 | (php-mode--disable-delay-set-style) | 1087 | (php-mode--disable-delay-set-style) |
| 1032 | 1088 | ||
| 1033 | ;; Back up manually set variables | 1089 | ;; Back up manually set variables |
| @@ -1046,13 +1102,11 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1046 | (if (eq (symbol-value 'php-style-delete-trailing-whitespace) t) | 1102 | (if (eq (symbol-value 'php-style-delete-trailing-whitespace) t) |
| 1047 | (add-hook 'before-save-hook 'delete-trailing-whitespace nil t) | 1103 | (add-hook 'before-save-hook 'delete-trailing-whitespace nil t) |
| 1048 | (remove-hook 'before-save-hook 'delete-trailing-whitespace t)) | 1104 | (remove-hook 'before-save-hook 'delete-trailing-whitespace t)) |
| 1049 | (cond ((eq stylename "pear") (run-hooks 'php-mode-pear-hook)) | 1105 | (cond ((equal stylename "pear") (run-hooks 'php-mode-pear-hook)) |
| 1050 | ((eq stylename "drupal") (run-hooks 'php-mode-drupal-hook)) | 1106 | ((equal stylename "drupal") (run-hooks 'php-mode-drupal-hook)) |
| 1051 | ((eq stylename "wordpress") (run-hooks 'php-mode-wordpress-hook)) | 1107 | ((equal stylename "wordpress") (run-hooks 'php-mode-wordpress-hook)) |
| 1052 | ((eq stylename "symfony2") (run-hooks 'php-mode-symfony2-hook)) | 1108 | ((equal stylename "symfony2") (run-hooks 'php-mode-symfony2-hook)) |
| 1053 | ((eq stylename "psr2") (run-hooks 'php-mode-psr2-hook)))) | 1109 | ((equal stylename "psr2") (run-hooks 'php-mode-psr2-hook)))) |
| 1054 | |||
| 1055 | (put 'php-set-style 'interactive-form (interactive-form 'c-set-style)) | ||
| 1056 | 1110 | ||
| 1057 | (defun php-mode--disable-delay-set-style (&rest args) | 1111 | (defun php-mode--disable-delay-set-style (&rest args) |
| 1058 | "Disable php-mode-set-style-delay on after hook. `ARGS' be ignore." | 1112 | "Disable php-mode-set-style-delay on after hook. `ARGS' be ignore." |
| @@ -1069,6 +1123,11 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1069 | (php-set-style (symbol-name coding-style))) | 1123 | (php-set-style (symbol-name coding-style))) |
| 1070 | (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay))))) | 1124 | (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay))))) |
| 1071 | 1125 | ||
| 1126 | (defun php-mode-set-local-variable-delay () | ||
| 1127 | "Set local variable from php-project." | ||
| 1128 | (php-project-apply-local-variables) | ||
| 1129 | (remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay)) | ||
| 1130 | |||
| 1072 | (defvar php-mode-syntax-table | 1131 | (defvar php-mode-syntax-table |
| 1073 | (let ((table (make-syntax-table))) | 1132 | (let ((table (make-syntax-table))) |
| 1074 | (c-populate-syntax-table table) | 1133 | (c-populate-syntax-table table) |
| @@ -1077,7 +1136,7 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1077 | (modify-syntax-entry ?\" "\"" table) | 1136 | (modify-syntax-entry ?\" "\"" table) |
| 1078 | (modify-syntax-entry ?# "< b" table) | 1137 | (modify-syntax-entry ?# "< b" table) |
| 1079 | (modify-syntax-entry ?\n "> b" table) | 1138 | (modify-syntax-entry ?\n "> b" table) |
| 1080 | (modify-syntax-entry ?$ "'" table) | 1139 | (modify-syntax-entry ?$ "_" table) |
| 1081 | table)) | 1140 | table)) |
| 1082 | 1141 | ||
| 1083 | ;;;###autoload | 1142 | ;;;###autoload |
| @@ -1122,6 +1181,9 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1122 | ;; PHP vars are case-sensitive | 1181 | ;; PHP vars are case-sensitive |
| 1123 | (setq case-fold-search t) | 1182 | (setq case-fold-search t) |
| 1124 | 1183 | ||
| 1184 | (when php-mode-enable-project-local-variable | ||
| 1185 | (add-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay t t)) | ||
| 1186 | |||
| 1125 | ;; When php-mode-enable-project-coding-style is set, it is delayed by hook. | 1187 | ;; When php-mode-enable-project-coding-style is set, it is delayed by hook. |
| 1126 | ;; Since it depends on the timing at which the file local variable is set. | 1188 | ;; Since it depends on the timing at which the file local variable is set. |
| 1127 | ;; File local variables are set after initialization of major mode except `run-hook' is complete. | 1189 | ;; File local variables are set after initialization of major mode except `run-hook' is complete. |
| @@ -1440,7 +1502,7 @@ a completion list." | |||
| 1440 | "return" "throws" "var")) | 1502 | "return" "throws" "var")) |
| 1441 | 1503 | ||
| 1442 | (defconst php-phpdoc-font-lock-doc-comments | 1504 | (defconst php-phpdoc-font-lock-doc-comments |
| 1443 | `(("{@[-[:alpha:]]+\\s-\\([^}]*\\)}" ; "{@foo ...}" markup. | 1505 | `(("{@[-[:alpha:]]+\\s-*\\([^}]*\\)}" ; "{@foo ...}" markup. |
| 1444 | (0 'php-doc-annotation-tag prepend nil) | 1506 | (0 'php-doc-annotation-tag prepend nil) |
| 1445 | (1 'php-string prepend nil)) | 1507 | (1 'php-string prepend nil)) |
| 1446 | (,(rx (group "$") (group (in "A-Za-z_") (* (in "0-9A-Za-z_")))) | 1508 | (,(rx (group "$") (group (in "A-Za-z_") (* (in "0-9A-Za-z_")))) |
| @@ -1482,6 +1544,9 @@ a completion list." | |||
| 1482 | ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call)) | 1544 | ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call)) |
| 1483 | ("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign)) | 1545 | ("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign)) |
| 1484 | 1546 | ||
| 1547 | ;; Logical operator (!) | ||
| 1548 | ("\\(![^=]\\)" 1 'php-logical-op) | ||
| 1549 | |||
| 1485 | ;; Highlight special variables | 1550 | ;; Highlight special variables |
| 1486 | ("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this)) | 1551 | ("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this)) |
| 1487 | ("\\(\\$+\\)\\(\\sw+\\)" (1 'php-variable-sigil) (2 'php-variable-name)) | 1552 | ("\\(\\$+\\)\\(\\sw+\\)" (1 'php-variable-sigil) (2 'php-variable-name)) |
| @@ -1517,7 +1582,14 @@ a completion list." | |||
| 1517 | ;; Highlight static method calls as such. This is necessary for method | 1582 | ;; Highlight static method calls as such. This is necessary for method |
| 1518 | ;; names which are identical to keywords to be highlighted correctly. | 1583 | ;; names which are identical to keywords to be highlighted correctly. |
| 1519 | ("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call) | 1584 | ("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call) |
| 1520 | 1585 | ;; Multiple catch (FooException | BarException $e) | |
| 1586 | (,(rx symbol-start "catch" symbol-end | ||
| 1587 | (* (syntax whitespace)) "(" (* (syntax whitespace)) | ||
| 1588 | (group (+ (or (syntax word) (syntax symbol))))) | ||
| 1589 | (1 font-lock-type-face) | ||
| 1590 | (,(rx (* (syntax whitespace)) "|" (* (syntax whitespace)) | ||
| 1591 | (group (+ (or (syntax word) (syntax symbol))) symbol-end)) | ||
| 1592 | nil nil (1 font-lock-type-face))) | ||
| 1521 | ;; While c-opt-cpp-* highlights the <?php opening tags, it is not | 1593 | ;; While c-opt-cpp-* highlights the <?php opening tags, it is not |
| 1522 | ;; possible to make it highlight short open tags and closing tags | 1594 | ;; possible to make it highlight short open tags and closing tags |
| 1523 | ;; as well. So we force the correct face on all cases that | 1595 | ;; as well. So we force the correct face on all cases that |
| @@ -1542,6 +1614,8 @@ a completion list." | |||
| 1542 | ;; is usually overkill. | 1614 | ;; is usually overkill. |
| 1543 | `( | 1615 | `( |
| 1544 | ("\\<\\(@\\)" 1 'php-errorcontrol-op) | 1616 | ("\\<\\(@\\)" 1 'php-errorcontrol-op) |
| 1617 | ;; Highlight function calls | ||
| 1618 | ("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call) | ||
| 1545 | ;; Highlight all upper-cased symbols as constant | 1619 | ;; Highlight all upper-cased symbols as constant |
| 1546 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) | 1620 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) |
| 1547 | 1621 | ||
| @@ -1581,7 +1655,23 @@ a completion list." | |||
| 1581 | ("\\?\\(\\(:?\\sw\\|\\s_\\)+\\)\\s-+\\$" 1 font-lock-type-face) | 1655 | ("\\?\\(\\(:?\\sw\\|\\s_\\)+\\)\\s-+\\$" 1 font-lock-type-face) |
| 1582 | ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) | 1656 | ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) |
| 1583 | (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) | 1657 | (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) |
| 1584 | )) | 1658 | |
| 1659 | ;; Assignment operators (=, +=, ...) | ||
| 1660 | ("\\([^=<!>]+?\\([\-+./%]?=\\)[^=<!>]+?\\)" 2 'php-assignment-op) | ||
| 1661 | |||
| 1662 | ;; Comparison operators (==, ===, >=, ...) | ||
| 1663 | ("\\([!=]=\\{1,2\\}[>]?\\|[<>]=?\\)" 1 'php-comparison-op) | ||
| 1664 | |||
| 1665 | ;; Arithmetic operators (+, -, *, **, /, %) | ||
| 1666 | ("\\(?:[A-Za-z0-9[:blank:]]\\)\\([\-+*/%]\\*?\\)\\(?:[A-Za-z0-9[:blank:]]\\)" 1 'php-arithmetic-op) | ||
| 1667 | |||
| 1668 | ;; Increment and Decrement operators (++, --) | ||
| 1669 | ("\\(\-\-\\|\+\+\\)\$\\w+" 1 'php-inc-dec-op) ;; pre inc/dec | ||
| 1670 | ("\$\\w+\\(\-\-\\|\+\+\\)" 1 'php-inc-dec-op) ;; post inc/dec | ||
| 1671 | |||
| 1672 | ;; Logical operators (and, or, &&, ...) | ||
| 1673 | ;; Not operator (!) is defined in "before cc-mode" section above. | ||
| 1674 | ("\\(&&\\|||\\)" 1 'php-logical-op))) | ||
| 1585 | "Detailed highlighting for PHP Mode.") | 1675 | "Detailed highlighting for PHP Mode.") |
| 1586 | 1676 | ||
| 1587 | (defvar php-font-lock-keywords php-font-lock-keywords-3 | 1677 | (defvar php-font-lock-keywords php-font-lock-keywords-3 |
