diff --git a/php-face.el b/php-face.el index 1e060082..5bd821e5 100644 --- a/php-face.el +++ b/php-face.el @@ -106,6 +106,16 @@ :group 'php-faces :tag "PHP Logical Op") +(defface php-arithmetic-op '((t (:inherit php-operator))) + "PHP Mode face used to arithmetic operators (+, -, %, ...)." + :group 'php-faces + :tag "PHP Arithmetic Op") + +(defface php-inc-dec-op '((t (:inherit php-operator))) + "PHP Mode face used to increment and decremt operators (--, ++)." + :group 'php-faces + :tag "PHP Increment/Decrement Op") + (defface php-string-op '((t (:inherit php-operator))) "PHP Mode face used to logical operators (.)." :group 'php-faces diff --git a/php-mode.el b/php-mode.el index 2477d69f..93e95410 100644 --- a/php-mode.el +++ b/php-mode.el @@ -1543,11 +1543,14 @@ a completion list." ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call)) ("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign)) + ;; Logical operator (!) + ("\\(![^=]\\)" 1 'php-logical-op) + ;; Highlight special variables ("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this)) ("\\(\\$+\\)\\(\\sw+\\)" (1 'php-variable-sigil) (2 'php-variable-name)) ("\\(->\\)\\([a-zA-Z0-9_]+\\)" (1 'php-object-op) (2 'php-property-name)) - + ;; Highlight function/method names ("\\]+?\\([\-+./%]?=\\)[^=]+?\\)" 2 'php-assignment-op) + + ;; Comparison operators (==, ===, >=, ...) + ("\\([!=]=\\{1,2\\}[>]?\\|[<>]=?\\)" 1 'php-comparison-op) + + ;; Arithmetic operators (+, -, *, **, /, %) + ("\\(?:[A-Za-z0-9[:blank:]]\\)\\([\-+*/%]\\*?\\)\\(?:[A-Za-z0-9[:blank:]]\\)" 1 'php-arithmetic-op) + + ;; Increment and Decrement operators (++, --) + ("\\(\-\-\\|\+\+\\)\$\\w+" 1 'php-inc-dec-op) ;; pre inc/dec + ("\$\\w+\\(\-\-\\|\+\+\\)" 1 'php-inc-dec-op) ;; post inc/dec + + ;; Logical operators (and, or, &&, ...) + ;; Not operator (!) is defined in "before cc-mode" section above. + ("\\(&&\\|\|\|\\)" 1 'php-logical-op) )) "Detailed highlighting for PHP Mode.")