diff --git a/lisp/php-face.el b/lisp/php-face.el index 6fade240..1106035c 100644 --- a/lisp/php-face.el +++ b/lisp/php-face.el @@ -145,7 +145,7 @@ :group 'php-faces :tag "PHP Constant") -(defface php-constant-assign '((t (:inherit font-lock-type-face))) +(defface php-constant-assign '((t (:inherit php-constant))) "PHP Mode face used to highlight constant assigning (\"const\" statement)." :group 'php-faces :tag "PHP Constant Assign") diff --git a/lisp/php-mode.el b/lisp/php-mode.el index 407745b3..319e1d2a 100644 --- a/lisp/php-mode.el +++ b/lisp/php-mode.el @@ -496,10 +496,10 @@ PHP does not have an C-like \"enum\" keyword." php nil) (c-lang-defconst c-typeless-decl-kwds - php (append (c-lang-const c-class-decl-kwds) '("function"))) + php (append (c-lang-const c-class-decl-kwds php) '("function" "const"))) (c-lang-defconst c-modifier-kwds - php '("abstract" "const" "final" "static" "case" "readonly")) + php '("abstract" "final" "static" "case" "readonly")) (c-lang-defconst c-protection-kwds "Access protection label keywords in classes." @@ -1396,11 +1396,6 @@ for \\[find-tag] (which see)." ("\\_<\\(?:implements\\|extends\\)\\_>" . 'php-class-declaration-spec) ;; Namespace declaration ("\\_" . 'php-namespace-declaration) - ;; import constant statement - (,(rx symbol-start (group "use" (+ (syntax whitespace)) "const") - (+ (syntax whitespace))) - (1 'php-import-declaration) - (,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign))) ;; import statement ("\\_" . 'php-import-declaration) ;; Class modifiers (abstract, final) @@ -1488,6 +1483,11 @@ for \\[find-tag] (which see)." (+ (syntax whitespace))) (1 'php-import-declaration) (,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-function-name t))) + ;; import constant statement + (,(rx symbol-start (group "use" (+ (syntax whitespace)) "const") + (+ (syntax whitespace))) + (1 'php-import-declaration) + (,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign t))) ;; Highlight function calls ("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call) ;; Highlight all upper-cased symbols as constant diff --git a/tests/lang/doc-comment/comments.php.27.faces b/tests/lang/doc-comment/comments.php.27.faces index b659a0ab..8b3b78e5 100644 --- a/tests/lang/doc-comment/comments.php.27.faces +++ b/tests/lang/doc-comment/comments.php.27.faces @@ -71,7 +71,7 @@ ("\n ") ("const" . php-keyword) (" ") - ("SAMPLE" . font-lock-type-face) + ("SAMPLE" . php-constant-assign) (" ") ("=" . php-assignment-op) (" ") diff --git a/tests/lang/doc-comment/comments.php.faces b/tests/lang/doc-comment/comments.php.faces index c8491911..593bb49e 100644 --- a/tests/lang/doc-comment/comments.php.faces +++ b/tests/lang/doc-comment/comments.php.faces @@ -70,7 +70,7 @@ ("\n ") ("const" . php-keyword) (" ") - ("SAMPLE" . font-lock-type-face) + ("SAMPLE" . php-constant-assign) (" ") ("=" . php-assignment-op) (" ") diff --git a/tests/lang/import/import-constant.php.faces b/tests/lang/import/import-constant.php.faces index bef6797e..015e7494 100644 --- a/tests/lang/import/import-constant.php.faces +++ b/tests/lang/import/import-constant.php.faces @@ -5,25 +5,29 @@ (" ") ("Foo" . font-lock-type-face) (";\n\n") - ("use const" . php-import-declaration) + ("use" . php-import-declaration) (" ") - ("Foo\\" . php-constant-assign) - ("BAR" . font-lock-type-face) + ("const" . php-keyword) + (" ") + ("Foo\\BAR" . php-constant-assign) (";\n") - ("use const" . php-import-declaration) + ("use" . php-import-declaration) (" ") - ("Foo" . font-lock-type-face) - ("\\{BUZ" . php-constant-assign) + ("const" . php-keyword) + (" ") + ("Foo\\{BUZ" . php-constant-assign) (", ") ("BUZBUZ}" . php-constant-assign) (";\n") - ("use const" . php-import-declaration) + ("use" . php-import-declaration) + (" ") + ("const" . php-keyword) (" ") - ("PHP_VERSION" . font-lock-type-face) + ("PHP_VERSION" . php-constant-assign) (";\n\n") ("const" . php-keyword) (" ") - ("FOO" . font-lock-type-face) + ("FOO" . php-constant-assign) (" ") ("=" . php-assignment-op) (" ")